code
stringlengths 3
1.05M
| repo_name
stringlengths 4
116
| path
stringlengths 3
942
| language
stringclasses 30
values | license
stringclasses 15
values | size
int32 3
1.05M
| line_mean
float64 0.5
100
| line_max
int64 1
1k
| alpha_frac
float64 0.25
1
| autogenerated
bool 1
class |
---|---|---|---|---|---|---|---|---|---|
//-----------------------------------------------------------------------
// <copyright file="IDemPlateFileGenerator.cs" company="Microsoft Corporation">
// Copyright (c) Microsoft Corporation 2011. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace Microsoft.Research.Wwt.Sdk.Core
{
/// <summary>
/// Interface for DEM plate file generator.
/// </summary>
public interface IDemPlateFileGenerator
{
/// <summary>
/// Gets the number of processed tiles for the level in context.
/// </summary>
long TilesProcessed { get; }
/// <summary>
/// This function is used to create the plate file from already generated DEM pyramid.
/// </summary>
/// <param name="serializer">
/// DEM tile serializer to retrieve the tile.
/// </param>
void CreateFromDemTile(IDemTileSerializer serializer);
}
}
|
WorldWideTelescope/wwt-tile-sdk
|
Core/IDemPlateFileGenerator.cs
|
C#
|
mit
| 977 | 35.111111 | 94 | 0.530256 | false |
namespace PlacesToEat.Data.Common
{
using System;
using System.Data.Entity;
using System.Linq;
using Contracts;
using Models;
public class DbUserRepository<T> : IDbUserRepository<T>
where T : class, IAuditInfo, IDeletableEntity
{
public DbUserRepository(DbContext context)
{
if (context == null)
{
throw new ArgumentException("An instance of DbContext is required to use this repository.", nameof(context));
}
this.Context = context;
this.DbSet = this.Context.Set<T>();
}
private IDbSet<T> DbSet { get; }
private DbContext Context { get; }
public IQueryable<T> All()
{
return this.DbSet.AsQueryable().Where(x => !x.IsDeleted);
}
public IQueryable<T> AllWithDeleted()
{
return this.DbSet.AsQueryable();
}
public void Delete(T entity)
{
entity.IsDeleted = true;
entity.DeletedOn = DateTime.UtcNow;
}
public T GetById(string id)
{
return this.DbSet.Find(id);
}
public void HardDelete(T entity)
{
this.DbSet.Remove(entity);
}
public void Save()
{
this.Context.SaveChanges();
}
}
}
|
tcholakov/PlacesToEat
|
Source/Data/PlacesToEat.Data.Common/DbUserRepository{T}.cs
|
C#
|
mit
| 1,375 | 22.271186 | 125 | 0.532411 | false |
---
layout: post
title: Java-Interview
category: Java
description: Java 面试
---
一、Java基础
1. String类为什么是final的
2. HashMap的源码,实现原理,底层结构。
3. 说说你知道的几个Java集合类:list、set、queue、map实现类。
4. 描述一下ArrayList和LinkedList各自实现和区别
5. Java中的队列都有哪些,有什么区别。
6. 反射中,Class.forName和classloader的区别。
7. Java7、Java8的新特性
8. Java数组和链表两种结构的操作效率,在哪些情况下(从开头开始,从结尾开始,从中间开始),哪些操作(插入,查找,删除)的效率高。
9. Java内存泄露的问题调查定位:jmap,jstack的使用等等。
10. string、stringbuilder、stringbuffer区别
11. hashtable和hashmap的区别
12 .异常的结构,运行时异常和非运行时异常,各举个例子。
13. String 类的常用方法
16. Java 的引用类型有哪几种
17. 抽象类和接口的区别
18. java的基础类型和字节大小
19. Hashtable,HashMap,ConcurrentHashMap底层实现原理与线程安全问题。
20. 如果不让你用Java Jdk提供的工具,你自己实现一个Map,你怎么做。说了好久,说了HashMap源代码,如果我做,就会借鉴HashMap的原理,说了一通HashMap实现。
21. Hash冲突怎么办?哪些解决散列冲突的方法?
22. HashMap冲突很厉害,最差性能,你会怎么解决?从O(n)提升到log(n)。
23. rehash
24. hashCode() 与 equals() 生成算法、方法怎么重写。
二、Java IO
1. 讲讲IO里面的常见类,字节流、字符流、接口、实现类、方法阻塞。
2. 讲讲NIO
3. String 编码UTF-8 和GBK的区别?
4. 什么时候使用字节流、什么时候使用字符流?
5. 递归读取文件夹下的文件,代码怎么实现?
三、Java Web
1. session和cookie的区别和联系,session的生命周期,多个服务部署时session管理。
2. servlet的一些相关问题
3. webservice相关问题
4. jdbc连接,forname方式的步骤,怎么声明使用一个事务。
5. 无框架下配置web.xml的主要配置内容
6. jsp和servlet的区别
四、JVM
1. Java的内存模型以及GC算法
2. jvm性能调优都做了什么
3. 介绍JVM中7个区域,然后把每个区域可能造成内存的溢出的情况说明。
4. 介绍GC 和GC Root不正常引用
5. 自己从classload 加载方式,加载机制说开去,从程序运行时数据区,讲到内存分配,讲到String常量池,讲到JVM垃圾回收机制,算法,hotspot。
6. jvm 如何分配直接内存, new 对象如何不分配在堆而是栈上,常量池解析。
7. 数组多大放在JVM老年代
8. 老年代中数组的访问方式
9. GC 算法,永久代对象如何 GC , GC 有环怎么处理。
10. 谁会被 GC ,什么时候 GC。
11. 如果想不被 GC 怎么办
12. 如果想在 GC 中生存 1 次怎么办
五、开源框架
1. hibernate和ibatis的区别
2. 讲讲mybatis的连接池
3. spring框架中需要引用哪些jar包,以及这些jar包的用途
4. springMVC的原理
5. springMVC注解的意思
6. spring中beanFactory和ApplicationContext的联系和区别
7. spring注入的几种方式
8. spring如何实现事物管理的
9. springIOC
10. spring AOP的原理
11. hibernate中的1级和2级缓存的使用方式以及区别原理(Lazy-Load的理解)
12. Hibernate的原理体系架构,五大核心接口,Hibernate对象的三种状态转换,事务管理。
六、多线程
1. Java创建线程之后,直接调用start()方法和run()的区别
2. 常用的线程池模式以及不同线程池的使用场景
3. newFixedThreadPool此种线程池如果线程数达到最大值后会怎么办,底层原理。
4. 多线程之间通信的同步问题,synchronized锁的是对象,衍伸出和synchronized相关很多的具体问题,例如同一个类不同方法都有synchronized锁,一个对象是否可以同时访问。或者一个类的static构造方法加上synchronized之后的锁的影响。
5. 了解可重入锁的含义,以及ReentrantLock 和synchronized的区别
6. 同步的数据结构,例如concurrentHashMap的源码理解以及内部实现原理,为什么他是同步的且效率高。
7. atomicinteger和Volatile等线程安全操作的关键字的理解和使用
8. 线程间通信,wait和notify
9. 定时线程的使用
10. 场景:在一个主线程中,要求有大量(很多很多)子线程执行完之后,主线程才执行完成。多种方式,考虑效率。
11. 进程和线程的区别
12. 什么叫线程安全?
13. 线程的几种状态
14. 并发、同步的接口或方法
15. HashMap 是否线程安全,为何不安全。 ConcurrentHashMap,线程安全,为何安全。底层实现是怎么样的。
16. J.U.C下的常见类的使用。 ThreadPool的深入考察; BlockingQueue的使用。(take,poll的区别,put,offer的区别);原子类的实现。
17. 简单介绍下多线程的情况,从建立一个线程开始。然后怎么控制同步过程,多线程常用的方法和结构
18. volatile的理解
19. 实现多线程有几种方式,多线程同步怎么做,说说几个线程里常用的方法。
七、网络通信
1. http是无状态通信,http的请求方式有哪些,可以自己定义新的请求方式么。
2. socket通信,以及长连接,分包,连接异常断开的处理。
3. socket通信模型的使用,AIO和NIO。
4. socket框架netty的使用,以及NIO的实现原理,为什么是异步非阻塞。
5. 同步和异步,阻塞和非阻塞。
6. OSI七层模型,包括TCP,IP的一些基本知识
7. http中,get post的区别
8. 说说http,tcp,udp之间关系和区别。
9. 说说浏览器访问www.taobao.com,经历了怎样的过程。
10. HTTP协议、 HTTPS协议,SSL协议及完整交互过程;
11. tcp的拥塞,快回传,ip的报文丢弃
12. https处理的一个过程,对称加密和非对称加密
13. head各个特点和区别
14. 说说浏览器访问www.taobao.com,经历了怎样的过程。
八、数据库MySql
1. MySql的存储引擎的不同
2. 单个索引、联合索引、主键索引
3. Mysql怎么分表,以及分表后如果想按条件分页查询怎么办
4. 分表之后想让一个id多个表是自增的,效率实现
5. MySql的主从实时备份同步的配置,以及原理(从库读主库的binlog),读写分离。
6. 写SQL语句和SQL优化
7. 索引的数据结构,B+树
8. 事务的四个特性,以及各自的特点(原子、隔离)等等,项目怎么解决这些问题。
9. 数据库的锁:行锁,表锁;乐观锁,悲观锁
10. 数据库事务的几种粒度
11. 关系型和非关系型数据库区别
九、设计模式
1. 单例模式:饱汉、饿汉。以及饿汉中的延迟加载,双重检查。
2. 工厂模式、装饰者模式、观察者模式。
3. 工厂方法模式的优点(低耦合、高内聚,开放封闭原则)
十、算法
1. 使用随机算法产生一个数,要求把1-1000W之间这些数全部生成。
2. 两个有序数组的合并排序
3. 一个数组的倒序
4. 计算一个正整数的正平方根
5. 说白了就是常见的那些查找、排序算法以及各自的时间复杂度。
6. 二叉树的遍历算法
7. DFS,BFS算法
9. 比较重要的数据结构,如链表,队列,栈的基本理解及大致实现。
10. 排序算法与时空复杂度(快排为什么不稳定,为什么你的项目还在用)
11. 逆波兰计算器
12. Hoffman 编码
13. 查找树与红黑树
十一、并发与性能调优
1. 有个每秒钟5k个请求,查询手机号所属地的笔试题,如何设计算法?请求再多,比如5w,如何设计整个系统?
2. 高并发情况下,我们系统是如何支撑大量的请求的
3. 集群如何同步会话状态
4. 负载均衡的原理
5 .如果有一个特别大的访问量,到数据库上,怎么做优化(DB设计,DBIO,SQL优化,Java优化)
6. 如果出现大面积并发,在不增加服务器的基础上,如何解决服务器响应不及时问题“。
7. 假如你的项目出现性能瓶颈了,你觉得可能会是哪些方面,怎么解决问题。
8. 如何查找 造成 性能瓶颈出现的位置,是哪个位置照成性能瓶颈。
9. 你的项目中使用过缓存机制吗?有没用用户非本地缓存
|
cdmaok/cdmaok.github.io
|
_posts/2016-08-31-Java-Interview.md
|
Markdown
|
mit
| 8,780 | 14.654676 | 139 | 0.741268 | false |
describe("Dragable Row Directive ", function () {
var scope, container, element, html, compiled, compile;
beforeEach(module("app", function ($provide) { $provide.value("authService", {}) }));
beforeEach(inject(function ($compile, $rootScope) {
html = '<div id="element-id" data-draggable-row=""'
+ ' data-draggable-elem-selector=".draggable"'
+ ' data-drop-area-selector=".drop-area">'
+ '<div class="draggable"></div>'
+ '<div class="drop-area" style="display: none;"></div>'
+ '</div>';
scope = $rootScope.$new();
compile = $compile;
}));
function prepareDirective(s) {
container = angular.element(html);
compiled = compile(container);
element = compiled(s);
s.$digest();
}
/***********************************************************************************************************************/
it('should add draggable attribute to draggable element, when initialise', function () {
prepareDirective(scope);
expect(element.find('.draggable').attr('draggable')).toBe('true');
});
it('should prevent default, when dragging over allowed element', function () {
prepareDirective(scope);
var event = $.Event('dragover');
event.preventDefault = window.jasmine.createSpy('preventDefault');
event.originalEvent = {
dataTransfer: {
types: {},
getData: window.jasmine.createSpy('getData').and.returnValue("element-id")
}
};
element.trigger(event);
expect(event.preventDefault).toHaveBeenCalled();
});
it('should show drop area, when drag enter allowed element', function () {
prepareDirective(scope);
var event = $.Event('dragenter');
event.originalEvent = {
dataTransfer: {
types: {},
getData: window.jasmine.createSpy('getData').and.returnValue("element-id")
}
};
element.trigger(event);
expect(element.find('.drop-area').css('display')).not.toEqual('none');
expect(event.originalEvent.dataTransfer.getData).toHaveBeenCalledWith('draggedRow');
});
it('should call scope onDragEnd, when dragging ends', function () {
prepareDirective(scope);
var event = $.Event('dragend');
var isolateScope = element.isolateScope();
spyOn(isolateScope, 'onDragEnd');
element.trigger(event);
expect(isolateScope.onDragEnd).toHaveBeenCalled();
});
it('should set drag data and call scope onDrag, when drag starts', function () {
prepareDirective(scope);
var event = $.Event('dragstart');
event.originalEvent = {
dataTransfer: {
setData: window.jasmine.createSpy('setData')
}
};
var isolateScope = element.isolateScope();
spyOn(isolateScope, 'onDrag');
element.find('.draggable').trigger(event);
expect(isolateScope.onDrag).toHaveBeenCalled();
expect(event.originalEvent.dataTransfer.setData).toHaveBeenCalledWith('draggedRow', 'element-id');
});
it('should prevent default, when dragging over allowed drop area', function () {
prepareDirective(scope);
var event = $.Event('dragover');
event.preventDefault = window.jasmine.createSpy('preventDefault');
event.originalEvent = {
dataTransfer: {
types: {},
getData: window.jasmine.createSpy('getData').and.returnValue("element-id")
}
};
element.find('.drop-area').trigger(event);
expect(event.preventDefault).toHaveBeenCalled();
});
it('should show drop area, when drag enter allowed drop area', function () {
prepareDirective(scope);
var event = $.Event('dragenter');
event.originalEvent = {
dataTransfer: {
types: {},
getData: window.jasmine.createSpy('getData').and.returnValue("element-id")
}
};
element.find('.drop-area').trigger(event);
expect(element.find('.drop-area').css('display')).not.toEqual('none');
expect(event.originalEvent.dataTransfer.getData).toHaveBeenCalledWith('draggedRow');
});
it('should hide drop area, when drag leave drop area', function () {
prepareDirective(scope);
var event = $.Event('dragleave');
event.originalEvent = {
dataTransfer: {
types: {},
getData: window.jasmine.createSpy('getData').and.returnValue("element-id")
}
};
element.find('.drop-area').trigger(event);
expect(element.find('.drop-area').css('display')).toEqual('none');
expect(event.originalEvent.dataTransfer.getData).toHaveBeenCalledWith('draggedRow');
});
it('should hide drop area and call scope onDrop, when drop on drop area', function () {
prepareDirective(scope);
var event = $.Event('drop');
event.preventDefault = window.jasmine.createSpy('preventDefault');
event.originalEvent = {
dataTransfer: {
types: {},
getData: window.jasmine.createSpy('getData').and.returnValue("element-id")
}
};
var isolateScope = element.isolateScope();
spyOn(isolateScope, 'onDrop');
element.find('.drop-area').trigger(event);
expect(event.originalEvent.dataTransfer.getData).toHaveBeenCalledWith('draggedRow');
expect(event.preventDefault).toHaveBeenCalled();
expect(element.find('.drop-area').css('display')).toEqual('none');
expect(isolateScope.onDrop).toHaveBeenCalled();
});
});
|
wongatech/remi
|
ReMi.Web/ReMi.Web.UI.Tests/Tests/app/common/directives/draggableRowTests.js
|
JavaScript
|
mit
| 5,831 | 37.615894 | 125 | 0.579317 | false |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Ninject.Modules;
using Ninject.Extensions.Conventions;
namespace SongManager.Web.NinjectSupport
{
/// <summary>
/// Automatically loads all Boot Modules and puts them into the Ninject Dependency Resolver
/// </summary>
public class DependencyBindingsModule : NinjectModule
{
public override void Load()
{
// Bind all BootModules
Kernel.Bind( i => i.FromAssembliesMatching( "SongManager.Web.dll", "SongManager.Web.Core.dll", "SongManager.Web.Data.dll", "SongManager.Core.dll" )
.SelectAllClasses()
.InheritedFrom( typeof( SongManager.Core.Boot.IBootModule ) )
.BindSingleInterface()
);
}
}
}
|
fjeller/ADC2016_Mvc5Sample
|
SongManager/SongManager.Web/NinjectSupport/DependencyBindingsModule.cs
|
C#
|
mit
| 725 | 26.846154 | 150 | 0.733057 | false |
# Amaretti.js
[](https://gitter.im/VincentCasse/amaretti.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](https://travis-ci.org/VincentCasse/amaretti.js.svg)
[](https://coveralls.io/github/VincentCasse/amaretti.js?branch=master)
Amaretti.js is a library to encrypt and decrypt message into the browser. They use native implementation (WebCrypto APIs) when available, or SJCL library when not.
## Getting started
### Installation
This library can be installed with npm or bower, as you prefer:
```bash
bower install amaretti
```
```bash
npm install amaretti
```
### How to use it
Just import the javascript file and require the library. Require system is included into amaretti library
```html
<script src="public/vendor.js"></script>
<script src="public/amaretti.js"></script>
var Amaretti = require('amaretti').init();
```
### Generate a salt
Salt are used into key generation and to randomize the encryption of a message. You can get a base64 salt using this `Amaretti.getSalt()`
```javascript
Amaretti.getSalt().then(function(salt) {
// Manipulate your salt
}, function (error) {
// There was an error
});
```
### Generate a key
To encrypt or decrypt messages, you need to use a key. You can generate a key usable with a passphrase (like a password). Key generated is returned as base64. To randomize the generation, you need to give a salt and a hash algorithm
```javascript
Amaretti.generateKey(passphrase, salt, hash).then(function(key) {
// Manipulate your key
}, function (error) {
// There was an error
});
```
* __passphrase__: is the passphrase used to encrypt or decrypt messages
* __salt__: is the salt, base64 encoded, used to randomize the key generator
* __hash__: is the name of algorithm used to hash the key. It could be _SHA-1_ or _SHA-256_
### Encrypt a message
You can encrypt a message with your key. Amaretti use AES-GCM to encrypt data. To avoid brut-force attack agains the encrypted data, each data had to be encrypt with a different and random nonce. You can use a salt as nonce. Don't lose this nonce, you will need it to decrypt the message.
```javascript
Amaretti.encrypt(key, message, nonce).then(function(encrypted) {
// Manipulate your encrypted message
}, function (error) {
// There was an error
});
```
* __key__: is the base64 used to encrypt message
* __message__: is the message to encrypt
* __nonce__: is a random value, in base64 format, use to avoid attacks
### Decrypt a message
```javascript
Amaretti..decrypt(key, encrypted, nonce).then(function(decrypted) {
// Manipulate your encrypted message
}, function (error) {
// There was an error
});
```
* __key__: is the base64 used to encrypt message
* __encrypted: is the encrypted message to decrypt, in base64 format
* __nonce__: is a random value, in base64 format, use to avoid attacks
## License
MIT
## How to contribute
Hum ... on github :)
### To build library
```bash
npm install
bower install
brunch build
```
### To run tests
```bash
npm run test
```
## Ideas for a roadmap
* Return key and crypted data with JOSE standard (JWE and JWT)
* Check sha-256 for firefox and sha-1 for SJCL ito key generation
|
VincentCasse/amaretti.js
|
README.md
|
Markdown
|
mit
| 3,469 | 29.165217 | 288 | 0.728452 | false |
package com.kromracing.runningroute.client;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Widget;
final public class Utils {
private Utils() {
}
/**
* Sets the HTML id for a widget.
* @param widget The widget to have the id set, ex: TextBox
* @param id ID in HTML, ex: textbox-location
*/
static void setId(final Widget widget, final String id) {
if (widget instanceof CheckBox) {
final Element checkBoxElement = widget.getElement();
// The first element is the actual box to check. That is the one we care about.
final Element inputElement = DOM.getChild(checkBoxElement, 0);
inputElement.setAttribute("id", id);
//DOM.setElementAttribute(inputElement, "id", id); deprecated!
}
else {
widget.getElement().setAttribute("id", id);
//DOM.setElementAttribute(widget.getElement(), "id", id); deprecated!
}
}
}
|
chadrosenquist/running-route
|
src/main/java/com/kromracing/runningroute/client/Utils.java
|
Java
|
mit
| 1,100 | 34.483871 | 92 | 0.632727 | false |
/**
* This file was copied from https://github.com/jenkinsci/mercurial-plugin/raw/master/src/test/java/hudson/plugins/mercurial/MercurialRule.java
* so we as well have a MercurialRule to create test repos with.
* The file is licensed under the MIT License, which can by found at: http://www.opensource.org/licenses/mit-license.php
* More information about this file and it's authors can be found at: https://github.com/jenkinsci/mercurial-plugin/
*/
package org.paylogic.jenkins.advancedscm;
import hudson.EnvVars;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.Action;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import hudson.model.TaskListener;
import hudson.plugins.mercurial.HgExe;
import hudson.plugins.mercurial.MercurialTagAction;
import hudson.scm.PollingResult;
import hudson.util.ArgumentListBuilder;
import hudson.util.StreamTaskListener;
import org.junit.Assume;
import org.junit.internal.AssumptionViolatedException;
import org.junit.rules.ExternalResource;
import org.jvnet.hudson.test.JenkinsRule;
import org.paylogic.jenkins.ABuildCause;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;
import static java.util.Collections.sort;
import static org.junit.Assert.*;
public final class MercurialRule extends ExternalResource {
private TaskListener listener;
private final JenkinsRule j;
public MercurialRule(JenkinsRule j) {
this.j = j;
}
@Override protected void before() throws Exception {
listener = new StreamTaskListener(System.out, Charset.defaultCharset());
try {
if (new ProcessBuilder("hg", "--version").start().waitFor() != 0) {
throw new AssumptionViolatedException("hg --version signaled an error");
}
} catch(IOException ioe) {
String message = ioe.getMessage();
if(message.startsWith("Cannot run program \"hg\"") && message.endsWith("No such file or directory")) {
throw new AssumptionViolatedException("hg is not available; please check that your PATH environment variable is properly configured");
}
Assume.assumeNoException(ioe); // failed to check availability of hg
}
}
private Launcher launcher() {
return j.jenkins.createLauncher(listener);
}
private HgExe hgExe() throws Exception {
return new HgExe(null, null, launcher(), j.jenkins, listener, new EnvVars());
}
public void hg(String... args) throws Exception {
HgExe hg = hgExe();
assertEquals(0, hg.launch(nobody(hg.seed(false)).add(args)).join());
}
public void hg(File repo, String... args) throws Exception {
HgExe hg = hgExe();
assertEquals(0, hg.launch(nobody(hg.seed(false)).add(args)).pwd(repo).join());
}
private static ArgumentListBuilder nobody(ArgumentListBuilder args) {
return args.add("--config").add("[email protected]");
}
public void touchAndCommit(File repo, String... names) throws Exception {
for (String name : names) {
FilePath toTouch = new FilePath(repo).child(name);
if (!toTouch.exists()) {
toTouch.getParent().mkdirs();
toTouch.touch(0);
hg(repo, "add", name);
} else {
toTouch.write(toTouch.readToString() + "extra line\n", "UTF-8");
}
}
hg(repo, "commit", "--message", "added " + Arrays.toString(names));
}
public String buildAndCheck(FreeStyleProject p, String name,
Action... actions) throws Exception {
FreeStyleBuild b = j.assertBuildStatusSuccess(p.scheduleBuild2(0, new ABuildCause(), actions).get()); // Somehow this needs a cause or it will fail
if (!b.getWorkspace().child(name).exists()) {
Set<String> children = new TreeSet<String>();
for (FilePath child : b.getWorkspace().list()) {
children.add(child.getName());
}
fail("Could not find " + name + " among " + children);
}
assertNotNull(b.getAction(MercurialTagAction.class));
@SuppressWarnings("deprecation")
String log = b.getLog();
return log;
}
public PollingResult pollSCMChanges(FreeStyleProject p) {
return p.poll(new StreamTaskListener(System.out, Charset
.defaultCharset()));
}
public String getLastChangesetId(File repo) throws Exception {
return hgExe().popen(new FilePath(repo), listener, false, new ArgumentListBuilder("log", "-l1", "--template", "{node}"));
}
public String[] getBranches(File repo) throws Exception {
String rawBranches = hgExe().popen(new FilePath(repo), listener, false, new ArgumentListBuilder("branches"));
ArrayList<String> list = new ArrayList<String>();
for (String line: rawBranches.split("\n")) {
// line should contain: <branchName> <revision>:<hash> (yes, with lots of whitespace)
String[] seperatedByWhitespace = line.split("\\s+");
String branchName = seperatedByWhitespace[0];
list.add(branchName);
}
sort(list);
return list.toArray(new String[list.size()]);
}
public String searchLog(File repo, String query) throws Exception {
return hgExe().popen(new FilePath(repo), listener, false, new ArgumentListBuilder("log", "-k", query));
}
}
|
jenkinsci/gatekeeper-plugin
|
src/test/java/org/paylogic/jenkins/advancedscm/MercurialRule.java
|
Java
|
mit
| 5,618 | 38.56338 | 155 | 0.659131 | false |
function simulated_annealing(tuning_run::Run,
channel::RemoteChannel;
temperature::Function = log_temperature)
iteration = 1
function iterate(tuning_run::Run)
p = temperature(iteration)
iteration += 1
return probabilistic_improvement(tuning_run, threshold = p)
end
technique(tuning_run,
channel,
iterate,
name = "Simulated Annealing")
end
|
phrb/StochasticSearch.jl
|
src/core/search/techniques/simulated_annealing.jl
|
Julia
|
mit
| 490 | 29.625 | 69 | 0.546939 | false |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* Close all */
.monaco-workbench .explorer-viewlet .action-close-all-files {
background: url("close-all-light.svg") center center no-repeat;
}
.vs-dark .monaco-workbench .explorer-viewlet .action-close-all-files {
background: url("close-all-dark.svg") center center no-repeat;
}
.hc-black .monaco-workbench .explorer-viewlet .action-close-all-files {
background: url("close-all-light.svg") center center no-repeat;
}
/* Save all */
.monaco-workbench .explorer-action.save-all {
background: url("save-all-light.svg") center center no-repeat;
}
.vs-dark .monaco-workbench .explorer-action.save-all {
background: url("save-all-dark.svg") center center no-repeat;
}
.hc-black .monaco-workbench .explorer-action.save-all {
background: url("save-all-hc.svg") center center no-repeat;
}
/* Add file */
.monaco-workbench .explorer-action.new-file {
background: url("add-file-light.svg") center center no-repeat;
}
.vs-dark .monaco-workbench .explorer-action.new-file {
background: url("add-file-dark.svg") center center no-repeat;
}
.hc-black .monaco-workbench .explorer-action.new-file {
background: url("add-file-hc.svg") center center no-repeat;
}
/* Add Folder */
.monaco-workbench .explorer-action.new-folder {
background: url("add-folder-light.svg") center center no-repeat;
}
.vs-dark .monaco-workbench .explorer-action.new-folder {
background: url("add-folder-dark.svg") center center no-repeat;
}
.hc-black .monaco-workbench .explorer-action.new-folder {
background: url("add-folder-hc.svg") center center no-repeat;
}
/* Refresh */
.monaco-workbench .explorer-action.refresh-explorer {
background: url("refresh-light.svg") center center no-repeat;
}
.vs-dark .monaco-workbench .explorer-action.refresh-explorer {
background: url("refresh-dark.svg") center center no-repeat;
}
.hc-black .monaco-workbench .explorer-action.refresh-explorer {
background: url("refresh-hc.svg") center center no-repeat;
}
/* Collapse all */
.monaco-workbench .explorer-action.collapse-explorer {
background: url("collapse-all-light.svg") center center no-repeat;
}
.vs-dark .monaco-workbench .explorer-action.collapse-explorer {
background: url("collapse-all-dark.svg") center center no-repeat;
}
.hc-black .monaco-workbench .explorer-action.collapse-explorer {
background: url("collapse-all-hc.svg") center center no-repeat;
}
/* Split editor vertical */
.monaco-workbench .quick-open-sidebyside-vertical {
background-image: url("split-editor-vertical-light.svg");
}
.vs-dark .monaco-workbench .quick-open-sidebyside-vertical {
background-image: url("split-editor-vertical-dark.svg");
}
.hc-black .monaco-workbench .quick-open-sidebyside-vertical {
background-image: url("split-editor-vertical-hc.svg");
}
/* Split editor horizontal */
.monaco-workbench .quick-open-sidebyside-horizontal {
background-image: url("split-editor-horizontal-light.svg");
}
.vs-dark .monaco-workbench .quick-open-sidebyside-horizontal {
background-image: url("split-editor-horizontal-dark.svg");
}
.hc-black .monaco-workbench .quick-open-sidebyside-horizontal {
background-image: url("split-editor-horizontal-hc.svg");
}
.monaco-workbench .file-editor-action.action-open-preview {
background: url("preview-light.svg") center center no-repeat;
}
.vs-dark .monaco-workbench .file-editor-action.action-open-preview,
.hc-black .monaco-workbench .file-editor-action.action-open-preview {
background: url("preview-dark.svg") center center no-repeat;
}
.explorer-viewlet .explorer-open-editors .close-editor-action {
background: url("action-close-light.svg") center center no-repeat;
}
.explorer-viewlet .explorer-open-editors .focused .monaco-list-row.selected:not(.highlighted) .close-editor-action {
background: url("action-close-focus.svg") center center no-repeat;
}
.explorer-viewlet .explorer-open-editors .monaco-list .monaco-list-row.dirty:not(:hover) > .monaco-action-bar .close-editor-action {
background: url("action-close-dirty.svg") center center no-repeat;
}
.vs-dark .explorer-viewlet .explorer-open-editors .monaco-list .monaco-list-row.dirty:not(:hover) > .monaco-action-bar .close-editor-action,
.hc-black .monaco-workbench .explorer-viewlet .explorer-open-editors .monaco-list .monaco-list-row.dirty:not(:hover) > .monaco-action-bar .close-editor-action {
background: url("action-close-dirty-dark.svg") center center no-repeat;
}
.explorer-viewlet .explorer-open-editors .monaco-list.focused .monaco-list-row.selected.dirty:not(:hover) > .monaco-action-bar .close-editor-action {
background: url("action-close-dirty-focus.svg") center center no-repeat;
}
.vs-dark .monaco-workbench .explorer-viewlet .explorer-open-editors .close-editor-action,
.hc-black .monaco-workbench .explorer-viewlet .explorer-open-editors .close-editor-action {
background: url("action-close-dark.svg") center center no-repeat;
}
|
mjbvz/vscode
|
src/vs/workbench/contrib/files/browser/media/fileactions.css
|
CSS
|
mit
| 5,195 | 35.328671 | 160 | 0.724158 | false |
package zhou.adapter;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.util.List;
/**
* Created by zzhoujay on 2015/7/22 0022.
*/
public class NormalAdapter extends RecyclerView.Adapter<NormalAdapter.Holder> {
private List<String> msg;
public NormalAdapter(List<String> msg) {
this.msg = msg;
}
@Override
public Holder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_normal, null);
Holder holder = new Holder(view);
return holder;
}
@Override
public void onBindViewHolder(Holder holder, int position) {
String m = msg.get(position);
holder.icon.setImageResource(R.mipmap.ic_launcher);
holder.text.setText(m);
}
@Override
public int getItemCount() {
return msg == null ? 0 : msg.size();
}
public static class Holder extends RecyclerView.ViewHolder {
public TextView text;
public ImageView icon;
public Holder(View itemView) {
super(itemView);
text = (TextView) itemView.findViewById(R.id.item_text);
icon = (ImageView) itemView.findViewById(R.id.item_icon);
}
}
}
|
ChinaKim/AdvanceAdapter
|
app/src/main/java/zhou/adapter/NormalAdapter.java
|
Java
|
mit
| 1,412 | 25.641509 | 97 | 0.667847 | false |
<ng-container *ngIf="preview.user && !authHelper.isSelf(preview.user)">
<user-info [user]="preview.user">
</user-info>
</ng-container>
<!-- description + image -->
<label-value [label]="i18n.voucher.voucher">
{{ preview.type.voucherTitle }}
</label-value>
<ng-container *ngIf="buyVoucher.count === 1; else multiple">
<label-value [label]="i18n.transaction.amount">
{{ buyVoucher.amount | currency:preview.type.configuration.currency }}
</label-value>
</ng-container>
<ng-template #multiple>
<label-value [label]="i18n.voucher.numberOfVouchers">
{{ buyVoucher.count }}
</label-value>
<label-value [label]="i18n.voucher.amountPerVoucher">
{{ buyVoucher.amount | currency:preview.type.configuration.currency }}
</label-value>
<label-value [label]="i18n.voucher.totalAmount">
{{ preview.totalAmount | currency:preview.type.configuration.currency }}
</label-value>
</ng-template>
<label-value *ngIf="preview.type.gift === 'choose'" kind="fieldView"
[label]="i18n.voucher.buy.usage"
[value]="buyVoucher.gift ? i18n.voucher.buy.usageGift : i18n.voucher.buy.usageSelf">
</label-value>
<label-value *ngIf="preview.type.gift === 'never'" kind="fieldView"
[label]="i18n.voucher.buy.usage" [value]="i18n.voucher.buy.usageAlwaysSelf">
</label-value>
<!-- payment fields -->
<ng-container *ngFor="let cf of paymentCustomFields">
<label-value
[hidden]="!fieldHelper.hasValue(cf.internalName, buyVoucher.paymentCustomValues)"
[label]="cf.name"
[labelPosition]="labelOnTop((layout.ltsm$ | async), cf) ? 'top' : 'auto'">
<format-field-value [customValues]="buyVoucher.paymentCustomValues"
[fields]="paymentCustomFields" [fieldName]="cf.internalName">
</format-field-value>
</label-value>
</ng-container>
<!-- custom fields -->
<ng-container *ngFor="let cf of voucherCustomFields">
<label-value
[hidden]="!fieldHelper.hasValue(cf.internalName, buyVoucher.voucherCustomValues)"
[label]="cf.name"
[labelPosition]="labelOnTop((layout.ltsm$ | async), cf) ? 'top' : 'auto'">
<format-field-value [customValues]="buyVoucher.voucherCustomValues"
[fields]="voucherCustomFields" [fieldName]="cf.internalName">
</format-field-value>
</label-value>
</ng-container>
<ng-container *ngIf="preview.confirmationPasswordInput">
<hr *ngIf="layout.gtxxs$ | async">
<confirmation-password focused
[formControl]="form.get('confirmationPassword')"
[passwordInput]="preview.confirmationPasswordInput"
[createDeviceConfirmation]="createDeviceConfirmation"
(confirmationModeChanged)="confirmationModeChanged.emit($event)"
(confirmed)="confirmed.emit($event)">
</confirmation-password>
</ng-container>
|
cyclosproject/cyclos4-ui
|
src/app/ui/banking/vouchers/buy-vouchers-step-confirm.component.html
|
HTML
|
mit
| 2,687 | 40.984375 | 86 | 0.710086 | false |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="zh_TW" version="2.0">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About GulfCoin</source>
<translation>關於位元幣</translation>
</message>
<message>
<location line="+39"/>
<source><b>GulfCoin</b> version</source>
<translation><b>位元幣</b>版本</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 ([email protected]) and UPnP software written by Thomas Bernard.</source>
<translation>
這是一套實驗性的軟體.
此軟體是依據 MIT/X11 軟體授權條款散布, 詳情請見附帶的 COPYING 檔案, 或是以下網站: http://www.opensource.org/licenses/mit-license.php.
此產品也包含了由 OpenSSL Project 所開發的 OpenSSL Toolkit (http://www.openssl.org/) 軟體, 由 Eric Young ([email protected]) 撰寫的加解密軟體, 以及由 Thomas Bernard 所撰寫的 UPnP 軟體.</translation>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation>版權</translation>
</message>
<message>
<location line="+0"/>
<source>The GulfCoin developers</source>
<translation>位元幣開發人員</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>&New Address</source>
<translation>新增位址</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your GulfCoin 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>這些是你用來收款的位元幣位址. 你可以提供不同的位址給不同的付款人, 來追蹤是誰支付給你.</translation>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>複製位址</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>顯示 &QR 條碼</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a GulfCoin address</source>
<translation>簽署訊息是用來證明位元幣位址是你的</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>訊息簽署</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>&Export</source>
<translation>匯出</translation>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified GulfCoin address</source>
<translation>驗證訊息是用來確認訊息是用指定的位元幣位址簽署的</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>訊息驗證</translation>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>刪除</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your GulfCoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation>這是你用來付款的位元幣位址. 在付錢之前, 務必要檢查金額和收款位址是否正確.</translation>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>複製標記</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>編輯</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation>付錢</translation>
</message>
<message>
<location line="+265"/>
<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.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>輸入錢包的新密碼.<br/>請用<b>10個以上的字元</b>, 或是<b>8個以上的單字</b>.</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 <b>LOSE ALL OF YOUR BITCOINS</b>!</source>
<translation>警告: 如果將錢包加密後忘記密碼, 你會<b>失去其中所有的位元幣</b>!</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>警告: 大寫字母鎖定作用中!</translation>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>錢包已加密</translation>
</message>
<message>
<location line="-56"/>
<source>GulfCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your gulfcoins from being stolen by malware infecting your computer.</source>
<translation>位元幣現在要關閉以完成加密程序. 請記住, 加密錢包無法完全防止入侵電腦的惡意程式偷取你的位元幣.</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>GulfCoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+254"/>
<source>Sign &message...</source>
<translation>訊息簽署...</translation>
</message>
<message>
<location line="+246"/>
<source>Synchronizing with network...</source>
<translation>網路同步中...</translation>
</message>
<message>
<location line="-321"/>
<source>&Overview</source>
<translation>總覽</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>顯示錢包一般總覽</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>交易</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&xit</source>
<translation>結束</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>結束應用程式</translation>
</message>
<message>
<location line="+7"/>
<source>Show information about GulfCoin</source>
<translation>顯示位元幣相關資訊</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>關於 &Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>顯示有關於 Qt 的資訊</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>選項...</translation>
</message>
<message>
<location line="+9"/>
<source>&Encrypt Wallet...</source>
<translation>錢包加密...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>錢包備份...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>密碼變更...</translation>
</message>
<message>
<location line="+251"/>
<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="-319"/>
<source>Send coins to a GulfCoin address</source>
<translation>付錢到位元幣位址</translation>
</message>
<message>
<location line="+52"/>
<source>Modify configuration options for GulfCoin</source>
<translation>修改位元幣的設定選項</translation>
</message>
<message>
<location line="+12"/>
<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>&Debug window</source>
<translation>除錯視窗</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>開啓除錯與診斷主控台</translation>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation>驗證訊息...</translation>
</message>
<message>
<location line="-183"/>
<location line="+6"/>
<location line="+508"/>
<source>GulfCoin</source>
<translation>位元幣</translation>
</message>
<message>
<location line="-514"/>
<location line="+6"/>
<source>Wallet</source>
<translation>錢包</translation>
</message>
<message>
<location line="+107"/>
<source>&Send</source>
<translation>付出</translation>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation>收受</translation>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation>位址</translation>
</message>
<message>
<location line="+23"/>
<location line="+2"/>
<source>&About GulfCoin</source>
<translation>關於位元幣</translation>
</message>
<message>
<location line="+10"/>
<location line="+2"/>
<source>&Show / Hide</source>
<translation>顯示或隱藏</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 GulfCoin addresses to prove you own them</source>
<translation>用位元幣位址簽署訊息來證明那是你的</translation>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified GulfCoin addresses</source>
<translation>驗證訊息來確認是用指定的位元幣位址簽署的</translation>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>檔案</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>設定</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>求助</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>分頁工具列</translation>
</message>
<message>
<location line="-228"/>
<location line="+288"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
<message>
<location line="-5"/>
<location line="+5"/>
<source>GulfCoin client</source>
<translation>位元幣客戶端軟體</translation>
</message>
<message numerus="yes">
<location line="+121"/>
<source>%n active connection(s) to GulfCoin network</source>
<translation><numerusform>與位元幣網路有 %n 個連線在使用中</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>已處理了估計全部 %2 個中的 %1 個區塊的交易紀錄.</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></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation><numerusform>%n 天</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation><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 GulfCoin address or malformed URI parameters.</source>
<translation>無法解析 URI! 也許位元幣位址無效或 URI 參數有誤.</translation>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>錢包<b>已加密</b>並且正<b>解鎖中</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>錢包<b>已加密</b>並且正<b>上鎖中</b></translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+110"/>
<source>A fatal error occurred. GulfCoin can no longer continue safely and will quit.</source>
<translation>發生了致命的錯誤. 位元幣程式無法再繼續安全執行, 只好結束.</translation>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+105"/>
<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>&Label</source>
<translation>標記</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>與這個位址簿項目關聯的標記</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>位址</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 "%1" is already in the address book.</source>
<translation>輸入的位址"%1"已存在於位址簿中.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid GulfCoin address.</source>
<translation>輸入的位址 "%1" 並不是有效的位元幣位址.</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>FreespaceChecker</name>
<message>
<location filename="../intro.cpp" line="+61"/>
<source>A new data directory will be created.</source>
<translation>將會建立新的資料目錄.</translation>
</message>
<message>
<location line="+22"/>
<source>name</source>
<translation>名稱</translation>
</message>
<message>
<location line="+2"/>
<source>Directory already exists. Add %1 if you intend to create a new directory here.</source>
<translation>目錄已經存在了. 如果你要在裡面建立新目錄的話, 請加上 %1.</translation>
</message>
<message>
<location line="+3"/>
<source>Path already exists, and is not a directory.</source>
<translation>已經存在該路徑了, 並且不是一個目錄.</translation>
</message>
<message>
<location line="+7"/>
<source>Cannot create data directory here.</source>
<translation>無法在這裡新增資料目錄</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+517"/>
<location line="+13"/>
<source>GulfCoin-Qt</source>
<translation>位元幣-Qt</translation>
</message>
<message>
<location line="-13"/>
<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>使用界面選項</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>設定語言, 比如說 "de_DE" (預設: 系統語系)</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>
<message>
<location line="+1"/>
<source>Choose data directory on startup (default: 0)</source>
<translation>啓動時選擇資料目錄 (預設值: 0)</translation>
</message>
</context>
<context>
<name>Intro</name>
<message>
<location filename="../forms/intro.ui" line="+14"/>
<source>Welcome</source>
<translation>歡迎</translation>
</message>
<message>
<location line="+9"/>
<source>Welcome to GulfCoin-Qt.</source>
<translation>歡迎使用"位元幣-Qt"</translation>
</message>
<message>
<location line="+26"/>
<source>As this is the first time the program is launched, you can choose where GulfCoin-Qt will store its data.</source>
<translation>由於這是程式第一次啓動, 你可以選擇"位元幣-Qt"儲存資料的地方.</translation>
</message>
<message>
<location line="+10"/>
<source>GulfCoin-Qt will download and store a copy of the GulfCoin block chain. At least %1GB of data will be stored in this directory, and it will grow over time. The wallet will also be stored in this directory.</source>
<translation>位元幣-Qt 會下載並儲存一份位元幣區塊鏈結的拷貝. 至少有 %1GB 的資料會儲存到這個目錄中, 並且還會持續增長. 另外錢包資料也會儲存在這個目錄.</translation>
</message>
<message>
<location line="+10"/>
<source>Use the default data directory</source>
<translation>用預設的資料目錄</translation>
</message>
<message>
<location line="+7"/>
<source>Use a custom data directory:</source>
<translation>用自定的資料目錄:</translation>
</message>
<message>
<location filename="../intro.cpp" line="+100"/>
<source>Error</source>
<translation>錯誤</translation>
</message>
<message>
<location line="+9"/>
<source>GB of free space available</source>
<translation>GB 可用空間</translation>
</message>
<message>
<location line="+3"/>
<source>(of %1GB needed)</source>
<translation>(需要 %1GB)</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>&Main</source>
<translation>主要</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 &fee</source>
<translation>付交易手續費</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start GulfCoin after logging in to the system.</source>
<translation>在登入系統後自動啓動位元幣.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start GulfCoin on system login</source>
<translation>系統登入時啟動位元幣</translation>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation>回復所有客戶端軟體選項成預設值.</translation>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation>選項回復</translation>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation>網路</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the GulfCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>自動在路由器上開啟 GulfCoin 的客戶端通訊埠. 只有在你的路由器支援 UPnP 且開啟時才有作用.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>用 &UPnP 設定通訊埠對應</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the GulfCoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation>透過 SOCKS 代理伺服器連線至位元幣網路 (比如說要透過 Tor 連線).</translation>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>透過 SOCKS 代理伺服器連線:</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>代理伺服器位址:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>代理伺服器的網際網路位址 (比如說 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>通訊埠:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>代理伺服器的通訊埠 (比如說 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>SOCKS 協定版本:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>代理伺服器的 SOCKS 協定版本 (比如說 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>視窗</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>&Minimize to the tray instead of the taskbar</source>
<translation>最小化至通知區域而非工作列</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&inimize on close</source>
<translation>關閉時最小化</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>顯示</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &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 GulfCoin.</source>
<translation>可以在這裡設定使用者介面的語言. 這個設定在位元幣程式重啓後才會生效.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>金額顯示單位:</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 GulfCoin addresses in the transaction list or not.</source>
<translation>是否要在交易列表中顯示位元幣位址.</translation>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>在交易列表顯示位址</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>好</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>取消</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>套用</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+54"/>
<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 GulfCoin.</source>
<translation>這個設定會在位元幣程式重啓後生效.</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="+202"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the GulfCoin network after a connection is established, but this process has not completed yet.</source>
<translation>顯示的資訊可能是過期的. 與位元幣網路的連線建立後, 你的錢包會自動和網路同步, 但這個步驟還沒完成.</translation>
</message>
<message>
<location line="-131"/>
<source>Unconfirmed:</source>
<translation>未確認金額:</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>錢包</translation>
</message>
<message>
<location line="+49"/>
<source>Confirmed:</source>
<translation>已確認金額:</translation>
</message>
<message>
<location line="+16"/>
<source>Your current spendable 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 spendable balance</source>
<translation>尚未確認的交易的總金額, 可用餘額不包含此金額</translation>
</message>
<message>
<location line="+13"/>
<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="+13"/>
<source>Total:</source>
<translation>總金額:</translation>
</message>
<message>
<location line="+16"/>
<source>Your current total balance</source>
<translation>目前全部餘額</translation>
</message>
<message>
<location line="+53"/>
<source><b>Recent transactions</b></source>
<translation><b>最近交易</b></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="+108"/>
<source>Cannot start gulfcoin: click-to-pay handler</source>
<translation>無法啟動 gulfcoin 隨按隨付處理器</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../bitcoin.cpp" line="+92"/>
<location filename="../intro.cpp" line="-32"/>
<source>GulfCoin</source>
<translation>位元幣</translation>
</message>
<message>
<location line="+1"/>
<source>Error: Specified data directory "%1" does not exist.</source>
<translation>錯誤: 不存在指定的資料目錄 "%1".</translation>
</message>
<message>
<location filename="../intro.cpp" line="+1"/>
<source>Error: Specified data directory "%1" can not be created.</source>
<translation>錯誤: 無法新增指定的資料目錄 "%1".</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>&Save As...</source>
<translation>儲存為...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+64"/>
<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="+345"/>
<source>N/A</source>
<translation>無</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>客戶端軟體版本</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>資訊</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>位於測試網路</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>估算總區塊數</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>最近區塊時間</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>開啓</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation>命令列選項</translation>
</message>
<message>
<location line="+7"/>
<source>Show the GulfCoin-Qt help message to get a list with possible GulfCoin command-line options.</source>
<translation>顯示"位元幣-Qt"的求助訊息, 來取得可用的命令列選項列表.</translation>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>顯示</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>主控台</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>建置日期</translation>
</message>
<message>
<location line="-104"/>
<source>GulfCoin - Debug window</source>
<translation>位元幣 - 除錯視窗</translation>
</message>
<message>
<location line="+25"/>
<source>GulfCoin Core</source>
<translation>位元幣核心</translation>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>除錯紀錄檔</translation>
</message>
<message>
<location line="+7"/>
<source>Open the GulfCoin 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 GulfCoin RPC console.</source>
<translation>歡迎使用位元幣 RPC 主控台.</translation>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>請用上下游標鍵來瀏覽歷史指令, 且可用 <b>Ctrl-L</b> 來清理畫面.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>請打 <b>help</b> 來看可用指令的簡介.</translation>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+128"/>
<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 &Recipient</source>
<translation>加收款人</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>移除所有交易欄位</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>全部清掉</translation>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>餘額:</translation>
</message>
<message>
<location line="+10"/>
<source>123.456 ABC</source>
<translation>123.456 ABC</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>確認付款動作</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>付出</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-62"/>
<location line="+2"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> 給 %2 (%3)</translation>
</message>
<message>
<location line="+6"/>
<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&mount:</source>
<translation>金額:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>付給:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source>
<translation>付款的目標位址 (比如說 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</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>&Label:</source>
<translation>標記:</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 GulfCoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source>
<translation>輸入位元幣位址 (比如說 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</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>&Sign Message</source>
<translation>訊息簽署</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>你可以用自己的位址來簽署訊息, 以證明你對它的所有權. 但是請小心, 不要簽署語意含糊不清的內容, 因為釣魚式詐騙可能會用騙你簽署的手法來冒充是你. 只有在語句中的細節你都同意時才簽署.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source>
<translation>用來簽署訊息的位址 (比如說 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</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 GulfCoin address</source>
<translation>簽署訊息是用來證明這個位元幣位址是你的</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &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 &All</source>
<translation>全部清掉</translation>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation>訊息驗證</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>請在下面輸入簽署的位址, 訊息(請確認完整複製了所包含的換行, 空格, 跳位符號等等), 與簽章, 以驗證該訊息. 請小心, 除了訊息內容外, 不要對簽章本身過度解讀, 以避免被用"中間人攻擊法"詐騙.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source>
<translation>簽署該訊息的位址 (比如說 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified GulfCoin address</source>
<translation>驗證訊息是用來確認訊息是用指定的位元幣位址簽署的</translation>
</message>
<message>
<location line="+3"/>
<source>Verify &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 GulfCoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source>
<translation>輸入位元幣位址 (比如說 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>按"訊息簽署"來產生簽章</translation>
</message>
<message>
<location line="+3"/>
<source>Enter GulfCoin signature</source>
<translation>輸入位元幣簽章</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 GulfCoin developers</source>
<translation>位元幣開發人員</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></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>標籤</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></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>出帳</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>交易識別碼</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 1 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation>生產出來的錢要再等 1 個區塊熟成之後, 才能夠花用. 當你產出區塊時, 它會被公布到網路上, 以被串連至區塊鎖鏈. 如果串連失敗了, 它的狀態就會變成"不被接受", 且不能被花用. 當你產出區塊的幾秒鐘內, 也有其他節點產出區塊的話, 有時候就會發生這種情形.</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>, 尚未成功公告出去</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation><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></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></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>複製交易識別碼</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="+143"/>
<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>識別碼</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="+46"/>
<source>&Export</source>
<translation>匯出</translation>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation>將目前分頁的資料匯出存成檔案</translation>
</message>
<message>
<location line="+197"/>
<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="+98"/>
<source>GulfCoin version</source>
<translation>位元幣版本</translation>
</message>
<message>
<location line="+104"/>
<source>Usage:</source>
<translation>用法:</translation>
</message>
<message>
<location line="-30"/>
<source>Send command to -server or gulfcoind</source>
<translation>送指令給 -server 或 gulfcoind
</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>列出指令
</translation>
</message>
<message>
<location line="-13"/>
<source>Get help for a command</source>
<translation>取得指令說明
</translation>
</message>
<message>
<location line="+25"/>
<source>Options:</source>
<translation>選項:
</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: gulfcoin.conf)</source>
<translation>指定設定檔 (預設: gulfcoin.conf)
</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: gulfcoind.pid)</source>
<translation>指定行程識別碼檔案 (預設: gulfcoind.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>設定資料庫快取大小為多少百萬位元組(MB, 預設: 25)</translation>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 12401 or testnet: 22401)</source>
<translation>在通訊埠 <port> 聽候連線 (預設: 12401, 或若為測試網路: 22401)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>維持與節點連線數的上限為 <n> 個 (預設: 125)</translation>
</message>
<message>
<location line="-49"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>連線到某個節點以取得其它節點的位址, 然後斷線</translation>
</message>
<message>
<location line="+84"/>
<source>Specify your own public address</source>
<translation>指定自己公開的位址</translation>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>與亂搞的節點斷線的臨界值 (預設: 100)</translation>
</message>
<message>
<location line="-136"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>避免與亂搞的節點連線的秒數 (預設: 86400)</translation>
</message>
<message>
<location line="-33"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>在 IPv4 網路上以通訊埠 %u 聽取 RPC 連線時發生錯誤: %s</translation>
</message>
<message>
<location line="+31"/>
<source>Listen for JSON-RPC connections on <port> (default: 12402 or testnet: 22402)</source>
<translation>在通訊埠 <port> 聽候 JSON-RPC 連線 (預設: 12402, 或若為測試網路: 22402)</translation>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>接受命令列與 JSON-RPC 指令
</translation>
</message>
<message>
<location line="+77"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>以背景程式執行並接受指令</translation>
</message>
<message>
<location line="+38"/>
<source>Use the test network</source>
<translation>使用測試網路
</translation>
</message>
<message>
<location line="-114"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>是否接受外來連線 (預設: 當沒有 -proxy 或 -connect 時預設為 1)</translation>
</message>
<message>
<location line="-84"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=gulfcoinrpc
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 "GulfCoin Alert" [email protected]
</source>
<translation>%s, 你必須要在以下設定檔中設定 RPC 密碼(rpcpassword):
%s
建議你使用以下隨機產生的密碼:
rpcuser=gulfcoinrpc
rpcpassword=%s
(你不用記住這個密碼)
使用者名稱(rpcuser)和密碼(rpcpassword)不可以相同!
如果設定檔還不存在, 請在新增時, 設定檔案權限為"只有主人才能讀取".
也建議你設定警示通知, 發生問題時你才會被通知到;
比如說設定為:
alertnotify=echo %%s | mail -s "GulfCoin Alert" [email protected]
</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>設定在 IPv6 網路的通訊埠 %u 上聽候 RPC 連線失敗, 退而改用 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>和指定的位址繫結, 並總是在該位址聽候連線. IPv6 請用 "[主機]:通訊埠" 這種格式</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. GulfCoin is probably already running.</source>
<translation>無法鎖定資料目錄 %s. 也許位元幣已經在執行了.</translation>
</message>
<message>
<location line="+3"/>
<source>Enter regression test mode, which uses a special chain in which blocks can be solved instantly. This is intended for regression testing tools and app development.</source>
<translation>進入回歸測試模式, 特別的區塊鎖鏈使用中, 可以立即解出區塊. 目的是用來做回歸測試, 以及配合應用程式的開發.</translation>
</message>
<message>
<location line="+4"/>
<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 會被取代為警示訊息)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>當錢包有交易改變時所要執行的指令 (指令中的 %s 會被取代為交易識別碼)</translation>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation>設定高優先權或低手續費的交易資料大小上限為多少位元組 (預設: 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's date and time are correct! If your clock is wrong GulfCoin will not work properly.</source>
<translation>警告: 請檢查電腦時間與日期是否正確! 位元幣無法在時鐘不準的情況下正常運作.</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 壞掉, 但資料被拯救回來了! 原來的 wallet.dat 會改儲存在 %s, 檔名為 wallet.{timestamp}.bak. 如果餘額或交易資料有誤, 你應該要用備份資料復原回來.</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>找出自己的網際網路位址 (預設: 當有聽候連線且沒有 -externalip 時為 1)</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>在任意的通訊埠聽候失敗. 如果你想的話可以用 -listen=0.</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation>讀取區塊資訊失敗</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>是否允許在找節點時使用域名查詢 (預設: 當沒用 -connect 時為 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="+2"/>
<source>Incorrect or no genesis block found. Wrong datadir for network?</source>
<translation>創世區塊不正確或找不到. 資料目錄錯了嗎?</translation>
</message>
<message>
<location line="+18"/>
<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="+7"/>
<source>Specify wallet file (within data directory)</source>
<translation>指定錢包檔(會在資料目錄中)</translation>
</message>
<message>
<location line="+20"/>
<source>Verifying blocks...</source>
<translation>驗證區塊資料中...</translation>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation>驗證錢包資料中...</translation>
</message>
<message>
<location line="+1"/>
<source>Wallet %s resides outside data directory %s</source>
<translation>錢包檔 %s 沒有在資料目錄 %s 裡面</translation>
</message>
<message>
<location line="+4"/>
<source>You need to rebuild the database using -reindex to change -txindex</source>
<translation>改變 -txindex 參數後, 必須要用 -reindex 參數來重建資料庫</translation>
</message>
<message>
<location line="-76"/>
<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, <0 = leave that many cores free, default: 0)</source>
<translation>設定指令碼驗證的執行緒數目 (最多為 16, 若為 0 表示程式自動決定, 小於 0 表示保留不用的處理器核心數目, 預設為 0)</translation>
</message>
<message>
<location line="+78"/>
<source>Information</source>
<translation>資訊</translation>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation>無效的 -tor 位址: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation>設定 -minrelaytxfee=<金額> 的金額無效: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation>設定 -mintxfee=<amount> 的金額無效: '%s'</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, <n>*1000 bytes (default: 5000)</source>
<translation>每個連線的接收緩衝區大小上限為 <n>*1000 個位元組 (預設: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>每個連線的傳送緩衝區大小上限為 <n>*1000 位元組 (預設: 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 <net> (IPv4, IPv6 or Tor)</source>
<translation>只和 <net> 網路上的節點連線 (IPv4, IPv6, 或 Tor)</translation>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>輸出額外的除錯資訊. 包含了其它所有的 -debug* 選項</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 GulfCoin Wiki for SSL setup instructions)</source>
<translation>SSL 選項: (SSL 設定程序請見 GulfCoin Wiki)</translation>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation>選擇 SOCKS 代理伺服器的協定版本(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>輸出追蹤或除錯資訊給除錯器</translation>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation>設定區塊大小上限為多少位元組 (預設: 250000)</translation>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>設定區塊大小下限為多少位元組 (預設: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>客戶端軟體啓動時將 debug.log 檔縮小 (預設: 當沒有 -debug 時為 1)</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="+5"/>
<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="+5"/>
<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="+2"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>錢包檔 weallet.dat 壞掉了, 拯救失敗</translation>
</message>
<message>
<location line="-52"/>
<source>Password for JSON-RPC connections</source>
<translation>JSON-RPC 連線密碼</translation>
</message>
<message>
<location line="-68"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>只允許從指定網路位址來的 JSON-RPC 連線</translation>
</message>
<message>
<location line="+77"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>送指令給在 <ip> 的節點 (預設: 127.0.0.1)
</translation>
</message>
<message>
<location line="-121"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>當最新區塊改變時所要執行的指令 (指令中的 %s 會被取代為區塊的雜湊值)</translation>
</message>
<message>
<location line="+149"/>
<source>Upgrade wallet to latest format</source>
<translation>將錢包升級成最新的格式</translation>
</message>
<message>
<location line="-22"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>設定密鑰池大小為 <n> (預設: 100)
</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>重新掃描區塊鎖鏈, 以尋找錢包所遺漏的交易.</translation>
</message>
<message>
<location line="+36"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>於 JSON-RPC 連線使用 OpenSSL (https)
</translation>
</message>
<message>
<location line="-27"/>
<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="-156"/>
<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="+171"/>
<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 繫結 (繫結回傳錯誤 %d, %s)</translation>
</message>
<message>
<location line="-93"/>
<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>允許對 -addnode, -seednode, -connect 的參數使用域名查詢 </translation>
</message>
<message>
<location line="+56"/>
<source>Loading addresses...</source>
<translation>載入位址中...</translation>
</message>
<message>
<location line="-36"/>
<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 GulfCoin</source>
<translation>載入檔案 wallet.dat 失敗: 此錢包需要新版的 GulfCoin</translation>
</message>
<message>
<location line="+96"/>
<source>Wallet needed to be rewritten: restart GulfCoin to complete</source>
<translation>錢包需要重寫: 請重啟位元幣來完成</translation>
</message>
<message>
<location line="-98"/>
<source>Error loading wallet.dat</source>
<translation>載入檔案 wallet.dat 失敗</translation>
</message>
<message>
<location line="+29"/>
<source>Invalid -proxy address: '%s'</source>
<translation>無效的 -proxy 位址: '%s'</translation>
</message>
<message>
<location line="+57"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>在 -onlynet 指定了不明的網路別: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>在 -socks 指定了不明的代理協定版本: %i</translation>
</message>
<message>
<location line="-98"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>無法解析 -bind 位址: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>無法解析 -externalip 位址: '%s'</translation>
</message>
<message>
<location line="+45"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>設定 -paytxfee=<金額> 的金額無效: '%s'</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="-58"/>
<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. GulfCoin is probably already running.</source>
<translation>無法和這台電腦上的 %s 繫結. 也許位元幣已經在執行了.</translation>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>交易付款時每 KB 的交易手續費</translation>
</message>
<message>
<location line="+20"/>
<source>Loading wallet...</source>
<translation>載入錢包中...</translation>
</message>
<message>
<location line="-53"/>
<source>Cannot downgrade wallet</source>
<translation>無法將錢包格式降級</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation>無法寫入預設位址</translation>
</message>
<message>
<location line="+65"/>
<source>Rescanning...</source>
<translation>重新掃描中...</translation>
</message>
<message>
<location line="-58"/>
<source>Done loading</source>
<translation>載入完成</translation>
</message>
<message>
<location line="+84"/>
<source>To use the %s option</source>
<translation>為了要使用 %s 選項</translation>
</message>
<message>
<location line="-76"/>
<source>Error</source>
<translation>錯誤</translation>
</message>
<message>
<location line="-31"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>你必須在下列設定檔中設定 RPC 密碼(rpcpassword=<password>):
%s
如果這個檔案還不存在, 請在新增時, 設定檔案權限為"只有主人才能讀取".</translation>
</message>
</context>
</TS>
|
coingulf/gulfcoin
|
src/qt/locale/bitcoin_zh_TW.ts
|
TypeScript
|
mit
| 119,082 | 33.704531 | 393 | 0.604489 | false |
package UserInterface.Animation;
/**
* Makes shit get big, makes shit get small.
*/
public class SizeAnimation extends Animation {
protected int iW, iH, fW, fH, cW, cH;
public SizeAnimation(long period, int paceType, boolean loop, int iW, int iH, int fW, int fH) {
super(period, paceType, loop);
this.iW = iW;
this.iH = iH;
this.fW = fW;
this.fH = fH;
this.cW = iW;
this.cH = iH;
}
@Override
protected void updateAnimation(double p) {
cW = (int)Math.round((fW - iW)*p) + iW;
cH = (int)Math.round((fH - iH)*p) + iH;
}
public int getWidth() {
return cW;
}
public int getHeight() {
return cH;
}
}
|
Daskie/Crazy8-CPE-103
|
src/UserInterface/Animation/SizeAnimation.java
|
Java
|
mit
| 731 | 20.5 | 99 | 0.5513 | false |
import * as path from "path";
import * as tl from "vsts-task-lib/task";
import {IExecOptions, IExecSyncResult} from "vsts-task-lib/toolrunner";
import * as auth from "packaging-common/nuget/Authentication";
import * as commandHelper from "packaging-common/nuget/CommandHelper";
import {NuGetConfigHelper2} from "packaging-common/nuget/NuGetConfigHelper2";
import * as ngToolRunner from "packaging-common/nuget/NuGetToolRunner2";
import peParser = require("packaging-common/pe-parser/index");
import {VersionInfo} from "packaging-common/pe-parser/VersionResource";
import * as nutil from "packaging-common/nuget/Utility";
import * as pkgLocationUtils from "packaging-common/locationUtilities";
import * as telemetry from "utility-common/telemetry";
import INuGetCommandOptions from "packaging-common/nuget/INuGetCommandOptions2";
class RestoreOptions implements INuGetCommandOptions {
constructor(
public nuGetPath: string,
public configFile: string,
public noCache: boolean,
public disableParallelProcessing: boolean,
public verbosity: string,
public packagesDirectory: string,
public environment: ngToolRunner.NuGetEnvironmentSettings,
public authInfo: auth.NuGetExtendedAuthInfo,
) { }
}
export async function run(nuGetPath: string): Promise<void> {
let packagingLocation: pkgLocationUtils.PackagingLocation;
try {
packagingLocation = await pkgLocationUtils.getPackagingUris(pkgLocationUtils.ProtocolType.NuGet);
} catch (error) {
tl.debug("Unable to get packaging URIs, using default collection URI");
tl.debug(JSON.stringify(error));
const collectionUrl = tl.getVariable("System.TeamFoundationCollectionUri");
packagingLocation = {
PackagingUris: [collectionUrl],
DefaultPackagingUri: collectionUrl};
}
const buildIdentityDisplayName: string = null;
const buildIdentityAccount: string = null;
try {
nutil.setConsoleCodePage();
// Reading inputs
const solutionPattern = tl.getPathInput("solution", true, false);
const useLegacyFind: boolean = tl.getVariable("NuGet.UseLegacyFindFiles") === "true";
let filesList: string[] = [];
if (!useLegacyFind) {
const findOptions: tl.FindOptions = <tl.FindOptions>{};
const matchOptions: tl.MatchOptions = <tl.MatchOptions>{};
const searchPatterns: string[] = nutil.getPatternsArrayFromInput(solutionPattern);
filesList = tl.findMatch(undefined, searchPatterns, findOptions, matchOptions);
}
else {
filesList = nutil.resolveFilterSpec(
solutionPattern,
tl.getVariable("System.DefaultWorkingDirectory") || process.cwd());
}
filesList.forEach((solutionFile) => {
if (!tl.stats(solutionFile).isFile()) {
throw new Error(tl.loc("NotARegularFile", solutionFile));
}
});
const noCache = tl.getBoolInput("noCache");
const disableParallelProcessing = tl.getBoolInput("disableParallelProcessing");
const verbosity = tl.getInput("verbosityRestore");
let packagesDirectory = tl.getPathInput("packagesDirectory");
if (!tl.filePathSupplied("packagesDirectory")) {
packagesDirectory = null;
}
const nuGetVersion: VersionInfo = await peParser.getFileVersionInfoAsync(nuGetPath);
// Discovering NuGet quirks based on the version
tl.debug("Getting NuGet quirks");
const quirks = await ngToolRunner.getNuGetQuirksAsync(nuGetPath);
// Clauses ordered in this way to avoid short-circuit evaluation, so the debug info printed by the functions
// is unconditionally displayed
const useV1CredProvider: boolean = ngToolRunner.isCredentialProviderEnabled(quirks);
const useV2CredProvider: boolean = ngToolRunner.isCredentialProviderV2Enabled(quirks);
const credProviderPath: string = nutil.locateCredentialProvider(useV2CredProvider);
const useCredConfig = ngToolRunner.isCredentialConfigEnabled(quirks)
&& (!useV1CredProvider && !useV2CredProvider);
// Setting up auth-related variables
tl.debug("Setting up auth");
let urlPrefixes = packagingLocation.PackagingUris;
tl.debug(`Discovered URL prefixes: ${urlPrefixes}`);
// Note to readers: This variable will be going away once we have a fix for the location service for
// customers behind proxies
const testPrefixes = tl.getVariable("NuGetTasks.ExtraUrlPrefixesForTesting");
if (testPrefixes) {
urlPrefixes = urlPrefixes.concat(testPrefixes.split(";"));
tl.debug(`All URL prefixes: ${urlPrefixes}`);
}
const accessToken = pkgLocationUtils.getSystemAccessToken();
const externalAuthArr: auth.ExternalAuthInfo[] = commandHelper.GetExternalAuthInfoArray("externalEndpoints");
const authInfo = new auth.NuGetExtendedAuthInfo(
new auth.InternalAuthInfo(
urlPrefixes,
accessToken,
((useV1CredProvider || useV2CredProvider) ? credProviderPath : null),
useCredConfig),
externalAuthArr);
const environmentSettings: ngToolRunner.NuGetEnvironmentSettings = {
credProviderFolder: useV2CredProvider === false ? credProviderPath : null,
V2CredProviderPath: useV2CredProvider === true ? credProviderPath : null,
extensionsDisabled: true,
};
// Setting up sources, either from provided config file or from feed selection
tl.debug("Setting up sources");
let nuGetConfigPath : string = undefined;
let configFile: string = undefined;
let selectOrConfig = tl.getInput("selectOrConfig");
// This IF is here in order to provide a value to nuGetConfigPath (if option selected, if user provided it)
// and then pass it into the config helper
if (selectOrConfig === "config") {
nuGetConfigPath = tl.getPathInput("nugetConfigPath", false, true);
if (!tl.filePathSupplied("nugetConfigPath")) {
nuGetConfigPath = undefined;
}
// If using NuGet version 4.8 or greater and nuget.config was provided,
// do not create temp config file
if (useV2CredProvider && nuGetConfigPath) {
configFile = nuGetConfigPath;
}
}
// If there was no nuGetConfigPath, NuGetConfigHelper will create a temp one
const nuGetConfigHelper = new NuGetConfigHelper2(
nuGetPath,
nuGetConfigPath,
authInfo,
environmentSettings,
null);
let credCleanup = () => { return; };
// Now that the NuGetConfigHelper was initialized with all the known information we can proceed
// and check if the user picked the 'select' option to fill out the config file if needed
if (selectOrConfig === "select") {
const sources: auth.IPackageSource[] = new Array<auth.IPackageSource>();
const feed = tl.getInput("feedRestore");
if (feed) {
const feedUrl: string = await nutil.getNuGetFeedRegistryUrl(
packagingLocation.DefaultPackagingUri,
feed,
nuGetVersion,
accessToken);
sources.push({
feedName: feed,
feedUri: feedUrl,
isInternal: true,
});
}
const includeNuGetOrg = tl.getBoolInput("includeNuGetOrg", false);
if (includeNuGetOrg) {
const nuGetSource: auth.IPackageSource = nuGetVersion.productVersion.a < 3
? auth.NuGetOrgV2PackageSource
: auth.NuGetOrgV2PackageSource;
sources.push(nuGetSource);
}
// Creating NuGet.config for the user
if (sources.length > 0)
{
// tslint:disable-next-line:max-line-length
tl.debug(`Adding the following sources to the config file: ${sources.map((x) => x.feedName).join(";")}`);
nuGetConfigHelper.addSourcesToTempNuGetConfig(sources);
credCleanup = () => tl.rmRF(nuGetConfigHelper.tempNugetConfigPath);
nuGetConfigPath = nuGetConfigHelper.tempNugetConfigPath;
}
else {
tl.debug("No sources were added to the temp NuGet.config file");
}
}
if (!useV2CredProvider && !configFile) {
// Setting creds in the temp NuGet.config if needed
await nuGetConfigHelper.setAuthForSourcesInTempNuGetConfigAsync();
tl.debug('Setting nuget.config auth');
} else {
// In case of !!useV2CredProvider, V2 credential provider will handle external credentials
tl.debug('No temp nuget.config auth');
}
// if configfile has already been set, let it be
if (!configFile) {
// Use config file if:
// - User selected "Select feeds" option
// - User selected "NuGet.config" option and the nuGetConfig input has a value
let useConfigFile: boolean = selectOrConfig === "select" || (selectOrConfig === "config" && !!nuGetConfigPath);
configFile = useConfigFile ? nuGetConfigHelper.tempNugetConfigPath : undefined;
if (useConfigFile)
{
credCleanup = () => tl.rmRF(nuGetConfigHelper.tempNugetConfigPath);
}
}
tl.debug(`ConfigFile: ${configFile}`);
try {
const restoreOptions = new RestoreOptions(
nuGetPath,
configFile,
noCache,
disableParallelProcessing,
verbosity,
packagesDirectory,
environmentSettings,
authInfo);
for (const solutionFile of filesList) {
restorePackages(solutionFile, restoreOptions);
}
} finally {
credCleanup();
}
tl.setResult(tl.TaskResult.Succeeded, tl.loc("PackagesInstalledSuccessfully"));
} catch (err) {
tl.error(err);
if (buildIdentityDisplayName || buildIdentityAccount) {
tl.warning(tl.loc("BuildIdentityPermissionsHint", buildIdentityDisplayName, buildIdentityAccount));
}
tl.setResult(tl.TaskResult.Failed, tl.loc("PackagesFailedToInstall"));
}
}
function restorePackages(solutionFile: string, options: RestoreOptions): IExecSyncResult {
const nugetTool = ngToolRunner.createNuGetToolRunner(options.nuGetPath, options.environment, options.authInfo);
nugetTool.arg("restore");
nugetTool.arg(solutionFile);
if (options.packagesDirectory) {
nugetTool.arg("-PackagesDirectory");
nugetTool.arg(options.packagesDirectory);
}
if (options.noCache) {
nugetTool.arg("-NoCache");
}
if (options.disableParallelProcessing) {
nugetTool.arg("-DisableParallelProcessing");
}
if (options.verbosity && options.verbosity !== "-") {
nugetTool.arg("-Verbosity");
nugetTool.arg(options.verbosity);
}
nugetTool.arg("-NonInteractive");
if (options.configFile) {
nugetTool.arg("-ConfigFile");
nugetTool.arg(options.configFile);
}
const execResult = nugetTool.execSync({ cwd: path.dirname(solutionFile) } as IExecOptions);
if (execResult.code !== 0) {
telemetry.logResult("Packaging", "NuGetCommand", execResult.code);
throw tl.loc("Error_NugetFailedWithCodeAndErr",
execResult.code,
execResult.stderr ? execResult.stderr.trim() : execResult.stderr);
}
return execResult;
}
|
grawcho/vso-agent-tasks
|
Tasks/NuGetCommandV2/nugetrestore.ts
|
TypeScript
|
mit
| 12,108 | 42.397849 | 123 | 0.629832 | false |
import _ from 'lodash';
import { createSelector } from 'reselect';
const srcFilesSelector = state => state.srcFiles;
const featuresSelector = state => state.features;
const featureByIdSelector = state => state.featureById;
const keywordSelector = (state, keyword) => keyword;
function getMarks(feature, ele) {
const marks = [];
switch (ele.type) {
case 'component':
if (ele.connectToStore) marks.push('C');
if (_.find(feature.routes, { component: ele.name })) marks.push('R');
break;
case 'action':
if (ele.isAsync) marks.push('A');
break;
default:
break;
}
return marks;
}
function getComponentsTreeData(feature) {
const components = feature.components;
return {
key: `${feature.key}-components`,
className: 'components',
label: 'Components',
icon: 'appstore-o',
count: components.length,
children: components.map(comp => ({
key: comp.file,
className: 'component',
label: comp.name,
icon: 'appstore-o',
searchable: true,
marks: getMarks(feature, comp),
})),
};
}
function getActionsTreeData(feature) {
const actions = feature.actions;
return {
key: `${feature.key}-actions`,
className: 'actions',
label: 'Actions',
icon: 'notification',
count: actions.length,
children: actions.map(action => ({
key: action.file,
className: 'action',
label: action.name,
icon: 'notification',
searchable: true,
marks: getMarks(feature, action),
})),
};
}
function getChildData(child) {
return {
key: child.file,
className: child.children ? 'misc-folder' : 'misc-file',
label: child.name,
icon: child.children ? 'folder' : 'file',
searchable: !child.children,
children: child.children ? child.children.map(getChildData) : null,
};
}
function getMiscTreeData(feature) {
const misc = feature.misc;
return {
key: `${feature.key}-misc`,
className: 'misc',
label: 'Misc',
icon: 'folder',
children: misc.map(getChildData),
};
}
export const getExplorerTreeData = createSelector(
srcFilesSelector,
featuresSelector,
featureByIdSelector,
(srcFiles, features, featureById) => {
const featureNodes = features.map((fid) => {
const feature = featureById[fid];
return {
key: feature.key,
className: 'feature',
label: feature.name,
icon: 'book',
children: [
{ label: 'Routes', key: `${fid}-routes`, searchable: false, className: 'routes', icon: 'share-alt', count: feature.routes.length },
getActionsTreeData(feature),
getComponentsTreeData(feature),
getMiscTreeData(feature),
],
};
});
const allNodes = [
{
key: 'features',
label: 'Features',
icon: 'features',
children: _.compact(featureNodes),
},
{
key: 'others-node',
label: 'Others',
icon: 'folder',
children: srcFiles.map(getChildData),
}
];
return { root: true, children: allNodes };
}
);
function filterTreeNode(node, keyword) {
const reg = new RegExp(_.escapeRegExp(keyword), 'i');
return {
...node,
children: _.compact(node.children.map((child) => {
if (child.searchable && reg.test(child.label)) return child;
if (child.children) {
const c = filterTreeNode(child, keyword);
return c.children.length > 0 ? c : null;
}
return null;
})),
};
}
export const getFilteredExplorerTreeData = createSelector(
getExplorerTreeData,
keywordSelector,
(treeData, keyword) => {
if (!keyword) return treeData;
return filterTreeNode(treeData, keyword);
}
);
// when searching the tree, all nodes should be expanded, the tree component needs expandedKeys property.
export const getExpandedKeys = createSelector(
getFilteredExplorerTreeData,
(treeData) => {
const keys = [];
let arr = [...treeData.children];
while (arr.length) {
const pop = arr.pop();
if (pop.children) {
keys.push(pop.key);
arr = [...arr, ...pop.children];
}
}
return keys;
}
);
|
supnate/rekit-portal
|
src/features/home/selectors/explorerTreeData.js
|
JavaScript
|
mit
| 4,178 | 24.47561 | 141 | 0.611058 | false |
<?php
class Receiving_lib
{
var $CI;
function __construct()
{
$this->CI =& get_instance();
}
function get_cart()
{
if(!$this->CI->session->userdata('cartRecv'))
$this->set_cart(array());
return $this->CI->session->userdata('cartRecv');
}
function set_cart($cart_data)
{
$this->CI->session->set_userdata('cartRecv',$cart_data);
}
function get_supplier()
{
if(!$this->CI->session->userdata('supplier'))
$this->set_supplier(-1);
return $this->CI->session->userdata('supplier');
}
function set_supplier($supplier_id)
{
$this->CI->session->set_userdata('supplier',$supplier_id);
}
function get_mode()
{
if(!$this->CI->session->userdata('recv_mode'))
$this->set_mode('receive');
return $this->CI->session->userdata('recv_mode');
}
function set_mode($mode)
{
$this->CI->session->set_userdata('recv_mode',$mode);
}
function get_stock_source()
{
if(!$this->CI->session->userdata('recv_stock_source'))
{
$location_id = $this->CI->Stock_locations->get_default_location_id();
$this->set_stock_source($location_id);
}
return $this->CI->session->userdata('recv_stock_source');
}
function get_comment()
{
return $this->CI->session->userdata('comment');
}
function set_comment($comment)
{
$this->CI->session->set_userdata('comment', $comment);
}
function clear_comment()
{
$this->CI->session->unset_userdata('comment');
}
function get_invoice_number()
{
return $this->CI->session->userdata('recv_invoice_number');
}
function set_invoice_number($invoice_number)
{
$this->CI->session->set_userdata('recv_invoice_number', $invoice_number);
}
function clear_invoice_number()
{
$this->CI->session->unset_userdata('recv_invoice_number');
}
function set_stock_source($stock_source)
{
$this->CI->session->set_userdata('recv_stock_source',$stock_source);
}
function clear_stock_source()
{
$this->CI->session->unset_userdata('recv_stock_source');
}
function get_stock_destination()
{
if(!$this->CI->session->userdata('recv_stock_destination'))
{
$location_id = $this->CI->Stock_locations->get_default_location_id();
$this->set_stock_destination($location_id);
}
return $this->CI->session->userdata('recv_stock_destination');
}
function set_stock_destination($stock_destination)
{
$this->CI->session->set_userdata('recv_stock_destination',$stock_destination);
}
function clear_stock_destination()
{
$this->CI->session->unset_userdata('recv_stock_destination');
}
function add_item($item_id,$quantity=1,$item_location,$discount=0,$price=null,$description=null,$serialnumber=null)
{
//make sure item exists in database.
if(!$this->CI->Item->exists($item_id))
{
//try to get item id given an item_number
$item_id = $this->CI->Item->get_item_id($item_id);
if(!$item_id)
return false;
}
//Get items in the receiving so far.
$items = $this->get_cart();
//We need to loop through all items in the cart.
//If the item is already there, get it's key($updatekey).
//We also need to get the next key that we are going to use in case we need to add the
//item to the list. Since items can be deleted, we can't use a count. we use the highest key + 1.
$maxkey=0; //Highest key so far
$itemalreadyinsale=FALSE; //We did not find the item yet.
$insertkey=0; //Key to use for new entry.
$updatekey=0; //Key to use to update(quantity)
foreach ($items as $item)
{
//We primed the loop so maxkey is 0 the first time.
//Also, we have stored the key in the element itself so we can compare.
//There is an array function to get the associated key for an element, but I like it better
//like that!
if($maxkey <= $item['line'])
{
$maxkey = $item['line'];
}
if($item['item_id']==$item_id && $item['item_location']==$item_location)
{
$itemalreadyinsale=TRUE;
$updatekey=$item['line'];
}
}
$insertkey=$maxkey+1;
$item_info=$this->CI->Item->get_info($item_id,$item_location);
//array records are identified by $insertkey and item_id is just another field.
$item = array(($insertkey)=>
array(
'item_id'=>$item_id,
'item_location'=>$item_location,
'stock_name'=>$this->CI->Stock_locations->get_location_name($item_location),
'line'=>$insertkey,
'name'=>$item_info->name,
'description'=>$description!=null ? $description: $item_info->description,
'serialnumber'=>$serialnumber!=null ? $serialnumber: '',
'allow_alt_description'=>$item_info->allow_alt_description,
'is_serialized'=>$item_info->is_serialized,
'quantity'=>$quantity,
'discount'=>$discount,
'in_stock'=>$this->CI->Item_quantities->get_item_quantity($item_id, $item_location)->quantity,
'price'=>$price!=null ? $price: $item_info->cost_price
)
);
//Item already exists
if($itemalreadyinsale)
{
$items[$updatekey]['quantity']+=$quantity;
}
else
{
//add to existing array
$items+=$item;
}
$this->set_cart($items);
return true;
}
function edit_item($line,$description,$serialnumber,$quantity,$discount,$price)
{
$items = $this->get_cart();
if(isset($items[$line]))
{
$items[$line]['description'] = $description;
$items[$line]['serialnumber'] = $serialnumber;
$items[$line]['quantity'] = $quantity;
$items[$line]['discount'] = $discount;
$items[$line]['price'] = $price;
$this->set_cart($items);
}
return false;
}
function is_valid_receipt($receipt_receiving_id)
{
//RECV #
$pieces = explode(' ',$receipt_receiving_id);
if(count($pieces)==2)
{
return $this->CI->Receiving->exists($pieces[1]);
}
else
{
return $this->CI->Receiving->get_receiving_by_invoice_number($receipt_receiving_id)->num_rows() > 0;
}
return false;
}
function is_valid_item_kit($item_kit_id)
{
//KIT #
$pieces = explode(' ',$item_kit_id);
if(count($pieces)==2)
{
return $this->CI->Item_kit->exists($pieces[1]);
}
return false;
}
function return_entire_receiving($receipt_receiving_id)
{
//POS #
$pieces = explode(' ',$receipt_receiving_id);
if ($pieces[0] == "RECV")
{
$receiving_id = $pieces[1];
}
else
{
$receiving = $this->CI->Receiving->get_receiving_by_invoice_number($receipt_receiving_id)->row();
$receiving_id = $receiving->receiving_id;
}
$this->empty_cart();
$this->delete_supplier();
$this->clear_comment();
foreach($this->CI->Receiving->get_receiving_items($receiving_id)->result() as $row)
{
$this->add_item($row->item_id,-$row->quantity_purchased,$row->item_location,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber);
}
$this->set_supplier($this->CI->Receiving->get_supplier($receiving_id)->person_id);
}
function add_item_kit($external_item_kit_id,$item_location)
{
//KIT #
$pieces = explode(' ',$external_item_kit_id);
$item_kit_id = $pieces[1];
foreach ($this->CI->Item_kit_items->get_info($item_kit_id) as $item_kit_item)
{
$this->add_item($item_kit_item['item_id'],$item_kit_item['quantity'],$item_location);
}
}
function copy_entire_receiving($receiving_id)
{
$this->empty_cart();
$this->delete_supplier();
foreach($this->CI->Receiving->get_receiving_items($receiving_id)->result() as $row)
{
$this->add_item($row->item_id,$row->quantity_purchased,$row->item_location,$row->discount_percent,$row->item_unit_price,$row->description,$row->serialnumber);
}
$this->set_supplier($this->CI->Receiving->get_supplier($receiving_id)->person_id);
$receiving_info=$this->CI->Receiving->get_info($receiving_id);
//$this->set_invoice_number($receiving_info->row()->invoice_number);
}
function copy_entire_requisition($requisition_id,$item_location)
{
$this->empty_cart();
$this->delete_supplier();
foreach($this->CI->Receiving->get_requisition_items($requisition_id)->result() as $row)
{
$this->add_item_unit($row->item_id,$row->requisition_quantity,$item_location,$row->description);
}
$this->set_supplier($this->CI->Receiving->get_supplier($requisition_id)->person_id);
$receiving_info=$this->CI->Receiving->get_info($receiving_id);
//$this->set_invoice_number($receiving_info->row()->invoice_number);
}
function delete_item($line)
{
$items=$this->get_cart();
unset($items[$line]);
$this->set_cart($items);
}
function empty_cart()
{
$this->CI->session->unset_userdata('cartRecv');
}
function delete_supplier()
{
$this->CI->session->unset_userdata('supplier');
}
function clear_mode()
{
$this->CI->session->unset_userdata('receiving_mode');
}
function clear_all()
{
$this->clear_mode();
$this->empty_cart();
$this->delete_supplier();
$this->clear_comment();
$this->clear_invoice_number();
}
function get_item_total($quantity, $price, $discount_percentage)
{
$total = bcmul($quantity, $price, PRECISION);
$discount_fraction = bcdiv($discount_percentage, 100, PRECISION);
$discount_amount = bcmul($total, $discount_fraction, PRECISION);
return bcsub($total, $discount_amount, PRECISION);
}
function get_total()
{
$total = 0;
foreach($this->get_cart() as $item)
{
$total += $this->get_item_total($item['quantity'], $item['price'], $item['discount']);
}
return $total;
}
}
?>
|
songwutk/opensourcepos
|
application/libraries/Receiving_lib.php
|
PHP
|
mit
| 9,998 | 25.550964 | 162 | 0.59952 | false |
package com.mauriciotogneri.apply.compiler.syntactic.nodes.arithmetic;
import com.mauriciotogneri.apply.compiler.lexical.Token;
import com.mauriciotogneri.apply.compiler.syntactic.TreeNode;
import com.mauriciotogneri.apply.compiler.syntactic.nodes.ExpressionBinaryNode;
public class ArithmeticModuleNode extends ExpressionBinaryNode
{
public ArithmeticModuleNode(Token token, TreeNode left, TreeNode right)
{
super(token, left, right);
}
@Override
public String sourceCode()
{
return String.format("mod(%s, %s)", left.sourceCode(), right.sourceCode());
}
}
|
mauriciotogneri/apply
|
src/main/java/com/mauriciotogneri/apply/compiler/syntactic/nodes/arithmetic/ArithmeticModuleNode.java
|
Java
|
mit
| 603 | 30.789474 | 83 | 0.756219 | false |
#LocalFolderPathStr=${PWD}
#LocalFilePathStr=$LocalFolderPathStr'/.pypirc'
#HomeFilePathStr=$HOME'/.pypirc'
#echo $LocalFilePathStr
#echo $HomeFilePathStr
#cp $LocalFilePathStr $HomeFilePathStr
python setup.py register
sudo python setup.py sdist upload
|
Ledoux/ShareYourSystem
|
Pythonlogy/upload.sh
|
Shell
|
mit
| 252 | 30.625 | 47 | 0.821429 | false |
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
@Component({
selector: 'app-user',
template: '<router-outlet></router-outlet>'
})
export class UserComponent implements OnInit {
constructor(public router: Router) { }
ngOnInit() {
if (this.router.url === '/user') {
this.router.navigate(['/dashboard']);
}
}
}
|
ahmelessawy/Hospital-Dashboard
|
Client/src/app/layouts/user/user.component.ts
|
TypeScript
|
mit
| 402 | 24.1875 | 50 | 0.606965 | false |
# coding: utf-8
from sqlalchemy.testing import eq_, assert_raises, assert_raises_message, \
config, is_
import re
from sqlalchemy.testing.util import picklers
from sqlalchemy.interfaces import ConnectionProxy
from sqlalchemy import MetaData, Integer, String, INT, VARCHAR, func, \
bindparam, select, event, TypeDecorator, create_engine, Sequence
from sqlalchemy.sql import column, literal
from sqlalchemy.testing.schema import Table, Column
import sqlalchemy as tsa
from sqlalchemy import testing
from sqlalchemy.testing import engines
from sqlalchemy import util
from sqlalchemy.testing.engines import testing_engine
import logging.handlers
from sqlalchemy.dialects.oracle.zxjdbc import ReturningParam
from sqlalchemy.engine import result as _result, default
from sqlalchemy.engine.base import Engine
from sqlalchemy.testing import fixtures
from sqlalchemy.testing.mock import Mock, call, patch
from contextlib import contextmanager
users, metadata, users_autoinc = None, None, None
class ExecuteTest(fixtures.TestBase):
__backend__ = True
@classmethod
def setup_class(cls):
global users, users_autoinc, metadata
metadata = MetaData(testing.db)
users = Table('users', metadata,
Column('user_id', INT, primary_key=True, autoincrement=False),
Column('user_name', VARCHAR(20)),
)
users_autoinc = Table('users_autoinc', metadata,
Column('user_id', INT, primary_key=True,
test_needs_autoincrement=True),
Column('user_name', VARCHAR(20)),
)
metadata.create_all()
@engines.close_first
def teardown(self):
testing.db.execute(users.delete())
@classmethod
def teardown_class(cls):
metadata.drop_all()
@testing.fails_on("postgresql+pg8000",
"pg8000 still doesn't allow single % without params")
def test_no_params_option(self):
stmt = "SELECT '%'" + testing.db.dialect.statement_compiler(
testing.db.dialect, None).default_from()
conn = testing.db.connect()
result = conn.\
execution_options(no_parameters=True).\
scalar(stmt)
eq_(result, '%')
@testing.fails_on_everything_except('firebird',
'sqlite', '+pyodbc',
'+mxodbc', '+zxjdbc', 'mysql+oursql')
def test_raw_qmark(self):
def go(conn):
conn.execute('insert into users (user_id, user_name) '
'values (?, ?)', (1, 'jack'))
conn.execute('insert into users (user_id, user_name) '
'values (?, ?)', [2, 'fred'])
conn.execute('insert into users (user_id, user_name) '
'values (?, ?)', [3, 'ed'], [4, 'horse'])
conn.execute('insert into users (user_id, user_name) '
'values (?, ?)', (5, 'barney'), (6, 'donkey'))
conn.execute('insert into users (user_id, user_name) '
'values (?, ?)', 7, 'sally')
res = conn.execute('select * from users order by user_id')
assert res.fetchall() == [
(1, 'jack'),
(2, 'fred'),
(3, 'ed'),
(4, 'horse'),
(5, 'barney'),
(6, 'donkey'),
(7, 'sally'),
]
for multiparam, param in [
(("jack", "fred"), {}),
((["jack", "fred"],), {})
]:
res = conn.execute(
"select * from users where user_name=? or "
"user_name=? order by user_id",
*multiparam, **param)
assert res.fetchall() == [
(1, 'jack'),
(2, 'fred')
]
res = conn.execute("select * from users where user_name=?",
"jack"
)
assert res.fetchall() == [(1, 'jack')]
conn.execute('delete from users')
go(testing.db)
conn = testing.db.connect()
try:
go(conn)
finally:
conn.close()
# some psycopg2 versions bomb this.
@testing.fails_on_everything_except('mysql+mysqldb', 'mysql+pymysql',
'mysql+cymysql', 'mysql+mysqlconnector', 'postgresql')
@testing.fails_on('postgresql+zxjdbc', 'sprintf not supported')
def test_raw_sprintf(self):
def go(conn):
conn.execute('insert into users (user_id, user_name) '
'values (%s, %s)', [1, 'jack'])
conn.execute('insert into users (user_id, user_name) '
'values (%s, %s)', [2, 'ed'], [3, 'horse'])
conn.execute('insert into users (user_id, user_name) '
'values (%s, %s)', 4, 'sally')
conn.execute('insert into users (user_id) values (%s)', 5)
res = conn.execute('select * from users order by user_id')
assert res.fetchall() == [(1, 'jack'), (2, 'ed'), (3,
'horse'), (4, 'sally'), (5, None)]
for multiparam, param in [
(("jack", "ed"), {}),
((["jack", "ed"],), {})
]:
res = conn.execute(
"select * from users where user_name=%s or "
"user_name=%s order by user_id",
*multiparam, **param)
assert res.fetchall() == [
(1, 'jack'),
(2, 'ed')
]
res = conn.execute("select * from users where user_name=%s",
"jack"
)
assert res.fetchall() == [(1, 'jack')]
conn.execute('delete from users')
go(testing.db)
conn = testing.db.connect()
try:
go(conn)
finally:
conn.close()
# pyformat is supported for mysql, but skipping because a few driver
# versions have a bug that bombs out on this test. (1.2.2b3,
# 1.2.2c1, 1.2.2)
@testing.skip_if(lambda : testing.against('mysql+mysqldb'),
'db-api flaky')
@testing.fails_on_everything_except('postgresql+psycopg2',
'postgresql+pypostgresql', 'mysql+mysqlconnector',
'mysql+pymysql', 'mysql+cymysql')
def test_raw_python(self):
def go(conn):
conn.execute('insert into users (user_id, user_name) '
'values (%(id)s, %(name)s)', {'id': 1, 'name'
: 'jack'})
conn.execute('insert into users (user_id, user_name) '
'values (%(id)s, %(name)s)', {'id': 2, 'name'
: 'ed'}, {'id': 3, 'name': 'horse'})
conn.execute('insert into users (user_id, user_name) '
'values (%(id)s, %(name)s)', id=4, name='sally'
)
res = conn.execute('select * from users order by user_id')
assert res.fetchall() == [(1, 'jack'), (2, 'ed'), (3,
'horse'), (4, 'sally')]
conn.execute('delete from users')
go(testing.db)
conn = testing.db.connect()
try:
go(conn)
finally:
conn.close()
@testing.fails_on_everything_except('sqlite', 'oracle+cx_oracle')
def test_raw_named(self):
def go(conn):
conn.execute('insert into users (user_id, user_name) '
'values (:id, :name)', {'id': 1, 'name': 'jack'
})
conn.execute('insert into users (user_id, user_name) '
'values (:id, :name)', {'id': 2, 'name': 'ed'
}, {'id': 3, 'name': 'horse'})
conn.execute('insert into users (user_id, user_name) '
'values (:id, :name)', id=4, name='sally')
res = conn.execute('select * from users order by user_id')
assert res.fetchall() == [(1, 'jack'), (2, 'ed'), (3,
'horse'), (4, 'sally')]
conn.execute('delete from users')
go(testing.db)
conn= testing.db.connect()
try:
go(conn)
finally:
conn.close()
@testing.engines.close_open_connections
def test_exception_wrapping_dbapi(self):
conn = testing.db.connect()
for _c in testing.db, conn:
assert_raises_message(
tsa.exc.DBAPIError,
r"not_a_valid_statement",
_c.execute, 'not_a_valid_statement'
)
@testing.requires.sqlite
def test_exception_wrapping_non_dbapi_error(self):
e = create_engine('sqlite://')
e.dialect.is_disconnect = is_disconnect = Mock()
with e.connect() as c:
c.connection.cursor = Mock(
return_value=Mock(
execute=Mock(
side_effect=TypeError("I'm not a DBAPI error")
))
)
assert_raises_message(
TypeError,
"I'm not a DBAPI error",
c.execute, "select "
)
eq_(is_disconnect.call_count, 0)
def test_exception_wrapping_non_dbapi_statement(self):
class MyType(TypeDecorator):
impl = Integer
def process_bind_param(self, value, dialect):
raise Exception("nope")
def _go(conn):
assert_raises_message(
tsa.exc.StatementError,
r"nope \(original cause: Exception: nope\) u?'SELECT 1 ",
conn.execute,
select([1]).\
where(
column('foo') == literal('bar', MyType())
)
)
_go(testing.db)
conn = testing.db.connect()
try:
_go(conn)
finally:
conn.close()
def test_stmt_exception_non_ascii(self):
name = util.u('méil')
with testing.db.connect() as conn:
assert_raises_message(
tsa.exc.StatementError,
util.u(
"A value is required for bind parameter 'uname'"
r'.*SELECT users.user_name AS .m\\xe9il.') if util.py2k
else
util.u(
"A value is required for bind parameter 'uname'"
'.*SELECT users.user_name AS .méil.')
,
conn.execute,
select([users.c.user_name.label(name)]).where(
users.c.user_name == bindparam("uname")),
{'uname_incorrect': 'foo'}
)
def test_stmt_exception_pickleable_no_dbapi(self):
self._test_stmt_exception_pickleable(Exception("hello world"))
@testing.crashes("postgresql+psycopg2",
"Older versions don't support cursor pickling, newer ones do")
@testing.fails_on("mysql+oursql",
"Exception doesn't come back exactly the same from pickle")
@testing.fails_on("mysql+mysqlconnector",
"Exception doesn't come back exactly the same from pickle")
@testing.fails_on("oracle+cx_oracle",
"cx_oracle exception seems to be having "
"some issue with pickling")
def test_stmt_exception_pickleable_plus_dbapi(self):
raw = testing.db.raw_connection()
the_orig = None
try:
try:
cursor = raw.cursor()
cursor.execute("SELECTINCORRECT")
except testing.db.dialect.dbapi.DatabaseError as orig:
# py3k has "orig" in local scope...
the_orig = orig
finally:
raw.close()
self._test_stmt_exception_pickleable(the_orig)
def _test_stmt_exception_pickleable(self, orig):
for sa_exc in (
tsa.exc.StatementError("some error",
"select * from table",
{"foo":"bar"},
orig),
tsa.exc.InterfaceError("select * from table",
{"foo":"bar"},
orig),
tsa.exc.NoReferencedTableError("message", "tname"),
tsa.exc.NoReferencedColumnError("message", "tname", "cname"),
tsa.exc.CircularDependencyError("some message", [1, 2, 3], [(1, 2), (3, 4)]),
):
for loads, dumps in picklers():
repickled = loads(dumps(sa_exc))
eq_(repickled.args[0], sa_exc.args[0])
if isinstance(sa_exc, tsa.exc.StatementError):
eq_(repickled.params, {"foo":"bar"})
eq_(repickled.statement, sa_exc.statement)
if hasattr(sa_exc, "connection_invalidated"):
eq_(repickled.connection_invalidated,
sa_exc.connection_invalidated)
eq_(repickled.orig.args[0], orig.args[0])
def test_dont_wrap_mixin(self):
class MyException(Exception, tsa.exc.DontWrapMixin):
pass
class MyType(TypeDecorator):
impl = Integer
def process_bind_param(self, value, dialect):
raise MyException("nope")
def _go(conn):
assert_raises_message(
MyException,
"nope",
conn.execute,
select([1]).\
where(
column('foo') == literal('bar', MyType())
)
)
_go(testing.db)
conn = testing.db.connect()
try:
_go(conn)
finally:
conn.close()
def test_empty_insert(self):
"""test that execute() interprets [] as a list with no params"""
testing.db.execute(users_autoinc.insert().
values(user_name=bindparam('name', None)), [])
eq_(testing.db.execute(users_autoinc.select()).fetchall(), [(1, None)])
@testing.requires.ad_hoc_engines
def test_engine_level_options(self):
eng = engines.testing_engine(options={'execution_options':
{'foo': 'bar'}})
with eng.contextual_connect() as conn:
eq_(conn._execution_options['foo'], 'bar')
eq_(conn.execution_options(bat='hoho')._execution_options['foo'
], 'bar')
eq_(conn.execution_options(bat='hoho')._execution_options['bat'
], 'hoho')
eq_(conn.execution_options(foo='hoho')._execution_options['foo'
], 'hoho')
eng.update_execution_options(foo='hoho')
conn = eng.contextual_connect()
eq_(conn._execution_options['foo'], 'hoho')
@testing.requires.ad_hoc_engines
def test_generative_engine_execution_options(self):
eng = engines.testing_engine(options={'execution_options':
{'base': 'x1'}})
eng1 = eng.execution_options(foo="b1")
eng2 = eng.execution_options(foo="b2")
eng1a = eng1.execution_options(bar="a1")
eng2a = eng2.execution_options(foo="b3", bar="a2")
eq_(eng._execution_options,
{'base': 'x1'})
eq_(eng1._execution_options,
{'base': 'x1', 'foo': 'b1'})
eq_(eng2._execution_options,
{'base': 'x1', 'foo': 'b2'})
eq_(eng1a._execution_options,
{'base': 'x1', 'foo': 'b1', 'bar': 'a1'})
eq_(eng2a._execution_options,
{'base': 'x1', 'foo': 'b3', 'bar': 'a2'})
is_(eng1a.pool, eng.pool)
# test pool is shared
eng2.dispose()
is_(eng1a.pool, eng2.pool)
is_(eng.pool, eng2.pool)
@testing.requires.ad_hoc_engines
def test_generative_engine_event_dispatch(self):
canary = []
def l1(*arg, **kw):
canary.append("l1")
def l2(*arg, **kw):
canary.append("l2")
def l3(*arg, **kw):
canary.append("l3")
eng = engines.testing_engine(options={'execution_options':
{'base': 'x1'}})
event.listen(eng, "before_execute", l1)
eng1 = eng.execution_options(foo="b1")
event.listen(eng, "before_execute", l2)
event.listen(eng1, "before_execute", l3)
eng.execute(select([1])).close()
eng1.execute(select([1])).close()
eq_(canary, ["l1", "l2", "l3", "l1", "l2"])
@testing.requires.ad_hoc_engines
def test_generative_engine_event_dispatch_hasevents(self):
def l1(*arg, **kw):
pass
eng = create_engine(testing.db.url)
assert not eng._has_events
event.listen(eng, "before_execute", l1)
eng2 = eng.execution_options(foo='bar')
assert eng2._has_events
def test_unicode_test_fails_warning(self):
class MockCursor(engines.DBAPIProxyCursor):
def execute(self, stmt, params=None, **kw):
if "test unicode returns" in stmt:
raise self.engine.dialect.dbapi.DatabaseError("boom")
else:
return super(MockCursor, self).execute(stmt, params, **kw)
eng = engines.proxying_engine(cursor_cls=MockCursor)
assert_raises_message(
tsa.exc.SAWarning,
"Exception attempting to detect unicode returns",
eng.connect
)
assert eng.dialect.returns_unicode_strings in (True, False)
eng.dispose()
def test_works_after_dispose(self):
eng = create_engine(testing.db.url)
for i in range(3):
eq_(eng.scalar(select([1])), 1)
eng.dispose()
def test_works_after_dispose_testing_engine(self):
eng = engines.testing_engine()
for i in range(3):
eq_(eng.scalar(select([1])), 1)
eng.dispose()
class ConvenienceExecuteTest(fixtures.TablesTest):
__backend__ = True
@classmethod
def define_tables(cls, metadata):
cls.table = Table('exec_test', metadata,
Column('a', Integer),
Column('b', Integer),
test_needs_acid=True
)
def _trans_fn(self, is_transaction=False):
def go(conn, x, value=None):
if is_transaction:
conn = conn.connection
conn.execute(self.table.insert().values(a=x, b=value))
return go
def _trans_rollback_fn(self, is_transaction=False):
def go(conn, x, value=None):
if is_transaction:
conn = conn.connection
conn.execute(self.table.insert().values(a=x, b=value))
raise Exception("breakage")
return go
def _assert_no_data(self):
eq_(
testing.db.scalar(self.table.count()), 0
)
def _assert_fn(self, x, value=None):
eq_(
testing.db.execute(self.table.select()).fetchall(),
[(x, value)]
)
def test_transaction_engine_ctx_commit(self):
fn = self._trans_fn()
ctx = testing.db.begin()
testing.run_as_contextmanager(ctx, fn, 5, value=8)
self._assert_fn(5, value=8)
def test_transaction_engine_ctx_begin_fails(self):
engine = engines.testing_engine()
mock_connection = Mock(
return_value=Mock(
begin=Mock(side_effect=Exception("boom"))
)
)
engine._connection_cls = mock_connection
assert_raises(
Exception,
engine.begin
)
eq_(
mock_connection.return_value.close.mock_calls,
[call()]
)
def test_transaction_engine_ctx_rollback(self):
fn = self._trans_rollback_fn()
ctx = testing.db.begin()
assert_raises_message(
Exception,
"breakage",
testing.run_as_contextmanager, ctx, fn, 5, value=8
)
self._assert_no_data()
def test_transaction_tlocal_engine_ctx_commit(self):
fn = self._trans_fn()
engine = engines.testing_engine(options=dict(
strategy='threadlocal',
pool=testing.db.pool))
ctx = engine.begin()
testing.run_as_contextmanager(ctx, fn, 5, value=8)
self._assert_fn(5, value=8)
def test_transaction_tlocal_engine_ctx_rollback(self):
fn = self._trans_rollback_fn()
engine = engines.testing_engine(options=dict(
strategy='threadlocal',
pool=testing.db.pool))
ctx = engine.begin()
assert_raises_message(
Exception,
"breakage",
testing.run_as_contextmanager, ctx, fn, 5, value=8
)
self._assert_no_data()
def test_transaction_connection_ctx_commit(self):
fn = self._trans_fn(True)
conn = testing.db.connect()
ctx = conn.begin()
testing.run_as_contextmanager(ctx, fn, 5, value=8)
self._assert_fn(5, value=8)
def test_transaction_connection_ctx_rollback(self):
fn = self._trans_rollback_fn(True)
conn = testing.db.connect()
ctx = conn.begin()
assert_raises_message(
Exception,
"breakage",
testing.run_as_contextmanager, ctx, fn, 5, value=8
)
self._assert_no_data()
def test_connection_as_ctx(self):
fn = self._trans_fn()
ctx = testing.db.connect()
testing.run_as_contextmanager(ctx, fn, 5, value=8)
# autocommit is on
self._assert_fn(5, value=8)
@testing.fails_on('mysql+oursql', "oursql bug ? getting wrong rowcount")
def test_connect_as_ctx_noautocommit(self):
fn = self._trans_fn()
self._assert_no_data()
ctx = testing.db.connect().execution_options(autocommit=False)
testing.run_as_contextmanager(ctx, fn, 5, value=8)
# autocommit is off
self._assert_no_data()
def test_transaction_engine_fn_commit(self):
fn = self._trans_fn()
testing.db.transaction(fn, 5, value=8)
self._assert_fn(5, value=8)
def test_transaction_engine_fn_rollback(self):
fn = self._trans_rollback_fn()
assert_raises_message(
Exception,
"breakage",
testing.db.transaction, fn, 5, value=8
)
self._assert_no_data()
def test_transaction_connection_fn_commit(self):
fn = self._trans_fn()
conn = testing.db.connect()
conn.transaction(fn, 5, value=8)
self._assert_fn(5, value=8)
def test_transaction_connection_fn_rollback(self):
fn = self._trans_rollback_fn()
conn = testing.db.connect()
assert_raises(
Exception,
conn.transaction, fn, 5, value=8
)
self._assert_no_data()
class CompiledCacheTest(fixtures.TestBase):
__backend__ = True
@classmethod
def setup_class(cls):
global users, metadata
metadata = MetaData(testing.db)
users = Table('users', metadata,
Column('user_id', INT, primary_key=True,
test_needs_autoincrement=True),
Column('user_name', VARCHAR(20)),
)
metadata.create_all()
@engines.close_first
def teardown(self):
testing.db.execute(users.delete())
@classmethod
def teardown_class(cls):
metadata.drop_all()
def test_cache(self):
conn = testing.db.connect()
cache = {}
cached_conn = conn.execution_options(compiled_cache=cache)
ins = users.insert()
cached_conn.execute(ins, {'user_name':'u1'})
cached_conn.execute(ins, {'user_name':'u2'})
cached_conn.execute(ins, {'user_name':'u3'})
assert len(cache) == 1
eq_(conn.execute("select count(*) from users").scalar(), 3)
class MockStrategyTest(fixtures.TestBase):
def _engine_fixture(self):
buf = util.StringIO()
def dump(sql, *multiparams, **params):
buf.write(util.text_type(sql.compile(dialect=engine.dialect)))
engine = create_engine('postgresql://', strategy='mock', executor=dump)
return engine, buf
def test_sequence_not_duped(self):
engine, buf = self._engine_fixture()
metadata = MetaData()
t = Table('testtable', metadata,
Column('pk', Integer, Sequence('testtable_pk_seq'), primary_key=True)
)
t.create(engine)
t.drop(engine)
eq_(
re.findall(r'CREATE (\w+)', buf.getvalue()),
["SEQUENCE", "TABLE"]
)
eq_(
re.findall(r'DROP (\w+)', buf.getvalue()),
["SEQUENCE", "TABLE"]
)
class ResultProxyTest(fixtures.TestBase):
__backend__ = True
def test_nontuple_row(self):
"""ensure the C version of BaseRowProxy handles
duck-type-dependent rows."""
from sqlalchemy.engine import RowProxy
class MyList(object):
def __init__(self, l):
self.l = l
def __len__(self):
return len(self.l)
def __getitem__(self, i):
return list.__getitem__(self.l, i)
proxy = RowProxy(object(), MyList(['value']), [None], {'key'
: (None, None, 0), 0: (None, None, 0)})
eq_(list(proxy), ['value'])
eq_(proxy[0], 'value')
eq_(proxy['key'], 'value')
@testing.provide_metadata
def test_no_rowcount_on_selects_inserts(self):
"""assert that rowcount is only called on deletes and updates.
This because cursor.rowcount may can be expensive on some dialects
such as Firebird, however many dialects require it be called
before the cursor is closed.
"""
metadata = self.metadata
engine = engines.testing_engine()
t = Table('t1', metadata,
Column('data', String(10))
)
metadata.create_all(engine)
with patch.object(engine.dialect.execution_ctx_cls, "rowcount") as mock_rowcount:
mock_rowcount.__get__ = Mock()
engine.execute(t.insert(),
{'data': 'd1'},
{'data': 'd2'},
{'data': 'd3'})
eq_(len(mock_rowcount.__get__.mock_calls), 0)
eq_(
engine.execute(t.select()).fetchall(),
[('d1', ), ('d2', ), ('d3', )]
)
eq_(len(mock_rowcount.__get__.mock_calls), 0)
engine.execute(t.update(), {'data': 'd4'})
eq_(len(mock_rowcount.__get__.mock_calls), 1)
engine.execute(t.delete())
eq_(len(mock_rowcount.__get__.mock_calls), 2)
def test_rowproxy_is_sequence(self):
import collections
from sqlalchemy.engine import RowProxy
row = RowProxy(object(), ['value'], [None], {'key'
: (None, None, 0), 0: (None, None, 0)})
assert isinstance(row, collections.Sequence)
@testing.requires.cextensions
def test_row_c_sequence_check(self):
import csv
import collections
metadata = MetaData()
metadata.bind = 'sqlite://'
users = Table('users', metadata,
Column('id', Integer, primary_key=True),
Column('name', String(40)),
)
users.create()
users.insert().execute(name='Test')
row = users.select().execute().fetchone()
s = util.StringIO()
writer = csv.writer(s)
# csv performs PySequenceCheck call
writer.writerow(row)
assert s.getvalue().strip() == '1,Test'
@testing.requires.selectone
def test_empty_accessors(self):
statements = [
(
"select 1",
[
lambda r: r.last_inserted_params(),
lambda r: r.last_updated_params(),
lambda r: r.prefetch_cols(),
lambda r: r.postfetch_cols(),
lambda r : r.inserted_primary_key
],
"Statement is not a compiled expression construct."
),
(
select([1]),
[
lambda r: r.last_inserted_params(),
lambda r : r.inserted_primary_key
],
r"Statement is not an insert\(\) expression construct."
),
(
select([1]),
[
lambda r: r.last_updated_params(),
],
r"Statement is not an update\(\) expression construct."
),
(
select([1]),
[
lambda r: r.prefetch_cols(),
lambda r : r.postfetch_cols()
],
r"Statement is not an insert\(\) "
r"or update\(\) expression construct."
),
]
for stmt, meths, msg in statements:
r = testing.db.execute(stmt)
try:
for meth in meths:
assert_raises_message(
tsa.exc.InvalidRequestError,
msg,
meth, r
)
finally:
r.close()
class ExecutionOptionsTest(fixtures.TestBase):
def test_dialect_conn_options(self):
engine = testing_engine("sqlite://", options=dict(_initialize=False))
engine.dialect = Mock()
conn = engine.connect()
c2 = conn.execution_options(foo="bar")
eq_(
engine.dialect.set_connection_execution_options.mock_calls,
[call(c2, {"foo": "bar"})]
)
def test_dialect_engine_options(self):
engine = testing_engine("sqlite://")
engine.dialect = Mock()
e2 = engine.execution_options(foo="bar")
eq_(
engine.dialect.set_engine_execution_options.mock_calls,
[call(e2, {"foo": "bar"})]
)
def test_dialect_engine_construction_options(self):
dialect = Mock()
engine = Engine(Mock(), dialect, Mock(),
execution_options={"foo": "bar"})
eq_(
dialect.set_engine_execution_options.mock_calls,
[call(engine, {"foo": "bar"})]
)
def test_propagate_engine_to_connection(self):
engine = testing_engine("sqlite://",
options=dict(execution_options={"foo": "bar"}))
conn = engine.connect()
eq_(conn._execution_options, {"foo": "bar"})
def test_propagate_option_engine_to_connection(self):
e1 = testing_engine("sqlite://",
options=dict(execution_options={"foo": "bar"}))
e2 = e1.execution_options(bat="hoho")
c1 = e1.connect()
c2 = e2.connect()
eq_(c1._execution_options, {"foo": "bar"})
eq_(c2._execution_options, {"foo": "bar", "bat": "hoho"})
class AlternateResultProxyTest(fixtures.TestBase):
__requires__ = ('sqlite', )
@classmethod
def setup_class(cls):
from sqlalchemy.engine import base, default
cls.engine = engine = testing_engine('sqlite://')
m = MetaData()
cls.table = t = Table('test', m,
Column('x', Integer, primary_key=True),
Column('y', String(50, convert_unicode='force'))
)
m.create_all(engine)
engine.execute(t.insert(), [
{'x':i, 'y':"t_%d" % i} for i in range(1, 12)
])
def _test_proxy(self, cls):
class ExcCtx(default.DefaultExecutionContext):
def get_result_proxy(self):
return cls(self)
self.engine.dialect.execution_ctx_cls = ExcCtx
rows = []
r = self.engine.execute(select([self.table]))
assert isinstance(r, cls)
for i in range(5):
rows.append(r.fetchone())
eq_(rows, [(i, "t_%d" % i) for i in range(1, 6)])
rows = r.fetchmany(3)
eq_(rows, [(i, "t_%d" % i) for i in range(6, 9)])
rows = r.fetchall()
eq_(rows, [(i, "t_%d" % i) for i in range(9, 12)])
r = self.engine.execute(select([self.table]))
rows = r.fetchmany(None)
eq_(rows[0], (1, "t_1"))
# number of rows here could be one, or the whole thing
assert len(rows) == 1 or len(rows) == 11
r = self.engine.execute(select([self.table]).limit(1))
r.fetchone()
eq_(r.fetchone(), None)
r = self.engine.execute(select([self.table]).limit(5))
rows = r.fetchmany(6)
eq_(rows, [(i, "t_%d" % i) for i in range(1, 6)])
def test_plain(self):
self._test_proxy(_result.ResultProxy)
def test_buffered_row_result_proxy(self):
self._test_proxy(_result.BufferedRowResultProxy)
def test_fully_buffered_result_proxy(self):
self._test_proxy(_result.FullyBufferedResultProxy)
def test_buffered_column_result_proxy(self):
self._test_proxy(_result.BufferedColumnResultProxy)
class EngineEventsTest(fixtures.TestBase):
__requires__ = 'ad_hoc_engines',
__backend__ = True
def tearDown(self):
Engine.dispatch._clear()
Engine._has_events = False
def _assert_stmts(self, expected, received):
orig = list(received)
for stmt, params, posn in expected:
if not received:
assert False, "Nothing available for stmt: %s" % stmt
while received:
teststmt, testparams, testmultiparams = \
received.pop(0)
teststmt = re.compile(r'[\n\t ]+', re.M).sub(' ',
teststmt).strip()
if teststmt.startswith(stmt) and (testparams
== params or testparams == posn):
break
def test_per_engine_independence(self):
e1 = testing_engine(config.db_url)
e2 = testing_engine(config.db_url)
canary = Mock()
event.listen(e1, "before_execute", canary)
s1 = select([1])
s2 = select([2])
e1.execute(s1)
e2.execute(s2)
eq_(
[arg[1][1] for arg in canary.mock_calls], [s1]
)
event.listen(e2, "before_execute", canary)
e1.execute(s1)
e2.execute(s2)
eq_([arg[1][1] for arg in canary.mock_calls], [s1, s1, s2])
def test_per_engine_plus_global(self):
canary = Mock()
event.listen(Engine, "before_execute", canary.be1)
e1 = testing_engine(config.db_url)
e2 = testing_engine(config.db_url)
event.listen(e1, "before_execute", canary.be2)
event.listen(Engine, "before_execute", canary.be3)
e1.connect()
e2.connect()
e1.execute(select([1]))
eq_(canary.be1.call_count, 1)
eq_(canary.be2.call_count, 1)
e2.execute(select([1]))
eq_(canary.be1.call_count, 2)
eq_(canary.be2.call_count, 1)
eq_(canary.be3.call_count, 2)
def test_per_connection_plus_engine(self):
canary = Mock()
e1 = testing_engine(config.db_url)
event.listen(e1, "before_execute", canary.be1)
conn = e1.connect()
event.listen(conn, "before_execute", canary.be2)
conn.execute(select([1]))
eq_(canary.be1.call_count, 1)
eq_(canary.be2.call_count, 1)
conn._branch().execute(select([1]))
eq_(canary.be1.call_count, 2)
eq_(canary.be2.call_count, 2)
def test_add_event_after_connect(self):
# new feature as of #2978
canary = Mock()
e1 = create_engine(config.db_url)
assert not e1._has_events
conn = e1.connect()
event.listen(e1, "before_execute", canary.be1)
conn.execute(select([1]))
eq_(canary.be1.call_count, 1)
conn._branch().execute(select([1]))
eq_(canary.be1.call_count, 2)
def test_force_conn_events_false(self):
canary = Mock()
e1 = create_engine(config.db_url)
assert not e1._has_events
event.listen(e1, "before_execute", canary.be1)
conn = e1._connection_cls(e1, connection=e1.raw_connection(),
_has_events=False)
conn.execute(select([1]))
eq_(canary.be1.call_count, 0)
conn._branch().execute(select([1]))
eq_(canary.be1.call_count, 0)
def test_cursor_events_ctx_execute_scalar(self):
canary = Mock()
e1 = testing_engine(config.db_url)
event.listen(e1, "before_cursor_execute", canary.bce)
event.listen(e1, "after_cursor_execute", canary.ace)
stmt = str(select([1]).compile(dialect=e1.dialect))
with e1.connect() as conn:
dialect = conn.dialect
ctx = dialect.execution_ctx_cls._init_statement(
dialect, conn, conn.connection, stmt, {})
ctx._execute_scalar(stmt, Integer())
eq_(canary.bce.mock_calls,
[call(conn, ctx.cursor, stmt, ctx.parameters[0], ctx, False)])
eq_(canary.ace.mock_calls,
[call(conn, ctx.cursor, stmt, ctx.parameters[0], ctx, False)])
def test_cursor_events_execute(self):
canary = Mock()
e1 = testing_engine(config.db_url)
event.listen(e1, "before_cursor_execute", canary.bce)
event.listen(e1, "after_cursor_execute", canary.ace)
stmt = str(select([1]).compile(dialect=e1.dialect))
with e1.connect() as conn:
result = conn.execute(stmt)
ctx = result.context
eq_(canary.bce.mock_calls,
[call(conn, ctx.cursor, stmt, ctx.parameters[0], ctx, False)])
eq_(canary.ace.mock_calls,
[call(conn, ctx.cursor, stmt, ctx.parameters[0], ctx, False)])
def test_argument_format_execute(self):
def before_execute(conn, clauseelement, multiparams, params):
assert isinstance(multiparams, (list, tuple))
assert isinstance(params, dict)
def after_execute(conn, clauseelement, multiparams, params, result):
assert isinstance(multiparams, (list, tuple))
assert isinstance(params, dict)
e1 = testing_engine(config.db_url)
event.listen(e1, 'before_execute', before_execute)
event.listen(e1, 'after_execute', after_execute)
e1.execute(select([1]))
e1.execute(select([1]).compile(dialect=e1.dialect).statement)
e1.execute(select([1]).compile(dialect=e1.dialect))
e1._execute_compiled(select([1]).compile(dialect=e1.dialect), (), {})
@testing.fails_on('firebird', 'Data type unknown')
def test_execute_events(self):
stmts = []
cursor_stmts = []
def execute(conn, clauseelement, multiparams,
params ):
stmts.append((str(clauseelement), params, multiparams))
def cursor_execute(conn, cursor, statement, parameters,
context, executemany):
cursor_stmts.append((str(statement), parameters, None))
for engine in [
engines.testing_engine(options=dict(implicit_returning=False)),
engines.testing_engine(options=dict(implicit_returning=False,
strategy='threadlocal')),
engines.testing_engine(options=dict(implicit_returning=False)).\
connect()
]:
event.listen(engine, 'before_execute', execute)
event.listen(engine, 'before_cursor_execute', cursor_execute)
m = MetaData(engine)
t1 = Table('t1', m,
Column('c1', Integer, primary_key=True),
Column('c2', String(50), default=func.lower('Foo'),
primary_key=True)
)
m.create_all()
try:
t1.insert().execute(c1=5, c2='some data')
t1.insert().execute(c1=6)
eq_(engine.execute('select * from t1').fetchall(), [(5,
'some data'), (6, 'foo')])
finally:
m.drop_all()
compiled = [('CREATE TABLE t1', {}, None),
('INSERT INTO t1 (c1, c2)',
{'c2': 'some data', 'c1': 5}, None),
('INSERT INTO t1 (c1, c2)',
{'c1': 6}, None),
('select * from t1', {}, None),
('DROP TABLE t1', {}, None)]
# or engine.dialect.preexecute_pk_sequences:
if not testing.against('oracle+zxjdbc'):
cursor = [
('CREATE TABLE t1', {}, ()),
('INSERT INTO t1 (c1, c2)', {
'c2': 'some data', 'c1': 5},
(5, 'some data')),
('SELECT lower', {'lower_2': 'Foo'},
('Foo', )),
('INSERT INTO t1 (c1, c2)',
{'c2': 'foo', 'c1': 6},
(6, 'foo')),
('select * from t1', {}, ()),
('DROP TABLE t1', {}, ()),
]
else:
insert2_params = 6, 'Foo'
if testing.against('oracle+zxjdbc'):
insert2_params += (ReturningParam(12), )
cursor = [('CREATE TABLE t1', {}, ()),
('INSERT INTO t1 (c1, c2)',
{'c2': 'some data', 'c1': 5}, (5, 'some data')),
('INSERT INTO t1 (c1, c2)', {'c1': 6,
'lower_2': 'Foo'}, insert2_params),
('select * from t1', {}, ()),
('DROP TABLE t1', {}, ())]
# bind param name 'lower_2' might
# be incorrect
self._assert_stmts(compiled, stmts)
self._assert_stmts(cursor, cursor_stmts)
def test_options(self):
canary = []
def execute(conn, *args, **kw):
canary.append('execute')
def cursor_execute(conn, *args, **kw):
canary.append('cursor_execute')
engine = engines.testing_engine()
event.listen(engine, 'before_execute', execute)
event.listen(engine, 'before_cursor_execute', cursor_execute)
conn = engine.connect()
c2 = conn.execution_options(foo='bar')
eq_(c2._execution_options, {'foo':'bar'})
c2.execute(select([1]))
c3 = c2.execution_options(bar='bat')
eq_(c3._execution_options, {'foo':'bar', 'bar':'bat'})
eq_(canary, ['execute', 'cursor_execute'])
def test_retval_flag(self):
canary = []
def tracker(name):
def go(conn, *args, **kw):
canary.append(name)
return go
def execute(conn, clauseelement, multiparams, params):
canary.append('execute')
return clauseelement, multiparams, params
def cursor_execute(conn, cursor, statement,
parameters, context, executemany):
canary.append('cursor_execute')
return statement, parameters
engine = engines.testing_engine()
assert_raises(
tsa.exc.ArgumentError,
event.listen, engine, "begin", tracker("begin"), retval=True
)
event.listen(engine, "before_execute", execute, retval=True)
event.listen(engine, "before_cursor_execute", cursor_execute, retval=True)
engine.execute(select([1]))
eq_(
canary, ['execute', 'cursor_execute']
)
def test_engine_connect(self):
engine = engines.testing_engine()
tracker = Mock()
event.listen(engine, "engine_connect", tracker)
c1 = engine.connect()
c2 = c1._branch()
c1.close()
eq_(
tracker.mock_calls,
[call(c1, False), call(c2, True)]
)
def test_execution_options(self):
engine = engines.testing_engine()
engine_tracker = Mock()
conn_tracker = Mock()
event.listen(engine, "set_engine_execution_options", engine_tracker)
event.listen(engine, "set_connection_execution_options", conn_tracker)
e2 = engine.execution_options(e1='opt_e1')
c1 = engine.connect()
c2 = c1.execution_options(c1='opt_c1')
c3 = e2.connect()
c4 = c3.execution_options(c3='opt_c3')
eq_(
engine_tracker.mock_calls,
[call(e2, {'e1': 'opt_e1'})]
)
eq_(
conn_tracker.mock_calls,
[call(c2, {"c1": "opt_c1"}), call(c4, {"c3": "opt_c3"})]
)
@testing.requires.sequences
@testing.provide_metadata
def test_cursor_execute(self):
canary = []
def tracker(name):
def go(conn, cursor, statement, parameters, context, executemany):
canary.append((statement, context))
return go
engine = engines.testing_engine()
t = Table('t', self.metadata,
Column('x', Integer, Sequence('t_id_seq'), primary_key=True),
implicit_returning=False
)
self.metadata.create_all(engine)
with engine.begin() as conn:
event.listen(conn, 'before_cursor_execute', tracker('cursor_execute'))
conn.execute(t.insert())
# we see the sequence pre-executed in the first call
assert "t_id_seq" in canary[0][0]
assert "INSERT" in canary[1][0]
# same context
is_(
canary[0][1], canary[1][1]
)
def test_transactional(self):
canary = []
def tracker(name):
def go(conn, *args, **kw):
canary.append(name)
return go
engine = engines.testing_engine()
event.listen(engine, 'before_execute', tracker('execute'))
event.listen(engine, 'before_cursor_execute', tracker('cursor_execute'))
event.listen(engine, 'begin', tracker('begin'))
event.listen(engine, 'commit', tracker('commit'))
event.listen(engine, 'rollback', tracker('rollback'))
conn = engine.connect()
trans = conn.begin()
conn.execute(select([1]))
trans.rollback()
trans = conn.begin()
conn.execute(select([1]))
trans.commit()
eq_(canary, [
'begin', 'execute', 'cursor_execute', 'rollback',
'begin', 'execute', 'cursor_execute', 'commit',
])
@testing.requires.savepoints
@testing.requires.two_phase_transactions
def test_transactional_advanced(self):
canary1 = []
def tracker1(name):
def go(*args, **kw):
canary1.append(name)
return go
canary2 = []
def tracker2(name):
def go(*args, **kw):
canary2.append(name)
return go
engine = engines.testing_engine()
for name in ['begin', 'savepoint',
'rollback_savepoint', 'release_savepoint',
'rollback', 'begin_twophase',
'prepare_twophase', 'commit_twophase']:
event.listen(engine, '%s' % name, tracker1(name))
conn = engine.connect()
for name in ['begin', 'savepoint',
'rollback_savepoint', 'release_savepoint',
'rollback', 'begin_twophase',
'prepare_twophase', 'commit_twophase']:
event.listen(conn, '%s' % name, tracker2(name))
trans = conn.begin()
trans2 = conn.begin_nested()
conn.execute(select([1]))
trans2.rollback()
trans2 = conn.begin_nested()
conn.execute(select([1]))
trans2.commit()
trans.rollback()
trans = conn.begin_twophase()
conn.execute(select([1]))
trans.prepare()
trans.commit()
eq_(canary1, ['begin', 'savepoint',
'rollback_savepoint', 'savepoint', 'release_savepoint',
'rollback', 'begin_twophase',
'prepare_twophase', 'commit_twophase']
)
eq_(canary2, ['begin', 'savepoint',
'rollback_savepoint', 'savepoint', 'release_savepoint',
'rollback', 'begin_twophase',
'prepare_twophase', 'commit_twophase']
)
class HandleErrorTest(fixtures.TestBase):
__requires__ = 'ad_hoc_engines',
__backend__ = True
def tearDown(self):
Engine.dispatch._clear()
Engine._has_events = False
def test_legacy_dbapi_error(self):
engine = engines.testing_engine()
canary = Mock()
event.listen(engine, "dbapi_error", canary)
with engine.connect() as conn:
try:
conn.execute("SELECT FOO FROM I_DONT_EXIST")
assert False
except tsa.exc.DBAPIError as e:
eq_(canary.mock_calls[0][1][5], e.orig)
eq_(canary.mock_calls[0][1][2], "SELECT FOO FROM I_DONT_EXIST")
def test_legacy_dbapi_error_no_ad_hoc_context(self):
engine = engines.testing_engine()
listener = Mock(return_value=None)
event.listen(engine, 'dbapi_error', listener)
nope = Exception("nope")
class MyType(TypeDecorator):
impl = Integer
def process_bind_param(self, value, dialect):
raise nope
with engine.connect() as conn:
assert_raises_message(
tsa.exc.StatementError,
r"nope \(original cause: Exception: nope\) u?'SELECT 1 ",
conn.execute,
select([1]).where(
column('foo') == literal('bar', MyType()))
)
# no legacy event
eq_(listener.mock_calls, [])
def test_legacy_dbapi_error_non_dbapi_error(self):
engine = engines.testing_engine()
listener = Mock(return_value=None)
event.listen(engine, 'dbapi_error', listener)
nope = TypeError("I'm not a DBAPI error")
with engine.connect() as c:
c.connection.cursor = Mock(
return_value=Mock(
execute=Mock(
side_effect=nope
))
)
assert_raises_message(
TypeError,
"I'm not a DBAPI error",
c.execute, "select "
)
# no legacy event
eq_(listener.mock_calls, [])
def test_handle_error(self):
engine = engines.testing_engine()
canary = Mock(return_value=None)
event.listen(engine, "handle_error", canary)
with engine.connect() as conn:
try:
conn.execute("SELECT FOO FROM I_DONT_EXIST")
assert False
except tsa.exc.DBAPIError as e:
ctx = canary.mock_calls[0][1][0]
eq_(ctx.original_exception, e.orig)
is_(ctx.sqlalchemy_exception, e)
eq_(ctx.statement, "SELECT FOO FROM I_DONT_EXIST")
def test_exception_event_reraise(self):
engine = engines.testing_engine()
class MyException(Exception):
pass
@event.listens_for(engine, 'handle_error', retval=True)
def err(context):
stmt = context.statement
exception = context.original_exception
if "ERROR ONE" in str(stmt):
return MyException("my exception")
elif "ERROR TWO" in str(stmt):
return exception
else:
return None
conn = engine.connect()
# case 1: custom exception
assert_raises_message(
MyException,
"my exception",
conn.execute, "SELECT 'ERROR ONE' FROM I_DONT_EXIST"
)
# case 2: return the DBAPI exception we're given;
# no wrapping should occur
assert_raises(
conn.dialect.dbapi.Error,
conn.execute, "SELECT 'ERROR TWO' FROM I_DONT_EXIST"
)
# case 3: normal wrapping
assert_raises(
tsa.exc.DBAPIError,
conn.execute, "SELECT 'ERROR THREE' FROM I_DONT_EXIST"
)
def test_exception_event_reraise_chaining(self):
engine = engines.testing_engine()
class MyException1(Exception):
pass
class MyException2(Exception):
pass
class MyException3(Exception):
pass
@event.listens_for(engine, 'handle_error', retval=True)
def err1(context):
stmt = context.statement
if "ERROR ONE" in str(stmt) or "ERROR TWO" in str(stmt) \
or "ERROR THREE" in str(stmt):
return MyException1("my exception")
elif "ERROR FOUR" in str(stmt):
raise MyException3("my exception short circuit")
@event.listens_for(engine, 'handle_error', retval=True)
def err2(context):
stmt = context.statement
if ("ERROR ONE" in str(stmt) or "ERROR FOUR" in str(stmt)) \
and isinstance(context.chained_exception, MyException1):
raise MyException2("my exception chained")
elif "ERROR TWO" in str(stmt):
return context.chained_exception
else:
return None
conn = engine.connect()
with patch.object(engine.
dialect.execution_ctx_cls,
"handle_dbapi_exception") as patched:
assert_raises_message(
MyException2,
"my exception chained",
conn.execute, "SELECT 'ERROR ONE' FROM I_DONT_EXIST"
)
eq_(patched.call_count, 1)
with patch.object(engine.
dialect.execution_ctx_cls,
"handle_dbapi_exception") as patched:
assert_raises(
MyException1,
conn.execute, "SELECT 'ERROR TWO' FROM I_DONT_EXIST"
)
eq_(patched.call_count, 1)
with patch.object(engine.
dialect.execution_ctx_cls,
"handle_dbapi_exception") as patched:
# test that non None from err1 isn't cancelled out
# by err2
assert_raises(
MyException1,
conn.execute, "SELECT 'ERROR THREE' FROM I_DONT_EXIST"
)
eq_(patched.call_count, 1)
with patch.object(engine.
dialect.execution_ctx_cls,
"handle_dbapi_exception") as patched:
assert_raises(
tsa.exc.DBAPIError,
conn.execute, "SELECT 'ERROR FIVE' FROM I_DONT_EXIST"
)
eq_(patched.call_count, 1)
with patch.object(engine.
dialect.execution_ctx_cls,
"handle_dbapi_exception") as patched:
assert_raises_message(
MyException3,
"my exception short circuit",
conn.execute, "SELECT 'ERROR FOUR' FROM I_DONT_EXIST"
)
eq_(patched.call_count, 1)
def test_exception_event_ad_hoc_context(self):
"""test that handle_error is called with a context in
cases where _handle_dbapi_error() is normally called without
any context.
"""
engine = engines.testing_engine()
listener = Mock(return_value=None)
event.listen(engine, 'handle_error', listener)
nope = Exception("nope")
class MyType(TypeDecorator):
impl = Integer
def process_bind_param(self, value, dialect):
raise nope
with engine.connect() as conn:
assert_raises_message(
tsa.exc.StatementError,
r"nope \(original cause: Exception: nope\) u?'SELECT 1 ",
conn.execute,
select([1]).where(
column('foo') == literal('bar', MyType()))
)
ctx = listener.mock_calls[0][1][0]
assert ctx.statement.startswith("SELECT 1 ")
is_(ctx.is_disconnect, False)
is_(ctx.original_exception, nope)
def test_exception_event_non_dbapi_error(self):
"""test that dbapi_error is called with a context in
cases where DBAPI raises an exception that is not a DBAPI
exception, e.g. internal errors or encoding problems.
"""
engine = engines.testing_engine()
listener = Mock(return_value=None)
event.listen(engine, 'handle_error', listener)
nope = TypeError("I'm not a DBAPI error")
with engine.connect() as c:
c.connection.cursor = Mock(
return_value=Mock(
execute=Mock(
side_effect=nope
))
)
assert_raises_message(
TypeError,
"I'm not a DBAPI error",
c.execute, "select "
)
ctx = listener.mock_calls[0][1][0]
eq_(ctx.statement, "select ")
is_(ctx.is_disconnect, False)
is_(ctx.original_exception, nope)
def _test_alter_disconnect(self, orig_error, evt_value):
engine = engines.testing_engine()
@event.listens_for(engine, "handle_error")
def evt(ctx):
ctx.is_disconnect = evt_value
with patch.object(engine.dialect, "is_disconnect",
Mock(return_value=orig_error)):
with engine.connect() as c:
try:
c.execute("SELECT x FROM nonexistent")
assert False
except tsa.exc.StatementError as st:
eq_(st.connection_invalidated, evt_value)
def test_alter_disconnect_to_true(self):
self._test_alter_disconnect(False, True)
self._test_alter_disconnect(True, True)
def test_alter_disconnect_to_false(self):
self._test_alter_disconnect(True, False)
self._test_alter_disconnect(False, False)
class ProxyConnectionTest(fixtures.TestBase):
"""These are the same tests as EngineEventsTest, except using
the deprecated ConnectionProxy interface.
"""
__requires__ = 'ad_hoc_engines',
__prefer_requires__ = 'two_phase_transactions',
@testing.uses_deprecated(r'.*Use event.listen')
@testing.fails_on('firebird', 'Data type unknown')
def test_proxy(self):
stmts = []
cursor_stmts = []
class MyProxy(ConnectionProxy):
def execute(
self,
conn,
execute,
clauseelement,
*multiparams,
**params
):
stmts.append((str(clauseelement), params, multiparams))
return execute(clauseelement, *multiparams, **params)
def cursor_execute(
self,
execute,
cursor,
statement,
parameters,
context,
executemany,
):
cursor_stmts.append((str(statement), parameters, None))
return execute(cursor, statement, parameters, context)
def assert_stmts(expected, received):
for stmt, params, posn in expected:
if not received:
assert False, "Nothing available for stmt: %s" % stmt
while received:
teststmt, testparams, testmultiparams = \
received.pop(0)
teststmt = re.compile(r'[\n\t ]+', re.M).sub(' ',
teststmt).strip()
if teststmt.startswith(stmt) and (testparams
== params or testparams == posn):
break
for engine in \
engines.testing_engine(options=dict(implicit_returning=False,
proxy=MyProxy())), \
engines.testing_engine(options=dict(implicit_returning=False,
proxy=MyProxy(),
strategy='threadlocal')):
m = MetaData(engine)
t1 = Table('t1', m,
Column('c1', Integer, primary_key=True),
Column('c2', String(50), default=func.lower('Foo'),
primary_key=True)
)
m.create_all()
try:
t1.insert().execute(c1=5, c2='some data')
t1.insert().execute(c1=6)
eq_(engine.execute('select * from t1').fetchall(), [(5,
'some data'), (6, 'foo')])
finally:
m.drop_all()
engine.dispose()
compiled = [('CREATE TABLE t1', {}, None),
('INSERT INTO t1 (c1, c2)', {'c2': 'some data',
'c1': 5}, None), ('INSERT INTO t1 (c1, c2)',
{'c1': 6}, None), ('select * from t1', {},
None), ('DROP TABLE t1', {}, None)]
if not testing.against('oracle+zxjdbc'): # or engine.dialect.pr
# eexecute_pk_sequence
# s:
cursor = [
('CREATE TABLE t1', {}, ()),
('INSERT INTO t1 (c1, c2)', {'c2': 'some data', 'c1'
: 5}, (5, 'some data')),
('SELECT lower', {'lower_2': 'Foo'},
('Foo', )),
('INSERT INTO t1 (c1, c2)', {'c2': 'foo', 'c1': 6},
(6, 'foo')),
('select * from t1', {}, ()),
('DROP TABLE t1', {}, ()),
]
else:
insert2_params = 6, 'Foo'
if testing.against('oracle+zxjdbc'):
insert2_params += (ReturningParam(12), )
cursor = [('CREATE TABLE t1', {}, ()),
('INSERT INTO t1 (c1, c2)', {'c2': 'some data'
, 'c1': 5}, (5, 'some data')),
('INSERT INTO t1 (c1, c2)', {'c1': 6,
'lower_2': 'Foo'}, insert2_params),
('select * from t1', {}, ()), ('DROP TABLE t1'
, {}, ())] # bind param name 'lower_2' might
# be incorrect
assert_stmts(compiled, stmts)
assert_stmts(cursor, cursor_stmts)
@testing.uses_deprecated(r'.*Use event.listen')
def test_options(self):
canary = []
class TrackProxy(ConnectionProxy):
def __getattribute__(self, key):
fn = object.__getattribute__(self, key)
def go(*arg, **kw):
canary.append(fn.__name__)
return fn(*arg, **kw)
return go
engine = engines.testing_engine(options={'proxy':TrackProxy()})
conn = engine.connect()
c2 = conn.execution_options(foo='bar')
eq_(c2._execution_options, {'foo':'bar'})
c2.execute(select([1]))
c3 = c2.execution_options(bar='bat')
eq_(c3._execution_options, {'foo':'bar', 'bar':'bat'})
eq_(canary, ['execute', 'cursor_execute'])
@testing.uses_deprecated(r'.*Use event.listen')
def test_transactional(self):
canary = []
class TrackProxy(ConnectionProxy):
def __getattribute__(self, key):
fn = object.__getattribute__(self, key)
def go(*arg, **kw):
canary.append(fn.__name__)
return fn(*arg, **kw)
return go
engine = engines.testing_engine(options={'proxy':TrackProxy()})
conn = engine.connect()
trans = conn.begin()
conn.execute(select([1]))
trans.rollback()
trans = conn.begin()
conn.execute(select([1]))
trans.commit()
eq_(canary, [
'begin', 'execute', 'cursor_execute', 'rollback',
'begin', 'execute', 'cursor_execute', 'commit',
])
@testing.uses_deprecated(r'.*Use event.listen')
@testing.requires.savepoints
@testing.requires.two_phase_transactions
def test_transactional_advanced(self):
canary = []
class TrackProxy(ConnectionProxy):
def __getattribute__(self, key):
fn = object.__getattribute__(self, key)
def go(*arg, **kw):
canary.append(fn.__name__)
return fn(*arg, **kw)
return go
engine = engines.testing_engine(options={'proxy':TrackProxy()})
conn = engine.connect()
trans = conn.begin()
trans2 = conn.begin_nested()
conn.execute(select([1]))
trans2.rollback()
trans2 = conn.begin_nested()
conn.execute(select([1]))
trans2.commit()
trans.rollback()
trans = conn.begin_twophase()
conn.execute(select([1]))
trans.prepare()
trans.commit()
canary = [t for t in canary if t not in ('cursor_execute', 'execute')]
eq_(canary, ['begin', 'savepoint',
'rollback_savepoint', 'savepoint', 'release_savepoint',
'rollback', 'begin_twophase',
'prepare_twophase', 'commit_twophase']
)
class DialectEventTest(fixtures.TestBase):
@contextmanager
def _run_test(self, retval):
m1 = Mock()
m1.do_execute.return_value = retval
m1.do_executemany.return_value = retval
m1.do_execute_no_params.return_value = retval
e = engines.testing_engine(options={"_initialize": False})
event.listen(e, "do_execute", m1.do_execute)
event.listen(e, "do_executemany", m1.do_executemany)
event.listen(e, "do_execute_no_params", m1.do_execute_no_params)
e.dialect.do_execute = m1.real_do_execute
e.dialect.do_executemany = m1.real_do_executemany
e.dialect.do_execute_no_params = m1.real_do_execute_no_params
def mock_the_cursor(cursor, *arg):
arg[-1].get_result_proxy = Mock(return_value=Mock(context=arg[-1]))
return retval
m1.real_do_execute.side_effect = m1.do_execute.side_effect = mock_the_cursor
m1.real_do_executemany.side_effect = m1.do_executemany.side_effect = mock_the_cursor
m1.real_do_execute_no_params.side_effect = m1.do_execute_no_params.side_effect = mock_the_cursor
with e.connect() as conn:
yield conn, m1
def _assert(self, retval, m1, m2, mock_calls):
eq_(m1.mock_calls, mock_calls)
if retval:
eq_(m2.mock_calls, [])
else:
eq_(m2.mock_calls, mock_calls)
def _test_do_execute(self, retval):
with self._run_test(retval) as (conn, m1):
result = conn.execute("insert into table foo", {"foo": "bar"})
self._assert(
retval,
m1.do_execute, m1.real_do_execute,
[call(
result.context.cursor,
"insert into table foo",
{"foo": "bar"}, result.context)]
)
def _test_do_executemany(self, retval):
with self._run_test(retval) as (conn, m1):
result = conn.execute("insert into table foo",
[{"foo": "bar"}, {"foo": "bar"}])
self._assert(
retval,
m1.do_executemany, m1.real_do_executemany,
[call(
result.context.cursor,
"insert into table foo",
[{"foo": "bar"}, {"foo": "bar"}], result.context)]
)
def _test_do_execute_no_params(self, retval):
with self._run_test(retval) as (conn, m1):
result = conn.execution_options(no_parameters=True).\
execute("insert into table foo")
self._assert(
retval,
m1.do_execute_no_params, m1.real_do_execute_no_params,
[call(
result.context.cursor,
"insert into table foo", result.context)]
)
def _test_cursor_execute(self, retval):
with self._run_test(retval) as (conn, m1):
dialect = conn.dialect
stmt = "insert into table foo"
params = {"foo": "bar"}
ctx = dialect.execution_ctx_cls._init_statement(
dialect, conn, conn.connection, stmt, [params])
conn._cursor_execute(ctx.cursor, stmt, params, ctx)
self._assert(
retval,
m1.do_execute, m1.real_do_execute,
[call(
ctx.cursor,
"insert into table foo",
{"foo": "bar"}, ctx)]
)
def test_do_execute_w_replace(self):
self._test_do_execute(True)
def test_do_execute_wo_replace(self):
self._test_do_execute(False)
def test_do_executemany_w_replace(self):
self._test_do_executemany(True)
def test_do_executemany_wo_replace(self):
self._test_do_executemany(False)
def test_do_execute_no_params_w_replace(self):
self._test_do_execute_no_params(True)
def test_do_execute_no_params_wo_replace(self):
self._test_do_execute_no_params(False)
def test_cursor_execute_w_replace(self):
self._test_cursor_execute(True)
def test_cursor_execute_wo_replace(self):
self._test_cursor_execute(False)
|
michaelBenin/sqlalchemy
|
test/engine/test_execute.py
|
Python
|
mit
| 70,582 | 34.431727 | 104 | 0.512213 | false |
/**
* Copyright (C) 2013 Tobias P. Becker
*
* 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.
*
* More information at: https://dslib.assembla.com/
*
*/
#pragma once
#include <core/patterns/Derivable.h>
#include <core/collection/containers/Set.h>
#include <core/Comparator.h>
namespace nspace {
/**
* \brief Node.
*/
template<typename Derived>
class Node : public Derivable<Derived>, public ObservableCollection<Derived*>, public ObservableCollection<Derived*>::Observer {
private:
/**
* \brief The predecessors.
*/
Set<Derived*> _predecessors;
/**
* \brief The successors.
*/
Set<Derived*> _successors;
public:
/**
* \brief Default constructor.
*/
Node();
/**
* \brief Destructor. removes all successors and predecessors
*/
virtual ~Node();
/**
* \brief callback when an element is added to the node. makes sure that the nodes are connected in
* both directions.
*
* \param [in,out] sender If non-null, the sender.
* \param [in,out] node If non-null, the node.
*/
void elementAdded(ObservableCollection<Derived*> * sender, Derived * node);
/**
* \brief callback when an element is removed from the node. makes sure the nodes are removed.
*
* \param [in,out] sender If non-null, the sender.
* \param [in,out] node If non-null, the node.
*/
void elementRemoved(ObservableCollection<Derived*> * sender, Derived * node);
/**
* \brief all connected nodes (union of predecessors and successors)
*
* \return null if it fails, else.
*/
Set<Derived*> neighbors() const;
/**
* \brief read access to predecessors.
*
* \return null if it fails, else.
*/
const Set<Derived*> & predecessors() const;
/**
* \brief read write access to predecessors.
*
* \return null if it fails, else.
*/
Set<Derived*> & predecessors();
/**
* \brief read write access to successor by index.
*
* \param i Zero-based index of the.
*
* \return null if it fails, else.
*/
Derived * successor(uint i);
/**
* \brief read access to successor by index.
*
* \param i Zero-based index of the.
*
* \return null if it fails, else.
*/
const Derived * successor(uint i) const;
/**
* \brief read / write access to predecessor by index.
*
* \param i Zero-based index of the.
*
* \return null if it fails, else.
*/
Derived * predecessor(uint i);
/**
* \brief read access to predecessor by index.
*
* \param i Zero-based index of the.
*
* \return null if it fails, else.
*/
const Derived * predecessor(uint i) const;
/**
* \brief read access tot first successor.
*
* \return null if it fails, else.
*/
const Derived * firstSuccessor() const;
/**
* \brief read write access to first successor.
*
* \return null if it fails, else.
*/
Derived * firstSuccessor();
/**
* \brief returns the first predecessor (const)
*
* \return null if it fails, else.
*/
const Derived * firstPredecessor() const;
/**
* \brief returns the first predecessor.
*
* \return null if it fails, else.
*/
Derived * firstPredecessor();
/**
* \brief allows const access to the successors.
*
* \return null if it fails, else.
*/
const Set<Derived*> & successors() const;
/**
* \brief allows access to the successors.
*
* \return null if it fails, else.
*/
Set<Derived*> & successors();
/**
* \brief adds a set of predecessors (arrows indicate direction of connection.
*
* \param nodes The nodes.
*
* \return The shifted result.
*/
Derived & operator <<(const Set<Derived*> &nodes);
/**
* \brief adds a set of successors.
*
* \param nodes The nodes.
*
* \return The shifted result.
*/
Derived & operator >>(const Set<Derived*> &nodes);
/**
* \brief adds a single predecessor.
*
* \param [in,out] node The node.
*
* \return The shifted result.
*/
Derived & operator <<(Derived & node);
/**
* \brief adds a single successor.
*
* \param [in,out] node The node.
*
* \return The shifted result.
*/
Derived & operator >>(Derived & node);
/**
* \brief adds a single predecessor (by pointer)
*
* \param [in,out] node If non-null, the node.
*
* \return The shifted result.
*/
Derived & operator <<(Derived * node);
/**
* \brief adds a single successor (by pointer)
*
* \param [in,out] node If non-null, the node.
*
* \return The shifted result.
*/
Derived & operator >>(Derived * node);
/**
* \brief removes the node from successors and predecessors.
*
* \param [in,out] node If non-null, the node to remove.
*/
void remove(Derived * node);
/**
* \brief iterates the neighbors.
*
* \param [in,out] action If non-null, the action.
*/
void foreachNeighbor(std::function<void (Derived*)> action) const;
/**
* \brief iterates the predecessors.
*
* \param [in,out] action If non-null, the action.
*/
void foreachPredecessor(std::function<void (Derived*)> action) const;
/**
* \brief iterates the successors.
*
* \param [in,out] action If non-null, the action.
*/
void foreachSuccessor(std::function<void (Derived*)> action) const;
/**
* \brief does a depth first search calling action on every node and also passing the path to the
* node as a parameter to action.
*
* \param [in,out] action If non-null, the action.
* \param currentpath (optional) [in,out] If non-null, the currentpath.
*/
void dfsWithPath(std::function<void (Derived *, Set<Derived * > )> action, Set<Derived * > currentpath = Set<Derived*>());
/**
* \brief Dfs the given action.
*
* \param [in,out] action If non-null, the action.
*/
void dfs(std::function<void (Derived * )> action);
/**
* \brief really bad implementation of dfs, it is slow and will crash (stack overflow ) if there
* are cycles in the graph.
*
* \param [in,out] f [in,out] If non-null, the std::function<void(bool&,Derived*)> to
* process.
* \param successors The successors.
*/
void dfs(std::function<void (bool &, Derived *)> f, std::function<void (Set<Derived*> &, const Derived &) > successors);
/**
* \brief also a realy bad implemention. this time of bfs (performancewise). it does not crash if
* cycles are contained and returns the number of cycles found.
*
* \param [in,out] f [in,out] If non-null, the std::function<void(bool&,Derived*)> to
* process.
* \param successors The successors.
*
* \return .
*/
int bfs(std::function<void (bool&,Derived*)> f,std::function<void (Set<Derived*> &, const Derived &) > successors);
/**
* \brief overload.
*
* \param [in,out] f [in,out] If non-null, the std::function<void(bool&,Derived*)> to
* process.
*
* \return .
*/
int bfs(std::function<void (bool&,Derived*)> f);
/**
* \brief Executes the predecessor added action.
*
* \param [in,out] predecessor If non-null, the predecessor.
*/
virtual void onPredecessorAdded(Derived * predecessor){}
/**
* \brief Executes the successor added action.
*
* \param [in,out] successor If non-null, the successor.
*/
virtual void onSuccessorAdded(Derived * successor){}
/**
* \brief Executes the predecessor removed action.
*
* \param [in,out] predecessor If non-null, the predecessor.
*/
virtual void onPredecessorRemoved(Derived* predecessor){}
/**
* \brief Executes the successor removed action.
*
* \param [in,out] predecessor If non-null, the predecessor.
*/
virtual void onSuccessorRemoved(Derived * predecessor){}
};
// implementation of node
template<typename Derived>
void Node<Derived>::remove(Derived * node){
successors()/=node; predecessors()/=node;
}
template<typename Derived>
void Node<Derived>::foreachNeighbor(std::function<void (Derived*)> action) const {
neighbors().foreachElement(action);
}
template<typename Derived>
void Node<Derived>::foreachPredecessor(std::function<void (Derived*)> action) const {
predecessors().foreachElement(action);
}
template<typename Derived>
void Node<Derived>::foreachSuccessor(std::function<void (Derived*)> action) const {
successors().foreachElement(action);
}
template<typename Derived>
Node<Derived>::Node(){
_predecessors.addObserver(this);
_successors.addObserver(this);
}
template<typename Derived>
Node<Derived>::~Node(){
_predecessors.clear();
_successors.clear();
}
// callback when an element is added to the node. makes sure that the nodes are connected in both directions
template<typename Derived>
void Node<Derived>::elementAdded(ObservableCollection<Derived*> * sender, Derived * node){
if(sender==&_predecessors) {
onPredecessorAdded(node);
node->successors() |= &this->derived();
}
if(sender==&_successors) {
onSuccessorAdded(node);
node->predecessors()|=&this->derived();
}
}
// callback when an element is removed from the node. makes sure the nodes are removed
template<typename Derived>
void Node<Derived>::elementRemoved(ObservableCollection<Derived*> * sender, Derived * node){
if(sender==&_predecessors) {
onPredecessorRemoved(node);
node->successors() /=&this->derived();
}
if(sender==&_successors) {
onSuccessorRemoved(node);
node->predecessors()/=&this->derived();
}
}
// all connected nodes (union of predecessors and successors)
template<typename Derived>
Set<Derived*> Node<Derived>::neighbors() const {
return predecessors()|successors();
}
// read access to predecessors
template<typename Derived>
const Set<Derived*> & Node<Derived>::predecessors() const {
return _predecessors;
}
// read write access to predecessors
template<typename Derived>
Set<Derived*> & Node<Derived>::predecessors(){
return _predecessors;
}
// read write access to successor by index
template<typename Derived>
Derived * Node<Derived>::successor(uint i){
return successors().at(i);
}
// read access to successor by index
template<typename Derived>
const Derived * Node<Derived>::successor(uint i) const {
return successors().at(i);
}
//read / write access to predecessor by index
template<typename Derived>
Derived * Node<Derived>::predecessor(uint i){
return predecessors().at(i);
}
// read access to predecessor by index
template<typename Derived>
const Derived * Node<Derived>::predecessor(uint i) const {
return predecessors().at(i);
}
// read access tot first successor
template<typename Derived>
const Derived * Node<Derived>::firstSuccessor() const {
return successors().first();
}
//read write access to first successor
template<typename Derived>
Derived * Node<Derived>::firstSuccessor(){
return successors().first();
}
// returns the first predecessor (const)
template<typename Derived>
const Derived * Node<Derived>::firstPredecessor() const {
return predecessors().first();
}
// returns the first predecessor
template<typename Derived>
Derived * Node<Derived>::firstPredecessor(){
return predecessors().first();
}
// allows const access to the successors
template<typename Derived>
const Set<Derived*> & Node<Derived>::successors() const {
return _successors;
}
//allows access to the successors
template<typename Derived>
Set<Derived*> & Node<Derived>::successors(){
return _successors;
}
// adds a set of predecessors (arrows indicate direction of connection
template<typename Derived>
Derived & Node<Derived>::operator <<(const Set<Derived*> &nodes){
predecessors() |= nodes;
return this->derived();
}
// adds a set of successors
template<typename Derived>
Derived & Node<Derived>::operator >>(const Set<Derived*> &nodes){
successors() |= nodes;
return this->derived();
}
// adds a single predecessor
template<typename Derived>
Derived & Node<Derived>::operator <<(Derived & node){
predecessors().add(&node);
return this->derived();
}
//adds a single successor
template<typename Derived>
Derived & Node<Derived>::operator >>(Derived & node){
successors().add(&node);
return this->derived();
}
// adds a single predecessor (by pointer)
template<typename Derived>
Derived & Node<Derived>::operator <<(Derived * node){
predecessors().add(node);
return this->derived();
}
// adds a single successor (by pointer)
template<typename Derived>
Derived & Node<Derived>::operator >>(Derived * node){
successors().add(node);
return this->derived();
}
template<typename Derived>
void Node<Derived>::dfsWithPath(std::function<void (Derived *, Set<Derived * > )> action, Set<Derived * > currentpath){
action(&this->derived(),currentpath);
successors().foreachElement([action,this,¤tpath](Derived * next){
next->dfsWithPath(action,currentpath|&this->derived());
});
}
template<typename Derived>
void Node<Derived>::dfs(std::function<void (Derived * )> action){
auto a = [action](bool& b, Derived * d){action(d); };
auto b = [] (Set<Derived * > &successors, const Derived ¤t){successors |= current.successors(); };
dfs(a,b );
}
// really bad implementation of dfs, it is slow and will crash (stack overflow ) if there are cycles in the graph
template<typename Derived>
void Node<Derived>::dfs(std::function<void (bool &, Derived *)> f, std::function<void (Set<Derived*> &, const Derived &) > successors){
Set<Derived* > next;
successors(next,this->derived());
bool cont=true;
f(cont,&this->derived());
if(!cont) return;
next.foreachElement([f,successors](Derived * n){
n->dfs(f,successors);
});
}
// also a realy bad implemention. this time of bfs (performancewise). it does not crash if cycles are contained and returns the number of cycles found
template<typename Derived>
int Node<Derived>::bfs(std::function<void (bool&,Derived*)> f,std::function<void (Set<Derived*> &, const Derived &) > successors){
Set<Derived *> list = &this->derived();
int cycles =0;
while(list) {
// get first element
Derived * current = list.first();
// remove first element
list /= current;
//execute function
bool cont = true;
f(cont,current);
if(!cont) return cycles;
// add successors of current;
successors(list,*current);
}
return cycles;
}
// overload
template<typename Derived>
int Node<Derived>::bfs(std::function<void (bool&,Derived*)> f){
std::function<void (Set<Derived*> &, const Derived &) > sfunc = [] (Set<Node *>&successors,const Derived &node){ successors |= node.successors(); };
return bfs(f,sfunc);
}
}
|
toeb/sine
|
src/core/graph/Node.h
|
C
|
mit
| 17,226 | 29.723757 | 164 | 0.606699 | false |
exports.login = function* (ctx) {
const result = yield ctx.service.mine.login(ctx.request.body);
if (!result) {
ctx.status = 400;
ctx.body = {
status: 400,
msg: `please check your username and password`,
}
return;
}
ctx.body = {
access_token: result.access_token,
msg: 'login success',
};
ctx.status = 200;
}
exports.signup = function* (ctx) {
const result = yield ctx.service.mine.signup(ctx.request.body);
if (!result.result) {
ctx.status = 400;
ctx.body = {
status: 400,
msg: result.msg,
}
return;
}
ctx.status = 201;
ctx.body = {
status: 201,
msg: 'success',
}
}
exports.info = function* (ctx) {
const info = yield ctx.service.mine.info(ctx.auth.user_id);
if (info == null) {
ctx.status = 200;
ctx.body = {
status: 200,
msg: 'there is no info for current user',
}
return;
}
ctx.body = info;
ctx.status = 200;
}
exports.statistics = function* (ctx) {
const info = yield ctx.service.mine.statistics(ctx.auth.user_id);
if (info == null) {
ctx.status = 200;
ctx.body = {
shares_count: 0,
friends_count: 0,
helpful_count: 0,
};
return;
}
ctx.body = info;
ctx.status = 200;
}
exports.accounts = function* (ctx) {
const accounts = yield ctx.service.mine.accounts(ctx.auth.user_id);
ctx.body = accounts;
ctx.status = 200;
}
exports.update = function* (ctx) {
let profile = ctx.request.body;
profile.id = ctx.auth.user_id;
const result = yield ctx.service.mine.update(profile);
if (result) {
ctx.status = 204;
return;
}
ctx.status = 500;
ctx.body = {
msg: 'update profile failed',
}
}
exports.avatar = function* (ctx) {
const parts = ctx.multipart();
const { filename, error } = yield ctx.service.mine.avatar(parts, `avatar/${ctx.auth.user_id}`);
if (error) {
ctx.status = 500;
ctx.body = {
status: 500,
msg: 'update avatar failed',
};
return false;
}
ctx.status = 200;
ctx.body = {
filename,
msg: 'success',
}
}
|
VIPShare/VIPShare-REST-Server
|
app/controller/mine.js
|
JavaScript
|
mit
| 2,077 | 19.564356 | 97 | 0.590756 | false |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
const importObject = Object.freeze({
env: {
__memory_base: 0,
__table_base: 0,
memory: new WebAssembly.Memory({
initial: 1, // 64KiB - single page
maximum: 10 // 640KiB
}),
table: new WebAssembly.Table({ // Table
initial: 0, // length
element: 'anyfunc'
})
}
});
// 1st option -----------------------
const loadWASM = (url, importObject) =>
fetch(url)
.then(response => response.arrayBuffer())
.then(buffer => WebAssembly
.instantiate(buffer, importObject)
)
.then(results => results.instance);
loadWASM('sum.wasm', importObject).then(instance => {
const {exports} = instance;
const result = exports._sum(40, 2);
console.log({instance, result});
});
// 2d option ------------------------
const loadWASM2 = async (url, importObject) => {
const buffer = await fetch(url).then(r => r.arrayBuffer());
const result = await WebAssembly.instantiate(buffer, importObject);
return result.instance;
};
loadWASM2('sum.wasm', importObject).then(instance => {
const {exports} = instance;
const result = exports._sum(40, 2);
console.log({instance, result});
});
// 3d way, disabled because:
// RangeError: WebAssembly.Instance is disallowed on the main thread, if the buffer size is larger than 4KB. Use WebAssembly.instantiate.
// Note: To generate fib-module with html example smaller than 11kb, use option -g2 instead of -g4
// const loadWASM3 = (url, importObject) => fetch(url)
// .then(response => response.arrayBuffer())
// .then(buffer => WebAssembly.compile(buffer))
// .then(module => new WebAssembly.Instance(module, importObject));
// loadWASM3('sum.wasm', importObject).then(instance => {
// const {exports} = instance;
// const result = exports._sum(40, 2);
// console.log({
// instance,
// result
// });
// });
</script>
</body>
</html>
|
arturparkhisenko/til
|
wasm/examples/sum/index.html
|
HTML
|
mit
| 2,315 | 29.064935 | 141 | 0.580562 | false |
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Web;
namespace Umbraco.Core
{
///<summary>
/// Extension methods for dictionary & concurrentdictionary
///</summary>
internal static class DictionaryExtensions
{
/// <summary>
/// Method to Get a value by the key. If the key doesn't exist it will create a new TVal object for the key and return it.
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TVal"></typeparam>
/// <param name="dict"></param>
/// <param name="key"></param>
/// <returns></returns>
public static TVal GetOrCreate<TKey, TVal>(this IDictionary<TKey, TVal> dict, TKey key)
where TVal : class, new()
{
if (dict.ContainsKey(key) == false)
{
dict.Add(key, new TVal());
}
return dict[key];
}
/// <summary>
/// Updates an item with the specified key with the specified value
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
/// <param name="dict"></param>
/// <param name="key"></param>
/// <param name="updateFactory"></param>
/// <returns></returns>
/// <remarks>
/// Taken from: http://stackoverflow.com/questions/12240219/is-there-a-way-to-use-concurrentdictionary-tryupdate-with-a-lambda-expression
///
/// If there is an item in the dictionary with the key, it will keep trying to update it until it can
/// </remarks>
public static bool TryUpdate<TKey, TValue>(this ConcurrentDictionary<TKey, TValue> dict, TKey key, Func<TValue, TValue> updateFactory)
{
TValue curValue;
while (dict.TryGetValue(key, out curValue))
{
if (dict.TryUpdate(key, updateFactory(curValue), curValue))
return true;
//if we're looping either the key was removed by another thread, or another thread
//changed the value, so we start again.
}
return false;
}
/// <summary>
/// Updates an item with the specified key with the specified value
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
/// <param name="dict"></param>
/// <param name="key"></param>
/// <param name="updateFactory"></param>
/// <returns></returns>
/// <remarks>
/// Taken from: http://stackoverflow.com/questions/12240219/is-there-a-way-to-use-concurrentdictionary-tryupdate-with-a-lambda-expression
///
/// WARNING: If the value changes after we've retreived it, then the item will not be updated
/// </remarks>
public static bool TryUpdateOptimisitic<TKey, TValue>(this ConcurrentDictionary<TKey, TValue> dict, TKey key, Func<TValue, TValue> updateFactory)
{
TValue curValue;
if (!dict.TryGetValue(key, out curValue))
return false;
dict.TryUpdate(key, updateFactory(curValue), curValue);
return true;//note we return true whether we succeed or not, see explanation below.
}
/// <summary>
/// Converts a dictionary to another type by only using direct casting
/// </summary>
/// <typeparam name="TKeyOut"></typeparam>
/// <typeparam name="TValOut"></typeparam>
/// <param name="d"></param>
/// <returns></returns>
public static IDictionary<TKeyOut, TValOut> ConvertTo<TKeyOut, TValOut>(this IDictionary d)
{
var result = new Dictionary<TKeyOut, TValOut>();
foreach (DictionaryEntry v in d)
{
result.Add((TKeyOut)v.Key, (TValOut)v.Value);
}
return result;
}
/// <summary>
/// Converts a dictionary to another type using the specified converters
/// </summary>
/// <typeparam name="TKeyOut"></typeparam>
/// <typeparam name="TValOut"></typeparam>
/// <param name="d"></param>
/// <param name="keyConverter"></param>
/// <param name="valConverter"></param>
/// <returns></returns>
public static IDictionary<TKeyOut, TValOut> ConvertTo<TKeyOut, TValOut>(this IDictionary d, Func<object, TKeyOut> keyConverter, Func<object, TValOut> valConverter)
{
var result = new Dictionary<TKeyOut, TValOut>();
foreach (DictionaryEntry v in d)
{
result.Add(keyConverter(v.Key), valConverter(v.Value));
}
return result;
}
/// <summary>
/// Converts a dictionary to a NameValueCollection
/// </summary>
/// <param name="d"></param>
/// <returns></returns>
public static NameValueCollection ToNameValueCollection(this IDictionary<string, string> d)
{
var n = new NameValueCollection();
foreach (var i in d)
{
n.Add(i.Key, i.Value);
}
return n;
}
/// <summary>
/// Merges all key/values from the sources dictionaries into the destination dictionary
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="TK"></typeparam>
/// <typeparam name="TV"></typeparam>
/// <param name="destination">The source dictionary to merge other dictionaries into</param>
/// <param name="overwrite">
/// By default all values will be retained in the destination if the same keys exist in the sources but
/// this can changed if overwrite = true, then any key/value found in any of the sources will overwritten in the destination. Note that
/// it will just use the last found key/value if this is true.
/// </param>
/// <param name="sources">The other dictionaries to merge values from</param>
public static void MergeLeft<T, TK, TV>(this T destination, IEnumerable<IDictionary<TK, TV>> sources, bool overwrite = false)
where T : IDictionary<TK, TV>
{
foreach (var p in sources.SelectMany(src => src).Where(p => overwrite || destination.ContainsKey(p.Key) == false))
{
destination[p.Key] = p.Value;
}
}
/// <summary>
/// Merges all key/values from the sources dictionaries into the destination dictionary
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="TK"></typeparam>
/// <typeparam name="TV"></typeparam>
/// <param name="destination">The source dictionary to merge other dictionaries into</param>
/// <param name="overwrite">
/// By default all values will be retained in the destination if the same keys exist in the sources but
/// this can changed if overwrite = true, then any key/value found in any of the sources will overwritten in the destination. Note that
/// it will just use the last found key/value if this is true.
/// </param>
/// <param name="source">The other dictionary to merge values from</param>
public static void MergeLeft<T, TK, TV>(this T destination, IDictionary<TK, TV> source, bool overwrite = false)
where T : IDictionary<TK, TV>
{
destination.MergeLeft(new[] {source}, overwrite);
}
/// <summary>
/// Returns the value of the key value based on the key, if the key is not found, a null value is returned
/// </summary>
/// <typeparam name="TKey">The type of the key.</typeparam>
/// <typeparam name="TVal">The type of the val.</typeparam>
/// <param name="d">The d.</param>
/// <param name="key">The key.</param>
/// <param name="defaultValue">The default value.</param>
/// <returns></returns>
public static TVal GetValue<TKey, TVal>(this IDictionary<TKey, TVal> d, TKey key, TVal defaultValue = default(TVal))
{
if (d.ContainsKey(key))
{
return d[key];
}
return defaultValue;
}
/// <summary>
/// Returns the value of the key value based on the key as it's string value, if the key is not found, then an empty string is returned
/// </summary>
/// <param name="d"></param>
/// <param name="key"></param>
/// <returns></returns>
public static string GetValueAsString<TKey, TVal>(this IDictionary<TKey, TVal> d, TKey key)
{
if (d.ContainsKey(key))
{
return d[key].ToString();
}
return String.Empty;
}
/// <summary>
/// Returns the value of the key value based on the key as it's string value, if the key is not found or is an empty string, then the provided default value is returned
/// </summary>
/// <param name="d"></param>
/// <param name="key"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public static string GetValueAsString<TKey, TVal>(this IDictionary<TKey, TVal> d, TKey key, string defaultValue)
{
if (d.ContainsKey(key))
{
var value = d[key].ToString();
if (value != string.Empty)
return value;
}
return defaultValue;
}
/// <summary>contains key ignore case.</summary>
/// <param name="dictionary">The dictionary.</param>
/// <param name="key">The key.</param>
/// <typeparam name="TValue">Value Type</typeparam>
/// <returns>The contains key ignore case.</returns>
public static bool ContainsKeyIgnoreCase<TValue>(this IDictionary<string, TValue> dictionary, string key)
{
return dictionary.Keys.InvariantContains(key);
}
/// <summary>
/// Converts a dictionary object to a query string representation such as:
/// firstname=shannon&lastname=deminick
/// </summary>
/// <param name="d"></param>
/// <returns></returns>
public static string ToQueryString(this IDictionary<string, object> d)
{
if (!d.Any()) return "";
var builder = new StringBuilder();
foreach (var i in d)
{
builder.Append(String.Format("{0}={1}&", HttpUtility.UrlEncode(i.Key), i.Value == null ? string.Empty : HttpUtility.UrlEncode(i.Value.ToString())));
}
return builder.ToString().TrimEnd('&');
}
/// <summary>The get entry ignore case.</summary>
/// <param name="dictionary">The dictionary.</param>
/// <param name="key">The key.</param>
/// <typeparam name="TValue">The type</typeparam>
/// <returns>The entry</returns>
public static TValue GetValueIgnoreCase<TValue>(this IDictionary<string, TValue> dictionary, string key)
{
return dictionary.GetValueIgnoreCase(key, default(TValue));
}
/// <summary>The get entry ignore case.</summary>
/// <param name="dictionary">The dictionary.</param>
/// <param name="key">The key.</param>
/// <param name="defaultValue">The default value.</param>
/// <typeparam name="TValue">The type</typeparam>
/// <returns>The entry</returns>
public static TValue GetValueIgnoreCase<TValue>(this IDictionary<string, TValue> dictionary, string key, TValue defaultValue)
{
key = dictionary.Keys.FirstOrDefault(i => i.InvariantEquals(key));
return key.IsNullOrWhiteSpace() == false
? dictionary[key]
: defaultValue;
}
}
}
|
lars-erik/Umbraco-CMS
|
src/Umbraco.Core/DictionaryExtensions.cs
|
C#
|
mit
| 12,153 | 41.785211 | 176 | 0.573533 | false |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Phenotype Demo</title>
<meta name="description" content="Phenotype Demo">
<link rel="stylesheet" href="style.css">
<script src="phenotype.js" type="application/javascript"></script>
</head>
<body>
<a href="https://github.com/benjamine/phenotype" id="fork_me">
<img alt="Fork me on GitHub" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png">
</a>
<h1>Phenotype Demo</h1>
<script type="text/javascript">
var Trait = phenotype.Trait;
var Walker = new Trait('Walker', {
goTo: function(location) {
phenotype.pending();
}
});
var Swimmer = new Trait('Swimmer', {
goTo: function(location) {
phenotype.pending();
}
});
var Flyer = new Trait('Flyer', {
goTo: function(location) {
phenotype.pending();
}
});
var Duck = new Trait('Duck', Walker, Swimmer, Flyer);
try {
Duck.create();
} catch(err) {
// conflict, goTo is defined in Walker, Swimmer and Flyer
console.error(err);
}
// updating
var jet = Flyer.create();
// add a trait to existing object
var Vehicle = new Trait('Vehicle', { seats: 3 });
Vehicle.addTo(jet);
// logs 3
console.log(jet.seats);
// modify existing Trait
Vehicle.add({ seats: 4, wings: 2 }, new Trait({ pilot: true }));
// logs 4 2 true
console.log(jet.seats, jet.wings, jet.pilot);
// using "required"
var Retriever = new Trait('Retriever', {
goTo: phenotype.member.required,
grab: phenotype.member.required,
retrieve: function(thing) {
this.goTo(thing.location);
this.grab(thing);
this.goTo(this.previousLocation);
}
});
try {
var retriever = Retriever.create();
} catch(err) {
// goTo is required by Retriever, this is an abstract Trait
console.error(err);
}
var Dog = new Trait('Dog', Walker, Retriever, {
grab: function(thing) {
phenotype.pending();
}
});
var dog = Dog.create();
try {
var ball = {};
dog.retrieve(ball);
} catch(err) {
// throws "pending" error from grab method above
console.error(err);
}
// using mixin (allows to apply a Trait to a preexistent object)
var parrot = { name: 'pepe' };
try {
Retriever.mixin(parrot);
} catch(err) {
// goTo is required by Retriever, and parrot doesn't have it
console.log(err);
}
parrot.goTo = phenotype.pending;
parrot.grab = phenotype.pending;
// this time parrot provides all required methods
Retriever.mixin(parrot);
// using "aliasOf" and "from"
var Bird = new Trait('Bird', Walker, Flyer, {
walkTo: phenotype.member.aliasOf(Walker, 'goTo'),
goTo: phenotype.member.from(Flyer)
});
var Hawk = new Trait('Hawk', Bird, Retriever, {
grab: function(thing) {
phenotype.pending();
}
});
var Capibara = new Trait('Capibara', Walker, Swimmer, {
walkTo: phenotype.member.aliasOf(Walker, 'goTo'),
swimTo: phenotype.member.aliasOf(Swimmer, 'goTo'),
goTo: function(location) {
location.isOnWater() ? this.swimTo(location) : this.walkTo(location);
}
});
// using ancestors
var Electric = new Trait('Electric', {
shutdown: function() {
console.log('disconnected power');
}
});
var CombustionEngine = new Trait('CombustionEngine', {
shutdown: function() {
console.log('disconnected fuel injection');
}
});
var Car = new Trait('Car', Electric, CombustionEngine, {
open: function(all){
console.log('doors unlocked');
},
shutdown: phenotype.member.ancestors().then(function() {
console.log('doors locked');
})
});
var RetractableRoof = new Trait('RetractableRoof', {
openRoof: function() {
console.log('roof retracted');
},
shutdown: function() {
console.log('roof extended');
}
});
var ConvertibleCar = new Trait('ConvertibleCar', Car, RetractableRoof, {
open: phenotype.member.ancestors().wrap(function(inner, base){
return function(all){
inner.call(this, all);
if (all) {
this.openRoof();
}
}
}),
shutdown: phenotype.member.ancestors()
});
// using pipe and async
var Peeler = new Trait('Peeler', {
process: function(err, thing) {
console.log('peeling ' + thing);
// peeling takes time, but timeout at 1500ms
var async = phenotype.async(1500);
setTimeout(function(){
async.done('peeled ' + thing);
}, 1000);
return async;
}
});
Peeler.create().process(null, "apple").then(function(err, result){
if (err) {
console.error('error peeling apple');
return;
}
// logs "peeled apple"
console.log('result:', result);
});
var Chopper = new Trait('Chopper', {
process: function(err, thing) {
console.log('chopping ' + thing);
return 'chopped ' + thing;
}
});
var Mixer = new Trait('Mixer', {
process: function(err, thing) {
console.log('mixing ' + thing);
// mixing takes time
var async = phenotype.async(3000);
setTimeout(function(){
async.done('mixed ' + thing);
}, 1200);
return async;
}
});
var Oven = new Trait('Oven', {
process: function(err, thing) {
console.log('baking ' + thing);
return 'baked ' + thing;
}
});
var CookingMachine = new Trait('CookingMachine', Peeler, Chopper, Mixer, Oven, {
process: phenotype.member.ancestors().pipe({continueOnError: true})
.then(function(err, thing) {
if (err) {
console.error('cooking failed');
console.error(err);
return;
}
console.log('finished cooking:', thing);
return thing;
})
});
var machine = CookingMachine.create();
machine.process(null, "vegetables").then(function(err, result){
if (err) {
console.error('error, no result');
return;
}
// logs "result: baked mixed chopped peeled vegetables"
console.log('result:', result);
});
// properties & events
var Labrador = new Trait('Labrador', Dog, Retriever, phenotype.HasEvents, {
name: phenotype.member.property(),
initial: phenotype.member.property(function(){
return this.name().substr(0, 1).toUpperCase();
}),
});
var spike = Labrador.create();
spike.name('Spike');
// logs "Spike"
console.log(spike.name());
// logs "S"
console.log(spike.initial());
spike.on({
bark: function(e, volume) {
console.log(e.source.name(), 'barked', volume);
},
namechanged: function(e, data) {
console.log(data.property.name, 'changed from', data.previousValue, 'to', data.value);
},
initialchanged: function(e, data) {
console.log(data.property.name, 'changed from', data.previousValue, 'to', data.value);
}
});
// logs "Spikey barked loud"
spike.emit('bark', 'loud');
spike.off('bark');
spike.emit('bark', 'louder');
// logs "name changed from Spike to Spikey"
spike.name('Spikey');
</script>
<section id="main">
<div>Not much to see here,<br/>check output on browser console</div>
</section>
<footer>
<a href="https://github.com/benjamine/phenotype">Download Phenotype</a><br>
<p class="credits">developed by <a href="http://twitter.com/beneidel">Benjamín Eidelman</a></p>
</footer>
</body>
</html>
|
benjamine/phenotype
|
demo.html
|
HTML
|
mit
| 8,335 | 26.508251 | 119 | 0.539477 | false |
import * as yargs from "yargs";
import { getEnvironment, getSlimConfig } from "../cli-helpers";
export const devCommand: yargs.CommandModule = {
command: "dev",
describe: "Start a development server.",
builder: {
open: {
alias: "o",
type: "boolean",
description: "Automatically open the web browser."
},
"update-dlls": {
alias: "u",
type: "boolean",
description: "Create dynamically linked libraries for vendors (@angular/core, etc.) and polyfills."
},
cordova: {
type: "boolean",
description: "Output the build to the target directory."
},
aot: {
type: "boolean",
description: "Use the Angular AOT compiler."
}
},
handler: (options: Options) => {
const dllTask = require("../tasks/dll.task");
const devTask = require("../tasks/dev.task");
const rootDir = process.cwd();
const slimConfig = getSlimConfig(rootDir);
const environmentVariables = getEnvironment(rootDir);
return dllTask(environmentVariables, slimConfig, options["update-dlls"])
.then(() => devTask(environmentVariables, slimConfig, options.open, options.aot))
.then(code => {
process.exit(code);
})
.catch(code => {
process.exit(code);
});
}
};
|
INSIDEM2M/slim
|
src/commands/dev.command.ts
|
TypeScript
|
mit
| 1,457 | 33.690476 | 111 | 0.542896 | false |
export const browserVersions = () => {
let u = navigator.userAgent
return {
// 移动终端浏览器版本信息
trident: u.indexOf('Trident') > -1, // IE内核
presto: u.indexOf('Presto') > -1, // opera内核
webKit: u.indexOf('AppleWebKit') > -1, // 苹果、谷歌内核
gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') === -1, // 火狐内核
mobile: !!u.match(/AppleWebKit.*Mobile.*/), // 是否为移动终端
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), // ios终端
android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, // android终端或者uc浏览器
iPhone: u.indexOf('iPhone') > -1, // 是否为iPhone或者QQHD浏览器
iPad: u.indexOf('iPad') > -1, // 是否iPad
webApp: u.indexOf('Safari') === -1 // 是否web应该程序,没有头部与底部
}
}
|
donfo/generator-vue-tpl
|
generators/app/templates/src/utils/browser.js
|
JavaScript
|
mit
| 833 | 42.8125 | 86 | 0.573466 | false |
module YandexMusic
class Client
include YandexMusic::Auth
include YandexMusic::Endpoints::Search
include YandexMusic::Endpoints::ArtistAlbums
include YandexMusic::Endpoints::AlbumsTracks
def initialize(client_id, client_secret)
@client_id, @client_secret = client_id, client_secret
end
private
def http
@faraday ||= Faraday.new do |faraday|
faraday.request :url_encoded # form-encode POST params
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
faraday.use YandexMusic::AppHttpClient # run requests through app emulator
end
end
def prepared(params)
params.inject({}) do |result, (key, value)|
result[key.to_s.gsub("_", "-")] = value
result
end
end
def parse_time(string)
Time.new(*string.scan(/\d+/).slice(0, 6).map(&:to_i), string.match(/[+-]{1}\d{2}:\d{2}/)[0]).utc
end
end
end
|
localhots/yandex_music
|
lib/yandex_music/client.rb
|
Ruby
|
mit
| 962 | 27.294118 | 102 | 0.627859 | false |
<div class="container">
<div class="col-md-12 col-sm-12 col-xs-12 no-padding">
<div ng-controller="GroupMenu" ng-model="currentMenu" ng-init="currentMenu = 'new'" ng-include="'group/menu'" class="row"></div>
<div class="row">
<div class="col-md-12 no-padding">
<div class="row">
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-users"></i> Editar Grupo
</div>
<div class="panel-body">
<div class="col-md-6 col-md-offset-3">
<br/>
<div class="thumbnail">
<div class="caption">
<form>
<div class="row center-block" style="position: absolute">
<div id="fileupload" ng-controller="UploaderController" data-file-upload="options" ng-class="{'fileupload-processing': processing() || loadingFiles}">
<span class="btn btn-default btn-sm btn-block fileinput-button">
<i class="fa fa-refresh fa-spin" ng-if="active() > 0"></i>
<i class="fa fa-camera" ng-if="active() == 0"></i>
Subir logo
<input type="file" name="files[]" multiple ng-disabled="disabled">
</span>
</div>
</div>
<div class="form-group">
<img ng-src="{{image.url}}" class="img-responsive">
</div>
<div class="form-group">
<input ng-model="group.title" type="text" class="form-control" id="exampleInputEmail1" placeholder="Nombre del grupo">
</div>
<div class="form-group">
<textarea ng-model="group.text" class="form-control" id="exampleInputPassword1" placeholder="Descripción"></textarea>
</div>
<div class="form-group">
<label ng-if="group.privado" ng-click="group.privado = false">
<i class="fa fa-check-square-o" ng-model="group.privado"></i>
Privado
</label>
<label ng-if="!group.privado" ng-click="group.privado = true">
<i class="fa fa-square-o" ng-model="group.privado"></i>
Privado
</label>
</div>
<button type="submit" class="btn btn-success" ng-click="actionSubmit()">
{{submitTitle}} <i class="fa fa-floppy-o"></i>
</button>
<a ng-href="/#/group/{{group._id}}" class="btn btn-default btn-primary">
Ver <i class="fa fa-eye"></i>
</a>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
|
claudio-moya-tapia/mean_demo
|
app/views/group/edit.html
|
HTML
|
mit
| 4,322 | 66.619048 | 198 | 0.315436 | false |
<?php
$hostname = "localhost";
$user = "root";
$password = "admin";
$database = "employees";
mysql_connect($hostname, $user, $password);
mysql_set_charset('utf8');
@mysql_select_db($database) or die( "Unable to select database");
mysql_query("SET NAMES 'utf8'");
$mysqli = new mysqli($hostname, $user, $password, $database);
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: " . $mysqli->connect_error;
exit;
}
if (!$mysqli->set_charset("utf8")) {
printf("Error loading character set utf8: %s\n", $mysqli->error);
exit;
}
|
frankyhung93/Learn_Coding
|
php/mysql/db_connect.php
|
PHP
|
mit
| 554 | 25.428571 | 69 | 0.655235 | false |
---
title: The Little Eye Blog
# View.
# 1 = List
# 2 = Compact
# 3 = Card
view: 3
aliases: ["/the-little-eye/"]
# Optional header image (relative to `static/img/` folder).
header:
caption: ""
image: ""
---
### A Point of View on Microscopy Research, the History of the Microscope and a hint of Interdisciplinary Academia
My aim with this blog is to share with others some of my interests, mainly in microscopy and bioimaging. You can expect to see a few different styles of posts as detailed in [Welcome to The Little Eye]({{< relref "20170619_intro" >}}).
### Why “The Little Eye”?
I’ve taken the name The Little Eye from Galileo Galilei who coined his early compound microscopes: "Occhiolino", Italian for "little eye". The term "microscope" was coined by Giovanni Faber, a contempory of Galileo, and comes from the Greek words for "small" and "to look at", intended to be analogous to "telescope" (see [Welcome to The Little Eye]({{< relref "20170619_intro" >}})).
|
ChasNelson1990/chasnelson.co.uk
|
content/posts/the-little-eye/_index.md
|
Markdown
|
mit
| 994 | 40.125 | 384 | 0.714286 | false |
.root {
display: inline-block;
position: relative;
z-index: 1;
cursor: var(--cursor-pointer);
height: var(--navbar-height);
line-height: var(--navbar-height);
border: none;
padding: var(--navbar-dropdown-padding);
font-size: var(--font-size-large);
}
.root:not(:last-child) {
margin-right: var(--navbar-item-space);
}
.root::after {
position: absolute;
icon-font: url('../../i-icon.vue/assets/arrow-down.svg');
font-size: var(--navbar-dropdown-popper-font-size);
right: 10px;
top: 0;
line-height: var(--navbar-height);
}
.popper {
background: white;
font-size: var(--navbar-dropdown-popper-font-size);
width: 100%;
line-height: var(--navbar-dropdown-popper-line-height);
}
.root[disabled] {
cursor: var(--cursor-not-allowed);
color: var(--navbar-dropdown-color-disabled);
}
|
vusion/proto-ui
|
src/components/u-navbar.vue/dropdown.vue/module.css
|
CSS
|
mit
| 866 | 23.055556 | 61 | 0.62933 | false |
/**
* Get a number suffix
* e.g. 1 -> st
* @param {int} i number to get suffix
* @return suffix
*/
var getSuffix = function (i) {
var j = i % 10,
k = i % 100;
if (j == 1 && k != 11) {
return i + "st";
}
if (j == 2 && k != 12) {
return i + "nd";
}
if (j == 3 && k != 13) {
return i + "rd";
}
return i + "th";
}
module.exports = {
getSuffix: getSuffix,
};
|
kayoumido/Ram-Bot
|
utility/tools.js
|
JavaScript
|
mit
| 429 | 16.875 | 39 | 0.41958 | false |
# Minitest::Mock::Easily
use MiniTest::Mock with easier API
## Installation
Add this line to your application's Gemfile:
gem 'minitest-mock-easily'
And then execute:
$ bundle
Or install it yourself as:
$ gem install minitest-mock-easily
## Usage
```
include MockEasily
m = mock do
expect :hello, 'hello'
expect :world, 'world'
end
assert_equal 'hello', m.hello
assert_equal 'world', m.world
```
## Contributing
1. Fork it ( http://github.com/<my-github-username>/minitest-mock-easily/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
|
sunaot/minitest-mock-easily
|
README.md
|
Markdown
|
mit
| 731 | 17.74359 | 79 | 0.704514 | false |
---
redirect_to:
- http://tech.hbc.com/2013-10-04-welcome-jonathan-leibiusky.html
layout:: post
title: Welcome Jonathan Leibiusky!
date: '2013-10-04T15:24:00-04:00'
tags:
- Jonathan Leibiusky
- Infrastructure Engineering
- people
- gilt tech
- nyc
- immutable deployment
- xetorthio
tumblr_url: http://tech.gilt.com/post/63102481375/welcome-jonathan-leibiusky
---
<p><img alt="image" height="597" src="http://media.tumblr.com/14b68c54234532e9417fbcc363475bea/tumblr_inline_mu5s8oA9b61s17bu5.jpg" width="800"/></p>
<p>We’re excited to have Jonathan Leibiusky join Gilt’s Infrastructure Engineering team! Jon will work from NYC and help us to drive <a href="http://tech.gilt.com/2013/06/07/virtualization-at-gilt-a-lightning-talk-for-nyc-devops" target="_blank">Galactica</a> forward and realize <a href="http://tech.gilt.com/2013/08/09/meet-a-gilt-technologist-roland-tritsch-vp" target="_blank">our vision of an immutable deployment infrastructure</a>.</p>
<p>More about Jon:</p>
<ul><li>He’s originally from Argentina, but spent some of his childhood in Israel</li>
<li>Previous job: Head of Research & Development for <a href="http://www.mercadolibre.com/" target="_blank">MercadoLibre</a></li>
<li>He’s a fan of Node.js and Go</li>
<li>Preferred IDE: vim</li>
<li>Preferred OS: Ubuntu + xfce</li>
<li>Plays some ukelele (and guitar)</li>
<li><a href="https://twitter.com/xetorthio" target="_blank">Twitter</a> & <a href="https://github.com/xetorthio" target="_blank">GitHub</a> nickname: xetorthio</li>
</ul>
|
gilt/tech-blog
|
_posts/tumblr/2013-10-04-welcome-jonathan-leibiusky.html
|
HTML
|
mit
| 1,545 | 54.178571 | 454 | 0.742395 | false |
namespace CSharpGL
{
partial class FormPropertyGrid
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
this.SuspendLayout();
//
// propertyGrid1
//
this.propertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.propertyGrid1.Font = new System.Drawing.Font("宋体", 12F);
this.propertyGrid1.Location = new System.Drawing.Point(0, 0);
this.propertyGrid1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.propertyGrid1.Name = "propertyGrid1";
this.propertyGrid1.Size = new System.Drawing.Size(534, 545);
this.propertyGrid1.TabIndex = 0;
//
// FormProperyGrid
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(534, 545);
this.Controls.Add(this.propertyGrid1);
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "FormProperyGrid";
this.Text = "FormPropertyGrid";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PropertyGrid propertyGrid1;
}
}
|
bitzhuwei/CSharpGL
|
Infrastructure/CSharpGL.Models/FormPropertyGrid.Designer.cs
|
C#
|
mit
| 2,212 | 35.180328 | 107 | 0.572983 | false |
package net.pinemz.hm.gui;
import net.pinemz.hm.R;
import net.pinemz.hm.api.HmApi;
import net.pinemz.hm.api.Prefecture;
import net.pinemz.hm.api.PrefectureCollection;
import net.pinemz.hm.storage.CommonSettings;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.google.common.base.Optional;
public class SettingsActivity
extends BasicActivity
{
public static final String TAG = "SettingsActivity";
private RequestQueue requestQueue;
private HmApi hmApi;
private PrefectureCollection prefectures;
private CommonSettings settings;
private ListView listViewPrefectures;
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate");
super.onCreate(savedInstanceState);
this.setContentView(R.layout.activity_settings);
this.requestQueue = Volley.newRequestQueue(this.getApplicationContext());
this.hmApi = new HmApi(this.getApplicationContext(), this.requestQueue);
this.listViewPrefectures = (ListView)this.findViewById(R.id.listViewPrefectures);
assert this.listViewPrefectures != null;
// ÝèNXðõ
this.settings = new CommonSettings(this.getApplicationContext());
}
@Override
protected void onResume() {
Log.d(TAG, "onResume");
super.onResume();
// s¹{§ðÇÝÞ
this.loadPrefectures();
}
@Override
protected void onPause() {
Log.d(TAG, "onPause");
super.onPause();
}
@Override
protected void onDestroy() {
Log.d(TAG, "onDestroy");
super.onDestroy();
this.requestQueue = null;
this.hmApi = null;
// ÝèNXððú
this.settings = null;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
Log.d(TAG, "onCreateOptionsMenu");
super.onCreateOptionsMenu(menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Log.d(TAG, "onOptionsItemSelected");
return super.onOptionsItemSelected(item);
}
public void okButtonClicked(View view) {
Log.d(TAG, "okButtonClicked");
assert view instanceof Button;
// »ÝIð³êÄ¢éÚðæ¾
int checkedPosition = this.listViewPrefectures.getCheckedItemPosition();
Log.v(TAG, "onButtonClicked>getCheckedItemPosition = " + checkedPosition);
if (checkedPosition == ListView.INVALID_POSITION) { return; }
// Ið³êÄ¢és¹{§¼ðæ¾
String checkedPrefectureName =
(String)this.listViewPrefectures.getItemAtPosition(checkedPosition);
assert checkedPrefectureName != null;
// s¹{§Ìf[^ðæ¾
Optional<Prefecture> prefecture =
this.prefectures.getByName(checkedPrefectureName);
// f[^ª³íɶݷéê
if (prefecture.isPresent()) {
Log.i(TAG, "Prefecture.id = " + prefecture.get().getId());
Log.i(TAG, "Prefecture.name = " + prefecture.get().getName());
this.saveSettings(prefecture.get());
}
}
public void cancelButtonClicked(View view) {
Log.d(TAG, "cancelButtonClicked");
assert view instanceof Button;
this.cancelSettings();
}
private void setPrefectures(PrefectureCollection prefectures) {
Log.d(TAG, "setPrefectures");
this.prefectures = prefectures;
assert prefectures != null;
ArrayAdapter<String> adapter = new ArrayAdapter<>(
this.getApplicationContext(),
android.R.layout.simple_list_item_single_choice,
prefectures.getNames()
);
this.listViewPrefectures.setAdapter(adapter);
this.listViewPrefectures.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
// æªðúóÔÅIð
if (adapter.getCount() > 0) {
int prefectureId = this.settings.loadPrefectureId();
// f[^ªÛ¶³êÄÈ¢êÍAÅÌs¹{§ðIð
if (prefectureId < 0) {
prefectureId = prefectures.getIds()[0];
}
// s¹{§ ID Ìêðæ¾
Integer[] ids = prefectures.getIds();
// êvµ½êAIð
for (int i = 0; i < ids.length; ++i) {
if (ids[i] == prefectureId) {
this.listViewPrefectures.setItemChecked(i, true);
break;
}
}
}
}
/**
* ÝèðÛ¶·é
* @param prefecture Û¶·és¹{§
*/
private void saveSettings(Prefecture prefecture) {
Log.d(TAG, "saveSettings");
assert prefecture != null;
// lðÛ¶
this.settings.savePrefectureId(prefecture.getId());
// bZ[Wð\¦
Toast.makeText(
this.getApplicationContext(),
R.string.setting_save_toast,
Toast.LENGTH_SHORT
).show();
this.finish();
}
/**
* ÝèÌÛ¶ðLZ·é
*/
private void cancelSettings() {
Toast.makeText(
this.getApplicationContext(),
R.string.setting_cancel_toast,
Toast.LENGTH_SHORT
).show();
this.finish();
}
private void loadPrefectures() {
// [fBObZ[Wð\¦
this.showProgressDialog(R.string.loading_msg_prefectures);
// f[^ðÇÝÞ
this.hmApi.getPrefectures(new HmApi.Listener<PrefectureCollection>() {
@Override
public void onSuccess(HmApi api, PrefectureCollection data) {
Log.d(TAG, "HmApi.Listener#onSuccess");
SettingsActivity.this.closeDialog();
SettingsActivity.this.setPrefectures(data);
}
@Override
public void onFailure() {
Log.e(TAG, "HmApi.Listener#onFailure");
SettingsActivity.this.showFinishAlertDialog(
R.string.network_failed_title,
R.string.network_failed_msg_prefectures
);
}
@Override
public void onException(Exception exception) {
Log.e(TAG, "HmApi.Listener#onException", exception);
SettingsActivity.this.showFinishAlertDialog(
R.string.network_error_title,
R.string.network_error_msg_prefectures
);
}
});
}
}
|
pine613/android-hm
|
android-hm/src/net/pinemz/hm/gui/SettingsActivity.java
|
Java
|
mit
| 6,222 | 24.364407 | 89 | 0.638219 | false |
'use strict';
const chai = require('chai'),
expect = chai.expect,
config = require('../config/config'),
Support = require('./support'),
dialect = Support.getTestDialect(),
Sequelize = Support.Sequelize,
fs = require('fs'),
path = require('path');
if (dialect === 'sqlite') {
var sqlite3 = require('sqlite3'); // eslint-disable-line
}
describe(Support.getTestDialectTeaser('Configuration'), () => {
describe('Connections problems should fail with a nice message', () => {
it('when we don\'t have the correct server details', () => {
const seq = new Sequelize(config[dialect].database, config[dialect].username, config[dialect].password, { storage: '/path/to/no/where/land', logging: false, host: '0.0.0.1', port: config[dialect].port, dialect });
if (dialect === 'sqlite') {
// SQLite doesn't have a breakdown of error codes, so we are unable to discern between the different types of errors.
return expect(seq.query('select 1 as hello')).to.eventually.be.rejectedWith(Sequelize.ConnectionError, 'SQLITE_CANTOPEN: unable to open database file');
}
return expect(seq.query('select 1 as hello')).to.eventually.be.rejectedWith([Sequelize.HostNotReachableError, Sequelize.InvalidConnectionError]);
});
it('when we don\'t have the correct login information', () => {
if (dialect === 'mssql') {
// NOTE: Travis seems to be having trouble with this test against the
// AWS instance. Works perfectly fine on a local setup.
expect(true).to.be.true;
return;
}
const seq = new Sequelize(config[dialect].database, config[dialect].username, 'fakepass123', { logging: false, host: config[dialect].host, port: 1, dialect });
if (dialect === 'sqlite') {
// SQLite doesn't require authentication and `select 1 as hello` is a valid query, so this should be fulfilled not rejected for it.
return expect(seq.query('select 1 as hello')).to.eventually.be.fulfilled;
}
return expect(seq.query('select 1 as hello')).to.eventually.be.rejectedWith(Sequelize.ConnectionRefusedError, 'connect ECONNREFUSED');
});
it('when we don\'t have a valid dialect.', () => {
expect(() => {
new Sequelize(config[dialect].database, config[dialect].username, config[dialect].password, { host: '0.0.0.1', port: config[dialect].port, dialect: 'some-fancy-dialect' });
}).to.throw(Error, 'The dialect some-fancy-dialect is not supported. Supported dialects: mssql, mariadb, mysql, postgres, and sqlite.');
});
});
describe('Instantiation with arguments', () => {
if (dialect === 'sqlite') {
it('should respect READONLY / READWRITE connection modes', () => {
const p = path.join(__dirname, '../tmp', 'foo.sqlite');
const createTableFoo = 'CREATE TABLE foo (faz TEXT);';
const createTableBar = 'CREATE TABLE bar (baz TEXT);';
const testAccess = Sequelize.Promise.method(() => {
return Sequelize.Promise.promisify(fs.access)(p, fs.R_OK | fs.W_OK);
});
return Sequelize.Promise.promisify(fs.unlink)(p)
.catch(err => {
expect(err.code).to.equal('ENOENT');
})
.then(() => {
const sequelizeReadOnly = new Sequelize('sqlite://foo', {
storage: p,
dialectOptions: {
mode: sqlite3.OPEN_READONLY
}
});
const sequelizeReadWrite = new Sequelize('sqlite://foo', {
storage: p,
dialectOptions: {
mode: sqlite3.OPEN_READWRITE
}
});
expect(sequelizeReadOnly.config.dialectOptions.mode).to.equal(sqlite3.OPEN_READONLY);
expect(sequelizeReadWrite.config.dialectOptions.mode).to.equal(sqlite3.OPEN_READWRITE);
return Sequelize.Promise.join(
sequelizeReadOnly.query(createTableFoo)
.should.be.rejectedWith(Error, 'SQLITE_CANTOPEN: unable to open database file'),
sequelizeReadWrite.query(createTableFoo)
.should.be.rejectedWith(Error, 'SQLITE_CANTOPEN: unable to open database file')
);
})
.then(() => {
// By default, sqlite creates a connection that's READWRITE | CREATE
const sequelize = new Sequelize('sqlite://foo', {
storage: p
});
return sequelize.query(createTableFoo);
})
.then(testAccess)
.then(() => {
const sequelizeReadOnly = new Sequelize('sqlite://foo', {
storage: p,
dialectOptions: {
mode: sqlite3.OPEN_READONLY
}
});
const sequelizeReadWrite = new Sequelize('sqlite://foo', {
storage: p,
dialectOptions: {
mode: sqlite3.OPEN_READWRITE
}
});
return Sequelize.Promise.join(
sequelizeReadOnly.query(createTableBar)
.should.be.rejectedWith(Error, 'SQLITE_READONLY: attempt to write a readonly database'),
sequelizeReadWrite.query(createTableBar)
);
})
.finally(() => {
return Sequelize.Promise.promisify(fs.unlink)(p);
});
});
}
});
});
|
inDream/sequelize
|
test/integration/configuration.test.js
|
JavaScript
|
mit
| 5,369 | 42.298387 | 219 | 0.59322 | false |
/*
* This file is part of Zinc, licensed under the MIT License (MIT).
*
* Copyright (c) 2015-2016, Jamie Mansfield <https://github.com/jamierocks>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package uk.jamierocks.zinc.example;
import com.google.common.collect.Lists;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandArgs;
import org.spongepowered.api.text.Text;
import uk.jamierocks.zinc.Command;
import uk.jamierocks.zinc.TabComplete;
import java.util.List;
public class ExampleCommands {
@Command(name = "example")
public CommandResult exampleCommand(CommandSource source, CommandArgs args) {
source.sendMessage(Text.of("This is the base command."));
return CommandResult.success();
}
@Command(parent = "example",
name = "sub")
public CommandResult exampleSubCommand(CommandSource source, CommandArgs args) {
source.sendMessage(Text.of("This is a sub command."));
return CommandResult.success();
}
@TabComplete(name = "example")
public List<String> tabComplete(CommandSource source, String args) {
return Lists.newArrayList();
}
}
|
jamierocks/Zinc
|
Example/src/main/java/uk/jamierocks/zinc/example/ExampleCommands.java
|
Java
|
mit
| 2,269 | 40.254545 | 84 | 0.74394 | false |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as strings from 'vs/base/common/strings';
import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range';
import { ApplyEditsResult, EndOfLinePreference, FindMatch, IInternalModelContentChange, ISingleEditOperationIdentifier, ITextBuffer, ITextSnapshot, ValidAnnotatedEditOperation, IValidEditOperation } from 'vs/editor/common/model';
import { PieceTreeBase, StringBuffer } from 'vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase';
import { SearchData } from 'vs/editor/common/model/textModelSearch';
import { countEOL, StringEOL } from 'vs/editor/common/model/tokensStore';
import { TextChange } from 'vs/editor/common/model/textChange';
export interface IValidatedEditOperation {
sortIndex: number;
identifier: ISingleEditOperationIdentifier | null;
range: Range;
rangeOffset: number;
rangeLength: number;
text: string;
eolCount: number;
firstLineLength: number;
lastLineLength: number;
forceMoveMarkers: boolean;
isAutoWhitespaceEdit: boolean;
}
export interface IReverseSingleEditOperation extends IValidEditOperation {
sortIndex: number;
}
export class PieceTreeTextBuffer implements ITextBuffer {
private readonly _pieceTree: PieceTreeBase;
private readonly _BOM: string;
private _mightContainRTL: boolean;
private _mightContainNonBasicASCII: boolean;
constructor(chunks: StringBuffer[], BOM: string, eol: '\r\n' | '\n', containsRTL: boolean, isBasicASCII: boolean, eolNormalized: boolean) {
this._BOM = BOM;
this._mightContainNonBasicASCII = !isBasicASCII;
this._mightContainRTL = containsRTL;
this._pieceTree = new PieceTreeBase(chunks, eol, eolNormalized);
}
// #region TextBuffer
public equals(other: ITextBuffer): boolean {
if (!(other instanceof PieceTreeTextBuffer)) {
return false;
}
if (this._BOM !== other._BOM) {
return false;
}
if (this.getEOL() !== other.getEOL()) {
return false;
}
return this._pieceTree.equal(other._pieceTree);
}
public mightContainRTL(): boolean {
return this._mightContainRTL;
}
public mightContainNonBasicASCII(): boolean {
return this._mightContainNonBasicASCII;
}
public getBOM(): string {
return this._BOM;
}
public getEOL(): '\r\n' | '\n' {
return this._pieceTree.getEOL();
}
public createSnapshot(preserveBOM: boolean): ITextSnapshot {
return this._pieceTree.createSnapshot(preserveBOM ? this._BOM : '');
}
public getOffsetAt(lineNumber: number, column: number): number {
return this._pieceTree.getOffsetAt(lineNumber, column);
}
public getPositionAt(offset: number): Position {
return this._pieceTree.getPositionAt(offset);
}
public getRangeAt(start: number, length: number): Range {
let end = start + length;
const startPosition = this.getPositionAt(start);
const endPosition = this.getPositionAt(end);
return new Range(startPosition.lineNumber, startPosition.column, endPosition.lineNumber, endPosition.column);
}
public getValueInRange(range: Range, eol: EndOfLinePreference = EndOfLinePreference.TextDefined): string {
if (range.isEmpty()) {
return '';
}
const lineEnding = this._getEndOfLine(eol);
return this._pieceTree.getValueInRange(range, lineEnding);
}
public getValueLengthInRange(range: Range, eol: EndOfLinePreference = EndOfLinePreference.TextDefined): number {
if (range.isEmpty()) {
return 0;
}
if (range.startLineNumber === range.endLineNumber) {
return (range.endColumn - range.startColumn);
}
let startOffset = this.getOffsetAt(range.startLineNumber, range.startColumn);
let endOffset = this.getOffsetAt(range.endLineNumber, range.endColumn);
return endOffset - startOffset;
}
public getCharacterCountInRange(range: Range, eol: EndOfLinePreference = EndOfLinePreference.TextDefined): number {
if (this._mightContainNonBasicASCII) {
// we must count by iterating
let result = 0;
const fromLineNumber = range.startLineNumber;
const toLineNumber = range.endLineNumber;
for (let lineNumber = fromLineNumber; lineNumber <= toLineNumber; lineNumber++) {
const lineContent = this.getLineContent(lineNumber);
const fromOffset = (lineNumber === fromLineNumber ? range.startColumn - 1 : 0);
const toOffset = (lineNumber === toLineNumber ? range.endColumn - 1 : lineContent.length);
for (let offset = fromOffset; offset < toOffset; offset++) {
if (strings.isHighSurrogate(lineContent.charCodeAt(offset))) {
result = result + 1;
offset = offset + 1;
} else {
result = result + 1;
}
}
}
result += this._getEndOfLine(eol).length * (toLineNumber - fromLineNumber);
return result;
}
return this.getValueLengthInRange(range, eol);
}
public getLength(): number {
return this._pieceTree.getLength();
}
public getLineCount(): number {
return this._pieceTree.getLineCount();
}
public getLinesContent(): string[] {
return this._pieceTree.getLinesContent();
}
public getLineContent(lineNumber: number): string {
return this._pieceTree.getLineContent(lineNumber);
}
public getLineCharCode(lineNumber: number, index: number): number {
return this._pieceTree.getLineCharCode(lineNumber, index);
}
public getLineLength(lineNumber: number): number {
return this._pieceTree.getLineLength(lineNumber);
}
public getLineMinColumn(lineNumber: number): number {
return 1;
}
public getLineMaxColumn(lineNumber: number): number {
return this.getLineLength(lineNumber) + 1;
}
public getLineFirstNonWhitespaceColumn(lineNumber: number): number {
const result = strings.firstNonWhitespaceIndex(this.getLineContent(lineNumber));
if (result === -1) {
return 0;
}
return result + 1;
}
public getLineLastNonWhitespaceColumn(lineNumber: number): number {
const result = strings.lastNonWhitespaceIndex(this.getLineContent(lineNumber));
if (result === -1) {
return 0;
}
return result + 2;
}
private _getEndOfLine(eol: EndOfLinePreference): string {
switch (eol) {
case EndOfLinePreference.LF:
return '\n';
case EndOfLinePreference.CRLF:
return '\r\n';
case EndOfLinePreference.TextDefined:
return this.getEOL();
}
throw new Error('Unknown EOL preference');
}
public setEOL(newEOL: '\r\n' | '\n'): void {
this._pieceTree.setEOL(newEOL);
}
public applyEdits(rawOperations: ValidAnnotatedEditOperation[], recordTrimAutoWhitespace: boolean, computeUndoEdits: boolean): ApplyEditsResult {
let mightContainRTL = this._mightContainRTL;
let mightContainNonBasicASCII = this._mightContainNonBasicASCII;
let canReduceOperations = true;
let operations: IValidatedEditOperation[] = [];
for (let i = 0; i < rawOperations.length; i++) {
let op = rawOperations[i];
if (canReduceOperations && op._isTracked) {
canReduceOperations = false;
}
let validatedRange = op.range;
if (!mightContainRTL && op.text) {
// check if the new inserted text contains RTL
mightContainRTL = strings.containsRTL(op.text);
}
if (!mightContainNonBasicASCII && op.text) {
mightContainNonBasicASCII = !strings.isBasicASCII(op.text);
}
let validText = '';
let eolCount = 0;
let firstLineLength = 0;
let lastLineLength = 0;
if (op.text) {
let strEOL: StringEOL;
[eolCount, firstLineLength, lastLineLength, strEOL] = countEOL(op.text);
const bufferEOL = this.getEOL();
const expectedStrEOL = (bufferEOL === '\r\n' ? StringEOL.CRLF : StringEOL.LF);
if (strEOL === StringEOL.Unknown || strEOL === expectedStrEOL) {
validText = op.text;
} else {
validText = op.text.replace(/\r\n|\r|\n/g, bufferEOL);
}
}
operations[i] = {
sortIndex: i,
identifier: op.identifier || null,
range: validatedRange,
rangeOffset: this.getOffsetAt(validatedRange.startLineNumber, validatedRange.startColumn),
rangeLength: this.getValueLengthInRange(validatedRange),
text: validText,
eolCount: eolCount,
firstLineLength: firstLineLength,
lastLineLength: lastLineLength,
forceMoveMarkers: Boolean(op.forceMoveMarkers),
isAutoWhitespaceEdit: op.isAutoWhitespaceEdit || false
};
}
// Sort operations ascending
operations.sort(PieceTreeTextBuffer._sortOpsAscending);
let hasTouchingRanges = false;
for (let i = 0, count = operations.length - 1; i < count; i++) {
let rangeEnd = operations[i].range.getEndPosition();
let nextRangeStart = operations[i + 1].range.getStartPosition();
if (nextRangeStart.isBeforeOrEqual(rangeEnd)) {
if (nextRangeStart.isBefore(rangeEnd)) {
// overlapping ranges
throw new Error('Overlapping ranges are not allowed!');
}
hasTouchingRanges = true;
}
}
if (canReduceOperations) {
operations = this._reduceOperations(operations);
}
// Delta encode operations
let reverseRanges = (computeUndoEdits || recordTrimAutoWhitespace ? PieceTreeTextBuffer._getInverseEditRanges(operations) : []);
let newTrimAutoWhitespaceCandidates: { lineNumber: number, oldContent: string }[] = [];
if (recordTrimAutoWhitespace) {
for (let i = 0; i < operations.length; i++) {
let op = operations[i];
let reverseRange = reverseRanges[i];
if (op.isAutoWhitespaceEdit && op.range.isEmpty()) {
// Record already the future line numbers that might be auto whitespace removal candidates on next edit
for (let lineNumber = reverseRange.startLineNumber; lineNumber <= reverseRange.endLineNumber; lineNumber++) {
let currentLineContent = '';
if (lineNumber === reverseRange.startLineNumber) {
currentLineContent = this.getLineContent(op.range.startLineNumber);
if (strings.firstNonWhitespaceIndex(currentLineContent) !== -1) {
continue;
}
}
newTrimAutoWhitespaceCandidates.push({ lineNumber: lineNumber, oldContent: currentLineContent });
}
}
}
}
let reverseOperations: IReverseSingleEditOperation[] | null = null;
if (computeUndoEdits) {
let reverseRangeDeltaOffset = 0;
reverseOperations = [];
for (let i = 0; i < operations.length; i++) {
const op = operations[i];
const reverseRange = reverseRanges[i];
const bufferText = this.getValueInRange(op.range);
const reverseRangeOffset = op.rangeOffset + reverseRangeDeltaOffset;
reverseRangeDeltaOffset += (op.text.length - bufferText.length);
reverseOperations[i] = {
sortIndex: op.sortIndex,
identifier: op.identifier,
range: reverseRange,
text: bufferText,
textChange: new TextChange(op.rangeOffset, bufferText, reverseRangeOffset, op.text)
};
}
// Can only sort reverse operations when the order is not significant
if (!hasTouchingRanges) {
reverseOperations.sort((a, b) => a.sortIndex - b.sortIndex);
}
}
this._mightContainRTL = mightContainRTL;
this._mightContainNonBasicASCII = mightContainNonBasicASCII;
const contentChanges = this._doApplyEdits(operations);
let trimAutoWhitespaceLineNumbers: number[] | null = null;
if (recordTrimAutoWhitespace && newTrimAutoWhitespaceCandidates.length > 0) {
// sort line numbers auto whitespace removal candidates for next edit descending
newTrimAutoWhitespaceCandidates.sort((a, b) => b.lineNumber - a.lineNumber);
trimAutoWhitespaceLineNumbers = [];
for (let i = 0, len = newTrimAutoWhitespaceCandidates.length; i < len; i++) {
let lineNumber = newTrimAutoWhitespaceCandidates[i].lineNumber;
if (i > 0 && newTrimAutoWhitespaceCandidates[i - 1].lineNumber === lineNumber) {
// Do not have the same line number twice
continue;
}
let prevContent = newTrimAutoWhitespaceCandidates[i].oldContent;
let lineContent = this.getLineContent(lineNumber);
if (lineContent.length === 0 || lineContent === prevContent || strings.firstNonWhitespaceIndex(lineContent) !== -1) {
continue;
}
trimAutoWhitespaceLineNumbers.push(lineNumber);
}
}
return new ApplyEditsResult(
reverseOperations,
contentChanges,
trimAutoWhitespaceLineNumbers
);
}
/**
* Transform operations such that they represent the same logic edit,
* but that they also do not cause OOM crashes.
*/
private _reduceOperations(operations: IValidatedEditOperation[]): IValidatedEditOperation[] {
if (operations.length < 1000) {
// We know from empirical testing that a thousand edits work fine regardless of their shape.
return operations;
}
// At one point, due to how events are emitted and how each operation is handled,
// some operations can trigger a high amount of temporary string allocations,
// that will immediately get edited again.
// e.g. a formatter inserting ridiculous ammounts of \n on a model with a single line
// Therefore, the strategy is to collapse all the operations into a huge single edit operation
return [this._toSingleEditOperation(operations)];
}
_toSingleEditOperation(operations: IValidatedEditOperation[]): IValidatedEditOperation {
let forceMoveMarkers = false;
const firstEditRange = operations[0].range;
const lastEditRange = operations[operations.length - 1].range;
const entireEditRange = new Range(firstEditRange.startLineNumber, firstEditRange.startColumn, lastEditRange.endLineNumber, lastEditRange.endColumn);
let lastEndLineNumber = firstEditRange.startLineNumber;
let lastEndColumn = firstEditRange.startColumn;
const result: string[] = [];
for (let i = 0, len = operations.length; i < len; i++) {
const operation = operations[i];
const range = operation.range;
forceMoveMarkers = forceMoveMarkers || operation.forceMoveMarkers;
// (1) -- Push old text
result.push(this.getValueInRange(new Range(lastEndLineNumber, lastEndColumn, range.startLineNumber, range.startColumn)));
// (2) -- Push new text
if (operation.text.length > 0) {
result.push(operation.text);
}
lastEndLineNumber = range.endLineNumber;
lastEndColumn = range.endColumn;
}
const text = result.join('');
const [eolCount, firstLineLength, lastLineLength] = countEOL(text);
return {
sortIndex: 0,
identifier: operations[0].identifier,
range: entireEditRange,
rangeOffset: this.getOffsetAt(entireEditRange.startLineNumber, entireEditRange.startColumn),
rangeLength: this.getValueLengthInRange(entireEditRange, EndOfLinePreference.TextDefined),
text: text,
eolCount: eolCount,
firstLineLength: firstLineLength,
lastLineLength: lastLineLength,
forceMoveMarkers: forceMoveMarkers,
isAutoWhitespaceEdit: false
};
}
private _doApplyEdits(operations: IValidatedEditOperation[]): IInternalModelContentChange[] {
operations.sort(PieceTreeTextBuffer._sortOpsDescending);
let contentChanges: IInternalModelContentChange[] = [];
// operations are from bottom to top
for (let i = 0; i < operations.length; i++) {
let op = operations[i];
const startLineNumber = op.range.startLineNumber;
const startColumn = op.range.startColumn;
const endLineNumber = op.range.endLineNumber;
const endColumn = op.range.endColumn;
if (startLineNumber === endLineNumber && startColumn === endColumn && op.text.length === 0) {
// no-op
continue;
}
if (op.text) {
// replacement
this._pieceTree.delete(op.rangeOffset, op.rangeLength);
this._pieceTree.insert(op.rangeOffset, op.text, true);
} else {
// deletion
this._pieceTree.delete(op.rangeOffset, op.rangeLength);
}
const contentChangeRange = new Range(startLineNumber, startColumn, endLineNumber, endColumn);
contentChanges.push({
range: contentChangeRange,
rangeLength: op.rangeLength,
text: op.text,
rangeOffset: op.rangeOffset,
forceMoveMarkers: op.forceMoveMarkers
});
}
return contentChanges;
}
findMatchesLineByLine(searchRange: Range, searchData: SearchData, captureMatches: boolean, limitResultCount: number): FindMatch[] {
return this._pieceTree.findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount);
}
// #endregion
// #region helper
// testing purpose.
public getPieceTree(): PieceTreeBase {
return this._pieceTree;
}
/**
* Assumes `operations` are validated and sorted ascending
*/
public static _getInverseEditRanges(operations: IValidatedEditOperation[]): Range[] {
let result: Range[] = [];
let prevOpEndLineNumber: number = 0;
let prevOpEndColumn: number = 0;
let prevOp: IValidatedEditOperation | null = null;
for (let i = 0, len = operations.length; i < len; i++) {
let op = operations[i];
let startLineNumber: number;
let startColumn: number;
if (prevOp) {
if (prevOp.range.endLineNumber === op.range.startLineNumber) {
startLineNumber = prevOpEndLineNumber;
startColumn = prevOpEndColumn + (op.range.startColumn - prevOp.range.endColumn);
} else {
startLineNumber = prevOpEndLineNumber + (op.range.startLineNumber - prevOp.range.endLineNumber);
startColumn = op.range.startColumn;
}
} else {
startLineNumber = op.range.startLineNumber;
startColumn = op.range.startColumn;
}
let resultRange: Range;
if (op.text.length > 0) {
// the operation inserts something
const lineCount = op.eolCount + 1;
if (lineCount === 1) {
// single line insert
resultRange = new Range(startLineNumber, startColumn, startLineNumber, startColumn + op.firstLineLength);
} else {
// multi line insert
resultRange = new Range(startLineNumber, startColumn, startLineNumber + lineCount - 1, op.lastLineLength + 1);
}
} else {
// There is nothing to insert
resultRange = new Range(startLineNumber, startColumn, startLineNumber, startColumn);
}
prevOpEndLineNumber = resultRange.endLineNumber;
prevOpEndColumn = resultRange.endColumn;
result.push(resultRange);
prevOp = op;
}
return result;
}
private static _sortOpsAscending(a: IValidatedEditOperation, b: IValidatedEditOperation): number {
let r = Range.compareRangesUsingEnds(a.range, b.range);
if (r === 0) {
return a.sortIndex - b.sortIndex;
}
return r;
}
private static _sortOpsDescending(a: IValidatedEditOperation, b: IValidatedEditOperation): number {
let r = Range.compareRangesUsingEnds(a.range, b.range);
if (r === 0) {
return b.sortIndex - a.sortIndex;
}
return -r;
}
// #endregion
}
|
joaomoreno/vscode
|
src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.ts
|
TypeScript
|
mit
| 18,581 | 32.359066 | 229 | 0.713525 | false |
// Template Source: BaseEntityCollectionPage.java.tt
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.requests;
import com.microsoft.graph.models.TermsAndConditionsAcceptanceStatus;
import com.microsoft.graph.requests.TermsAndConditionsAcceptanceStatusCollectionRequestBuilder;
import javax.annotation.Nullable;
import javax.annotation.Nonnull;
import com.microsoft.graph.requests.TermsAndConditionsAcceptanceStatusCollectionResponse;
import com.microsoft.graph.http.BaseCollectionPage;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The class for the Terms And Conditions Acceptance Status Collection Page.
*/
public class TermsAndConditionsAcceptanceStatusCollectionPage extends BaseCollectionPage<TermsAndConditionsAcceptanceStatus, TermsAndConditionsAcceptanceStatusCollectionRequestBuilder> {
/**
* A collection page for TermsAndConditionsAcceptanceStatus
*
* @param response the serialized TermsAndConditionsAcceptanceStatusCollectionResponse from the service
* @param builder the request builder for the next collection page
*/
public TermsAndConditionsAcceptanceStatusCollectionPage(@Nonnull final TermsAndConditionsAcceptanceStatusCollectionResponse response, @Nonnull final TermsAndConditionsAcceptanceStatusCollectionRequestBuilder builder) {
super(response, builder);
}
/**
* Creates the collection page for TermsAndConditionsAcceptanceStatus
*
* @param pageContents the contents of this page
* @param nextRequestBuilder the request builder for the next page
*/
public TermsAndConditionsAcceptanceStatusCollectionPage(@Nonnull final java.util.List<TermsAndConditionsAcceptanceStatus> pageContents, @Nullable final TermsAndConditionsAcceptanceStatusCollectionRequestBuilder nextRequestBuilder) {
super(pageContents, nextRequestBuilder);
}
}
|
microsoftgraph/msgraph-sdk-java
|
src/main/java/com/microsoft/graph/requests/TermsAndConditionsAcceptanceStatusCollectionPage.java
|
Java
|
mit
| 2,194 | 53.85 | 236 | 0.753418 | false |
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <iWorkImport/TSUProgress.h>
@class NSArray, NSObject<OS_dispatch_queue>;
// Not exported
@interface TSUProgressGroup : TSUProgress
{
NSArray *mChildren;
NSArray *mChildrenProgressObservers;
NSObject<OS_dispatch_queue> *mChildrenProgressObserversQueue;
}
- (void)p_updateChildrenProgressObservers;
- (void)removeProgressObserver:(id)arg1;
- (id)addProgressObserverWithValueInterval:(double)arg1 queue:(id)arg2 handler:(id)arg3;
- (_Bool)isIndeterminate;
- (double)maxValue;
- (double)value;
- (void)dealloc;
- (id)initWithChildren:(id)arg1;
@end
|
matthewsot/CocoaSharp
|
Headers/PrivateFrameworks/iWorkImport/TSUProgressGroup.h
|
C
|
mit
| 712 | 23.551724 | 88 | 0.733146 | false |
Dockermail - Email Core
==========
This image provides a secure, minimal mail server based on 'postfix' and 'dovecot'.
All incoming mail to your domains is accepted.
For outgoing mail, only authenticated (logged in with username and password) clients can send messages via STARTTLS.
## Setup
You will need 2 folder on your host, one to store your configuration and another one to store your email. For example:
* `/opt/dockermail/settings`
* `/opt/dockermail/vmail`
These will be mounted into container and store settings and email on host.
All the configuration is done through a single `config.json` file, extra files (eg. SSL keys) will be stored in the settings directory for backup.
There is an example file in `config/example` to get you started.
#### Remember to restart your container if you update the settings!
---
### config.json
```json
{
"settings": {
"myhostname": "mail.example.com"
},
"domains": {
"example.com" :
[
{
"email": "[email protected]",
"password": "{PLAIN}SuperSecure123",
"aliases": ["@example.com"]
},
{
"email": "[email protected]",
"password": "{SHA256-CRYPT}$5$ojXGqoxOAygN91er$VQD/8dDyCYOaLl2yLJlRFXgl.NSrB3seZGXBRMdZAr6"
}
]
}
}
```
The hash within *config.json* contains 2 primary keys: `domains` and `settings`.
##### settings
* `myhostname` - should be the fully qualified domain of the server hosting email. Although optional you will have problems with EHLO commands and `amavis` without it.
#### domains
Each domain has an array of account objects, each account has the following keys:
* `email` - email address of the account. Will also be used as the login.
* `password` - password for the account. See below for details.
* `aliases` - (Optional) Array of aliases to redirect to this account. For a catch-all use your domain with no account, eg: `@example.com`.
##### Generating passwords
Passwords have to be in a dovecot format.
A plain-text password looks like this: `{PLAIN}SuperSecure123`.
To get more secure hash values, you need to start the container and run:
```bash
docker exec -it [email_core_container_name] doveadm pw -s [scheme-name]
```
This will attach to a running container, prompt you for a password and provide a hash. For example:
```bash
> docker exec -it dockermail_core_1 doveadm pw -s SHA512-CRYPT
Enter new password:
Retype new password:
{SHA512-CRYPT}$6$OA/BzvLzf7C9uohz$a9B0kCihcHsfnK.x4xJWHs9V7.eR5crVtSUn6hoe6p03oea34.uxkozRUw7RYu13z26xNniY3M1kZu4CgSVaB/
```
See [Dovecot Wiki](http://wiki.dovecot.org/Authentication/PasswordSchemes) for more details on different schemes.
## Run
Using the pre-built image from docker hub, you can start your email by running:
```bash
docker run -name dockermail -d \
-p 25:25 -p 587:587 -p 143:143 -p 993:993 \
-v /opt/dockermail/settings:/mail_settings \
-v /opt/dockermail/vmail:/vmail \
adaline/dockermail-core
```
This will connect SMTP ports 25/587 and IMAP port 143/993 to host and mount the folders as per examples given above.
## SSL
Container will produce own SSL keys and back these up into the settings folder. These files are:
```
ssl-cert-snakeoil.key
ssl-cert-snakeoil.pem
```
On boot it will use these if present. You can replace these backup keys with your own, just restart the container.
|
adaline/dockermail
|
core/README.md
|
Markdown
|
mit
| 3,340 | 36.111111 | 167 | 0.723653 | false |
/** @file safesysstat.h
* @brief #include <sys/stat.h> with portability enhancements
*/
/* Copyright (C) 2007,2012,2017 Olly Betts
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#ifndef XAPIAN_INCLUDED_SAFESYSSTAT_H
#define XAPIAN_INCLUDED_SAFESYSSTAT_H
#include <sys/stat.h>
#include <sys/types.h>
#ifdef __WIN32__
// MSVC lacks these POSIX macros and other compilers may too:
#ifndef S_ISDIR
# define S_ISDIR(ST_MODE) (((ST_MODE) & _S_IFMT) == _S_IFDIR)
#endif
#ifndef S_ISREG
# define S_ISREG(ST_MODE) (((ST_MODE) & _S_IFMT) == _S_IFREG)
#endif
// On UNIX, mkdir() is prototyped in <sys/stat.h> but on Windows it's in
// <direct.h>, so just include that from here to avoid build failures on
// MSVC just because of some new use of mkdir(). This also reduces the
// number of conditionalised #include statements we need in the sources.
#include <direct.h>
// Add overloaded version of mkdir which takes an (ignored) mode argument
// to allow source code to just specify a mode argument unconditionally.
//
// The () around mkdir are in case it's defined as a macro.
inline int (mkdir)(const char *pathname, mode_t /*mode*/) {
return _mkdir(pathname);
}
#else
// These were specified by POSIX.1-1996, so most platforms should have
// these by now:
#ifndef S_ISDIR
# define S_ISDIR(ST_MODE) (((ST_MODE) & S_IFMT) == S_IFDIR)
#endif
#ifndef S_ISREG
# define S_ISREG(ST_MODE) (((ST_MODE) & S_IFMT) == S_IFREG)
#endif
#endif
#endif /* XAPIAN_INCLUDED_SAFESYSSTAT_H */
|
Kronuz/Xapiand
|
src/xapian/common/safesysstat.h
|
C
|
mit
| 2,158 | 32.2 | 73 | 0.715014 | false |
// Script by Bo Tranberg
// http://botranberg.dk
// https://github.com/tranberg/citations
//
// This script requires jQuery and jQuery UI
$(function() {
// Inser html for dialog just before the button to open it
var butt = document.getElementById('citations');
butt.insertAdjacentHTML('beforeBegin',
'\
<div id="dialog" title="Cite this paper" style="text-align:left"> \
<p style="text-align: center;"><b>Copy and paste one of the formatted citations into your bibliography manager.</b></p> \
<table style="border-collapse:separate; border-spacing:2em"> \
<tr style="vertical-align:top;"> \
<td><strong>APA</strong></td> \
<td><span id="APA1"></span><span id="APA2"></span><span id="APA3"></span><span id="APA4" style="font-style: italic"></span></td> \
</tr> \
<tr style="vertical-align:top;"> \
<td><strong>Bibtex</strong></td> \
<td> \
@article{<span id="bibtag"></span>,<br> \
title={<span id="bibtitle"></span>},<br> \
author={<span id="bibauthor"></span>},<br> \
journal={<span id="bibjournal"></span>},<br> \
year={<span id="bibyear"></span>},<br> \
url={<span id="biburl"></span>},<br> \
} \
</td> \
</tr> \
</table> \
</div>');
// Definitions of citations dialog
$("#dialog").dialog({
autoOpen: false,
show: {
effect: "fade",
duration: 200
},
hide: {
effect: "fade",
duration: 200
},
maxWidth:600,
maxHeight: 600,
width: 660,
height: 400,
modal: true,
});
// Open citation dialog on click
$("#citations").click(function() {
$("#dialog").dialog("open");
});
// Find authors
var metas = document.getElementsByTagName('meta');
var author = ''
// Determine number of authors
var numAuthors = 0
for (i=0; i<metas.length; i++) {
if (metas[i].getAttribute("name") == "citation_author") {
numAuthors += 1
};
};
// Build a string of authors for Bibtex
var authorIndex = 0
for (i=0; i<metas.length; i++) {
if (metas[i].getAttribute("name") == "citation_author") {
authorIndex += 1
if (authorIndex>1) {
if (authorIndex<=numAuthors) {
author = author+' and '
};
};
author = author+metas[i].getAttribute("content")
};
};
// Populate formatted citations in Bibtex
var title = $("meta[name='citation_title']").attr('content')
// The following test might seem stupid, but it's needed because some php function at OpenPsych appends two whitespaces to the start of the title in the meta data
if (title[1] == ' ') {
title = title.slice(2)
};
var journal = $("meta[name='citation_journal_title']").attr('content')
var pubyear = $("meta[name='citation_publication_date']").attr('content').substring(0,4)
var puburl = document.URL
// Build a string for the Bibtex tag
if (author.indexOf(',') < author.indexOf(' ')) {
var firstAuthor = author.substr(0,author.indexOf(','));
} else {
var firstAuthor = author.substr(0,author.indexOf(' '));
};
if (title.indexOf(',')<title.indexOf('0')) {
var startTitle = title.substr(0,title.indexOf(','));
} else {
var startTitle = title.substr(0,title.indexOf(' '));
};
$('#bibtag').html(firstAuthor+pubyear)
$('#bibtitle').html(title)
$('#bibauthor').html(author)
$('#bibjournal').html(journal)
$('#bibyear').html(pubyear)
$('#biburl').html(puburl)
//Build a string of authors for APA
var author = ''
var authorIndex = 0
for (i=0; i<metas.length; i++) {
if (metas[i].getAttribute("name") == "citation_author") {
authorIndex += 1
if (authorIndex>1) {
if (authorIndex<numAuthors) {
author = author+', '
};
};
if (authorIndex>1) {
if (authorIndex===numAuthors) {
author = author+', & '
};
};
// Check if author only has a single name
if (metas[i].getAttribute("content").indexOf(', ')>0) {
// Append author string with the surnames and first letter of next author's name
author = author+metas[i].getAttribute("content").substr(0,metas[i].getAttribute("content").indexOf(', ')+3)+'.'
// If the author has several names, append the first letter of these to the string
if (metas[i].getAttribute("content").indexOf(', ') < metas[i].getAttribute("content").lastIndexOf(' ')-1) {
var extraNames = metas[i].getAttribute("content").substr(metas[i].getAttribute("content").indexOf(', ')+2)
var addNames = extraNames.substr(extraNames.indexOf(' '))
author = author+addNames.substr(addNames.indexOf(' '))
};
} else {
author = author+metas[i].getAttribute("content")
};
};
};
// Populate formatted citations in APA
$('#APA1').html(author)
$('#APA2').html(' ('+pubyear+').')
$('#APA3').html(' '+title+'.')
$('#APA4').html(' '+journal+'.')
});
|
tranberg/citations
|
js/cite.js
|
JavaScript
|
mit
| 6,059 | 39.939189 | 166 | 0.49117 | false |
/*
* Copyright (C) 2010 The Android Open Source Project
*
* 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.
*/
#ifndef _INIT_INIT_PARSER_H_
#define _INIT_INIT_PARSER_H_
#include <map>
#include <memory>
#include <string>
#include <vector>
class SectionParser {
public:
virtual ~SectionParser() {
}
virtual bool ParseSection(const std::vector<std::string>& args, const std::string& filename,
int line, std::string* err) = 0;
virtual bool ParseLineSection(const std::vector<std::string>& args, int line,
std::string* err) = 0;
virtual void EndSection() = 0;
virtual void EndFile(const std::string& filename) = 0;
};
class Parser {
public:
static Parser& GetInstance();
void DumpState() const;
bool ParseConfig(const std::string& path);
void AddSectionParser(const std::string& name,
std::unique_ptr<SectionParser> parser);
void set_is_system_etc_init_loaded(bool loaded) {
is_system_etc_init_loaded_ = loaded;
}
void set_is_vendor_etc_init_loaded(bool loaded) {
is_vendor_etc_init_loaded_ = loaded;
}
void set_is_odm_etc_init_loaded(bool loaded) {
is_odm_etc_init_loaded_ = loaded;
}
bool is_system_etc_init_loaded() { return is_system_etc_init_loaded_; }
bool is_vendor_etc_init_loaded() { return is_vendor_etc_init_loaded_; }
bool is_odm_etc_init_loaded() { return is_odm_etc_init_loaded_; }
private:
Parser();
void ParseData(const std::string& filename, const std::string& data);
bool ParseConfigFile(const std::string& path);
bool ParseConfigDir(const std::string& path);
std::map<std::string, std::unique_ptr<SectionParser>> section_parsers_;
bool is_system_etc_init_loaded_ = false;
bool is_vendor_etc_init_loaded_ = false;
bool is_odm_etc_init_loaded_ = false;
};
#endif
|
dylanh333/android-unmkbootimg
|
vendor/android-tools/init/init_parser.h
|
C
|
mit
| 2,414 | 33.485714 | 96 | 0.664872 | false |
{% extends "base.html" %}
{% block content %}
<h1>{{ question.question_text }}</h1>
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
<form action="{% url 'polls:vote' question.id %}" method="post">
{% csrf_token %}
{% for choice in question.choice_set.all %}
<input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}" />
<label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br/>
{% endfor %}
<input type="submit" value="Vote" />
</form>
{% endblock content %}
|
gavmain/django_demo
|
demo/templates/polls/detail.html
|
HTML
|
mit
| 552 | 35.8 | 97 | 0.610507 | false |
# MyLibSwift
|
arise-yoshimoto/MyLibSwift
|
README.md
|
Markdown
|
mit
| 12 | 12 | 12 | 0.833333 | false |
package io.github.ageofwar.telejam.updates;
import io.github.ageofwar.telejam.Bot;
import io.github.ageofwar.telejam.TelegramException;
import io.github.ageofwar.telejam.methods.GetUpdates;
import java.io.IOException;
import java.util.Collections;
import java.util.Objects;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.function.LongUnaryOperator;
/**
* Utility class that reads new updates received from a bot.
*
* @author Michi Palazzo
*/
public final class UpdateReader implements AutoCloseable {
private final Bot bot;
private final ConcurrentLinkedQueue<Update> updates;
private final LongUnaryOperator backOff;
private long lastUpdateId;
/**
* Constructs an UpdateReader.
*
* @param bot the bot that receive updates
* @param backOff back off to be used when long polling fails
*/
public UpdateReader(Bot bot, LongUnaryOperator backOff) {
this.bot = Objects.requireNonNull(bot);
this.backOff = Objects.requireNonNull(backOff);
updates = new ConcurrentLinkedQueue<>();
lastUpdateId = -1;
}
/**
* Constructs an UpdateReader.
*
* @param bot the bot that receive updates
*/
public UpdateReader(Bot bot) {
this(bot, a -> 500L);
}
/**
* Returns the number of updates that can be read from this update reader without blocking by the
* next invocation read method for this update reader. The next invocation
* might be the same thread or another thread.
* If the available updates are more than {@code Integer.MAX_VALUE}, returns
* {@code Integer.MAX_VALUE}.
*
* @return the number of updates that can be read from this update reader
* without blocking by the next invocation read method
*/
public int available() {
return updates.size();
}
/**
* Tells whether this stream is ready to be read.
*
* @return <code>true</code> if the next read() is guaranteed not to block for input,
* <code>false</code> otherwise. Note that returning false does not guarantee that the
* next read will block.
*/
public boolean ready() {
return !updates.isEmpty();
}
/**
* Reads one update from the stream.
*
* @return the read update
* @throws IOException if an I/O Exception occurs
* @throws InterruptedException if any thread has interrupted the current
* thread while waiting for updates
*/
public Update read() throws IOException, InterruptedException {
if (!ready()) {
for (long attempts = 0; getUpdates() == 0; attempts++) {
Thread.sleep(backOff.applyAsLong(attempts));
}
}
return updates.remove();
}
/**
* Retrieves new updates received from the bot.
*
* @return number of updates received
* @throws IOException if an I/O Exception occurs
*/
public int getUpdates() throws IOException {
try {
Update[] newUpdates = getUpdates(lastUpdateId + 1);
Collections.addAll(updates, newUpdates);
if (newUpdates.length > 0) {
lastUpdateId = newUpdates[newUpdates.length - 1].getId();
}
return newUpdates.length;
} catch (Throwable e) {
if (!(e instanceof TelegramException)) {
lastUpdateId++;
}
throw e;
}
}
/**
* Discards buffered updates and all received updates.
*
* @throws IOException if an I/O Exception occurs
*/
public void discardAll() throws IOException {
Update[] newUpdate = getUpdates(-1);
if (newUpdate.length == 1) {
lastUpdateId = newUpdate[0].getId();
}
updates.clear();
}
private Update[] getUpdates(long offset) throws IOException {
GetUpdates getUpdates = new GetUpdates()
.offset(offset)
.allowedUpdates();
return bot.execute(getUpdates);
}
@Override
public void close() throws IOException {
try {
Update nextUpdate = updates.peek();
getUpdates(nextUpdate != null ? nextUpdate.getId() : lastUpdateId + 1);
lastUpdateId = -1;
updates.clear();
} catch (IOException e) {
throw new IOException("Unable to close update reader", e);
}
}
}
|
AgeOfWar/Telejam
|
src/main/java/io/github/ageofwar/telejam/updates/UpdateReader.java
|
Java
|
mit
| 4,138 | 27.937063 | 99 | 0.664572 | false |
@import url("//fonts.googleapis.com/css?family=News+Cycle:400,700");
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
display: block;
}
audio,
canvas,
video {
display: inline-block;
}
audio:not([controls]) {
display: none;
height: 0;
}
[hidden],
template {
display: none;
}
html {
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
body {
margin: 0;
}
a {
background: transparent;
}
a:focus {
outline: thin dotted;
}
a:active,
a:hover {
outline: 0;
}
h1 {
margin: 0.67em 0;
font-size: 2em;
}
abbr[title] {
border-bottom: 1px dotted;
}
b,
strong {
font-weight: bold;
}
dfn {
font-style: italic;
}
hr {
height: 0;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
mark {
color: #000;
background: #ff0;
}
code,
kbd,
pre,
samp {
font-family: monospace, serif;
font-size: 1em;
}
pre {
white-space: pre-wrap;
}
q {
quotes: "\201C" "\201D" "\2018" "\2019";
}
small {
font-size: 80%;
}
sub,
sup {
position: relative;
font-size: 75%;
line-height: 0;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
img {
border: 0;
}
svg:not(:root) {
overflow: hidden;
}
figure {
margin: 0;
}
fieldset {
padding: 0.35em 0.625em 0.75em;
margin: 0 2px;
border: 1px solid #c0c0c0;
}
legend {
padding: 0;
border: 0;
}
button,
input,
select,
textarea {
margin: 0;
font-family: inherit;
font-size: 100%;
}
button,
input {
line-height: normal;
}
button,
select {
text-transform: none;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
cursor: pointer;
-webkit-appearance: button;
}
button[disabled],
html input[disabled] {
cursor: default;
}
input[type="checkbox"],
input[type="radio"] {
padding: 0;
box-sizing: border-box;
}
input[type="search"] {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
-webkit-appearance: textfield;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
padding: 0;
border: 0;
}
textarea {
overflow: auto;
vertical-align: top;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
@media print {
* {
color: #000 !important;
text-shadow: none !important;
background: transparent !important;
box-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
a[href^="javascript:"]:after,
a[href^="#"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
thead {
display: table-header-group;
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
@page {
margin: 2cm .5cm;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
select {
background: #fff !important;
}
.navbar {
display: none;
}
.table td,
.table th {
background-color: #fff !important;
}
.btn > .caret,
.dropup > .btn > .caret {
border-top-color: #000 !important;
}
.label {
border: 1px solid #000;
}
.table {
border-collapse: collapse !important;
}
.table-bordered th,
.table-bordered td {
border: 1px solid #ddd !important;
}
}
*,
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html {
font-size: 62.5%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body {
/*font-family: Georgia, "Times New Roman", Times, serif;*/
font-size: 15px;
line-height: 1.428571429;
color: #777777;
background-color: #ffffff;
}
input,
button,
select,
textarea {
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
a {
color: #eb6864;
text-decoration: none;
}
a:hover,
a:focus {
color: #e22620;
text-decoration: underline;
}
a:focus {
outline: thin dotted #333;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
img {
vertical-align: middle;
}
.img-responsive {
display: block;
height: auto;
max-width: 100%;
}
.img-rounded {
border-radius: 6px;
}
.img-thumbnail {
display: inline-block;
height: auto;
max-width: 100%;
padding: 4px;
line-height: 1.428571429;
background-color: #ffffff;
border: 1px solid #dddddd;
border-radius: 4px;
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.img-circle {
border-radius: 50%;
}
hr {
margin-top: 21px;
margin-bottom: 21px;
border: 0;
border-top: 1px solid #eeeeee;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
p {
margin: 0 0 10.5px;
}
.lead {
margin-bottom: 21px;
font-size: 17px;
font-weight: 200;
line-height: 1.4;
}
@media (min-width: 768px) {
.lead {
font-size: 22.5px;
}
}
small,
.small {
font-size: 85%;
}
cite {
font-style: normal;
}
.text-muted {
color: #999999;
}
.text-primary {
color: #eb6864;
}
.text-primary:hover {
color: #e53c37;
}
.text-warning {
color: #c09853;
}
.text-warning:hover {
color: #a47e3c;
}
.text-danger {
color: #b94a48;
}
.text-danger:hover {
color: #953b39;
}
.text-success {
color: #468847;
}
.text-success:hover {
color: #356635;
}
.text-info {
color: #3a87ad;
}
.text-info:hover {
color: #2d6987;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.text-center {
text-align: center;
}
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
font-family: "News Cycle", "Arial Narrow Bold", sans-serif;
font-weight: 700;
line-height: 1.1;
color: #000000;
}
h1 small,
h2 small,
h3 small,
h4 small,
h5 small,
h6 small,
.h1 small,
.h2 small,
.h3 small,
.h4 small,
.h5 small,
.h6 small,
h1 .small,
h2 .small,
h3 .small,
h4 .small,
h5 .small,
h6 .small,
.h1 .small,
.h2 .small,
.h3 .small,
.h4 .small,
.h5 .small,
.h6 .small {
font-weight: normal;
line-height: 1;
color: #999999;
}
h1,
h2,
h3 {
margin-top: 21px;
margin-bottom: 10.5px;
}
h1 small,
h2 small,
h3 small,
h1 .small,
h2 .small,
h3 .small {
font-size: 65%;
}
h4,
h5,
h6 {
margin-top: 10.5px;
margin-bottom: 10.5px;
}
h4 small,
h5 small,
h6 small,
h4 .small,
h5 .small,
h6 .small {
font-size: 75%;
}
h1,
.h1 {
font-size: 39px;
}
h2,
.h2 {
font-size: 32px;
}
h3,
.h3 {
font-size: 26px;
}
h4,
.h4 {
font-size: 19px;
}
h5,
.h5 {
font-size: 15px;
}
h6,
.h6 {
font-size: 13px;
}
.page-header {
padding-bottom: 9.5px;
margin: 42px 0 21px;
border-bottom: 1px solid #eeeeee;
}
ul,
ol {
margin-top: 0;
margin-bottom: 10.5px;
}
ul ul,
ol ul,
ul ol,
ol ol {
margin-bottom: 0;
}
.list-unstyled {
padding-left: 0;
list-style: none;
}
.list-inline {
padding-left: 0;
list-style: none;
}
.list-inline > li {
display: inline-block;
padding-right: 5px;
padding-left: 5px;
}
.list-inline > li:first-child {
padding-left: 0;
}
dl {
margin-bottom: 21px;
}
dt,
dd {
line-height: 1.428571429;
}
dt {
font-weight: bold;
}
dd {
margin-left: 0;
}
@media (min-width: 768px) {
.dl-horizontal dt {
float: left;
width: 160px;
overflow: hidden;
clear: left;
text-align: right;
text-overflow: ellipsis;
white-space: nowrap;
}
.dl-horizontal dd {
margin-left: 180px;
}
.dl-horizontal dd:before,
.dl-horizontal dd:after {
display: table;
content: " ";
}
.dl-horizontal dd:after {
clear: both;
}
.dl-horizontal dd:before,
.dl-horizontal dd:after {
display: table;
content: " ";
}
.dl-horizontal dd:after {
clear: both;
}
.dl-horizontal dd:before,
.dl-horizontal dd:after {
display: table;
content: " ";
}
.dl-horizontal dd:after {
clear: both;
}
.dl-horizontal dd:before,
.dl-horizontal dd:after {
display: table;
content: " ";
}
.dl-horizontal dd:after {
clear: both;
}
.dl-horizontal dd:before,
.dl-horizontal dd:after {
display: table;
content: " ";
}
.dl-horizontal dd:after {
clear: both;
}
}
abbr[title],
abbr[data-original-title] {
cursor: help;
border-bottom: 1px dotted #999999;
}
abbr.initialism {
font-size: 90%;
text-transform: uppercase;
}
blockquote {
padding: 10.5px 21px;
margin: 0 0 21px;
border-left: 5px solid #eeeeee;
}
blockquote p {
font-size: 18.75px;
font-weight: 300;
line-height: 1.25;
}
blockquote p:last-child {
margin-bottom: 0;
}
blockquote small {
display: block;
line-height: 1.428571429;
color: #999999;
}
blockquote small:before {
content: '\2014 \00A0';
}
blockquote.pull-right {
padding-right: 15px;
padding-left: 0;
border-right: 5px solid #eeeeee;
border-left: 0;
}
blockquote.pull-right p,
blockquote.pull-right small,
blockquote.pull-right .small {
text-align: right;
}
blockquote.pull-right small:before,
blockquote.pull-right .small:before {
content: '';
}
blockquote.pull-right small:after,
blockquote.pull-right .small:after {
content: '\00A0 \2014';
}
blockquote:before,
blockquote:after {
content: "";
}
address {
margin-bottom: 21px;
font-style: normal;
line-height: 1.428571429;
}
code,
kbd,
pre,
samp {
font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
}
code {
padding: 2px 4px;
font-size: 90%;
color: #c7254e;
white-space: nowrap;
background-color: #f9f2f4;
border-radius: 4px;
}
pre {
display: block;
padding: 10px;
margin: 0 0 10.5px;
font-size: 14px;
line-height: 1.428571429;
color: #333333;
word-break: break-all;
word-wrap: break-word;
background-color: #f5f5f5;
border: 1px solid #cccccc;
border-radius: 4px;
}
pre code {
padding: 0;
font-size: inherit;
color: inherit;
white-space: pre-wrap;
background-color: transparent;
border-radius: 0;
}
.pre-scrollable {
max-height: 340px;
overflow-y: scroll;
}
.container {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
.container:before,
.container:after {
display: table;
content: " ";
}
.container:after {
clear: both;
}
.container:before,
.container:after {
display: table;
content: " ";
}
.container:after {
clear: both;
}
.container:before,
.container:after {
display: table;
content: " ";
}
.container:after {
clear: both;
}
.container:before,
.container:after {
display: table;
content: " ";
}
.container:after {
clear: both;
}
.container:before,
.container:after {
display: table;
content: " ";
}
.container:after {
clear: both;
}
.row {
margin-right: -15px;
margin-left: -15px;
}
.row:before,
.row:after {
display: table;
content: " ";
}
.row:after {
clear: both;
}
.row:before,
.row:after {
display: table;
content: " ";
}
.row:after {
clear: both;
}
.row:before,
.row:after {
display: table;
content: " ";
}
.row:after {
clear: both;
}
.row:before,
.row:after {
display: table;
content: " ";
}
.row:after {
clear: both;
}
.row:before,
.row:after {
display: table;
content: " ";
}
.row:after {
clear: both;
}
.col-xs-1,
.col-sm-1,
.col-md-1,
.col-lg-1,
.col-xs-2,
.col-sm-2,
.col-md-2,
.col-lg-2,
.col-xs-3,
.col-sm-3,
.col-md-3,
.col-lg-3,
.col-xs-4,
.col-sm-4,
.col-md-4,
.col-lg-4,
.col-xs-5,
.col-sm-5,
.col-md-5,
.col-lg-5,
.col-xs-6,
.col-sm-6,
.col-md-6,
.col-lg-6,
.col-xs-7,
.col-sm-7,
.col-md-7,
.col-lg-7,
.col-xs-8,
.col-sm-8,
.col-md-8,
.col-lg-8,
.col-xs-9,
.col-sm-9,
.col-md-9,
.col-lg-9,
.col-xs-10,
.col-sm-10,
.col-md-10,
.col-lg-10,
.col-xs-11,
.col-sm-11,
.col-md-11,
.col-lg-11,
.col-xs-12,
.col-sm-12,
.col-md-12,
.col-lg-12 {
position: relative;
min-height: 1px;
padding-right: 15px;
padding-left: 15px;
}
.col-xs-1,
.col-xs-2,
.col-xs-3,
.col-xs-4,
.col-xs-5,
.col-xs-6,
.col-xs-7,
.col-xs-8,
.col-xs-9,
.col-xs-10,
.col-xs-11 {
float: left;
}
.col-xs-12 {
width: 100%;
}
.col-xs-11 {
width: 91.66666666666666%;
}
.col-xs-10 {
width: 83.33333333333334%;
}
.col-xs-9 {
width: 75%;
}
.col-xs-8 {
width: 66.66666666666666%;
}
.col-xs-7 {
width: 58.333333333333336%;
}
.col-xs-6 {
width: 50%;
}
.col-xs-5 {
width: 41.66666666666667%;
}
.col-xs-4 {
width: 33.33333333333333%;
}
.col-xs-3 {
width: 25%;
}
.col-xs-2 {
width: 16.666666666666664%;
}
.col-xs-1 {
width: 8.333333333333332%;
}
.col-xs-pull-12 {
right: 100%;
}
.col-xs-pull-11 {
right: 91.66666666666666%;
}
.col-xs-pull-10 {
right: 83.33333333333334%;
}
.col-xs-pull-9 {
right: 75%;
}
.col-xs-pull-8 {
right: 66.66666666666666%;
}
.col-xs-pull-7 {
right: 58.333333333333336%;
}
.col-xs-pull-6 {
right: 50%;
}
.col-xs-pull-5 {
right: 41.66666666666667%;
}
.col-xs-pull-4 {
right: 33.33333333333333%;
}
.col-xs-pull-3 {
right: 25%;
}
.col-xs-pull-2 {
right: 16.666666666666664%;
}
.col-xs-pull-1 {
right: 8.333333333333332%;
}
.col-xs-pull-0 {
right: 0;
}
.col-xs-push-12 {
left: 100%;
}
.col-xs-push-11 {
left: 91.66666666666666%;
}
.col-xs-push-10 {
left: 83.33333333333334%;
}
.col-xs-push-9 {
left: 75%;
}
.col-xs-push-8 {
left: 66.66666666666666%;
}
.col-xs-push-7 {
left: 58.333333333333336%;
}
.col-xs-push-6 {
left: 50%;
}
.col-xs-push-5 {
left: 41.66666666666667%;
}
.col-xs-push-4 {
left: 33.33333333333333%;
}
.col-xs-push-3 {
left: 25%;
}
.col-xs-push-2 {
left: 16.666666666666664%;
}
.col-xs-push-1 {
left: 8.333333333333332%;
}
.col-xs-push-0 {
left: 0;
}
.col-xs-offset-12 {
margin-left: 100%;
}
.col-xs-offset-11 {
margin-left: 91.66666666666666%;
}
.col-xs-offset-10 {
margin-left: 83.33333333333334%;
}
.col-xs-offset-9 {
margin-left: 75%;
}
.col-xs-offset-8 {
margin-left: 66.66666666666666%;
}
.col-xs-offset-7 {
margin-left: 58.333333333333336%;
}
.col-xs-offset-6 {
margin-left: 50%;
}
.col-xs-offset-5 {
margin-left: 41.66666666666667%;
}
.col-xs-offset-4 {
margin-left: 33.33333333333333%;
}
.col-xs-offset-3 {
margin-left: 25%;
}
.col-xs-offset-2 {
margin-left: 16.666666666666664%;
}
.col-xs-offset-1 {
margin-left: 8.333333333333332%;
}
.col-xs-offset-0 {
margin-left: 0;
}
@media (min-width: 768px) {
.container {
width: 750px;
}
.col-sm-1,
.col-sm-2,
.col-sm-3,
.col-sm-4,
.col-sm-5,
.col-sm-6,
.col-sm-7,
.col-sm-8,
.col-sm-9,
.col-sm-10,
.col-sm-11 {
float: left;
}
.col-sm-12 {
width: 100%;
}
.col-sm-11 {
width: 91.66666666666666%;
}
.col-sm-10 {
width: 83.33333333333334%;
}
.col-sm-9 {
width: 75%;
}
.col-sm-8 {
width: 66.66666666666666%;
}
.col-sm-7 {
width: 58.333333333333336%;
}
.col-sm-6 {
width: 50%;
}
.col-sm-5 {
width: 41.66666666666667%;
}
.col-sm-4 {
width: 33.33333333333333%;
}
.col-sm-3 {
width: 25%;
}
.col-sm-2 {
width: 16.666666666666664%;
}
.col-sm-1 {
width: 8.333333333333332%;
}
.col-sm-pull-12 {
right: 100%;
}
.col-sm-pull-11 {
right: 91.66666666666666%;
}
.col-sm-pull-10 {
right: 83.33333333333334%;
}
.col-sm-pull-9 {
right: 75%;
}
.col-sm-pull-8 {
right: 66.66666666666666%;
}
.col-sm-pull-7 {
right: 58.333333333333336%;
}
.col-sm-pull-6 {
right: 50%;
}
.col-sm-pull-5 {
right: 41.66666666666667%;
}
.col-sm-pull-4 {
right: 33.33333333333333%;
}
.col-sm-pull-3 {
right: 25%;
}
.col-sm-pull-2 {
right: 16.666666666666664%;
}
.col-sm-pull-1 {
right: 8.333333333333332%;
}
.col-sm-pull-0 {
right: 0;
}
.col-sm-push-12 {
left: 100%;
}
.col-sm-push-11 {
left: 91.66666666666666%;
}
.col-sm-push-10 {
left: 83.33333333333334%;
}
.col-sm-push-9 {
left: 75%;
}
.col-sm-push-8 {
left: 66.66666666666666%;
}
.col-sm-push-7 {
left: 58.333333333333336%;
}
.col-sm-push-6 {
left: 50%;
}
.col-sm-push-5 {
left: 41.66666666666667%;
}
.col-sm-push-4 {
left: 33.33333333333333%;
}
.col-sm-push-3 {
left: 25%;
}
.col-sm-push-2 {
left: 16.666666666666664%;
}
.col-sm-push-1 {
left: 8.333333333333332%;
}
.col-sm-push-0 {
left: 0;
}
.col-sm-offset-12 {
margin-left: 100%;
}
.col-sm-offset-11 {
margin-left: 91.66666666666666%;
}
.col-sm-offset-10 {
margin-left: 83.33333333333334%;
}
.col-sm-offset-9 {
margin-left: 75%;
}
.col-sm-offset-8 {
margin-left: 66.66666666666666%;
}
.col-sm-offset-7 {
margin-left: 58.333333333333336%;
}
.col-sm-offset-6 {
margin-left: 50%;
}
.col-sm-offset-5 {
margin-left: 41.66666666666667%;
}
.col-sm-offset-4 {
margin-left: 33.33333333333333%;
}
.col-sm-offset-3 {
margin-left: 25%;
}
.col-sm-offset-2 {
margin-left: 16.666666666666664%;
}
.col-sm-offset-1 {
margin-left: 8.333333333333332%;
}
.col-sm-offset-0 {
margin-left: 0;
}
}
@media (min-width: 992px) {
.container {
width: 970px;
}
.col-md-1,
.col-md-2,
.col-md-3,
.col-md-4,
.col-md-5,
.col-md-6,
.col-md-7,
.col-md-8,
.col-md-9,
.col-md-10,
.col-md-11 {
float: left;
}
.col-md-12 {
width: 100%;
}
.col-md-11 {
width: 91.66666666666666%;
}
.col-md-10 {
width: 83.33333333333334%;
}
.col-md-9 {
width: 75%;
}
.col-md-8 {
width: 66.66666666666666%;
}
.col-md-7 {
width: 58.333333333333336%;
}
.col-md-6 {
width: 50%;
}
.col-md-5 {
width: 41.66666666666667%;
}
.col-md-4 {
width: 33.33333333333333%;
}
.col-md-3 {
width: 25%;
}
.col-md-2 {
width: 16.666666666666664%;
}
.col-md-1 {
width: 8.333333333333332%;
}
.col-md-pull-12 {
right: 100%;
}
.col-md-pull-11 {
right: 91.66666666666666%;
}
.col-md-pull-10 {
right: 83.33333333333334%;
}
.col-md-pull-9 {
right: 75%;
}
.col-md-pull-8 {
right: 66.66666666666666%;
}
.col-md-pull-7 {
right: 58.333333333333336%;
}
.col-md-pull-6 {
right: 50%;
}
.col-md-pull-5 {
right: 41.66666666666667%;
}
.col-md-pull-4 {
right: 33.33333333333333%;
}
.col-md-pull-3 {
right: 25%;
}
.col-md-pull-2 {
right: 16.666666666666664%;
}
.col-md-pull-1 {
right: 8.333333333333332%;
}
.col-md-pull-0 {
right: 0;
}
.col-md-push-12 {
left: 100%;
}
.col-md-push-11 {
left: 91.66666666666666%;
}
.col-md-push-10 {
left: 83.33333333333334%;
}
.col-md-push-9 {
left: 75%;
}
.col-md-push-8 {
left: 66.66666666666666%;
}
.col-md-push-7 {
left: 58.333333333333336%;
}
.col-md-push-6 {
left: 50%;
}
.col-md-push-5 {
left: 41.66666666666667%;
}
.col-md-push-4 {
left: 33.33333333333333%;
}
.col-md-push-3 {
left: 25%;
}
.col-md-push-2 {
left: 16.666666666666664%;
}
.col-md-push-1 {
left: 8.333333333333332%;
}
.col-md-push-0 {
left: 0;
}
.col-md-offset-12 {
margin-left: 100%;
}
.col-md-offset-11 {
margin-left: 91.66666666666666%;
}
.col-md-offset-10 {
margin-left: 83.33333333333334%;
}
.col-md-offset-9 {
margin-left: 75%;
}
.col-md-offset-8 {
margin-left: 66.66666666666666%;
}
.col-md-offset-7 {
margin-left: 58.333333333333336%;
}
.col-md-offset-6 {
margin-left: 50%;
}
.col-md-offset-5 {
margin-left: 41.66666666666667%;
}
.col-md-offset-4 {
margin-left: 33.33333333333333%;
}
.col-md-offset-3 {
margin-left: 25%;
}
.col-md-offset-2 {
margin-left: 16.666666666666664%;
}
.col-md-offset-1 {
margin-left: 8.333333333333332%;
}
.col-md-offset-0 {
margin-left: 0;
}
}
@media (min-width: 1200px) {
.container {
width: 1170px;
}
.col-lg-1,
.col-lg-2,
.col-lg-3,
.col-lg-4,
.col-lg-5,
.col-lg-6,
.col-lg-7,
.col-lg-8,
.col-lg-9,
.col-lg-10,
.col-lg-11 {
float: left;
}
.col-lg-12 {
width: 100%;
}
.col-lg-11 {
width: 91.66666666666666%;
}
.col-lg-10 {
width: 83.33333333333334%;
}
.col-lg-9 {
width: 75%;
}
.col-lg-8 {
width: 66.66666666666666%;
}
.col-lg-7 {
width: 58.333333333333336%;
}
.col-lg-6 {
width: 50%;
}
.col-lg-5 {
width: 41.66666666666667%;
}
.col-lg-4 {
width: 33.33333333333333%;
}
.col-lg-3 {
width: 25%;
}
.col-lg-2 {
width: 16.666666666666664%;
}
.col-lg-1 {
width: 8.333333333333332%;
}
.col-lg-pull-12 {
right: 100%;
}
.col-lg-pull-11 {
right: 91.66666666666666%;
}
.col-lg-pull-10 {
right: 83.33333333333334%;
}
.col-lg-pull-9 {
right: 75%;
}
.col-lg-pull-8 {
right: 66.66666666666666%;
}
.col-lg-pull-7 {
right: 58.333333333333336%;
}
.col-lg-pull-6 {
right: 50%;
}
.col-lg-pull-5 {
right: 41.66666666666667%;
}
.col-lg-pull-4 {
right: 33.33333333333333%;
}
.col-lg-pull-3 {
right: 25%;
}
.col-lg-pull-2 {
right: 16.666666666666664%;
}
.col-lg-pull-1 {
right: 8.333333333333332%;
}
.col-lg-pull-0 {
right: 0;
}
.col-lg-push-12 {
left: 100%;
}
.col-lg-push-11 {
left: 91.66666666666666%;
}
.col-lg-push-10 {
left: 83.33333333333334%;
}
.col-lg-push-9 {
left: 75%;
}
.col-lg-push-8 {
left: 66.66666666666666%;
}
.col-lg-push-7 {
left: 58.333333333333336%;
}
.col-lg-push-6 {
left: 50%;
}
.col-lg-push-5 {
left: 41.66666666666667%;
}
.col-lg-push-4 {
left: 33.33333333333333%;
}
.col-lg-push-3 {
left: 25%;
}
.col-lg-push-2 {
left: 16.666666666666664%;
}
.col-lg-push-1 {
left: 8.333333333333332%;
}
.col-lg-push-0 {
left: 0;
}
.col-lg-offset-12 {
margin-left: 100%;
}
.col-lg-offset-11 {
margin-left: 91.66666666666666%;
}
.col-lg-offset-10 {
margin-left: 83.33333333333334%;
}
.col-lg-offset-9 {
margin-left: 75%;
}
.col-lg-offset-8 {
margin-left: 66.66666666666666%;
}
.col-lg-offset-7 {
margin-left: 58.333333333333336%;
}
.col-lg-offset-6 {
margin-left: 50%;
}
.col-lg-offset-5 {
margin-left: 41.66666666666667%;
}
.col-lg-offset-4 {
margin-left: 33.33333333333333%;
}
.col-lg-offset-3 {
margin-left: 25%;
}
.col-lg-offset-2 {
margin-left: 16.666666666666664%;
}
.col-lg-offset-1 {
margin-left: 8.333333333333332%;
}
.col-lg-offset-0 {
margin-left: 0;
}
}
table {
max-width: 100%;
background-color: transparent;
}
th {
text-align: left;
}
.table {
width: 100%;
margin-bottom: 21px;
}
.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
padding: 8px;
line-height: 1.428571429;
vertical-align: top;
border-top: 1px solid #dddddd;
}
.table > thead > tr > th {
vertical-align: bottom;
border-bottom: 2px solid #dddddd;
}
.table > caption + thead > tr:first-child > th,
.table > colgroup + thead > tr:first-child > th,
.table > thead:first-child > tr:first-child > th,
.table > caption + thead > tr:first-child > td,
.table > colgroup + thead > tr:first-child > td,
.table > thead:first-child > tr:first-child > td {
border-top: 0;
}
.table > tbody + tbody {
border-top: 2px solid #dddddd;
}
.table .table {
background-color: #ffffff;
}
.table-condensed > thead > tr > th,
.table-condensed > tbody > tr > th,
.table-condensed > tfoot > tr > th,
.table-condensed > thead > tr > td,
.table-condensed > tbody > tr > td,
.table-condensed > tfoot > tr > td {
padding: 5px;
}
.table-bordered {
border: 1px solid #dddddd;
}
.table-bordered > thead > tr > th,
.table-bordered > tbody > tr > th,
.table-bordered > tfoot > tr > th,
.table-bordered > thead > tr > td,
.table-bordered > tbody > tr > td,
.table-bordered > tfoot > tr > td {
border: 1px solid #dddddd;
}
.table-bordered > thead > tr > th,
.table-bordered > thead > tr > td {
border-bottom-width: 2px;
}
.table-striped > tbody > tr:nth-child(odd) > td,
.table-striped > tbody > tr:nth-child(odd) > th {
background-color: #f9f9f9;
}
.table-hover > tbody > tr:hover > td,
.table-hover > tbody > tr:hover > th {
background-color: #f5f5f5;
}
table col[class*="col-"] {
display: table-column;
float: none;
}
table td[class*="col-"],
table th[class*="col-"] {
display: table-cell;
float: none;
}
.table > thead > tr > td.active,
.table > tbody > tr > td.active,
.table > tfoot > tr > td.active,
.table > thead > tr > th.active,
.table > tbody > tr > th.active,
.table > tfoot > tr > th.active,
.table > thead > tr.active > td,
.table > tbody > tr.active > td,
.table > tfoot > tr.active > td,
.table > thead > tr.active > th,
.table > tbody > tr.active > th,
.table > tfoot > tr.active > th {
background-color: #f5f5f5;
}
.table > thead > tr > td.success,
.table > tbody > tr > td.success,
.table > tfoot > tr > td.success,
.table > thead > tr > th.success,
.table > tbody > tr > th.success,
.table > tfoot > tr > th.success,
.table > thead > tr.success > td,
.table > tbody > tr.success > td,
.table > tfoot > tr.success > td,
.table > thead > tr.success > th,
.table > tbody > tr.success > th,
.table > tfoot > tr.success > th {
background-color: #dff0d8;
}
.table-hover > tbody > tr > td.success:hover,
.table-hover > tbody > tr > th.success:hover,
.table-hover > tbody > tr.success:hover > td,
.table-hover > tbody > tr.success:hover > th {
background-color: #d0e9c6;
}
.table > thead > tr > td.danger,
.table > tbody > tr > td.danger,
.table > tfoot > tr > td.danger,
.table > thead > tr > th.danger,
.table > tbody > tr > th.danger,
.table > tfoot > tr > th.danger,
.table > thead > tr.danger > td,
.table > tbody > tr.danger > td,
.table > tfoot > tr.danger > td,
.table > thead > tr.danger > th,
.table > tbody > tr.danger > th,
.table > tfoot > tr.danger > th {
background-color: #f2dede;
}
.table-hover > tbody > tr > td.danger:hover,
.table-hover > tbody > tr > th.danger:hover,
.table-hover > tbody > tr.danger:hover > td,
.table-hover > tbody > tr.danger:hover > th {
background-color: #ebcccc;
}
.table > thead > tr > td.warning,
.table > tbody > tr > td.warning,
.table > tfoot > tr > td.warning,
.table > thead > tr > th.warning,
.table > tbody > tr > th.warning,
.table > tfoot > tr > th.warning,
.table > thead > tr.warning > td,
.table > tbody > tr.warning > td,
.table > tfoot > tr.warning > td,
.table > thead > tr.warning > th,
.table > tbody > tr.warning > th,
.table > tfoot > tr.warning > th {
background-color: #fcf8e3;
}
.table-hover > tbody > tr > td.warning:hover,
.table-hover > tbody > tr > th.warning:hover,
.table-hover > tbody > tr.warning:hover > td,
.table-hover > tbody > tr.warning:hover > th {
background-color: #faf2cc;
}
@media (max-width: 767px) {
.table-responsive {
width: 100%;
margin-bottom: 15.75px;
overflow-x: scroll;
overflow-y: hidden;
border: 1px solid #dddddd;
-ms-overflow-style: -ms-autohiding-scrollbar;
-webkit-overflow-scrolling: touch;
}
.table-responsive > .table {
margin-bottom: 0;
}
.table-responsive > .table > thead > tr > th,
.table-responsive > .table > tbody > tr > th,
.table-responsive > .table > tfoot > tr > th,
.table-responsive > .table > thead > tr > td,
.table-responsive > .table > tbody > tr > td,
.table-responsive > .table > tfoot > tr > td {
white-space: nowrap;
}
.table-responsive > .table-bordered {
border: 0;
}
.table-responsive > .table-bordered > thead > tr > th:first-child,
.table-responsive > .table-bordered > tbody > tr > th:first-child,
.table-responsive > .table-bordered > tfoot > tr > th:first-child,
.table-responsive > .table-bordered > thead > tr > td:first-child,
.table-responsive > .table-bordered > tbody > tr > td:first-child,
.table-responsive > .table-bordered > tfoot > tr > td:first-child {
border-left: 0;
}
.table-responsive > .table-bordered > thead > tr > th:last-child,
.table-responsive > .table-bordered > tbody > tr > th:last-child,
.table-responsive > .table-bordered > tfoot > tr > th:last-child,
.table-responsive > .table-bordered > thead > tr > td:last-child,
.table-responsive > .table-bordered > tbody > tr > td:last-child,
.table-responsive > .table-bordered > tfoot > tr > td:last-child {
border-right: 0;
}
.table-responsive > .table-bordered > tbody > tr:last-child > th,
.table-responsive > .table-bordered > tfoot > tr:last-child > th,
.table-responsive > .table-bordered > tbody > tr:last-child > td,
.table-responsive > .table-bordered > tfoot > tr:last-child > td {
border-bottom: 0;
}
}
fieldset {
padding: 0;
margin: 0;
border: 0;
}
legend {
display: block;
width: 100%;
padding: 0;
margin-bottom: 21px;
font-size: 22.5px;
line-height: inherit;
color: #777777;
border: 0;
border-bottom: 1px solid #e5e5e5;
}
label {
display: inline-block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="search"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
input[type="radio"],
input[type="checkbox"] {
margin: 4px 0 0;
margin-top: 1px \9;
/* IE8-9 */
line-height: normal;
}
input[type="file"] {
display: block;
}
select[multiple],
select[size] {
height: auto;
}
select optgroup {
font-family: inherit;
font-size: inherit;
font-style: inherit;
}
input[type="file"]:focus,
input[type="radio"]:focus,
input[type="checkbox"]:focus {
outline: thin dotted #333;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
height: auto;
}
output {
display: block;
padding-top: 9px;
font-size: 15px;
line-height: 1.428571429;
color: #777777;
vertical-align: middle;
}
.form-control {
display: block;
width: 100%;
height: 39px;
padding: 8px 12px;
font-size: 15px;
line-height: 1.428571429;
color: #777777;
vertical-align: middle;
background-color: #ffffff;
background-image: none;
border: 1px solid #cccccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
}
.form-control:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
}
.form-control:-moz-placeholder {
color: #999999;
}
.form-control::-moz-placeholder {
color: #999999;
}
.form-control:-ms-input-placeholder {
color: #999999;
}
.form-control::-webkit-input-placeholder {
color: #999999;
}
.form-control[disabled],
.form-control[readonly],
fieldset[disabled] .form-control {
cursor: not-allowed;
background-color: #eeeeee;
}
textarea.form-control {
height: auto;
}
.form-group {
margin-bottom: 15px;
}
.radio,
.checkbox {
display: block;
min-height: 21px;
padding-left: 20px;
margin-top: 10px;
margin-bottom: 10px;
vertical-align: middle;
}
.radio label,
.checkbox label {
display: inline;
margin-bottom: 0;
font-weight: normal;
cursor: pointer;
}
.radio input[type="radio"],
.radio-inline input[type="radio"],
.checkbox input[type="checkbox"],
.checkbox-inline input[type="checkbox"] {
float: left;
margin-left: -20px;
}
.radio + .radio,
.checkbox + .checkbox {
margin-top: -5px;
}
.radio-inline,
.checkbox-inline {
display: inline-block;
padding-left: 20px;
margin-bottom: 0;
font-weight: normal;
vertical-align: middle;
cursor: pointer;
}
.radio-inline + .radio-inline,
.checkbox-inline + .checkbox-inline {
margin-top: 0;
margin-left: 10px;
}
input[type="radio"][disabled],
input[type="checkbox"][disabled],
.radio[disabled],
.radio-inline[disabled],
.checkbox[disabled],
.checkbox-inline[disabled],
fieldset[disabled] input[type="radio"],
fieldset[disabled] input[type="checkbox"],
fieldset[disabled] .radio,
fieldset[disabled] .radio-inline,
fieldset[disabled] .checkbox,
fieldset[disabled] .checkbox-inline {
cursor: not-allowed;
}
.input-sm {
height: 31px;
padding: 5px 10px;
font-size: 13px;
line-height: 1.5;
border-radius: 3px;
}
select.input-sm {
height: 31px;
line-height: 31px;
}
textarea.input-sm {
height: auto;
}
.input-lg {
height: 58px;
padding: 14px 16px;
font-size: 19px;
line-height: 1.33;
border-radius: 6px;
}
select.input-lg {
height: 58px;
line-height: 58px;
}
textarea.input-lg {
height: auto;
}
.has-warning .help-block,
.has-warning .control-label,
.has-warning .radio,
.has-warning .checkbox,
.has-warning .radio-inline,
.has-warning .checkbox-inline {
color: #c09853;
}
.has-warning .form-control {
border-color: #c09853;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.has-warning .form-control:focus {
border-color: #a47e3c;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;
}
.has-warning .input-group-addon {
color: #c09853;
background-color: #fcf8e3;
border-color: #c09853;
}
.has-error .help-block,
.has-error .control-label,
.has-error .radio,
.has-error .checkbox,
.has-error .radio-inline,
.has-error .checkbox-inline {
color: #b94a48;
}
.has-error .form-control {
border-color: #b94a48;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.has-error .form-control:focus {
border-color: #953b39;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;
}
.has-error .input-group-addon {
color: #b94a48;
background-color: #f2dede;
border-color: #b94a48;
}
.has-success .help-block,
.has-success .control-label,
.has-success .radio,
.has-success .checkbox,
.has-success .radio-inline,
.has-success .checkbox-inline {
color: #468847;
}
.has-success .form-control {
border-color: #468847;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.has-success .form-control:focus {
border-color: #356635;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;
}
.has-success .input-group-addon {
color: #468847;
background-color: #dff0d8;
border-color: #468847;
}
.form-control-static {
margin-bottom: 0;
}
.help-block {
display: block;
margin-top: 5px;
margin-bottom: 10px;
color: #b7b7b7;
}
@media (min-width: 768px) {
.form-inline .form-group {
display: inline-block;
margin-bottom: 0;
vertical-align: middle;
}
.form-inline .form-control {
display: inline-block;
}
.form-inline .radio,
.form-inline .checkbox {
display: inline-block;
padding-left: 0;
margin-top: 0;
margin-bottom: 0;
}
.form-inline .radio input[type="radio"],
.form-inline .checkbox input[type="checkbox"] {
float: none;
margin-left: 0;
}
}
.form-horizontal .control-label,
.form-horizontal .radio,
.form-horizontal .checkbox,
.form-horizontal .radio-inline,
.form-horizontal .checkbox-inline {
padding-top: 9px;
margin-top: 0;
margin-bottom: 0;
}
.form-horizontal .form-group {
margin-right: -15px;
margin-left: -15px;
}
.form-horizontal .form-group:before,
.form-horizontal .form-group:after {
display: table;
content: " ";
}
.form-horizontal .form-group:after {
clear: both;
}
.form-horizontal .form-group:before,
.form-horizontal .form-group:after {
display: table;
content: " ";
}
.form-horizontal .form-group:after {
clear: both;
}
.form-horizontal .form-group:before,
.form-horizontal .form-group:after {
display: table;
content: " ";
}
.form-horizontal .form-group:after {
clear: both;
}
.form-horizontal .form-group:before,
.form-horizontal .form-group:after {
display: table;
content: " ";
}
.form-horizontal .form-group:after {
clear: both;
}
.form-horizontal .form-group:before,
.form-horizontal .form-group:after {
display: table;
content: " ";
}
.form-horizontal .form-group:after {
clear: both;
}
.form-horizontal .form-control-static {
padding-top: 9px;
}
@media (min-width: 768px) {
.form-horizontal .control-label {
text-align: right;
}
}
.btn {
display: inline-block;
padding: 8px 12px;
margin-bottom: 0;
font-size: 15px;
font-weight: normal;
line-height: 1.428571429;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
.btn:focus {
outline: thin dotted #333;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
.btn:hover,
.btn:focus {
color: #ffffff;
text-decoration: none;
}
.btn:active,
.btn.active {
background-image: none;
outline: 0;
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
.btn.disabled,
.btn[disabled],
fieldset[disabled] .btn {
pointer-events: none;
cursor: not-allowed;
opacity: 0.65;
filter: alpha(opacity=65);
-webkit-box-shadow: none;
box-shadow: none;
}
.btn-default {
color: #ffffff;
background-color: #999999;
border-color: #999999;
}
.btn-default:hover,
.btn-default:focus,
.btn-default:active,
.btn-default.active,
.open .dropdown-toggle.btn-default {
color: #ffffff;
background-color: #858585;
border-color: #7a7a7a;
}
.btn-default:active,
.btn-default.active,
.open .dropdown-toggle.btn-default {
background-image: none;
}
.btn-default.disabled,
.btn-default[disabled],
fieldset[disabled] .btn-default,
.btn-default.disabled:hover,
.btn-default[disabled]:hover,
fieldset[disabled] .btn-default:hover,
.btn-default.disabled:focus,
.btn-default[disabled]:focus,
fieldset[disabled] .btn-default:focus,
.btn-default.disabled:active,
.btn-default[disabled]:active,
fieldset[disabled] .btn-default:active,
.btn-default.disabled.active,
.btn-default[disabled].active,
fieldset[disabled] .btn-default.active {
background-color: #999999;
border-color: #999999;
}
.btn-primary {
color: #ffffff;
background-color: #eb6864;
border-color: #eb6864;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.open .dropdown-toggle.btn-primary {
color: #ffffff;
background-color: #e64540;
border-color: #e4332e;
}
.btn-primary:active,
.btn-primary.active,
.open .dropdown-toggle.btn-primary {
background-image: none;
}
.btn-primary.disabled,
.btn-primary[disabled],
fieldset[disabled] .btn-primary,
.btn-primary.disabled:hover,
.btn-primary[disabled]:hover,
fieldset[disabled] .btn-primary:hover,
.btn-primary.disabled:focus,
.btn-primary[disabled]:focus,
fieldset[disabled] .btn-primary:focus,
.btn-primary.disabled:active,
.btn-primary[disabled]:active,
fieldset[disabled] .btn-primary:active,
.btn-primary.disabled.active,
.btn-primary[disabled].active,
fieldset[disabled] .btn-primary.active {
background-color: #eb6864;
border-color: #eb6864;
}
.btn-warning {
color: #ffffff;
background-color: #f5e625;
border-color: #f5e625;
}
.btn-warning:hover,
.btn-warning:focus,
.btn-warning:active,
.btn-warning.active,
.open .dropdown-toggle.btn-warning {
color: #ffffff;
background-color: #e7d70b;
border-color: #d3c50a;
}
.btn-warning:active,
.btn-warning.active,
.open .dropdown-toggle.btn-warning {
background-image: none;
}
.btn-warning.disabled,
.btn-warning[disabled],
fieldset[disabled] .btn-warning,
.btn-warning.disabled:hover,
.btn-warning[disabled]:hover,
fieldset[disabled] .btn-warning:hover,
.btn-warning.disabled:focus,
.btn-warning[disabled]:focus,
fieldset[disabled] .btn-warning:focus,
.btn-warning.disabled:active,
.btn-warning[disabled]:active,
fieldset[disabled] .btn-warning:active,
.btn-warning.disabled.active,
.btn-warning[disabled].active,
fieldset[disabled] .btn-warning.active {
background-color: #f5e625;
border-color: #f5e625;
}
.btn-danger {
color: #ffffff;
background-color: #f57a00;
border-color: #f57a00;
}
.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active,
.btn-danger.active,
.open .dropdown-toggle.btn-danger {
color: #ffffff;
background-color: #cc6600;
border-color: #b85c00;
}
.btn-danger:active,
.btn-danger.active,
.open .dropdown-toggle.btn-danger {
background-image: none;
}
.btn-danger.disabled,
.btn-danger[disabled],
fieldset[disabled] .btn-danger,
.btn-danger.disabled:hover,
.btn-danger[disabled]:hover,
fieldset[disabled] .btn-danger:hover,
.btn-danger.disabled:focus,
.btn-danger[disabled]:focus,
fieldset[disabled] .btn-danger:focus,
.btn-danger.disabled:active,
.btn-danger[disabled]:active,
fieldset[disabled] .btn-danger:active,
.btn-danger.disabled.active,
.btn-danger[disabled].active,
fieldset[disabled] .btn-danger.active {
background-color: #f57a00;
border-color: #f57a00;
}
.btn-success {
color: #ffffff;
background-color: #22b24c;
border-color: #22b24c;
}
.btn-success:hover,
.btn-success:focus,
.btn-success:active,
.btn-success.active,
.open .dropdown-toggle.btn-success {
color: #ffffff;
background-color: #1b903d;
border-color: #187f36;
}
.btn-success:active,
.btn-success.active,
.open .dropdown-toggle.btn-success {
background-image: none;
}
.btn-success.disabled,
.btn-success[disabled],
fieldset[disabled] .btn-success,
.btn-success.disabled:hover,
.btn-success[disabled]:hover,
fieldset[disabled] .btn-success:hover,
.btn-success.disabled:focus,
.btn-success[disabled]:focus,
fieldset[disabled] .btn-success:focus,
.btn-success.disabled:active,
.btn-success[disabled]:active,
fieldset[disabled] .btn-success:active,
.btn-success.disabled.active,
.btn-success[disabled].active,
fieldset[disabled] .btn-success.active {
background-color: #22b24c;
border-color: #22b24c;
}
.btn-info {
color: #ffffff;
background-color: #336699;
border-color: #336699;
}
.btn-info:hover,
.btn-info:focus,
.btn-info:active,
.btn-info.active,
.open .dropdown-toggle.btn-info {
color: #ffffff;
background-color: #29527a;
border-color: #24476b;
}
.btn-info:active,
.btn-info.active,
.open .dropdown-toggle.btn-info {
background-image: none;
}
.btn-info.disabled,
.btn-info[disabled],
fieldset[disabled] .btn-info,
.btn-info.disabled:hover,
.btn-info[disabled]:hover,
fieldset[disabled] .btn-info:hover,
.btn-info.disabled:focus,
.btn-info[disabled]:focus,
fieldset[disabled] .btn-info:focus,
.btn-info.disabled:active,
.btn-info[disabled]:active,
fieldset[disabled] .btn-info:active,
.btn-info.disabled.active,
.btn-info[disabled].active,
fieldset[disabled] .btn-info.active {
background-color: #336699;
border-color: #336699;
}
.btn-link {
font-weight: normal;
color: #eb6864;
cursor: pointer;
border-radius: 0;
}
.btn-link,
.btn-link:active,
.btn-link[disabled],
fieldset[disabled] .btn-link {
background-color: transparent;
-webkit-box-shadow: none;
box-shadow: none;
}
.btn-link,
.btn-link:hover,
.btn-link:focus,
.btn-link:active {
border-color: transparent;
}
.btn-link:hover,
.btn-link:focus {
color: #e22620;
text-decoration: underline;
background-color: transparent;
}
.btn-link[disabled]:hover,
fieldset[disabled] .btn-link:hover,
.btn-link[disabled]:focus,
fieldset[disabled] .btn-link:focus {
color: #999999;
text-decoration: none;
}
.btn-lg {
padding: 14px 16px;
font-size: 19px;
line-height: 1.33;
border-radius: 6px;
}
.btn-sm,
.btn-xs {
padding: 5px 10px;
font-size: 13px;
line-height: 1.5;
border-radius: 3px;
}
.btn-xs {
padding: 1px 5px;
}
.btn-block {
display: block;
width: 100%;
padding-right: 0;
padding-left: 0;
}
.btn-block + .btn-block {
margin-top: 5px;
}
input[type="submit"].btn-block,
input[type="reset"].btn-block,
input[type="button"].btn-block {
width: 100%;
}
.fade {
opacity: 0;
-webkit-transition: opacity 0.15s linear;
transition: opacity 0.15s linear;
}
.fade.in {
opacity: 1;
}
.collapse {
display: none;
}
.collapse.in {
display: block;
}
.collapsing {
position: relative;
height: 0;
overflow: hidden;
-webkit-transition: height 0.35s ease;
transition: height 0.35s ease;
}
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../fonts/glyphicons-halflings-regular.eot');
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
.glyphicon {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
-webkit-font-smoothing: antialiased;
font-style: normal;
font-weight: normal;
line-height: 1;
-moz-osx-font-smoothing: grayscale;
}
.glyphicon:empty {
width: 1em;
}
.glyphicon-asterisk:before {
content: "\2a";
}
.glyphicon-plus:before {
content: "\2b";
}
.glyphicon-euro:before {
content: "\20ac";
}
.glyphicon-minus:before {
content: "\2212";
}
.glyphicon-cloud:before {
content: "\2601";
}
.glyphicon-envelope:before {
content: "\2709";
}
.glyphicon-pencil:before {
content: "\270f";
}
.glyphicon-glass:before {
content: "\e001";
}
.glyphicon-music:before {
content: "\e002";
}
.glyphicon-search:before {
content: "\e003";
}
.glyphicon-heart:before {
content: "\e005";
}
.glyphicon-star:before {
content: "\e006";
}
.glyphicon-star-empty:before {
content: "\e007";
}
.glyphicon-user:before {
content: "\e008";
}
.glyphicon-film:before {
content: "\e009";
}
.glyphicon-th-large:before {
content: "\e010";
}
.glyphicon-th:before {
content: "\e011";
}
.glyphicon-th-list:before {
content: "\e012";
}
.glyphicon-ok:before {
content: "\e013";
}
.glyphicon-remove:before {
content: "\e014";
}
.glyphicon-zoom-in:before {
content: "\e015";
}
.glyphicon-zoom-out:before {
content: "\e016";
}
.glyphicon-off:before {
content: "\e017";
}
.glyphicon-signal:before {
content: "\e018";
}
.glyphicon-cog:before {
content: "\e019";
}
.glyphicon-trash:before {
content: "\e020";
}
.glyphicon-home:before {
content: "\e021";
}
.glyphicon-file:before {
content: "\e022";
}
.glyphicon-time:before {
content: "\e023";
}
.glyphicon-road:before {
content: "\e024";
}
.glyphicon-download-alt:before {
content: "\e025";
}
.glyphicon-download:before {
content: "\e026";
}
.glyphicon-upload:before {
content: "\e027";
}
.glyphicon-inbox:before {
content: "\e028";
}
.glyphicon-play-circle:before {
content: "\e029";
}
.glyphicon-repeat:before {
content: "\e030";
}
.glyphicon-refresh:before {
content: "\e031";
}
.glyphicon-list-alt:before {
content: "\e032";
}
.glyphicon-lock:before {
content: "\e033";
}
.glyphicon-flag:before {
content: "\e034";
}
.glyphicon-headphones:before {
content: "\e035";
}
.glyphicon-volume-off:before {
content: "\e036";
}
.glyphicon-volume-down:before {
content: "\e037";
}
.glyphicon-volume-up:before {
content: "\e038";
}
.glyphicon-qrcode:before {
content: "\e039";
}
.glyphicon-barcode:before {
content: "\e040";
}
.glyphicon-tag:before {
content: "\e041";
}
.glyphicon-tags:before {
content: "\e042";
}
.glyphicon-book:before {
content: "\e043";
}
.glyphicon-bookmark:before {
content: "\e044";
}
.glyphicon-print:before {
content: "\e045";
}
.glyphicon-camera:before {
content: "\e046";
}
.glyphicon-font:before {
content: "\e047";
}
.glyphicon-bold:before {
content: "\e048";
}
.glyphicon-italic:before {
content: "\e049";
}
.glyphicon-text-height:before {
content: "\e050";
}
.glyphicon-text-width:before {
content: "\e051";
}
.glyphicon-align-left:before {
content: "\e052";
}
.glyphicon-align-center:before {
content: "\e053";
}
.glyphicon-align-right:before {
content: "\e054";
}
.glyphicon-align-justify:before {
content: "\e055";
}
.glyphicon-list:before {
content: "\e056";
}
.glyphicon-indent-left:before {
content: "\e057";
}
.glyphicon-indent-right:before {
content: "\e058";
}
.glyphicon-facetime-video:before {
content: "\e059";
}
.glyphicon-picture:before {
content: "\e060";
}
.glyphicon-map-marker:before {
content: "\e062";
}
.glyphicon-adjust:before {
content: "\e063";
}
.glyphicon-tint:before {
content: "\e064";
}
.glyphicon-edit:before {
content: "\e065";
}
.glyphicon-share:before {
content: "\e066";
}
.glyphicon-check:before {
content: "\e067";
}
.glyphicon-move:before {
content: "\e068";
}
.glyphicon-step-backward:before {
content: "\e069";
}
.glyphicon-fast-backward:before {
content: "\e070";
}
.glyphicon-backward:before {
content: "\e071";
}
.glyphicon-play:before {
content: "\e072";
}
.glyphicon-pause:before {
content: "\e073";
}
.glyphicon-stop:before {
content: "\e074";
}
.glyphicon-forward:before {
content: "\e075";
}
.glyphicon-fast-forward:before {
content: "\e076";
}
.glyphicon-step-forward:before {
content: "\e077";
}
.glyphicon-eject:before {
content: "\e078";
}
.glyphicon-chevron-left:before {
content: "\e079";
}
.glyphicon-chevron-right:before {
content: "\e080";
}
.glyphicon-plus-sign:before {
content: "\e081";
}
.glyphicon-minus-sign:before {
content: "\e082";
}
.glyphicon-remove-sign:before {
content: "\e083";
}
.glyphicon-ok-sign:before {
content: "\e084";
}
.glyphicon-question-sign:before {
content: "\e085";
}
.glyphicon-info-sign:before {
content: "\e086";
}
.glyphicon-screenshot:before {
content: "\e087";
}
.glyphicon-remove-circle:before {
content: "\e088";
}
.glyphicon-ok-circle:before {
content: "\e089";
}
.glyphicon-ban-circle:before {
content: "\e090";
}
.glyphicon-arrow-left:before {
content: "\e091";
}
.glyphicon-arrow-right:before {
content: "\e092";
}
.glyphicon-arrow-up:before {
content: "\e093";
}
.glyphicon-arrow-down:before {
content: "\e094";
}
.glyphicon-share-alt:before {
content: "\e095";
}
.glyphicon-resize-full:before {
content: "\e096";
}
.glyphicon-resize-small:before {
content: "\e097";
}
.glyphicon-exclamation-sign:before {
content: "\e101";
}
.glyphicon-gift:before {
content: "\e102";
}
.glyphicon-leaf:before {
content: "\e103";
}
.glyphicon-fire:before {
content: "\e104";
}
.glyphicon-eye-open:before {
content: "\e105";
}
.glyphicon-eye-close:before {
content: "\e106";
}
.glyphicon-warning-sign:before {
content: "\e107";
}
.glyphicon-plane:before {
content: "\e108";
}
.glyphicon-calendar:before {
content: "\e109";
}
.glyphicon-random:before {
content: "\e110";
}
.glyphicon-comment:before {
content: "\e111";
}
.glyphicon-magnet:before {
content: "\e112";
}
.glyphicon-chevron-up:before {
content: "\e113";
}
.glyphicon-chevron-down:before {
content: "\e114";
}
.glyphicon-retweet:before {
content: "\e115";
}
.glyphicon-shopping-cart:before {
content: "\e116";
}
.glyphicon-folder-close:before {
content: "\e117";
}
.glyphicon-folder-open:before {
content: "\e118";
}
.glyphicon-resize-vertical:before {
content: "\e119";
}
.glyphicon-resize-horizontal:before {
content: "\e120";
}
.glyphicon-hdd:before {
content: "\e121";
}
.glyphicon-bullhorn:before {
content: "\e122";
}
.glyphicon-bell:before {
content: "\e123";
}
.glyphicon-certificate:before {
content: "\e124";
}
.glyphicon-thumbs-up:before {
content: "\e125";
}
.glyphicon-thumbs-down:before {
content: "\e126";
}
.glyphicon-hand-right:before {
content: "\e127";
}
.glyphicon-hand-left:before {
content: "\e128";
}
.glyphicon-hand-up:before {
content: "\e129";
}
.glyphicon-hand-down:before {
content: "\e130";
}
.glyphicon-circle-arrow-right:before {
content: "\e131";
}
.glyphicon-circle-arrow-left:before {
content: "\e132";
}
.glyphicon-circle-arrow-up:before {
content: "\e133";
}
.glyphicon-circle-arrow-down:before {
content: "\e134";
}
.glyphicon-globe:before {
content: "\e135";
}
.glyphicon-wrench:before {
content: "\e136";
}
.glyphicon-tasks:before {
content: "\e137";
}
.glyphicon-filter:before {
content: "\e138";
}
.glyphicon-briefcase:before {
content: "\e139";
}
.glyphicon-fullscreen:before {
content: "\e140";
}
.glyphicon-dashboard:before {
content: "\e141";
}
.glyphicon-paperclip:before {
content: "\e142";
}
.glyphicon-heart-empty:before {
content: "\e143";
}
.glyphicon-link:before {
content: "\e144";
}
.glyphicon-phone:before {
content: "\e145";
}
.glyphicon-pushpin:before {
content: "\e146";
}
.glyphicon-usd:before {
content: "\e148";
}
.glyphicon-gbp:before {
content: "\e149";
}
.glyphicon-sort:before {
content: "\e150";
}
.glyphicon-sort-by-alphabet:before {
content: "\e151";
}
.glyphicon-sort-by-alphabet-alt:before {
content: "\e152";
}
.glyphicon-sort-by-order:before {
content: "\e153";
}
.glyphicon-sort-by-order-alt:before {
content: "\e154";
}
.glyphicon-sort-by-attributes:before {
content: "\e155";
}
.glyphicon-sort-by-attributes-alt:before {
content: "\e156";
}
.glyphicon-unchecked:before {
content: "\e157";
}
.glyphicon-expand:before {
content: "\e158";
}
.glyphicon-collapse-down:before {
content: "\e159";
}
.glyphicon-collapse-up:before {
content: "\e160";
}
.glyphicon-log-in:before {
content: "\e161";
}
.glyphicon-flash:before {
content: "\e162";
}
.glyphicon-log-out:before {
content: "\e163";
}
.glyphicon-new-window:before {
content: "\e164";
}
.glyphicon-record:before {
content: "\e165";
}
.glyphicon-save:before {
content: "\e166";
}
.glyphicon-open:before {
content: "\e167";
}
.glyphicon-saved:before {
content: "\e168";
}
.glyphicon-import:before {
content: "\e169";
}
.glyphicon-export:before {
content: "\e170";
}
.glyphicon-send:before {
content: "\e171";
}
.glyphicon-floppy-disk:before {
content: "\e172";
}
.glyphicon-floppy-saved:before {
content: "\e173";
}
.glyphicon-floppy-remove:before {
content: "\e174";
}
.glyphicon-floppy-save:before {
content: "\e175";
}
.glyphicon-floppy-open:before {
content: "\e176";
}
.glyphicon-credit-card:before {
content: "\e177";
}
.glyphicon-transfer:before {
content: "\e178";
}
.glyphicon-cutlery:before {
content: "\e179";
}
.glyphicon-header:before {
content: "\e180";
}
.glyphicon-compressed:before {
content: "\e181";
}
.glyphicon-earphone:before {
content: "\e182";
}
.glyphicon-phone-alt:before {
content: "\e183";
}
.glyphicon-tower:before {
content: "\e184";
}
.glyphicon-stats:before {
content: "\e185";
}
.glyphicon-sd-video:before {
content: "\e186";
}
.glyphicon-hd-video:before {
content: "\e187";
}
.glyphicon-subtitles:before {
content: "\e188";
}
.glyphicon-sound-stereo:before {
content: "\e189";
}
.glyphicon-sound-dolby:before {
content: "\e190";
}
.glyphicon-sound-5-1:before {
content: "\e191";
}
.glyphicon-sound-6-1:before {
content: "\e192";
}
.glyphicon-sound-7-1:before {
content: "\e193";
}
.glyphicon-copyright-mark:before {
content: "\e194";
}
.glyphicon-registration-mark:before {
content: "\e195";
}
.glyphicon-cloud-download:before {
content: "\e197";
}
.glyphicon-cloud-upload:before {
content: "\e198";
}
.glyphicon-tree-conifer:before {
content: "\e199";
}
.glyphicon-tree-deciduous:before {
content: "\e200";
}
.caret {
display: inline-block;
width: 0;
height: 0;
margin-left: 2px;
vertical-align: middle;
border-top: 4px solid #000000;
border-right: 4px solid transparent;
border-bottom: 0 dotted;
border-left: 4px solid transparent;
}
.dropdown {
position: relative;
}
.dropdown-toggle:focus {
outline: 0;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
font-size: 15px;
list-style: none;
background-color: #ffffff;
border: 1px solid #cccccc;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
background-clip: padding-box;
}
.dropdown-menu.pull-right {
right: 0;
left: auto;
}
.dropdown-menu .divider {
height: 1px;
margin: 9.5px 0;
overflow: hidden;
background-color: #e5e5e5;
}
.dropdown-menu > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.428571429;
color: #333333;
white-space: nowrap;
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
color: #ffffff;
text-decoration: none;
background-color: #eb6864;
}
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
color: #ffffff;
text-decoration: none;
background-color: #eb6864;
outline: 0;
}
.dropdown-menu > .disabled > a,
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus {
color: #999999;
}
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus {
text-decoration: none;
cursor: not-allowed;
background-color: transparent;
background-image: none;
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.open > .dropdown-menu {
display: block;
}
.open > a {
outline: 0;
}
.dropdown-header {
display: block;
padding: 3px 20px;
font-size: 13px;
line-height: 1.428571429;
color: #999999;
}
.dropdown-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 990;
}
.pull-right > .dropdown-menu {
right: 0;
left: auto;
}
.dropup .caret,
.navbar-fixed-bottom .dropdown .caret {
border-top: 0 dotted;
border-bottom: 4px solid #000000;
content: "";
}
.dropup .dropdown-menu,
.navbar-fixed-bottom .dropdown .dropdown-menu {
top: auto;
bottom: 100%;
margin-bottom: 1px;
}
@media (min-width: 768px) {
.navbar-right .dropdown-menu {
right: 0;
left: auto;
}
}
.btn-default .caret {
border-top-color: #ffffff;
}
.btn-primary .caret,
.btn-success .caret,
.btn-warning .caret,
.btn-danger .caret,
.btn-info .caret {
border-top-color: #fff;
}
.dropup .btn-default .caret {
border-bottom-color: #ffffff;
}
.dropup .btn-primary .caret,
.dropup .btn-success .caret,
.dropup .btn-warning .caret,
.dropup .btn-danger .caret,
.dropup .btn-info .caret {
border-bottom-color: #fff;
}
.btn-group,
.btn-group-vertical {
position: relative;
display: inline-block;
vertical-align: middle;
}
.btn-group > .btn,
.btn-group-vertical > .btn {
position: relative;
float: left;
}
.btn-group > .btn:hover,
.btn-group-vertical > .btn:hover,
.btn-group > .btn:focus,
.btn-group-vertical > .btn:focus,
.btn-group > .btn:active,
.btn-group-vertical > .btn:active,
.btn-group > .btn.active,
.btn-group-vertical > .btn.active {
z-index: 2;
}
.btn-group > .btn:focus,
.btn-group-vertical > .btn:focus {
outline: none;
}
.btn-group .btn + .btn,
.btn-group .btn + .btn-group,
.btn-group .btn-group + .btn,
.btn-group .btn-group + .btn-group {
margin-left: -1px;
}
.btn-toolbar:before,
.btn-toolbar:after {
display: table;
content: " ";
}
.btn-toolbar:after {
clear: both;
}
.btn-toolbar:before,
.btn-toolbar:after {
display: table;
content: " ";
}
.btn-toolbar:after {
clear: both;
}
.btn-toolbar:before,
.btn-toolbar:after {
display: table;
content: " ";
}
.btn-toolbar:after {
clear: both;
}
.btn-toolbar:before,
.btn-toolbar:after {
display: table;
content: " ";
}
.btn-toolbar:after {
clear: both;
}
.btn-toolbar:before,
.btn-toolbar:after {
display: table;
content: " ";
}
.btn-toolbar:after {
clear: both;
}
.btn-toolbar .btn-group {
float: left;
}
.btn-toolbar > .btn + .btn,
.btn-toolbar > .btn-group + .btn,
.btn-toolbar > .btn + .btn-group,
.btn-toolbar > .btn-group + .btn-group {
margin-left: 5px;
}
.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
border-radius: 0;
}
.btn-group > .btn:first-child {
margin-left: 0;
}
.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.btn-group > .btn:last-child:not(:first-child),
.btn-group > .dropdown-toggle:not(:first-child) {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
.btn-group > .btn-group {
float: left;
}
.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0;
}
.btn-group > .btn-group:first-child > .btn:last-child,
.btn-group > .btn-group:first-child > .dropdown-toggle {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.btn-group > .btn-group:last-child > .btn:first-child {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
.btn-group .dropdown-toggle:active,
.btn-group.open .dropdown-toggle {
outline: 0;
}
.btn-group-xs > .btn {
padding: 5px 10px;
padding: 1px 5px;
font-size: 13px;
line-height: 1.5;
border-radius: 3px;
}
.btn-group-sm > .btn {
padding: 5px 10px;
font-size: 13px;
line-height: 1.5;
border-radius: 3px;
}
.btn-group-lg > .btn {
padding: 14px 16px;
font-size: 19px;
line-height: 1.33;
border-radius: 6px;
}
.btn-group > .btn + .dropdown-toggle {
padding-right: 8px;
padding-left: 8px;
}
.btn-group > .btn-lg + .dropdown-toggle {
padding-right: 12px;
padding-left: 12px;
}
.btn-group.open .dropdown-toggle {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
.btn-group.open .dropdown-toggle.btn-link {
-webkit-box-shadow: none;
box-shadow: none;
}
.btn .caret {
margin-left: 0;
}
.btn-lg .caret {
border-width: 5px 5px 0;
border-bottom-width: 0;
}
.dropup .btn-lg .caret {
border-width: 0 5px 5px;
}
.btn-group-vertical > .btn,
.btn-group-vertical > .btn-group {
display: block;
float: none;
width: 100%;
max-width: 100%;
}
.btn-group-vertical > .btn-group:before,
.btn-group-vertical > .btn-group:after {
display: table;
content: " ";
}
.btn-group-vertical > .btn-group:after {
clear: both;
}
.btn-group-vertical > .btn-group:before,
.btn-group-vertical > .btn-group:after {
display: table;
content: " ";
}
.btn-group-vertical > .btn-group:after {
clear: both;
}
.btn-group-vertical > .btn-group:before,
.btn-group-vertical > .btn-group:after {
display: table;
content: " ";
}
.btn-group-vertical > .btn-group:after {
clear: both;
}
.btn-group-vertical > .btn-group:before,
.btn-group-vertical > .btn-group:after {
display: table;
content: " ";
}
.btn-group-vertical > .btn-group:after {
clear: both;
}
.btn-group-vertical > .btn-group:before,
.btn-group-vertical > .btn-group:after {
display: table;
content: " ";
}
.btn-group-vertical > .btn-group:after {
clear: both;
}
.btn-group-vertical > .btn-group > .btn {
float: none;
}
.btn-group-vertical > .btn + .btn,
.btn-group-vertical > .btn + .btn-group,
.btn-group-vertical > .btn-group + .btn,
.btn-group-vertical > .btn-group + .btn-group {
margin-top: -1px;
margin-left: 0;
}
.btn-group-vertical > .btn:not(:first-child):not(:last-child) {
border-radius: 0;
}
.btn-group-vertical > .btn:first-child:not(:last-child) {
border-top-right-radius: 4px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.btn-group-vertical > .btn:last-child:not(:first-child) {
border-top-right-radius: 0;
border-bottom-left-radius: 4px;
border-top-left-radius: 0;
}
.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0;
}
.btn-group-vertical > .btn-group:first-child > .btn:last-child,
.btn-group-vertical > .btn-group:first-child > .dropdown-toggle {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.btn-group-vertical > .btn-group:last-child > .btn:first-child {
border-top-right-radius: 0;
border-top-left-radius: 0;
}
.btn-group-justified {
display: table;
width: 100%;
border-collapse: separate;
table-layout: fixed;
}
.btn-group-justified .btn {
display: table-cell;
float: none;
width: 1%;
}
[data-toggle="buttons"] > .btn > input[type="radio"],
[data-toggle="buttons"] > .btn > input[type="checkbox"] {
display: none;
}
.input-group {
position: relative;
display: table;
border-collapse: separate;
}
.input-group.col {
float: none;
padding-right: 0;
padding-left: 0;
}
.input-group .form-control {
width: 100%;
margin-bottom: 0;
}
.input-group-lg > .form-control,
.input-group-lg > .input-group-addon,
.input-group-lg > .input-group-btn > .btn {
height: 58px;
padding: 14px 16px;
font-size: 19px;
line-height: 1.33;
border-radius: 6px;
}
select.input-group-lg > .form-control,
select.input-group-lg > .input-group-addon,
select.input-group-lg > .input-group-btn > .btn {
height: 58px;
line-height: 58px;
}
textarea.input-group-lg > .form-control,
textarea.input-group-lg > .input-group-addon,
textarea.input-group-lg > .input-group-btn > .btn {
height: auto;
}
.input-group-sm > .form-control,
.input-group-sm > .input-group-addon,
.input-group-sm > .input-group-btn > .btn {
height: 31px;
padding: 5px 10px;
font-size: 13px;
line-height: 1.5;
border-radius: 3px;
}
select.input-group-sm > .form-control,
select.input-group-sm > .input-group-addon,
select.input-group-sm > .input-group-btn > .btn {
height: 31px;
line-height: 31px;
}
textarea.input-group-sm > .form-control,
textarea.input-group-sm > .input-group-addon,
textarea.input-group-sm > .input-group-btn > .btn {
height: auto;
}
.input-group-addon,
.input-group-btn,
.input-group .form-control {
display: table-cell;
}
.input-group-addon:not(:first-child):not(:last-child),
.input-group-btn:not(:first-child):not(:last-child),
.input-group .form-control:not(:first-child):not(:last-child) {
border-radius: 0;
}
.input-group-addon,
.input-group-btn {
width: 1%;
white-space: nowrap;
vertical-align: middle;
}
.input-group-addon {
padding: 8px 12px;
font-size: 15px;
font-weight: normal;
line-height: 1;
color: #777777;
text-align: center;
background-color: #eeeeee;
border: 1px solid #cccccc;
border-radius: 4px;
}
.input-group-addon.input-sm {
padding: 5px 10px;
font-size: 13px;
border-radius: 3px;
}
.input-group-addon.input-lg {
padding: 14px 16px;
font-size: 19px;
border-radius: 6px;
}
.input-group-addon input[type="radio"],
.input-group-addon input[type="checkbox"] {
margin-top: 0;
}
.input-group .form-control:first-child,
.input-group-addon:first-child,
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .dropdown-toggle,
.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.input-group-addon:first-child {
border-right: 0;
}
.input-group .form-control:last-child,
.input-group-addon:last-child,
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .dropdown-toggle,
.input-group-btn:first-child > .btn:not(:first-child) {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
.input-group-addon:last-child {
border-left: 0;
}
.input-group-btn {
position: relative;
white-space: nowrap;
}
.input-group-btn:first-child > .btn {
margin-right: -1px;
}
.input-group-btn:last-child > .btn {
margin-left: -1px;
}
.input-group-btn > .btn {
position: relative;
}
.input-group-btn > .btn + .btn {
margin-left: -4px;
}
.input-group-btn > .btn:hover,
.input-group-btn > .btn:active {
z-index: 2;
}
.nav {
padding-left: 0;
margin-bottom: 0;
list-style: none;
}
.nav:before,
.nav:after {
display: table;
content: " ";
}
.nav:after {
clear: both;
}
.nav:before,
.nav:after {
display: table;
content: " ";
}
.nav:after {
clear: both;
}
.nav:before,
.nav:after {
display: table;
content: " ";
}
.nav:after {
clear: both;
}
.nav:before,
.nav:after {
display: table;
content: " ";
}
.nav:after {
clear: both;
}
.nav:before,
.nav:after {
display: table;
content: " ";
}
.nav:after {
clear: both;
}
.nav > li {
position: relative;
display: block;
}
.nav > li > a {
position: relative;
display: block;
padding: 10px 15px;
}
.nav > li > a:hover,
.nav > li > a:focus {
text-decoration: none;
background-color: #eeeeee;
}
.nav > li.disabled > a {
color: #999999;
}
.nav > li.disabled > a:hover,
.nav > li.disabled > a:focus {
color: #999999;
text-decoration: none;
cursor: not-allowed;
background-color: transparent;
}
.nav .open > a,
.nav .open > a:hover,
.nav .open > a:focus {
background-color: #eeeeee;
border-color: #eb6864;
}
.nav .open > a .caret,
.nav .open > a:hover .caret,
.nav .open > a:focus .caret {
border-top-color: #e22620;
border-bottom-color: #e22620;
}
.nav .nav-divider {
height: 1px;
margin: 9.5px 0;
overflow: hidden;
background-color: #e5e5e5;
}
.nav > li > a > img {
max-width: none;
}
.nav-tabs {
border-bottom: 1px solid #dddddd;
}
.nav-tabs > li {
float: left;
margin-bottom: -1px;
}
.nav-tabs > li > a {
margin-right: 2px;
line-height: 1.428571429;
border: 1px solid transparent;
border-radius: 4px 4px 0 0;
}
.nav-tabs > li > a:hover {
border-color: #eeeeee #eeeeee #dddddd;
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
color: #777777;
cursor: default;
background-color: #ffffff;
border: 1px solid #dddddd;
border-bottom-color: transparent;
}
.nav-tabs.nav-justified {
width: 100%;
border-bottom: 0;
}
.nav-tabs.nav-justified > li {
float: none;
}
.nav-tabs.nav-justified > li > a {
margin-bottom: 5px;
text-align: center;
}
.nav-tabs.nav-justified > .dropdown .dropdown-menu {
top: auto;
left: auto;
}
@media (min-width: 768px) {
.nav-tabs.nav-justified > li {
display: table-cell;
width: 1%;
}
.nav-tabs.nav-justified > li > a {
margin-bottom: 0;
}
}
.nav-tabs.nav-justified > li > a {
margin-right: 0;
border-radius: 4px;
}
.nav-tabs.nav-justified > .active > a,
.nav-tabs.nav-justified > .active > a:hover,
.nav-tabs.nav-justified > .active > a:focus {
border: 1px solid #dddddd;
}
@media (min-width: 768px) {
.nav-tabs.nav-justified > li > a {
border-bottom: 1px solid #dddddd;
border-radius: 4px 4px 0 0;
}
.nav-tabs.nav-justified > .active > a,
.nav-tabs.nav-justified > .active > a:hover,
.nav-tabs.nav-justified > .active > a:focus {
border-bottom-color: #ffffff;
}
}
.nav-pills > li {
float: left;
}
.nav-pills > li > a {
border-radius: 4px;
}
.nav-pills > li + li {
margin-left: 2px;
}
.nav-pills > li.active > a,
.nav-pills > li.active > a:hover,
.nav-pills > li.active > a:focus {
color: #ffffff;
background-color: #eb6864;
}
.nav-pills > li.active > a .caret,
.nav-pills > li.active > a:hover .caret,
.nav-pills > li.active > a:focus .caret {
border-top-color: #ffffff;
border-bottom-color: #ffffff;
}
.nav-stacked > li {
float: none;
}
.nav-stacked > li + li {
margin-top: 2px;
margin-left: 0;
}
.nav-justified {
width: 100%;
}
.nav-justified > li {
float: none;
}
.nav-justified > li > a {
margin-bottom: 5px;
text-align: center;
}
.nav-justified > .dropdown .dropdown-menu {
top: auto;
left: auto;
}
@media (min-width: 768px) {
.nav-justified > li {
display: table-cell;
width: 1%;
}
.nav-justified > li > a {
margin-bottom: 0;
}
}
.nav-tabs-justified {
border-bottom: 0;
}
.nav-tabs-justified > li > a {
margin-right: 0;
border-radius: 4px;
}
.nav-tabs-justified > .active > a,
.nav-tabs-justified > .active > a:hover,
.nav-tabs-justified > .active > a:focus {
border: 1px solid #dddddd;
}
@media (min-width: 768px) {
.nav-tabs-justified > li > a {
border-bottom: 1px solid #dddddd;
border-radius: 4px 4px 0 0;
}
.nav-tabs-justified > .active > a,
.nav-tabs-justified > .active > a:hover,
.nav-tabs-justified > .active > a:focus {
border-bottom-color: #ffffff;
}
}
.tab-content > .tab-pane {
display: none;
}
.tab-content > .active {
display: block;
}
.nav .caret {
border-top-color: #eb6864;
border-bottom-color: #eb6864;
}
.nav a:hover .caret {
border-top-color: #e22620;
border-bottom-color: #e22620;
}
.nav-tabs .dropdown-menu {
margin-top: -1px;
border-top-right-radius: 0;
border-top-left-radius: 0;
}
.navbar {
position: relative;
min-height: 60px;
margin-bottom: 21px;
border: 1px solid transparent;
}
.navbar:before,
.navbar:after {
display: table;
content: " ";
}
.navbar:after {
clear: both;
}
.navbar:before,
.navbar:after {
display: table;
content: " ";
}
.navbar:after {
clear: both;
}
.navbar:before,
.navbar:after {
display: table;
content: " ";
}
.navbar:after {
clear: both;
}
.navbar:before,
.navbar:after {
display: table;
content: " ";
}
.navbar:after {
clear: both;
}
.navbar:before,
.navbar:after {
display: table;
content: " ";
}
.navbar:after {
clear: both;
}
@media (min-width: 768px) {
.navbar {
border-radius: 4px;
}
}
.navbar-header:before,
.navbar-header:after {
display: table;
content: " ";
}
.navbar-header:after {
clear: both;
}
.navbar-header:before,
.navbar-header:after {
display: table;
content: " ";
}
.navbar-header:after {
clear: both;
}
.navbar-header:before,
.navbar-header:after {
display: table;
content: " ";
}
.navbar-header:after {
clear: both;
}
.navbar-header:before,
.navbar-header:after {
display: table;
content: " ";
}
.navbar-header:after {
clear: both;
}
.navbar-header:before,
.navbar-header:after {
display: table;
content: " ";
}
.navbar-header:after {
clear: both;
}
@media (min-width: 768px) {
.navbar-header {
float: left;
}
}
.navbar-collapse {
max-height: 340px;
padding-right: 15px;
padding-left: 15px;
overflow-x: visible;
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
-webkit-overflow-scrolling: touch;
}
.navbar-collapse:before,
.navbar-collapse:after {
display: table;
content: " ";
}
.navbar-collapse:after {
clear: both;
}
.navbar-collapse:before,
.navbar-collapse:after {
display: table;
content: " ";
}
.navbar-collapse:after {
clear: both;
}
.navbar-collapse:before,
.navbar-collapse:after {
display: table;
content: " ";
}
.navbar-collapse:after {
clear: both;
}
.navbar-collapse:before,
.navbar-collapse:after {
display: table;
content: " ";
}
.navbar-collapse:after {
clear: both;
}
.navbar-collapse:before,
.navbar-collapse:after {
display: table;
content: " ";
}
.navbar-collapse:after {
clear: both;
}
.navbar-collapse.in {
overflow-y: auto;
}
@media (min-width: 768px) {
.navbar-collapse {
width: auto;
border-top: 0;
box-shadow: none;
}
.navbar-collapse.collapse {
display: block !important;
height: auto !important;
padding-bottom: 0;
overflow: visible !important;
}
.navbar-collapse.in {
overflow-y: auto;
}
.navbar-collapse .navbar-nav.navbar-left:first-child {
margin-left: -15px;
}
.navbar-collapse .navbar-nav.navbar-right:last-child {
margin-right: -15px;
}
.navbar-collapse .navbar-text:last-child {
margin-right: 0;
}
}
.container > .navbar-header,
.container > .navbar-collapse {
margin-right: -15px;
margin-left: -15px;
}
@media (min-width: 768px) {
.container > .navbar-header,
.container > .navbar-collapse {
margin-right: 0;
margin-left: 0;
}
}
.navbar-static-top {
z-index: 1000;
border-width: 0 0 1px;
}
@media (min-width: 768px) {
.navbar-static-top {
border-radius: 0;
}
}
.navbar-fixed-top,
.navbar-fixed-bottom {
position: fixed;
right: 0;
left: 0;
z-index: 1030;
}
@media (min-width: 768px) {
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-fixed-bottom {
bottom: 0;
margin-bottom: 0;
border-width: 1px 0 0;
}
.navbar-brand {
float: left;
padding: 19.5px 15px;
font-size: 19px;
line-height: 21px;
}
.navbar-brand:hover,
.navbar-brand:focus {
text-decoration: none;
}
@media (min-width: 768px) {
.navbar > .container .navbar-brand {
margin-left: -15px;
}
}
.navbar-toggle {
position: relative;
float: right;
padding: 9px 10px;
margin-top: 13px;
margin-right: 15px;
margin-bottom: 13px;
background-color: transparent;
border: 1px solid transparent;
border-radius: 4px;
}
.navbar-toggle .icon-bar {
display: block;
width: 22px;
height: 2px;
border-radius: 1px;
}
.navbar-toggle .icon-bar + .icon-bar {
margin-top: 4px;
}
@media (min-width: 768px) {
.navbar-toggle {
display: none;
}
}
.navbar-nav {
margin: 9.75px -15px;
}
.navbar-nav > li > a {
padding-top: 10px;
padding-bottom: 10px;
line-height: 21px;
}
@media (max-width: 767px) {
.navbar-nav .open .dropdown-menu {
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
box-shadow: none;
}
.navbar-nav .open .dropdown-menu > li > a,
.navbar-nav .open .dropdown-menu .dropdown-header {
padding: 5px 15px 5px 25px;
}
.navbar-nav .open .dropdown-menu > li > a {
line-height: 21px;
}
.navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-nav .open .dropdown-menu > li > a:focus {
background-image: none;
}
}
@media (min-width: 768px) {
.navbar-nav {
float: left;
margin: 0;
}
.navbar-nav > li {
float: left;
}
.navbar-nav > li > a {
padding-top: 19.5px;
padding-bottom: 19.5px;
}
}
@media (min-width: 768px) {
.navbar-left {
float: left !important;
}
.navbar-right {
float: right !important;
}
}
.navbar-form {
padding: 10px 15px;
margin-top: 10.5px;
margin-right: -15px;
margin-bottom: 10.5px;
margin-left: -15px;
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
}
@media (min-width: 768px) {
.navbar-form .form-group {
display: inline-block;
margin-bottom: 0;
vertical-align: middle;
}
.navbar-form .form-control {
display: inline-block;
}
.navbar-form .radio,
.navbar-form .checkbox {
display: inline-block;
padding-left: 0;
margin-top: 0;
margin-bottom: 0;
}
.navbar-form .radio input[type="radio"],
.navbar-form .checkbox input[type="checkbox"] {
float: none;
margin-left: 0;
}
}
@media (max-width: 767px) {
.navbar-form .form-group {
margin-bottom: 5px;
}
}
@media (min-width: 768px) {
.navbar-form {
width: auto;
padding-top: 0;
padding-bottom: 0;
margin-right: 0;
margin-left: 0;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
}
.navbar-nav > li > .dropdown-menu {
margin-top: 0;
border-top-right-radius: 0;
border-top-left-radius: 0;
}
.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.navbar-nav.pull-right > li > .dropdown-menu,
.navbar-nav > li > .dropdown-menu.pull-right {
right: 0;
left: auto;
}
.navbar-btn {
margin-top: 10.5px;
margin-bottom: 10.5px;
}
.navbar-text {
float: left;
margin-top: 19.5px;
margin-bottom: 19.5px;
}
@media (min-width: 768px) {
.navbar-text {
margin-right: 15px;
margin-left: 15px;
}
}
.navbar-default {
background-color: #ffffff;
border-color: #eeeeee;
}
.navbar-default .navbar-brand {
color: #000000;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: #000000;
background-color: #eeeeee;
}
.navbar-default .navbar-text {
color: #000000;
}
.navbar-default .navbar-nav > li > a {
color: #000000;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: #000000;
background-color: #eeeeee;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #000000;
background-color: #eeeeee;
}
.navbar-default .navbar-nav > .disabled > a,
.navbar-default .navbar-nav > .disabled > a:hover,
.navbar-default .navbar-nav > .disabled > a:focus {
color: #cccccc;
background-color: transparent;
}
.navbar-default .navbar-toggle {
border-color: #dddddd;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #dddddd;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #cccccc;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #eeeeee;
}
.navbar-default .navbar-nav > .dropdown > a:hover .caret,
.navbar-default .navbar-nav > .dropdown > a:focus .caret {
border-top-color: #000000;
border-bottom-color: #000000;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
color: #000000;
background-color: #eeeeee;
}
.navbar-default .navbar-nav > .open > a .caret,
.navbar-default .navbar-nav > .open > a:hover .caret,
.navbar-default .navbar-nav > .open > a:focus .caret {
border-top-color: #000000;
border-bottom-color: #000000;
}
.navbar-default .navbar-nav > .dropdown > a .caret {
border-top-color: #000000;
border-bottom-color: #000000;
}
@media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #000000;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #000000;
background-color: #eeeeee;
}
.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #000000;
background-color: #eeeeee;
}
.navbar-default .navbar-nav .open .dropdown-menu > .disabled > a,
.navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus {
color: #cccccc;
background-color: transparent;
}
}
.navbar-default .navbar-link {
color: #000000;
}
.navbar-default .navbar-link:hover {
color: #000000;
}
.navbar-inverse {
background-color: #eb6864;
border-color: #e53c37;
}
.navbar-inverse .navbar-brand {
color: #ffffff;
}
.navbar-inverse .navbar-brand:hover,
.navbar-inverse .navbar-brand:focus {
color: #ffffff;
background-color: #e74b47;
}
.navbar-inverse .navbar-text {
color: #ffffff;
}
.navbar-inverse .navbar-nav > li > a {
color: #ffffff;
}
.navbar-inverse .navbar-nav > li > a:hover,
.navbar-inverse .navbar-nav > li > a:focus {
color: #ffffff;
background-color: #e74b47;
}
.navbar-inverse .navbar-nav > .active > a,
.navbar-inverse .navbar-nav > .active > a:hover,
.navbar-inverse .navbar-nav > .active > a:focus {
color: #ffffff;
background-color: #e74b47;
}
.navbar-inverse .navbar-nav > .disabled > a,
.navbar-inverse .navbar-nav > .disabled > a:hover,
.navbar-inverse .navbar-nav > .disabled > a:focus {
color: #444444;
background-color: transparent;
}
.navbar-inverse .navbar-toggle {
border-color: #e53c37;
}
.navbar-inverse .navbar-toggle:hover,
.navbar-inverse .navbar-toggle:focus {
background-color: #e53c37;
}
.navbar-inverse .navbar-toggle .icon-bar {
background-color: #ffffff;
}
.navbar-inverse .navbar-collapse,
.navbar-inverse .navbar-form {
border-color: #e74944;
}
.navbar-inverse .navbar-nav > .open > a,
.navbar-inverse .navbar-nav > .open > a:hover,
.navbar-inverse .navbar-nav > .open > a:focus {
color: #ffffff;
background-color: #e74b47;
}
.navbar-inverse .navbar-nav > .dropdown > a:hover .caret {
border-top-color: #ffffff;
border-bottom-color: #ffffff;
}
.navbar-inverse .navbar-nav > .dropdown > a .caret {
border-top-color: #ffffff;
border-bottom-color: #ffffff;
}
.navbar-inverse .navbar-nav > .open > a .caret,
.navbar-inverse .navbar-nav > .open > a:hover .caret,
.navbar-inverse .navbar-nav > .open > a:focus .caret {
border-top-color: #ffffff;
border-bottom-color: #ffffff;
}
@media (max-width: 767px) {
.navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header {
border-color: #e53c37;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a {
color: #ffffff;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus {
color: #ffffff;
background-color: #e74b47;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > .active > a,
.navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #ffffff;
background-color: #e74b47;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a,
.navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus {
color: #444444;
background-color: transparent;
}
}
.navbar-inverse .navbar-link {
color: #ffffff;
}
.navbar-inverse .navbar-link:hover {
color: #ffffff;
}
.breadcrumb {
padding: 8px 15px;
margin-bottom: 21px;
list-style: none;
background-color: #f5f5f5;
border-radius: 4px;
}
.breadcrumb > li {
display: inline-block;
}
.breadcrumb > li + li:before {
padding: 0 5px;
color: #cccccc;
content: "/\00a0";
}
.breadcrumb > .active {
color: #999999;
}
.pagination {
display: inline-block;
padding-left: 0;
margin: 21px 0;
border-radius: 4px;
}
.pagination > li {
display: inline;
}
.pagination > li > a,
.pagination > li > span {
position: relative;
float: left;
padding: 8px 12px;
margin-left: -1px;
line-height: 1.428571429;
text-decoration: none;
background-color: #ffffff;
border: 1px solid #dddddd;
}
.pagination > li:first-child > a,
.pagination > li:first-child > span {
margin-left: 0;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
}
.pagination > li:last-child > a,
.pagination > li:last-child > span {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.pagination > li > a:hover,
.pagination > li > span:hover,
.pagination > li > a:focus,
.pagination > li > span:focus {
background-color: #eeeeee;
}
.pagination > .active > a,
.pagination > .active > span,
.pagination > .active > a:hover,
.pagination > .active > span:hover,
.pagination > .active > a:focus,
.pagination > .active > span:focus {
z-index: 2;
color: #999999;
cursor: default;
background-color: #f5f5f5;
border-color: #f5f5f5;
}
.pagination > .disabled > span,
.pagination > .disabled > span:hover,
.pagination > .disabled > span:focus,
.pagination > .disabled > a,
.pagination > .disabled > a:hover,
.pagination > .disabled > a:focus {
color: #999999;
cursor: not-allowed;
background-color: #ffffff;
border-color: #dddddd;
}
.pagination-lg > li > a,
.pagination-lg > li > span {
padding: 14px 16px;
font-size: 19px;
}
.pagination-lg > li:first-child > a,
.pagination-lg > li:first-child > span {
border-bottom-left-radius: 6px;
border-top-left-radius: 6px;
}
.pagination-lg > li:last-child > a,
.pagination-lg > li:last-child > span {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
.pagination-sm > li > a,
.pagination-sm > li > span {
padding: 5px 10px;
font-size: 13px;
}
.pagination-sm > li:first-child > a,
.pagination-sm > li:first-child > span {
border-bottom-left-radius: 3px;
border-top-left-radius: 3px;
}
.pagination-sm > li:last-child > a,
.pagination-sm > li:last-child > span {
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
.pager {
padding-left: 0;
margin: 21px 0;
text-align: center;
list-style: none;
}
.pager:before,
.pager:after {
display: table;
content: " ";
}
.pager:after {
clear: both;
}
.pager:before,
.pager:after {
display: table;
content: " ";
}
.pager:after {
clear: both;
}
.pager:before,
.pager:after {
display: table;
content: " ";
}
.pager:after {
clear: both;
}
.pager:before,
.pager:after {
display: table;
content: " ";
}
.pager:after {
clear: both;
}
.pager:before,
.pager:after {
display: table;
content: " ";
}
.pager:after {
clear: both;
}
.pager li {
display: inline;
}
.pager li > a,
.pager li > span {
display: inline-block;
padding: 5px 14px;
background-color: #ffffff;
border: 1px solid #dddddd;
border-radius: 15px;
}
.pager li > a:hover,
.pager li > a:focus {
text-decoration: none;
background-color: #eeeeee;
}
.pager .next > a,
.pager .next > span {
float: right;
}
.pager .previous > a,
.pager .previous > span {
float: left;
}
.pager .disabled > a,
.pager .disabled > a:hover,
.pager .disabled > a:focus,
.pager .disabled > span {
color: #999999;
cursor: not-allowed;
background-color: #ffffff;
}
.label {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: bold;
line-height: 1;
color: #ffffff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
}
.label[href]:hover,
.label[href]:focus {
color: #ffffff;
text-decoration: none;
cursor: pointer;
}
.label:empty {
display: none;
}
.label-default {
background-color: #999999;
}
.label-default[href]:hover,
.label-default[href]:focus {
background-color: #808080;
}
.label-primary {
background-color: #eb6864;
}
.label-primary[href]:hover,
.label-primary[href]:focus {
background-color: #e53c37;
}
.label-success {
background-color: #22b24c;
}
.label-success[href]:hover,
.label-success[href]:focus {
background-color: #1a873a;
}
.label-info {
background-color: #336699;
}
.label-info[href]:hover,
.label-info[href]:focus {
background-color: #264c73;
}
.label-warning {
background-color: #f5e625;
}
.label-warning[href]:hover,
.label-warning[href]:focus {
background-color: #ddce0a;
}
.label-danger {
background-color: #f57a00;
}
.label-danger[href]:hover,
.label-danger[href]:focus {
background-color: #c26100;
}
.badge {
display: inline-block;
min-width: 10px;
padding: 3px 7px;
font-size: 13px;
font-weight: bold;
line-height: 1;
color: #ffffff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
background-color: #999999;
border-radius: 10px;
}
.badge:empty {
display: none;
}
a.badge:hover,
a.badge:focus {
color: #ffffff;
text-decoration: none;
cursor: pointer;
}
.btn .badge {
position: relative;
top: -1px;
}
a.list-group-item.active > .badge,
.nav-pills > .active > a > .badge {
color: #eb6864;
background-color: #ffffff;
}
.nav-pills > li > a > .badge {
margin-left: 3px;
}
.jumbotron {
padding: 30px;
margin-bottom: 30px;
font-size: 23px;
font-weight: 200;
line-height: 2.1428571435;
color: inherit;
background-color: #eeeeee;
}
.jumbotron h1 {
line-height: 1;
color: inherit;
}
.jumbotron p {
line-height: 1.4;
}
.container .jumbotron {
border-radius: 6px;
}
@media screen and (min-width: 768px) {
.jumbotron {
padding-top: 48px;
padding-bottom: 48px;
}
.container .jumbotron {
padding-right: 60px;
padding-left: 60px;
}
.jumbotron h1 {
font-size: 67.5px;
}
}
.thumbnail {
display: inline-block;
display: block;
height: auto;
max-width: 100%;
padding: 4px;
margin-bottom: 21px;
line-height: 1.428571429;
background-color: #ffffff;
border: 1px solid #dddddd;
border-radius: 4px;
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.thumbnail > img {
display: block;
height: auto;
max-width: 100%;
margin-right: auto;
margin-left: auto;
}
a.thumbnail:hover,
a.thumbnail:focus,
a.thumbnail.active {
border-color: #eb6864;
}
.thumbnail .caption {
padding: 9px;
color: #777777;
}
.alert {
padding: 15px;
margin-bottom: 21px;
border: 1px solid transparent;
border-radius: 4px;
}
.alert h4 {
margin-top: 0;
color: inherit;
}
.alert .alert-link {
font-weight: bold;
}
.alert > p,
.alert > ul {
margin-bottom: 0;
}
.alert > p + p {
margin-top: 5px;
}
.alert-dismissable {
padding-right: 35px;
}
.alert-dismissable .close {
position: relative;
top: -2px;
right: -21px;
color: inherit;
}
.alert-success {
color: #468847;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.alert-success hr {
border-top-color: #c9e2b3;
}
.alert-success .alert-link {
color: #356635;
}
.alert-info {
color: #3a87ad;
background-color: #d9edf7;
border-color: #bce8f1;
}
.alert-info hr {
border-top-color: #a6e1ec;
}
.alert-info .alert-link {
color: #2d6987;
}
.alert-warning {
color: #c09853;
background-color: #fcf8e3;
border-color: #fbeed5;
}
.alert-warning hr {
border-top-color: #f8e5be;
}
.alert-warning .alert-link {
color: #a47e3c;
}
.alert-danger {
color: #b94a48;
background-color: #f2dede;
border-color: #eed3d7;
}
.alert-danger hr {
border-top-color: #e6c1c7;
}
.alert-danger .alert-link {
color: #953b39;
}
@-webkit-keyframes progress-bar-stripes {
from {
background-position: 40px 0;
}
to {
background-position: 0 0;
}
}
@-moz-keyframes progress-bar-stripes {
from {
background-position: 40px 0;
}
to {
background-position: 0 0;
}
}
@-o-keyframes progress-bar-stripes {
from {
background-position: 0 0;
}
to {
background-position: 40px 0;
}
}
@keyframes progress-bar-stripes {
from {
background-position: 40px 0;
}
to {
background-position: 0 0;
}
}
.progress {
height: 21px;
margin-bottom: 21px;
overflow: hidden;
background-color: #f5f5f5;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}
.progress-bar {
float: left;
width: 0;
height: 100%;
font-size: 13px;
line-height: 21px;
color: #ffffff;
text-align: center;
background-color: #eb6864;
-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
-webkit-transition: width 0.6s ease;
transition: width 0.6s ease;
}
.progress-striped .progress-bar {
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-size: 40px 40px;
}
.progress.active .progress-bar {
-webkit-animation: progress-bar-stripes 2s linear infinite;
animation: progress-bar-stripes 2s linear infinite;
}
.progress-bar-success {
background-color: #22b24c;
}
.progress-striped .progress-bar-success {
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.progress-bar-info {
background-color: #336699;
}
.progress-striped .progress-bar-info {
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.progress-bar-warning {
background-color: #f5e625;
}
.progress-striped .progress-bar-warning {
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.progress-bar-danger {
background-color: #f57a00;
}
.progress-striped .progress-bar-danger {
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.media,
.media-body {
overflow: hidden;
zoom: 1;
}
.media,
.media .media {
margin-top: 15px;
}
.media:first-child {
margin-top: 0;
}
.media-object {
display: block;
}
.media-heading {
margin: 0 0 5px;
}
.media > .pull-left {
margin-right: 10px;
}
.media > .pull-right {
margin-left: 10px;
}
.media-list {
padding-left: 0;
list-style: none;
}
.list-group {
padding-left: 0;
margin-bottom: 20px;
}
.list-group-item {
position: relative;
display: block;
padding: 10px 15px;
margin-bottom: -1px;
background-color: #ffffff;
border: 1px solid #dddddd;
}
.list-group-item:first-child {
border-top-right-radius: 4px;
border-top-left-radius: 4px;
}
.list-group-item:last-child {
margin-bottom: 0;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
}
.list-group-item > .badge {
float: right;
}
.list-group-item > .badge + .badge {
margin-right: 5px;
}
a.list-group-item {
color: #555555;
}
a.list-group-item .list-group-item-heading {
color: #333333;
}
a.list-group-item:hover,
a.list-group-item:focus {
text-decoration: none;
background-color: #f5f5f5;
}
a.list-group-item.active,
a.list-group-item.active:hover,
a.list-group-item.active:focus {
z-index: 2;
color: #ffffff;
background-color: #eb6864;
border-color: #eb6864;
}
a.list-group-item.active .list-group-item-heading,
a.list-group-item.active:hover .list-group-item-heading,
a.list-group-item.active:focus .list-group-item-heading {
color: inherit;
}
a.list-group-item.active .list-group-item-text,
a.list-group-item.active:hover .list-group-item-text,
a.list-group-item.active:focus .list-group-item-text {
color: #ffffff;
}
.list-group-item-heading {
margin-top: 0;
margin-bottom: 5px;
}
.list-group-item-text {
margin-bottom: 0;
line-height: 1.3;
}
.panel {
margin-bottom: 21px;
background-color: #ffffff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}
.panel-body {
padding: 15px;
}
.panel-body:before,
.panel-body:after {
display: table;
content: " ";
}
.panel-body:after {
clear: both;
}
.panel-body:before,
.panel-body:after {
display: table;
content: " ";
}
.panel-body:after {
clear: both;
}
.panel-body:before,
.panel-body:after {
display: table;
content: " ";
}
.panel-body:after {
clear: both;
}
.panel-body:before,
.panel-body:after {
display: table;
content: " ";
}
.panel-body:after {
clear: both;
}
.panel-body:before,
.panel-body:after {
display: table;
content: " ";
}
.panel-body:after {
clear: both;
}
.panel > .list-group {
margin-bottom: 0;
}
.panel > .list-group .list-group-item {
border-width: 1px 0;
}
.panel > .list-group .list-group-item:first-child {
border-top-right-radius: 0;
border-top-left-radius: 0;
}
.panel > .list-group .list-group-item:last-child {
border-bottom: 0;
}
.panel-heading + .list-group .list-group-item:first-child {
border-top-width: 0;
}
.panel > .table,
.panel > .table-responsive {
margin-bottom: 0;
}
.panel > .panel-body + .table,
.panel > .panel-body + .table-responsive {
border-top: 1px solid #dddddd;
}
.panel > .table-bordered,
.panel > .table-responsive > .table-bordered {
border: 0;
}
.panel > .table-bordered > thead > tr > th:first-child,
.panel > .table-responsive > .table-bordered > thead > tr > th:first-child,
.panel > .table-bordered > tbody > tr > th:first-child,
.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child,
.panel > .table-bordered > tfoot > tr > th:first-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child,
.panel > .table-bordered > thead > tr > td:first-child,
.panel > .table-responsive > .table-bordered > thead > tr > td:first-child,
.panel > .table-bordered > tbody > tr > td:first-child,
.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child,
.panel > .table-bordered > tfoot > tr > td:first-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child {
border-left: 0;
}
.panel > .table-bordered > thead > tr > th:last-child,
.panel > .table-responsive > .table-bordered > thead > tr > th:last-child,
.panel > .table-bordered > tbody > tr > th:last-child,
.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child,
.panel > .table-bordered > tfoot > tr > th:last-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child,
.panel > .table-bordered > thead > tr > td:last-child,
.panel > .table-responsive > .table-bordered > thead > tr > td:last-child,
.panel > .table-bordered > tbody > tr > td:last-child,
.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child,
.panel > .table-bordered > tfoot > tr > td:last-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child {
border-right: 0;
}
.panel > .table-bordered > thead > tr:last-child > th,
.panel > .table-responsive > .table-bordered > thead > tr:last-child > th,
.panel > .table-bordered > tbody > tr:last-child > th,
.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th,
.panel > .table-bordered > tfoot > tr:last-child > th,
.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th,
.panel > .table-bordered > thead > tr:last-child > td,
.panel > .table-responsive > .table-bordered > thead > tr:last-child > td,
.panel > .table-bordered > tbody > tr:last-child > td,
.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td,
.panel > .table-bordered > tfoot > tr:last-child > td,
.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td {
border-bottom: 0;
}
.panel-heading {
padding: 10px 15px;
border-bottom: 1px solid transparent;
border-top-right-radius: 3px;
border-top-left-radius: 3px;
}
.panel-heading > .dropdown .dropdown-toggle {
color: inherit;
}
.panel-title {
margin-top: 0;
margin-bottom: 0;
font-size: 17px;
}
.panel-title > a {
color: inherit;
}
.panel-footer {
padding: 10px 15px;
background-color: #f5f5f5;
border-top: 1px solid #dddddd;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
}
.panel-group .panel {
margin-bottom: 0;
overflow: hidden;
border-radius: 4px;
}
.panel-group .panel + .panel {
margin-top: 5px;
}
.panel-group .panel-heading {
border-bottom: 0;
}
.panel-group .panel-heading + .panel-collapse .panel-body {
border-top: 1px solid #dddddd;
}
.panel-group .panel-footer {
border-top: 0;
}
.panel-group .panel-footer + .panel-collapse .panel-body {
border-bottom: 1px solid #dddddd;
}
.panel-default {
border-color: #dddddd;
}
.panel-default > .panel-heading {
color: #777777;
background-color: #f5f5f5;
border-color: #dddddd;
}
.panel-default > .panel-heading + .panel-collapse .panel-body {
border-top-color: #dddddd;
}
.panel-default > .panel-heading > .dropdown .caret {
border-color: #777777 transparent;
}
.panel-default > .panel-footer + .panel-collapse .panel-body {
border-bottom-color: #dddddd;
}
.panel-primary {
border-color: #eb6864;
}
.panel-primary > .panel-heading {
color: #ffffff;
background-color: #eb6864;
border-color: #eb6864;
}
.panel-primary > .panel-heading + .panel-collapse .panel-body {
border-top-color: #eb6864;
}
.panel-primary > .panel-heading > .dropdown .caret {
border-color: #ffffff transparent;
}
.panel-primary > .panel-footer + .panel-collapse .panel-body {
border-bottom-color: #eb6864;
}
.panel-success {
border-color: #22b24c;
}
.panel-success > .panel-heading {
color: #468847;
background-color: #22b24c;
border-color: #22b24c;
}
.panel-success > .panel-heading + .panel-collapse .panel-body {
border-top-color: #22b24c;
}
.panel-success > .panel-heading > .dropdown .caret {
border-color: #468847 transparent;
}
.panel-success > .panel-footer + .panel-collapse .panel-body {
border-bottom-color: #22b24c;
}
.panel-warning {
border-color: #f5e625;
}
.panel-warning > .panel-heading {
color: #c09853;
background-color: #f5e625;
border-color: #f5e625;
}
.panel-warning > .panel-heading + .panel-collapse .panel-body {
border-top-color: #f5e625;
}
.panel-warning > .panel-heading > .dropdown .caret {
border-color: #c09853 transparent;
}
.panel-warning > .panel-footer + .panel-collapse .panel-body {
border-bottom-color: #f5e625;
}
.panel-danger {
border-color: #f57a00;
}
.panel-danger > .panel-heading {
color: #b94a48;
background-color: #f57a00;
border-color: #f57a00;
}
.panel-danger > .panel-heading + .panel-collapse .panel-body {
border-top-color: #f57a00;
}
.panel-danger > .panel-heading > .dropdown .caret {
border-color: #b94a48 transparent;
}
.panel-danger > .panel-footer + .panel-collapse .panel-body {
border-bottom-color: #f57a00;
}
.panel-info {
border-color: #336699;
}
.panel-info > .panel-heading {
color: #3a87ad;
background-color: #336699;
border-color: #336699;
}
.panel-info > .panel-heading + .panel-collapse .panel-body {
border-top-color: #336699;
}
.panel-info > .panel-heading > .dropdown .caret {
border-color: #3a87ad transparent;
}
.panel-info > .panel-footer + .panel-collapse .panel-body {
border-bottom-color: #336699;
}
.well {
min-height: 20px;
padding: 19px;
margin-bottom: 20px;
background-color: #f5f5f5;
border: 1px solid #e3e3e3;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
}
.well blockquote {
border-color: #ddd;
border-color: rgba(0, 0, 0, 0.15);
}
.well-lg {
padding: 24px;
border-radius: 6px;
}
.well-sm {
padding: 9px;
border-radius: 3px;
}
.close {
float: right;
font-size: 22.5px;
font-weight: bold;
line-height: 1;
color: #000000;
text-shadow: 0 1px 0 #ffffff;
opacity: 0.2;
filter: alpha(opacity=20);
}
.close:hover,
.close:focus {
color: #000000;
text-decoration: none;
cursor: pointer;
opacity: 0.5;
filter: alpha(opacity=50);
}
button.close {
padding: 0;
cursor: pointer;
background: transparent;
border: 0;
-webkit-appearance: none;
}
.modal-open {
overflow: hidden;
}
.modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1040;
display: none;
overflow: auto;
overflow-y: scroll;
}
.modal.fade .modal-dialog {
-webkit-transform: translate(0, -25%);
-ms-transform: translate(0, -25%);
transform: translate(0, -25%);
-webkit-transition: -webkit-transform 0.3s ease-out;
-moz-transition: -moz-transform 0.3s ease-out;
-o-transition: -o-transform 0.3s ease-out;
transition: transform 0.3s ease-out;
}
.modal.in .modal-dialog {
-webkit-transform: translate(0, 0);
-ms-transform: translate(0, 0);
transform: translate(0, 0);
}
.modal-dialog {
position: relative;
z-index: 1050;
width: auto;
padding: 10px;
margin-right: auto;
margin-left: auto;
}
.modal-content {
position: relative;
background-color: #ffffff;
border: 1px solid #999999;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
outline: none;
-webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
background-clip: padding-box;
}
.modal-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1030;
background-color: #000000;
}
.modal-backdrop.fade {
opacity: 0;
filter: alpha(opacity=0);
}
.modal-backdrop.in {
opacity: 0.5;
filter: alpha(opacity=50);
}
.modal-header {
min-height: 16.428571429px;
padding: 15px;
border-bottom: 1px solid #e5e5e5;
}
.modal-header .close {
margin-top: -2px;
}
.modal-title {
margin: 0;
line-height: 1.428571429;
}
.modal-body {
position: relative;
padding: 20px;
}
.modal-footer {
padding: 19px 20px 20px;
margin-top: 15px;
text-align: right;
border-top: 1px solid #e5e5e5;
}
.modal-footer:before,
.modal-footer:after {
display: table;
content: " ";
}
.modal-footer:after {
clear: both;
}
.modal-footer:before,
.modal-footer:after {
display: table;
content: " ";
}
.modal-footer:after {
clear: both;
}
.modal-footer:before,
.modal-footer:after {
display: table;
content: " ";
}
.modal-footer:after {
clear: both;
}
.modal-footer:before,
.modal-footer:after {
display: table;
content: " ";
}
.modal-footer:after {
clear: both;
}
.modal-footer:before,
.modal-footer:after {
display: table;
content: " ";
}
.modal-footer:after {
clear: both;
}
.modal-footer .btn + .btn {
margin-bottom: 0;
margin-left: 5px;
}
.modal-footer .btn-group .btn + .btn {
margin-left: -1px;
}
.modal-footer .btn-block + .btn-block {
margin-left: 0;
}
@media screen and (min-width: 768px) {
.modal-dialog {
width: 600px;
padding-top: 30px;
padding-bottom: 30px;
}
.modal-content {
-webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}
}
.tooltip {
position: absolute;
z-index: 1030;
display: block;
font-size: 13px;
line-height: 1.4;
opacity: 0;
filter: alpha(opacity=0);
visibility: visible;
}
.tooltip.in {
opacity: 0.9;
filter: alpha(opacity=90);
}
.tooltip.top {
padding: 5px 0;
margin-top: -3px;
}
.tooltip.right {
padding: 0 5px;
margin-left: 3px;
}
.tooltip.bottom {
padding: 5px 0;
margin-top: 3px;
}
.tooltip.left {
padding: 0 5px;
margin-left: -3px;
}
.tooltip-inner {
max-width: 200px;
padding: 3px 8px;
color: #ffffff;
text-align: center;
text-decoration: none;
background-color: rgba(0, 0, 0, 0.9);
border-radius: 4px;
}
.tooltip-arrow {
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
.tooltip.top .tooltip-arrow {
bottom: 0;
left: 50%;
margin-left: -5px;
border-top-color: rgba(0, 0, 0, 0.9);
border-width: 5px 5px 0;
}
.tooltip.top-left .tooltip-arrow {
bottom: 0;
left: 5px;
border-top-color: rgba(0, 0, 0, 0.9);
border-width: 5px 5px 0;
}
.tooltip.top-right .tooltip-arrow {
right: 5px;
bottom: 0;
border-top-color: rgba(0, 0, 0, 0.9);
border-width: 5px 5px 0;
}
.tooltip.right .tooltip-arrow {
top: 50%;
left: 0;
margin-top: -5px;
border-right-color: rgba(0, 0, 0, 0.9);
border-width: 5px 5px 5px 0;
}
.tooltip.left .tooltip-arrow {
top: 50%;
right: 0;
margin-top: -5px;
border-left-color: rgba(0, 0, 0, 0.9);
border-width: 5px 0 5px 5px;
}
.tooltip.bottom .tooltip-arrow {
top: 0;
left: 50%;
margin-left: -5px;
border-bottom-color: rgba(0, 0, 0, 0.9);
border-width: 0 5px 5px;
}
.tooltip.bottom-left .tooltip-arrow {
top: 0;
left: 5px;
border-bottom-color: rgba(0, 0, 0, 0.9);
border-width: 0 5px 5px;
}
.tooltip.bottom-right .tooltip-arrow {
top: 0;
right: 5px;
border-bottom-color: rgba(0, 0, 0, 0.9);
border-width: 0 5px 5px;
}
.popover {
position: absolute;
top: 0;
left: 0;
z-index: 1010;
display: none;
max-width: 276px;
padding: 1px;
text-align: left;
white-space: normal;
background-color: #ffffff;
border: 1px solid #cccccc;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
background-clip: padding-box;
}
.popover.top {
margin-top: -10px;
}
.popover.right {
margin-left: 10px;
}
.popover.bottom {
margin-top: 10px;
}
.popover.left {
margin-left: -10px;
}
.popover-title {
padding: 8px 14px;
margin: 0;
font-size: 15px;
font-weight: normal;
line-height: 18px;
background-color: #f7f7f7;
border-bottom: 1px solid #ebebeb;
border-radius: 5px 5px 0 0;
}
.popover-content {
padding: 9px 14px;
}
.popover .arrow,
.popover .arrow:after {
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
.popover .arrow {
border-width: 11px;
}
.popover .arrow:after {
border-width: 10px;
content: "";
}
.popover.top .arrow {
bottom: -11px;
left: 50%;
margin-left: -11px;
border-top-color: #999999;
border-top-color: rgba(0, 0, 0, 0.25);
border-bottom-width: 0;
}
.popover.top .arrow:after {
bottom: 1px;
margin-left: -10px;
border-top-color: #ffffff;
border-bottom-width: 0;
content: " ";
}
.popover.right .arrow {
top: 50%;
left: -11px;
margin-top: -11px;
border-right-color: #999999;
border-right-color: rgba(0, 0, 0, 0.25);
border-left-width: 0;
}
.popover.right .arrow:after {
bottom: -10px;
left: 1px;
border-right-color: #ffffff;
border-left-width: 0;
content: " ";
}
.popover.bottom .arrow {
top: -11px;
left: 50%;
margin-left: -11px;
border-bottom-color: #999999;
border-bottom-color: rgba(0, 0, 0, 0.25);
border-top-width: 0;
}
.popover.bottom .arrow:after {
top: 1px;
margin-left: -10px;
border-bottom-color: #ffffff;
border-top-width: 0;
content: " ";
}
.popover.left .arrow {
top: 50%;
right: -11px;
margin-top: -11px;
border-left-color: #999999;
border-left-color: rgba(0, 0, 0, 0.25);
border-right-width: 0;
}
.popover.left .arrow:after {
right: 1px;
bottom: -10px;
border-left-color: #ffffff;
border-right-width: 0;
content: " ";
}
.carousel {
position: relative;
}
.carousel-inner {
position: relative;
width: 100%;
overflow: hidden;
}
.carousel-inner > .item {
position: relative;
display: none;
-webkit-transition: 0.6s ease-in-out left;
transition: 0.6s ease-in-out left;
}
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
display: block;
height: auto;
max-width: 100%;
line-height: 1;
}
.carousel-inner > .active,
.carousel-inner > .next,
.carousel-inner > .prev {
display: block;
}
.carousel-inner > .active {
left: 0;
}
.carousel-inner > .next,
.carousel-inner > .prev {
position: absolute;
top: 0;
width: 100%;
}
.carousel-inner > .next {
left: 100%;
}
.carousel-inner > .prev {
left: -100%;
}
.carousel-inner > .next.left,
.carousel-inner > .prev.right {
left: 0;
}
.carousel-inner > .active.left {
left: -100%;
}
.carousel-inner > .active.right {
left: 100%;
}
.carousel-control {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 15%;
font-size: 20px;
color: #ffffff;
text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
opacity: 0.5;
filter: alpha(opacity=50);
}
.carousel-control.left {
background-image: -webkit-gradient(linear, 0 top, 100% top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0.0001)));
background-image: -webkit-linear-gradient(left, color-stop(rgba(0, 0, 0, 0.5) 0), color-stop(rgba(0, 0, 0, 0.0001) 100%));
background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.5) 0, rgba(0, 0, 0, 0.0001) 100%);
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5) 0, rgba(0, 0, 0, 0.0001) 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);
}
.carousel-control.right {
right: 0;
left: auto;
background-image: -webkit-gradient(linear, 0 top, 100% top, from(rgba(0, 0, 0, 0.0001)), to(rgba(0, 0, 0, 0.5)));
background-image: -webkit-linear-gradient(left, color-stop(rgba(0, 0, 0, 0.0001) 0), color-stop(rgba(0, 0, 0, 0.5) 100%));
background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0, rgba(0, 0, 0, 0.5) 100%);
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.0001) 0, rgba(0, 0, 0, 0.5) 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);
}
.carousel-control:hover,
.carousel-control:focus {
color: #ffffff;
text-decoration: none;
opacity: 0.9;
filter: alpha(opacity=90);
}
.carousel-control .icon-prev,
.carousel-control .icon-next,
.carousel-control .glyphicon-chevron-left,
.carousel-control .glyphicon-chevron-right {
position: absolute;
top: 50%;
z-index: 5;
display: inline-block;
}
.carousel-control .icon-prev,
.carousel-control .glyphicon-chevron-left {
left: 50%;
}
.carousel-control .icon-next,
.carousel-control .glyphicon-chevron-right {
right: 50%;
}
.carousel-control .icon-prev,
.carousel-control .icon-next {
width: 20px;
height: 20px;
margin-top: -10px;
margin-left: -10px;
font-family: serif;
}
.carousel-control .icon-prev:before {
content: '\2039';
}
.carousel-control .icon-next:before {
content: '\203a';
}
.carousel-indicators {
position: absolute;
bottom: 10px;
left: 50%;
z-index: 15;
width: 60%;
padding-left: 0;
margin-left: -30%;
text-align: center;
list-style: none;
}
.carousel-indicators li {
display: inline-block;
width: 10px;
height: 10px;
margin: 1px;
text-indent: -999px;
cursor: pointer;
background-color: #000 \9;
background-color: rgba(0, 0, 0, 0);
border: 1px solid #ffffff;
border-radius: 10px;
}
.carousel-indicators .active {
width: 12px;
height: 12px;
margin: 0;
background-color: #ffffff;
}
.carousel-caption {
position: absolute;
right: 15%;
bottom: 20px;
left: 15%;
z-index: 10;
padding-top: 20px;
padding-bottom: 20px;
color: #ffffff;
text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.carousel-caption .btn {
text-shadow: none;
}
@media screen and (min-width: 768px) {
.carousel-control .glyphicons-chevron-left,
.carousel-control .glyphicons-chevron-right,
.carousel-control .icon-prev,
.carousel-control .icon-next {
width: 30px;
height: 30px;
margin-top: -15px;
margin-left: -15px;
font-size: 30px;
}
.carousel-caption {
right: 20%;
left: 20%;
padding-bottom: 30px;
}
.carousel-indicators {
bottom: 20px;
}
}
.clearfix:before,
.clearfix:after {
display: table;
content: " ";
}
.clearfix:after {
clear: both;
}
.clearfix:before,
.clearfix:after {
display: table;
content: " ";
}
.clearfix:after {
clear: both;
}
.center-block {
display: block;
margin-right: auto;
margin-left: auto;
}
.pull-right {
float: right !important;
}
.pull-left {
float: left !important;
}
.hide {
display: none !important;
}
.show {
display: block !important;
}
.invisible {
visibility: hidden;
}
.text-hide {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.hidden {
display: none !important;
visibility: hidden !important;
}
.affix {
position: fixed;
}
@-ms-viewport {
width: device-width;
}
.visible-xs,
tr.visible-xs,
th.visible-xs,
td.visible-xs {
display: none !important;
}
@media (max-width: 767px) {
.visible-xs {
display: block !important;
}
tr.visible-xs {
display: table-row !important;
}
th.visible-xs,
td.visible-xs {
display: table-cell !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-xs.visible-sm {
display: block !important;
}
tr.visible-xs.visible-sm {
display: table-row !important;
}
th.visible-xs.visible-sm,
td.visible-xs.visible-sm {
display: table-cell !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-xs.visible-md {
display: block !important;
}
tr.visible-xs.visible-md {
display: table-row !important;
}
th.visible-xs.visible-md,
td.visible-xs.visible-md {
display: table-cell !important;
}
}
@media (min-width: 1200px) {
.visible-xs.visible-lg {
display: block !important;
}
tr.visible-xs.visible-lg {
display: table-row !important;
}
th.visible-xs.visible-lg,
td.visible-xs.visible-lg {
display: table-cell !important;
}
}
.visible-sm,
tr.visible-sm,
th.visible-sm,
td.visible-sm {
display: none !important;
}
@media (max-width: 767px) {
.visible-sm.visible-xs {
display: block !important;
}
tr.visible-sm.visible-xs {
display: table-row !important;
}
th.visible-sm.visible-xs,
td.visible-sm.visible-xs {
display: table-cell !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm {
display: block !important;
}
tr.visible-sm {
display: table-row !important;
}
th.visible-sm,
td.visible-sm {
display: table-cell !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-sm.visible-md {
display: block !important;
}
tr.visible-sm.visible-md {
display: table-row !important;
}
th.visible-sm.visible-md,
td.visible-sm.visible-md {
display: table-cell !important;
}
}
@media (min-width: 1200px) {
.visible-sm.visible-lg {
display: block !important;
}
tr.visible-sm.visible-lg {
display: table-row !important;
}
th.visible-sm.visible-lg,
td.visible-sm.visible-lg {
display: table-cell !important;
}
}
.visible-md,
tr.visible-md,
th.visible-md,
td.visible-md {
display: none !important;
}
@media (max-width: 767px) {
.visible-md.visible-xs {
display: block !important;
}
tr.visible-md.visible-xs {
display: table-row !important;
}
th.visible-md.visible-xs,
td.visible-md.visible-xs {
display: table-cell !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-md.visible-sm {
display: block !important;
}
tr.visible-md.visible-sm {
display: table-row !important;
}
th.visible-md.visible-sm,
td.visible-md.visible-sm {
display: table-cell !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md {
display: block !important;
}
tr.visible-md {
display: table-row !important;
}
th.visible-md,
td.visible-md {
display: table-cell !important;
}
}
@media (min-width: 1200px) {
.visible-md.visible-lg {
display: block !important;
}
tr.visible-md.visible-lg {
display: table-row !important;
}
th.visible-md.visible-lg,
td.visible-md.visible-lg {
display: table-cell !important;
}
}
.visible-lg,
tr.visible-lg,
th.visible-lg,
td.visible-lg {
display: none !important;
}
@media (max-width: 767px) {
.visible-lg.visible-xs {
display: block !important;
}
tr.visible-lg.visible-xs {
display: table-row !important;
}
th.visible-lg.visible-xs,
td.visible-lg.visible-xs {
display: table-cell !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-lg.visible-sm {
display: block !important;
}
tr.visible-lg.visible-sm {
display: table-row !important;
}
th.visible-lg.visible-sm,
td.visible-lg.visible-sm {
display: table-cell !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-lg.visible-md {
display: block !important;
}
tr.visible-lg.visible-md {
display: table-row !important;
}
th.visible-lg.visible-md,
td.visible-lg.visible-md {
display: table-cell !important;
}
}
@media (min-width: 1200px) {
.visible-lg {
display: block !important;
}
tr.visible-lg {
display: table-row !important;
}
th.visible-lg,
td.visible-lg {
display: table-cell !important;
}
}
.hidden-xs {
display: block !important;
}
tr.hidden-xs {
display: table-row !important;
}
th.hidden-xs,
td.hidden-xs {
display: table-cell !important;
}
@media (max-width: 767px) {
.hidden-xs,
tr.hidden-xs,
th.hidden-xs,
td.hidden-xs {
display: none !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.hidden-xs.hidden-sm,
tr.hidden-xs.hidden-sm,
th.hidden-xs.hidden-sm,
td.hidden-xs.hidden-sm {
display: none !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.hidden-xs.hidden-md,
tr.hidden-xs.hidden-md,
th.hidden-xs.hidden-md,
td.hidden-xs.hidden-md {
display: none !important;
}
}
@media (min-width: 1200px) {
.hidden-xs.hidden-lg,
tr.hidden-xs.hidden-lg,
th.hidden-xs.hidden-lg,
td.hidden-xs.hidden-lg {
display: none !important;
}
}
.hidden-sm {
display: block !important;
}
tr.hidden-sm {
display: table-row !important;
}
th.hidden-sm,
td.hidden-sm {
display: table-cell !important;
}
@media (max-width: 767px) {
.hidden-sm.hidden-xs,
tr.hidden-sm.hidden-xs,
th.hidden-sm.hidden-xs,
td.hidden-sm.hidden-xs {
display: none !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.hidden-sm,
tr.hidden-sm,
th.hidden-sm,
td.hidden-sm {
display: none !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.hidden-sm.hidden-md,
tr.hidden-sm.hidden-md,
th.hidden-sm.hidden-md,
td.hidden-sm.hidden-md {
display: none !important;
}
}
@media (min-width: 1200px) {
.hidden-sm.hidden-lg,
tr.hidden-sm.hidden-lg,
th.hidden-sm.hidden-lg,
td.hidden-sm.hidden-lg {
display: none !important;
}
}
.hidden-md {
display: block !important;
}
tr.hidden-md {
display: table-row !important;
}
th.hidden-md,
td.hidden-md {
display: table-cell !important;
}
@media (max-width: 767px) {
.hidden-md.hidden-xs,
tr.hidden-md.hidden-xs,
th.hidden-md.hidden-xs,
td.hidden-md.hidden-xs {
display: none !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.hidden-md.hidden-sm,
tr.hidden-md.hidden-sm,
th.hidden-md.hidden-sm,
td.hidden-md.hidden-sm {
display: none !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.hidden-md,
tr.hidden-md,
th.hidden-md,
td.hidden-md {
display: none !important;
}
}
@media (min-width: 1200px) {
.hidden-md.hidden-lg,
tr.hidden-md.hidden-lg,
th.hidden-md.hidden-lg,
td.hidden-md.hidden-lg {
display: none !important;
}
}
.hidden-lg {
display: block !important;
}
tr.hidden-lg {
display: table-row !important;
}
th.hidden-lg,
td.hidden-lg {
display: table-cell !important;
}
@media (max-width: 767px) {
.hidden-lg.hidden-xs,
tr.hidden-lg.hidden-xs,
th.hidden-lg.hidden-xs,
td.hidden-lg.hidden-xs {
display: none !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.hidden-lg.hidden-sm,
tr.hidden-lg.hidden-sm,
th.hidden-lg.hidden-sm,
td.hidden-lg.hidden-sm {
display: none !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.hidden-lg.hidden-md,
tr.hidden-lg.hidden-md,
th.hidden-lg.hidden-md,
td.hidden-lg.hidden-md {
display: none !important;
}
}
@media (min-width: 1200px) {
.hidden-lg,
tr.hidden-lg,
th.hidden-lg,
td.hidden-lg {
display: none !important;
}
}
.visible-print,
tr.visible-print,
th.visible-print,
td.visible-print {
display: none !important;
}
@media print {
.visible-print {
display: block !important;
}
tr.visible-print {
display: table-row !important;
}
th.visible-print,
td.visible-print {
display: table-cell !important;
}
.hidden-print,
tr.hidden-print,
th.hidden-print,
td.hidden-print {
display: none !important;
}
}
.navbar {
font-family: "News Cycle", "Arial Narrow Bold", sans-serif;
font-size: 18px;
font-weight: 700;
}
.navbar-brand {
font-size: 18px;
font-weight: 700;
text-transform: uppercase;
}
.has-warning .help-block,
.has-warning .control-label {
color: #f57a00;
}
.has-warning .form-control,
.has-warning .form-control:focus {
border-color: #f57a00;
}
.has-error .help-block,
.has-error .control-label {
color: #eb6864;
}
.has-error .form-control,
.has-error .form-control:focus {
border-color: #eb6864;
}
.has-success .help-block,
.has-success .control-label {
color: #22b24c;
}
.has-success .form-control,
.has-success .form-control:focus {
border-color: #22b24c;
}
.pagination .active > a,
.pagination .active > a:hover {
border-color: #ddd;
}
.jumbotron h1,
.jumbotron h2,
.jumbotron h3,
.jumbotron h4,
.jumbotron h5,
.jumbotron h6 {
font-family: "News Cycle", "Arial Narrow Bold", sans-serif;
font-weight: 700;
color: #000;
}
.panel-primary .panel-title,
.panel-success .panel-title,
.panel-warning .panel-title,
.panel-danger .panel-title,
.panel-info .panel-title {
color: #fff;
}
.clearfix:before,
.clearfix:after {
display: table;
content: " ";
}
.clearfix:after {
clear: both;
}
.clearfix:before,
.clearfix:after {
display: table;
content: " ";
}
.clearfix:after {
clear: both;
}
.center-block {
display: block;
margin-right: auto;
margin-left: auto;
}
.pull-right {
float: right !important;
}
.pull-left {
float: left !important;
}
.hide {
display: none !important;
}
.show {
display: block !important;
}
.invisible {
visibility: hidden;
}
.text-hide {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.hidden {
display: none !important;
visibility: hidden !important;
}
.affix {
position: fixed;
}
.top-space {
margin-top: 45px;
}
|
BitcoinMafia/identicoin
|
public/css/bootstrap.css
|
CSS
|
mit
| 133,225 | 16.485891 | 318 | 0.642237 | false |
Copyright 2013 Romens Team
http://romens.ru/
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.
|
RomensTeam/Remus
|
LICENSE.md
|
Markdown
|
mit
| 1,089 | 49.952381 | 70 | 0.790634 | false |
#include <gtest/gtest.h>
#include "loquat/misc/binary_search.hpp"
TEST(BinarySearchTest, Integer){
for(int l = -16; l <= 16; ++l){
for(int r = l; r <= 16; ++r){
for(int expect = l; expect <= r; ++expect){
const auto actual = loquat::binary_search(
l, r, [=](int x){ return x < expect; });
EXPECT_EQ(expect, actual);
}
}
}
}
TEST(BinarySearchTest, Floating){
for(int li = -16; li <= 16; ++li){
for(int ri = li; ri <= li; ++ri){
const double l = li * 1.1, r = ri * 1.1;
for(double expect = l; expect < r; expect += 0.2){
const auto actual = loquat::binary_search(
l, r, [=](double x){ return x < expect; });
EXPECT_DOUBLE_EQ(expect, actual);
}
const auto min_actual = loquat::binary_search(
l, r, [=](double){ return true; });
EXPECT_DOUBLE_EQ(l, min_actual);
const auto max_actual = loquat::binary_search(
l, r, [=](double){ return false; });
EXPECT_DOUBLE_EQ(r, max_actual);
}
}
}
|
logicmachine/loquat
|
test/misc/binary_search_test.cpp
|
C++
|
mit
| 957 | 27.147059 | 53 | 0.574713 | false |
"""
``editquality generate_make -h``
::
Code-generate Makefile from template and configuration
:Usage:
generate_make -h | --help
generate_make
[--config=<path>]
[--main=<filename>]
[--output=<path>]
[--templates=<path>]
[--debug]
:Options:
--config=<path> Directory to search for configuration files
[default: config/]
--main=<filename> Override to use a main template other than the
default [default: Makefile.j2]
--output=<path> Where to write the Makefile output.
[default: <stdout>]
--templates=<path> Directory to search for input templates.
[default: templates/]
--debug Print debug logging
"""
# TODO:
# * make API calls to learn things
# * ores/config has dict merge
# * survey dependency solvers
# https://github.com/ninja-build/ninja/wiki/List-of-generators-producing-ninja-build-files
# ** Still considering: scons, doit, drake, ninja, meson
# ** Don't like so far: waf
# * Where can we store information about samples?
# Original population rates; how we've distorted them.
import logging
import os.path
import sys
import docopt
from .. import config
from ..codegen import generate
logger = logging.getLogger(__name__)
def main(argv=None):
args = docopt.docopt(__doc__, argv=argv)
logging.basicConfig(
level=logging.DEBUG if args['--debug'] else logging.WARNING,
format='%(asctime)s %(levelname)s:%(name)s -- %(message)s'
)
config_path = args["--config"]
output_f = sys.stdout \
if args["--output"] == "<stdout>" \
else open(args["--output"], "w")
templates_path = args["--templates"]
main_template_path = args["--main"]
if not os.path.isabs(main_template_path):
# Join a filename to the default templates dir.
main_template_path = os.path.join(templates_path, main_template_path)
with open(main_template_path, "r") as f:
main_template = f.read()
variables = config.load_config(config_path)
output = generate.generate(variables, templates_path, main_template)
output_f.write(output)
|
wiki-ai/editquality
|
editquality/utilities/generate_make.py
|
Python
|
mit
| 2,362 | 30.078947 | 90 | 0.582557 | false |
/**
* Reverb for the OpenAL cross platform audio library
* Copyright (C) 2008-2009 by Christopher Fitzgerald.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
* Or go to http://www.gnu.org/copyleft/lgpl.html
*/
#include "config.h"
#include <math.h>
#include <stdlib.h>
#include "AL/al.h"
#include "AL/alc.h"
#include "alMain.h"
#include "alAuxEffectSlot.h"
#include "alEffect.h"
#include "alError.h"
#include "alu.h"
typedef struct DelayLine
{
// The delay lines use sample lengths that are powers of 2 to allow
// bitmasking instead of modulus wrapping.
ALuint Mask;
ALfloat *Line;
} DelayLine;
typedef struct ALverbState {
// Must be first in all effects!
ALeffectState state;
// All delay lines are allocated as a single buffer to reduce memory
// fragmentation and management code.
ALfloat *SampleBuffer;
// Master effect low-pass filter (2 chained 1-pole filters).
FILTER LpFilter;
ALfloat LpHistory[2];
// Initial effect delay and decorrelation.
DelayLine Delay;
// The tap points for the initial delay. First tap goes to early
// reflections, the last four decorrelate to late reverb.
ALuint Tap[5];
struct {
// Total gain for early reflections.
ALfloat Gain;
// Early reflections are done with 4 delay lines.
ALfloat Coeff[4];
DelayLine Delay[4];
ALuint Offset[4];
// The gain for each output channel based on 3D panning.
ALfloat PanGain[OUTPUTCHANNELS];
} Early;
struct {
// Total gain for late reverb.
ALfloat Gain;
// Attenuation to compensate for modal density and decay rate.
ALfloat DensityGain;
// The feed-back and feed-forward all-pass coefficient.
ALfloat ApFeedCoeff;
// Mixing matrix coefficient.
ALfloat MixCoeff;
// Late reverb has 4 parallel all-pass filters.
ALfloat ApCoeff[4];
DelayLine ApDelay[4];
ALuint ApOffset[4];
// In addition to 4 cyclical delay lines.
ALfloat Coeff[4];
DelayLine Delay[4];
ALuint Offset[4];
// The cyclical delay lines are 1-pole low-pass filtered.
ALfloat LpCoeff[4];
ALfloat LpSample[4];
// The gain for each output channel based on 3D panning.
ALfloat PanGain[OUTPUTCHANNELS];
} Late;
// The current read offset for all delay lines.
ALuint Offset;
} ALverbState;
// All delay line lengths are specified in seconds.
// The lengths of the early delay lines.
static const ALfloat EARLY_LINE_LENGTH[4] =
{
0.0015f, 0.0045f, 0.0135f, 0.0405f
};
// The lengths of the late all-pass delay lines.
static const ALfloat ALLPASS_LINE_LENGTH[4] =
{
0.0151f, 0.0167f, 0.0183f, 0.0200f,
};
// The lengths of the late cyclical delay lines.
static const ALfloat LATE_LINE_LENGTH[4] =
{
0.0211f, 0.0311f, 0.0461f, 0.0680f
};
// The late cyclical delay lines have a variable length dependent on the
// effect's density parameter (inverted for some reason) and this multiplier.
static const ALfloat LATE_LINE_MULTIPLIER = 4.0f;
// Input into the late reverb is decorrelated between four channels. Their
// timings are dependent on a fraction and multiplier. See VerbUpdate() for
// the calculations involved.
static const ALfloat DECO_FRACTION = 1.0f / 32.0f;
static const ALfloat DECO_MULTIPLIER = 2.0f;
// The maximum length of initial delay for the master delay line (a sum of
// the maximum early reflection and late reverb delays).
static const ALfloat MASTER_LINE_LENGTH = 0.3f + 0.1f;
// Find the next power of 2. Actually, this will return the input value if
// it is already a power of 2.
static ALuint NextPowerOf2(ALuint value)
{
ALuint powerOf2 = 1;
if(value)
{
value--;
while(value)
{
value >>= 1;
powerOf2 <<= 1;
}
}
return powerOf2;
}
// Basic delay line input/output routines.
static __inline ALfloat DelayLineOut(DelayLine *Delay, ALuint offset)
{
return Delay->Line[offset&Delay->Mask];
}
static __inline ALvoid DelayLineIn(DelayLine *Delay, ALuint offset, ALfloat in)
{
Delay->Line[offset&Delay->Mask] = in;
}
// Delay line output routine for early reflections.
static __inline ALfloat EarlyDelayLineOut(ALverbState *State, ALuint index)
{
return State->Early.Coeff[index] *
DelayLineOut(&State->Early.Delay[index],
State->Offset - State->Early.Offset[index]);
}
// Given an input sample, this function produces stereo output for early
// reflections.
static __inline ALvoid EarlyReflection(ALverbState *State, ALfloat in, ALfloat *out)
{
ALfloat d[4], v, f[4];
// Obtain the decayed results of each early delay line.
d[0] = EarlyDelayLineOut(State, 0);
d[1] = EarlyDelayLineOut(State, 1);
d[2] = EarlyDelayLineOut(State, 2);
d[3] = EarlyDelayLineOut(State, 3);
/* The following uses a lossless scattering junction from waveguide
* theory. It actually amounts to a householder mixing matrix, which
* will produce a maximally diffuse response, and means this can probably
* be considered a simple feedback delay network (FDN).
* N
* ---
* \
* v = 2/N / d_i
* ---
* i=1
*/
v = (d[0] + d[1] + d[2] + d[3]) * 0.5f;
// The junction is loaded with the input here.
v += in;
// Calculate the feed values for the delay lines.
f[0] = v - d[0];
f[1] = v - d[1];
f[2] = v - d[2];
f[3] = v - d[3];
// Refeed the delay lines.
DelayLineIn(&State->Early.Delay[0], State->Offset, f[0]);
DelayLineIn(&State->Early.Delay[1], State->Offset, f[1]);
DelayLineIn(&State->Early.Delay[2], State->Offset, f[2]);
DelayLineIn(&State->Early.Delay[3], State->Offset, f[3]);
// Output the results of the junction for all four lines.
out[0] = State->Early.Gain * f[0];
out[1] = State->Early.Gain * f[1];
out[2] = State->Early.Gain * f[2];
out[3] = State->Early.Gain * f[3];
}
// All-pass input/output routine for late reverb.
static __inline ALfloat LateAllPassInOut(ALverbState *State, ALuint index, ALfloat in)
{
ALfloat out;
out = State->Late.ApCoeff[index] *
DelayLineOut(&State->Late.ApDelay[index],
State->Offset - State->Late.ApOffset[index]);
out -= (State->Late.ApFeedCoeff * in);
DelayLineIn(&State->Late.ApDelay[index], State->Offset,
(State->Late.ApFeedCoeff * out) + in);
return out;
}
// Delay line output routine for late reverb.
static __inline ALfloat LateDelayLineOut(ALverbState *State, ALuint index)
{
return State->Late.Coeff[index] *
DelayLineOut(&State->Late.Delay[index],
State->Offset - State->Late.Offset[index]);
}
// Low-pass filter input/output routine for late reverb.
static __inline ALfloat LateLowPassInOut(ALverbState *State, ALuint index, ALfloat in)
{
State->Late.LpSample[index] = in +
((State->Late.LpSample[index] - in) * State->Late.LpCoeff[index]);
return State->Late.LpSample[index];
}
// Given four decorrelated input samples, this function produces stereo
// output for late reverb.
static __inline ALvoid LateReverb(ALverbState *State, ALfloat *in, ALfloat *out)
{
ALfloat d[4], f[4];
// Obtain the decayed results of the cyclical delay lines, and add the
// corresponding input channels attenuated by density. Then pass the
// results through the low-pass filters.
d[0] = LateLowPassInOut(State, 0, (State->Late.DensityGain * in[0]) +
LateDelayLineOut(State, 0));
d[1] = LateLowPassInOut(State, 1, (State->Late.DensityGain * in[1]) +
LateDelayLineOut(State, 1));
d[2] = LateLowPassInOut(State, 2, (State->Late.DensityGain * in[2]) +
LateDelayLineOut(State, 2));
d[3] = LateLowPassInOut(State, 3, (State->Late.DensityGain * in[3]) +
LateDelayLineOut(State, 3));
// To help increase diffusion, run each line through an all-pass filter.
// The order of the all-pass filters is selected so that the shortest
// all-pass filter will feed the shortest delay line.
d[0] = LateAllPassInOut(State, 1, d[0]);
d[1] = LateAllPassInOut(State, 3, d[1]);
d[2] = LateAllPassInOut(State, 0, d[2]);
d[3] = LateAllPassInOut(State, 2, d[3]);
/* Late reverb is done with a modified feedback delay network (FDN)
* topology. Four input lines are each fed through their own all-pass
* filter and then into the mixing matrix. The four outputs of the
* mixing matrix are then cycled back to the inputs. Each output feeds
* a different input to form a circlular feed cycle.
*
* The mixing matrix used is a 4D skew-symmetric rotation matrix derived
* using a single unitary rotational parameter:
*
* [ d, a, b, c ] 1 = a^2 + b^2 + c^2 + d^2
* [ -a, d, c, -b ]
* [ -b, -c, d, a ]
* [ -c, b, -a, d ]
*
* The rotation is constructed from the effect's diffusion parameter,
* yielding: 1 = x^2 + 3 y^2; where a, b, and c are the coefficient y
* with differing signs, and d is the coefficient x. The matrix is thus:
*
* [ x, y, -y, y ] x = 1 - (0.5 diffusion^3)
* [ -y, x, y, y ] y = sqrt((1 - x^2) / 3)
* [ y, -y, x, y ]
* [ -y, -y, -y, x ]
*
* To reduce the number of multiplies, the x coefficient is applied with
* the cyclical delay line coefficients. Thus only the y coefficient is
* applied when mixing, and is modified to be: y / x.
*/
f[0] = d[0] + (State->Late.MixCoeff * ( d[1] - d[2] + d[3]));
f[1] = d[1] + (State->Late.MixCoeff * (-d[0] + d[2] + d[3]));
f[2] = d[2] + (State->Late.MixCoeff * ( d[0] - d[1] + d[3]));
f[3] = d[3] + (State->Late.MixCoeff * (-d[0] - d[1] - d[2]));
// Output the results of the matrix for all four cyclical delay lines,
// attenuated by the late reverb gain (which is attenuated by the 'x'
// mix coefficient).
out[0] = State->Late.Gain * f[0];
out[1] = State->Late.Gain * f[1];
out[2] = State->Late.Gain * f[2];
out[3] = State->Late.Gain * f[3];
// The delay lines are fed circularly in the order:
// 0 -> 1 -> 3 -> 2 -> 0 ...
DelayLineIn(&State->Late.Delay[0], State->Offset, f[2]);
DelayLineIn(&State->Late.Delay[1], State->Offset, f[0]);
DelayLineIn(&State->Late.Delay[2], State->Offset, f[3]);
DelayLineIn(&State->Late.Delay[3], State->Offset, f[1]);
}
// Process the reverb for a given input sample, resulting in separate four-
// channel output for both early reflections and late reverb.
static __inline ALvoid ReverbInOut(ALverbState *State, ALfloat in, ALfloat *early, ALfloat *late)
{
ALfloat taps[4];
// Low-pass filter the incoming sample.
in = lpFilter2P(&State->LpFilter, 0, in);
// Feed the initial delay line.
DelayLineIn(&State->Delay, State->Offset, in);
// Calculate the early reflection from the first delay tap.
in = DelayLineOut(&State->Delay, State->Offset - State->Tap[0]);
EarlyReflection(State, in, early);
// Calculate the late reverb from the last four delay taps.
taps[0] = DelayLineOut(&State->Delay, State->Offset - State->Tap[1]);
taps[1] = DelayLineOut(&State->Delay, State->Offset - State->Tap[2]);
taps[2] = DelayLineOut(&State->Delay, State->Offset - State->Tap[3]);
taps[3] = DelayLineOut(&State->Delay, State->Offset - State->Tap[4]);
LateReverb(State, taps, late);
// Step all delays forward one sample.
State->Offset++;
}
// This destroys the reverb state. It should be called only when the effect
// slot has a different (or no) effect loaded over the reverb effect.
ALvoid VerbDestroy(ALeffectState *effect)
{
ALverbState *State = (ALverbState*)effect;
if(State)
{
free(State->SampleBuffer);
State->SampleBuffer = NULL;
free(State);
}
}
// NOTE: Temp, remove later.
static __inline ALint aluCart2LUTpos(ALfloat re, ALfloat im)
{
ALint pos = 0;
ALfloat denom = aluFabs(re) + aluFabs(im);
if(denom > 0.0f)
pos = (ALint)(QUADRANT_NUM*aluFabs(im) / denom + 0.5);
if(re < 0.0)
pos = 2 * QUADRANT_NUM - pos;
if(im < 0.0)
pos = LUT_NUM - pos;
return pos%LUT_NUM;
}
// This updates the reverb state. This is called any time the reverb effect
// is loaded into a slot.
ALvoid VerbUpdate(ALeffectState *effect, ALCcontext *Context, ALeffect *Effect)
{
ALverbState *State = (ALverbState*)effect;
ALuint index;
ALfloat length, mixCoeff, cw, g, coeff;
ALfloat hfRatio = Effect->Reverb.DecayHFRatio;
// Calculate the master low-pass filter (from the master effect HF gain).
cw = cos(2.0 * M_PI * Effect->Reverb.HFReference / Context->Frequency);
g = __max(Effect->Reverb.GainHF, 0.0001f);
State->LpFilter.coeff = 0.0f;
if(g < 0.9999f) // 1-epsilon
State->LpFilter.coeff = (1 - g*cw - aluSqrt(2*g*(1-cw) - g*g*(1 - cw*cw))) / (1 - g);
// Calculate the initial delay taps.
length = Effect->Reverb.ReflectionsDelay;
State->Tap[0] = (ALuint)(length * Context->Frequency);
length += Effect->Reverb.LateReverbDelay;
/* The four inputs to the late reverb are decorrelated to smooth the
* initial reverb and reduce harsh echos. The timings are calculated as
* multiples of a fraction of the smallest cyclical delay time. This
* result is then adjusted so that the first tap occurs immediately (all
* taps are reduced by the shortest fraction).
*
* offset[index] = ((FRACTION MULTIPLIER^index) - 1) delay
*/
for(index = 0;index < 4;index++)
{
length += LATE_LINE_LENGTH[0] *
(1.0f + (Effect->Reverb.Density * LATE_LINE_MULTIPLIER)) *
(DECO_FRACTION * (pow(DECO_MULTIPLIER, (ALfloat)index) - 1.0f));
State->Tap[1 + index] = (ALuint)(length * Context->Frequency);
}
// Calculate the early reflections gain (from the master effect gain, and
// reflections gain parameters).
State->Early.Gain = Effect->Reverb.Gain * Effect->Reverb.ReflectionsGain;
// Calculate the gain (coefficient) for each early delay line.
for(index = 0;index < 4;index++)
State->Early.Coeff[index] = pow(10.0f, EARLY_LINE_LENGTH[index] /
Effect->Reverb.LateReverbDelay *
-60.0f / 20.0f);
// Calculate the first mixing matrix coefficient (x).
mixCoeff = 1.0f - (0.5f * pow(Effect->Reverb.Diffusion, 3.0f));
// Calculate the late reverb gain (from the master effect gain, and late
// reverb gain parameters). Since the output is tapped prior to the
// application of the delay line coefficients, this gain needs to be
// attenuated by the 'x' mix coefficient from above.
State->Late.Gain = Effect->Reverb.Gain * Effect->Reverb.LateReverbGain * mixCoeff;
/* To compensate for changes in modal density and decay time of the late
* reverb signal, the input is attenuated based on the maximal energy of
* the outgoing signal. This is calculated as the ratio between a
* reference value and the current approximation of energy for the output
* signal.
*
* Reverb output matches exponential decay of the form Sum(a^n), where a
* is the attenuation coefficient, and n is the sample ranging from 0 to
* infinity. The signal energy can thus be approximated using the area
* under this curve, calculated as: 1 / (1 - a).
*
* The reference energy is calculated from a signal at the lowest (effect
* at 1.0) density with a decay time of one second.
*
* The coefficient is calculated as the average length of the cyclical
* delay lines. This produces a better result than calculating the gain
* for each line individually (most likely a side effect of diffusion).
*
* The final result is the square root of the ratio bound to a maximum
* value of 1 (no amplification).
*/
length = (LATE_LINE_LENGTH[0] + LATE_LINE_LENGTH[1] +
LATE_LINE_LENGTH[2] + LATE_LINE_LENGTH[3]);
g = length * (1.0f + LATE_LINE_MULTIPLIER) * 0.25f;
g = pow(10.0f, g * -60.0f / 20.0f);
g = 1.0f / (1.0f - (g * g));
length *= 1.0f + (Effect->Reverb.Density * LATE_LINE_MULTIPLIER) * 0.25f;
length = pow(10.0f, length / Effect->Reverb.DecayTime * -60.0f / 20.0f);
length = 1.0f / (1.0f - (length * length));
State->Late.DensityGain = __min(aluSqrt(g / length), 1.0f);
// Calculate the all-pass feed-back and feed-forward coefficient.
State->Late.ApFeedCoeff = 0.6f * pow(Effect->Reverb.Diffusion, 3.0f);
// Calculate the mixing matrix coefficient (y / x).
g = aluSqrt((1.0f - (mixCoeff * mixCoeff)) / 3.0f);
State->Late.MixCoeff = g / mixCoeff;
for(index = 0;index < 4;index++)
{
// Calculate the gain (coefficient) for each all-pass line.
State->Late.ApCoeff[index] = pow(10.0f, ALLPASS_LINE_LENGTH[index] /
Effect->Reverb.DecayTime *
-60.0f / 20.0f);
}
// If the HF limit parameter is flagged, calculate an appropriate limit
// based on the air absorption parameter.
if(Effect->Reverb.DecayHFLimit && Effect->Reverb.AirAbsorptionGainHF < 1.0f)
{
ALfloat limitRatio;
// For each of the cyclical delays, find the attenuation due to air
// absorption in dB (converting delay time to meters using the speed
// of sound). Then reversing the decay equation, solve for HF ratio.
// The delay length is cancelled out of the equation, so it can be
// calculated once for all lines.
limitRatio = 1.0f / (log10(Effect->Reverb.AirAbsorptionGainHF) *
SPEEDOFSOUNDMETRESPERSEC *
Effect->Reverb.DecayTime / -60.0f * 20.0f);
// Need to limit the result to a minimum of 0.1, just like the HF
// ratio parameter.
limitRatio = __max(limitRatio, 0.1f);
// Using the limit calculated above, apply the upper bound to the
// HF ratio.
hfRatio = __min(hfRatio, limitRatio);
}
// Calculate the low-pass filter frequency.
cw = cos(2.0f * M_PI * Effect->Reverb.HFReference / Context->Frequency);
for(index = 0;index < 4;index++)
{
// Calculate the length (in seconds) of each cyclical delay line.
length = LATE_LINE_LENGTH[index] * (1.0f + (Effect->Reverb.Density *
LATE_LINE_MULTIPLIER));
// Calculate the delay offset for the cyclical delay lines.
State->Late.Offset[index] = (ALuint)(length * Context->Frequency);
// Calculate the gain (coefficient) for each cyclical line.
State->Late.Coeff[index] = pow(10.0f, length / Effect->Reverb.DecayTime *
-60.0f / 20.0f);
// Eventually this should boost the high frequencies when the ratio
// exceeds 1.
coeff = 0.0f;
if (hfRatio < 1.0f)
{
// Calculate the decay equation for each low-pass filter.
g = pow(10.0f, length / (Effect->Reverb.DecayTime * hfRatio) *
-60.0f / 20.0f) / State->Late.Coeff[index];
g = __max(g, 0.1f);
g *= g;
// Calculate the gain (coefficient) for each low-pass filter.
if(g < 0.9999f) // 1-epsilon
coeff = (1 - g*cw - aluSqrt(2*g*(1-cw) - g*g*(1 - cw*cw))) / (1 - g);
// Very low decay times will produce minimal output, so apply an
// upper bound to the coefficient.
coeff = __min(coeff, 0.98f);
}
State->Late.LpCoeff[index] = coeff;
// Attenuate the cyclical line coefficients by the mixing coefficient
// (x).
State->Late.Coeff[index] *= mixCoeff;
}
// Calculate the 3D-panning gains for the early reflections and late
// reverb (for EAX mode).
{
ALfloat earlyPan[3] = { Effect->Reverb.ReflectionsPan[0], Effect->Reverb.ReflectionsPan[1], Effect->Reverb.ReflectionsPan[2] };
ALfloat latePan[3] = { Effect->Reverb.LateReverbPan[0], Effect->Reverb.LateReverbPan[1], Effect->Reverb.LateReverbPan[2] };
ALfloat *speakerGain, dirGain, ambientGain;
ALfloat length;
ALint pos;
length = earlyPan[0]*earlyPan[0] + earlyPan[1]*earlyPan[1] + earlyPan[2]*earlyPan[2];
if(length > 1.0f)
{
length = 1.0f / aluSqrt(length);
earlyPan[0] *= length;
earlyPan[1] *= length;
earlyPan[2] *= length;
}
length = latePan[0]*latePan[0] + latePan[1]*latePan[1] + latePan[2]*latePan[2];
if(length > 1.0f)
{
length = 1.0f / aluSqrt(length);
latePan[0] *= length;
latePan[1] *= length;
latePan[2] *= length;
}
// This code applies directional reverb just like the mixer applies
// directional sources. It diffuses the sound toward all speakers
// as the magnitude of the panning vector drops, which is only an
// approximation of the expansion of sound across the speakers from
// the panning direction.
pos = aluCart2LUTpos(earlyPan[2], earlyPan[0]);
speakerGain = &Context->PanningLUT[OUTPUTCHANNELS * pos];
dirGain = aluSqrt((earlyPan[0] * earlyPan[0]) + (earlyPan[2] * earlyPan[2]));
ambientGain = (1.0 - dirGain);
for(index = 0;index < OUTPUTCHANNELS;index++)
State->Early.PanGain[index] = dirGain * speakerGain[index] + ambientGain;
pos = aluCart2LUTpos(latePan[2], latePan[0]);
speakerGain = &Context->PanningLUT[OUTPUTCHANNELS * pos];
dirGain = aluSqrt((latePan[0] * latePan[0]) + (latePan[2] * latePan[2]));
ambientGain = (1.0 - dirGain);
for(index = 0;index < OUTPUTCHANNELS;index++)
State->Late.PanGain[index] = dirGain * speakerGain[index] + ambientGain;
}
}
// This processes the reverb state, given the input samples and an output
// buffer.
ALvoid VerbProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS])
{
ALverbState *State = (ALverbState*)effect;
ALuint index;
ALfloat early[4], late[4], out[4];
ALfloat gain = Slot->Gain;
for(index = 0;index < SamplesToDo;index++)
{
// Process reverb for this sample.
ReverbInOut(State, SamplesIn[index], early, late);
// Mix early reflections and late reverb.
out[0] = (early[0] + late[0]) * gain;
out[1] = (early[1] + late[1]) * gain;
out[2] = (early[2] + late[2]) * gain;
out[3] = (early[3] + late[3]) * gain;
// Output the results.
SamplesOut[index][FRONT_LEFT] += out[0];
SamplesOut[index][FRONT_RIGHT] += out[1];
SamplesOut[index][FRONT_CENTER] += out[3];
SamplesOut[index][SIDE_LEFT] += out[0];
SamplesOut[index][SIDE_RIGHT] += out[1];
SamplesOut[index][BACK_LEFT] += out[0];
SamplesOut[index][BACK_RIGHT] += out[1];
SamplesOut[index][BACK_CENTER] += out[2];
}
}
// This processes the EAX reverb state, given the input samples and an output
// buffer.
ALvoid EAXVerbProcess(ALeffectState *effect, const ALeffectslot *Slot, ALuint SamplesToDo, const ALfloat *SamplesIn, ALfloat (*SamplesOut)[OUTPUTCHANNELS])
{
ALverbState *State = (ALverbState*)effect;
ALuint index;
ALfloat early[4], late[4];
ALfloat gain = Slot->Gain;
for(index = 0;index < SamplesToDo;index++)
{
// Process reverb for this sample.
ReverbInOut(State, SamplesIn[index], early, late);
// Unfortunately, while the number and configuration of gains for
// panning adjust according to OUTPUTCHANNELS, the output from the
// reverb engine is not so scalable.
SamplesOut[index][FRONT_LEFT] +=
(State->Early.PanGain[FRONT_LEFT]*early[0] +
State->Late.PanGain[FRONT_LEFT]*late[0]) * gain;
SamplesOut[index][FRONT_RIGHT] +=
(State->Early.PanGain[FRONT_RIGHT]*early[1] +
State->Late.PanGain[FRONT_RIGHT]*late[1]) * gain;
SamplesOut[index][FRONT_CENTER] +=
(State->Early.PanGain[FRONT_CENTER]*early[3] +
State->Late.PanGain[FRONT_CENTER]*late[3]) * gain;
SamplesOut[index][SIDE_LEFT] +=
(State->Early.PanGain[SIDE_LEFT]*early[0] +
State->Late.PanGain[SIDE_LEFT]*late[0]) * gain;
SamplesOut[index][SIDE_RIGHT] +=
(State->Early.PanGain[SIDE_RIGHT]*early[1] +
State->Late.PanGain[SIDE_RIGHT]*late[1]) * gain;
SamplesOut[index][BACK_LEFT] +=
(State->Early.PanGain[BACK_LEFT]*early[0] +
State->Late.PanGain[BACK_LEFT]*late[0]) * gain;
SamplesOut[index][BACK_RIGHT] +=
(State->Early.PanGain[BACK_RIGHT]*early[1] +
State->Late.PanGain[BACK_RIGHT]*late[1]) * gain;
SamplesOut[index][BACK_CENTER] +=
(State->Early.PanGain[BACK_CENTER]*early[2] +
State->Late.PanGain[BACK_CENTER]*late[2]) * gain;
}
}
// This creates the reverb state. It should be called only when the reverb
// effect is loaded into a slot that doesn't already have a reverb effect.
ALeffectState *VerbCreate(ALCcontext *Context)
{
ALverbState *State = NULL;
ALuint samples, length[13], totalLength, index;
State = malloc(sizeof(ALverbState));
if(!State)
{
alSetError(AL_OUT_OF_MEMORY);
return NULL;
}
State->state.Destroy = VerbDestroy;
State->state.Update = VerbUpdate;
State->state.Process = VerbProcess;
// All line lengths are powers of 2, calculated from their lengths, with
// an additional sample in case of rounding errors.
// See VerbUpdate() for an explanation of the additional calculation
// added to the master line length.
samples = (ALuint)
((MASTER_LINE_LENGTH +
(LATE_LINE_LENGTH[0] * (1.0f + LATE_LINE_MULTIPLIER) *
(DECO_FRACTION * ((DECO_MULTIPLIER * DECO_MULTIPLIER *
DECO_MULTIPLIER) - 1.0f)))) *
Context->Frequency) + 1;
length[0] = NextPowerOf2(samples);
totalLength = length[0];
for(index = 0;index < 4;index++)
{
samples = (ALuint)(EARLY_LINE_LENGTH[index] * Context->Frequency) + 1;
length[1 + index] = NextPowerOf2(samples);
totalLength += length[1 + index];
}
for(index = 0;index < 4;index++)
{
samples = (ALuint)(ALLPASS_LINE_LENGTH[index] * Context->Frequency) + 1;
length[5 + index] = NextPowerOf2(samples);
totalLength += length[5 + index];
}
for(index = 0;index < 4;index++)
{
samples = (ALuint)(LATE_LINE_LENGTH[index] *
(1.0f + LATE_LINE_MULTIPLIER) * Context->Frequency) + 1;
length[9 + index] = NextPowerOf2(samples);
totalLength += length[9 + index];
}
// All lines share a single sample buffer and have their masks and start
// addresses calculated once.
State->SampleBuffer = malloc(totalLength * sizeof(ALfloat));
if(!State->SampleBuffer)
{
free(State);
alSetError(AL_OUT_OF_MEMORY);
return NULL;
}
for(index = 0; index < totalLength;index++)
State->SampleBuffer[index] = 0.0f;
State->LpFilter.coeff = 0.0f;
State->LpFilter.history[0] = 0.0f;
State->LpFilter.history[1] = 0.0f;
State->Delay.Mask = length[0] - 1;
State->Delay.Line = &State->SampleBuffer[0];
totalLength = length[0];
State->Tap[0] = 0;
State->Tap[1] = 0;
State->Tap[2] = 0;
State->Tap[3] = 0;
State->Tap[4] = 0;
State->Early.Gain = 0.0f;
for(index = 0;index < 4;index++)
{
State->Early.Coeff[index] = 0.0f;
State->Early.Delay[index].Mask = length[1 + index] - 1;
State->Early.Delay[index].Line = &State->SampleBuffer[totalLength];
totalLength += length[1 + index];
// The early delay lines have their read offsets calculated once.
State->Early.Offset[index] = (ALuint)(EARLY_LINE_LENGTH[index] *
Context->Frequency);
}
State->Late.Gain = 0.0f;
State->Late.DensityGain = 0.0f;
State->Late.ApFeedCoeff = 0.0f;
State->Late.MixCoeff = 0.0f;
for(index = 0;index < 4;index++)
{
State->Late.ApCoeff[index] = 0.0f;
State->Late.ApDelay[index].Mask = length[5 + index] - 1;
State->Late.ApDelay[index].Line = &State->SampleBuffer[totalLength];
totalLength += length[5 + index];
// The late all-pass lines have their read offsets calculated once.
State->Late.ApOffset[index] = (ALuint)(ALLPASS_LINE_LENGTH[index] *
Context->Frequency);
}
for(index = 0;index < 4;index++)
{
State->Late.Coeff[index] = 0.0f;
State->Late.Delay[index].Mask = length[9 + index] - 1;
State->Late.Delay[index].Line = &State->SampleBuffer[totalLength];
totalLength += length[9 + index];
State->Late.Offset[index] = 0;
State->Late.LpCoeff[index] = 0.0f;
State->Late.LpSample[index] = 0.0f;
}
// Panning is applied as an independent gain for each output channel.
for(index = 0;index < OUTPUTCHANNELS;index++)
{
State->Early.PanGain[index] = 0.0f;
State->Late.PanGain[index] = 0.0f;
}
State->Offset = 0;
return &State->state;
}
ALeffectState *EAXVerbCreate(ALCcontext *Context)
{
ALeffectState *State = VerbCreate(Context);
if(State) State->Process = EAXVerbProcess;
return State;
}
|
ghoulsblade/vegaogre
|
lugre/baselib/openal-soft-1.8.466/Alc/alcReverb.c
|
C
|
mit
| 31,015 | 38.012579 | 155 | 0.613284 | false |
# baites.github.io
# Installation
* Cloning and creating docker image
**NOTE**: This installation requires installed docker server.
```bash
$ git clone git clone https://github.com/baites/baites.github.io.git
$ cd baites.github.io
$ docker build -t jekyll -f jekyll.dockerfile .
...
Successfully tagged jekyll:latest
```
* Creating container
```bash
$ USER_ID=$(id -u)
$ USER_NAME=$(id -un)
$ GROUP_ID=$(id -g)
$ GROUP_NAME=$(id -gn)
$ docker create \
--name jekyll-$USER_NAME \
--mount type=bind,source=$PWD,target=/home/$USER_NAME/baites.github.io \
--mount type=bind,source=$HOME/.ssh,target=/home/$USER_NAME/.ssh \
--workdir /home/$USER_NAME/baites.github.io \
-t -p 4000:4000 jekyll
$ docker start jekyll-$USER_NAME
```
* Mirror user and group to the container
```bash
$ CMD="useradd -u $USER_ID -N $USER_NAME && \
groupadd -g $GROUP_ID $GROUP_NAME && \
usermod -g $GROUP_NAME $USER_NAME &&\
echo '$USER_NAME ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/$USER_NAME &&\
chown -R $USER_NAME:$GROUP_NAME /home/$USER_NAME"
docker exec jekyll-$USER_NAME /bin/bash -c "$CMD"
```
* Entering in the container install gihub pages
```bash
$ docker exec -it -u $USER_NAME jekyll-$USER_NAME /bin/bash
$USER_NAME@bcfa7ea7eb52 baites.github.io$ export PATH="/home/baites/.gem/ruby/2.7.0/bin:$PATH"
$USER_NAME@bcfa7ea7eb52 baites.github.io$ gem install bundler
...
$USER_NAME@bcfa7ea7eb52 baites.github.io$ bundle exec jekyll serve -I --future --host 0.0.0.0
...
```
* Open browser at http://localhost:4000/
|
baites/baites.github.io
|
README.md
|
Markdown
|
mit
| 1,505 | 26.381818 | 94 | 0.69701 | false |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class Product(Model):
_required = []
_attribute_map = {
'integer': {'key': 'integer', 'type': 'int'},
'string': {'key': 'string', 'type': 'str'},
}
def __init__(self, *args, **kwargs):
"""Product
:param int integer
:param str string
"""
self.integer = None
self.string = None
super(Product, self).__init__(*args, **kwargs)
|
vulcansteel/autorest
|
AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/BodyArray/auto_rest_swagger_bat_array_service/models/product.py
|
Python
|
mit
| 931 | 27.212121 | 76 | 0.514501 | false |
// # Ghost Configuration
// Setup your Ghost install for various environments
// Documentation can be found at http://support.ghost.org/config/
var path = require('path'),
config;
config = {
// ### Production
// When running Ghost in the wild, use the production environment
// Configure your URL and mail settings here
production: {
url: 'http://my-ghost-blog.com',
mail: {},
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost.db')
},
debug: false
},
server: {
// Host to be passed to node's `net.Server#listen()`
host: '127.0.0.1',
// Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
port: '2368'
}
},
// ### Development **(default)**
development: {
// The url to use when providing links to the site, E.g. in RSS and email.
// Change this to your Ghost blogs published URL.
url: 'http://localhost:2368',
// Example mail config
// Visit http://support.ghost.org/mail for instructions
// ```
mail: {
transport: 'SMTP',
options: {
service: 'Gmail',
auth: {
user: '[email protected]', // mailgun username
pass: 'ghostblogwandering' // mailgun password
}
}
},
//```
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost-dev.db')
},
debug: false
},
server: {
// Host to be passed to node's `net.Server#listen()`
host: '127.0.0.1',
// Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
port: '2368'
},
paths: {
contentPath: path.join(__dirname, '/content/')
}
},
// **Developers only need to edit below here**
// ### Testing
// Used when developing Ghost to run tests and check the health of Ghost
// Uses a different port number
testing: {
url: 'http://127.0.0.1:2369',
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost-test.db')
}
},
server: {
host: '127.0.0.1',
port: '2369'
},
logging: false
},
// ### Testing MySQL
// Used by Travis - Automated testing run through GitHub
'testing-mysql': {
url: 'http://127.0.0.1:2369',
database: {
client: 'mysql',
connection: {
host : '127.0.0.1',
user : 'root',
password : '',
database : 'ghost_testing',
charset : 'utf8'
}
},
server: {
host: '127.0.0.1',
port: '2369'
},
logging: false
},
// ### Testing pg
// Used by Travis - Automated testing run through GitHub
'testing-pg': {
url: 'http://127.0.0.1:2369',
database: {
client: 'pg',
connection: {
host : '127.0.0.1',
user : 'postgres',
password : '',
database : 'ghost_testing',
charset : 'utf8'
}
},
server: {
host: '127.0.0.1',
port: '2369'
},
logging: false
}
};
// Export config
module.exports = config;
|
rquellh/thewanderingconsultant
|
config.js
|
JavaScript
|
mit
| 3,810 | 27.432836 | 108 | 0.46168 | false |
import React from 'react';
import PropTypes from 'prop-types';
import styled, { keyframes } from 'styled-components';
const blink = keyframes`
from, to {
opacity: 1;
}
50% {
opacity: 0;
}
`;
const CursorSpan = styled.span`
font-weight: 100;
color: black;
font-size: 1em;
padding-left: 2px;
animation: ${blink} 1s step-end infinite;
`;
const Cursor = ({ className }) => (
<CursorSpan className={className}>|</CursorSpan>
);
Cursor.propTypes = { className: PropTypes.string };
Cursor.defaultProps = { className: '' };
export default Cursor;
|
adamjking3/react-typing-animation
|
src/Cursor.js
|
JavaScript
|
mit
| 572 | 18.724138 | 54 | 0.662587 | false |
// Copyright Louis Dionne 2015
// Distributed under the Boost Software License, Version 1.0.
#include <type_traits>
template <typename T>
using void_t = std::conditional_t<true, void, T>;
// sample(common_type-N3843)
template <typename T, typename U>
using builtin_common_t = std::decay_t<decltype(
true ? std::declval<T>() : std::declval<U>()
)>;
template <typename, typename ...>
struct ct { };
template <typename T>
struct ct<void, T> : std::decay<T> { };
template <typename T, typename U, typename ...V>
struct ct<void_t<builtin_common_t<T, U>>, T, U, V...>
: ct<void, builtin_common_t<T, U>, V...>
{ };
template <typename ...T>
struct common_type : ct<void, T...> { };
// end-sample
template <typename ...Ts>
using common_type_t = typename common_type<Ts...>::type;
//////////////////////////////////////////////////////////////////////////////
// Tests
//////////////////////////////////////////////////////////////////////////////
template <typename T, typename = void>
struct has_type : std::false_type { };
template <typename T>
struct has_type<T, void_t<typename T::type>> : std::true_type { };
struct A { }; struct B { }; struct C { };
// Ensure proper behavior in normal cases
static_assert(std::is_same<
common_type_t<char>,
char
>{}, "");
static_assert(std::is_same<
common_type_t<A, A>,
A
>{}, "");
static_assert(std::is_same<
common_type_t<char, short, char, short>,
int
>{}, "");
static_assert(std::is_same<
common_type_t<char, double, short, char, short, double>,
double
>{}, "");
static_assert(std::is_same<
common_type_t<char, short, float, short>,
float
>{}, "");
// Ensure SFINAE-friendliness
static_assert(!has_type<common_type<>>{}, "");
static_assert(!has_type<common_type<int, void>>{}, "");
int main() { }
|
ldionne/hana-cppnow-2015
|
code/common_type-N3843.cpp
|
C++
|
mit
| 1,800 | 21.78481 | 78 | 0.576667 | false |
package remove_duplicates_from_sorted_list;
import common.ListNode;
public class RemoveDuplicatesfromSortedList {
public class Solution {
public ListNode deleteDuplicates(ListNode head) {
if (head != null) {
ListNode pre = head;
ListNode p = pre.next;
while (p != null) {
if (p.val == pre.val) {
pre.next = p.next;
} else {
pre = p;
}
p = p.next;
}
}
return head;
}
}
public static class UnitTest {
}
}
|
quantumlaser/code2016
|
LeetCode/Answers/Leetcode-java-solution/remove_duplicates_from_sorted_list/RemoveDuplicatesfromSortedList.java
|
Java
|
mit
| 668 | 22.857143 | 57 | 0.423653 | false |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
namespace Umbraco.Core.Models.EntityBase
{
/// <summary>
/// A base class for use to implement IRememberBeingDirty/ICanBeDirty
/// </summary>
public abstract class TracksChangesEntityBase : IRememberBeingDirty
{
/// <summary>
/// Tracks the properties that have changed
/// </summary>
private readonly IDictionary<string, bool> _propertyChangedInfo = new Dictionary<string, bool>();
/// <summary>
/// Tracks the properties that we're changed before the last commit (or last call to ResetDirtyProperties)
/// </summary>
private IDictionary<string, bool> _lastPropertyChangedInfo = null;
/// <summary>
/// Property changed event
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Method to call on a property setter.
/// </summary>
/// <param name="propertyInfo">The property info.</param>
protected virtual void OnPropertyChanged(PropertyInfo propertyInfo)
{
_propertyChangedInfo[propertyInfo.Name] = true;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyInfo.Name));
}
}
/// <summary>
/// Indicates whether a specific property on the current entity is dirty.
/// </summary>
/// <param name="propertyName">Name of the property to check</param>
/// <returns>True if Property is dirty, otherwise False</returns>
public virtual bool IsPropertyDirty(string propertyName)
{
return _propertyChangedInfo.Any(x => x.Key == propertyName);
}
/// <summary>
/// Indicates whether the current entity is dirty.
/// </summary>
/// <returns>True if entity is dirty, otherwise False</returns>
public virtual bool IsDirty()
{
return _propertyChangedInfo.Any();
}
/// <summary>
/// Indicates that the entity had been changed and the changes were committed
/// </summary>
/// <returns></returns>
public bool WasDirty()
{
return _lastPropertyChangedInfo != null && _lastPropertyChangedInfo.Any();
}
/// <summary>
/// Indicates whether a specific property on the current entity was changed and the changes were committed
/// </summary>
/// <param name="propertyName">Name of the property to check</param>
/// <returns>True if Property was changed, otherwise False. Returns false if the entity had not been previously changed.</returns>
public virtual bool WasPropertyDirty(string propertyName)
{
return WasDirty() && _lastPropertyChangedInfo.Any(x => x.Key == propertyName);
}
/// <summary>
/// Resets the remembered dirty properties from before the last commit
/// </summary>
public void ForgetPreviouslyDirtyProperties()
{
_lastPropertyChangedInfo.Clear();
}
/// <summary>
/// Resets dirty properties by clearing the dictionary used to track changes.
/// </summary>
/// <remarks>
/// Please note that resetting the dirty properties could potentially
/// obstruct the saving of a new or updated entity.
/// </remarks>
public virtual void ResetDirtyProperties()
{
ResetDirtyProperties(true);
}
/// <summary>
/// Resets dirty properties by clearing the dictionary used to track changes.
/// </summary>
/// <param name="rememberPreviouslyChangedProperties">
/// true if we are to remember the last changes made after resetting
/// </param>
/// <remarks>
/// Please note that resetting the dirty properties could potentially
/// obstruct the saving of a new or updated entity.
/// </remarks>
public virtual void ResetDirtyProperties(bool rememberPreviouslyChangedProperties)
{
if (rememberPreviouslyChangedProperties)
{
//copy the changed properties to the last changed properties
_lastPropertyChangedInfo = _propertyChangedInfo.ToDictionary(v => v.Key, v => v.Value);
}
_propertyChangedInfo.Clear();
}
/// <summary>
/// Used by inheritors to set the value of properties, this will detect if the property value actually changed and if it did
/// it will ensure that the property has a dirty flag set.
/// </summary>
/// <param name="setValue"></param>
/// <param name="value"></param>
/// <param name="propertySelector"></param>
/// <returns>returns true if the value changed</returns>
/// <remarks>
/// This is required because we don't want a property to show up as "dirty" if the value is the same. For example, when we
/// save a document type, nearly all properties are flagged as dirty just because we've 'reset' them, but they are all set
/// to the same value, so it's really not dirty.
/// </remarks>
internal bool SetPropertyValueAndDetectChanges<T>(Func<T, T> setValue, T value, PropertyInfo propertySelector)
{
var initVal = value;
var newVal = setValue(value);
if (!Equals(initVal, newVal))
{
OnPropertyChanged(propertySelector);
return true;
}
return false;
}
}
}
|
zidad/Umbraco-CMS
|
src/Umbraco.Core/Models/EntityBase/TracksChangesEntityBase.cs
|
C#
|
mit
| 5,915 | 38.238095 | 138 | 0.588196 | false |
# coding=utf8
"""
Parser for todo format string.
from todo.parser import parser
parser.parse(string) # return an Todo instance
"""
from models import Task
from models import Todo
from ply import lex
from ply import yacc
class TodoLexer(object):
"""
Lexer for Todo format string.
Tokens
ID e.g. '1.'
DONE e.g. '(x)'
TASK e.g. 'This is a task'
"""
tokens = (
"ID",
"DONE",
"TASK",
)
t_ignore = "\x20\x09" # ignore spaces and tabs
def t_ID(self, t):
r'\d+\.([uU]|[lL]|[uU][lL]|[lL][uU])?'
t.value = int(t.value[:-1])
return t
def t_DONE(self, t):
r'(\(x\))'
return t
def t_TASK(self, t):
r'((?!\(x\))).+'
return t
def t_newline(self, t):
r'\n+'
t.lexer.lineno += len(t.value)
def t_error(self, t):
raise SyntaxError(
"Illegal character: '%s' at Line %d" % (t.value[0], t.lineno)
)
def __init__(self):
self.lexer = lex.lex(module=self)
class TodoParser(object):
"""
Parser for Todo format string, works with a todo lexer.
Parse string to Python list
todo_str = "1. (x) Write email to tom"
TodoParser().parse(todo_str)
"""
tokens = TodoLexer.tokens
def p_error(self, p):
if p:
raise SyntaxError(
"Character '%s' at line %d" % (p.value[0], p.lineno)
)
else:
raise SyntaxError("SyntaxError at EOF")
def p_start(self, p):
"start : translation_unit"
p[0] = self.todo
def p_translation_unit(self, p):
"""
translation_unit : translate_task
| translation_unit translate_task
|
"""
pass
def p_translation_task(self, p):
"""
translate_task : ID DONE TASK
| ID TASK
"""
if len(p) == 4:
done = True
content = p[3]
elif len(p) == 3:
done = False
content = p[2]
task = Task(p[1], content, done)
self.todo.append(task)
def __init__(self):
self.parser = yacc.yacc(module=self, debug=0, write_tables=0)
def parse(self, data):
# reset list
self.todo = Todo()
return self.parser.parse(data)
lexer = TodoLexer() # build lexer
parser = TodoParser() # build parser
|
guori12321/todo
|
todo/parser.py
|
Python
|
mit
| 2,473 | 20.504348 | 73 | 0.496967 | false |
var test = require('tape');
var BSFS = require('../lib/bsfs');
indexedDB.deleteDatabase('bsfs-tests');
function randomId () { return Math.random().toString(36).substr(2) }
test('bsfs exists', function (t) {
t.plan(1);
var bsfs = new BSFS('bsfs-tests');
if (!bsfs._ready) return bsfs.once('ready', ready);
else process.nextTick(ready);
function ready () {
t.equals(typeof bsfs, 'object');
}
});
test('bsfs has file router', function (t) {
t.plan(1);
var bsfs = new BSFS('bsfs-tests');
if (!bsfs._ready) return bsfs.once('ready', ready);
else process.nextTick(ready);
function ready () {
t.equal(typeof bsfs._fileRouter, 'object');
}
});
test('write without path throws', function (t) {
t.plan(1);
var bsfs = new BSFS('bsfs-tests');
if (!bsfs._ready) return bsfs.once('ready', ready);
else process.nextTick(ready);
function ready () {
t.throws(function() {
bsfs.createWriteStream(null, function() {})
});
}
});
test('write file', function (t) {
t.plan(1);
var bsfs = new BSFS('bsfs-tests');
if (!bsfs._ready) return bsfs.once('ready', ready);
else process.nextTick(ready);
function ready () {
var path = '/tmp/test-' + randomId();
var content = 'Hello cruel world ' + randomId();
var w = bsfs.createWriteStream(path, function(err, meta) {
t.equal(err, null);
});
w.end(content);
}
});
test('write then read file by key', function (t) {
t.plan(1);
var path = '/tmp/test-' + randomId();
var content = 'Hello cruel world ' + randomId();
var bsfs = new BSFS('bsfs-tests');
if (!bsfs._ready) return bsfs.once('ready', ready);
else process.nextTick(ready);
function readBack (key) {
var r = bsfs.createReadStreamFromKey(key);
var readContent = '';
r.on('data', function (chunk) {
readContent += chunk;
});
r.on('end', function () {
t.equal(content, readContent);
});
}
function ready () {
var w = bsfs.createWriteStream(path, function(err, meta) {
readBack(meta.key);
});
w.end(content);
}
});
test('write then read file by name', function (t) {
t.plan(1);
var content = 'Hello cruel world ' + randomId();
var path = '/tmp/test-' + randomId();
var bsfs = new BSFS('bsfs-tests');
if (!bsfs._ready) return bsfs.once('ready', ready);
else process.nextTick(ready);
function readBack (path) {
var r = bsfs.createReadStream(path);
var readContent = '';
r.on('data', function (chunk) {
readContent += chunk;
});
r.on('end', function () {
t.equal(content, readContent);
});
}
function ready () {
var w = bsfs.createWriteStream(path, function(err, meta) {
readBack(path);
});
w.end(content);
}
});
test('access', function (t) {
t.test('is silent (for now)', function (t) {
t.plan(3);
var bsfs = new BSFS('bsfs-tests');
if (!bsfs.ready) return bsfs.once('ready', ready)
else process.nextTick(ready);
function ready () {
bsfs.access(null, function (err) {
t.ifError(err);
});
bsfs.access('/tmp', function (err) {
t.ifError(err);
});
bsfs.access('/tmp', 2, function (err) {
t.ifError(err);
});
}
});
t.test('throws on invalid callback argument', function (t) {
t.plan(1);
var bsfs = new BSFS('bsfs-tests');
if (!bsfs.ready) return bsfs.once('ready', ready)
else process.nextTick(ready);
function ready () {
t.throws(function () {
bsfs.access('/tmp/', 0, 'potatoe');
})
}
});
});
test('accessSync', function (t) {
t.test('is silent (for now)', function (t) {
t.plan(2);
var bsfs = new BSFS('bsfs-tests');
if (!bsfs.ready) return bsfs.once('ready', ready)
else process.nextTick(ready);
function ready () {
t.ifError(bsfs.accessSync(randomId()));
t.ifError(bsfs.accessSync());
}
})
});
test('exists', function (t) {
t.test('is true for all paths (for now)', function (t) {
t.plan(1);
var bsfs = new BSFS('bsfs-tests');
if (!bsfs.ready) return bsfs.once('ready', ready);
else proccess.nextTick(ready);
function ready () {
bsfs.exists(randomId(), function (exists) {
t.ok(exists);
});
}
});
});
test('existsSync', function (t) {
t.test('throws on null path', function (t) {
t.plan(1);
var bsfs = new BSFS('bsfs-tests');
if (!bsfs.ready) return bsfs.once('ready', ready);
else proccess.nextTick(ready);
function ready () {
t.throws(bsfs.existsSync());
}
});
t.test('is true for all paths (for now)', function (t) {
t.plan(2);
var bsfs = new BSFS('bsfs-tests');
if (!bsfs.ready) return bsfs.once('ready', ready);
else proccess.nextTick(ready);
function ready () {
t.ok(bsfs.existsSync(randomId()));
t.ok(bsfs.existsSync());
}
});
});
test('appendFile without path throws', function (t) {
t.plan(1);
var bsfs = new BSFS('bsfs-tests');
if (!bsfs._ready) return bsfs.once('ready', ready);
else process.nextTick(ready);
function ready () {
t.throws(function () {
bsfs.appendFile(null, function () {});
});
}
});
|
nickaugust/bsfs
|
test/bsfs.js
|
JavaScript
|
mit
| 5,219 | 20.566116 | 68 | 0.581721 | false |
---
title: A List of the White Rabbit Mechanics We Are Considering
author: all
date: 15/01/11
tags: [concept, summary, gamemechanics, whiterabbit]
layout: post
---
The white rabbit.
Here is a list of some of the rabbits we could pull out of our designer's magical top hat.
## Cooperative Rope Walking
### Summary
One scenario is while one person crawls across a cable to breach the hull of another ship, the other must move the ship in sync with the other ship to ensure the crawling player doesn't fall.
Could further add elements of wind and obstacles.
### Pros
+ Very explicit cooperative components
+ Leaves room for interesting use of physics
+ Fits well as minigame between core hack and slash
### Cons
+ Direct cooperation between players requires very fast and accurate network syncing
+ Can be frustrating if your partner is very poor at this minigame
## Ghost with Visibility Goggles
### Summary
While one player only sees shimmers of an enemy or an important object, the other can see it very clearly.
They must cooperate
### Pros
### Cons
## Building Blocks with Imbuement
> Originally by me but I find the gravitational singularities to be more interesting and probably even easier to implement. This could be interesting regardless and could be considered in another light where one player can imbue the weaponry of the others. - Calem
### Summary
### Pros
### Cons
## Cooperative Gravitational Singularities
### Summary
Players get a singularity tool that can produce singularities that either push or pull all objects within a sphere of influence.
The map would preferably be prepared to be interactive with this weapon.
For the ice planet, this could be as simple as pre-subdividing the terrain mesh into large icy chunks and into ice shards that can damage enemies.
Interesting physics based puzzles become available.
In the prototype, this was used to traverse a bridge of objects trapped between to singularities.
Another mode is allowing a double jump by jumping onto the top of a singularity, which pushes the character up or allows them to walk on top of the sphere of influence depending on the gravitational factor.


(note this image has a low framerate as it is a low quality gif :-) actual prototype is very smooth)
Mesh collision can greatly improve the look and feel, but will dramatically reduce performance.
Smooth performance with mesh collision limited to some 250 cubes.

A bridge can be formed with 25 sheets if optimising for few objects with convex collision meshes.

### Pros
+ Very easy to implemented if the prototyping is any indication
+ Adds more interesting components to level design
+ Purely physics based cooperation and problem solving, which should be very intuitive, deterministic (like Portal)
+ No particularly special considerations for AI
+ Concept has been tested for resource usage and does well without optimisations
+ Particle effects can be used to hide unrealistic collision a bit and make sense in the context of the singularity
+ Cooperative elements are less contrived, and if friendly fire is enabled accidentally sucking your partner into a singularity could be very amusing given the appropriate sound effects and cues
### Cons
+ Would require level design considerations beyond normal puzzle making (subdivisions)
+ Fine control of singularity location may be awkward (though could be easy if both joysticks used in fine control mode?)
+ Syncing physics of multiple bodies between players may be difficult and needs to be tested.
+ Approximated collision has to be used for the objects in the sphere of influence if there are going to be more than a couple hundred objects
## Transition into spirit with different environmental interactions
### Summary
### Pros
### Cons
## Time travelling with effects on past
### Summary
### Pros
### Cons
## Collector and defender with pinging for resource collection
### Summary
### Pros
### Cons
## Single item to share
### Summary
> The mechanics of this need to be fleshed out more, I think. - Calem
### Pros
### Cons
## One player can transform the other, changing their abilities
### Summary
### Pros
### Cons
|
scarlethammergames/scarlethammergames.github.io
|
_posts/15-01-11-collated-white-rabbits.md
|
Markdown
|
mit
| 4,496 | 32.804511 | 266 | 0.777358 | false |
---
layout: page
title: Pride Solutions Conference
date: 2016-05-24
author: Carl Mccarty
tags: weekly links, java
status: published
summary: Curabitur ipsum ante, aliquam sit.
banner: images/banner/office-01.jpg
booking:
startDate: 05/26/2016
endDate: 05/31/2016
ctyhocn: LITWTHX
groupCode: PSC
published: true
---
Cras vitae ullamcorper libero, id laoreet lacus. Praesent sed ligula suscipit, interdum nulla in, blandit ipsum. Nunc sem massa, posuere ut tellus et, tempus consectetur erat. Suspendisse potenti. Etiam ultricies nunc sit amet congue vestibulum. Pellentesque vehicula tristique tellus, sed pellentesque risus fringilla eget. Nullam id malesuada ligula. Praesent ante nibh, accumsan non urna vel, molestie condimentum justo. Ut feugiat ligula vitae odio mattis, at facilisis neque ultricies. In sagittis ante justo, eu ornare nibh rhoncus non. Ut vel ligula nec est maximus gravida non nec massa. Sed placerat orci sed lacus tristique dictum. Sed id ipsum cursus, lacinia ligula id, scelerisque nibh. Nullam fringilla mi metus, a rutrum tortor aliquam in. Sed et nibh vulputate, iaculis nulla id, auctor mi. Integer elit dui, eleifend eget diam commodo, sagittis vestibulum magna.
* Aenean luctus metus in quam elementum, vitae mollis augue ornare
* Praesent eget ipsum accumsan, scelerisque ex id, pharetra quam.
Aenean tempor sollicitudin aliquet. Ut interdum ex et mauris finibus tempus. Aliquam erat volutpat. Morbi mollis laoreet elit, at iaculis lectus iaculis ut. Donec rutrum volutpat purus, sed pretium urna feugiat a. Mauris porta feugiat ligula, eget posuere tellus vehicula vel. Sed commodo eros eget ante sollicitudin, id pretium enim consequat. Duis sed ex sit amet elit venenatis consequat. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Etiam gravida nisl quis nisl porta, ut malesuada lacus iaculis. Proin suscipit orci id dolor mattis, ac mollis ligula placerat. Curabitur facilisis nibh odio, eu vulputate nulla congue et. Quisque dolor dolor, accumsan et vestibulum a, suscipit nec felis.
|
KlishGroup/prose-pogs
|
pogs/L/LITWTHX/PSC/index.md
|
Markdown
|
mit
| 2,072 | 93.181818 | 879 | 0.804537 | false |
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**/
#include "stateengine/AtomicState.h"
#include "stateengine/Defines.h"
//--------------------------------------------------------------------
// TAtomicState
//--------------------------------------------------------------------
//--------------------------------------------------------------------
namespace donut
{
typedef void (*TUpdaterFunction)(const TStateEngineId&, double);
typedef void (*TStateCallBack)(const TStateEngineId&, TStateData *);
//--------------------------------------------------------------------
TAtomicState::TAtomicState(TStateEngineId parStateEngineId, TStateId parId, TStateData (* parTStateData), void (* parEnterCallBack), void (* parLeaveCallBack), void (* parUpdater))
: FStateEngineId (parStateEngineId)
{
FEnterCallBack = parEnterCallBack;
FLeaveCallBack = parLeaveCallBack;
FStateData = parTStateData;
FUpdater = parUpdater;
FId = parId;
}
TAtomicState::~TAtomicState()
{
// assert_msg_NO_RELEASE(FStateData!=NULL, "The state data has been already deleted. you do not need to.")
delete FStateData;
}
void TAtomicState::AddTransition(TTransitionId parId, TTransition * parTransition)
{
FOutTransitions[parId] = parTransition;
}
#if _DEBUG
void TAtomicState::AddInTransition(const TTransition * parTransition)
{
// FInTransitions.push_back(parTransition)
}
#endif
void TAtomicState::Update(double parDt)
{
void (*updater)( const TStateEngineId&, double) = *((TUpdaterFunction*) (&FUpdater));
updater(FStateEngineId , parDt);
}
void TAtomicState::Enter()
{
void (*enter)(const TStateEngineId&, TStateData *) = *((TStateCallBack*) (&FEnterCallBack));
enter(FStateEngineId, FStateData);
}
void TAtomicState::Leave()
{
void (*leave)(const TStateEngineId&, TStateData *) = *((TStateCallBack*) (&FLeaveCallBack));
leave(FStateEngineId, FStateData);
}
void TAtomicState::TransitionCallBack()
{
}
} // End namestate StateEngine
|
AnisB/Donut
|
engine/src/stateengine/AtomicState.cpp
|
C++
|
mit
| 2,621 | 28.795455 | 182 | 0.648989 | false |
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
//Bundle ajouté
new FOS\UserBundle\FOSUserBundle(),
new Psa\PageBundle\PsaPageBundle(),
//new Psa\UserBundle\PsaUserBundle(),
new Psa\AdminBundle\PsaAdminBundle(),
new Psa\CommonBundle\PsaCommonBundle(),
//Forum Bundles
new EWZ\Bundle\TimeBundle\EWZTimeBundle(),
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new CCDNComponent\CommonBundle\CCDNComponentCommonBundle(),
new CCDNComponent\BBCodeBundle\CCDNComponentBBCodeBundle(),
new CCDNComponent\CrumbTrailBundle\CCDNComponentCrumbTrailBundle(),
new CCDNComponent\DashboardBundle\CCDNComponentDashboardBundle(),
new CCDNComponent\AttachmentBundle\CCDNComponentAttachmentBundle(),
new CCDNComponent\MenuBundle\CCDNComponentMenuBundle(),
new CCDNForum\KarmaBundle\CCDNForumKarmaBundle(),
new CCDNUser\UserBundle\CCDNUserUserBundle(),
new CCDNForum\AdminBundle\CCDNForumAdminBundle(),
new CCDNForum\ForumBundle\CCDNForumForumBundle(),
new CCDNUser\AdminBundle\CCDNUserAdminBundle(),
new EWZ\Bundle\RecaptchaBundle\EWZRecaptchaBundle(),
new CCDNUser\ProfileBundle\CCDNUserProfileBundle(),
new CCDNForum\ModeratorBundle\CCDNForumModeratorBundle(),
new CCDNUser\MemberBundle\CCDNUserMemberBundle(),
new CCDNMessage\MessageBundle\CCDNMessageMessageBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new CoreSphere\ConsoleBundle\CoreSphereConsoleBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
|
psamada2012/psa
|
app/AppKernel.php
|
PHP
|
mit
| 3,052 | 45.938462 | 89 | 0.671583 | false |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DependencyInjection\Dumper;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\DependencyInjection\Scope;
/**
* GraphvizDumper dumps a service container as a graphviz file.
*
* You can convert the generated dot file with the dot utility (http://www.graphviz.org/):
*
* dot -Tpng container.dot > foo.png
*
* @author Fabien Potencier <[email protected]>
*/
class GraphvizDumper extends Dumper
{
private $nodes;
private $edges;
private $options = array(
'graph' => array('ratio' => 'compress'),
'node' => array('fontsize' => 11, 'fontname' => 'Arial', 'shape' => 'record'),
'edge' => array('fontsize' => 9, 'fontname' => 'Arial', 'color' => 'grey', 'arrowhead' => 'open', 'arrowsize' => 0.5),
'node.instance' => array('fillcolor' => '#9999ff', 'style' => 'filled'),
'node.definition' => array('fillcolor' => '#eeeeee'),
'node.missing' => array('fillcolor' => '#ff9999', 'style' => 'filled'),
);
/**
* Dumps the service container as a graphviz graph.
*
* Available options:
*
* * graph: The default options for the whole graph
* * node: The default options for nodes
* * edge: The default options for edges
* * node.instance: The default options for services that are defined directly by object instances
* * node.definition: The default options for services that are defined via service definition instances
* * node.missing: The default options for missing services
*
* @param array $options An array of options
*
* @return string The dot representation of the service container
*/
public function dump(array $options = array())
{
foreach (array('graph', 'node', 'edge', 'node.instance', 'node.definition', 'node.missing') as $key) {
if (isset($options[$key])) {
$this->options[$key] = array_merge($this->options[$key], $options[$key]);
}
}
$this->nodes = $this->findNodes();
$this->edges = array();
foreach ($this->container->getDefinitions() as $id => $definition) {
$this->edges[$id] = array_merge(
$this->findEdges($id, $definition->getArguments(), true, ''),
$this->findEdges($id, $definition->getProperties(), false, '')
);
foreach ($definition->getMethodCalls() as $call) {
$this->edges[$id] = array_merge(
$this->edges[$id],
$this->findEdges($id, $call[1], false, $call[0].'()')
);
}
}
return $this->startDot().$this->addNodes().$this->addEdges().$this->endDot();
}
/**
* Returns all nodes.
*
* @return string A string representation of all nodes
*/
private function addNodes()
{
$code = '';
foreach ($this->nodes as $id => $node) {
$aliases = $this->getAliases($id);
$code .= sprintf(" node_%s [label=\"%s\\n%s\\n\", shape=%s%s];\n", $this->dotize($id), $id.($aliases ? ' ('.implode(', ', $aliases).')' : ''), $node['class'], $this->options['node']['shape'], $this->addAttributes($node['attributes']));
}
return $code;
}
/**
* Returns all edges.
*
* @return string A string representation of all edges
*/
private function addEdges()
{
$code = '';
foreach ($this->edges as $id => $edges) {
foreach ($edges as $edge) {
$code .= sprintf(" node_%s -> node_%s [label=\"%s\" style=\"%s\"];\n", $this->dotize($id), $this->dotize($edge['to']), $edge['name'], $edge['required'] ? 'filled' : 'dashed');
}
}
return $code;
}
/**
* Finds all edges belonging to a specific service id.
*
* @param string $id The service id used to find edges
* @param array $arguments An array of arguments
* @param bool $required
* @param string $name
*
* @return array An array of edges
*/
private function findEdges($id, $arguments, $required, $name)
{
$edges = array();
foreach ($arguments as $argument) {
if ($argument instanceof Parameter) {
$argument = $this->container->hasParameter($argument) ? $this->container->getParameter($argument) : null;
} elseif (is_string($argument) && preg_match('/^%([^%]+)%$/', $argument, $match)) {
$argument = $this->container->hasParameter($match[1]) ? $this->container->getParameter($match[1]) : null;
}
if ($argument instanceof Reference) {
if (!$this->container->has((string) $argument)) {
$this->nodes[(string) $argument] = array('name' => $name, 'required' => $required, 'class' => '', 'attributes' => $this->options['node.missing']);
}
$edges[] = array('name' => $name, 'required' => $required, 'to' => $argument);
} elseif (is_array($argument)) {
$edges = array_merge($edges, $this->findEdges($id, $argument, $required, $name));
}
}
return $edges;
}
/**
* Finds all nodes.
*
* @return array An array of all nodes
*/
private function findNodes()
{
$nodes = array();
$container = $this->cloneContainer();
foreach ($container->getDefinitions() as $id => $definition) {
$class = $definition->getClass();
if ('\\' === substr($class, 0, 1)) {
$class = substr($class, 1);
}
$nodes[$id] = array('class' => str_replace('\\', '\\\\', $this->container->getParameterBag()->resolveValue($class)), 'attributes' => array_merge($this->options['node.definition'], array('style' => ContainerInterface::SCOPE_PROTOTYPE !== $definition->getScope() ? 'filled' : 'dotted')));
$container->setDefinition($id, new Definition('stdClass'));
}
foreach ($container->getServiceIds() as $id) {
$service = $container->get($id);
if (array_key_exists($id, $container->getAliases())) {
continue;
}
if (!$container->hasDefinition($id)) {
$class = ('service_container' === $id) ? get_class($this->container) : get_class($service);
$nodes[$id] = array('class' => str_replace('\\', '\\\\', $class), 'attributes' => $this->options['node.instance']);
}
}
return $nodes;
}
private function cloneContainer()
{
$parameterBag = new ParameterBag($this->container->getParameterBag()->all());
$container = new ContainerBuilder($parameterBag);
$container->setDefinitions($this->container->getDefinitions());
$container->setAliases($this->container->getAliases());
$container->setResources($this->container->getResources());
foreach ($this->container->getScopes() as $scope => $parentScope) {
$container->addScope(new Scope($scope, $parentScope));
}
foreach ($this->container->getExtensions() as $extension) {
$container->registerExtension($extension);
}
return $container;
}
/**
* Returns the start dot.
*
* @return string The string representation of a start dot
*/
private function startDot()
{
return sprintf("digraph sc {\n %s\n node [%s];\n edge [%s];\n\n",
$this->addOptions($this->options['graph']),
$this->addOptions($this->options['node']),
$this->addOptions($this->options['edge'])
);
}
/**
* Returns the end dot.
*
* @return string
*/
private function endDot()
{
return "}\n";
}
/**
* Adds attributes.
*
* @param array $attributes An array of attributes
*
* @return string A comma separated list of attributes
*/
private function addAttributes($attributes)
{
$code = array();
foreach ($attributes as $k => $v) {
$code[] = sprintf('%s="%s"', $k, $v);
}
return $code ? ', '.implode(', ', $code) : '';
}
/**
* Adds options.
*
* @param array $options An array of options
*
* @return string A space separated list of options
*/
private function addOptions($options)
{
$code = array();
foreach ($options as $k => $v) {
$code[] = sprintf('%s="%s"', $k, $v);
}
return implode(' ', $code);
}
/**
* Dotizes an identifier.
*
* @param string $id The identifier to dotize
*
* @return string A dotized string
*/
private function dotize($id)
{
return strtolower(preg_replace('/\W/i', '_', $id));
}
/**
* Compiles an array of aliases for a specified service id.
*
* @param string $id A service id
*
* @return array An array of aliases
*/
private function getAliases($id)
{
$aliases = array();
foreach ($this->container->getAliases() as $alias => $origin) {
if ($id == $origin) {
$aliases[] = $alias;
}
}
return $aliases;
}
}
|
Harmeko/badass_shop
|
vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php
|
PHP
|
mit
| 10,241 | 32.023256 | 298 | 0.530515 | false |
'use strict';
angular.module('mean.system').directive('googleMaps', ['GoogleMaps', 'Global',
function(GoogleMaps, Global) {
return {
restrict: 'E',
template: '<div id="map" style="height: 600px; width: 100%;"></div>',
controller: function() {
var mapOptions;
if ( GoogleMaps ) {
mapOptions = {
center: new GoogleMaps.LatLng(-34.397, 150.644),
zoom: 14,
mapTypeId: GoogleMaps.MapTypeId.ROADMAP
};
Global.map = new GoogleMaps.Map(document.getElementById('map'), mapOptions);
}
}
};
}]);
|
ezekielriva/bus-locator
|
public/system/directives/google-maps.js
|
JavaScript
|
mit
| 612 | 29.6 | 86 | 0.553922 | false |
#!/bin/sh
set -e
NEEDS_CONFIG=0
if [ "$#" -lt "1" ]; then
echo "Bad usage: check_reconf.sh [target_package] (optional configure arguments)"
exit 1
fi
if [ "$ONYX_ARCH" = "" ]; then
echo "ONYX_ARCH needs to be set!"
exit 1
fi
if [ "$HOST" = "" ]; then
echo "HOST needs to be set!"
exit 1
fi
if [ "$SYSROOT" = "" ]; then
echo "SYSROOT needs to be set!"
exit 1
fi
TARGET_PKG=$1
cd $TARGET_PKG
if [ -f "CONF_STAMP" ]; then
if [ $(cat CONF_STAMP) != "ARCH=${ONYX_ARCH}" ]; then
NEEDS_CONFIG=1
fi
else
NEEDS_CONFIG=1
fi
#echo "Needs conf: ${NEEDS_CONFIG}"
# Shift the arguments by one so we discard the first argument
shift 1
if [ "$NEEDS_CONFIG" = 0 ]; then
exit 0
fi
# Try and make clean/make distclean because some makefiles are kind of buggy **cough cough musl**
if [ -f Makefile ]; then
make distclean || make clean || true
fi
./configure --host=$HOST --with-sysroot=$SYSROOT "$@"
echo "ARCH=${ONYX_ARCH}" > CONF_STAMP
|
heatd/Onyx
|
scripts/check_reconf.sh
|
Shell
|
mit
| 948 | 16.555556 | 97 | 0.64135 | false |
<?php
namespace PxS\PeerReviewingBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/hello/Fabien');
$this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
}
}
|
joekukish/PeerReviewingSuite
|
src/PxS/PeerReviewingBundle/Tests/Controller/DefaultControllerTest.php
|
PHP
|
mit
| 406 | 22.882353 | 90 | 0.679803 | false |
//
// URBSegmentedControl.h
// URBSegmentedControlDemo
//
// Created by Nicholas Shipes on 2/1/13.
// Copyright (c) 2013 Urban10 Interactive. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSUInteger, URBSegmentedControlOrientation) {
URBSegmentedControlOrientationHorizontal = 0,
URBSegmentedControlOrientationVertical
};
typedef NS_ENUM(NSUInteger, URBSegmentViewLayout) {
URBSegmentViewLayoutDefault = 0,
URBSegmentViewLayoutVertical
};
typedef NS_ENUM(NSUInteger, URBSegmentImagePosition) {
URBSegmentImagePositionLeft = 0,
URBSegmentImagePositionRight
};
@interface URBSegmentedControl : UISegmentedControl <UIAppearance>
typedef void (^URBSegmentedControlBlock)(NSInteger index, URBSegmentedControl *segmentedControl);
/**
Layout behavior for the segments (row or columns).
*/
@property (nonatomic) URBSegmentedControlOrientation layoutOrientation;
/**
Layout behavior of the segment contents.
*/
@property (nonatomic) URBSegmentViewLayout segmentViewLayout;
/**
* Position of the image when placed horizontally next to a segment label. Not used for controls containing only text or images.
*/
@property (nonatomic, assign) URBSegmentImagePosition imagePosition;
/**
Block handle called when the selected segment has changed.
*/
@property (nonatomic, copy) URBSegmentedControlBlock controlEventBlock;
/**
Background color for the base container view.
*/
@property (nonatomic, strong) UIColor *baseColor;
@property (nonatomic, strong) UIColor *baseGradient;
/**
Stroke color used around the base container view.
*/
@property (nonatomic, strong) UIColor *strokeColor;
/**
Stroke width for the base container view.
*/
@property (nonatomic, assign) CGFloat strokeWidth;
/**
Corner radius for the base container view.
*/
@property (nonatomic) CGFloat cornerRadius;
/**
Whether or not a gradient should be automatically applied to the base and segment backgrounds based on the defined base colors.
*/
@property (nonatomic, assign) BOOL showsGradient;
/**
Padding between the segments and the base container view.
*/
@property (nonatomic, assign) UIEdgeInsets segmentEdgeInsets;
///----------------------------
/// @name Segment Customization
///----------------------------
@property (nonatomic, strong) UIColor *segmentBackgroundColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *segmentBackgroundGradient UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *imageColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *selectedImageColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, assign) UIEdgeInsets contentEdgeInsets;
@property (nonatomic, assign) UIEdgeInsets titleEdgeInsets;
@property (nonatomic, assign) UIEdgeInsets imageEdgeInsets;
- (id)initWithTitles:(NSArray *)titles;
- (id)initWithIcons:(NSArray *)icons;
- (id)initWithTitles:(NSArray *)titles icons:(NSArray *)icons;
- (void)insertSegmentWithTitle:(NSString *)title image:(UIImage *)image atIndex:(NSUInteger)segment animated:(BOOL)animated;
- (void)setSegmentBackgroundColor:(UIColor *)segmentBackgroundColor atIndex:(NSUInteger)segment;
- (void)setImageColor:(UIColor *)imageColor forState:(UIControlState)state UI_APPEARANCE_SELECTOR;
- (void)setSegmentBackgroundColor:(UIColor *)segmentBackgroundColor UI_APPEARANCE_SELECTOR;
- (void)setControlEventBlock:(URBSegmentedControlBlock)controlEventBlock;
@end
@interface UIImage (URBSegmentedControl)
- (UIImage *)imageTintedWithColor:(UIColor *)color;
@end
|
u10int/URBSegmentedControl
|
URBSegmentedControl.h
|
C
|
mit
| 3,492 | 30.1875 | 129 | 0.77606 | false |
import { Component, OnInit, HostListener, ElementRef } from '@angular/core';
import { Router, NavigationEnd, NavigationExtras } from '@angular/router';
import { AuthService } from '../../services/auth.service';
@Component({
selector: 'app-nav',
templateUrl: 'app-nav.component.html'
})
export class AppNavComponent implements OnInit {
loggedIn: boolean;
menuDropped: boolean;
searchKeyword: string;
constructor(
public auth: AuthService,
private router: Router,
private elementRef: ElementRef
) {
this.router.events.subscribe(event => {
if (event instanceof NavigationEnd) {
this.menuDropped = false;
this.searchKeyword = '';
}
});
this.searchKeyword = '';
}
ngOnInit() {
this.auth.checkLogin();
}
toggleMenu() {
this.menuDropped = !this.menuDropped;
}
logout(): void {
this.auth.logout();
this.menuDropped = false;
}
searchPackages(e: Event): void {
e.preventDefault();
const navigationExtras: NavigationExtras = {
queryParams: { 'keyword': this.searchKeyword }
};
this.router.navigate(['search'], navigationExtras);
}
@HostListener('document:click', ['$event'])
onBlur(e: MouseEvent) {
if (!this.menuDropped) {
return;
}
let toggleBtn = this.elementRef.nativeElement.querySelector('.drop-menu-act');
if (e.target === toggleBtn || toggleBtn.contains(<any>e.target)) {
return;
}
let dropMenu: HTMLElement = this.elementRef.nativeElement.querySelector('.nav-dropdown');
if (dropMenu && dropMenu !== e.target && !dropMenu.contains((<any>e.target))) {
this.menuDropped = false;
}
}
}
|
Izak88/morose
|
src/app/components/app-nav/app-nav.component.ts
|
TypeScript
|
mit
| 1,671 | 23.573529 | 93 | 0.648713 | false |
// Copyright (c) 2011-2013 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "walletview.h"
#include "addressbookpage.h"
#include "askpassphrasedialog.h"
#include "bitcoingui.h"
#include "clientmodel.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "overviewpage.h"
#include "receivecoinsdialog.h"
#include "sendcoinsdialog.h"
#include "signverifymessagedialog.h"
#include "transactiontablemodel.h"
#include "transactionview.h"
#include "walletmodel.h"
#include "miningpage.h"
#include "ui_interface.h"
#include <QAction>
#include <QActionGroup>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QProgressDialog>
#include <QPushButton>
#include <QVBoxLayout>
WalletView::WalletView(QWidget *parent):
QStackedWidget(parent),
clientModel(0),
walletModel(0)
{
// Create tabs
overviewPage = new OverviewPage();
transactionsPage = new QWidget(this);
QVBoxLayout *vbox = new QVBoxLayout();
QHBoxLayout *hbox_buttons = new QHBoxLayout();
transactionView = new TransactionView(this);
vbox->addWidget(transactionView);
QPushButton *exportButton = new QPushButton(tr("&Export"), this);
exportButton->setToolTip(tr("Export the data in the current tab to a file"));
#ifndef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
exportButton->setIcon(QIcon(":/icons/export"));
#endif
hbox_buttons->addStretch();
hbox_buttons->addWidget(exportButton);
vbox->addLayout(hbox_buttons);
transactionsPage->setLayout(vbox);
receiveCoinsPage = new ReceiveCoinsDialog();
sendCoinsPage = new SendCoinsDialog();
miningPage = new MiningPage();
addWidget(overviewPage);
addWidget(transactionsPage);
addWidget(receiveCoinsPage);
addWidget(sendCoinsPage);
addWidget(miningPage);
// Clicking on a transaction on the overview pre-selects the transaction on the transaction history page
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
// Double-clicking on a transaction on the transaction history page shows details
connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));
// Clicking on "Export" allows to export the transaction list
connect(exportButton, SIGNAL(clicked()), transactionView, SLOT(exportClicked()));
// Pass through messages from sendCoinsPage
connect(sendCoinsPage, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
// Pass through messages from transactionView
connect(transactionView, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
}
WalletView::~WalletView()
{
}
void WalletView::setBitcoinGUI(BitcoinGUI *gui)
{
if (gui)
{
// Clicking on a transaction on the overview page simply sends you to transaction history page
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), gui, SLOT(gotoHistoryPage()));
// Receive and report messages
connect(this, SIGNAL(message(QString,QString,unsigned int)), gui, SLOT(message(QString,QString,unsigned int)));
// Pass through encryption status changed signals
connect(this, SIGNAL(encryptionStatusChanged(int)), gui, SLOT(setEncryptionStatus(int)));
// Pass through transaction notifications
connect(this, SIGNAL(incomingTransaction(QString,int,qint64,QString,QString)), gui, SLOT(incomingTransaction(QString,int,qint64,QString,QString)));
}
}
void WalletView::setClientModel(ClientModel *clientModel)
{
this->clientModel = clientModel;
overviewPage->setClientModel(clientModel);
miningPage->setClientModel(clientModel);
}
void WalletView::setWalletModel(WalletModel *walletModel)
{
this->walletModel = walletModel;
// Put transaction list in tabs
transactionView->setModel(walletModel);
overviewPage->setWalletModel(walletModel);
receiveCoinsPage->setModel(walletModel);
sendCoinsPage->setModel(walletModel);
miningPage->setWalletModel(walletModel);
if (walletModel)
{
// Receive and pass through messages from wallet model
connect(walletModel, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
// Handle changes in encryption status
connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SIGNAL(encryptionStatusChanged(int)));
updateEncryptionStatus();
// Balloon pop-up for new transaction
connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(processNewTransaction(QModelIndex,int,int)));
// Ask for passphrase if needed
connect(walletModel, SIGNAL(requireUnlock()), this, SLOT(unlockWallet()));
// Show progress dialog
connect(walletModel, SIGNAL(showProgress(QString,int)), this, SLOT(showProgress(QString,int)));
}
}
void WalletView::processNewTransaction(const QModelIndex& parent, int start, int /*end*/)
{
// Prevent balloon-spam when initial block download is in progress
if (!walletModel || !clientModel || clientModel->inInitialBlockDownload())
return;
TransactionTableModel *ttm = walletModel->getTransactionTableModel();
QString date = ttm->index(start, TransactionTableModel::Date, parent).data().toString();
qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent).data(Qt::EditRole).toULongLong();
QString type = ttm->index(start, TransactionTableModel::Type, parent).data().toString();
QString address = ttm->index(start, TransactionTableModel::ToAddress, parent).data().toString();
emit incomingTransaction(date, walletModel->getOptionsModel()->getDisplayUnit(), amount, type, address);
}
void WalletView::gotoOverviewPage()
{
setCurrentWidget(overviewPage);
}
void WalletView::gotoHistoryPage()
{
setCurrentWidget(transactionsPage);
}
void WalletView::gotoReceiveCoinsPage()
{
setCurrentWidget(receiveCoinsPage);
}
void WalletView::gotoSendCoinsPage(QString addr)
{
setCurrentWidget(sendCoinsPage);
if (!addr.isEmpty())
sendCoinsPage->setAddress(addr);
}
void WalletView::gotoMiningPage()
{
setCurrentWidget(miningPage);
}
void WalletView::gotoSignMessageTab(QString addr)
{
// calls show() in showTab_SM()
SignVerifyMessageDialog *signVerifyMessageDialog = new SignVerifyMessageDialog(this);
signVerifyMessageDialog->setAttribute(Qt::WA_DeleteOnClose);
signVerifyMessageDialog->setModel(walletModel);
signVerifyMessageDialog->showTab_SM(true);
if (!addr.isEmpty())
signVerifyMessageDialog->setAddress_SM(addr);
}
void WalletView::gotoVerifyMessageTab(QString addr)
{
// calls show() in showTab_VM()
SignVerifyMessageDialog *signVerifyMessageDialog = new SignVerifyMessageDialog(this);
signVerifyMessageDialog->setAttribute(Qt::WA_DeleteOnClose);
signVerifyMessageDialog->setModel(walletModel);
signVerifyMessageDialog->showTab_VM(true);
if (!addr.isEmpty())
signVerifyMessageDialog->setAddress_VM(addr);
}
bool WalletView::handlePaymentRequest(const SendCoinsRecipient& recipient)
{
return sendCoinsPage->handlePaymentRequest(recipient);
}
void WalletView::showOutOfSyncWarning(bool fShow)
{
overviewPage->showOutOfSyncWarning(fShow);
}
void WalletView::updateEncryptionStatus()
{
emit encryptionStatusChanged(walletModel->getEncryptionStatus());
}
void WalletView::encryptWallet(bool status)
{
if(!walletModel)
return;
AskPassphraseDialog dlg(status ? AskPassphraseDialog::Encrypt : AskPassphraseDialog::Decrypt, this);
dlg.setModel(walletModel);
dlg.exec();
updateEncryptionStatus();
}
void WalletView::backupWallet()
{
QString filename = GUIUtil::getSaveFileName(this,
tr("Backup Wallet"), QString(),
tr("Wallet Data (*.dat)"), NULL);
if (filename.isEmpty())
return;
if (!walletModel->backupWallet(filename)) {
emit message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to %1.").arg(filename),
CClientUIInterface::MSG_ERROR);
}
else {
emit message(tr("Backup Successful"), tr("The wallet data was successfully saved to %1.").arg(filename),
CClientUIInterface::MSG_INFORMATION);
}
}
void WalletView::changePassphrase()
{
AskPassphraseDialog dlg(AskPassphraseDialog::ChangePass, this);
dlg.setModel(walletModel);
dlg.exec();
}
void WalletView::unlockWallet()
{
if(!walletModel)
return;
// Unlock wallet when requested by wallet model
if (walletModel->getEncryptionStatus() == WalletModel::Locked)
{
AskPassphraseDialog dlg(AskPassphraseDialog::Unlock, this);
dlg.setModel(walletModel);
dlg.exec();
}
}
void WalletView::usedSendingAddresses()
{
if(!walletModel)
return;
AddressBookPage *dlg = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab, this);
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->setModel(walletModel->getAddressTableModel());
dlg->show();
}
void WalletView::usedReceivingAddresses()
{
if(!walletModel)
return;
AddressBookPage *dlg = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this);
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->setModel(walletModel->getAddressTableModel());
dlg->show();
}
void WalletView::showProgress(const QString &title, int nProgress)
{
if (nProgress == 0)
{
progressDialog = new QProgressDialog(title, "", 0, 100);
progressDialog->setWindowModality(Qt::ApplicationModal);
progressDialog->setMinimumDuration(0);
progressDialog->setCancelButton(0);
progressDialog->setAutoClose(false);
progressDialog->setValue(0);
}
else if (nProgress == 100)
{
if (progressDialog)
{
progressDialog->close();
progressDialog->deleteLater();
}
}
else if (progressDialog)
progressDialog->setValue(nProgress);
}
|
coinkeeper/2015-06-22_19-00_ziftrcoin
|
src/qt/walletview.cpp
|
C++
|
mit
| 10,319 | 31.655063 | 155 | 0.720128 | false |
<?php
return array (
'id' => 'samsung_gt_m5650_ver1',
'fallback' => 'generic_dolfin',
'capabilities' =>
array (
'pointing_method' => 'touchscreen',
'mobile_browser_version' => '1.0',
'uaprof' => 'http://wap.samsungmobile.com/uaprof/GT-M5650.rdf',
'model_name' => 'GT M5650',
'brand_name' => 'Samsung',
'marketing_name' => 'Corby Lindy',
'release_date' => '2010_february',
'softkey_support' => 'true',
'table_support' => 'true',
'wml_1_1' => 'true',
'wml_1_2' => 'true',
'xhtml_support_level' => '3',
'wml_1_3' => 'true',
'columns' => '20',
'rows' => '16',
'max_image_width' => '228',
'resolution_width' => '240',
'resolution_height' => '320',
'max_image_height' => '280',
'jpg' => 'true',
'gif' => 'true',
'bmp' => 'true',
'wbmp' => 'true',
'png' => 'true',
'colors' => '65536',
'nokia_voice_call' => 'true',
'streaming_vcodec_mpeg4_asp' => '0',
'streaming_vcodec_h263_0' => '10',
'streaming_3g2' => 'true',
'streaming_3gpp' => 'true',
'streaming_acodec_amr' => 'nb',
'streaming_vcodec_h264_bp' => '1',
'streaming_video' => 'true',
'streaming_vcodec_mpeg4_sp' => '0',
'wap_push_support' => 'true',
'mms_png' => 'true',
'mms_max_size' => '307200',
'mms_max_width' => '0',
'mms_spmidi' => 'true',
'mms_max_height' => '0',
'mms_gif_static' => 'true',
'mms_wav' => 'true',
'mms_vcard' => 'true',
'mms_midi_monophonic' => 'true',
'mms_bmp' => 'true',
'mms_wbmp' => 'true',
'mms_amr' => 'true',
'mms_jpeg_baseline' => 'true',
'aac' => 'true',
'sp_midi' => 'true',
'mp3' => 'true',
'amr' => 'true',
'midi_monophonic' => 'true',
'imelody' => 'true',
'j2me_midp_2_0' => 'true',
'j2me_cldc_1_0' => 'true',
'j2me_cldc_1_1' => 'true',
'j2me_midp_1_0' => 'true',
'wifi' => 'true',
'max_data_rate' => '3600',
'directdownload_support' => 'true',
'oma_support' => 'true',
'oma_v_1_0_separate_delivery' => 'true',
'image_inlining' => 'true',
),
);
|
cuckata23/wurfl-data
|
data/samsung_gt_m5650_ver1.php
|
PHP
|
mit
| 2,098 | 28.138889 | 67 | 0.498093 | false |
<?php
/**
* File: SimpleImage.php
* Author: Simon Jarvis
* Modified by: Miguel Fermín
* Based in: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
* http://www.gnu.org/licenses/gpl.html
*/
class Image_compression_helper {
public $image;
public $image_type;
public function __construct($filename = null) {
if (!empty($filename)) {
$this->load($filename);
}
}
public function load($filename) {
$image_info = getimagesize($filename);
$this->image_type = $image_info[2];
if ($this->image_type == IMAGETYPE_JPEG) {
$this->image = imagecreatefromjpeg($filename);
} elseif ($this->image_type == IMAGETYPE_GIF) {
$this->image = imagecreatefromgif($filename);
} elseif ($this->image_type == IMAGETYPE_PNG) {
$this->image = imagecreatefrompng($filename);
} else {
throw new Exception("The file you're trying to open is not supported");
}
}
public function example($url) {
// Usage:
// Load the original image
$image = new SimpleImage($url);
// Resize the image to 600px width and the proportional height
$image->resizeToWidth(600);
$image->save('lemon_resized.jpg');
// Create a squared version of the image
$image->square(200);
$image->save('lemon_squared.jpg');
// Scales the image to 75%
$image->scale(75);
$image->save('lemon_scaled.jpg');
// Resize the image to specific width and height
$image->resize(80, 60);
$image->save('lemon_resized2.jpg');
// Resize the canvas and fill the empty space with a color of your choice
$image->maxareafill(600, 400, 32, 39, 240);
$image->save('lemon_filled.jpg');
// Output the image to the browser:
$image->output();
}
public function save($filename, $image_type = IMAGETYPE_JPEG, $compression = 75, $permissions = null) {
if ($image_type == IMAGETYPE_JPEG) {
imagejpeg($this->image, $filename, $compression);
} elseif ($image_type == IMAGETYPE_GIF) {
imagegif($this->image, $filename);
} elseif ($image_type == IMAGETYPE_PNG) {
imagepng($this->image, $filename);
}
if ($permissions != null) {
chmod($filename, $permissions);
}
}
public function output($image_type = IMAGETYPE_JPEG, $quality = 80) {
if ($image_type == IMAGETYPE_JPEG) {
header("Content-type: image/jpeg");
imagejpeg($this->image, null, $quality);
} elseif ($image_type == IMAGETYPE_GIF) {
header("Content-type: image/gif");
imagegif($this->image);
} elseif ($image_type == IMAGETYPE_PNG) {
header("Content-type: image/png");
imagepng($this->image);
}
}
public function getWidth() {
return imagesx($this->image);
}
public function getHeight() {
return imagesy($this->image);
}
public function resizeToHeight($height) {
$ratio = $height / $this->getHeight();
$width = round($this->getWidth() * $ratio);
$this->resize($width, $height);
}
public function resizeToWidth($width) {
$ratio = $width / $this->getWidth();
$height = round($this->getHeight() * $ratio);
$this->resize($width, $height);
}
public function square($size) {
$new_image = imagecreatetruecolor($size, $size);
if ($this->getWidth() > $this->getHeight()) {
$this->resizeToHeight($size);
imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));
imagealphablending($new_image, false);
imagesavealpha($new_image, true);
imagecopy($new_image, $this->image, 0, 0, ($this->getWidth() - $size) / 2, 0, $size, $size);
} else {
$this->resizeToWidth($size);
imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));
imagealphablending($new_image, false);
imagesavealpha($new_image, true);
imagecopy($new_image, $this->image, 0, 0, 0, ($this->getHeight() - $size) / 2, $size, $size);
}
$this->image = $new_image;
}
public function scale($scale) {
$width = $this->getWidth() * $scale / 100;
$height = $this->getHeight() * $scale / 100;
$this->resize($width, $height);
}
public function resize($width, $height) {
$new_image = imagecreatetruecolor($width, $height);
imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));
imagealphablending($new_image, false);
imagesavealpha($new_image, true);
imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
$this->image = $new_image;
}
public function cut($x, $y, $width, $height) {
$new_image = imagecreatetruecolor($width, $height);
imagecolortransparent($new_image, imagecolorallocate($new_image, 0, 0, 0));
imagealphablending($new_image, false);
imagesavealpha($new_image, true);
imagecopy($new_image, $this->image, 0, 0, $x, $y, $width, $height);
$this->image = $new_image;
}
public function maxarea($width, $height = null) {
$height = $height ? $height : $width;
if ($this->getWidth() > $width) {
$this->resizeToWidth($width);
}
if ($this->getHeight() > $height) {
$this->resizeToheight($height);
}
}
public function minarea($width, $height = null) {
$height = $height ? $height : $width;
if ($this->getWidth() < $width) {
$this->resizeToWidth($width);
}
if ($this->getHeight() < $height) {
$this->resizeToheight($height);
}
}
public function cutFromCenter($width, $height) {
if ($width < $this->getWidth() && $width > $height) {
$this->resizeToWidth($width);
}
if ($height < $this->getHeight() && $width < $height) {
$this->resizeToHeight($height);
}
$x = ($this->getWidth() / 2) - ($width / 2);
$y = ($this->getHeight() / 2) - ($height / 2);
return $this->cut($x, $y, $width, $height);
}
public function maxareafill($width, $height, $red = 0, $green = 0, $blue = 0) {
$this->maxarea($width, $height);
$new_image = imagecreatetruecolor($width, $height);
$color_fill = imagecolorallocate($new_image, $red, $green, $blue);
imagefill($new_image, 0, 0, $color_fill);
imagecopyresampled($new_image, $this->image, floor(($width - $this->getWidth()) / 2), floor(($height - $this->getHeight()) / 2), 0, 0, $this->getWidth(), $this->getHeight(), $this->getWidth(), $this->getHeight()
);
$this->image = $new_image;
}
}
|
ryno888/thehappydog
|
application/helpers/image_compression_helper.php
|
PHP
|
mit
| 7,553 | 33.171946 | 219 | 0.568724 | false |
# == Schema Information
#
# Table name: accounts
#
# id :integer not null, primary key
# type :string default("Account"), not null
# description :string default(""), not null
# currency :string default("USD"), not null
# created_at :datetime not null
# updated_at :datetime not null
# owner_id :integer
# owner_type :string
# standalone :boolean default(FALSE)
# override_fee_percentage :integer
#
# Indexes
#
# index_accounts_on_item_id (owner_id)
# index_accounts_on_item_type (owner_type)
# index_accounts_on_type (type)
#
class Account::SoftwarePublicInterest < Account
end
|
bountysource/core
|
app/models/account/software_public_interest.rb
|
Ruby
|
mit
| 800 | 32.333333 | 73 | 0.52625 | false |
package illume.analysis;
import java.awt.image.BufferedImage;
/* This simple analyser example averages pixel values. */
public class SimpleImageAnalyser<T extends BufferedImage> extends AbstractImageAnalyser<T> {
@Override
public double analyse(T input) {
int sum_r = 0;
int sum_g = 0;
int sum_b = 0;
for (int y = 0; y < input.getHeight(); y++) {
for (int x = 0; x < input.getWidth(); x++) {
final int clr = input.getRGB(x, y);
sum_r += (clr & 0x00ff0000) >> 16;
sum_g += (clr & 0x0000ff00) >> 8;
sum_b += clr & 0x000000ff;
}
}
double sum_rgb = ((sum_r + sum_b + sum_g) / 3.0d);
double avg = sum_rgb / (input.getHeight() * input.getWidth());
// 8-bit RGB
return avg / 255;
}
}
|
HSAR/Illume
|
src/main/java/illume/analysis/SimpleImageAnalyser.java
|
Java
|
mit
| 852 | 31.769231 | 92 | 0.523474 | false |
import { ExtraGlamorousProps } from './glamorous-component'
import {
ViewProperties,
TextStyle,
ViewStyle,
ImageStyle,
TextInputProperties,
ImageProperties,
ScrollViewProps,
TextProperties,
TouchableHighlightProperties,
TouchableNativeFeedbackProperties,
TouchableOpacityProperties,
TouchableWithoutFeedbackProps,
FlatListProperties,
SectionListProperties
} from 'react-native'
export interface NativeComponent {
Image: React.StatelessComponent<
ImageProperties & ExtraGlamorousProps & ImageStyle
>
ScrollView: React.StatelessComponent<
ScrollViewProps & ExtraGlamorousProps & ViewStyle
>
Text: React.StatelessComponent<
TextProperties & ExtraGlamorousProps & TextStyle
>
TextInput: React.StatelessComponent<
TextInputProperties & ExtraGlamorousProps & TextStyle
>
TouchableHighlight: React.StatelessComponent<
TouchableHighlightProperties & ExtraGlamorousProps & ViewStyle
>
TouchableNativeFeedback: React.StatelessComponent<
TouchableNativeFeedbackProperties & ExtraGlamorousProps & ViewStyle
>
TouchableOpacity: React.StatelessComponent<
TouchableOpacityProperties & ExtraGlamorousProps & ViewStyle
>
TouchableWithoutFeedback: React.StatelessComponent<
TouchableWithoutFeedbackProps & ExtraGlamorousProps & ViewStyle
>
View: React.StatelessComponent<
ViewProperties & ExtraGlamorousProps & ViewStyle
>
FlatList: React.StatelessComponent<
FlatListProperties<any> & ExtraGlamorousProps & ViewStyle
>
SectionList: React.StatelessComponent<
SectionListProperties<any> & ExtraGlamorousProps & ViewStyle
>
}
|
robinpowered/glamorous-native
|
typings/built-in-glamorous-components.d.ts
|
TypeScript
|
mit
| 1,623 | 29.055556 | 71 | 0.794824 | false |
var express = require('../')
, Router = express.Router
, request = require('./support/http')
, methods = require('methods')
, assert = require('assert');
describe('Router', function(){
var router, app;
beforeEach(function(){
router = new Router;
app = express();
})
describe('.match(method, url, i)', function(){
it('should match based on index', function(){
router.route('get', '/foo', function(){});
router.route('get', '/foob?', function(){});
router.route('get', '/bar', function(){});
var method = 'GET';
var url = '/foo?bar=baz';
var route = router.match(method, url, 0);
route.constructor.name.should.equal('Route');
route.method.should.equal('get');
route.path.should.equal('/foo');
var route = router.match(method, url, 1);
route.path.should.equal('/foob?');
var route = router.match(method, url, 2);
assert(!route);
url = '/bar';
var route = router.match(method, url);
route.path.should.equal('/bar');
})
})
describe('.matchRequest(req, i)', function(){
it('should match based on index', function(){
router.route('get', '/foo', function(){});
router.route('get', '/foob?', function(){});
router.route('get', '/bar', function(){});
var req = { method: 'GET', url: '/foo?bar=baz' };
var route = router.matchRequest(req, 0);
route.constructor.name.should.equal('Route');
route.method.should.equal('get');
route.path.should.equal('/foo');
var route = router.matchRequest(req, 1);
req._route_index.should.equal(1);
route.path.should.equal('/foob?');
var route = router.matchRequest(req, 2);
assert(!route);
req.url = '/bar';
var route = router.matchRequest(req);
route.path.should.equal('/bar');
})
})
describe('.middleware', function(){
it('should dispatch', function(done){
router.route('get', '/foo', function(req, res){
res.send('foo');
});
app.use(router.middleware);
request(app)
.get('/foo')
.expect('foo', done);
})
})
describe('.multiple callbacks', function(){
it('should throw if a callback is null', function(){
assert.throws(function () {
router.route('get', '/foo', null, function(){});
})
})
it('should throw if a callback is undefined', function(){
assert.throws(function () {
router.route('get', '/foo', undefined, function(){});
})
})
it('should throw if a callback is not a function', function(){
assert.throws(function () {
router.route('get', '/foo', 'not a function', function(){});
})
})
it('should not throw if all callbacks are functions', function(){
router.route('get', '/foo', function(){}, function(){});
})
})
describe('.all', function() {
it('should support using .all to capture all http verbs', function() {
var router = new Router();
router.all('/foo', function(){});
var url = '/foo?bar=baz';
methods.forEach(function testMethod(method) {
var route = router.match(method, url);
route.constructor.name.should.equal('Route');
route.method.should.equal(method);
route.path.should.equal('/foo');
});
})
})
})
|
Mitdasein/AngularBlogGitHub
|
mongodb/visionmedia-express-7724fc6/test/Router.js
|
JavaScript
|
mit
| 3,342 | 26.619835 | 74 | 0.567624 | false |
#include "EventQueueThread.h"
|
InfiniteInteractive/LimitlessSDK
|
sdk/Utilities/eventQueueThread.cpp
|
C++
|
mit
| 30 | 29 | 29 | 0.8 | false |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>slickgrid-colfix-plugin example</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../bower_components/slickgrid/slick.grid.css" type="text/css" />
<link rel="stylesheet" href="../bower_components/slickgrid/css/smoothness/jquery-ui-1.8.16.custom.css" type="text/css" />
<link rel="stylesheet" href="../bower_components/slickgrid/examples/examples.css" type="text/css" />
<style>
body {margin: 0;}
.grid {background: white; outline: 0; border: 1px solid gray;}
.slick-row.active {background-color: #fcc;}
.idx {background-color: #f2f2f2; border-right: 1px solid #aaa; text-align: right; font-size: 0.8em; padding-right: 8px;}
</style>
</head>
<body>
<div id="my-grid" class="grid" style="width: 800px; height: 400px"></div>
<script src="../bower_components/slickgrid/lib/jquery-1.7.min.js"></script>
<script src="../bower_components/slickgrid/lib/jquery-ui-1.8.16.custom.min.js"></script>
<script src="../bower_components/slickgrid/lib/jquery.event.drag-2.2.js"></script>
<script src="../bower_components/slickgrid/slick.core.js"></script>
<script src="../bower_components/slickgrid/slick.grid.js"></script>
<script src="../dist/slick.colfix.js"></script>
<script>
/** columns defination */
var columns = [
{id: '#', name: '', field: 'idx', width: 50, cssClass: 'idx'},
{id: 'col1', name: 'col 1', field: 'col1', width: 50},
{id: 'col2', name: 'col 2', field: 'col2', width: 80},
{id: 'col3', name: 'col 3', field: 'col3', width: 100},
{id: 'col4', name: 'col 4', field: 'col4', width: 200},
{id: 'col5', name: 'col 5', field: 'col5', width: 50},
{id: 'col6', name: 'col 6', field: 'col6', width: 300},
{id: 'col7', name: 'col 7', field: 'col7', width: 100},
{id: 'col8', name: 'col 8', field: 'col8', width: 200},
{id: 'col9', name: 'col 9', field: 'col9', width: 100}
];
/** grid options */
var options = {
enableColumnReorder: false,
explicitInitialization: true
};
/** data */
var data = [];
for (var i = 0; i < 500; i++) {
data[i] = {
idx: i,
col1: 'col 1-' + i,
col2: 'col 2-' + i,
col3: 'col 3-' + i,
col4: 'col 4-' + i,
col5: 'col 5-' + i,
col6: 'col 6-' + i,
col7: 'col 7-' + i,
col8: 'col 8-' + i,
col9: 'col 9-' + i
};
}
/** SlickGrid */
var grid = new Slick.Grid('#my-grid', data, columns, options);
// register colfix plguin
grid.registerPlugin(new Slick.Plugins.ColFix('#'));
// initialize
grid.init();
</script>
</body>
</html>
|
keik/slickgrid-colfix-plugin
|
examples/basic-explicitinit.html
|
HTML
|
mit
| 2,886 | 36 | 126 | 0.548164 | false |
using Foundation;
using System;
using System.Linq;
using UIKit;
namespace UICatalog
{
public partial class BaseSearchController : UITableViewController, IUISearchResultsUpdating
{
private const string CellIdentifier = "searchResultsCell";
private readonly string[] allItems =
{
"Here's", "to", "the", "crazy", "ones.", "The", "misfits.", "The", "rebels.",
"The", "troublemakers.", "The", "round", "pegs", "in", "the", "square", "holes.", "The", "ones", "who",
"see", "things", "differently.", "They're", "not", "fond", "of", @"rules.", "And", "they", "have", "no",
"respect", "for", "the", "status", "quo.", "You", "can", "quote", "them,", "disagree", "with", "them,",
"glorify", "or", "vilify", "them.", "About", "the", "only", "thing", "you", "can't", "do", "is", "ignore",
"them.", "Because", "they", "change", "things.", "They", "push", "the", "human", "race", "forward.",
"And", "while", "some", "may", "see", "them", "as", "the", "crazy", "ones,", "we", "see", "genius.",
"Because", "the", "people", "who", "are", "crazy", "enough", "to", "think", "they", "can", "change",
"the", "world,", "are", "the", "ones", "who", "do."
};
private string[] items;
private string query;
public BaseSearchController(IntPtr handle) : base(handle) { }
public override void ViewDidLoad()
{
base.ViewDidLoad();
items = allItems;
}
protected void ApplyFilter(string filter)
{
query = filter;
items = string.IsNullOrEmpty(query) ? allItems : allItems.Where(s => s.Contains(query)).ToArray();
TableView.ReloadData();
}
public override nint RowsInSection(UITableView tableView, nint section)
{
return items.Length;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.DequeueReusableCell(CellIdentifier, indexPath);
cell.TextLabel.Text = items[indexPath.Row];
return cell;
}
#region IUISearchResultsUpdating
[Export("updateSearchResultsForSearchController:")]
public void UpdateSearchResultsForSearchController(UISearchController searchController)
{
// UpdateSearchResultsForSearchController is called when the controller is being dismissed
// to allow those who are using the controller they are search as the results controller a chance to reset their state.
// No need to update anything if we're being dismissed.
if (searchController.Active)
{
ApplyFilter(searchController.SearchBar.Text);
}
}
#endregion
}
}
|
xamarin/monotouch-samples
|
UICatalog/UICatalog/Controllers/Search/SearchControllers/BaseSearchController.cs
|
C#
|
mit
| 2,884 | 37.986486 | 131 | 0.568308 | false |
//
// AppDelegate.h
// DecoratorPattern
//
// Created by Vito on 13-11-15.
// Copyright (c) 2013年 Vito. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
vitoziv/DesignPatternObjc
|
DecoratorPattern/DecoratorPattern/AppDelegate.h
|
C
|
mit
| 276 | 17.266667 | 60 | 0.708029 | false |
<?php
/**
* This file is part of the Cubiche package.
*
* Copyright (c) Cubiche
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cubiche\Core\EventDispatcher;
use Cubiche\Core\Bus\MessageInterface;
/**
* Event interface.
*
* @author Ivannis Suárez Jerez <[email protected]>
*/
interface EventInterface extends MessageInterface
{
/**
* Stop event propagation.
*
* @return $this
*/
public function stopPropagation();
/**
* Check whether propagation was stopped.
*
* @return bool
*/
public function isPropagationStopped();
/**
* Get the event name.
*
* @return string
*/
public function eventName();
}
|
cubiche/cubiche
|
src/Cubiche/Core/EventDispatcher/EventInterface.php
|
PHP
|
mit
| 799 | 17.55814 | 74 | 0.641604 | false |
<?php
namespace Kordy\Ticketit\Controllers;
use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use Kordy\Ticketit\Models\Agent;
use Kordy\Ticketit\Models\Setting;
use Kordy\Ticketit\Seeds\SettingsTableSeeder;
use Kordy\Ticketit\Seeds\TicketitTableSeeder;
class InstallController extends Controller
{
public $migrations_tables = [];
public function __construct()
{
$migrations = \File::files(dirname(dirname(__FILE__)).'/Migrations');
foreach ($migrations as $migration) {
$this->migrations_tables[] = basename($migration, '.php');
}
}
public function publicAssets()
{
$public = $this->allFilesList(public_path('vendor/ticketit'));
$assets = $this->allFilesList(base_path('vendor/kordy/ticketit/src/Public'));
if ($public !== $assets) {
Artisan::call('vendor:publish', [
'--provider' => 'Kordy\\Ticketit\\TicketitServiceProvider',
'--tag' => ['public'],
]);
}
}
/*
* Initial install form
*/
public function index()
{
// if all migrations are not yet installed or missing settings table,
// then start the initial install with admin and master template choices
if (count($this->migrations_tables) == count($this->inactiveMigrations())
|| in_array('2015_10_08_123457_create_settings_table', $this->inactiveMigrations())
) {
$views_files_list = $this->viewsFilesList('../resources/views/') + ['another' => trans('ticketit::install.another-file')];
$inactive_migrations = $this->inactiveMigrations();
$users_list = User::lists('first_name', 'id')->toArray();
return view('ticketit::install.index', compact('views_files_list', 'inactive_migrations', 'users_list'));
}
// other than that, Upgrade to a new version, installing new migrations and new settings slugs
if (Agent::isAdmin()) {
$inactive_migrations = $this->inactiveMigrations();
$inactive_settings = $this->inactiveSettings();
return view('ticketit::install.upgrade', compact('inactive_migrations', 'inactive_settings'));
}
\Log::emergency('Ticketit needs upgrade, admin should login and visit ticketit-install to activate the upgrade');
throw new \Exception('Ticketit needs upgrade, admin should login and visit ticketit install route');
}
/*
* Do all pre-requested setup
*/
public function setup(Request $request)
{
$master = $request->master;
if ($master == 'another') {
$another_file = $request->other_path;
$views_content = strstr(substr(strstr($another_file, 'views/'), 6), '.blade.php', true);
$master = str_replace('/', '.', $views_content);
}
$this->initialSettings($master);
$admin_id = $request->admin_id;
$admin = User::find($admin_id);
$admin->ticketit_admin = true;
$admin->save();
return redirect('/'.Setting::grab('main_route'));
}
/*
* Do version upgrade
*/
public function upgrade()
{
if (Agent::isAdmin()) {
$this->initialSettings();
return redirect('/'.Setting::grab('main_route'));
}
\Log::emergency('Ticketit upgrade path access: Only admin is allowed to upgrade');
throw new \Exception('Ticketit upgrade path access: Only admin is allowed to upgrade');
}
/*
* Initial installer to install migrations, seed default settings, and configure the master_template
*/
public function initialSettings($master = false)
{
$inactive_migrations = $this->inactiveMigrations();
if ($inactive_migrations) { // If a migration is missing, do the migrate
Artisan::call('vendor:publish', [
'--provider' => 'Kordy\\Ticketit\\TicketitServiceProvider',
'--tag' => ['db'],
]);
Artisan::call('migrate');
$this->settingsSeeder($master);
// if this is the first install of the html editor, seed old posts text to the new html column
if (in_array('2016_01_15_002617_add_htmlcontent_to_ticketit_and_comments', $inactive_migrations)) {
Artisan::call('ticketit:htmlify');
}
} elseif ($this->inactiveSettings()) { // new settings to be installed
$this->settingsSeeder($master);
}
\Cache::forget('settings');
}
/**
* Run the settings table seeder.
*
* @param string $master
*/
public function settingsSeeder($master = false)
{
$cli_path = 'config/ticketit.php'; // if seeder run from cli, use the cli path
$provider_path = '../config/ticketit.php'; // if seeder run from provider, use the provider path
$config_settings = [];
$settings_file_path = false;
if (File::isFile($cli_path)) {
$settings_file_path = $cli_path;
} elseif (File::isFile($provider_path)) {
$settings_file_path = $provider_path;
}
if ($settings_file_path) {
$config_settings = include $settings_file_path;
File::move($settings_file_path, $settings_file_path.'.backup');
}
$seeder = new SettingsTableSeeder();
if ($master) {
$config_settings['master_template'] = $master;
}
$seeder->config = $config_settings;
$seeder->run();
}
/**
* Get list of all files in the views folder.
*
* @return mixed
*/
public function viewsFilesList($dir_path)
{
$dir_files = File::files($dir_path);
$files = [];
foreach ($dir_files as $file) {
$path = basename($file);
$name = strstr(basename($file), '.', true);
$files[$name] = $path;
}
return $files;
}
/**
* Get list of all files in the views folder.
*
* @return mixed
*/
public function allFilesList($dir_path)
{
$files = [];
if (File::exists($dir_path)) {
$dir_files = File::allFiles($dir_path);
foreach ($dir_files as $file) {
$path = basename($file);
$name = strstr(basename($file), '.', true);
$files[$name] = $path;
}
}
return $files;
}
/**
* Get all Ticketit Package migrations that were not migrated.
*
* @return array
*/
public function inactiveMigrations()
{
$inactiveMigrations = [];
$migration_arr = [];
// Package Migrations
$tables = $this->migrations_tables;
// Application active migrations
$migrations = DB::select('select * from migrations');
foreach ($migrations as $migration_parent) { // Count active package migrations
$migration_arr [] = $migration_parent->migration;
}
foreach ($tables as $table) {
if (!in_array($table, $migration_arr)) {
$inactiveMigrations [] = $table;
}
}
return $inactiveMigrations;
}
/**
* Check if all Ticketit Package settings that were not installed to setting table.
*
* @return bool
*/
public function inactiveSettings()
{
$seeder = new SettingsTableSeeder();
// Package Settings
$installed_settings = DB::table('ticketit_settings')->lists('value', 'slug');
// Application active migrations
$default_Settings = $seeder->getDefaults();
if (count($installed_settings) == count($default_Settings)) {
return false;
}
$inactive_settings = array_diff_key($default_Settings, $installed_settings);
return $inactive_settings;
}
/**
* Generate demo users, agents, and tickets.
*
* @return \Illuminate\Http\RedirectResponse
*/
public function demoDataSeeder()
{
$seeder = new TicketitTableSeeder();
$seeder->run();
session()->flash('status', 'Demo tickets, users, and agents are seeded!');
return redirect()->action('\Kordy\Ticketit\Controllers\TicketsController@index');
}
}
|
maxvishnja/ticketsystem
|
src/Controllers/InstallController.php
|
PHP
|
mit
| 8,480 | 31 | 134 | 0.573585 | false |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>V8 API Reference Guide for node.js v7.2.1: v8::Maybe< T > Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v7.2.1
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="inherits.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1Maybe.html">Maybe</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="#friends">Friends</a> |
<a href="classv8_1_1Maybe-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">v8::Maybe< T > Class Template Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include <<a class="el" href="v8_8h_source.html">v8.h</a>></code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a486b608c21c8038d5019bd7d75866345"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a486b608c21c8038d5019bd7d75866345"></a>
V8_INLINE bool </td><td class="memItemRight" valign="bottom"><b>IsNothing</b> () const </td></tr>
<tr class="separator:a486b608c21c8038d5019bd7d75866345"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:adc82dc945891060d312fb6fbf8fb56ae"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adc82dc945891060d312fb6fbf8fb56ae"></a>
V8_INLINE bool </td><td class="memItemRight" valign="bottom"><b>IsJust</b> () const </td></tr>
<tr class="separator:adc82dc945891060d312fb6fbf8fb56ae"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4959bad473c4549048c1d2271a1a73e0"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4959bad473c4549048c1d2271a1a73e0"></a>
V8_INLINE T </td><td class="memItemRight" valign="bottom"><b>ToChecked</b> () const </td></tr>
<tr class="separator:a4959bad473c4549048c1d2271a1a73e0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae2e1c6d0bd1ab5ff8de22a312c4dbb37"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae2e1c6d0bd1ab5ff8de22a312c4dbb37"></a>
V8_WARN_UNUSED_RESULT V8_INLINE bool </td><td class="memItemRight" valign="bottom"><b>To</b> (T *out) const </td></tr>
<tr class="separator:ae2e1c6d0bd1ab5ff8de22a312c4dbb37"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a02b19d7fcb7744d8dba3530ef8e14c8c"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a02b19d7fcb7744d8dba3530ef8e14c8c"></a>
V8_INLINE T </td><td class="memItemRight" valign="bottom"><b>FromJust</b> () const </td></tr>
<tr class="separator:a02b19d7fcb7744d8dba3530ef8e14c8c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0bcb5fb0d0e92a3f0cc546f11068a8df"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0bcb5fb0d0e92a3f0cc546f11068a8df"></a>
V8_INLINE T </td><td class="memItemRight" valign="bottom"><b>FromMaybe</b> (const T &default_value) const </td></tr>
<tr class="separator:a0bcb5fb0d0e92a3f0cc546f11068a8df"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:adf61111c2da44e10ba5ab546a9a525ce"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adf61111c2da44e10ba5ab546a9a525ce"></a>
V8_INLINE bool </td><td class="memItemRight" valign="bottom"><b>operator==</b> (const <a class="el" href="classv8_1_1Maybe.html">Maybe</a> &other) const </td></tr>
<tr class="separator:adf61111c2da44e10ba5ab546a9a525ce"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5bbacc606422d7ab327c2683462342ec"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5bbacc606422d7ab327c2683462342ec"></a>
V8_INLINE bool </td><td class="memItemRight" valign="bottom"><b>operator!=</b> (const <a class="el" href="classv8_1_1Maybe.html">Maybe</a> &other) const </td></tr>
<tr class="separator:a5bbacc606422d7ab327c2683462342ec"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:aeb9593e125b42d748acbd69b72c89f37"><td class="memTemplParams" colspan="2"><a class="anchor" id="aeb9593e125b42d748acbd69b72c89f37"></a>
template<class U > </td></tr>
<tr class="memitem:aeb9593e125b42d748acbd69b72c89f37"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="classv8_1_1Maybe.html">Maybe</a>< U > </td><td class="memTemplItemRight" valign="bottom"><b>Nothing</b> ()</td></tr>
<tr class="separator:aeb9593e125b42d748acbd69b72c89f37"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aeff0e7fedd63cfebe9a5286e2cd8552d"><td class="memTemplParams" colspan="2"><a class="anchor" id="aeff0e7fedd63cfebe9a5286e2cd8552d"></a>
template<class U > </td></tr>
<tr class="memitem:aeff0e7fedd63cfebe9a5286e2cd8552d"><td class="memTemplItemLeft" align="right" valign="top"><a class="el" href="classv8_1_1Maybe.html">Maybe</a>< U > </td><td class="memTemplItemRight" valign="bottom"><b>Just</b> (const U &u)</td></tr>
<tr class="separator:aeff0e7fedd63cfebe9a5286e2cd8552d"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template<class T><br />
class v8::Maybe< T ></h3>
<p>A simple <a class="el" href="classv8_1_1Maybe.html">Maybe</a> type, representing an object which may or may not have a value, see <a href="https://hackage.haskell.org/package/base/docs/Data-Maybe.html">https://hackage.haskell.org/package/base/docs/Data-Maybe.html</a>.</p>
<p>If an API method returns a Maybe<>, the API method can potentially fail either because an exception is thrown, or because an exception is pending, e.g. because a previous API call threw an exception that hasn't been caught yet, or because a TerminateExecution exception was thrown. In that case, a "Nothing" value is returned. </p>
</div><hr/>The documentation for this class was generated from the following file:<ul>
<li>deps/v8/include/<a class="el" href="v8_8h_source.html">v8.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
|
v8-dox/v8-dox.github.io
|
03b1c31/html/classv8_1_1Maybe.html
|
HTML
|
mit
| 10,130 | 63.522293 | 340 | 0.692991 | false |
package com.covoex.qarvox;
import com.covoex.qarvox.Application.BasicFunction;
/**
* @author Myeongjun Kim
*/
public class Main {
public static void main(String[] args) {
BasicFunction.programStart();
}
}
|
Covoex/Qarvox
|
src/main/java/com/covoex/qarvox/Main.java
|
Java
|
mit
| 227 | 15.214286 | 51 | 0.682819 | false |
##  Device Info Plugin for Xamarin
Simple way of getting common device information.
### Setup
* Available on NuGet: http://www.nuget.org/packages/Xam.Plugin.DeviceInfo [](https://www.nuget.org/packages/Xam.Plugin.DeviceInfo/)
* Install into your PCL project and Client projects.
**Platform Support**
|Platform|Supported|Version|
| ------------------- | :-----------: | :------------------: |
|Xamarin.iOS|Yes|iOS 7+|
|Xamarin.iOS Unified|Yes|iOS 7+|
|Xamarin.Android|Yes|API 10+|
|Windows Phone Silverlight|Yes|8.0+|
|Windows Phone RT|Yes|8.1+|
|Windows Store RT|Yes|8.1+|
|Windows 10 UWP|Yes|10+|
|Xamarin.Mac|No||
### API Usage
Call **CrossDeviceInfo.Current** from any project or PCL to gain access to APIs.
**GenerateAppId**
Used to generate a unique Id for your app.
```csharp
/// <summary>
/// Generates a an AppId optionally using the PhoneId a prefix and a suffix and a Guid to ensure uniqueness
///
/// The AppId format is as follows {prefix}guid{phoneid}{suffix}, where parts in {} are optional.
/// </summary>
/// <param name="usingPhoneId">Setting this to true adds the device specific id to the AppId (remember to give the app the correct permissions)</param>
/// <param name="prefix">Sets the prefix of the AppId</param>
/// <param name="suffix">Sets the suffix of the AppId</param>
/// <returns></returns>
string GenerateAppId(bool usingPhoneId = false, string prefix = null, string suffix = null);
```
**Id**
```csharp
/// <summary>
/// This is the device specific Id (remember the correct permissions in your app to use this)
/// </summary>
string Id { get; }
```
Important:
Windows Phone:
Permissions to add:
ID_CAP_IDENTITY_DEVICE
**Device Model**
```csharp
/// <summary>
/// Get the model of the device
/// </summary>
string Model { get; }
```
**Version**
```csharp
/// <summary>
/// Get the version of the Operating System
/// </summary>
string Version { get; }
```
Returns the specific version number of the OS such as:
* iOS: 8.1
* Android: 4.4.4
* Windows Phone: 8.10.14219.0
* WinRT: always 8.1 until there is a work around
**Platform**
```csharp
/// <summary>
/// Get the platform of the device
/// </summary>
Platform Platform { get; }
```
Returns the Platform Enum of:
```csharp
public enum Platform
{
Android,
iOS,
WindowsPhone,
Windows
}
```
#### Contributors
* [jamesmontemagno](https://github.com/jamesmontemagno)
Thanks!
#### License
Dirived from: [@Cheesebaron](http://www.github.com/cheesebaron)
//---------------------------------------------------------------------------------
// Copyright 2013 Tomasz Cielecki ([email protected])
// 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
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
// INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR
// CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
// MERCHANTABLITY OR NON-INFRINGEMENT.
// See the Apache 2 License for the specific language governing
// permissions and limitations under the License.
//---------------------------------------------------------------------------------
|
monostefan/Xamarin.Plugins
|
DeviceInfo/README.md
|
Markdown
|
mit
| 3,448 | 27.97479 | 209 | 0.669954 | false |
<?php
/*
Safe sample
input : get the field UserData from the variable $_POST
sanitize : use of ternary condition
construction : concatenation with simple quote
*/
/*Copyright 2015 Bertrand STIVALET
Permission is hereby granted, without written agreement or royalty fee, to
use, copy, modify, and distribute this software and its documentation for
any purpose, provided that the above copyright notice and the following
three paragraphs appear in all copies of this software.
IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT
LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO
OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.*/
$tainted = $_POST['UserData'];
$tainted = $tainted == 'safe1' ? 'safe1' : 'safe2';
$var = http_redirect("pages/'". $tainted . "'.php");
?>
|
stivalet/PHP-Vulnerability-test-suite
|
URF/CWE_601/safe/CWE_601__POST__ternary_white_list__http_redirect_file_id-concatenation_simple_quote.php
|
PHP
|
mit
| 1,220 | 21.611111 | 75 | 0.762295 | false |
-----------------------------------------------------------
-- LibAddonManager.lua
-----------------------------------------------------------
-- Take the global "..." (name, addon) as parameters to
-- initialize an addon object.
--
-- Abin (2014-11-04)
-----------------------------------------------------------
-- API Documentation:
-----------------------------------------------------------
-- addon = LibAddonManager:CreateAddon("name", addon) -- Take over the addon object
-- addon is a table represents your addon object, it contains the following field upon creation:
-- version: string, the value of fileld "## Version" in toc file, or "1.0" if missing
-- numericVersion: number, numeric form of version
-- name: string, name of the addon, same as the toc file name
-- title: string, same as "name" by default but developers may change for different locales
-- player: string, player name
-- realm: string, current realm name
-- faction: string, player faction group in English, either "Alliance" or "Horde"
-- class: string, player class in upper-cased English, "WARRIOR", "MAGE", "PALADIN" etc.
-- race: string, player race in English, "Human", "NightElf", "Troll", etc.
-- guid: string, GUID of the player
-- And the following functions & methods are defined for the object:
-- addon.tcopy(source [, destination]) -- Copy entire table data includes sub-tables from source to destination, return new table
-- addon.tfind(table, value) -- Seach a numeric based table for match value, return index
-- addon.tfind(table, func, ...) -- Seach a numeric based table for match value using defined function, return index, [boolean] func(element, ...)
-- addon:Print("text" [, r, g, b]) -- Prints a message
-- addon:Debug("text") -- Prints a message ONLY if addon.debug is true
-- addon:Initialized() -- Returns whether the addon has been initialized
-- addon:RegisterDB("dbName", hasCharDB) -- "hasCharDB" can be string, in which case char db will be the contents in toc field "SavedVariablesPerCharacter". Non-string type will treated as "name - realm" stored in db["profiles"]
-- addon:VerifyDBVersion(version [, db]) -- Returns true only if value of [db].version is numeric and no smaller than the specified version value
-- addon:RegisterSlashCmd("command1" [, "command2" [, ...]]) -- Register slash commands, no limited numbers
-- addon:RegisterBindingClick(button, "name", "text") -- Set an override binding click to a button, "name" is the binding name, "text" is what appears in the game's "Key Bindings" UI
-- addon:GetCurProfileName() -- Return current profile name string, in format of "name - realm"
-- addob:GetProfileNameList() -- Return a table stores list of profile names { "name1", "name2", ... }
-- addon:GetProfileData("name") -- Return the profile data table specified by "name"
-- addon:CopyProfile("src" [, "dest"]) -- Copy contents from profile "src" to "dest", copy to current profile if "dest" is not specified
-- addon:DeleteProfile("name") -- Delete a profile specified by "name", cannot delete current profile
-- addon:RegisterLocale("name", "locale", data) -- Register a localized string table
-- addon:GetLocale("name", "locale") -- Get a registered string table
-- addon:PopupShowConfirm("text", func, arg1 [, "buttons"]) -- Show a popup dialog without editbox, func(arg1) will be called. "buttons" can be "MB_OK", "MB_OKCANCEL", "MB_YESNO", "MB_ACCEPTCANCEL", "MB_ACCEPTDECLINE"
-- addon:PopupShowAck("text" [, func, arg1]) -- Show an acknowledgement dialog with a fixed "Okay" button
-- addon:PopupShowInput("text", func, arg1, "default" [, wide]) -- Show a popup dialog with editbox for user inputs, func(arg1, "text") will be called. editbox width will be set to 260 if "wide" is true
-- addon:PopupHide() -- Hide the popup dialog shown by this addon
-- addon:EmbedEventObject([ object ]) -- Embeds an object with event-handling capability
-- addon:RegisterEvent("event" [, func])
-- addon:RegisterEvent("event" [, "method"])
-- addon:UnregisterEvent("event")
-- addon:RegisterAllEvents()
-- addon:UnregisterAllEvents()
-- addon:RegisterTick(interval)
-- addon:UnregisterTick()
-- addon:SetInterval(interval)
-- addon:IsTicking()
-- addon:BroadcastEvent("event" [, ...])
-- addon:RegisterEventCallback("event", func [, arg1])
-- addon:BroadcastOptionEvent(option [, ...])
-- addon:RegisterOptionCallback("option", func [, arg1])
-- addon:CreateModule("key", "dbType" [, ...]) -- Create a module using an unique key, "dbType" can be "ACCOUNT", "CHAR" or "ACCOUNT|CHAR", ... can be anything
-- addon:NumModules() -- Return number of modules registered in this addon
-- addon:GetModule(index) -- Get a module specified by index
-- addon:GetModule("key") -- Get a module specified by key string
-- addon:EnumModules(func, ...) -- Enum all modules and call func(module, ...)
-- addon:CallAllModules("method", ...) -- Call all modules' method specified by "method"(STRING), regardless the enable/disable states of the module
-- addon:CallAllEnabledModules("method", ...) -- Call all modules' method specified by "method"(STRING), only enabled modules are involved
-----------------------------------------------------------
-- Callback functions:
-----------------------------------------------------------
-- addon:OnInitialize(db, dbIsNew, chardb, chardbIsNew) -- Called when PLAYER_LOGIN event fires
-- addon:OnModulesInitDone() -- Called after all modules of this addon are initialized done
-- addon:OnTick(elapsed) -- Fires when ticking
-- addon:OnSlashCmd(text) -- Fires when the user types a slash command registered by this addon
-- addon:OnVerifyModule("key", "dbType" [, ...]) -- Called before creates a new module, if this method exists and returns nil/false, the creatiopn fails
-- addon:OnCreateModule(module, "key", ...) -- Called when a new module is created, "..." is what passed in addon:CreateModule
-- addon:OnEvent(event, ...) -- Fires when an event fires and this callback is defined
-- addon:OnEnterCombat() -- Fires when the player enters combat
-- addon:OnLeaveCombat() -- Fires when the player leaves combat
-----------------------------------------------------------
-- Module functions:
-----------------------------------------------------------
-- module:Enable()
-- module:Disable()
-- module:IsEnabled()
-----------------------------------------------------------
-- Module callback functions:
-----------------------------------------------------------
-- module:OnInitialize(db, dbIsNew, chardb, chardbIsNew) -- Fires after the PLAYER_LOGIN event fires, db and chardb are subsets of the addon dbs
-- module:OnEnable() -- Fires when the module is enabled via "module:Enable()"
-- module:OnDisable() -- Fires when the module is disabled via "module:Disable()"
-- module:OnTick(elapsed) -- Fires when ticking
-- module:OnEvent(event, ...) -- Fires when an event fires and this callback is defined
-- module:OnEnterCombat() -- Fires when the player enters combat, only for enabled modules
-- module:OnLeaveCombat() -- Fires when the player leaves combat, only for enabled modules
-----------------------------------------------------------
local type = type
local CreateFrame = CreateFrame
local tinsert = tinsert
local GetAddOnMetadata = GetAddOnMetadata
local tonumber = tonumber
local tostring = tostring
local select = select
local strupper = strupper
local strfind = strfind
local strtrim = strtrim
local wipe = wipe
local ClearOverrideBindings = ClearOverrideBindings
local GetBindingKey = GetBindingKey
local SetOverrideBindingClick = SetOverrideBindingClick
local pairs = pairs
local ipairs = ipairs
local InCombatLockdown = InCombatLockdown
local UnitName = UnitName
local GetRealmName = GetRealmName
local UnitFactionGroup = UnitFactionGroup
local UnitClass = UnitClass
local UnitGUID = UnitGUID
local format = format
local error = error
local StaticPopup_Show = StaticPopup_Show
local StaticPopup_Hide = StaticPopup_Hide
local StaticPopupDialogs = StaticPopupDialogs
local _G = _G
local VERSION = 1.22
local lib = _G.LibAddonManager
if type(lib) == "table" then
local version = lib.version
if type(version) == "number" and version >= VERSION then
return
end
else
lib = {}
_G.LibAddonManager = lib
end
lib.version = VERSION
local PRIVATE = "{62B10A9A-6AF5-40EF-93F6-D7271489AA66}"
local PLAYER_INFO = {}
local PROFILE_NAME
-------------------------------------------------------
-- Library utility function
-------------------------------------------------------
function lib.tcopy(src, dest)
if type(dest) == "table" then
wipe(dest)
else
dest = {}
end
local k, v
for k, v in pairs(src) do
if type(v) == "table" then
dest[k] = lib.tcopy(v)
else
dest[k] = v
end
end
return dest
end
function lib.tfind(t, arg, ...)
if type(t) ~= "table" then
return
end
local funcSearch = type(arg) == "function"
local index, data
for index, data in ipairs(t) do
if funcSearch then
if arg(data, ...) then
return index
end
else
if data == arg then
return index
end
end
end
end
local function Addon_Print(self, msg, r, g, b)
DEFAULT_CHAT_FRAME:AddMessage("|cffffff78"..self.title..":|r "..tostring(msg), r or 0.5, g or 0.75, b or 1)
end
local function Addon_Debug(self, msg)
if self.debug then
Addon_Print(self, msg, 1, 0.5, 0)
end
end
local function Addon_GetCurProfileName(self)
return PROFILE_NAME
end
local function Addon_GetProfileNameList(self)
local list = {}
if self.db and type(self.db.profiles) == "table" then
local name
for name in pairs(self.db.profiles) do
tinsert(list, name)
end
end
return list
end
-- Depreciated
local function Addon_CopyTable(self, ...)
return lib.tcopy(...)
end
local function Addon_GetProfileData(self, profile)
if self.db and type(self.db.profiles) == "table" then
return self.db.profiles[profile]
end
end
local function Addon_CopyProfile(self, source, dest)
if type(source) ~= "string" then
source = Addon_GetCurProfileName(self)
end
if type(dest) ~= "string" then
dest = Addon_GetCurProfileName(self)
end
if source == dest then
return
end
if self.db and type(self.db.profiles) == "table" then
if self.db.profiles[source] then
self.db.profiles[dest] = lib.tcopy(self.db.profiles[source])
end
end
end
local function Addon_DeleteProfile(self, profile)
if self.db and type(self.db.profiles) == "table" and type(profile) == "string" and profile ~= Addon_GetCurProfileName(self) then
self.db.profiles[profile] = nil
end
end
local function Addon_RegisterSlashCmd(self, ...)
local UPPER_NAME = strupper(self.name)
local i
for i = 1, select("#", ...) do
local cmd = select(i, ...)
if type(cmd) == "string" then
if strfind(cmd, "/") ~= 1 then
cmd = "/"..cmd
end
_G["SLASH_"..UPPER_NAME..i] = cmd
end
end
SlashCmdList[UPPER_NAME] = function(text)
if type(self.OnSlashCmd) == "function" then
self:OnSlashCmd(strtrim(text)) -- The addon wants to process the slash command itself
elseif type(self.OnClashCmd) == "function" then
self:OnClashCmd(strtrim(text)) -- The addon wants to process the slash command itself
else
local frame = self.optionFrame or self.optionPage or self.frame
if type(frame) ~= "table" then
return
end
if type(frame.Toggle) == "function" then
frame:Toggle()
elseif type(frame.Open) == "function" then
frame:Open()
elseif frame:IsShown() then
frame:Hide()
else
frame:Show()
end
end
end
end
local function Addon_RegisterDB(self, dbName, hasCharDB)
if type(dbName) ~= "string" then
dbName = nil
end
if dbName then
local private = self[PRIVATE]
private.dbName, private.hasCharDB = dbName, hasCharDB
end
end
local function Addon_RegisterBindingClick(self, button, name, text)
if type(name) ~= "string" or type(button) ~= "table" then
return
end
--local header = "BINDING_HEADER_"..strupper(self.name).."_TITLE"
--if not _G[header] then
-- _G[header] = self.title
--end
if type(text) == "string" then
_G["BINDING_NAME_"..name] = text
end
button.bindingName, button.bindingText = name, text
lib._bindingList[name] = button
end
local function EEO_RegisterEvent(self, event, method)
if type(method) ~= "function" and type(method) ~= "string" then
method = nil
end
local frame = self[PRIVATE].frame
if not frame:IsEventRegistered(event) then
frame:RegisterEvent(event)
end
frame.events[event] = method
end
local function EEO_UnregisterEvent(self, event)
local frame = self[PRIVATE].frame
frame.events[event] = nil
if frame:IsEventRegistered(event) then
frame:UnregisterEvent(event)
end
end
local function EEO_IsEventRegistered(self, event)
return self[PRIVATE].frame:IsEventRegistered(event)
end
local function EEO_RegisterAllEvents(self)
return self[PRIVATE].frame:RegisterAllEvents()
end
local function EEO_UnregisterAllEvents(self)
return self[PRIVATE].frame:UnregisterAllEvents()
end
local function EEO_SetInterval(self, interval)
if type(interval) ~= "number" or interval < 0.2 then
interval = 0.2
end
local frame = self[PRIVATE].frame
frame.elapsed = 0
frame.tickSeconds = interval
end
local function EEO_RegisterTick(self, interval)
EEO_SetInterval(self, interval)
self[PRIVATE].frame:Show()
end
local function EEO_UnregisterTick(self)
local frame = self[PRIVATE].frame
frame:Hide()
frame.tickSeconds = nil
end
local function EEO_IsTicking(self)
return self[PRIVATE].frame:IsShown()
end
local function EEOFrame_OnEvent(self, event, ...)
local object = self.parentObject
if type(object.OnEvent) == "function" then
object:OnEvent(event, ...)
else
local func = self.events[event]
if not func then
func = object[event]
elseif type(func) ~= "function" then -- string, number, etc
func = object[func]
end
if type(func) == "function" then
func(object, ...)
end
end
end
local function EEOFrame_OnUpdate(self, elapsed)
local tickSeconds = self.tickSeconds
if not tickSeconds then
self:Hide()
return
end
local updateElapsed = (self.elapsed or 0) + elapsed
if updateElapsed >= tickSeconds then
local object = self.parentObject
if object.OnTick then
object:OnTick(updateElapsed)
end
updateElapsed = 0
end
self.elapsed = updateElapsed
end
local function Lib_EmbedEventObject(object)
if type(object) ~= "table" then
object = {}
end
local private = lib._SetupTable(object, PRIVATE)
local frame = CreateFrame("Frame")
private.frame = frame
frame.parentObject = object
frame.events = {}
frame:Hide()
frame:SetScript("OnEvent", EEOFrame_OnEvent)
frame:SetScript("OnUpdate", EEOFrame_OnUpdate)
object.RegisterEvent = EEO_RegisterEvent
object.UnregisterEvent = EEO_UnregisterEvent
object.IsEventRegistered = EEO_IsEventRegistered
object.RegisterAllEvents = EEO_RegisterAllEvents
object.UnregisterAllEvents = EEO_UnregisterAllEvents
object.RegisterTick = EEO_RegisterTick
object.UnregisterTick = EEO_UnregisterTick
object.SetInterval = EEO_SetInterval
object.IsTicking = EEO_IsTicking
return object
end
local function BCO_BroadcastEvent(self, event, ...)
local callbacks = self[PRIVATE].broadcastCallbacks[event]
if not callbacks then
return
end
local i
for i = 1, #callbacks do
local arg1 = callbacks[i].arg1
if arg1 then
callbacks[i].func(arg1, ...)
else
callbacks[i].func(...)
end
end
end
local function BCO_RegisterEventCallback(self, event, func, arg1)
if type(event) ~= "string" or type(func) ~= "function" then
return
end
local list = self[PRIVATE].broadcastCallbacks
local callbacks = list[event]
if not callbacks then
callbacks = {}
list[event] = callbacks
end
tinsert(callbacks, { func = func, arg1 = arg1 })
end
local OPTION_EVENT_PREFX = "OnOptionChanged_" -- Option event name prefix
local function BCO_BroadcastOptionEvent(self, option, ...)
if type(option) == "string" then
BCO_BroadcastEvent(self, OPTION_EVENT_PREFX..option, ...)
end
end
local function BCO_RegisterOptionCallback(self, option, func, arg1)
if type(option) == "string" then
BCO_RegisterEventCallback(self, OPTION_EVENT_PREFX..option, func, arg1)
end
end
local function Lib_EmbedBroadcastObject(object)
if type(object) ~= "table" then
object = {}
end
local private = lib._SetupTable(object, PRIVATE)
private.broadcastCallbacks = {}
object.BroadcastEvent = BCO_BroadcastEvent
object.RegisterEventCallback = BCO_RegisterEventCallback
object.BroadcastOptionEvent = BCO_BroadcastOptionEvent
object.RegisterOptionCallback = BCO_RegisterOptionCallback
return object
end
local function Module_IsEnabled(self)
return self[PRIVATE].enabled
end
local function Module_Enable(self)
if Module_IsEnabled(self) then
return
end
self[PRIVATE].enabled = 1
if type(self.OnEnable) == "function" then
self:OnEnable()
end
end
local function Module_Disable(self)
if not Module_IsEnabled(self) then
return
end
self[PRIVATE].enabled = nil
self:UnregisterAllEvents()
self:UnregisterTick()
if type(self.OnDisable) == "function" then
self:OnDisable()
end
end
local function Addon_EnumModules(self, func, ...)
if type(func) == "function" then
local modules = self[PRIVATE].modules
local i
for i = 1, #modules do
func(modules[i], ...)
end
end
end
local function Addon_CallAllModules(self, method, ...)
local modules = self[PRIVATE].modules
local i
for i = 1, #modules do
local module = modules[i]
local func = module[method]
if type(func) == "function" then
func(module, ...)
end
end
end
local function Addon_CallAllEnabledModules(self, method, ...)
local modules = self[PRIVATE].modules
local i
for i = 1, #modules do
local module = modules[i]
if Module_IsEnabled(module) then
local func = module[method]
if type(func) == "function" then
func(module, ...)
end
end
end
end
local function Addon_GetModule(self, key)
local modules = self[PRIVATE].modules
if type(key) ~= "string" then
return modules[key]
end
local _, module
for _, module in ipairs(modules) do
if module.key == key then
return module
end
end
end
local function Addon_NumModules(self)
return #(self[PRIVATE].modules)
end
local function Addon_CreateModule(self, key, dbType, ...)
if type(key) ~= "string" then
error(format("bad argument #1 to 'addon:CreateModule' (string expected, got %s)", type(key)))
return
end
local module = Addon_GetModule(self, key)
if module then
error(format("bad argument #1 to 'addon:CreateModule' (key '%s' already used)", key))
return
end
if type(dbType) == "string" then
dbType = strupper(dbType)
else
dbType = nil
end
local verifyFunc = self.OnVerifyModule
if type(verifyFunc) == "function" and not verifyFunc(self, key, dbType, ...) then
return
end
module = Lib_EmbedEventObject()
module.key, module.dbType = key, dbType
module.IsEnabled = Module_IsEnabled
module.Enable = Module_Enable
module.Disable = Module_Disable
tinsert(self[PRIVATE].modules, module)
if type(self.OnCreateModule) == "function" then
self:OnCreateModule(module, key, ...)
end
return module
end
local function Addon_RegisterLocale(self, name, locale, data)
if type(name) == "string" and type(data) == "table" and type(locale) == "string" then
local moduleLocales = self[PRIVATE].moduleLocales
if not moduleLocales[name] then
moduleLocales[name] = {}
end
if not moduleLocales[name][locale] then
moduleLocales[name][locale] = data
end
end
end
local function Addon_GetLocale(self, name, locale)
local data = self[PRIVATE].moduleLocales[name]
if data then
if type(locale) ~= "string" then
locale = GetLocale()
end
return data[locale] or data.enUS
end
end
local function Addon_EmbedEventObject(self, object)
return Lib_EmbedEventObject(object)
end
local function Addon_VerifyDBVersion(self, version, t)
if type(version) ~= "number" then
version = 0
end
if type(t) ~= "table" then
t = self.db
end
if t and type(t.version) == "number" then
return t.version >= version
end
end
local function Addon_Initialized(self)
return self[PRIVATE].initDone
end
local function EditBox_Highlight(self)
self:SetFocus()
self:HighlightText()
end
local function PopupData_EditBoxOnEnterPressed(self)
local text = strtrim(self:GetText())
local parent = self:GetParent()
local func = parent.data2
if text == "" or (type(func) == "function" and func(parent.data, text)) then
EditBox_Highlight(self)
else
self:GetParent():Hide()
end
end
local function PopupData_OnShow(self)
local editBox = self.editBox
if editBox:IsShown() and editBox:GetText() ~= "" then
EditBox_Highlight(editBox)
end
end
local function PopupData_EditBoxOnEscapePressed(self)
self:GetParent():Hide()
end
local function PopupData_OnAccept(self, arg1, func)
if type(func) ~= "function" then
return
end
local editBox = self.editBox
if not editBox:IsShown() then
return func(arg1)
end
local text = strtrim(editBox:GetText())
if text == "" or func(arg1, text) then
EditBox_Highlight(editBox)
return 1
end
end
local function ParsePopupButtons(buttons)
if buttons == "MB_OK" then
return OKAY
end
if buttons == "MB_YESNO" then
return YES, NO
end
if buttons == "MB_ACCEPTCANCEL" then
return ACCEPT, CANCEL
end
if buttons == "MB_ACCEPTDECLINE" then
return ACCEPT, DECLINE
end
return OKAY, CANCEL -- "MB_OKCANCEL" or others
end
local function Addon_PopupShowConfirm(self, text, func, arg1, buttons)
local data = self[PRIVATE].popupData
data.text = text
data.hasEditBox = nil
data.editBoxWidth = nil
data.button1, data.button2, data.button3 = ParsePopupButtons(buttons)
local dialog = StaticPopup_Show(self[PRIVATE].popupId)
if dialog then
dialog.data = arg1
dialog.data2 = func
return dialog
end
end
local function Addon_PopupShowAck(self, text, func, arg1)
return Addon_PopupShowConfirm(self, text, func, arg1, "MB_OK")
end
local function Addon_PopupShowInput(self, text, func, arg1, default, wide)
local data = self[PRIVATE].popupData
data.text = text
data.hasEditBox = 1
data.editBoxWidth = wide and 260 or nil
data.button1, data.button2, data.button3 = ParsePopupButtons()
local dialog = StaticPopup_Show(self[PRIVATE].popupId)
if dialog then
dialog.data = arg1
dialog.data2 = func
if default then
dialog.editBox:SetText(tostring(default))
return dialog
end
end
end
local function Addon_PopupHide(self)
StaticPopup_Hide(self[PRIVATE].popupId)
end
function lib:CreateAddon(name, addon)
if type(name) ~= "string" then
error(format("bad argument #1 to 'LibAddonManager:CreateAddon' (string expected, got %s)", type(name)))
return
end
if type(addon) ~= "table" then
error(format("bad argument #2 to 'LibAddonManager:CreateAddon' (table expected, got %s)", type(addon)))
return
end
if _G[name] then
error(format("'LibAddonManager:CreateAddon' failed to register addon '%s' (object already exists)", name))
return
end
_G[name] = addon
addon.version = GetAddOnMetadata(name, "Version") or "1.0"
addon.numericVersion = tonumber(addon.version) or 1.0
addon.name = name
addon.title = name -- This may be changed by developers into other locales, but just use name for now
lib.CopyPlayerInfo(addon)
local popupId = "LibAddonManager_PopupData_"..name
local popupData = {
exclusive = 1,
whileDead = 1,
hideOnEscape = 1,
OnAccept = PopupData_OnAccept,
EditBoxOnEnterPressed = PopupData_EditBoxOnEnterPressed,
EditBoxOnEscapePressed = PopupData_EditBoxOnEscapePressed,
OnShow = PopupData_OnShow,
}
StaticPopupDialogs[popupId] = popupData
addon[PRIVATE] = { modules = {}, moduleLocales = {}, popupData = popupData, popupId = popupId }
Lib_EmbedEventObject(addon)
Lib_EmbedBroadcastObject(addon)
addon.Print = Addon_Print
addon.Debug = Addon_Debug
addon.RegisterDB = Addon_RegisterDB
addon.GetCurProfileName = Addon_GetCurProfileName
addon.GetProfileNameList = Addon_GetProfileNameList
addon.GetProfileData = Addon_GetProfileData
addon.CopyProfile = Addon_CopyProfile
addon.DeleteProfile = Addon_DeleteProfile
addon.Initialized = Addon_Initialized
addon.RegisterBindingClick = Addon_RegisterBindingClick
addon.RegisterSlashCmd = Addon_RegisterSlashCmd
addon.RegisterLocale = Addon_RegisterLocale
addon.GetLocale = Addon_GetLocale
addon.EmbedEventObject = Addon_EmbedEventObject
addon.VerifyDBVersion = Addon_VerifyDBVersion
addon.PopupShowConfirm = Addon_PopupShowConfirm
addon.PopupShowAck = Addon_PopupShowAck
addon.PopupShowInput = Addon_PopupShowInput
addon.PopupHide = Addon_PopupHide
addon.tcopy = lib.tcopy
addon.tfind = lib.tfind
addon.CreateModule = Addon_CreateModule
addon.NumModules = Addon_NumModules
addon.GetModule = Addon_GetModule
addon.EnumModules = Addon_EnumModules
addon.CallAllModules = Addon_CallAllModules
addon.CallAllEnabledModules = Addon_CallAllEnabledModules
-- Depreciated functions but stay for downward compatibility
addon.CopyTable = Addon_CopyTable
tinsert(lib._addonList, addon)
return addon
end
-------------------------------------------------------
-- The library background event frame works
-------------------------------------------------------
function lib.CopyPlayerInfo(addon)
local key, val
for key, val in pairs(PLAYER_INFO) do
addon[key] = val
end
end
local function Lib_UpdatePlayerInfo()
PLAYER_INFO.player = UnitName("player")
PLAYER_INFO.realm = GetRealmName()
PLAYER_INFO.faction = UnitFactionGroup("player")
PLAYER_INFO.class = select(2, UnitClass("player"))
PLAYER_INFO.race = select(2, UnitRace("player"))
PLAYER_INFO.guid = UnitGUID("player")
PROFILE_NAME = PLAYER_INFO.player.." - "..PLAYER_INFO.realm
end
Lib_UpdatePlayerInfo()
function lib._SetupTable(parent, key, isFrame)
if type(parent) ~= "table" or not key then
return
end
local t = parent[key]
local isNew
if type(t) ~= "table" then
isNew = 1
if isFrame then
t = CreateFrame("Frame")
else
t = {}
end
parent[key] = t
end
return t, isNew
end
lib._SetupTable(lib, "_addonList")
lib._SetupTable(lib, "_bindingList")
local function Module_InitializeDB(self, db, chardb)
local moduledb, moduledbNew, moduleChardb, moduleChardbNew
if strfind(self.dbType or "", "ACCOUNT") then
local temp = lib._SetupTable(db, "modules")
moduledb, moduledbNew = lib._SetupTable(temp, self.key)
end
if strfind(self.dbType or "", "CHAR") then
local temp = lib._SetupTable(chardb, "modules")
moduleChardb, moduleChardbNew = lib._SetupTable(temp, self.key)
end
self.db, self.chardb = moduledb, moduleChardb
local private = self[PRIVATE]
if type(self.OnInitialize) == "function" then
self:OnInitialize(moduledb, moduledbNew, moduleChardb, moduleChardbNew)
end
end
local function Lib_CallAllAddonsAndEnabledModules(method, ...)
local _, addon
for _, addon in ipairs(lib._addonList) do
local func = addon[method]
if type(func) == "function" then
func(addon, ...)
end
Addon_CallAllEnabledModules(addon, method, ...)
end
end
local function Lib_CheckInitDB(addon)
local private = addon[PRIVATE]
local db, dbIsNew = lib._SetupTable(_G, private.dbName)
addon.db = db
local chardb, chardbIsNew
if db and private.hasCharDB then
if type(private.hasCharDB) == "string" then
chardb, chardbIsNew = lib._SetupTable(_G, private.hasCharDB)
addon.chardb = chardb
else
local profileName = addon:GetCurProfileName()
local profiles = lib._SetupTable(db, "profiles")
chardb, chardbIsNew = lib._SetupTable(profiles, profileName)
addon.chardb = chardb
end
end
if type(addon.OnInitialize) == "function" then
addon:OnInitialize(db, dbIsNew, chardb, chardbIsNew)
end
end
local function Lib_ApplyAllBindings()
local name, button
for name, button in pairs(lib._bindingList) do
ClearOverrideBindings(button)
local key1, key2 = GetBindingKey(name)
if key2 then
SetOverrideBindingClick(button, false, key2, button:GetName())
end
if key1 then
SetOverrideBindingClick(button, false, key1, button:GetName())
end
end
end
local function EventFrame_TryUpdateBindings(self)
if InCombatLockdown() then
self.hasPending = 1 -- Delay call
else
Lib_ApplyAllBindings()
end
end
local frame = lib._SetupTable(lib, "_eventFrame", 1)
frame:RegisterEvent("PLAYER_LOGIN")
frame:SetScript("OnEvent", function(self, event, arg1)
if event == "PLAYER_LOGIN" then
Lib_UpdatePlayerInfo()
local _, addon
for _, addon in ipairs(lib._addonList) do
lib.CopyPlayerInfo(addon)
Lib_CheckInitDB(addon)
end
for _, addon in ipairs(lib._addonList) do
Addon_EnumModules(addon, Module_InitializeDB, addon.db, addon.chardb)
end
for _, addon in ipairs(lib._addonList) do
addon[PRIVATE].initDone = 1
if type(addon.OnModulesInitDone) == "function" then
addon:OnModulesInitDone()
end
end
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:RegisterEvent("UPDATE_BINDINGS")
EventFrame_TryUpdateBindings(self)
elseif event == "UPDATE_BINDINGS" then
EventFrame_TryUpdateBindings(self)
elseif event == "PLAYER_REGEN_DISABLED" then
Lib_CallAllAddonsAndEnabledModules("OnEnterCombat")
elseif event == "PLAYER_REGEN_ENABLED" then
if self.hasPending then
self.hasPending = nil
Lib_ApplyAllBindings()
end
Lib_CallAllAddonsAndEnabledModules("OnLeaveCombat")
end
end)
|
fgprodigal/RayUI
|
Interface/AddOns/IntelliMount/Includes/LibAddonManager.lua
|
Lua
|
mit
| 29,220 | 26.962679 | 228 | 0.707803 | false |
import {Curve} from '../curve'
export class Line extends Curve {
constructor(p0, v) {
super();
this.p0 = p0;
this.v = v;
this._pointsCache = new Map();
}
intersectSurface(surface) {
if (surface.isPlane) {
const s0 = surface.normal.multiply(surface.w);
return surface.normal.dot(s0.minus(this.p0)) / surface.normal.dot(this.v); // 4.7.4
} else {
return super.intersectSurface(surface);
}
}
intersectCurve(curve, surface) {
if (curve.isLine && surface.isPlane) {
const otherNormal = surface.normal.cross(curve.v)._normalize();
return otherNormal.dot(curve.p0.minus(this.p0)) / otherNormal.dot(this.v); // (4.8.3)
}
return super.intersectCurve(curve, surface);
}
parametricEquation(t) {
return this.p0.plus(this.v.multiply(t));
}
t(point) {
return point.minus(this.p0).dot(this.v);
}
pointOfSurfaceIntersection(surface) {
let point = this._pointsCache.get(surface);
if (!point) {
const t = this.intersectSurface(surface);
point = this.parametricEquation(t);
this._pointsCache.set(surface, point);
}
return point;
}
translate(vector) {
return new Line(this.p0.plus(vector), this.v);
}
approximate(resolution, from, to, path) {
}
offset() {};
}
Line.prototype.isLine = true;
Line.fromTwoPlanesIntersection = function(plane1, plane2) {
const n1 = plane1.normal;
const n2 = plane2.normal;
const v = n1.cross(n2)._normalize();
const pf1 = plane1.toParametricForm();
const pf2 = plane2.toParametricForm();
const r0diff = pf1.r0.minus(pf2.r0);
const ww = r0diff.minus(n2.multiply(r0diff.dot(n2)));
const p0 = pf2.r0.plus( ww.multiply( n1.dot(r0diff) / n1.dot(ww)));
return new Line(p0, v);
};
Line.fromSegment = function(a, b) {
return new Line(a, b.minus(a)._normalize());
};
|
Autodrop3d/autodrop3dServer
|
public/webcad/app/brep/geom/impl/line.js
|
JavaScript
|
mit
| 1,860 | 24.479452 | 95 | 0.64086 | false |
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Network::Mgmt::V2019_11_01
module Models
#
# Properties of the Radius client root certificate of
# VpnServerConfiguration.
#
class VpnServerConfigRadiusClientRootCertificate
include MsRestAzure
# @return [String] The certificate name.
attr_accessor :name
# @return [String] The Radius client root certificate thumbprint.
attr_accessor :thumbprint
#
# Mapper for VpnServerConfigRadiusClientRootCertificate class as Ruby
# Hash.
# This will be used for serialization/deserialization.
#
def self.mapper()
{
client_side_validation: true,
required: false,
serialized_name: 'VpnServerConfigRadiusClientRootCertificate',
type: {
name: 'Composite',
class_name: 'VpnServerConfigRadiusClientRootCertificate',
model_properties: {
name: {
client_side_validation: true,
required: false,
serialized_name: 'name',
type: {
name: 'String'
}
},
thumbprint: {
client_side_validation: true,
required: false,
serialized_name: 'thumbprint',
type: {
name: 'String'
}
}
}
}
}
end
end
end
end
|
Azure/azure-sdk-for-ruby
|
management/azure_mgmt_network/lib/2019-11-01/generated/azure_mgmt_network/models/vpn_server_config_radius_client_root_certificate.rb
|
Ruby
|
mit
| 1,617 | 26.40678 | 75 | 0.549784 | false |
---
layout: default
title: Distributed compressed sensing
---
<h2>{{ page.title }}</h2>
<p>To be writen<a href="">here</a></p>
|
myworkstation/myworkstation.github.io
|
_posts/2015-05-15-Distributed compressed sensing.html
|
HTML
|
mit
| 126 | 20.166667 | 38 | 0.642857 | false |
<?php
/**
*
* Enter address data for the cart, when anonymous users checkout
*
* @package VirtueMart
* @subpackage User
* @author Max Milbers
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: edit_address_addshipto.php 7499 2013-12-18 15:11:51Z Milbo $
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
?>
<fieldset>
<legend>
<?php echo '<span class="userfields_info">' .vmText::_('COM_VIRTUEMART_USER_FORM_SHIPTO_LBL').'</span>'; ?>
</legend>
<?php echo $this->lists['shipTo']; ?>
</fieldset>
|
yaelduckwen/libriastore
|
joomla/templates/horme_3/html/com_virtuemart/user/edit_address_addshipto.php
|
PHP
|
mit
| 988 | 37.038462 | 111 | 0.709514 | false |
#include "TString.h"
#include "TGraph.h"
#include "TGraphErrors.h"
#include "TGraphAsymmErrors.h"
#include <fstream>
#include <Riostream.h>
#include <sstream>
#include <fstream>
using namespace std;
TGraphErrors* GetGraphWithSymmYErrorsFromFile(TString txtFileName, Color_t markerColor=1, Style_t markerStyle=20, Size_t markerSize=1, Style_t lineStyle=1,Width_t lineWidth=2, bool IsNoErr=0)
{
Float_t x_array[400],ex_array[400],y_array[400],ey_array[400];
Char_t buffer[2048];
Float_t x,y,ex,ey;
Int_t nlines = 0;
ifstream infile(txtFileName.Data());
if (!infile.is_open()) {
cout << "Error opening file. Exiting." << endl;
} else {
while (!infile.eof()) {
infile.getline(buffer,2048);
sscanf(buffer,"%f %f %f\n",&x,&y,&ey);
x_array[nlines] = x;
ex_array[nlines] = 0;
y_array[nlines] = y;
ey_array[nlines] = ey;
if(IsNoErr) ey_array[nlines]=0;
nlines++;
}
}
TGraphErrors *graph =
new TGraphErrors(nlines-1,x_array,y_array,ex_array,ey_array);
txtFileName.Remove(txtFileName.Index(".txt"),4);
graph->SetName(txtFileName.Data());
graph->SetMarkerStyle(markerStyle);
graph->SetMarkerColor(markerColor);
graph->SetLineStyle(lineStyle);
graph->SetLineColor(markerColor);
graph->SetMarkerSize(markerSize);
graph->SetLineWidth(3);
return graph;
}
void drawSysBoxValue(TGraph* gr, int fillcolor=TColor::GetColor("#ffff00"), double xwidth=0.3, double *percent, double xshift=0)
{
TBox* box;
for(int n=0;n<gr->GetN();n++)
{
double x,y;
gr->GetPoint(n,x,y);
double yerr = percent[n];
box = new TBox(x+xshift-xwidth,y-fabs(yerr),x+xwidth,y+fabs(yerr));
box->SetLineWidth(0);
box->SetFillColor(kGray);
box->Draw("Fsame");
}
}
|
tuos/FlowAndCorrelations
|
flowCorr/paperMacro/qm/GetFileAndSys.C
|
C++
|
mit
| 1,754 | 27.290323 | 191 | 0.664766 | false |
<?php
// Documentation test config file for "Components / Jumbotron" part
return [
'title' => 'Jumbotron',
'url' => '%bootstrap-url%/components/jumbotron/',
'rendering' => function (\Laminas\View\Renderer\PhpRenderer $oView) {
echo $oView->jumbotron([
'title' => 'Hello, world!',
'lead' => 'This is a simple hero unit, a simple jumbotron-style component ' .
'for calling extra attention to featured content or information.',
'---' => ['attributes' => ['class' => 'my-4']],
'It uses utility classes for typography and spacing to space ' .
'content out within the larger container.',
'button' => [
'options' => [
'tag' => 'a',
'label' => 'Learn more',
'variant' => 'primary',
'size' => 'lg',
],
'attributes' => [
'href' => '#',
]
],
]) . PHP_EOL;
// To make the jumbotron full width, and without rounded corners, add the option fluid
echo $oView->jumbotron(
[
'title' => 'Fluid jumbotron',
'lead' => 'This is a modified jumbotron that occupies the entire horizontal space of its parent.',
],
['fluid' => true]
);
},
'expected' => '<div class="jumbotron">' . PHP_EOL .
' <h1 class="display-4">Hello, world!</h1>' . PHP_EOL .
' <p class="lead">This is a simple hero unit, a simple jumbotron-style component ' .
'for calling extra attention to featured content or information.</p>' . PHP_EOL .
' <hr class="my-4" />' . PHP_EOL .
' <p>It uses utility classes for typography and spacing to space ' .
'content out within the larger container.</p>' . PHP_EOL .
' <a href="#" class="btn btn-lg btn-primary" role="button">Learn more</a>' . PHP_EOL .
'</div>' . PHP_EOL .
'<div class="jumbotron jumbotron-fluid">' . PHP_EOL .
' <div class="container">' . PHP_EOL .
' <h1 class="display-4">Fluid jumbotron</h1>' . PHP_EOL .
' <p class="lead">This is a modified jumbotron that occupies ' .
'the entire horizontal space of its parent.</p>' . PHP_EOL .
' </div>' . PHP_EOL .
'</div>',
];
|
neilime/zf-twbs-helper-module
|
tests/TestSuite/Documentation/Components/Jumbotron.php
|
PHP
|
mit
| 2,445 | 45.132075 | 114 | 0.503885 | false |
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CssMerger.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CssMerger.Tests")]
[assembly: AssemblyCopyright("Copyright © 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM componenets. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f7c36817-3ade-4d22-88b3-aca652491500")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
gudmundurh/CssMerger
|
CssMerger.Tests/Properties/AssemblyInfo.cs
|
C#
|
mit
| 1,331 | 33.973684 | 84 | 0.743223 | false |
import time
import pymemcache.client
import pytest
from limits import RateLimitItemPerMinute, RateLimitItemPerSecond
from limits.storage import MemcachedStorage, storage_from_string
from limits.strategies import (
FixedWindowElasticExpiryRateLimiter,
FixedWindowRateLimiter,
)
from tests.utils import fixed_start
@pytest.mark.memcached
@pytest.mark.flaky
class TestMemcachedStorage:
@pytest.fixture(autouse=True)
def setup(self, memcached, memcached_cluster):
self.storage_url = "memcached://localhost:22122"
def test_init_options(self, mocker):
constructor = mocker.spy(pymemcache.client, "PooledClient")
assert storage_from_string(self.storage_url, connect_timeout=1).check()
assert constructor.call_args[1]["connect_timeout"] == 1
@fixed_start
def test_fixed_window(self):
storage = MemcachedStorage("memcached://localhost:22122")
limiter = FixedWindowRateLimiter(storage)
per_min = RateLimitItemPerSecond(10)
start = time.time()
count = 0
while time.time() - start < 0.5 and count < 10:
assert limiter.hit(per_min)
count += 1
assert not limiter.hit(per_min)
while time.time() - start <= 1:
time.sleep(0.1)
assert limiter.hit(per_min)
@fixed_start
def test_fixed_window_cluster(self):
storage = MemcachedStorage("memcached://localhost:22122,localhost:22123")
limiter = FixedWindowRateLimiter(storage)
per_min = RateLimitItemPerSecond(10)
start = time.time()
count = 0
while time.time() - start < 0.5 and count < 10:
assert limiter.hit(per_min)
count += 1
assert not limiter.hit(per_min)
while time.time() - start <= 1:
time.sleep(0.1)
assert limiter.hit(per_min)
@fixed_start
def test_fixed_window_with_elastic_expiry(self):
storage = MemcachedStorage("memcached://localhost:22122")
limiter = FixedWindowElasticExpiryRateLimiter(storage)
per_sec = RateLimitItemPerSecond(2, 2)
assert limiter.hit(per_sec)
time.sleep(1)
assert limiter.hit(per_sec)
assert not limiter.test(per_sec)
time.sleep(1)
assert not limiter.test(per_sec)
time.sleep(1)
assert limiter.test(per_sec)
@fixed_start
def test_fixed_window_with_elastic_expiry_cluster(self):
storage = MemcachedStorage("memcached://localhost:22122,localhost:22123")
limiter = FixedWindowElasticExpiryRateLimiter(storage)
per_sec = RateLimitItemPerSecond(2, 2)
assert limiter.hit(per_sec)
time.sleep(1)
assert limiter.hit(per_sec)
assert not limiter.test(per_sec)
time.sleep(1)
assert not limiter.test(per_sec)
time.sleep(1)
assert limiter.test(per_sec)
def test_clear(self):
storage = MemcachedStorage("memcached://localhost:22122")
limiter = FixedWindowRateLimiter(storage)
per_min = RateLimitItemPerMinute(1)
limiter.hit(per_min)
assert not limiter.hit(per_min)
limiter.clear(per_min)
assert limiter.hit(per_min)
|
alisaifee/limits
|
tests/storage/test_memcached.py
|
Python
|
mit
| 3,218 | 31.836735 | 81 | 0.651336 | false |