code
stringlengths
2
1.05M
repo_name
stringlengths
4
116
path
stringlengths
3
991
language
stringclasses
30 values
license
stringclasses
15 values
size
int32
3
1.05M
# go-miner # Data Mining Algorithms in GoLang. ## Installation $ go get github.com/ozzie80/go-miner ## Algorithms ### k-means Description From [Wikipedia](https://en.wikipedia.org/wiki/K-means_clustering): > k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster. This results in a partitioning of the data space into Voronoi cells. The k-means implementation of go-miner uses the [k-means++](https://en.wikipedia.org/wiki/K-means%2B%2B "k-means++") algorithm for choosing the initial cluster centroids. The implementation provides internal quality indexes, [Dunn Index](https://en.wikipedia.org/wiki/Dunn_index) and [Davies-Bouldin Index](https://en.wikipedia.org/wiki/Davies%E2%80%93Bouldin_index), for evaluating clustering results. Usage Example // Create points or read from a .csv file points := []dt.Vector{{1.0, 2.0, 3.0}, {5.1, 6.2, 7.3}, {2.0, 3.5, 5.0}} // Specify Parameters: K, Points, MaxIter (optional) params := kmeans.Params{2, points, math.MaxInt64} // Run k-means clusters, err := kmeans.Run(params) // Get quality index score index := kmeans.DunnIndex{} // DaviesBouldinIndex{} score := index.GetScore(clusters) To Do - Concurrent version - Cuda/GPU version ### To Be Added - Apriori - *K*NN - Naive Bayes - PageRank - SVM - ... ## License go-miner is MIT License.
ozzie80/go-miner
README.md
Markdown
mit
1,453
namespace UCloudSDK.Models { /// <summary> /// 获取流量信息 /// <para> /// http://docs.ucloud.cn/api/ucdn/get_ucdn_traffic.html /// </para> /// </summary> public partial class GetUcdnTrafficRequest { /// <summary> /// 默认Action名称 /// </summary> private string _action = "GetUcdnTraffic"; /// <summary> /// API名称 /// <para> /// GetUcdnTraffic /// </para> /// </summary> public string Action { get { return _action; } set { _action = value; } } /// <summary> /// None /// </summary> public string 不需要提供参数 { get; set; } } }
icyflash/ucloud-csharp-sdk
UCloudSDK/Models/UCDN/GetUcdnTrafficRequest.cs
C#
mit
808
--- layout: post title: Mughal Empire categories: - Learning --- [Mughal Empire](http://en.wikipedia.org/wiki/Mughal_Empire) (1526 – 1857) rulers... - 1526-1530 [Babur ](http://en.wikipedia.org/wiki/Babur) - 1530–1539 and after restoration 1555–1556 [Humayun ](http://en.wikipedia.org/wiki/Humayun) - 1556–1605 [Akbar ](http://en.wikipedia.org/wiki/Akbar) - 1605–1627 [Jahangir ](http://en.wikipedia.org/wiki/Jahangir) - 1628–1658 [Shah Jahan ](http://en.wikipedia.org/wiki/Shah_Jahan) - 1659–1707   [Aurangzeb ](http://en.wikipedia.org/wiki/Aurangzeb) - Later Emperors = 1707-1857
sayanee/archives
_posts/2008-01-13-mughal-empire.md
Markdown
mit
601
require "spec_helper" module Smsru describe API do shared_context "shared configuration", need_values: 'configuration' do before :each do Smsru.configure do |conf| conf.api_id = 'your-api-id' conf.from = 'sender-name' conf.test = test conf.format = format end end subject { Smsru::API } end shared_examples 'send_sms' do it { expect(VCR.use_cassette(cassette) { subject.send_sms(phone, text) }).to eq(response) } end shared_examples 'send_group_sms' do it { expect(VCR.use_cassette(cassette) { subject.group_send(phone, text) }).to eq(response) } end let(:text) { 'Sample of text that will have sended inside sms.' } let(:phone) { '+79050000000' } context 'test', need_values: 'configuration' do let(:test) { true } describe 'format = false' do it_behaves_like "send_sms" do let(:response) { "100\n000-00000" } let(:cassette) { 'api/send_sms' } let(:format) { false } end end describe 'error message' do let(:phone) { '0000' } let(:raw_response) { "202\n0000" } it_behaves_like "send_sms" do let(:response) { raw_response } let(:cassette) { 'api/error_sms' } let(:format) { false } end it_behaves_like "send_sms" do let(:response) { Smsru::Response.new(phone, raw_response) } let(:cassette) { 'api/error_sms' } let(:format) { true } end end describe 'group send sms' do let(:raw_response) { "100\n000-00000\n000-00000" } let(:phone) { ['+79050000000', '+79060000000'] } let(:cassette) { 'api/group_sms' } describe 'format = true' do it_behaves_like "send_group_sms" do let(:response_phone) { '+79050000000,+79060000000' } let(:response) { [Smsru::Response.new(response_phone, raw_response)] } let(:format) { true } end end describe 'format = false' do it_behaves_like "send_group_sms" do let(:response) { [raw_response] } let(:format) { false } end end end end context 'production', need_values: 'configuration' do let(:test) { false } describe 'send sms' do let(:raw_response) { "100\n000-00000\nbalance=1000" } let(:cassette) { 'api/send_sms_production' } describe 'format = false' do it_behaves_like "send_sms" do let(:response) { raw_response } let(:format) { false } end end describe 'format = true' do it_behaves_like "send_sms" do let(:response) { Smsru::Response.new(phone, raw_response) } let(:format) { true } end end end describe 'group send sms' do let(:raw_response) { "100\n000-00000\n000-00000\nbalance=1000" } let(:cassette) { 'api/group_sms_production' } let(:phone) { ['+79050000000', '+79060000000'] } let(:response_phone) { '+79050000000,+79060000000' } describe 'format = true' do it_behaves_like "send_group_sms" do let(:response) { [Smsru::Response.new(response_phone, raw_response)] } let(:format) { true } end end describe 'format = false' do it_behaves_like "send_group_sms" do let(:response) { [raw_response] } let(:format) { false } end end end end end end
alekseenkoss77/smsru
spec/lib/smsru/api_spec.rb
Ruby
mit
3,612
import { expect } from 'chai'; import buildUriTemplate from '../src/uri-template'; describe('URI Template Handler', () => { context('when there are path object parameters', () => { context('when the path object parameters are not query parameters', () => { const basePath = '/api'; const href = '/pet/findByTags'; const pathObjectParams = [ { in: 'path', description: 'Path parameter from path object', name: 'fromPath', required: true, type: 'string', }, ]; const queryParams = [ { in: 'query', description: 'Tags to filter by', name: 'tags', required: true, type: 'string', }, { in: 'query', description: 'For tests. Unknown type of query parameter.', name: 'unknown', required: true, type: 'unknown', }, ]; it('returns the correct URI', () => { const hrefForResource = buildUriTemplate(basePath, href, pathObjectParams, queryParams); expect(hrefForResource).to.equal('/api/pet/findByTags{?tags,unknown}'); }); }); context('when there are no query parameters but have one path object parameter', () => { const basePath = '/api'; const href = '/pet/{id}'; const pathObjectParams = [ { in: 'path', description: 'Pet\'s identifier', name: 'id', required: true, type: 'number', }, ]; const queryParams = []; it('returns the correct URI', () => { const hrefForResource = buildUriTemplate(basePath, href, pathObjectParams, queryParams); expect(hrefForResource).to.equal('/api/pet/{id}'); }); }); context('when there are query parameters defined', () => { const basePath = '/api'; const href = '/pet/findByTags'; const pathObjectParams = [ { in: 'query', description: 'Query parameter from path object', name: 'fromPath', required: true, type: 'string', }, ]; const queryParams = [ { in: 'query', description: 'Tags to filter by', name: 'tags', required: true, type: 'string', }, { in: 'query', description: 'For tests. Unknown type of query parameter.', name: 'unknown', required: true, type: 'unknown', }, ]; it('returns the correct URI', () => { const hrefForResource = buildUriTemplate(basePath, href, pathObjectParams, queryParams); expect(hrefForResource).to.equal('/api/pet/findByTags{?fromPath,tags,unknown}'); }); }); context('when there are parameters with reserved characters', () => { const basePath = '/my-api'; const href = '/pet/{unique%2did}'; const queryParams = [ { in: 'query', description: 'Tags to filter by', name: 'tag-names[]', required: true, type: 'string', }, ]; it('returns the correct URI', () => { const hrefForResource = buildUriTemplate(basePath, href, [], queryParams); expect(hrefForResource).to.equal('/my-api/pet/{unique%2did}{?tag%2dnames%5B%5D}'); }); }); context('when there is a conflict in parameter names', () => { const basePath = '/api'; const href = '/pet/findByTags'; const pathObjectParams = [ { in: 'query', description: 'Tags to filter by', name: 'tags', required: true, type: 'string', }, ]; const queryParams = [ { in: 'query', description: 'Tags to filter by', name: 'tags', required: true, type: 'string', }, ]; it('only adds one to the query parameters', () => { const hrefForResource = buildUriTemplate(basePath, href, pathObjectParams, queryParams); expect(hrefForResource).to.equal('/api/pet/findByTags{?tags}'); }); }); context('when there are no query parameters defined', () => { const basePath = '/api'; const href = '/pet/findByTags'; const pathObjectParams = [ { in: 'query', description: 'Query parameter from path object', name: 'fromPath', required: true, type: 'string', }, ]; const queryParams = []; it('returns the correct URI', () => { const hrefForResource = buildUriTemplate(basePath, href, pathObjectParams, queryParams); expect(hrefForResource).to.equal('/api/pet/findByTags{?fromPath}'); }); }); }); context('when there are query parameters but no path object parameters', () => { const basePath = '/api'; const href = '/pet/findByTags'; const pathObjectParams = []; const queryParams = [ { in: 'query', description: 'Tags to filter by', name: 'tags', required: true, type: 'string', }, { in: 'query', description: 'For tests. Unknown type of query parameter.', name: 'unknown', required: true, type: 'unknown', }, ]; it('returns the correct URI', () => { const hrefForResource = buildUriTemplate(basePath, href, pathObjectParams, queryParams); expect(hrefForResource).to.equal('/api/pet/findByTags{?tags,unknown}'); }); }); context('when there are no query or path object parameters', () => { const basePath = '/api'; const href = '/pet/findByTags'; const pathObjectParams = []; const queryParams = []; it('returns the correct URI', () => { const hrefForResource = buildUriTemplate(basePath, href, pathObjectParams, queryParams); expect(hrefForResource).to.equal('/api/pet/findByTags'); }); }); describe('array parameters with collectionFormat', () => { it('returns a template with default format', () => { const parameter = { in: 'query', name: 'tags', type: 'array', }; const hrefForResource = buildUriTemplate('', '/example', [parameter]); expect(hrefForResource).to.equal('/example{?tags}'); }); it('returns a template with csv format', () => { const parameter = { in: 'query', name: 'tags', type: 'array', collectionFormat: 'csv', }; const hrefForResource = buildUriTemplate('', '/example', [parameter]); expect(hrefForResource).to.equal('/example{?tags}'); }); it('returns an exploded template with multi format', () => { const parameter = { in: 'query', name: 'tags', type: 'array', collectionFormat: 'multi', }; const hrefForResource = buildUriTemplate('', '/example', [parameter]); expect(hrefForResource).to.equal('/example{?tags*}'); }); }); });
apiaryio/fury-adapter-swagger
test/uri-template.js
JavaScript
mit
7,065
let Demo1 = require('./components/demo1.js'); document.body.appendChild(Demo1());
zjx1195688876/learn-react
src/webapp/main.js
JavaScript
mit
82
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // 有关程序集的常规信息通过以下 // 特性集控制。更改这些特性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("Demo05")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Demo05")] [assembly: AssemblyCopyright("Copyright © Microsoft 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, // 则将该类型上的 ComVisible 特性设置为 true。 [assembly: ComVisible(false)] //若要开始生成可本地化的应用程序,请在 //<PropertyGroup> 中的 .csproj 文件中 //设置 <UICulture>CultureYouAreCodingWith</UICulture>。例如,如果您在源文件中 //使用的是美国英语,请将 <UICulture> 设置为 en-US。然后取消 //对以下 NeutralResourceLanguage 特性的注释。更新 //以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //主题特定资源词典所处位置 //(在页面或应用程序资源词典中 // 未找到某个资源的情况下使用) ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 //(在页面、应用程序或任何主题特定资源词典中 // 未找到某个资源的情况下使用) )] // 程序集的版本信息由下面四个值组成: // // 主版本 // 次版本 // 内部版本号 // 修订号 // // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
HungryAnt/AntWpfDemos
AntWpfDemos/Demo05/Properties/AssemblyInfo.cs
C#
mit
2,195
<div id="container" class="container-fluid" ng-controller="cloudAppController"> <div class="table"> <div class="col-lg-2"> <label for="teamDD">Team:</label> <select id="teamDD" class="form-control headerSelectWidth" ng-model="filteredTeam" ng-change="onTeamChange()" ng-options="team.id as team.name for team in teamsOnly"></select> </div> <!--<div class="col-lg-2"> <label for="moduleSearch">Module:</label> <input id="moduleSearch" class="form-control headerSelectWidth" ng-model="search.moduleName"/> </div>--> <div class="col-lg-2"> <label for="cloudAppSearch">CloudApp:</label> <input id="cloudAppSearch" class="form-control headerSelectWidth" ng-model="search.appName"/> </div> <div class="col-lg-1"> <div class="spinner" ng-show="isLoading"></div> </div> </div> <div ng-repeat = "module in cloudAddData.modules"> <div class="col-lg-12"> <table class="table"> <thead> <tr> <th> <span >{{module.moduleName}}</span> </th> </tr> <tr> <th> <span tooltip-placement="top">CloudApp</span> </th> <th> <span tooltip-placement="top">Page</span> </th> <th>StoryPoints</th> <th>Stream</th> <th>TaskStatus</th> <th>Blockers</th> </tr> </thead> <tbody> <tr ng-repeat = "cloudApp in module.cloudApps | filter:search:strict | orderBy:['appName','pageName']:reverse"> <!-- <td class="table_cell_border" ng-if="showCloud(cloudApp.appName)">{{cloudApp.appName}}</td> <td class="" ng-if="previousCloudSkipped"></td> rowspan="{{module.}}" --> <td class="table_cell_border" style="vertical-align: middle;" rowspan="{{getSpan(cloudApp.appName, module.cloudAppRowspans)}}" ng-if="showCloud(cloudApp.appName)" >{{cloudApp.appName}}</td> <td class="table_cell_border">{{cloudApp.pageName}}</td> <td class="table_cell_border">{{cloudApp.storyPoints}}</td> <td class="table_cell_border">{{cloudApp.stream}}</td> <td class="table_cell_border">{{cloudApp.taskStatus}}</td> <td class="table_cell_border"> <span ng-repeat="blocker in cloudApp.blockers" > <a ng-if="blocker.status!='Closed'" class="btn btn-primary blocker_style" ng-style={'background-color':stringToColorCode(blocker.key)} href="{{blocker.uri}}" target="_blank"> {{blocker.key}} <span class="badge">{{blocker.pagesInvolved}}</span> </a> <a ng-if="blocker.status=='Closed'" class="btn btn-primary blocker_style blocker_status_{{blocker.status}}" href="{{blocker.uri}}" target="_blank"> {{blocker.key}} <span class="badge">{{blocker.pagesInvolved}}</span> </a> </span> </td> </tr> </tbody> </table> </div> </div> </div>
ZloiBubr/ReportTool
public/pages/cloudappBlocker.html
HTML
mit
3,587
package doit.study.droid.fragments; import android.app.Activity; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.widget.CheckBox; import android.widget.EditText; import doit.study.droid.R; public class DislikeDialogFragment extends DialogFragment { public static final String EXTRA_CAUSE = "doit.study.droid.extra_cause"; private static final String QUESTION_TEXT_KEY = "doit.study.droid.question_text_key"; private Activity mHostActivity; private View mView; private int[] mCauseIds = {R.id.question_incorrect, R.id.answer_incorrect, R.id.documentation_irrelevant}; public static DislikeDialogFragment newInstance(String questionText) { DislikeDialogFragment dislikeDialog = new DislikeDialogFragment(); Bundle arg = new Bundle(); arg.putString(QUESTION_TEXT_KEY, questionText); dislikeDialog.setArguments(arg); return dislikeDialog; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { mHostActivity = getActivity(); LayoutInflater inflater = mHostActivity.getLayoutInflater(); mView = inflater.inflate(R.layout.fragment_dialog_dislike, null); AlertDialog.Builder builder = new AlertDialog.Builder(mHostActivity); builder.setMessage(getString(R.string.report_because)) .setView(mView) .setPositiveButton(mHostActivity.getString(R.string.report), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Fragment fr = getTargetFragment(); if (fr != null) { Intent intent = new Intent(); intent.putExtra(EXTRA_CAUSE, formReport()); fr.onActivityResult(getTargetRequestCode(), Activity.RESULT_OK, intent); } } }) .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); // Create the AlertDialog object and return it return builder.create(); } private String formReport() { EditText editText = (EditText) mView.findViewById(R.id.comment); StringBuilder result = new StringBuilder(" Cause:"); for (int id : mCauseIds) { CheckBox checkBox = (CheckBox) mView.findViewById(id); if (checkBox.isChecked()) result.append(checkBox.getText()) .append(","); } result.append(" Comment:"); result.append(editText.getText()); return result.toString(); } }
JaeW/dodroid
app/src/main/java/doit/study/droid/fragments/DislikeDialogFragment.java
Java
mit
3,105
<?php namespace Zycon42\Security\Application; use Nette; use Nette\Application\Request; use Nette\Reflection\ClassType; use Nette\Reflection\Method; use Symfony\Component\ExpressionLanguage\Expression; class PresenterRequirementsChecker extends Nette\Object { /** * @var ExpressionEvaluator */ private $expressionEvaluator; private $failedExpression; public function __construct(ExpressionEvaluator $expressionEvaluator) { $this->expressionEvaluator = $expressionEvaluator; } /** * @param ClassType|Method $element * @param Request $request * @return bool * @throws \InvalidArgumentException */ public function checkRequirement($element, Request $request) { if ($element instanceof ClassType) { $expressions = $this->getClassExpressionsToEvaluate($element); } else if ($element instanceof Method) { $expressions = $this->getMethodExpressionsToEvaluate($element); } else throw new \InvalidArgumentException("Argument 'element' must be instanceof Nette\\Reflection\\ClassType or Nette\\Reflection\\Method"); if (!empty($expressions)) { foreach ($expressions as $expression) { $result = $this->expressionEvaluator->evaluate($expression, $request); if (!$result) { $this->failedExpression = $expression; return false; } } } return true; } public function getFailedExpression() { return $this->failedExpression; } private function getClassExpressionsToEvaluate(ClassType $classType) { $expressions = []; $this->walkClassHierarchy($classType, $expressions); return $expressions; } private function walkClassHierarchy(ClassType $classType, &$expressions) { $parentClass = $classType->getParentClass(); if ($parentClass) $this->walkClassHierarchy($parentClass, $expressions); $annotation = $classType->getAnnotation('Security'); if ($annotation) { if (!is_string($annotation)) { throw new \InvalidArgumentException('Security annotation must be simple string with expression.'); } $expressions[] = new Expression($annotation); } } private function getMethodExpressionsToEvaluate(Method $method) { $annotation = $method->getAnnotation('Security'); if ($annotation) { if (!is_string($annotation)) { throw new \InvalidArgumentException('Security annotation must be simple string with expression.'); } return [new Expression($annotation)]; } return []; } }
Zycon42/Security
lib/Zycon42/Security/Application/PresenterRequirementsChecker.php
PHP
mit
2,781
<?php namespace App\Http\Middleware; use Input, Closure, Response, User; class CheckClientKey { public function handle($request, Closure $next) { $input = Input::all(); $output = array(); if(!isset($input['key'])){ $output['error'] = 'API key required'; return Response::json($output, 403); } $findUser = User::where('api_key', '=', $input['key'])->first(); if(!$findUser){ $output['error'] = 'Invalid API key'; return Response::json($output, 400); } if($findUser->activated == 0){ $output['error'] = 'Account not activated'; return Response::json($output, 403); } User::$api_user = $findUser; return $next($request); } }
tokenly/token-slot
app/Http/Middleware/CheckClientKey.php
PHP
mit
696
/*! NSURL extension YSCategorys Copyright (c) 2013-2014 YoungShook https://github.com/youngshook/YSCategorys The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php */ #import <Foundation/Foundation.h> @interface NSURL (YSKit) /** Cover query string into NSDictionary */ - (NSDictionary *)ys_queryDictionary; + (NSURL *)ys_appStoreURLforApplicationIdentifier:(NSString *)identifier; + (NSURL *)ys_appStoreReviewURLForApplicationIdentifier:(NSString *)identifier; @end
youngshook/YSCategorys
Categorys/Foundation/NSURL+YSKit.h
C
mit
519
--- permalink: /en/getting-startedLearn redirect: /en/getting-started/ layout: redirect sitemap: false ---
sunnankar/wucorg
redirects/redirects4/en-getting-startedLearn.html
HTML
mit
106
#region References using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics.CodeAnalysis; using Speedy; #endregion namespace Scribe.Data.Entities { public class Page : ModifiableEntity { #region Constructors [SuppressMessage("ReSharper", "VirtualMemberCallInContructor")] public Page() { Versions = new Collection<PageVersion>(); } #endregion #region Properties public virtual PageVersion ApprovedVersion { get; set; } public virtual int? ApprovedVersionId { get; set; } public virtual PageVersion CurrentVersion { get; set; } public virtual int? CurrentVersionId { get; set; } /// <summary> /// Gets or sets a flag to indicated this pages has been "soft" deleted. /// </summary> public bool IsDeleted { get; set; } public virtual ICollection<PageVersion> Versions { get; set; } #endregion } }
BobbyCannon/Scribe
Scribe.Data/Entities/Page.cs
C#
mit
889
#pragma config(Sensor, in1, linefollower, sensorLineFollower) #pragma config(Sensor, dgtl5, OutputBeltSonar, sensorSONAR_mm) #pragma config(Motor, port6, WhipCreamMotor, tmotorVex393, openLoop) #pragma config(Motor, port7, InputBeltMotor, tmotorServoContinuousRotation, openLoop) #pragma config(Motor, port8, ElevatorMotor, tmotorServoContinuousRotation, openLoop) #pragma config(Motor, port9, OutputBeltMotor, tmotorServoContinuousRotation, openLoop) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// /* Project Title: Cookie Maker Team Members: Patrick Kubiak Date: Section: Task Description: Control cookie maker machine Pseudocode: Move input conveior belt set distance Move elevator set distance Move output conveior belt until whip cream Press whip cream Reset whip cream Move output conveior belt to end Reset elevator */ task main() { //Program begins, insert code within curly braces while (true) { //Input Conveior Belt startMotor(InputBeltMotor, 127); wait(2.5); stopMotor(InputBeltMotor); //Elevator startMotor(ElevatorMotor, 127); wait(1.5); stopMotor(ElevatorMotor); //Move Cookie To line follower do { startMotor(OutputBeltMotor, -127); } while(SensorValue(linefollower) > 2900); stopMotor(OutputBeltMotor); //Reset Elevator startMotor(ElevatorMotor, -127); wait(2); stopMotor(ElevatorMotor); //Move Cookie To Whip Cream startMotor(OutputBeltMotor, -127); wait(0.4); stopMotor(OutputBeltMotor); //Whip Cream Press startMotor(WhipCreamMotor, -127); wait(1); stopMotor(WhipCreamMotor); //Whip Cream Reset startMotor(WhipCreamMotor, 127); wait(0.9); stopMotor(WhipCreamMotor); //Output Conveior Belt startMotor(OutputBeltMotor, -127); wait(2); } }
patkub/pltw-vex-robotc
CookieMaker_Sensor.c
C
mit
1,901
# 弃用通知 此项目已不再维护,所有内容已经移至[magpie](https://github.com/haifenghuang/magpie)。 # Monkey程序语言 Table of Contents ================= * [Monkey程序语言](#monkey%E7%A8%8B%E5%BA%8F%E8%AF%AD%E8%A8%80) * [主页](#%E4%B8%BB%E9%A1%B5) * [概述](#%E6%A6%82%E8%BF%B0) * [总览](#%E6%80%BB%E8%A7%88) * [安装](#%E5%AE%89%E8%A3%85) * [基本用法](#%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95) * [语言之旅](#%E8%AF%AD%E8%A8%80%E4%B9%8B%E6%97%85) * [注释](#%E6%B3%A8%E9%87%8A) * [数据类型](#%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B) * [常量(字面值)](#%E5%B8%B8%E9%87%8F%E5%AD%97%E9%9D%A2%E5%80%BC) * [变量](#%E5%8F%98%E9%87%8F) * [保留字](#%E4%BF%9D%E7%95%99%E5%AD%97) * [类型转换](#%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2) * [qw(Quote word)关键字](#qwquote-word%E5%85%B3%E9%94%AE%E5%AD%97) * [enum关键字](#enum%E5%85%B3%E9%94%AE%E5%AD%97) * [元操作符(Meta\-Operators)](#%E5%85%83%E6%93%8D%E4%BD%9C%E7%AC%A6meta-operators) * [控制流程](#%E6%8E%A7%E5%88%B6%E6%B5%81%E7%A8%8B) * [using语句](#using%E8%AF%AD%E5%8F%A5) * [用户自定义操作符](#%E7%94%A8%E6%88%B7%E8%87%AA%E5%AE%9A%E4%B9%89%E6%93%8D%E4%BD%9C%E7%AC%A6) * [整型(Integer)](#%E6%95%B4%E5%9E%8Binteger) * [浮点型(Float)](#%E6%B5%AE%E7%82%B9%E5%9E%8Bfloat) * [Decimal类型](#decimal%E7%B1%BB%E5%9E%8B) * [数组(Array)](#%E6%95%B0%E7%BB%84array) * [字符串(String)](#%E5%AD%97%E7%AC%A6%E4%B8%B2string) * [哈希(Hash)](#%E5%93%88%E5%B8%8Chash) * [元祖(Tuple)](#%E5%85%83%E7%A5%96tuple) * [类](#%E7%B1%BB) * [继承和多态](#%E7%BB%A7%E6%89%BF%E5%92%8C%E5%A4%9A%E6%80%81) * [操作符重载](#%E6%93%8D%E4%BD%9C%E7%AC%A6%E9%87%8D%E8%BD%BD) * [属性(类似C\#)](#%E5%B1%9E%E6%80%A7%E7%B1%BB%E4%BC%BCc) * [索引器](#%E7%B4%A2%E5%BC%95%E5%99%A8) * [静态变量/方法/属性](#%E9%9D%99%E6%80%81%E5%8F%98%E9%87%8F%E6%96%B9%E6%B3%95%E5%B1%9E%E6%80%A7) * [类类别(class category)](#%E7%B1%BB%E7%B1%BB%E5%88%ABclass-category) * [注解](#%E6%B3%A8%E8%A7%A3) * [标准输入/输出/错误](#%E6%A0%87%E5%87%86%E8%BE%93%E5%85%A5%E8%BE%93%E5%87%BA%E9%94%99%E8%AF%AF) * [标准库中的错误处理](#%E6%A0%87%E5%87%86%E5%BA%93%E4%B8%AD%E7%9A%84%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86) * [关于defer关键字](#%E5%85%B3%E4%BA%8Edefer%E5%85%B3%E9%94%AE%E5%AD%97) * [不同类型的联接](#%E4%B8%8D%E5%90%8C%E7%B1%BB%E5%9E%8B%E7%9A%84%E8%81%94%E6%8E%A5) * [列表推导(Comprehensions)](#%E5%88%97%E8%A1%A8%E6%8E%A8%E5%AF%BCcomprehensions) * [Grep和map](#grep%E5%92%8Cmap) * [函数](#%E5%87%BD%E6%95%B0) * [Pipe操作符](#pipe%E6%93%8D%E4%BD%9C%E7%AC%A6) * [Spawn 和 channel](#spawn-%E5%92%8C-channel) * [使用go语言模块](#%E4%BD%BF%E7%94%A8go%E8%AF%AD%E8%A8%80%E6%A8%A1%E5%9D%97) * [标准模块介绍](#%E6%A0%87%E5%87%86%E6%A8%A1%E5%9D%97%E4%BB%8B%E7%BB%8D) * [fmt 模块](#fmt-%E6%A8%A1%E5%9D%97) * [time 模块](#time-%E6%A8%A1%E5%9D%97) * [logger 模块](#logger-%E6%A8%A1%E5%9D%97) * [flag 模块(处理命令行选项)](#flag-%E6%A8%A1%E5%9D%97%E5%A4%84%E7%90%86%E5%91%BD%E4%BB%A4%E8%A1%8C%E9%80%89%E9%A1%B9) * [json 模块( json序列化(marshal)和反序列化(unmarshal) )](#json-%E6%A8%A1%E5%9D%97-json%E5%BA%8F%E5%88%97%E5%8C%96marshal%E5%92%8C%E5%8F%8D%E5%BA%8F%E5%88%97%E5%8C%96unmarshal-) * [net 模块](#net-%E6%A8%A1%E5%9D%97) * [linq 模块](#linq-%E6%A8%A1%E5%9D%97) * [Linq for file支持](#linq-for-file%E6%94%AF%E6%8C%81) * [csv 模块](#csv-%E6%A8%A1%E5%9D%97) * [template 模块](#template-%E6%A8%A1%E5%9D%97) * [sql 模块](#sql-%E6%A8%A1%E5%9D%97) * [实用工具](#%E5%AE%9E%E7%94%A8%E5%B7%A5%E5%85%B7) * [文档生成](#%E6%96%87%E6%A1%A3%E7%94%9F%E6%88%90) * [语法高亮](#%E8%AF%AD%E6%B3%95%E9%AB%98%E4%BA%AE) * [未来计划](#%E6%9C%AA%E6%9D%A5%E8%AE%A1%E5%88%92) * [许可证](#%E8%AE%B8%E5%8F%AF%E8%AF%81) * [备注](#%E5%A4%87%E6%B3%A8) ## 主页 [monkey](https://github.com/haifenghuang/monkey) ## 概述 Monkey是一个用go语言写的解析器. 语法借鉴了C, Ruby, Python, Perl和C#. 支持常用的控制流程,函数式编程和面向对象编程。 同时它还包括一个实时语法高亮的REPL。 下面是一个使用monkey语言的示例程序: ```swift //声明注解,注解的body中必须是属性,不能是方法 class @MinMaxValidator { property MinLength property MaxLength default 10 //Same as 'property MaxLength = 10' } //Marker annotation class @NoSpaceValidator {} class @DepartmentValidator { property Department } //这个是请求类,我们对这个类使用注解 class Request { @MinMaxValidator(MinLength=1) property FirstName; //这种方式声明的属性,默认为可读可写。等价于'property FirstName { get; set; }' @NoSpaceValidator property LastName; @DepartmentValidator(Department=["Department of Education", "Department of Labors"]) property Dept; } //处理注解的类 class RequestHandler { static fn handle(o) { props = o.getProperties() for p in props { annos = p.getAnnotations() for anno in annos { if anno.instanceOf(MinMaxValidator) { //p.value表示属性的值 if len(p.value) > anno.MaxLength || len(p.value) < anno.MinLength { printf("Property '%s' is not valid!\n", p.name) } } elseif anno.instanceOf(NoSpaceValidator) { for c in p.value { if c == " " || c == "\t" { printf("Property '%s' is not valid!\n", p.name) break } } } elseif anno.instanceOf(DepartmentValidator) { found = false for d in anno.Department { if p.value == d { found = true } } if !found { printf("Property '%s' is not valid!\n", p.name) } } } } } } class RequestMain { static fn main() { request = new Request(); request.FirstName = "Haifeng123456789" request.LastName = "Huang " request.Dept = "Department of Labors" RequestHandler.handle(request); } } RequestMain.main() ``` 下面是处理结果: ``` Property 'FirstName' is not valid! Property 'LastName' is not valid! ``` 下面是一个实时语法高亮REPL: ![REPL](REPL.gif) 下面是使用mdoc生成的html文档: ![HTML DOC](doc.png) ## 总览 此项目是基于mayoms的项目 [monkey](https://github.com/mayoms/monkey),修改了其中的一些bug,同时增加了许多语言特性: * 增加了简单面向对象(oop)支持(索引器,操作符重载,属性,static方法,注解) * 更改了`string`模块(能够正确处理utf8字符编码) * 修改了`file`模块(包含一些新方法). * 增加了`math`,`time`, `sort`, `os`, `log`, `net`, `http`, `filepath`, `fmt`, `sync`, `list`, `csv`, `regexp`, `template`, 模块等 * `sql(db)`模块(能够正确的处理`null`值) * `flag`模块(用来处理命令行参数) * `json`模块(json序列化和反序列化) * `linq`模块(代码来自[linq](https://github.com/ahmetb/go-linq)并进行了相应的更改) * 增加了`decimal`模块(代码来自[decimal](https://github.com/shopspring/decimal)并进行了相应的小幅度更改) * 正则表达式支持(部分类似于perl) * 管道(channel)(基于go语言的channel) * 更多的操作符支持(&&, ||, &, |, ^, +=, -=, ?:, ??等等) * utf8支持(例如,你可以使用utf8字符作为变量名) * 更多的流程控制支持(例如: try/catch/finally, for-in, case-in, 类似c语言的for循环) * defer支持 * spawn支持(goroutine) * enum支持 * `using`支持(类似C#的using) * pipe操作符支持 * 支持可变参数和缺省参数的函数 * 支持列表推导(list comprehension)和哈希推导(hash comprehension) * 支持用户自定义操作符 * 使用Go Package的方法(`RegisterFunctions`和`RegisterVars`) 这个项目的目的主要有以下几点: * 自学go语言 * 了解解析器的工作原理 但是,解析器的速度并不是这个项目考虑的因素 ## 安装 下载本项目,运行`./run.sh` ## 基本用法 你可以如下方式使用REPL: ```sh ~ » monkey Monkey programming language REPL >> ``` 或者运行一个monkey文件: ```sh monkey path/to/file ``` ## 语言之旅 ### 注释 Monkey支持两种形式的单行注释和块注释: ```swift // a single line comment # another single line comment /* This is a block comment. */ ``` 同时也支持块注释 ### 数据类型 Monkey支持9种基本类型: `String`, `Int`, `UInt`, `Float`, `Bool`, `Array`, `Hash`, `Tuple`和`Nil` ```swift s1 = "hello, 黄" # strings are UTF-8 encoded s2 = `hello, "world"` # raw string i = 10 # int u = 10u # uint f = 10.0 # float b = true # bool a = [1, "2"] # array h = {"a": 1, "b": 2} # hash t = (1,2,3) # tuple n = nil ``` ### 常量(字面值) Monkey中,主要有11种类型的常量(字面量). * Integer * UInteger * Float * String * 正则表达式 * Array * Hash * Tuple * Nil * Boolean * Function ```swift // Integer literals i1 = 10 i2 = 20_000_000 i3 = 0x80 // hex i4 = 0b10101 // binary i5 = 0o127 // octal // Unsigned Integer literals ui1 = 10u ui2 = 20_000_000u //for more readable ui3 = 0x80u // hex ui4 = 0b10101u // binary ui5 = 0o127u // octal // Float literals f1 = 10.25 f2 = 1.02E3 f3 = 123_456.789_012 // String literals s1 = "123" s2 = "Hello world" // Regular expression literals r = /\d+/.match("12") if (r) { prinln("regex matched!") } // Array literals a = [1+2, 3, 4, "5", 3] // Hash literals h = { "a": 1, "b": 2, "c": 2} //Tuple literals t = (1, 2+3, "Hello", 5) // Nil literal n = nil // Boolean literals t = true f = false // Function literals let f1 = add(x, y) { return x + y } println(f1(1,2)) //fat-arrow function literals let f2 = (x, y) => x + y println(f2(1,2)) ``` ### 变量 你可以使用`let`来声明一个变量,或直接使用赋值的方式来声明并赋值一个变量:`variable=value`. ```swift let a, b, c = 1, "hello world", [1,2,3] d = 4 e = 5 姓="黄" ``` 你还可以使用`解构赋值`(Destructuring assignment), 当使用这种方法的时候,等号左边的变量必须用‘()’包起来: ```swift //等号右边为数组 let (d,e,f) = [1,5,8] //d=1, e=5, f=8 //等号右边为元祖 let (g, h, i) = (10, 20, "hhf") //g=10, h=20, i=hhf //等号右边为哈希 let (j, k, l) = {"j": 50, "l": "good"} //j=50, k=nil, l=good ``` 如果你不使用`let`来给变量赋值,那么你将不能使用多变量赋值。下面的语句是错误的: ```swift //错误,多变量赋值必须使用let关键字 a, b, c = 1, "hello world", [1,2,3] ``` 注:从Monkey 5.0开始,`let`的含义有所变化,如果声明的变量已经存在,给变量赋值的时候就会覆盖原来的值: ```swift let x, y = 10, 20; let x, y = y, x //交换两个变量的值 printf("x=%v, y=%v\n", x, y) //结果:x=20, y=10 ``` `let`还支持使用占位符(_), 如果给占位符赋了一个值,占位符会忽略这个值: ```swift let x, _, y = 10, 20, 30 printf("x=%d, y=%d\n", x, y) //结果:x=10, y=30 ``` ### 保留字 下面列出了monkey语言的保留字: * fn * let * true false nil * if elsif elseif elif else * unless * return * include * and or * enum * struct # 保留,暂时没使用 * do while for break continue where * grep map * case is in * try catch finally throw * defer * spawn * qw * using * class new property set get static default * interface public private protected #保留,暂时没使用 ### 类型转换 你可以使用内置的方法:`int()`, `uint()`, `float()`, `str()`, `array()`, `tuple`, `hash`, `decimal`来进行不同类型之间的转换. ```swift let i = 0xa let u = uint(i) // result: 10 let s = str(i) // result: "10" let f = float(i) // result: 10 let a = array(i) // result: [10] let t = tuple(i) // result: (10,) let h = hash(("key", "value")) // result: {"key": "value} let d = decimal("123.45634567") // result: 123.45634567 ``` 你可以从一个数组创建一个tuple: ```swift let t = tuple([10, 20]) //result:(10,20) ``` 同样的, 你也可以从一个tuple创建一个数组: ```swift let arr = array((10,20)) //result:[10,20] ``` 你只能从数组或者tuple来创建一个hash: ```swift //创建一个空的哈希 let h1 = hash() //same as h1 = {} //从数组创建哈希 let h1 = hash([10, 20]) //result: {10 : 20} let h2 = hash([10,20,30]) //result: {10 : 20, 30 : nil} //从tuple创建哈希 let h3 = hash((10, 20)) //result: {10 : 20} let h4 = hash((10,20,30)) //result: {10 : 20, 30 : nil} ``` ### `qw`(Quote word)关键字 `qw`关键字类似perl的`qw`关键字. 当你想使用很多的双引号字符串时,`qw`就是一个好帮手. ```swift for str in qw<abc, def, ghi, jkl, mno> { //允许的成对操作符:'{}', '<>', '()' println('str={str}') } newArr = qw(1,2,3.5) //注:这里的newArr是一个字符串数组,不是一个整形数组. fmt.printf("newArr=%v\n", newArr) ``` ### `enum`关键字 在mokey中,你可以使用`enum`来定义常量. ```swift LogOption = enum { Ldate = 1 << 0, Ltime = 1 << 1, Lmicroseconds = 1 << 2, Llongfile = 1 << 3, Lshortfile = 1 << 4, LUTC = 1 << 5, LstdFlags = 1 << 4 | 1 << 5 } opt = LogOption.LstdFlags println(opt) //得到`enum`的所有名称 for s in LogOption.getNames() { //非排序(non-ordered) println(s) } //得到`enum`的所有值 for s in LogOption.getValues() { //非排序(non-ordered) println(s) } // 得到`enum`的一个特定的名字 println(LogOption.getName(LogOption.Lshortfile)) ``` ### 元操作符(Meta-Operators) Monkey内嵌了一些类似Perl6的元操作符。 但是对于元操作符有严格的限制: * 元操作符只能针对数组进行操作 * 元操作符操作的数组中的所有元素必须是数字(uint, int, float)或者字符串 * 元操作符是中缀元操作符的时候,如果两边都是数组的话,数组元素必须相等 ```swift let arr1 = [1,2,3] ~* [4,5,6] let arr2 = [1,2,3] ~* 4 let arr3 = [1,2,"HELLO"] ~* 2 let value1 = ~*[10,2,2] let value2 = ~+[2,"HELLO",2] println(arr1) //结果:[4, 10, 18] println(arr2) //结果:[4, 8, 12] println(arr3) //结果:[2,4,"HELLOHELLO"] println(value1) //结果:40 println(value2) //结果:2HELLO2 ``` 目前为止,Monkey中有六个元操作符: * <p>~+</p> * <p>~-</p> * <p>~*</p> * <p>~/</p> * <p>~%</p> * <p>~^</p> 这六个元操作符既可以作为中缀表达式,也可以作为前缀表达式。 元操作符作为中缀表达式返回的结果为数组类型。 元操作符作为前缀表达式返回的结果为值类型(uint, int, float, string)。 下面的表格列出了相关的元操作符及其含义(只列出了`~+`): <table> <tr> <th>元操作符</td> <th>表达式</td> <th>举例</td> <th>结果</td> </tr> <tr> <td>~+</td> <td>中缀表达式</td> <td>[x1, y1, z1] ~+ [x2, y2, z2]</td> <td>[x1+x2, y1+y2, z1+z2] (数组)</td> </tr> <tr> <td>~+</td> <td>中缀表达式</td> <td>[x1, y1, z1] ~+ 4</td> <td>[x1+4, y1+4, z1+4] (数组)</td> </tr> <tr> <td>~+</td> <td>前缀表达式</td> <td>~+[x1, y1, z1]</td> <td>x1+y1+z1 (注:数值, 非数组)</td> </tr> </table> ### 控制流程 * if/if-else/if-elif-else/if-elsif-else/if-elseif-else/if-else if-else * unless/unless-else * for/for-in * while * do * try-catch-finally * case-in/case-is ```swift // if-else let a, b = 10, 5 if (a > b) { println("a > b") } elseif a == b { // 也可以使用'elsif', 'elseif'和'elif' println("a = b") } else { println("a < b") } //unless-else unless b > a { println("a >= b") } else { println("b > a") } // for i = 9 for { // 无限循环 i = i + 2 if (i > 20) { break } println('i = {i}') } i = 0 for (i = 0; i < 5; i++) { // 类似c语言的for循环, '()'必须要有 if (i > 4) { break } if (i == 2) { continue } println('i is {i}') } i = 0 for (; i < 5; i++) { // 无初期化语句 if (i > 4) { break } if (i == 2) { continue } println('i is {i}') } i = 0 for (; i < 5;;) { // 无初期化和更新语句 if (i > 4) { break } if (i == 2) { continue } println('i is {i}') i++ //更新语句 } i = 0 for (;;;) { // 等价于'for { block }'语句 if (i > 4) { break } println('i is {i}') i++ //更新语句 } for i in range(10) { println('i = {i}') } a = [1,2,3,4] for i in a where i % 2 != 0 { println(i) } hs = {"a":1, "b":2, "c":3, "d":4, "e":5, "f":6, "g":7} for k, v in hs where v % 2 == 0 { println('{k} : {v}') } for i in 1..5 { println('i={i}') } for item in 10..20 where $_ % 2 == 0 { // $_ is the index printf("idx=%d, item=%d\n", $_, item) } for c in "m".."a" { println('c={c}') } for idx, v in "abcd" { printf("idx=%d, v=%s\n", idx, v) } for idx, v in ["a", "b", "c", "d"] { printf("idx=%d, v=%s\n", idx, v) } for item in ["a", "b", "c", "d"] where $_ % 2 == 0 { // $_ 是索引 printf("idx=%d, item=%s\n", $_, v) } //for循环是个表达式(expression),而不是一个语句(statement), 因此它能够被赋值给一个变量 let plus_one = for i in [1,2,3,4] { i + 1 } fmt.println(plus_one) // while i = 10 while (i>3) { i-- println('i={i}') } // do i = 10 do { i-- if (i==3) { break } } // try-catch-finally(仅支持throw一个string类型的变量) let exceptStr = "SUMERROR" try { let th = 1 + 2 if (th == 3) { throw exceptStr } } catch "OTHERERROR" { println("Catched OTHERERROR") } catch exceptStr { println("Catched is SUMERROR") } catch { println("Catched ALL") } finally { println("finally running") } // case-in/case-is let testStr = "123" case testStr in { // in(完全或部分匹配), is(完全匹配) "abc", "mno" { println("testStr is 'abc' or 'mno'") } "def" { println("testStr is 'def'") } `\d+` { println("testStr contains digit") } else { println("testStr not matched") } } let i = [{"a":1, "b":2}, 10] let x = [{"a":1, "b":2},10] case i in { 1, 2 { println("i matched 1, 2") } 3 { println("i matched 3") } x { println("i matched x") } else { println("i not matched anything")} } ``` ### `using`语句 在Monkey中,如果你有一些资源需要释放(release/free/close),例如关闭文件,释放网络连接等等, 你可以使用类似`c#`的`using`语句。 ```swift // 这里,我们使用'using'语句,因此你不必显示调用infile.close()。 // 当'using'语句执行完后,Monkey解析器会隐式调用infile.close()。 using (infile = newFile("./file.demo", "r")) { if (infile == nil) { println("opening 'file.demo' for reading failed, error:", infile.message()) os.exit(1) } let line; let num = 0 //Read file by using extraction operator(">>") while (infile>>line != nil) { num++ printf("%d %s\n", num, line) } } ``` ### 用户自定义操作符 在Monkey中, 你可以自定义一些操作符, 但是你不能覆盖Monkey内置的操作符。 > 注: 并不是所有的操作符都可以自定义。 下面的例子展示了如何使用自定义操作符: ```swift //中缀运算符'=@'接受两个参数 fn =@(x, y) { return x + y * y } //前缀运算符'=^'仅接受一个参数 fn =^(x) { return -x } let pp = 10 =@ 5 // 使用用户自定义的中缀运算符'=@' printf("pp=%d\n", pp) // 结果: pp=35 let hh = =^10 // 使用用户自定义的前缀运算符'=^' printf("hh=%d\n", hh) // 结果: hh=-10 ``` ```swift fn .^(x, y) { arr = [] while x <= y { arr += x x += 2 } return arr } let pp = 10.^20 printf("pp=%v\n", pp) // result: pp=[10, 12, 14, 16, 18, 20] ``` 下面的表格列出了Monkey内置的运算符和用户可以自定义的运算符: <table> <tr> <th>内置运算符</td> <th>用户自定义运算符</td> </tr> <tr> <td>==<br/>=~<br/>=></td> <td>=X</td> </tr> <tr> <td>++<br/>+=</td> <td>+X</td> </tr> <tr> <td>--<br/>-=<br/>-></td> <td>-X</td> </tr> <tr> <td>&gt;=<br/>&lt;&gt;</td> <td>&gt;X</td> </tr> <tr> <td>&lt;=<br/>&lt;&lt;</td> <td>&lt;X</td> </tr> <tr> <td>!=<br/>!~</td> <td>!X</td> </tr> <tr> <td>*=<br/>**</td> <td>*X</td> </tr> <tr> <td>..<br/>..</td> <td>.X</td> </tr> <tr> <td>&amp;=<br/>&amp;&amp;</td> <td>&amp;X</td> </tr> <tr> <td>|=<br/>||</td> <td>|X</td> </tr> <tr> <td>^=</td> <td>^X</td> </tr> </table> > 在上面的表格中,`X`可以是`.=+-*/%&,|^~<,>},!?@#$`。 ### 整型(Integer) 在Monkey中,整型也是一个对象。因此,你可以调用这个对象的方法。请看下面的例子: ```swift x = (-1).next() println(x) //0 x = -1.next() //equals 'x = -(1.next()) println(x) //-2 x = (-1).prev() println(x) //-2 x = -1.prev() //equals 'x = -(1.prev()) println(x) //0 x = [i for i in 10.upto(15)] println(x) //[10, 11, 12, 13, 14, 15] for i in 10.downto(5) { print(i, "") //10 9 8 7 6 5 } println() if 10.isEven() { println("10 is even") } if 9.isOdd() { println("9 is odd") } ``` ### 浮点型(Float) 在Monkey中,浮点型也是一个对象。因此,你可以调用这个对象的方法。请看下面的例子: ```swift f0 = 15.20 println(f0) f1 = 15.20.ceil() println(f1) f2 = 15.20.floor() println(f2) ``` ### Decimal类型 在Monkey中,Decimal类型表示一个任意精度固定位数的十进数(Arbitrary-precision fixed-point decimal numbers). 这个类型的代码主要是基于[decimal](https://github.com/shopspring/decimal). 请看下面的例子: ```swift d1 = decimal.fromString("123.45678901234567") //从字符串创建Decimal类型 d2 = decimal.fromFloat(3) //从浮点型创建Decimal类型 //设置除法精度(division precision). //注意: 这个操作将会影响所有后续对Decimal类型的运算 decimal.setDivisionPrecision(50) fmt.println("123.45678901234567/3 = ", d1.div(d2)) //打印 d1/d2 fmt.println(d1.div(d2)) //效果同上 fmt.println(decimal.fromString("123.456").trunc(2)) //将字符串转换为decimal d3=decimal("123.45678901234567") fmt.println(d3) fmt.println("123.45678901234567/3 = ", d3.div(d2)) ``` ### 数组(Array) 在Monkey中, 你可以使用[]来初始化一个空的数组: ```swift emptyArr = [] emptyArr[3] = 3 //将会自动扩容 println(emptyArr) ``` 你可以使用两种方式来创建一个给定长度的数组: ```swift //创建一个有10个元素的数组(默认值为nil) //Note: this only support integer literal. let arr = []10 println(arr) //使用内置'newArray'方法. let anotherArr = newArray(len(arr)) println(anotherArr) println(anotherArr) //结果: [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil] let arr1 = ["1","a5","5", "5b","4","cc", "7", "dd", "9"] let arr2 = newArray(6, arr1, 10, 11, 12) //第一个参数为数组size println(arr2) //结果: ["1", "a5", "5", "5b", "4", "cc", "7", "dd", "9", 10, 11, 12] let arr3 = newArray(20, arr1, 10, 11, 12) println(arr3) //结果 : ["1", "a5", "5", "5b", "4", "cc", "7", "dd", "9", 10, 11, 12, nil, nil, nil, nil, nil, nil, nil, nil] ``` 数组可以包含任意数据类型的元素。 ```swift mixedArr = [1, 2.5, "Hello", ["Another", "Array"], {"Name":"HHF", "SEX":"Male"}] ``` 注: 最后关闭方括弧(']')前的逗号(',’)是可以省略的。 你可以使用索引来访问数组元素。 ```swift println('mixedArr[2]={mixedArr[2]}') println(["a", "b", "c", "d"][2]) ``` 因为数组是一个对象, 因此你可以使用对象方法来操作它。 ```swift if ([].empty()) { println("array is empty") } emptyArr.push("Hello") println(emptyArr) //你可以使用'加算(+=)'的方式来向数组中添加一个元素: emptyArr += 2 println(emptyArr) //你还可以使用`<<(插入操作符)`的方式来向数组中添加一个元素,插入操作符支持链式操作。 emptyArr << 2 << 3 println(emptyArr) ``` 可以使用`for`循环来遍历一个数组。 ```swift numArr = [1,3,5,2,4,6,7,8,9] for item in numArr where item % 2 == 0 { println(item) } let strArr = ["1","a5","5", "5b","4","cc", "7", "dd", "9"] for item in strArr where /^\d+/.match(item) { println(item) } for item in ["a", "b", "c", "d"] where $_ % 2 == 0 { //$_是索引 printf("idx=%d, v=%s\n", $_, item) } ``` 你可以使用内置函数`reverse`来反转数组元素: ```swift let arr = [1,3,5,2,4,6,7,8,9] println("Source Array =", arr) revArr = reverse(arr) println("Reverse Array =", revArr) ``` 数组还支持使用`数组乘法运算符`(*): ```swift let arr = [3,4] * 3 println(arr) // 结果: [3,4,3,4,3,4] ``` ### 字符串(String) 在monkey中, 有三种类型的`string`: * 原生字符串(可包含`\n`) * 双引号字符串(不可包含`\n`) * 单引号字符串(可解析字符串) 原生字符串是一系列字符序列。使用反引号(``)来表示. 在原生字符串中,除了不能使用反引号外,你可以使用其它的任意字符。 请看下面的例子: ```swift normalStr = "Hello " + "world!" println(normalStr) println("123456"[2]) rawStr = `Welcome to visit us!` println(rawStr) //当你希望一个变量在字符串中也能够被解析时,你可以使用单引号。 //需要被解析的字符串放在花括号('{}')中: str = "Hello world" println('str={str}') //输出: "Hello world" str[6]="W" println('str={str}') //输出: "Hello World" ``` 在monkey中, 字符串是utf8编码的, 这说明你可以使用utf8编码的字符作为变量名: ```swift 三 = 3 五 = 5 println(三 + 五) //输出 : 8 ``` 字符串也是对象,你可以使用`strings`模块中的方法来操作字符串: ```swift upperStr = "hello world".upper() println(upperStr) //输出 : HELLO WORLD ``` 字符串也可以被遍历: ```swift for idx, v in "abcd" { printf("idx=%d, v=%s\n", idx, v) } for v in "Hello World" { printf("idx=%d, v=%s\n", $_, v) //$_是索引 } ``` 你可以连接一个对象到字符串: ```swift joinedStr = "Hello " + "World" joinedStr += "!" println(joinedStr) ``` 你还可以使用内置函数`reverse`来反转字符串: ```swift let str = "Hello world!" println("Source Str =", str) revStr = reverse(str) println("Reverse str =", revStr) ``` 如果你希望将一个包含数字的字符串转换为数字,你可以在字符串之前加入"+“号,将此字符串转换为数字: ```swift a = +"121314" // a是一个整数 println(a) // 结果:121314 // 整数支持"0x"(十六进制), "0b"(二进制), "0o"(八进制)前缀 a = +"0x10" // a是一个整数 println(a) // 结果:16 a = +"121314.6789" // a是一个浮点数 println(a) // 结果:121314.6789 ``` ### 哈希(Hash) 在monkey中,哈希默认会保持Key的插入顺序,类似Python的orderedDict. 你可以使用{}来创建一个空的哈希: ```swift emptyHash = {} emptyHash["key1"] = "value1" println(emptyHash) ``` 哈希的键(key)可以是字符串(string),整型(int)或布尔型(boolean): ```swift hashObj = { 12 : "twelve", true : 1, "Name" : "HHF" } hash["age"] = 12 // same as hash.age = 12 println(hashObj) ``` 注: 最后关闭花括弧('}')前的逗号(',’)是可以省略的。 你还可以使用'+'或'-'来从一个哈希中增加或者删除一个元素: ```swift hashObj += {"key1" : "value1"} hashObj += {"key2" : "value2"} hashObj += {5 : "five"} hashObj -= "key2" hashObj -= 5 println(hash) ``` 哈希也是一个对象,你可以使用`hash`模块中的方法来操作哈希: ```swift hashObj.push(15, "fifteen") //第一个参数是键,第二个参数是值 hashObj.pop(15) keys = hashObj.keys() println(keys) values = hashObj.values() println(values) ``` 你还可以使用内置函数`reverse`来反转哈希的key和value: ```swift let hs = {"key1":12, "key2":"HHF", "key3":false} println("Source Hash =", hs) revHash = reverse(hs) println("Reverse Hash =", revHash) ``` ### 元祖(Tuple) 在Monkey中, `tuple`与数组非常类似, 但一旦你创建了一个元祖,你就不能够更改它。 Tuples使用括号来创建: ```swift //创建一个空元祖 let t1 = tuple() //效果同上 let t2 = () // 创建仅有一个元素的元祖. // 注意: 结尾的","是必须的,否则将会被解析为(1), 而不是元祖 let t3 = (1,) //创建有两个元素的元祖 let t4 = (2,3) ``` 你可以使用内置函数`tuple`,将任何类型的对象装换为元祖。 ```swift let t = tuple("hello") println(t) // 结果: ("hello") ``` 类似于数组, 元祖也可以被索引(indexed),或切片(sliced)。 索引表达式`tuple[i]`返回第i个索引位置的元祖元素, 切片表达式 tuple[i:j]返回一个子元祖. ```swift let t = (1,2,3)[2] print(t) // result:3 ``` 元祖还可以被遍历(类似数组),所以元祖可以使用在for循环中,用在 列表推导中。 ```swift //for循环 for i in (1,2,3) { println(i) } //元祖推导(comprehension) let t1 = [x+1 for x in (2,4,6)] println(t1) //result: [3, 5, 7]. 注意: 结果是数组,不是元祖 ``` 与数组不同,元祖不能够被修改。但是元祖内部的可变元素是可以被修改的. ```swift arr1 = [1,2,3] t = (0, arr1, 5, 6) println(t) // 结果: (0, [1, 2, 3], 5, 6) arr1.push(4) println(t) //结果: (0, [1, 2, 3, 4], 5, 6) ``` 元祖也可以用作哈希的键。 ```swift key1=(1,2,3) key2=(2,3,4) let ht = {key1 : 10, key2 : 20} println(ht[key1]) // result: 10 println(ht[key2]) // result: 20 ``` 元祖可以使用`+`来连接,它会创建一个新的元祖。 ```swift let t = (1, 2) + (3, 4) println(t) // 结果: (1, 2, 3, 4) ``` 如果将元祖用在布尔环境中,那么如果元祖的元素数量大于0, 那么返回结果是true。 ```swift let t = (1,) if t { println("t is not empty!") } else { println("t is empty!") } //结果 : "t is not empty!" ``` 元祖的json序列化(反序列化)的结果都为数组,而不是元祖 ```swift let tupleJson = ("key1","key2") let tupleStr = json.marshal(tupleJson) //结果: [ // "key1", // "key2", // ] println(json.indent(tupleStr, " ")) let tupleJson1 = json.unmarshal(tupleStr) println(tupleJson1) //结果: ["key1", "key2"] ``` 元祖与一个数组相加,返回结果为一个数组,而不是元祖. ```swift t2 = (1,2,3) + [4,5,6] println(t2) // 结果: [(1, 2, 3), 4, 5, 6] ``` 你也可以使用内置函数`reverse`来反转元祖中的元素: ```swift let tp = (1,3,5,2,4,6,7,8,9) println(tp) //结果: (1, 3, 5, 2, 4, 6, 7, 8, 9) revTuple = reverse(tp) println(revTuple) //结果: (9, 8, 7, 6, 4, 2, 5, 3, 1) ``` ### 类 Monkey支持简单的面向对象编程, 下面列出了Mokey支持的特性: * 继承和多态 * 操作符重载 * 属性(getter和setter) * 静态变量/方法/属性 * 索引器 * 类类别(类似Objective-c的Category) * 注解(类似java的annotation) * 类的构造器方法和类的普通方法支持多参数和默认参数 monkey解析器(parser)能够正确的处理关键字`public`, `private`, `protected`, 但是解释器(evaluator)会忽略这些。 也就是说,monkey现在暂时不支持访问限定。 你可以使用`class`关键字来声明一个类,使用`new Class(xxx)`来创建一个类的实例。 ```swift class Animal { let name = "" fn init(name) { //'init'是构造方法 //do somthing } } ``` 在monkey中,所有的类都继承于`object`根类。`object`根类包含几个所有类的共通方法。比如`toString()`, `instanceOf()`, `is_a()`, `classOf()`, `hashCode`。 `instanceOf()`等价于`is_a()` 下面的代码和上面的代码等价: ```swift class Animal : object { let name = "" fn init(name) { //'init'是构造方法 //do somthing } } ``` #### 继承和多态 你使用`:`来表示继承关系: ```swift class Dog : Animal { //Dog类继承于Animal类 } ``` 在子类中,你可以使用`parent`来访问基类的方法和字段。 请看下面的例子: ```swift class Animal { let Name; fn MakeNoise() { println("generic noise") } fn ToString() { return "oooooooo" } } class Cat : Animal { fn init(name) { this.Name = name } fn MakeNoise() { println("Meow") } fn ToString() { return Name + " cat" } } class Dog : Animal { fn init(name) { this.Name = name } fn MakeNoise() { println("Woof!") } fn ToString() { return Name + " dog" } fn OnlyDogMethod() { println("secret dog only method") } } cat = new Cat("pearl") dog = new Dog("cole") randomAnimal = new Animal() animals = [cat, dog, randomAnimal] for animal in animals { println("Animal name: " + animal.Name) animal.MakeNoise() println(animal.ToString()) if is_a(animal, "Dog") { animal.OnlyDogMethod() } } ``` 运行结果如下: ``` Animal name: pearl Meow pearl cat Animal name: cole Woof! cole dog secret dog only method Animal name: nil generic noise oooooooo ``` #### 操作符重载 ```swift class Vector { let x = 0; let y = 0; // 构造函数 fn init (a, b, c) { if (!a) { a = 0;} if (!b) {b = 0;} x = a; y = b } fn +(v) { //重载'+' if (type(v) == "INTEGER" { return new Vector(x + v, y + v); } elseif v.is_a(Vector) { return new Vector(x + v.x, y + v.y); } return nil; } fn String() { return fmt.sprintf("(%v),(%v)", this.x, this.y); } } fn Vectormain() { v1 = new Vector(1,2); v2 = new Vector(4,5); // 下面的代码会调用Vector对象的'+'方法 v3 = v1 + v2 //等价于'v3 = v1.+(v2)' // 返回"(5),(7)" println(v3.String()); v4 = v1 + 10 //等价于v4 = v1.+(10); //返回"(11),(12)" println(v4.String()); } Vectormain() ``` #### 属性(类似C#) ```swift class Date { let month = 7; // Backing store property Month { get { return month } set { if ((value > 0) && (value < 13)) { month = value } else { println("BAD, month is invalid") } } } property Year; //与'property Year { get; set;}'等价 property Day { get; } property OtherInfo1 { get; } property OtherInfo2 { set; } fn init(year, month, day) { this.Year = year this.Month = month this.Day = day } fn getDateInfo() { printf("Year:%v, Month:%v, Day:%v\n", this.Year, this.Month, this.Day) //note here, you need to use 'this.Property', not 'Property' } } dateObj = new Date(2000, 5, 11) //printf("Calling Date's getter, month=%d\n", dateObj.Month) dateObj.getDateInfo() println() dateObj.Month = 10 printf("dateObj.Month=%d\n", dateObj.Month) dateObj.Year = 2018 println() dateObj.getDateInfo() //下面的代码会报错,因为OtherInfo1是个只读属性 //dateObj.OtherInfo1 = "Other Date Info" //println(dateObj.OtherInfo1) //下面的代码会报错,因为OtherInfo2是个只写属性 //dateObj.OtherInfo2 = "Other Date Info2" //println(dateObj.OtherInfo2) //下面的代码会报错,因为Day属性是个只读属性 //dateObj.Day = 18 ``` #### 索引器 Monkey还支持类似C#的索引器(`Indexer`)。 索引器能够让你像访问数组一样访问对象。 索引器使用如下的方式声明: 使用`property this[parameter]`方式来声明一个索引器。 ```swift property this[index] { get { xxx } set { xxx } } ``` 请看下面的代码: ```swift class IndexedNames { let namelist = [] let size = 10 fn init() { let i = 0 for (i = 0; i < size; i++) { namelist[i] = "N. A." } } fn getNameList() { println(namelist) } property this[index] { get { let tmp; if ( index >= 0 && index <= size - 1 ) { tmp = namelist[index] } else { tmp = "" } return tmp } set { if ( index >= 0 && index <= size-1 ) { namelist[index] = value } } } } fn Main() { namesObj = new IndexedNames() //下面的代码会调用索引器的setter方法 namesObj[0] = "Zara" namesObj[1] = "Riz" namesObj[2] = "Nuha" namesObj[3] = "Asif" namesObj[4] = "Davinder" namesObj[5] = "Sunil" namesObj[6] = "Rubic" namesObj.getNameList() for (i = 0; i < namesObj.size; i++) { println(namesObj[i]) //调用索引器的getter方法 } } Main() ``` #### 静态变量/方法/属性 ```swift class Test { static let x = 0; static let y = 5; static fn Main() { println(Test.x); println(Test.y); Test.x = 99; println(Test.x); } } Test.Main() ``` 注:非静态变量/方法/属性可以访问静态变量/方法/属性。 但是反过来不行。 #### 类类别(class category) Monkey支持类似objective-c的类别(C#中称为extension methods)。 ```swift class Animal { fn Walk() { println("Animal Walk!") } } //类类别 like objective-c class Animal (Run) { //建立一个Animal的Run类别. fn Run() { println("Animal Run!") this.Walk() //可以调用Animal类的Walk()方法. } } animal = new Animal() animal.Walk() println() animal.Run() ``` #### 注解 Monkey也支持非常简单的“注解”: * 仅支持类的属性和方法的注解(不支持类自身的注解,也不支持普通方法的注解) * 注解类的声明中,仅支持属性,不支持方法 * 使用注解时,你必须创建一个相应的对象 使用`class @annotationName {}`的方式来声明一个注解。 Monkey同时包含几个内置的注解: * @Override(作用类似于java的@Override)。 * @NotNull * @NotEmpty 请看下面的例子: ```swift //声明注解,注解的body中必须是属性,不能是方法 class @MinMaxValidator { property MinLength property MaxLength default 10 //Same as 'property MaxLength = 10' } //Marker annotation class @NoSpaceValidator {} class @DepartmentValidator { property Department } //这个是请求类,我们对这个类使用注解 class Request { @MinMaxValidator(MinLength=1) property FirstName; //默认可读可写(getter和setter),等价于'property FirstName {get; set;}' @NoSpaceValidator property LastName; @DepartmentValidator(Department=["Department of Education", "Department of Labors", "Department of Justice"]) property Dept; } //处理注解的类 class RequestHandler { static fn handle(o) { props = o.getProperties() for p in props { annos = p.getAnnotations() for anno in annos { if anno.instanceOf(MinMaxValidator) { //p.value表示属性的值 if len(p.value) > anno.MaxLength || len(p.value) < anno.MinLength { printf("Property '%s' is not valid!\n", p.name) } } elseif anno.instanceOf(NoSpaceValidator) { for c in p.value { if c == " " || c == "\t" { printf("Property '%s' is not valid!\n", p.name) break } } } elseif anno.instanceOf(DepartmentValidator) { found = false for d in anno.Department { if p.value == d { found = true } } if !found { printf("Property '%s' is not valid!\n", p.name) } } } } } } class RequestMain { static fn main() { request = new Request(); request.FirstName = "Haifeng123456789" request.LastName = "Huang " request.Dept = "Department of Justice" RequestHandler.handle(request); } } RequestMain.main() ``` 下面是处理结果: ``` Property 'FirstName' not valid! Property 'LastName' not valid! ``` ### 标准输入/输出/错误 Monkey中预定义了下面三个对象: `stdin`, `stdout`, `stderr`。分别代表标准输入,标准输出,标准错误。 ```swift stdout.writeLine("Hello world") //和上面效果一样 fmt.fprintf(stdout, "Hello world\n") print("Please type your name:") name = stdin.read(1024) //从标准输入读最多1024字节 println("Your name is " + name) ``` 你还可以使用类似C++的插入操作符(`<<`)和提取操作符(`>>`)来操作标准输入和输出。 ```swift // Output to stdout by using insertion operator("<<") // 'endl' is a predefined object, which is "\n". stdout << "hello " << "world!" << " How are you?" << endl; // Read from stdin by using extraction operator(">>") let name; stdout << "Your name please: "; stdin >> name; printf("Welcome, name=%v\n", name) ``` 插入操作符(`<<`)和提取操作符(`>>`)同样适用于文件操作。 ```swift //Read file by using extraction operator(">>") infile = newFile("./file.demo", "r") if (infile == nil) { println("opening 'file.demo' for reading failed, error:", infile.message()) os.exit(1) } let line; let num = 0 while ( infile>>line != nil) { num++ printf("%d %s\n", num, line) } infile.close() //Writing to file by using inserttion operator("<<") outfile = newFile("./outfile.demo", "w") if (outfile == nil) { println("opening 'outfile.demo' for writing failed, error:", outfile.message()) os.exit(1) } outfile << "Hello" << endl outfile << "world" << endl outfile.close() ``` ### 标准库中的错误处理 当标准库中的函数返回`nil`或者`false`的时候,你可以使用它们的`message()`方法类获取错误信息: ```swift file = newFile(filename, "r") if (file == nil) { println("opening ", filename, "for reading failed, error:", file.message()) } //操作文件 //... //关闭文件 file.close() let ret = http.listenAndServe("127.0.0.1:9090") if (ret == false) { println("listenAndServe failed, error:", ret.message()) } ``` 也许你会觉得奇怪,为什么`nil`或`false`有`message()`方法? 因为在monkey中, `nil`和`false`两个都是对象,因此它们都有方法。 ### 关于`defer`关键字 `defer`语句推迟(defer)某个函数的执行直到函数返回。 ```swift let add = fn(x,y){ defer println("I'm defer1") println("I'm in add") defer println("I'm defer2") return x + y } println(add(2,2)) ``` 结果如下: ```sh I'm in add I'm defer2 I'm defer1 4 ``` ### 不同类型的联接 Monkey中,你可以联接不同的类型。请看下面的例子: ```swift // Number plus assignment num = 10 num += 10 + 15.6 num += 20 println(num) // String plus assignment str = "Hello " str += "world! " str += [1, 2, 3] println(str) // Array plus assignment arr = [] arr += 1 arr += 10.5 arr += [1, 2, 3] arr += {"key":"value"} println(arr) // Array compare arr1 = [1, 10.5, [1, 2, 3], {"key" : "value"}] println(arr1) if arr == arr1 { //support ARRAY compare println("arr1 = arr") } else { println("arr1 != arr") } // Hash assignment("+=", "-=") hash = {} hash += {"key1" : "value1"} hash += {"key2" : "value2"} hash += {5 : "five"} println(hash) hash -= "key2" hash -= 5 println(hash) ``` ### 列表推导(Comprehensions) Monkey支持列表推导(列表可以为数组,字符串,Range,Tuple, 哈希)。 列表推导的返回值均为数组。请看下面的例子: ```swift //数组 x = [[word.upper(), word.lower(), word.title()] for word in ["hello", "world", "good", "morning"]] println(x) //结果:[["HELLO", "hello", "Hello"], ["WORLD", "world", "World"], ["GOOD", "good", "Good"], ["MORNING", "morning", "Morning"]] //字符串 y = [ c.upper() for c in "huanghaifeng" where $_ % 2 != 0] //$_ is the index println(y) //结果:["U", "N", "H", "I", "E", "G"] //范围 w = [i + 1 for i in 1..10] println(w) //结果:[2, 3, 4, 5, 6, 7, 8, 9, 10, 11] //tuple v = [x+1 for x in (12,34,56)] println(v) //结果:[13, 35, 57] //哈希 z = [v * 10 for k,v in {"key1":10, "key2":20, "key3":30}] println(z) //结果:[100, 200, 300] ``` Monkey同时也支持哈希推导。 哈希推导的返回值均为哈希。请看下面的例子: ```swift //哈希推导 (from hash) z1 = { v:k for k,v in {"key1":10, "key2":20, "key3":30}} //reverse key-value pair println(z1) // 结果: {10 : "key1", 20 : "key2", 30 : "key3"}, 顺序可能不同 //哈希推导 (from array) z2 = {x:x**2 for x in [1,2,3]} println(z2) // 结果: {1 : 1, 2 : 4, 3 : 9}, 顺序可能不同 //哈希推导 (from .. range) z3 = {x:x**2 for x in 5..7} println(z3) // 结果: {5 : 25, 6 : 36, 7 : 49}, 顺序可能不同 //哈希推导 (from string) z4 = {x:x.upper() for x in "hi"} println(z4) // 结果: {"h" : "H", "i" : "I"}, 顺序可能不同 //哈希推导 (from tuple) z5 = {x+1:x+2 for x in (1,2,3)} println(z5) // 结果: {4 : 5, 2 : 3, 3 : 4}, 顺序可能不同 ``` ### Grep和map `grep`和`map`类似于perl的`grep`和`map`. ```swift let sourceArr = [2,4,6,8,10,12] //$_表示每次循环取得的值 let m = grep $_ > 5, sourceArr //对每一个sourceArr中的元素,仅返回">5"的元素 println('m is {m}') let cp = map $_ * 2 , sourceArr //将每个元素乘以2 println('cp is {cp}') //一个复杂一点的例子 let fields = { "animal" : "dog", "building" : "house", "colour" : "red", "fruit" : "apple" } let pattern = `animal|fruit` // =~(匹配), !~(不匹配) let values = map { fields[$_] } grep { $_ =~ pattern } fields.keys() println(values) ``` ### 函数 在Monkey中,函数和别的基础类型一样,能够作为函数的参数,作为函数的返回值 函数还可以有缺省参数和可变参数。 ```swift //define a function let add = fn() { [5,6] } let n = [1, 2] + [3, 4] + add() println(n) let complex = { "add" : fn(x, y) { return fn(z) {x + y + z } }, //function with closure "sub" : fn(x, y) { x - y }, "other" : [1,2,3,4] } println(complex["add"](1, 2)(3)) println(complex["sub"](10, 2)) println(complex["other"][2]) let warr = [1+1, 3, fn(x) { x + 1}(2),"abc","def"] println(warr) println("\nfor i in 5..1 where i > 2 :") for i in fn(x){ x+1 }(4)..fn(x){ x+1 }(0) where i > 2 { if (i == 3) { continue } println('i={i}') } // 缺省参数和可变参数 add = fn (x, y=5, z=7, args...) { w = x + y + z for i in args { w += i } return w } w = add(2,3,4,5,6,7) println(w) ``` 你也可以像下面这样创建一个命名函数: ```swift fn sub(x,y=2) { return x - y } println(sub(10)) //结果 : 8 ``` 你还可以使用`胖箭头(fat arraw)`语法来创建一个匿名函数: ```swift let x = () => 5 + 5 println(x()) //结果: 10 let y = (x) => x * 5 println(y(2)) //结果: 10 let z = (x,y) => x * y + 5 println(z(3,4)) //结果 :17 let add = fn (x, factor) { x + factor(x) } result = add(5, (x) => x * 2) println(result) //结果 : 15 ``` 如果函数没有参数,你可以省略()。例如 ```swift println("hhf".upper) //结果: "HHF" //和上面结果一样 println("hhf".upper()) ``` Monkey5.0之前,函数不支持多个返回值, 但有很多方法可以达到目的. 下面是其中的一种实现方式: ```swift fn div(x, y) { if y == 0 { return [nil, "y could not be zero"] } return [x/y, ""] } ret = div(10,5) if ret[1] != "" { println(ret[1]) } else { println(ret[0]) } ``` 从版本5.0开始,Monkey可以使用let语句支持函数返回多个值。 返回的多个值被包装为一个元祖(tuple)。 ```swift fn testReturn(a, b, c, d=40) { return a, b, c, d } let (x, y, c, d) = testReturn(10, 20, 30) // let x, y, c, d = testReturn(10, 20, 30) same as above printf("x=%v, y=%v, c=%v, d=%v\n", x, y, c, d) //Result: x=10, y=20, c=30, d=40 ``` 注:必须使用`let`才能够支持支持函数的多个返回值,下面的语句无法通过编译。 ```swift (x, y, c, d) = testReturn(10, 20, 30) // no 'let', compile error x, y, c, d = testReturn(10, 20, 30) // no 'let', compile error ``` ### Pipe操作符 `pipe`操作符来自[Elixir](https://elixir-lang.org/). ```swift # Test pipe operator(|>) x = ["hello", "world"] |> strings.join(" ") |> strings.upper() |> strings.lower() |> strings.title() printf("x=<%s>\n", x) let add = fn(x,y) { return x + y } let pow = fn(x) { return x ** 2} let subtract = fn(x) { return x - 1} let mm = add(1,2) |> pow() |> subtract() printf("mm=%d\n", mm) "Hello %s!\n" |> fmt.printf("world") ``` ### Spawn 和 channel 你可以使用`spawn`来创建一个新的线程, `chan`来和这个线程进行交互. ```swift let aChan = chan() spawn fn() { let message = aChan.recv() println('channel received message=<{message}>') }() //发送信息到线程 aChan.send("Hello Channel!") ``` 使用channel和spawn的组合,你可以实现lazy evaluation(延迟执行): ```swift // XRange is an iterator over all the numbers from 0 to the limit. fn XRange(limit) { ch = chan() spawn fn() { //for (i = 0; i <= limit; i++) // 警告: 务必不要使用此种类型的for循环,否则得到的结果不会是你希望的 for i in 0..limit { ch.send(i) } // 确保循环终了的时候,channel被正常关闭! ch.close() }() return ch } for i in XRange(10) { fmt.println(i) } ``` ## 使用`go`语言模块 Monkey提供了引入`go`语言模块的功能(实验性)。 如果你需要使用`go`语言的package函数或类型,你首先需要使用`RegisterFunctions'或`RegisterVars` 来注册`go`语言的方法或类型到Monkey语言中。 下面是`main.go`中的例子(节选): ```swift // 因为Monkey语言中,已经提供了内置模块`fmt`, 因此这里我们使用`gfmt`作为名字。 eval.RegisterFunctions("gfmt", []interface{}{ fmt.Errorf, fmt.Println, fmt.Print, fmt.Printf, fmt.Fprint, fmt.Fprint, fmt.Fprintln, fmt.Fscan, fmt.Fscanf, fmt.Fscanln, fmt.Scan, fmt.Scanf, fmt.Scanln, fmt.Sscan, fmt.Sscanf, fmt.Sscanln, fmt.Sprint, fmt.Sprintf, fmt.Sprintln, }) eval.RegisterFunctions("io/ioutil", []interface{}{ ioutil.WriteFile, ioutil.ReadFile, ioutil.TempDir, ioutil.TempFile, ioutil.ReadAll, ioutil.ReadDir, ioutil.NopCloser, }) eval.Eval(program, scope) ``` 接下来, 在你的Monkey文件中,像下面这样使用导入的方法: ```swift gfmt.Printf("Hello %s!\n", "go function"); //注意: 这里需要使用'io_ioutil', 而不是'io/ioutil'。 let files, err = io_ioutil.ReadDir(".") if err != nil { gfmt.Println(err) } for file in files { if file.Name() == ".git" { continue } gfmt.Printf("Name=%s, Size=%d\n", file.Name(), file.Size()) } ``` 更详细的例子请参照`goObj.my`。 ## 标准模块介绍 Monkey中,预定义了一些标准模块,例如:json, sql, sort, fmt, os, logger, time, flag, net, http等等。 下面是对monkey的标准模块的一个简短的描述。 ### fmt 模块 ```swift let i, f, b, s, aArr, aHash = 108, 25.383, true, "Hello, world", [1, 2, 3, 4, "a", "b"], { "key1" : 1, "key2" : 2, "key3" : "abc"} //使用 '%v (value)' 来打印变量值, '%_' 来打印变量类型 fmt.printf("i=[%05d, %X], b=[%t], f=[%.5f], s=[%-15s], aArr=%v, aHash=%v\n", i, i, b, f, s, aArr, aHash) fmt.printf("i=[%_], b=[%t], f=[%f], aArr=%_, aHash=%_, s=[%s] \n", i, b, f, aArr, aHash, s) sp = fmt.sprintf("i=[%05d, %X], b=[%t], f=[%.5f], s=[%-15s]\n", i, i, b, f, s) fmt.printf("sp=%s", sp) fmt.fprintf(stdout, "Hello %s\n", "world") ``` ### time 模块 ```swift t1 = newTime() format = t1.strftime("%F %R") println(t1.toStr(format)) Epoch = t1.toEpoch() println(Epoch) t2 = t1.fromEpoch(Epoch) println(t2.toStr(format)) ``` ### logger 模块 ```swift #输出到标准输出(stdout) log = newLogger(stdout, "LOGGER-", logger.LSTDFLAGS | logger.LMICROSECONDS) log.printf("Hello, %s\n", "logger") fmt.printf("Logger: flags =<%d>, prefix=<%s>\n", log.flags(), log.prefix()) //输出到文件 file = newFile("./logger.log", "a+") log.setOutput(file) for i in 1..5 { log.printf("This is <%d>\n", i) } file.close() //别忘记关闭文件 ``` ### flag 模块(处理命令行选项) ```swift let verV = flag.bool("version", false, "0.1") let ageV = flag.int("age", 40, "an int") let heightV = flag.float("height", 120.5, "a float") let nameV = flag.string("name", "HuangHaiFeng", "a string") let hobbiesV = flag.string("hobbies", "1,2,3", "a comma-delimited string") flag.parse() println("verV = ", verV) println("ageV = ", ageV) println("heightV = ", heightV) println("nameV = ", nameV) println("hobbies = ", hobbiesV.split(",")) if (flag.isSet("age")) { println("age is set") } else { println("age is not set") } ``` ### json 模块( json序列化(marshal)和反序列化(unmarshal) ) ```swift let hsJson = {"key1" : 10, "key2" : "Hello Json %s %s Module", "key3" : 15.8912, "key4" : [1,2,3.5, "Hello"], "key5" : true, "key6" : {"subkey1":12, "subkey2":"Json"}, "key7" : fn(x,y){x+y}(1,2) } let hashStr = json.marshal(hsJson) //也可以使用 `json.toJson(hsJson)` println(json.indent(hashStr, " ")) let hsJson1 = json.unmarshal(hashStr) println(hsJson1) let arrJson = [1,2.3,"HHF",[],{ "key" :10, "key1" :11}] let arrStr = json.marshal(arrJson) println(json.indent(arrStr)) let arr1Json = json.unmarshal(arrStr) //也可以使用 `json.fromJson(arrStr)` println(arr1Json) ``` ### net 模块 ```swift //简单的TCP客户端 let conn = dialTCP("tcp", "127.0.0.1:9090") if (conn == nil) { println("dailTCP failed, error:", conn.message()) os.exit(1) } let n = conn.write("Hello server, I'm client") if (n == nil) { println("conn write failed, error:", n.message()) os.exit(1) } let ret = conn.close() if (ret == false) { println("Server close failed, error:", ret.message()) } //一个简单的TCP服务端 let ln = listenTCP("tcp", ":9090") for { let conn = ln.acceptTCP() if (conn == nil) { println(conn.message()) } else { printf("Accepted client, Address=%s\n", conn.addr()) } spawn fn(conn) { //spawn a thread to handle the connection println(conn.read()) }(conn) } //end for let ret = ln.close() if (ret == false) { println("Server close failed, error:", ret.message()) } ``` ### linq 模块 在Monkey中, `linq`模块支持下面的其中类型的对象: * File对象 (使用内置函数`newFile`创建) * Csv reader对象(使用内置函数`newCsvReader`创建) * String对象 * Array对象 * Tuple对象 * Hash对象 * Channel对象(使用内置函数`chan`创建) ```swift let mm = [1,2,3,4,5,6,7,8,9,10] println('before mm={mm}') result = linq.from(mm).where(fn(x) { x % 2 == 0 }).select(fn(x) { x = x + 2 }).toSlice() println('after result={result}') result = linq.from(mm).where(fn(x) { x % 2 == 0 }).select(fn(x) { x = x + 2 }).last() println('after result={result}') let sortArr = [1,2,3,4,5,6,7,8,9,10] result = linq.from(sortArr).sort(fn(x,y){ return x > y }) println('[1,2,3,4,5,6,7,8,9,10] sort(x>y)={result}') result = linq.from(sortArr).sort(fn(x,y){ return x < y }) println('[1,2,3,4,5,6,7,8,9,10] sort(x<y)={result}') thenByDescendingArr = [ {"Owner" : "Google", "Name" : "Chrome"}, {"Owner" : "Microsoft", "Name" : "Windows"}, {"Owner" : "Google", "Name" : "GMail"}, {"Owner" : "Microsoft", "Name" : "VisualStudio"}, {"Owner" : "Google", "Name" : "GMail"}, {"Owner" : "Microsoft", "Name" : "XBox"}, {"Owner" : "Google", "Name" : "GMail"}, {"Owner" : "Google", "Name" : "AppEngine"}, {"Owner" : "Intel", "Name" : "ParallelStudio"}, {"Owner" : "Intel", "Name" : "VTune"}, {"Owner" : "Microsoft", "Name" : "Office"}, {"Owner" : "Intel", "Name" : "Edison"}, {"Owner" : "Google", "Name" : "GMail"}, {"Owner" : "Microsoft", "Name" : "PowerShell"}, {"Owner" : "Google", "Name" : "GMail"}, {"Owner" : "Google", "Name" : "GDrive"} ] result = linq.from(thenByDescendingArr).orderBy(fn(x) { return x["Owner"] }).thenByDescending(fn(x){ return x["Name"] }).toOrderedSlice() //Note: You need to use toOrderedSlice //use json.indent() for formatting the output let thenByDescendingArrStr = json.marshal(result) println(json.indent(thenByDescendingArrStr, " ")) //测试 'selectManyByIndexed' println() let selectManyByIndexedArr1 = [[1, 2, 3], [4, 5, 6, 7]] result = linq.from(selectManyByIndexedArr1).selectManyByIndexed( fn(idx, x){ if idx == 0 { return linq.from([10, 20, 30]) } return linq.from(x) }, fn(x,y){ return x + 1 }) println('[[1, 2, 3], [4, 5, 6, 7]] selectManyByIndexed() = {result}') let selectManyByIndexedArr2 = ["st", "ng"] result = linq.from(selectManyByIndexedArr2).selectManyByIndexed( fn(idx,x){ if idx == 0 { return linq.from(x + "r") } return linq.from("i" + x) },fn(x,y){ return x + "_" }) println('["st", "ng"] selectManyByIndexed() = {result}') ``` ### Linq for file支持 现在,monkey有了一个支持`linq for file`的功能。这个功能类似awk。 请看下面的代码: ```swift //test: linq for "file" file = newFile("./examples/linqSample.csv", "r") //以读取方式打开linqSample.csv result = linq.from(file,",",fn(line){ //第二个参数为字段分隔符, 第三个参数为注释函数(comment function) if line.trim().hasPrefix("#") { //如果行以'#'开头 return true //返回'true'表示忽略这一行 } else { return false } }).where(fn(fields) { //'fields'是一个哈希数组: // fields = [ // {"line" : LineNo1, "nf" : line1's number of fields, 0 : line1, 1 : field1, 2 : field2, ...}, // {"line" : LineNo2, "nf" : line2's number of fields, 0 : line2, 1 : field1, 2 : field2, ...} // ] int(fields[1]) > 300000 //仅选取第一个字段的值 > 300000 }).sort(fn(field1,field2){ return int(field1[1]) > int(field2[1]) //第一个字段按照降序排列 }).select(fn(fields) { fields[5] //仅输出第五个字段 }) println(result) file.close() //别忘记关闭文件 //another test: linq for "file" file = newFile("./examples/linqSample.csv", "r") //以读取方式打开linqSample.csv result = linq.from(file,",",fn(line){ //第二个参数为字段分隔符, 第三个参数为注释函数(comment function) if line.trim().hasPrefix("#") { //如果行以'#'开头 return true //返回'true'表示忽略这一行 } else { return false } }).where(fn(fields) { int(fields[1]) > 300000 //仅选取第一个字段的值 > 300000 }).sort(fn(field1,field2){ return int(field1[1]) > int(field2[1]) //第一个字段按照降序排列 }).selectMany(fn(fields) { row = [[fields[0]]] //fields[0]为整行数据。 注意:我们需要使用两个[], 否则selectMany()将会flatten输出结果 linq.from(row) //输出整行数据 }) println(result) file.close() //别忘记关闭文件 //test: linq for "csv" r = newCsvReader("./examples/test.csv") //以读取方式打开test.csv r.setOptions({"Comma":";", "Comment":"#"}) result = linq.from(r).where(fn(x) { //The 'x' is an array of hashes, like below: // x = [ // {"nf": line1's number of fields, 1: field1, 2: field2, ...}, // {"nf": line2's number of fields, 1: field1, 2: field2, ...} // ] x[2] == "Pike"//仅选取第二个字段 = "Pike" }).sort(fn(x,y){ return len(x[1]) > len(y[1]) //以第一个字段的长度排序 }) println(result) r.close() //别忘记关闭Reader ``` ### csv 模块 ```swift //测试 csv reader let r = newCsvReader("./examples/test.csv") if r == nil { printf("newCsv returns err, message:%s\n", r.message()) } r.setOptions({"Comma": ";", "Comment": "#"}) ra = r.readAll() if (ra == nil) { printf("readAll returns err, message:%s\n", ra.message()) } for line in ra { println(line) for record in line { println(" ", record) } } r.close() //do not to forget to close the reader //测试 csv writer let ofile = newFile("./examples/demo.csv", "a+") let w = newCsvWriter(ofile) w.setOptions({"Comma": " "}) w.write(["1", "2", "3"]) w.writeAll([["4", "5", "6"],["7", "8", "9"],["10", "11", "12"]]) w.flush() ofile.close() //do not to forget to close the file ``` ### template 模块 `template` 模块包含'text'和'html'模版处理. 使用 `newText(...)` 或者 `parseTextFiles(...)` 来创建一个新的'text'模版。 使用 `newHtml(...)` 或者`parseHtmlFiles(...)` 来创建一个新的'html'模版。 ```swift arr = [ { "key" : "key1", "value" : "value1" }, { "key" : "key2", "value" : "value2" }, { "key" : "key3", "value" : "value3" } ] //使用parseTextFiles(), 来写入一个字符串 template.parseTextFiles("./examples/looping.tmpl").execute(resultValue, arr) println('{resultValue}') //使用parseTextFiles()来写入一个文件 file = newFile("./examples/outTemplate.log", "a+") template.parseTextFiles("./examples/looping.tmpl").execute(file, arr) file.close() //do not to forget to close the file //使用 parse() //注: 我们需要使用"{{-" and "-}}"来移除输出中的回车换行(newline) template.newText("array").parse(`Looping {{- range . }} key={{ .key }}, value={{ .value -}} {{- end }} `).execute(resultValue, arr) println('{resultValue}') ``` ### sql 模块 `sql` 模块提供了一个底层封装来操作数据库。 它可以正确的处理数据库中的null值,虽然没有经过完全的测试。 为了测试`sql`模块, 你需要做以下几个步骤: 1. 下载sql驱动器(sql driver)代码. 2. 将驱动器的包包含到'sql.go'文件中: ```go _ "github.com/mattn/go-sqlite3" ``` 3. 重新编译monkey源码. 下面是一个完整的使用数据库的例子(`examples/db.my`): ```swift let dbOp = fn() { os.remove("./foo.db") //delete `foo.db` file let db = dbOpen("sqlite3", "./foo.db") if (db == nil) { println("DB open failed, error:", db.message()) return false } defer db.close() let sqlStmt = `create table foo (id integer not null primary key, name text);delete from foo;` let exec_ret = db.exec(sqlStmt) if (exec_ret == nil) { println("DB exec failed! error:", exec_ret.message()) return false } let tx = db.begin() if (tx == nil) { println("db.Begin failed!, error:", tx.message()) return false } let stmt = tx.prepare(`insert into foo(id, name) values(?, ?)`) if (stmt == nil) { println("tx.Prepare failed!, error:", stmt.message()) return false } defer stmt.close() let i = 0 for (i = 0; i < 105; i++) { let name = "您好" + i if (i>100) { //插入`null`值. 有七个预定义的null常量:INT_NULL,UINT_NULL,FLOAT_NULL,STRING_NULL,BOOL_NULL,TIME_NULL, DECIMAL_NULL. let rs = stmt.exec(i, sql.STRING_NULL) } else { let rs = stmt.exec(i, name) } if (rs == nil) { println("statement exec failed, error:", rs.message()) return false } } //end for tx.commit() let id, name = 0, "" let rows = db.query("select id, name from foo") if (rows == nil) { println("db queue failed, error:", rows.message()) return false } defer rows.close() while (rows.next()) { rows.scan(id, name) if (name.valid()) { //检查是否为`null` println(id, "|", name) } else { println(id, "|", "null") } } return true } let ret = dbOp() if (ret == nil) { os.exit(1) } os.exit() ``` ## 实用工具 项目还包含了一些使用的工具:`formatter`和`highlighter`。 formatter工具能够格式化monkey语言。 highlighter工具能够语法高亮monkey语言(提供两种输出:命令行和html)。 你也可以将它们合起来使用: ```sh ./fmt xx.my | ./highlight //输出到屏幕(命令行高亮不只是windows) ``` ## 文档生成 Monkey还包含一个命令行工具`mdoc`,可以从Monkey文件的注释生成markdown类型的文档或者HTML文档。 目前仅仅支持以下语句的注释生成: * let语句 * enum语句 * function语句 * class语句 * let语句 * function语句 * property语句 ```sh //生成markdown文件, 生成的文件名为'doc.md' ./mdoc examples/doc.my //生成html文件, 生成的文件名为'doc.html' ./mdoc -html examples/doc.my //生成html文件, 同时生成函数和类的代码,生成的文件名为'doc.html' ./mdoc -html -showsource examples/doc.my //使用内置的css格式修饰html文档 // 0 - GitHub // 1 - Zenburn // 2 - Lake // 3 - Sea Side // 4 - Kimbie Light // 5 - Light Blue // 6 - Atom Dark // 7 - Forgotten Light ./mdoc -html -showsource -css 1 examples/doc.my //使用外部css文件来修饰html文档(优先级高于'-css'选项) //'-cssfile'选项的优先级高于'-css'选项 //如果提供的css文件不存在或者文件读取错误,则使用'-css'选项 ./mdoc -html -showsource -css 1 -cssfile ./examples/github-markdown.css examples/doc.my //遍历examples目录下的所有'.my'的文件,生成html ./mdoc -html examples ``` HTML文档的生成是调用github的REST API,因此必须在网络连接正常的情况下才能够生成HTML文档。 同时,你可能需要设置代理(环境变量:HTTP_PROXY)。 关于生成文档的示例,请参照: * [markdown.md](examples/markdown.md) * [markdown.html](examples/markdown.html) 由于github不能够直接浏览html文档,你可以使用(http://htmlpreview.github.io/)来浏览html文档。 ## 语法高亮 目前,monkey支持以下几种编辑器的语法高亮: 1. vim [vim](misc/vim) 2. emeditor [emeditor](misc/emeditor) 3. notepad++ [notepad++](misc/notepad%2B%2B) 4. Visual Studio Code [VSC](misc/vscode) 5. Sublime Text 3 [Sublime Text 3](misc/SublimeText3) ## 未来计划 下面是对项目的未来计划的描述: * 改进标准库并增加更多的函数. * 写更多的测试代码! ## 许可证 MIT ## 备注 如果你喜欢此项目,请点击下面的链接,多多star,fork。谢谢! [monkey](https://github.com/haifenghuang/monkey)
haifenghuang/monkey
README_cn.md
Markdown
mit
67,164
<?php use League\Flysystem\Adapter\Local; use League\Flysystem\Filesystem; use Spatie\Backup\FileHelpers\FileSelector; class FileSelectorTest extends Orchestra\Testbench\TestCase { protected $path; protected $disk; protected $root; protected $testFilesPath; protected $fileSelector; public function setUp() { parent::setUp(); $this->root = realpath('tests/_data/disk/root'); $this->path = 'backups'; $this->testFilesPath = realpath($this->root.'/'.$this->path); //make sure all files in our testdirectory are 5 days old foreach (scandir($this->testFilesPath) as $file) { touch($this->testFilesPath.'/'.$file, time() - (60 * 60 * 24 * 5)); } $this->disk = new Illuminate\Filesystem\FilesystemAdapter(new Filesystem(new Local($this->root))); $this->fileSelector = new FileSelector($this->disk, $this->path); } /** * @test */ public function it_returns_only_files_with_the_specified_extensions() { $oldFiles = $this->fileSelector->getFilesOlderThan(new DateTime(), ['zip']); $this->assertNotEmpty($oldFiles); $this->assertFalse(in_array('MariahCarey.php', $oldFiles)); } /** * @test */ public function it_returns_an_empty_array_if_no_extensions_are_specified() { $oldFiles = $this->fileSelector->getFilesOlderThan(new DateTime(), ['']); $this->assertEmpty($oldFiles); } /** * @test */ public function it_gets_files_older_than_the_given_date() { $testFileName = 'test_it_gets_files_older_than_the_given_date.zip'; touch($this->testFilesPath.'/'.$testFileName, time() - (60 * 60 * 24 * 10) + 60); //create a file that is 10 days and a minute old $oldFiles = $this->fileSelector->getFilesOlderThan((new DateTime())->sub(new DateInterval('P9D')), ['zip']); $this->assertTrue(in_array($this->path.'/'.$testFileName, $oldFiles)); $oldFiles = $this->fileSelector->getFilesOlderThan((new DateTime())->sub(new DateInterval('P10D')), ['zip']); $this->assertFalse(in_array($this->path.'/'.$testFileName, $oldFiles)); $oldFiles = $this->fileSelector->getFilesOlderThan((new DateTime())->sub(new DateInterval('P11D')), ['zip']); $this->assertFalse(in_array($this->path.'/'.$testFileName, $oldFiles)); } /** * @test */ public function it_excludes_files_outside_given_path() { $files = $this->fileSelector->getFilesOlderThan(new DateTime(), ['zip']); touch(realpath('tests/_data/disk/root/TomJones.zip'), time() - (60 * 60 * 24 * 10) + 60); $this->assertFalse(in_array($this->path.'/'.'TomJones.zip', $files)); $this->assertTrue(in_array($this->path.'/'.'test.zip', $files)); } /** * Call artisan command and return code. * * @param string $command * @param array $parameters * * @return int */ public function artisan($command, $parameters = []) { } }
emayk/laravel-backup
tests/fileSelector/FileSelectorTest.php
PHP
mit
3,070
var Handler, MiniEventEmitter; Handler = require("./handler"); MiniEventEmitter = (function() { function MiniEventEmitter(obj) { var handler; handler = new Handler(this, obj); this.on = handler.on; this.off = handler.off; this.emit = handler.emit; this.emitIf = handler.emitIf; this.trigger = handler.emit; this.triggerIf = handler.emitIf; } MiniEventEmitter.prototype.listen = function(type, event, args) {}; return MiniEventEmitter; })(); module.exports = MiniEventEmitter;
hawkerboy7/mini-event-emitter
build/js/app.js
JavaScript
mit
522
#!/usr/bin/bash # Hard variables # Directory containing Snakemake and cluster.json files snakefile_dir='/nas/longleaf/home/sfrenk/pipelines/snakemake' usage="\nCreate directory with Snakemake files required for pipeline \n\n setup_dir -p <pipeline> -d <directory> \n\n pipelines: bowtie_srna, hisat2_rna, srna_telo\n\n" pipeline="" if [ -z "$1" ]; then printf "$usage" exit fi while [[ $# > 0 ]] do key="$1" case $key in -p|--pipeline) pipeline="$2" shift ;; -d|--dir) dir="$2" shift ;; -h|--help) printf "$usage" exit ;; esac shift done if [[ ! -d $dir ]]; then echo "ERROR: Invalid directory" exit 1 fi if [[ $pipeline == "" ]]; then echo "ERROR: Please select pipeline: bowtie_srna or hisat2_rna" exit 1 fi # Determine pipeline file case $pipeline in "bowtie_srna"|"bowtie_sRNA") snakefile="bowtie_srna.Snakefile" ;; "hisat2_rna"|"hisat2_RNA") snakefile='hisat2_rna.Snakefile' ;; "srna_telo") snakefile="srna_telo.Snakefile" ;; *) echo "ERROR: Invalid pipeline. Please select one of the following: bowtie_srna, hisat2_rna or srna_telo" exit 1 ;; esac # Copy over the snakefile cp ${snakefile_dir}/${snakefile} ./${snakefile} # Edit base directory in Snakefile # Remove trailing "/" from dir if it's there input_dir="$(echo $dir |sed -r 's/\/$//')" input_dir=\"${input_dir}\" sed -i -e "s|^BASEDIR.*|BASEDIR = ${input_dir}|" $snakefile # Determine file extension extension="$(ls $dir | grep -Eo "\.[^/]+(\.gz)?$" | sort | uniq)" # Check if there are multiple file extensions in the same directory ext_count="$(ls $dir | grep -Eo "\.[^/]+(\.gz)?$" | sort | uniq | wc -l)" if [[ $ext_count == 0 ]]; then echo "ERROR: Directory is empty!" elif [[ $ext_count != 1 ]]; then echo "WARNING: Multiple file extensions found: using .fastq.gz" extension=".fastq.gz" fi # Edit extension and utils_dir in Snakefile extension="\"${extension}\"" sed -i -e "s|^EXTENSION.*|EXTENSION = ${extension}|g" $snakefile utils_dir="${snakefile_dir%/snakemake}/utils" utils_dir="\"${utils_dir}\"" sed -i -e "s|^UTILS_DIR.*|UTILS_DIR = ${utils_dir}|g" $snakefile # Create Snakmake command script printf "#!/usr/bin/bash\n" > "run_snakemake.sh" printf "#SBATCH -t 2-0\n\n" >> "run_snakemake.sh" printf "module add python\n\n" >> "run_snakemake.sh" printf "snakemake -s $snakefile --keep-going --rerun-incomplete --cluster-config ${snakefile_dir}/cluster.json -j 100 --cluster \"sbatch -n {cluster.n} -N {cluster.N} -t {cluster.time}\"\n" >> run_snakemake.sh
sfrenk/rna-seq_pipelines
utils/setup_dir.sh
Shell
mit
2,550
/** * React Starter Kit (https://www.reactstarterkit.com/) * * Copyright © 2014-present Kriasoft, LLC. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE.txt file in the root directory of this source tree. */ import React from 'react'; import {connect} from 'react-redux'; import StringList from './StringList/StringList' import TwitterSelector from './DomainSelector/TwitterSelector' import TweetFilter from './TweetFilter/TweetFilter' class Search extends React.Component { constructor(props) { super(props); this.state = { includedWords: [] }; this.getWords = this.getWords.bind(this); } getWords(words) { this.setState({ includedWords: words }); } render() { const styles = { fontFamily: 'Helvetica Neue', fontSize: 14, lineHeight: '10px', color: 'white', display: 'flex', alignItems: 'center', justifyContent: 'center', } return ( <div> <TweetFilter /> </div> ); } } export default Search;
hmeinertrita/MyPlanetGirlGuides
src/routes/search/Search.js
JavaScript
mit
1,083
// // YZAlertView.h // AlertViewDemo // // Created by yangyongzheng on 2017/8/17. // Copyright © 2017年 yangyongzheng. All rights reserved. // #import <UIKit/UIKit.h> typedef void(^YYZAlertViewActionHandler)(UIAlertAction *action); NS_CLASS_AVAILABLE_IOS(8_0) @interface YYZAlertView : NSObject + (void)yyz_alertViewWithTitle:(NSString *)title message:(NSString *)message cancelActionTitle:(NSString *)cancelActionTitle; + (void)yyz_alertViewWithTitle:(NSString *)title message:(NSString *)message actionTitle:(NSString *)actionTitle actionHandler:(YYZAlertViewActionHandler)actionHandler; + (void)yyz_alertViewWithTitle:(NSString *)title message:(NSString *)message cancelActionTitle:(NSString *)cancelActionTitle otherActionTitle:(NSString *)otherActionTitle actionHandler:(YYZAlertViewActionHandler)actionHandler; @end
yangyongzheng/YZLottery
YZKit/Utility/YYZAlertView.h
C
mit
997
{% extends "layout_unbranded.html" %} {% block page_title %} GOV.UK prototype kit {% endblock %} {% block content %} <main id="content" role="main"> <div class="grid-row"> <div class="column-full"> <div id="global-breadcrumb" class="breadcrumb"> <a class="link-back" href="results_confirm2?search=QQ123456C">Back</a> </div> <h1 class="heading-large">QQ123456C</h1> <div class="tab-content"> <div class="js-tabs nav-tabs"> <ul class="tabs-nav" role="tablist"> <li class="active"><a href="#current-sp-value" id="tab-overview">Overview</a></li> <li><a href="#options-sp-value" id="tab-options">Filling gaps</a></li> <li><a href="#improve-sp-value" id="tab-contracting-out">Starting amount</a></li> <li><a href="#contracted-out" id="tab-ni-record">National Insurance summary</a></li> </ul> </div> </div> </div> <div id="forecast" class="tab-pane"> <div class="column-half"> <div class="forecast-wrapper2"> <span class="forecast-label2">State Pension date</span> <span class="forecast-data-bold2">4 May 2034</span> </div> <div class="forecast-wrapper2"> <span class="forecast-label2">Final relevant year (FRY)</span> <span class="forecast-data-bold2">2033-34</span> <span class="forecast-label2">&nbsp;</span><span class="forecast-data-bold2 forecast-label2-inline">18 years to FRY </span> </div> <div class="forecast-wrapper2"> <span class="forecast-label2">COPE estimate</span> <span class="forecast-data-bold2">£18.84 a week</span> <span class="forecast-no-data forecast-header forecast-label2-inline">Was contracted out</span> </div> </div> <div class="column-half"> <div class="forecast-wrapper2"> <span class="forecast-label2">Estimate up to 5 April 2016 </span> <span class="forecast-data-bold2">£120.10 a week</span> <span class="forecast-label2 forecast-label2-inline">Qualifying years</span> <span class="forecast-data-bold2 forecast-label2-inline">28</span> </div> <div class="forecast-wrapper2"> <span class="forecast-label2">Forecast contributing future years</span> <span class="forecast-data-bold2">£159.55 a week</span> <span class="forecast-label2 forecast-label2-inline">Future years needed</span> <span class="forecast-data-bold2 forecast-label2-inline">9</span> </div> <div class="forecast-wrapper2"> <span class="forecast-label2">Most they can get</span> <span class="forecast-data-bold2">£159.55 a week</span> </div> </div> </div> <div id="options" class="tab-pane"> <div class="column-two-thirds"> <h3 class="heading-small">Improve by filling gaps</h3> <table class="vnics"><tr><th>Gaps filled</th><th>Old rules</th><th>New rules</th></tr> <tr><td>Estimate 05 April 2016</td><td class="vnics_bold">£120.10 a week</td><td>£108.33 a week</td></tr> <tr><td>1</td><td class="vnics_bold">£124.17 a week</td><td>£112.89 a week</td></tr> <tr><td>2</td><td class="vnics_bold">£128.24 a week<td>£117.45 a week</td></tr> <tr><td>3</td><td><td>£122.00 a week</td></tr> <tr><td>4</td><td><td>£126.56 a week</td></tr> <tr><td>5</td><td><td class="vnics_bold">£131.12 a week</td></tr> </table> </div> </div> <div id="contracting-out" class="tab-pane"> <div class="column-two-thirds"> <h3 class="heading-small">Starting amount at April 2016 is £117.16 a week</h3> </div> <div class="column-one-half column-half-left"> <div class="forecast-wrapper2"> <p class="heading-small">Old rules</p> <span class="forecast-label2">Basic</span> <span class="forecast-data2">£111.35 a week</span> <span class="forecast-label2 forecast-label2-inline">Additional Pension and Grad</span> <span class="forecast-data2 forecast-label2-inline">£5.81 a week</span> <span class="forecast-label2 forecast-label2-inline">Total</span> <span class="forecast-data-bold2 forecast-label2-inline">£117.16 a week </span> </div> </div> <div class="column-one-half column-half-right"> <div class="forecast-wrapper2"> <p class="heading-small">New rules</p> <span class="forecast-label2">New State Pension</span> <span class="forecast-data2">£124.52 a week</span> <span class="forecast-label2 forecast-label2-inline">RDA</span> <span class="forecast-data2 forecast-label2-inline">£18.84 a week</span> <span class="forecast-label2 forecast-label2-inline">Total</span> <span class="forecast-data-bold2 forecast-label2-inline">£105.68 a week</span> </div> </div> </div> <div id="ni-record" class="tab-pane"> <div class="column-two-thirds"> <h2 class="heading-small">Shortfalls in record</h2> <p>5 years can be filled</p> <dl class="accordion2"> <dt> <div class="ni-wrapper"> <div class="ni-years2">2016-17</div> <div class="ni-notfull">This year is not available yet</div> </div> </dt> <dt> <div class="ni-wrapper"> <div class="ni-years2">2015-16</div> <div class="ni-notfull">£733.20 shortfall</div> </div> </dt> <dt> <div class="ni-wrapper"> <div class="ni-years2">2014-15</div> <div class="ni-notfull">£722.80 shortfall</div> </div> </dt> <dt> <div class="ni-wrapper"> <div class="ni-years2">2013-14</div> <div class="ni-notfull">£704.60 shortfall</div> </div> </dt> <dt> <div class="ni-wrapper"> <div class="ni-years2">2012-13</div> <div class="ni-notfull">£689.00 shortfall</div> </div> </dt> <dt> <div class="ni-wrapper"> <div class="ni-years2">2011-12</div> <div class="ni-notfull">£289.80 shortfall</div> </div> </dt> </dl> </div> <div class="column-one-third"> <aside class="govuk-related-items dwp-related-items" role="complementary"> <h2 class="heading-small" id="subsection-title">Full years and shortfalls</h2> <nav role="navigation" aria-labelledby="subsection-title"> <ul class="font-xsmall"> <nav role="navigation" aria-labelledby="parent-subsection"> <ul class="list-bullets"> <li><span style="font-size: 16px"><span style="font-weight: 700">28</span> qualifying years </span> </li> <li><span style="font-size: 16px"><span style="font-weight: 700">18</span> years to contribute before 05 April 2034</span> </li> <li><span style="font-size: 16px"><span style="font-weight: 700">5</span> years with a shortfall</span> </li> </ul> </ul> </nav> </aside> </div> </div> </div> </main> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script type="text/javascript"> // function show(elementId) { // document.getElementById("id1").style.display = "none"; // document.getElementById("id2").style.display = "block"; // document.getElementById(elementId).style.display = "block"; // } jQuery(document).ready(function($){ $("a#tab-overview").click(function() { $(".tabs-nav li").removeClass("active"); $(this).parent().addClass("active"); $("#forecast").show(); $("#ni-record").hide(); $("#contracting-out").hide(); $("#contracting-out").hide(); $("#options").hide(); window.location.hash = "#lie-forecast"; return false; }); $("a#tab-options").click(function() { $(".tabs-nav li").removeClass("active"); $(this).parent().addClass("active"); $("#options").show(); $("#forecast").hide(); $("#ni-record").hide(); $("#contracting-out").hide(); window.location.hash = "#lie-options"; return false; }); $("a#tab-ni-record").click(function() { $(".tabs-nav li").removeClass("active"); $(this).parent().addClass("active"); $("#ni-record").show(); $("#contracting-out").hide(); $("#forecast").hide(); $("#options").hide(); window.location.hash = "#lie-ni-record"; return false; }); $("a#tab-contracting-out").click(function() { $(".tabs-nav li").removeClass("active"); $(this).parent().addClass("active"); $("#contracting-out").show(); $("#ni-record").hide(); $("#forecast").hide(); $("#options").hide(); window.location.hash = "#lie-contracting-out"; return false; }); if(window.location.hash === "#lie-forecast") { $("a#tab-overview").trigger('click'); } else if (window.location.hash === "#lie-ni-record") { $("a#tab-ni-record").trigger('click'); } else if (window.location.hash === "#lie-contracting-out") { $("a#tab-contracting-out").trigger('click'); } else if (window.location.hash === "#lie-optionst") { $("a#tab-options").trigger('click'); } }); </script> </div> </main> <script type="text/javascript"> function removeWhitespaces() { var txtbox = document.getElementById('search-main'); txtbox.value = txtbox.value.replace(/\s/g, ""); } </script> {% endblock %}
steven-borthwick/check-support
app/views/volnicsv1a/forecast_QQ123456C.html
HTML
mit
9,847
<div id="maxoptions_example"></div>
oakmac/autocompletejs
examples/4008.html
HTML
mit
35
Given(/^I have an Auton that has two steps, first step scheduling the next step$/) do class ScheduleSecondStepAuton < Nestene::Auton def first context.schedule_step(:second) end def second 'ok' end attr_accessor :context attribute foo: Fixnum end @auton_type="ScheduleSecondStepAuton" @auton_id = Celluloid::Actor[:nestene_core].create_auton(@auton_type) end When(/^I schedule the first step that returns the uuid of the second scheduled step$/) do @step_execution_id = Celluloid::Actor[:nestene_core].schedule_step @auton_id, :first @step_execution_id = Celluloid::Actor[:nestene_core].wait_for_execution_result(@auton_id, @step_execution_id) end When(/^I wait for the second step to finish$/) do @execution_result = Celluloid::Actor[:nestene_core].wait_for_execution_result(@auton_id, @step_execution_id) end Given(/^I have two autons where first auton schedules step on the other auton$/) do class StepSchedulingAuton < Nestene::Auton def schedule_step self.step_id = context.schedule_step_on_auton('step_executor', :step) end attr_accessor :context attribute step_id: Fixnum end class StepExecutorAuton < Nestene::Auton def step context.schedule_step(:second) end attr_accessor :context attribute foo: Fixnum end @first_auton_id = Celluloid::Actor[:nestene_core].create_auton('StepSchedulingAuton') @second_auton_id = Celluloid::Actor[:nestene_core].create_auton('StepExecutorAuton','step_executor') end When(/^I schedule the step on the first auton and wait for it's execution$/) do step_id = Celluloid::Actor[:nestene_core].schedule_step @first_auton_id, :schedule_step @second_auton_step_id = Celluloid::Actor[:nestene_core].wait_for_execution_result @first_auton_id, step_id end Then(/^second auton should either have scheduled or executed step$/) do Celluloid::Actor[:nestene_core].wait_for_execution_result @second_auton_id, @second_auton_step_id end
draganm/nestene
features/step_definitions/schedule_steps_steps.rb
Ruby
mit
1,992
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>ergo: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.10.2 / ergo - 8.6.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> ergo <small> 8.6.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-01-18 13:05:13 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-01-18 13:05:13 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.10.2 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.07.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.07.1 Official release 4.07.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/ergo&quot; license: &quot;Unknown&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Ergo&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;} &quot;coq-counting&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;} &quot;coq-nfix&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;} &quot;coq-containers&quot; {&gt;= &quot;8.6&quot; &amp; &lt; &quot;8.7~&quot;} ] tags: [ &quot;keyword: reflexive decision procedure&quot; &quot;keyword: satisfiability modulo theories&quot; &quot;category: Computer Science/Decision Procedures and Certified Algorithms/Decision procedures&quot; ] authors: [ &quot;Stéphane Lescuyer&quot; ] bug-reports: &quot;https://github.com/coq-contribs/ergo/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/ergo.git&quot; synopsis: &quot;Ergo: a Coq plugin for reification of term with arbitrary signature&quot; description: &quot;This library provides a tactic that performs SMT solving (SAT + congruence closure + arithmetic).&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/ergo/archive/v8.6.0.tar.gz&quot; checksum: &quot;md5=5995e362eac7d51d1d6339ab417d518e&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-ergo.8.6.0 coq.8.10.2</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.10.2). The following dependencies couldn&#39;t be met: - coq-ergo -&gt; coq &lt; 8.7~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-ergo.8.6.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
coq-bench/coq-bench.github.io
clean/Linux-x86_64-4.07.1-2.0.6/released/8.10.2/ergo/8.6.0.html
HTML
mit
6,970
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>finger-tree: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.12.1 / finger-tree - 8.7.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> finger-tree <small> 8.7.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-01-11 21:45:50 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-01-11 21:45:50 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.12.1 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.09.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.09.1 Official release 4.09.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;https://github.com/coq-contribs/finger-tree&quot; license: &quot;LGPL&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/FingerTree&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.7&quot; &amp; &lt; &quot;8.8~&quot;} ] tags: [ &quot;keyword: data structures&quot; &quot;keyword: dependent types&quot; &quot;keyword: Finger Trees&quot; &quot;category: Computer Science/Data Types and Data Structures&quot; &quot;date: 2009-02&quot; ] authors: [ &quot;Matthieu Sozeau &lt;mattam@mattam.org&gt; [http://mattam.org]&quot; ] bug-reports: &quot;https://github.com/coq-contribs/finger-tree/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/finger-tree.git&quot; synopsis: &quot;Dependent Finger Trees&quot; description: &quot;&quot;&quot; http://mattam.org/research/russell/fingertrees.en.html A verified generic implementation of Finger Trees&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/finger-tree/archive/v8.7.0.tar.gz&quot; checksum: &quot;md5=65bc1765ca51e147bcbd410b0f4c88b0&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-finger-tree.8.7.0 coq.8.12.1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.12.1). The following dependencies couldn&#39;t be met: - coq-finger-tree -&gt; coq &lt; 8.8~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-finger-tree.8.7.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
coq-bench/coq-bench.github.io
clean/Linux-x86_64-4.09.1-2.0.6/released/8.12.1/finger-tree/8.7.0.html
HTML
mit
6,929
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>paramcoq: Not compatible</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.10.0 / paramcoq - 1.1.1+coq8.7</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> paramcoq <small> 1.1.1+coq8.7 <span class="label label-info">Not compatible</span> </small> </h1> <p><em><script>document.write(moment("2020-07-16 08:04:26 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-07-16 08:04:26 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils conf-m4 1 Virtual package relying on m4 coq 8.10.0 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.05.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.05.0 Official 4.05.0 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.8.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; synopsis: &quot;Paramcoq&quot; name: &quot;coq-paramcoq&quot; version: &quot;1.1.1+coq8.7&quot; maintainer: &quot;Pierre Roux &lt;pierre.roux@onera.fr&gt;&quot; homepage: &quot;https://github.com/coq-community/paramcoq&quot; dev-repo: &quot;git+https://github.com/coq-community/paramcoq.git&quot; bug-reports: &quot;https://github.com/coq-community/paramcoq/issues&quot; license: &quot;MIT&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Param&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.7.2&quot; &amp; &lt; &quot;8.8~&quot;} ] tags: [ &quot;keyword:paramcoq&quot; &quot;keyword:parametricity&quot; &quot;keyword:ocaml module&quot; &quot;category:paramcoq&quot; &quot;category:Miscellaneous/Coq Extensions&quot; &quot;logpath:Param&quot; ] authors: [ &quot;Chantal Keller (Inria, École polytechnique)&quot; &quot;Marc Lasson (ÉNS de Lyon)&quot; &quot;Abhishek Anand&quot; &quot;Pierre Roux&quot; &quot;Emilio Jesús Gallego Arias&quot; &quot;Cyril Cohen&quot; &quot;Matthieu Sozeau&quot; ] flags: light-uninstall url { src: &quot;https://github.com/coq-community/paramcoq/releases/download/v1.1.1+coq8.7/coq-paramcoq.1.1.1+coq8.7.tgz&quot; checksum: &quot;md5=3eb94ccdb53e6dfc7f0d74b3cd1a5db5&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-paramcoq.1.1.1+coq8.7 coq.8.10.0</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.10.0). The following dependencies couldn&#39;t be met: - coq-paramcoq -&gt; coq &lt; 8.8~ -&gt; ocaml &lt; 4.03.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-paramcoq.1.1.1+coq8.7</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> <small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small> </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
coq-bench/coq-bench.github.io
clean/Linux-x86_64-4.05.0-2.0.6/released/8.10.0/paramcoq/1.1.1+coq8.7.html
HTML
mit
7,188
using MineLib.Core; using MineLib.Core.Data; using MineLib.Core.IO; using ProtocolClassic.Data; namespace ProtocolClassic.Packets.Server { public struct LevelFinalizePacket : IPacketWithSize { public Position Coordinates; public byte ID { get { return 0x04; } } public short Size { get { return 7; } } public IPacketWithSize ReadPacket(IProtocolDataReader reader) { Coordinates = Position.FromReaderShort(reader); return this; } IPacket IPacket.ReadPacket(IProtocolDataReader reader) { return ReadPacket(reader); } public IPacket WritePacket(IProtocolStream stream) { Coordinates.ToStreamShort(stream); return this; } } }
MineLib/ProtocolClassic
Packets/Server/LevelFinalize.cs
C#
mit
812
#ifndef IDUCK_HPP_124b1b04_74d3_41ae_b7ce_2a0bea79f1c7 #define IDUCK_HPP_124b1b04_74d3_41ae_b7ce_2a0bea79f1c7 #include "../strategy/IFly.hpp" /** \interface IDuck Interface for duck. It can fly, quack and rotate right. */ class IDuck { public: virtual Course getCourse() const = 0; virtual int getDistance(Course course) const = 0; virtual void fly() = 0; virtual void quack() = 0; virtual void right() = 0; virtual void left() = 0; virtual ~IDuck() { } }; #endif // IDUCK_HPP_124b1b04_74d3_41ae_b7ce_2a0bea79f1c7
PS-Group/compiler-theory-samples
interpreter/IDuckPro_AST/src/duck/IDuck.hpp
C++
mit
553
require 'cred_hubble/resources/credential' module CredHubble module Resources class UserValue include Virtus.model attribute :username, String attribute :password, String attribute :password_hash, String def to_json(options = {}) attributes.to_json(options) end def attributes_for_put attributes.delete_if { |k, _| immutable_attributes.include?(k) } end private def immutable_attributes [:password_hash] end end class UserCredential < Credential attribute :value, UserValue def type Credential::USER_TYPE end def attributes_for_put super.merge(value: value && value.attributes_for_put) end end end end
tcdowney/cred_hubble
lib/cred_hubble/resources/user_credential.rb
Ruby
mit
767
# encoding: utf-8 require 'spec_helper' describe Optimizer::Algebra::Projection::ExtensionOperand, '#optimizable?' do subject { object.optimizable? } let(:header) { Relation::Header.coerce([[:id, Integer], [:name, String], [:age, Integer]]) } let(:base) { Relation.new(header, LazyEnumerable.new([[1, 'Dan Kubb', 35]])) } let(:relation) { operand.project([:id, :name]) } let(:object) { described_class.new(relation) } before do expect(object.operation).to be_kind_of(Algebra::Projection) end context 'when the operand is an extension, and the extended attribtue is removed ' do let(:operand) { base.extend { |r| r.add(:active, true) } } it { should be(true) } end context 'when the operand is an extension, and the extended attribtue is not removed ' do let(:operand) { base.extend { |r| r.add(:active, true) } } let(:relation) { operand.project([:id, :name, :active]) } it { should be(false) } end context 'when the operand is not an extension' do let(:operand) { base } it { should be(false) } end end
dkubb/axiom-optimizer
spec/unit/axiom/optimizer/algebra/projection/extension_operand/optimizable_predicate_spec.rb
Ruby
mit
1,187
#include <stdio.h> #include "list.h" #define N 10 link reverse(link); int main(void) { int i; link head, x; // Population head = new_link(0); x = head; for (i = 1; i < N; ++i) { x = insert_after(x, new_link(i)); } // Reversal head = reverse(head); // Traversal x = head; do { printf("%i\n", x->item); x = x->next; } while (x != head); return 0; } link reverse(link x) { link t; link y = x; link r = NULL; do { t = y->next; y->next = r; r = y; y = t; } while (y != x); x->next = r; return r; }
bartobri/data-structures-c
linked-lists/circular-reversal/main.c
C
mit
546
import { get } from "ember-metal/property_get"; import { set } from "ember-metal/property_set"; import Ember from "ember-metal/core"; // Ember.assert import EmberError from "ember-metal/error"; import { Descriptor, defineProperty } from "ember-metal/properties"; import { ComputedProperty } from "ember-metal/computed"; import create from "ember-metal/platform/create"; import { meta, inspect } from "ember-metal/utils"; import { addDependentKeys, removeDependentKeys } from "ember-metal/dependent_keys"; export default function alias(altKey) { return new AliasedProperty(altKey); } export function AliasedProperty(altKey) { this.altKey = altKey; this._dependentKeys = [altKey]; } AliasedProperty.prototype = create(Descriptor.prototype); AliasedProperty.prototype.get = function AliasedProperty_get(obj, keyName) { return get(obj, this.altKey); }; AliasedProperty.prototype.set = function AliasedProperty_set(obj, keyName, value) { return set(obj, this.altKey, value); }; AliasedProperty.prototype.willWatch = function(obj, keyName) { addDependentKeys(this, obj, keyName, meta(obj)); }; AliasedProperty.prototype.didUnwatch = function(obj, keyName) { removeDependentKeys(this, obj, keyName, meta(obj)); }; AliasedProperty.prototype.setup = function(obj, keyName) { Ember.assert("Setting alias '" + keyName + "' on self", this.altKey !== keyName); var m = meta(obj); if (m.watching[keyName]) { addDependentKeys(this, obj, keyName, m); } }; AliasedProperty.prototype.teardown = function(obj, keyName) { var m = meta(obj); if (m.watching[keyName]) { removeDependentKeys(this, obj, keyName, m); } }; AliasedProperty.prototype.readOnly = function() { this.set = AliasedProperty_readOnlySet; return this; }; function AliasedProperty_readOnlySet(obj, keyName, value) { throw new EmberError('Cannot set read-only property "' + keyName + '" on object: ' + inspect(obj)); } AliasedProperty.prototype.oneWay = function() { this.set = AliasedProperty_oneWaySet; return this; }; function AliasedProperty_oneWaySet(obj, keyName, value) { defineProperty(obj, keyName, null); return set(obj, keyName, value); } // Backwards compatibility with Ember Data AliasedProperty.prototype._meta = undefined; AliasedProperty.prototype.meta = ComputedProperty.prototype.meta;
gdi2290/ember.js
packages/ember-metal/lib/alias.js
JavaScript
mit
2,326
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_65) on Sat Dec 27 23:31:06 CST 2014 --> <TITLE> Uses of Class pages.MarkovTable </TITLE> <META NAME="date" CONTENT="2014-12-27"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class pages.MarkovTable"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../pages/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../pages/MarkovTable.html" title="class in pages"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?pages//class-useMarkovTable.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="MarkovTable.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>pages.MarkovTable</B></H2> </CENTER> <A NAME="pages"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A> in <A HREF="../../pages/package-summary.html">pages</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Fields in <A HREF="../../pages/package-summary.html">pages</A> declared as <A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>(package private) &nbsp;<A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A></CODE></FONT></TD> <TD><CODE><B>Model.</B><B><A HREF="../../pages/Model.html#markov">markov</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>private &nbsp;<A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A></CODE></FONT></TD> <TD><CODE><B>ClassifyingThread.</B><B><A HREF="../../pages/ClassifyingThread.html#markov">markov</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>private &nbsp;<A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A></CODE></FONT></TD> <TD><CODE><B>ClassifyingExecutor.</B><B><A HREF="../../pages/ClassifyingExecutor.html#markov">markov</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../pages/package-summary.html">pages</A> that return <A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A></CODE></FONT></TD> <TD><CODE><B>Corpus.</B><B><A HREF="../../pages/Corpus.html#makeMarkovTable(java.util.ArrayList, double)">makeMarkovTable</A></B>(java.util.ArrayList&lt;java.lang.String&gt;&nbsp;volumesToUse, double&nbsp;alpha)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../pages/package-summary.html">pages</A> with parameters of type <A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>GenrePredictorMulticlass.</B><B><A HREF="../../pages/GenrePredictorMulticlass.html#classify(java.lang.String, java.lang.String, java.lang.String, pages.MarkovTable, java.util.ArrayList, pages.Vocabulary, pages.FeatureNormalizer, boolean)">classify</A></B>(java.lang.String&nbsp;thisFile, java.lang.String&nbsp;inputDir, java.lang.String&nbsp;outputDir, <A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A>&nbsp;markov, java.util.ArrayList&lt;java.lang.String&gt;&nbsp;genres, <A HREF="../../pages/Vocabulary.html" title="class in pages">Vocabulary</A>&nbsp;vocabulary, <A HREF="../../pages/FeatureNormalizer.html" title="class in pages">FeatureNormalizer</A>&nbsp;normalizer, boolean&nbsp;isPairtree)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>GenrePredictor.</B><B><A HREF="../../pages/GenrePredictor.html#classify(java.lang.String, java.lang.String, java.lang.String, pages.MarkovTable, java.util.ArrayList, pages.Vocabulary, pages.FeatureNormalizer, boolean)">classify</A></B>(java.lang.String&nbsp;thisFile, java.lang.String&nbsp;inputDir, java.lang.String&nbsp;outputDir, <A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A>&nbsp;markov, java.util.ArrayList&lt;java.lang.String&gt;&nbsp;genres, <A HREF="../../pages/Vocabulary.html" title="class in pages">Vocabulary</A>&nbsp;vocabulary, <A HREF="../../pages/FeatureNormalizer.html" title="class in pages">FeatureNormalizer</A>&nbsp;normalizer, boolean&nbsp;isPairtree)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static&nbsp;java.util.ArrayList&lt;double[]&gt;</CODE></FONT></TD> <TD><CODE><B>ForwardBackward.</B><B><A HREF="../../pages/ForwardBackward.html#smooth(java.util.ArrayList, pages.MarkovTable, double[])">smooth</A></B>(java.util.ArrayList&lt;double[]&gt;&nbsp;evidenceVectors, <A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A>&nbsp;markov, double[]&nbsp;wordLengths)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Constructors in <A HREF="../../pages/package-summary.html">pages</A> with parameters of type <A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../pages/ClassifyingThread.html#ClassifyingThread(java.lang.String, java.lang.String, java.lang.String, int, java.util.ArrayList, pages.MarkovTable, java.util.ArrayList, pages.Vocabulary, pages.FeatureNormalizer, boolean, java.lang.String)">ClassifyingThread</A></B>(java.lang.String&nbsp;thisFile, java.lang.String&nbsp;inputDir, java.lang.String&nbsp;outputDir, int&nbsp;numGenres, java.util.ArrayList&lt;<A HREF="../../pages/GenrePredictor.html" title="class in pages">GenrePredictor</A>&gt;&nbsp;classifiers, <A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A>&nbsp;markov, java.util.ArrayList&lt;java.lang.String&gt;&nbsp;genres, <A HREF="../../pages/Vocabulary.html" title="class in pages">Vocabulary</A>&nbsp;vocabulary, <A HREF="../../pages/FeatureNormalizer.html" title="class in pages">FeatureNormalizer</A>&nbsp;normalizer, boolean&nbsp;isPairtree, java.lang.String&nbsp;modelLabel)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../pages/Model.html#Model(pages.Vocabulary, pages.FeatureNormalizer, pages.GenreList, java.util.ArrayList, pages.MarkovTable)">Model</A></B>(<A HREF="../../pages/Vocabulary.html" title="class in pages">Vocabulary</A>&nbsp;vocabulary, <A HREF="../../pages/FeatureNormalizer.html" title="class in pages">FeatureNormalizer</A>&nbsp;normalizer, <A HREF="../../pages/GenreList.html" title="class in pages">GenreList</A>&nbsp;genreList, java.util.ArrayList&lt;<A HREF="../../pages/GenrePredictor.html" title="class in pages">GenrePredictor</A>&gt;&nbsp;classifiers, <A HREF="../../pages/MarkovTable.html" title="class in pages">MarkovTable</A>&nbsp;markov)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../pages/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../pages/MarkovTable.html" title="class in pages"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html?pages//class-useMarkovTable.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="MarkovTable.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
tedunderwood/genre
pages/doc/pages/class-use/MarkovTable.html
HTML
mit
13,555
/* * This file is subject to the terms and conditions defined in * file 'LICENSE.txt', which is part of this source code package. * * author: emicklei */ V8D.receiveCallback = function(msg) { var obj = JSON.parse(msg); var context = this; if (obj.receiver != "this") { var namespaces = obj.receiver.split("."); for (var i = 0; i < namespaces.length; i++) { context = context[namespaces[i]]; } } var func = context[obj.selector]; if (func != null) { return JSON.stringify(func.apply(context, obj.args)); } else { // try reporting the error if (console != null) { console.log("[JS] unable to perform", msg); } // TODO return error? return "null"; } } // This callback is set for handling function calls from Go transferred as JSON. // It is called from Go using "worker.Send(...)". // Throws a SyntaxError exception if the string to parse is not valid JSON. // $recv(V8D.receiveCallback); // This callback is set for handling function calls from Go transferred as JSON that expect a return value. // It is called from Go using "worker.SendSync(...)". // Throws a SyntaxError exception if the string to parse is not valid JSON. // Returns the JSON representation of the return value of the handling function. // $recvSync(V8D.receiveCallback); // callDispatch is used from Go to call a callback function that was registered. // V8D.callDispatch = function(functionRef /*, arguments */ ) { var jsonArgs = [].slice.call(arguments).splice(1); var callback = V8D.function_registry.take(functionRef) if (V8D.function_registry.none == callback) { $print("[JS] no function for reference:" + functionRef); return; } callback.apply(this, jsonArgs.map(function(each){ return JSON.parse(each); })); } // MessageSend is a constructor. // V8D.MessageSend = function MessageSend(receiver, selector, onReturn) { this.data = { "receiver": receiver, "selector": selector, "callback": onReturn, "args": [].slice.call(arguments).splice(3) }; } // MessageSend toJSON returns the JSON representation. // V8D.MessageSend.prototype = { toJSON: function() { return JSON.stringify(this.data); } } // callReturn performs a MessageSend in Go and returns the value from that result // V8D.callReturn = function(receiver, selector /*, arguments */ ) { var msg = { "receiver": receiver, "selector": selector, "args": [].slice.call(arguments).splice(2) }; return JSON.parse($sendSync(JSON.stringify(msg))); } // call performs a MessageSend in Go and does NOT return a value. // V8D.call = function(receiver, selector /*, arguments */ ) { var msg = { "receiver": receiver, "selector": selector, "args": [].slice.call(arguments).splice(2) }; $send(JSON.stringify(msg)); } // callThen performs a MessageSend in Go which can call the onReturn function. // It does not return the value of the perform. // V8D.callThen = function(receiver, selector, onReturnFunction /*, arguments */ ) { var msg = { "receiver": receiver, "selector": selector, "callback": V8D.function_registry.put(onReturnFunction), "args": [].slice.call(arguments).splice(3) }; $send(JSON.stringify(msg)); } // set adds/replaces the value for a variable in the global scope. // V8D.set = function(variableName,itsValue) { V8D.outerThis[variableName] = itsValue; } // get returns the value for a variable in the global scope. // V8D.get = function(variableName) { return V8D.outerThis[variableName]; }
emicklei/v8dispatcher
js/setup.js
JavaScript
mit
3,684
#!/usr/bin/env bash GEM_BIN=$1/ruby/bin/gem export GEM_HOME=/usr/local/kidsruby/ruby/lib/ruby/gems/1.9.1 install_gems() { echo $KIDSRUBY_INSTALLING_GEMS ${GEM_BIN} install htmlentities-4.3.0.gem --no-ri --no-rdoc 2>&1 ${GEM_BIN} install rubywarrior-i18n-0.0.3.gem --no-ri --no-rdoc 2>&1 ${GEM_BIN} install serialport-1.1.1-universal.x86_64-darwin-10.gem --no-ri --no-rdoc 2>&1 ${GEM_BIN} install hybridgroup-sphero-1.0.1.gem --no-ri --no-rdoc 2>&1 } install_qtbindings() { echo $KIDSRUBY_INSTALLING_QTBINDINGS ${GEM_BIN} install qtbindings-4.7.3-universal-darwin-10.gem --no-ri --no-rdoc 2>&1 } install_gosu() { echo $KIDSRUBY_INSTALLING_GOSU ${GEM_BIN} install gosu-0.7.36.2-universal-darwin.gem --no-ri --no-rdoc 2>&1 } install_gems install_qtbindings install_gosu
hybridgroup/kidsrubyinstaller-osx
install_gems.sh
Shell
mit
784
<?php namespace Symfony\Component\Serializer; use Symfony\Component\Serializer\SerializerInterface; /* * This file is part of the Symfony framework. * * (c) Fabien Potencier <fabien@symfony.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ /** * Defines the interface of encoders * * @author Jordi Boggiano <j.boggiano@seld.be> */ interface SerializerAwareInterface { /** * Sets the owning Serializer object * * @param SerializerInterface $serializer */ function setSerializer(SerializerInterface $serializer); }
flyingfeet/FlyingFeet
vendor/symfony/src/Symfony/Component/Serializer/SerializerAwareInterface.php
PHP
mit
608
// ƒwƒbƒ_ƒtƒ@ƒCƒ‹‚̃Cƒ“ƒNƒ‹[ƒh #include <windows.h> // •W€WindowsAPI #include <tchar.h> // TCHARŒ^ #include <string.h> // C•¶Žš—ñˆ— // ŠÖ”‚̃vƒƒgƒ^ƒCƒvéŒ¾ LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); // ƒEƒBƒ“ƒhƒEƒƒbƒZ[ƒW‚ɑ΂µ‚Ä“ÆŽ©‚̏ˆ—‚ð‚·‚é‚悤‚É’è‹`‚µ‚½ƒR[ƒ‹ƒoƒbƒNŠÖ”WindowProc. // _tWinMainŠÖ”‚Ì’è‹` int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd) { // •Ï”‚̐錾 HWND hWnd; // CreateWindow‚ō쐬‚µ‚½ƒEƒBƒ“ƒhƒE‚̃EƒBƒ“ƒhƒEƒnƒ“ƒhƒ‹‚ðŠi”[‚·‚éHWNDŒ^•Ï”hWnd. MSG msg; // ƒEƒBƒ“ƒhƒEƒƒbƒZ[ƒWî•ñ‚ðŠi”[‚·‚éMSG\‘¢‘ÌŒ^•Ï”msg. WNDCLASS wc; // ƒEƒBƒ“ƒhƒEƒNƒ‰ƒXî•ñ‚ð‚à‚ÂWNDCLASS\‘¢‘ÌŒ^•Ï”wc. // ƒEƒBƒ“ƒhƒEƒNƒ‰ƒX‚̐ݒè wc.lpszClassName = _T("SetBkColor"); // ƒEƒBƒ“ƒhƒEƒNƒ‰ƒX–¼‚Í"SetBkColor". wc.style = CS_HREDRAW | CS_VREDRAW; // ƒXƒ^ƒCƒ‹‚ÍCS_HREDRAW | CS_VREDRAW. wc.lpfnWndProc = WindowProc; // ƒEƒBƒ“ƒhƒEƒvƒƒV[ƒWƒƒ‚Í“ÆŽ©‚̏ˆ—‚ð’è‹`‚µ‚½WindowProc. wc.hInstance = hInstance; // ƒCƒ“ƒXƒ^ƒ“ƒXƒnƒ“ƒhƒ‹‚Í_tWinMain‚̈ø”. wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); // ƒAƒCƒRƒ“‚̓AƒvƒŠƒP[ƒVƒ‡ƒ“Šù’è‚Ì‚à‚Ì. wc.hCursor = LoadCursor(NULL, IDC_ARROW); // ƒJ[ƒ\ƒ‹‚Í–îˆó. wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); // ”wŒi‚Í”’ƒuƒ‰ƒV. wc.lpszMenuName = NULL; // ƒƒjƒ…[‚Í‚È‚µ. wc.cbClsExtra = 0; // 0‚Å‚¢‚¢. wc.cbWndExtra = 0; // 0‚Å‚¢‚¢. // ƒEƒBƒ“ƒhƒEƒNƒ‰ƒX‚Ì“o˜^ if (!RegisterClass(&wc)) { // RegisterClass‚ŃEƒBƒ“ƒhƒEƒNƒ‰ƒX‚ð“o˜^‚µ, 0‚ª•Ô‚Á‚½‚çƒGƒ‰[. // ƒGƒ‰[ˆ— MessageBox(NULL, _T("RegisterClass failed!"), _T("SetBkColor"), MB_OK | MB_ICONHAND); // MessageBox‚Å"RegisterClass failed!"‚ƃGƒ‰[ƒƒbƒZ[ƒW‚ð•\Ž¦. return -1; // ˆÙíI—¹(1) } // ƒEƒBƒ“ƒhƒE‚̍쐬 hWnd = CreateWindow(_T("SetBkColor"), _T("SetBkColor"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); // CreateWindow‚Å, ã‚Å“o˜^‚µ‚½"SetBkColor"ƒEƒBƒ“ƒhƒEƒNƒ‰ƒX‚̃EƒBƒ“ƒhƒE‚ðì¬. if (hWnd == NULL) { // ƒEƒBƒ“ƒhƒE‚̍쐬‚ÉŽ¸”s‚µ‚½‚Æ‚«. // ƒGƒ‰[ˆ— MessageBox(NULL, _T("CreateWindow failed!"), _T("SetBkColor"), MB_OK | MB_ICONHAND); // MessageBox‚Å"CreateWindow failed!"‚ƃGƒ‰[ƒƒbƒZ[ƒW‚ð•\Ž¦. return -2; // ˆÙíI—¹(2) } // ƒEƒBƒ“ƒhƒE‚Ì•\Ž¦ ShowWindow(hWnd, SW_SHOW); // ShowWindow‚ÅSW_SHOW‚ðŽw’肵‚ăEƒBƒ“ƒhƒE‚Ì•\Ž¦. // ƒƒbƒZ[ƒWƒ‹[ƒv while (GetMessage(&msg, NULL, 0, 0) > 0) { // GetMessage‚сƒbƒZ[ƒW‚ðŽæ“¾, –ß‚è’l‚ª0‚æ‚è‘å‚«‚¢ŠÔ‚̓‹[ƒv‚µ‘±‚¯‚é. // ƒEƒBƒ“ƒhƒEƒƒbƒZ[ƒW‚Ì‘—o DispatchMessage(&msg); // DispatchMessage‚Ŏ󂯎æ‚Á‚½ƒƒbƒZ[ƒW‚ðƒEƒBƒ“ƒhƒEƒvƒƒV[ƒWƒƒ(‚±‚̏ꍇ‚Í“ÆŽ©‚É’è‹`‚µ‚½WindowProc)‚É‘—o. } // ƒvƒƒOƒ‰ƒ€‚̏I—¹ return (int)msg.wParam; // I—¹ƒR[ƒh(msg.wParam)‚ð–ß‚è’l‚Æ‚µ‚Ä•Ô‚·. } // WindowProcŠÖ”‚Ì’è‹` LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { // ƒEƒBƒ“ƒhƒEƒƒbƒZ[ƒW‚ɑ΂µ‚Ä“ÆŽ©‚̏ˆ—‚ð‚·‚é‚悤‚É’è‹`‚µ‚½ƒEƒBƒ“ƒhƒEƒvƒƒV[ƒWƒƒ. // ƒEƒBƒ“ƒhƒEƒƒbƒZ[ƒW‚ɑ΂·‚鏈—. switch (uMsg) { // switch-casa•¶‚ÅuMsg‚Ì’l‚²‚Ƃɏˆ—‚ðU‚蕪‚¯‚é. // ƒEƒBƒ“ƒhƒE‚̍쐬‚ªŠJŽn‚³‚ꂽŽž. case WM_CREATE: // ƒEƒBƒ“ƒhƒE‚̍쐬‚ªŠJŽn‚³‚ꂽŽž.(uMsg‚ªWM_CREATE‚ÌŽž.) // WM_CREATEƒuƒƒbƒN { // ƒEƒBƒ“ƒhƒEì¬¬Œ÷ return 0; // return•¶‚Å0‚ð•Ô‚µ‚Ä, ƒEƒBƒ“ƒhƒEì¬¬Œ÷‚Æ‚·‚é. } // Šù’è‚̏ˆ—‚ÖŒü‚©‚¤. break; // break‚Å”²‚¯‚Ä, Šù’è‚̏ˆ—(DefWindowProc)‚ÖŒü‚©‚¤. // ƒEƒBƒ“ƒhƒE‚ª”jŠü‚³‚ꂽŽž. case WM_DESTROY: // ƒEƒBƒ“ƒhƒE‚ª”jŠü‚³‚ꂽŽž.(uMsg‚ªWM_DESTROY‚ÌŽž.) // WM_DESTROYƒuƒƒbƒN { // I—¹ƒƒbƒZ[ƒW‚Ì‘—M. PostQuitMessage(0); // PostQuitMessage‚ŏI—¹ƒR[ƒh‚ð0‚Æ‚µ‚ÄWM_QUITƒƒbƒZ[ƒW‚𑗐M.(‚·‚é‚ƃƒbƒZ[ƒWƒ‹[ƒv‚ÌGetMessage‚Ì–ß‚è’l‚ª0‚É‚È‚é‚Ì‚Å, ƒƒbƒZ[ƒWƒ‹[ƒv‚©‚甲‚¯‚é.) } // Šù’è‚̏ˆ—‚ÖŒü‚©‚¤. break; // break‚Å”²‚¯‚Ä, Šù’è‚̏ˆ—(DefWindowProc)‚ÖŒü‚©‚¤. // ‰æ–Ê‚Ì•`‰æ‚ð—v‹‚³‚ꂽŽž. case WM_PAINT: // ‰æ–Ê‚Ì•`‰æ‚ð—v‹‚³‚ꂽŽž.(uMsg‚ªWM_PAINT‚ÌŽž.) // WM_PAINTƒuƒƒbƒN { // ‚±‚̃uƒƒbƒN‚̃[ƒJƒ‹•Ï”E”z—ñ‚̐錾‚Ə‰Šú‰». HDC hDC; // ƒfƒoƒCƒXƒRƒ“ƒeƒLƒXƒgƒnƒ“ƒhƒ‹‚ðŠi”[‚·‚éHDCŒ^•Ï”hDC. PAINTSTRUCT ps; // ƒyƒCƒ“ƒgî•ñ‚ðŠÇ—‚·‚éPAINTSTRUCT\‘¢‘ÌŒ^‚̕ϐ”ps. TCHAR tszText[] = _T("ABCDE"); // TCHARŒ^”z—ñtszText‚ð"ABCDE"‚ŏ‰Šú‰». size_t uiLen = 0; // tszText‚Ì’·‚³‚ðŠi”[‚·‚邽‚ß‚Ìsize_tŒ^•Ï”uiLen‚ð0‚ɏ‰Šú‰». // ƒEƒBƒ“ƒhƒE‚Ì•`‰æŠJŽn hDC = BeginPaint(hwnd, &ps); // BeginPaint‚Å‚±‚̃EƒBƒ“ƒhƒE‚Ì•`‰æ‚̏€”õ‚ð‚·‚é. –ß‚è’l‚ɂ̓fƒoƒCƒXƒRƒ“ƒeƒLƒXƒgƒnƒ“ƒhƒ‹‚ª•Ô‚é‚Ì‚Å, hDC‚ÉŠi”[. // ”wŒiF‚̐ݒè SetBkColor(hDC, RGB(0x00, 0x00, 0xff)); // SetBkColor‚ՂðƒZƒbƒg. // •`‰æF‚̐ݒè SetTextColor(hDC, RGB(0xff, 0x00, 0x00)); // SetTextColor‚ŐԂðƒZƒbƒg. // •¶Žš—ñ‚Ì•`‰æ uiLen = _tcslen(tszText); // _tcslen‚ÅtszText‚Ì’·‚³‚ðŽæ“¾‚µ, uiLen‚ÉŠi”[. TextOut(hDC, 50, 50, tszText, (int)uiLen); // TextOut‚ŃEƒBƒ“ƒhƒEhwnd‚̍À•W(50, 50)‚̈ʒu‚ÉtszText‚ð•`‰æ. // ƒEƒBƒ“ƒhƒE‚Ì•`‰æI—¹ EndPaint(hwnd, &ps); // EndPaint‚Å‚±‚̃EƒBƒ“ƒhƒE‚Ì•`‰æˆ—‚ðI—¹‚·‚é. } // Šù’è‚̏ˆ—‚ÖŒü‚©‚¤. break; // break‚Å”²‚¯‚Ä, Šù’è‚̏ˆ—(DefWindowProc)‚ÖŒü‚©‚¤. // ã‹LˆÈŠO‚ÌŽž. default: // ã‹LˆÈŠO‚Ì’l‚ÌŽž‚ÌŠù’菈—. // Šù’è‚̏ˆ—‚ÖŒü‚©‚¤. break; // break‚Å”²‚¯‚Ä, Šù’è‚̏ˆ—(DefWindowProc)‚ÖŒü‚©‚¤. } // ‚ ‚Æ‚ÍŠù’è‚̏ˆ—‚É”C‚¹‚é. return DefWindowProc(hwnd, uMsg, wParam, lParam); // –ß‚è’l‚àŠÜ‚ßDefWindowProc‚ÉŠù’è‚̏ˆ—‚ð”C‚¹‚é. }
bg1bgst333/Sample
winapi/SetBkColor/SetBkColor/src/SetBkColor/SetBkColor/SetBkColor.cpp
C++
mit
5,385
/** * * Modelo de Login usando MCV * Desenvolvido por Ricardo Hirashiki * Publicado em: http://www.sitedoricardo.com.br * Data: Ago/2011 * * Baseado na extensao criada por Wemerson Januario * http://code.google.com/p/login-window/ * */ Ext.define('Siccad.view.authentication.CapsWarningTooltip', { extend : 'Ext.tip.QuickTip', alias : 'widget.capswarningtooltip', target : 'authentication-login', id : 'toolcaps', anchor : 'left', anchorOffset : 60, width : 305, dismissDelay : 0, autoHide : false, disabled : false, title : '<b>Caps Lock est&aacute; ativada</b>', html : '<div>Se Caps lock estiver ativado, isso pode fazer com que voc&ecirc;</div>' + '<div>digite a senha incorretamente.</div><br/>' + '<div>Voc&ecirc; deve pressionar a tecla Caps lock para desativ&aacute;-la</div>' + '<div>antes de digitar a senha.</div>' });
romeugodoi/demo_sf2
src/Sicoob/SiccadBundle/Resources/public/js/siccad/view/authentication/CapsWarningTooltip.js
JavaScript
mit
1,010
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Rotate : MonoBehaviour { public Vector3 m_rotate; public float m_speed; void Start() { transform.rotation = Random.rotation; } // Update is called once per frame void Update () { transform.Rotate(m_rotate*Time.deltaTime* m_speed); } }
a172862967/ProceduralSphere
KGProceduralSphere/Assets/Demo/Rotate.cs
C#
mit
373
<?php /* SRVDVServerBundle:Registration:email.txt.twig */ class __TwigTemplate_d9fb642ef38579dd6542f4eacc9668ce91ac497e0fd5b3f1b1ca25429847bdfe extends Twig_Template { public function __construct(Twig_Environment $env) { parent::__construct($env); $this->parent = false; $this->blocks = array( 'subject' => array($this, 'block_subject'), 'body_text' => array($this, 'block_body_text'), 'body_html' => array($this, 'block_body_html'), ); } protected function doDisplay(array $context, array $blocks = array()) { $__internal_7a96ebd63b4296612d33f1d823c5023a1e83652097ab3b2f83bcd80ebfe28389 = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"); $__internal_7a96ebd63b4296612d33f1d823c5023a1e83652097ab3b2f83bcd80ebfe28389->enter($__internal_7a96ebd63b4296612d33f1d823c5023a1e83652097ab3b2f83bcd80ebfe28389_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "SRVDVServerBundle:Registration:email.txt.twig")); // line 2 echo " "; // line 3 $this->displayBlock('subject', $context, $blocks); // line 8 $this->displayBlock('body_text', $context, $blocks); // line 13 $this->displayBlock('body_html', $context, $blocks); $__internal_7a96ebd63b4296612d33f1d823c5023a1e83652097ab3b2f83bcd80ebfe28389->leave($__internal_7a96ebd63b4296612d33f1d823c5023a1e83652097ab3b2f83bcd80ebfe28389_prof); } // line 3 public function block_subject($context, array $blocks = array()) { $__internal_8dec34524e53ef6eb9823b0097df011468b0fef15fddadcedc50239d971a3cfe = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"); $__internal_8dec34524e53ef6eb9823b0097df011468b0fef15fddadcedc50239d971a3cfe->enter($__internal_8dec34524e53ef6eb9823b0097df011468b0fef15fddadcedc50239d971a3cfe_prof = new Twig_Profiler_Profile($this->getTemplateName(), "block", "subject")); // line 4 echo " "; // line 5 echo " "; echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->trans("registration.email.subject", array("%username%" => $this->getAttribute((isset($context["user"]) ? $context["user"] : $this->getContext($context, "user")), "username", array()), "%confirmationUrl%" => (isset($context["confirmationUrl"]) ? $context["confirmationUrl"] : $this->getContext($context, "confirmationUrl"))), "FOSUserBundle"); echo " "; $__internal_8dec34524e53ef6eb9823b0097df011468b0fef15fddadcedc50239d971a3cfe->leave($__internal_8dec34524e53ef6eb9823b0097df011468b0fef15fddadcedc50239d971a3cfe_prof); } // line 8 public function block_body_text($context, array $blocks = array()) { $__internal_7131087c60e816b15fc165bd85f50803d3ee0c35a7e40bf98ad739acaf455904 = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"); $__internal_7131087c60e816b15fc165bd85f50803d3ee0c35a7e40bf98ad739acaf455904->enter($__internal_7131087c60e816b15fc165bd85f50803d3ee0c35a7e40bf98ad739acaf455904_prof = new Twig_Profiler_Profile($this->getTemplateName(), "block", "body_text")); // line 9 echo " "; // line 10 echo " "; echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->trans("registration.email.message", array("%username%" => $this->getAttribute((isset($context["user"]) ? $context["user"] : $this->getContext($context, "user")), "username", array()), "%confirmationUrl%" => (isset($context["confirmationUrl"]) ? $context["confirmationUrl"] : $this->getContext($context, "confirmationUrl"))), "FOSUserBundle"); echo " "; $__internal_7131087c60e816b15fc165bd85f50803d3ee0c35a7e40bf98ad739acaf455904->leave($__internal_7131087c60e816b15fc165bd85f50803d3ee0c35a7e40bf98ad739acaf455904_prof); } // line 13 public function block_body_html($context, array $blocks = array()) { $__internal_35b67ba0a150c9c6c2bdcba437c30bb455fcc764d18c8bc8364adeec347d24a3 = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"); $__internal_35b67ba0a150c9c6c2bdcba437c30bb455fcc764d18c8bc8364adeec347d24a3->enter($__internal_35b67ba0a150c9c6c2bdcba437c30bb455fcc764d18c8bc8364adeec347d24a3_prof = new Twig_Profiler_Profile($this->getTemplateName(), "block", "body_html")); $__internal_35b67ba0a150c9c6c2bdcba437c30bb455fcc764d18c8bc8364adeec347d24a3->leave($__internal_35b67ba0a150c9c6c2bdcba437c30bb455fcc764d18c8bc8364adeec347d24a3_prof); } public function getTemplateName() { return "SRVDVServerBundle:Registration:email.txt.twig"; } public function getDebugInfo() { return array ( 75 => 13, 65 => 10, 63 => 9, 57 => 8, 47 => 5, 45 => 4, 39 => 3, 32 => 13, 30 => 8, 28 => 3, 25 => 2,); } /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */ public function getSource() { @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED); return $this->getSourceContext()->getCode(); } public function getSourceContext() { return new Twig_Source("{% trans_default_domain 'FOSUserBundle' %} {% block subject %} {% autoescape false %} {{ 'registration.email.subject'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}) }} {% endautoescape %} {% endblock %} {% block body_text %} {% autoescape false %} {{ 'registration.email.message'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}) }} {% endautoescape %} {% endblock %} {% block body_html %}{% endblock %} ", "SRVDVServerBundle:Registration:email.txt.twig", "C:\\wamp64\\www\\serveurDeVoeux\\src\\SRVDV\\ServerBundle/Resources/views/Registration/email.txt.twig"); } }
youcefboukersi/serveurdevoeux
app/cache/dev/twig/a4/a4d5e331da6ebdf63a769ec513a07ed062a09e096299142f0540503ab3951bbb.php
PHP
mit
6,108
using Portal.CMS.Entities.Enumerators; using Portal.CMS.Services.Generic; using Portal.CMS.Services.PageBuilder; using Portal.CMS.Web.Architecture.ActionFilters; using Portal.CMS.Web.Architecture.Extensions; using Portal.CMS.Web.Areas.PageBuilder.ViewModels.Component; using Portal.CMS.Web.ViewModels.Shared; using System; using System.Linq; using System.Threading.Tasks; using System.Web.Mvc; using System.Web.SessionState; namespace Portal.CMS.Web.Areas.PageBuilder.Controllers { [AdminFilter(ActionFilterResponseType.Modal)] [SessionState(SessionStateBehavior.ReadOnly)] public class ComponentController : Controller { private readonly IPageSectionService _pageSectionService; private readonly IPageComponentService _pageComponentService; private readonly IImageService _imageService; public ComponentController(IPageSectionService pageSectionService, IPageComponentService pageComponentService, IImageService imageService) { _pageSectionService = pageSectionService; _pageComponentService = pageComponentService; _imageService = imageService; } [HttpGet] [OutputCache(Duration = 86400)] public async Task<ActionResult> Add() { var model = new AddViewModel { PageComponentTypeList = await _pageComponentService.GetComponentTypesAsync() }; return View("_Add", model); } [HttpPost] [ValidateInput(false)] public async Task<JsonResult> Add(int pageSectionId, string containerElementId, string elementBody) { elementBody = elementBody.Replace("animated bounce", string.Empty); await _pageComponentService.AddAsync(pageSectionId, containerElementId, elementBody); return Json(new { State = true }); } [HttpPost] public async Task<ActionResult> Delete(int pageSectionId, string elementId) { try { await _pageComponentService.DeleteAsync(pageSectionId, elementId); return Json(new { State = true }); } catch (Exception ex) { return Json(new { State = false, Message = ex.InnerException }); } } [HttpPost] [ValidateInput(false)] public async Task<ActionResult> Edit(int pageSectionId, string elementId, string elementHtml) { await _pageComponentService.EditElementAsync(pageSectionId, elementId, elementHtml); return Content("Refresh"); } [HttpGet] public async Task<ActionResult> EditImage(int pageSectionId, string elementId, string elementType) { var imageList = await _imageService.GetAsync(); var model = new ImageViewModel { SectionId = pageSectionId, ElementType = elementType, ElementId = elementId, GeneralImages = new PaginationViewModel { PaginationType = "general", TargetInputField = "SelectedImageId", ImageList = imageList.Where(x => x.ImageCategory == ImageCategory.General) }, IconImages = new PaginationViewModel { PaginationType = "icon", TargetInputField = "SelectedImageId", ImageList = imageList.Where(x => x.ImageCategory == ImageCategory.Icon) }, ScreenshotImages = new PaginationViewModel { PaginationType = "screenshot", TargetInputField = "SelectedImageId", ImageList = imageList.Where(x => x.ImageCategory == ImageCategory.Screenshot) }, TextureImages = new PaginationViewModel { PaginationType = "texture", TargetInputField = "SelectedImageId", ImageList = imageList.Where(x => x.ImageCategory == ImageCategory.Texture) } }; return View("_EditImage", model); } [HttpPost] public async Task<JsonResult> EditImage(ImageViewModel model) { try { var selectedImage = await _imageService.GetAsync(model.SelectedImageId); await _pageComponentService.EditImageAsync(model.SectionId, model.ElementType, model.ElementId, selectedImage.CDNImagePath()); return Json(new { State = true, Source = selectedImage.CDNImagePath() }); } catch (Exception) { return Json(new { State = false }); } } [HttpGet] public ActionResult EditVideo(int pageSectionId, string widgetWrapperElementId, string videoPlayerElementId) { var model = new VideoViewModel { SectionId = pageSectionId, WidgetWrapperElementId = widgetWrapperElementId, VideoPlayerElementId = videoPlayerElementId, VideoUrl = string.Empty }; return View("_EditVideo", model); } [HttpPost] [ValidateAntiForgeryToken] public async Task<ActionResult> EditVideo(VideoViewModel model) { try { await _pageComponentService.EditSourceAsync(model.SectionId, model.VideoPlayerElementId, model.VideoUrl); return Json(new { State = true }); } catch (Exception) { return Json(new { State = false }); } } [HttpGet] public ActionResult EditContainer(int pageSectionId, string elementId) { var model = new ContainerViewModel { SectionId = pageSectionId, ElementId = elementId }; return View("_EditContainer", model); } [HttpPost] [ValidateAntiForgeryToken] public async Task<ActionResult> EditContainer(ContainerViewModel model) { await _pageSectionService.EditAnimationAsync(model.SectionId, model.ElementId, model.Animation.ToString()); return Content("Refresh"); } [HttpPost] [ValidateInput(false)] public async Task<ActionResult> Link(int pageSectionId, string elementId, string elementHtml, string elementHref, string elementTarget) { await _pageComponentService.EditAnchorAsync(pageSectionId, elementId, elementHtml, elementHref, elementTarget); return Content("Refresh"); } [HttpPost] public async Task<JsonResult> Clone(int pageSectionId, string elementId, string componentStamp) { await _pageComponentService.CloneElementAsync(pageSectionId, elementId, componentStamp); return Json(new { State = true }); } } }
tommcclean/PortalCMS
Portal.CMS.Web/Areas/PageBuilder/Controllers/ComponentController.cs
C#
mit
7,137
<?php /** * Created by PhpStorm. * User: robert * Date: 1/14/15 * Time: 3:06 PM */ namespace Skema\Directive; class Binding extends Base { }
Skema/Skema
Skema/Directive/Binding.php
PHP
mit
149
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ // // ActionOnDispose.cs // // // Implemention of IDisposable that runs a delegate on Dispose. // // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; namespace System.Threading.Tasks.Dataflow.Internal { /// <summary>Provider of disposables that run actions.</summary> internal sealed class Disposables { /// <summary>An IDisposable that does nothing.</summary> internal readonly static IDisposable Nop = new NopDisposable(); /// <summary>Creates an IDisposable that runs an action when disposed.</summary> /// <typeparam name="T1">Specifies the type of the first argument.</typeparam> /// <typeparam name="T2">Specifies the type of the second argument.</typeparam> /// <param name="action">The action to invoke.</param> /// <param name="arg1">The first argument.</param> /// <param name="arg2">The second argument.</param> /// <returns>The created disposable.</returns> internal static IDisposable Create<T1, T2>(Action<T1, T2> action, T1 arg1, T2 arg2) { Contract.Requires(action != null, "Non-null disposer action required."); return new Disposable<T1, T2>(action, arg1, arg2); } /// <summary>Creates an IDisposable that runs an action when disposed.</summary> /// <typeparam name="T1">Specifies the type of the first argument.</typeparam> /// <typeparam name="T2">Specifies the type of the second argument.</typeparam> /// <typeparam name="T3">Specifies the type of the third argument.</typeparam> /// <param name="action">The action to invoke.</param> /// <param name="arg1">The first argument.</param> /// <param name="arg2">The second argument.</param> /// <param name="arg3">The third argument.</param> /// <returns>The created disposable.</returns> internal static IDisposable Create<T1, T2, T3>(Action<T1, T2, T3> action, T1 arg1, T2 arg2, T3 arg3) { Contract.Requires(action != null, "Non-null disposer action required."); return new Disposable<T1, T2, T3>(action, arg1, arg2, arg3); } /// <summary>A disposable that's a nop.</summary> [DebuggerDisplay("Disposed = true")] private sealed class NopDisposable : IDisposable { void IDisposable.Dispose() { } } /// <summary>An IDisposable that will run a delegate when disposed.</summary> [DebuggerDisplay("Disposed = {Disposed}")] private sealed class Disposable<T1, T2> : IDisposable { /// <summary>First state argument.</summary> private readonly T1 _arg1; /// <summary>Second state argument.</summary> private readonly T2 _arg2; /// <summary>The action to run when disposed. Null if disposed.</summary> private Action<T1, T2> _action; /// <summary>Initializes the ActionOnDispose.</summary> /// <param name="action">The action to run when disposed.</param> /// <param name="arg1">The first argument.</param> /// <param name="arg2">The second argument.</param> internal Disposable(Action<T1, T2> action, T1 arg1, T2 arg2) { Contract.Requires(action != null, "Non-null action needed for disposable"); _action = action; _arg1 = arg1; _arg2 = arg2; } /// <summary>Gets whether the IDisposable has been disposed.</summary> [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] private bool Disposed { get { return _action == null; } } /// <summary>Invoke the action.</summary> void IDisposable.Dispose() { Action<T1, T2> toRun = _action; if (toRun != null && Interlocked.CompareExchange(ref _action, null, toRun) == toRun) { toRun(_arg1, _arg2); } } } /// <summary>An IDisposable that will run a delegate when disposed.</summary> [DebuggerDisplay("Disposed = {Disposed}")] private sealed class Disposable<T1, T2, T3> : IDisposable { /// <summary>First state argument.</summary> private readonly T1 _arg1; /// <summary>Second state argument.</summary> private readonly T2 _arg2; /// <summary>Third state argument.</summary> private readonly T3 _arg3; /// <summary>The action to run when disposed. Null if disposed.</summary> private Action<T1, T2, T3> _action; /// <summary>Initializes the ActionOnDispose.</summary> /// <param name="action">The action to run when disposed.</param> /// <param name="arg1">The first argument.</param> /// <param name="arg2">The second argument.</param> /// <param name="arg3">The third argument.</param> internal Disposable(Action<T1, T2, T3> action, T1 arg1, T2 arg2, T3 arg3) { Contract.Requires(action != null, "Non-null action needed for disposable"); _action = action; _arg1 = arg1; _arg2 = arg2; _arg3 = arg3; } /// <summary>Gets whether the IDisposable has been disposed.</summary> [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] private bool Disposed { get { return _action == null; } } /// <summary>Invoke the action.</summary> void IDisposable.Dispose() { Action<T1, T2, T3> toRun = _action; if (toRun != null && Interlocked.CompareExchange(ref _action, null, toRun) == toRun) { toRun(_arg1, _arg2, _arg3); } } } } }
cuteant/dotnet-tpl-dataflow
source/Internal/ActionOnDispose.cs
C#
mit
5,481
using System; using System.Collections.Generic; using Esb.Transport; namespace Esb.Message { public interface IMessageQueue { void Add(Envelope message); IEnumerable<Envelope> Messages { get; } Envelope GetNextMessage(); void SuspendMessages(Type messageType); void ResumeMessages(Type messageType); void RerouteMessages(Type messageType); void RemoveMessages(Type messageType); event EventHandler<EventArgs> OnMessageArived; IRouter Router { get; set; } } }
Xynratron/WorkingCluster
Esb/Message/IMessageQueue.cs
C#
mit
548
// This file auto generated by plugin for ida pro. Generated code only for x64. Please, dont change manually #pragma once #include <common/common.h> #include <CRealMoveRequestDelayCheckerDetail.hpp> #include <common/ATFCore.hpp> START_ATF_NAMESPACE namespace Register { class CRealMoveRequestDelayCheckerRegister : public IRegister { public: void Register() override { auto& hook_core = CATFCore::get_instance(); for (auto& r : Detail::CRealMoveRequestDelayChecker_functions) hook_core.reg_wrapper(r.pBind, r); } }; }; // end namespace Register END_ATF_NAMESPACE
goodwinxp/Yorozuya
library/ATF/CRealMoveRequestDelayCheckerRegister.hpp
C++
mit
727
title: 会声会影安装与激活 date: 2016-06-05 22:58:54 tags: --- ## 资源 * [会声会影下载](http://www.huishenghuiying.com.cn/xiazai.html#selctbuy) * [会声会影注册机下载](https://hostr.co/file/FDp8MOYlRuHv/AppNee.com.Corel.X5-X9.All.Products.Universal.Keygen.7z?warning=on) * 转载:[会声会影安装与激活](https://luoyefe.com/blog/2016/06/05/%E4%BC%9A%E5%A3%B0%E4%BC%9A%E5%BD%B1%E5%AE%89%E8%A3%85%E4%B8%8E%E6%BF%80%E6%B4%BB/) @[Github](https://github.com/luoye-fe/hexo-blog/tree/master/source/_posts) ## 安装(x8版本) #### 1、找到下载好的以 `.exe` 为结尾的安装文件,将后缀名改为 `.rar`,然后打开此压缩包(不是解压,用360压缩等工具打开) #### 2、打开压缩包中的 `setup.xml` * 搜索 `SHOWSERIALDIALOG`,将其 `value` 改为 `true` * 搜索 `SERIALNUMBER`,将其 `value` 删除 > 修改前 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/1.png) > 修改后 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/2.png) 然后将 `.rar` 改回 `.exe` #### 3、断开网络链接 #### 4、打开注册机,选择产品为 `Corel VideoStudio Pro/Ulitime X8` ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/3.png) #### 5、双击打开安装包 * 勾选接受协议,下一步 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/4.png) * 要求输入序列号 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/5.png) * 拷贝注册机中生成的序列号 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/6.png) * 粘贴在输入框内,点击下一步 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/7.png) * 位置默认,视频标准默认,安装位置自定义,点击立即安装,等待安装完成 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/8.png) #### 6、打开会声会影主程序,第一次打开会提示为试用版30天,有功能限制,无视。待程序打开后,关闭程序 > 这个地方有可能出现打开主程序提示试用版然后打不开软件的情况,此时,链接上网络,双击 `Corel FastFlick X8`,会出现提示注册的界面,输入邮箱进行注册,如下 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/9.png) ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/10.png) > 点击下一步,完成后关闭页面 * 出现如下界面时,断开网络链接,根据箭头指示点击 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/11.png) ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/12.png) * 在注册机中输入安装码(只能手工输入,注意连字符) ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/13.png) ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/14.png) * 点击 `Generate Activation Code` 生成激活码 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/15.png) * 复制生成好的激活码 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/16.png) * 粘贴在安装程序激活码位置 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/17.png) * 点击下一步完成激活 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/18.png) * 链接网络,打开主程序,已成功激活 ![](https://github.com/luoye-fe/hexo-blog/blob/master/source/_posts/会声会影安装与激活/19.png)
taoste/taoste.github.io
intl/Tool/会声会影安装与激活/会声会影安装与激活.md
Markdown
mit
4,053
# nodejs-boilerplate ## About A boilerplate for a developer environment pre-built for a nodejs project using expressjs for the backend and angularjs for the front end. This boilerplate also comes with a built in logger for requests as well as a Gruntfile with my favorite addons for developing nodejs projects. :godmode: ## Dependencies **AngularJS** Using the Browserify addon in grunt, I've created a folder structure for organizing angular projects into smaller components within the *public/js/modules* folder. While running grunt watch, all of these files are included in *public/js/main.js* and will continue to be compressed into *public/js/bundle.min.js*. I have set AngularJS html5Mode option to true and have made the server configurations necessary to remove the hashtag from urls. Strict mode has been added to each module to ensure proper javascript is being used. **bower** Using a .bowerrc file, I have set it so running *bower install* will install packages directly into the *public/js/bower_components* folder. This is intended to keep frontend libraries and frameworks seperate from backend node_modules and Gruntfile addons. **SASS and Compass** This boilerplate comes with the SASS precompiler and I have decided to go with SCSS because I enjoy curly brackets. **Grunt** Be sure to keep the grunt watch task running during development. I've set jshint to all javascript files including those found in the backend. Thank you and have a nice day :)
typicalmike002/nodejs-boilerplate
README.md
Markdown
mit
1,485
//----------------------------------------------------------------------- // <copyright file="LocalizableFormBase.cs" company="Hyperar"> // Copyright (c) Hyperar. All rights reserved. // </copyright> // <author>Matías Ezequiel Sánchez</author> //----------------------------------------------------------------------- namespace Hyperar.HattrickUltimate.UserInterface { using System; using System.Windows.Forms; using Interface; /// <summary> /// ILocalizableForm base implementation. /// </summary> public partial class LocalizableFormBase : Form, ILocalizableForm { #region Public Methods /// <summary> /// Populates controls' properties with the corresponding localized string. /// </summary> public virtual void PopulateLanguage() { } #endregion Public Methods #region Protected Methods /// <summary> /// Raises the System.Windows.Forms.Form.Load event. /// </summary> /// <param name="e">An System.EventArgs that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.PopulateLanguage(); } #endregion Protected Methods } }
hyperar/Hattrick-Ultimate
Hyperar.HattrickUltimate.UserInterface/LocalizableFormBase.cs
C#
mit
1,283
var width = window.innerWidth, height = window.innerHeight, boids = [], destination, canvas, context; const MAX_NUMBER = 100; const MAX_SPEED = 1; const radius = 5; init(); animation(); function init(){ canvas = document.getElementById('canvas'), context = canvas.getContext( "2d" ); canvas.width = width; canvas.height = height; destination = { x:Math.random()*width, y:Math.random()*height }; for (var i = 0; i <MAX_NUMBER; i++) { boids[i] = new Boid(); }; } var _animation; function animation(){ _animation = requestAnimationFrame(animation); context.clearRect(0,0,width,height); for (var i = 0; i < boids.length; i++) { boids[i].rule1(); boids[i].rule2(); boids[i].rule3(); boids[i].rule4(); boids[i].rule5(); boids[i].rule6(); var nowSpeed = Math.sqrt(boids[i].vx * boids[i].vx + boids[i].vy * boids[i].vy ); if(nowSpeed > MAX_SPEED){ boids[i].vx *= MAX_SPEED / nowSpeed; boids[i].vy *= MAX_SPEED / nowSpeed; } boids[i].x += boids[i].vx; boids[i].y += boids[i].vy; drawCircle(boids[i].x,boids[i].y); drawVector(boids[i].x,boids[i].y,boids[i].vx,boids[i].vy); }; } /* //mouseEvent document.onmousemove = function (event){ destination ={ x:event.screenX, y:event.screenY } }; */ function Boid(){ this.x = Math.random()*width; this.y = Math.random()*height; this.vx = 0.0; this.vy = 0.0; this.dx = Math.random()*width; this.dy = Math.random()*height; //群れの中心に向かう this.rule1 = function(){ var centerx = 0, centery = 0; for (var i = 0; i < boids.length; i++) { if (boids[i] != this) { centerx += boids[i].x; centery += boids[i].y; }; }; centerx /= MAX_NUMBER-1; centery /= MAX_NUMBER-1; this.vx += (centerx-this.x)/1000; this.vy += (centery-this.y)/1000; } //他の個体と離れるように動く this.rule2 = function(){ var _vx = 0, _vy = 0; for (var i = 0; i < boids.length; i++) { if(this != boids[i]){ var distance = distanceTo(this.x,boids[i].x,this.y,boids[i].y); if(distance<25){ distance += 0.001; _vx -= (boids[i].x - this.x)/distance; _vy -= (boids[i].y - this.y)/distance; //this.dx = -boids[i].x; //this.dy = -boids[i].y; } } }; this.vx += _vx; this.vy += _vy; } //他の個体と同じ速度で動こうとする this.rule3 = function(){ var _pvx = 0, _pvy = 0; for (var i = 0; i < boids.length; i++) { if (boids[i] != this) { _pvx += boids[i].vx; _pvy += boids[i].vy; } }; _pvx /= MAX_NUMBER-1; _pvy /= MAX_NUMBER-1; this.vx += (_pvx - this.vx)/10; this.vy += (_pvy - this.vy)/10; }; //壁側の時の振る舞い this.rule4 = function(){ if(this.x < 10 && this.vx < 0)this.vx += 10/(Math.abs( this.x ) + 1 ); if(this.x > width && this.vx > 0)this.vx -= 10/(Math.abs( width - this.x ) + 1 ); if (this.y < 10 && this.vy < 0)this.vy += 10/(Math.abs( this.y ) + 1 ); if(this.y > height && this.vy > 0)this.vy -= 10/(Math.abs( height - this.y ) + 1 ); }; //目的地に行く this.rule5 = function(){ var _dx = this.dx - this.x, _dy = this.dy - this.y; this.vx += (this.dx - this.x)/500; this.vy += (this.dy - this.y)/500; } //捕食する this.rule6 = function(){ var _vx = Math.random()-0.5, _vy = Math.random()-0.5; for (var i = 0; i < boids.length; i++) { if(this != boids[i] && this.dx != boids[i].dx && this.dy != boids[i].dy){ var distance = distanceTo(this.x,boids[i].x,this.y,boids[i].y); if(distance<20 && distance>15){ console.log(distance); distance += 0.001; _vx += (boids[i].x - this.x)/distance; _vy += (boids[i].y - this.y)/distance; drawLine(this.x,this.y,boids[i].x,boids[i].y); this.dx = boids[i].dx; this.dy = boids[i].dy; } } }; this.vx += _vx; this.vy += _vy; } } function distanceTo(x1,x2,y1,y2){ var dx = x2-x1, dy = y2-y1; return Math.sqrt(dx*dx+dy*dy); } function drawCircle(x,y){ context.beginPath(); context.strokeStyle = "#fff"; context.arc(x,y,radius,0,Math.PI*2,false); context.stroke(); } const VectorLong = 10; function drawVector(x,y,vx,vy){ context.beginPath(); var pointx = x+vx*VectorLong; var pointy = y+vy*VectorLong; context.moveTo(x,y); context.lineTo(pointx,pointy); context.stroke(); } function drawLine(x1,y1,x2,y2){ context.beginPath(); context.moveTo(x1,y1); context.lineTo(x2,y2); context.stroke(); }
yuuki2006628/boid
boid.js
JavaScript
mit
4,749
package com.facetime.spring.support; import java.util.ArrayList; import java.util.List; import com.facetime.core.conf.ConfigUtils; import com.facetime.core.utils.StringUtils; /** * 分页类 * * @author yufei * @param <T> */ public class Page<T> { private static int BEGIN_PAGE_SIZE = 20; /** 下拉分页列表的递增数量级 */ private static int ADD_PAGE_SIZE_RATIO = 10; public static int DEFAULT_PAGE_SIZE = 10; private static int MAX_PAGE_SIZE = 200; private QueryInfo<T> queryInfo = null; private List<T> queryResult = null; public Page() { this(new QueryInfo<T>()); } public Page(QueryInfo<T> queryInfo) { this.queryInfo = queryInfo; this.queryResult = new ArrayList<T>(15); } /** * @return 下拉分页列表的递增数量级 */ public final static int getAddPageSize() { String addPageSizeRatio = ConfigUtils.getProperty("add_page_size_ratio"); if (StringUtils.isValid(addPageSizeRatio)) ADD_PAGE_SIZE_RATIO = Integer.parseInt(addPageSizeRatio); return ADD_PAGE_SIZE_RATIO; } /** * @return 默认分页下拉列表的开始值 */ public final static int getBeginPageSize() { String beginPageSize = ConfigUtils.getProperty("begin_page_size"); if (StringUtils.isValid(beginPageSize)) BEGIN_PAGE_SIZE = Integer.parseInt(beginPageSize); return BEGIN_PAGE_SIZE; } /** * 默认列表记录显示条数 */ public static final int getDefaultPageSize() { String defaultPageSize = ConfigUtils.getProperty("default_page_size"); if (StringUtils.isValid(defaultPageSize)) DEFAULT_PAGE_SIZE = Integer.parseInt(defaultPageSize); return DEFAULT_PAGE_SIZE; } /** * 默认分页列表显示的最大记录条数 */ public static final int getMaxPageSize() { String maxPageSize = ConfigUtils.getProperty("max_page_size"); if (StringUtils.isValid(maxPageSize)) { MAX_PAGE_SIZE = Integer.parseInt(maxPageSize); } return MAX_PAGE_SIZE; } public String getBeanName() { return this.queryInfo.getBeanName(); } public int getCurrentPageNo() { return this.queryInfo.getCurrentPageNo(); } public String getKey() { return this.queryInfo.getKey(); } public Integer getNeedRowNum() { return this.getPageSize() - this.getQueryResult().size(); } public long getNextPage() { return this.queryInfo.getNextPage(); } public int getPageCount() { return this.queryInfo.getPageCount(); } public int getPageSize() { return this.queryInfo.getPageSize(); } public List<T> getParams() { return this.queryInfo.getParams(); } public int getPreviousPage() { return this.queryInfo.getPreviousPage(); } public String[] getProperties() { return this.queryInfo.getProperties(); } public List<T> getQueryResult() { return this.queryResult; } public int getRecordCount() { return this.queryInfo.getRecordCount(); } public String getSql() { return this.queryInfo.getSql(); } public boolean isHasResult() { return this.queryResult != null && this.queryResult.size() > 0; } public void setBeanName(String beanNameValue) { this.queryInfo.setBeanName(beanNameValue); } public void setCurrentPageNo(int currentPageNo) { this.queryInfo.setCurrentPageNo(currentPageNo); } public void setKey(String keyValue) { this.queryInfo.setKey(keyValue); } public void setPageCount(int pageCount) { this.queryInfo.setPageCount(pageCount); } public void setPageSize(int pageSize) { this.queryInfo.setPageSize(pageSize); } public void setParams(List<T> paramsValue) { this.queryInfo.setParams(paramsValue); } public void setProperties(String[] propertiesValue) { this.queryInfo.setProperties(propertiesValue); } public void setQueryResult(List<T> list) { this.queryResult = list; } public void setRecordCount(int count) { this.queryInfo.setRecordCount(count); } public void setSql(String sql) { this.queryInfo.setSql(sql); } }
allanfish/facetime
facetime-spring/src/main/java/com/facetime/spring/support/Page.java
Java
mit
3,885
--- layout: post title: Mancester 6/26 --- ### Screened today, imaged 6/22 growth exp. & screened larvae; cleaned broodstock, yada yada yada... #### Imaged 6/22 SN growth experiment larvae Grace imaged the well plate, taking photos of first the well #, then larvae, not capturing the same larvae more than once. She imaged a ruler whenever it was necessary to adjust the zoom. Images will named and uploaded to my [O.lurida repo images folder](https://github.com/laurahspencer/O.lurida_Stress/tree/master/Images) using the following well plate map: ![file_000 8](https://user-images.githubusercontent.com/17264765/27980511-534852be-6334-11e7-9249-69d9f0de8dba.jpeg) #### Screening data ![snip20170707_48](https://user-images.githubusercontent.com/17264765/27980434-79d1d1ea-6333-11e7-8c35-bf04684e528d.png) ![snip20170707_46](https://user-images.githubusercontent.com/17264765/27980433-79d01ac6-6333-11e7-8c2c-1a7b3af70e77.png) TB Continued.... need to reference notebook entry left @ home
laurahspencer/LabNotebook
_posts/2017-06-26-Manchester6-26.md
Markdown
mit
994
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL'; -- ---------------------------------------------------------------------------------------------------------- -- TABLES -- ---------------------------------------------------------------------------------------------------------- -- ----------------------------------------------------- -- Table `gene` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `gene` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `hgnc_id` int(10) unsigned NOT NULL, `symbol` varchar(40) NOT NULL, `name` TEXT NOT NULL, `type` enum('protein-coding gene','pseudogene','non-coding RNA','other') NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `hgnc_id` (`hgnc_id`), UNIQUE KEY `symbol` (`symbol`), KEY `type` (`type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Genes from HGNC'; -- ----------------------------------------------------- -- Table `gene_alias` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `gene_alias` ( `gene_id` int(10) unsigned NOT NULL, `symbol` varchar(40) NOT NULL, `type` enum('synonym','previous') NOT NULL, KEY `fk_gene_id1` (`gene_id` ASC) , CONSTRAINT `fk_gene_id1` FOREIGN KEY (`gene_id` ) REFERENCES `gene` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, KEY `symbol` (`symbol`), KEY `type` (`type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Alternative symbols of genes'; -- ----------------------------------------------------- -- Table `gene_transcript` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `gene_transcript` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `gene_id` int(10) unsigned NOT NULL, `name` varchar(40) NOT NULL, `source` enum('ccds', 'ensembl') NOT NULL, `chromosome` enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','X','Y','MT') NOT NULL, `start_coding` int(10) unsigned NULL, `end_coding` int(10) unsigned NULL, `strand` enum('+', '-') NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `fk_gene_id3` FOREIGN KEY (`gene_id` ) REFERENCES `gene` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, UNIQUE KEY `gene_name_unique` (`gene_id`, `name`), UNIQUE KEY `name` (`name`) , KEY `source` (`source`), KEY `chromosome` (`chromosome`), KEY `start_coding` (`start_coding`), KEY `end_coding` (`end_coding`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Gene transcipts'; -- ----------------------------------------------------- -- Table `gene_exon` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `gene_exon` ( `transcript_id` int(10) unsigned NOT NULL, `start` int(10) unsigned NOT NULL, `end` int(10) unsigned NOT NULL, KEY `fk_transcript_id2` (`transcript_id` ASC) , CONSTRAINT `fk_transcript_id2` FOREIGN KEY (`transcript_id` ) REFERENCES `gene_transcript` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, KEY `start` (`start`), KEY `end` (`end`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Transcript exons'; -- ----------------------------------------------------- -- Table `geneinfo_germline` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `geneinfo_germline` ( `symbol` VARCHAR(40) NOT NULL, `inheritance` ENUM('AR','AD','AR+AD','XLR','XLD','XLR+XLD','MT','MU','n/a') NOT NULL, `gnomad_oe_syn` FLOAT NULL, `gnomad_oe_mis` FLOAT NULL, `gnomad_oe_lof` FLOAT NULL, `comments` text NOT NULL, PRIMARY KEY `symbol` (`symbol`) ) ENGINE=InnoDB CHARSET=utf8; -- ----------------------------------------------------- -- Table `mid` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mid` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `sequence` VARCHAR(45) NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `name_UNIQUE` (`name` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `genome` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `genome` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `build` VARCHAR(45) NOT NULL, `comment` TEXT NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `build_UNIQUE` (`build` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `processing_system` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `processing_system` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name_short` VARCHAR(50) NOT NULL, `name_manufacturer` VARCHAR(100) NOT NULL, `adapter1_p5` VARCHAR(45) NULL DEFAULT NULL, `adapter2_p7` VARCHAR(45) NULL DEFAULT NULL, `type` ENUM('WGS','WGS (shallow)','WES','Panel','Panel Haloplex','Panel MIPs','RNA','ChIP-Seq', 'cfDNA (patient-specific)', 'cfDNA') NOT NULL, `shotgun` TINYINT(1) NOT NULL, `umi_type` ENUM('n/a','HaloPlex HS','SureSelect HS','ThruPLEX','Safe-SeqS','MIPs','QIAseq','IDT-UDI-UMI','IDT-xGen-Prism') NOT NULL DEFAULT 'n/a', `target_file` VARCHAR(255) NULL DEFAULT NULL COMMENT 'filename of sub-panel BED file relative to the megSAP enrichment folder.', `genome_id` INT(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `name_short` (`name_short` ASC), UNIQUE INDEX `name_manufacturer` (`name_manufacturer` ASC), INDEX `fk_processing_system_genome1` (`genome_id` ASC), CONSTRAINT `fk_processing_system_genome1` FOREIGN KEY (`genome_id`) REFERENCES `genome` (`id`) ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `device` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `device` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `type` ENUM('GAIIx','MiSeq','HiSeq2500','NextSeq500','NovaSeq5000','NovaSeq6000','MGI-2000','SequelII','PromethION') NOT NULL, `name` VARCHAR(45) NOT NULL, `comment` TEXT NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `name_UNIQUE` (`name` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `sequencing_run` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sequencing_run` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NOT NULL, `fcid` VARCHAR(45) NULL DEFAULT NULL, `flowcell_type` ENUM('Illumina MiSeq v2','Illumina MiSeq v2 Micro','Illumina MiSeq v2 Nano','Illumina MiSeq v3','Illumina NextSeq High Output','Illumina NextSeq Mid Output','Illumina NovaSeq SP','Illumina NovaSeq S1','Illumina NovaSeq S2','Illumina NovaSeq S4','PromethION FLO-PRO002','SMRTCell 8M','n/a') NOT NULL DEFAULT 'n/a', `start_date` DATE NULL DEFAULT NULL, `end_date` DATE NULL DEFAULT NULL, `device_id` INT(11) NOT NULL, `recipe` VARCHAR(45) NOT NULL COMMENT 'Read length for reads and index reads separated by \'+\'', `pool_molarity` float DEFAULT NULL, `pool_quantification_method` enum('n/a','Tapestation','Bioanalyzer','qPCR','Tapestation & Qubit','Bioanalyzer & Qubit','Bioanalyzer & Tecan Infinite','Fragment Analyzer & Qubit','Fragment Analyzer & Tecan Infinite','Illumina 450bp & Qubit ssDNA','PCR Size & ssDNA') NOT NULL DEFAULT 'n/a', `comment` TEXT NULL DEFAULT NULL, `quality` ENUM('n/a','good','medium','bad') NOT NULL DEFAULT 'n/a', `status` ENUM('n/a','run_started','run_finished','run_aborted','demultiplexing_started','analysis_started','analysis_finished','analysis_not_possible','analysis_and_backup_not_required') NOT NULL DEFAULT 'n/a', `backup_done` TINYINT(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE INDEX `name_UNIQUE` (`name` ASC), UNIQUE INDEX `fcid_UNIQUE` (`fcid` ASC), INDEX `fk_run_device1` (`device_id` ASC), CONSTRAINT `fk_run_device1` FOREIGN KEY (`device_id`) REFERENCES `device` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `runqc_read` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `runqc_read` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `read_num` INT NOT NULL, `cycles` INT NOT NULL, `is_index` BOOLEAN NOT NULL, `q30_perc` FLOAT NOT NULL, `error_rate` FLOAT DEFAULT NULL, `sequencing_run_id` INT(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE (`sequencing_run_id`, `read_num`), INDEX `fk_sequencing_run_id` (`sequencing_run_id` ASC), CONSTRAINT `fk_sequencing_run_id` FOREIGN KEY (`sequencing_run_id`) REFERENCES `sequencing_run` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `runqc_lane` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `runqc_lane` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `lane_num` INT NOT NULL, `cluster_density` FLOAT NOT NULL, `cluster_density_pf` FLOAT NOT NULL, `yield` FLOAT NOT NULL, `error_rate` FLOAT DEFAULT NULL, `q30_perc` FLOAT NOT NULL, `occupied_perc` FLOAT DEFAULT NULL, `runqc_read_id` INT(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE (`runqc_read_id`, `lane_num`), INDEX `fk_runqc_read_id` (`runqc_read_id` ASC), CONSTRAINT `fk_runqc_read_id` FOREIGN KEY (`runqc_read_id`) REFERENCES `runqc_read` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `species` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `species` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `name_UNIQUE` (`name` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `sender` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sender` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NOT NULL, `phone` VARCHAR(45) NULL DEFAULT NULL, `email` VARCHAR(45) NULL DEFAULT NULL, `affiliation` VARCHAR(100) NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `name_UNIQUE` (`name` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `user` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `user` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `user_id` VARCHAR(45) NOT NULL COMMENT 'Use the lower-case Windows domain name!', `password` VARCHAR(64) NOT NULL, `user_role` ENUM('user','admin','special') NOT NULL, `name` VARCHAR(45) NOT NULL, `email` VARCHAR(100) NOT NULL, `created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `last_login` DATETIME NULL DEFAULT NULL, `active` TINYINT(1) DEFAULT 1 NOT NULL, `salt` VARCHAR(40) NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `name_UNIQUE` (`user_id` ASC), UNIQUE INDEX `email_UNIQUE` (`email` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `sample` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sample` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(20) NOT NULL, `name_external` VARCHAR(255) NULL DEFAULT NULL COMMENT 'External names.<br>If several, separate by comma!<br>Always enter full names, no short forms!', `received` DATE NULL DEFAULT NULL, `receiver_id` INT(11) NULL DEFAULT NULL, `sample_type` ENUM('DNA','DNA (amplicon)','DNA (native)','RNA','cfDNA') NOT NULL, `species_id` INT(11) NOT NULL, `concentration` FLOAT NULL DEFAULT NULL, `volume` FLOAT NULL DEFAULT NULL, `od_260_280` FLOAT NULL DEFAULT NULL, `gender` ENUM('male','female','n/a') NOT NULL, `comment` TEXT NULL DEFAULT NULL, `quality` ENUM('n/a','good','medium','bad') NOT NULL DEFAULT 'n/a', `od_260_230` FLOAT NULL DEFAULT NULL, `integrity_number` FLOAT NULL DEFAULT NULL, `tumor` TINYINT(1) NOT NULL, `ffpe` TINYINT(1) NOT NULL, `sender_id` INT(11) NOT NULL, `disease_group` ENUM('n/a','Neoplasms','Diseases of the blood or blood-forming organs','Diseases of the immune system','Endocrine, nutritional or metabolic diseases','Mental, behavioural or neurodevelopmental disorders','Sleep-wake disorders','Diseases of the nervous system','Diseases of the visual system','Diseases of the ear or mastoid process','Diseases of the circulatory system','Diseases of the respiratory system','Diseases of the digestive system','Diseases of the skin','Diseases of the musculoskeletal system or connective tissue','Diseases of the genitourinary system','Developmental anomalies','Other diseases') NOT NULL DEFAULT 'n/a', `disease_status` ENUM('n/a','Affected','Unaffected','Unclear') NOT NULL DEFAULT 'n/a', `tissue` ENUM('n/a','Blood','Buccal mucosa','Skin') NOT NULL DEFAULT 'n/a', PRIMARY KEY (`id`), UNIQUE INDEX `name_UNIQUE` (`name` ASC), INDEX `fk_samples_species1` (`species_id` ASC), INDEX `sender_id` (`sender_id` ASC), INDEX `receiver_id` (`receiver_id` ASC), INDEX `name_external` (`name_external` ASC), INDEX `tumor` (`tumor` ASC), INDEX `quality` (`quality` ASC), INDEX `disease_group` (`disease_group`), INDEX `disease_status` (`disease_status`), CONSTRAINT `fk_samples_species1` FOREIGN KEY (`species_id`) REFERENCES `species` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `sample_ibfk_1` FOREIGN KEY (`sender_id`) REFERENCES `sender` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `sample_ibfk_2` FOREIGN KEY (`receiver_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `sample_disease_info` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sample_disease_info` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `sample_id` INT(11) NOT NULL, `disease_info` TEXT NOT NULL, `type` ENUM('HPO term id', 'ICD10 code', 'OMIM disease/phenotype identifier', 'Orpha number', 'CGI cancer type', 'tumor fraction', 'age of onset', 'clinical phenotype (free text)', 'RNA reference tissue') NOT NULL, `user_id` int(11) DEFAULT NULL, `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), CONSTRAINT `fk_sample_id` FOREIGN KEY (`sample_id`) REFERENCES `sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `sample_relations` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sample_relations` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `sample1_id` INT(11) NOT NULL, `relation` ENUM('parent-child', 'tumor-normal', 'siblings', 'same sample', 'tumor-cfDNA', 'same patient', 'cousins', 'twins', 'twins (monozygotic)') NOT NULL, `sample2_id` INT(11) NOT NULL, `user_id` int(11) DEFAULT NULL, `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE INDEX `relation_unique` (`sample1_id` ASC, `relation` ASC, `sample2_id` ASC), CONSTRAINT `fk_sample1_id` FOREIGN KEY (`sample1_id`) REFERENCES `sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_sample2_id` FOREIGN KEY (`sample2_id`) REFERENCES `sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_user2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `project` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `project` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NOT NULL, `aliases` TEXT DEFAULT NULL, `type` ENUM('diagnostic','research','test','external') NOT NULL, `internal_coordinator_id` INT(11) NOT NULL COMMENT 'Person who is responsible for this project.<br>The person will be notified when new samples are available.', `comment` TEXT NULL DEFAULT NULL, `analysis` ENUM('fastq','mapping','variants') NOT NULL DEFAULT 'variants' COMMENT 'Bioinformatics analysis to be done for non-tumor germline samples in this project.<br>"fastq" skips the complete analysis.<br>"mapping" creates the BAM file but calls no variants.<br>"variants" performs the full analysis.', `preserve_fastqs` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Prevents FASTQ files from being deleted after mapping in this project.<br>Has no effect if megSAP is not configured to delete FASTQs automatically.<br>For diagnostics, do not check. For other project types ask the bioinformatician in charge.', `email_notification` varchar(200) DEFAULT NULL COMMENT 'List of email addresses (separated by semicolon) that are notified in addition to the project coordinator when new samples are available.', PRIMARY KEY (`id`), UNIQUE INDEX `name_UNIQUE` (`name` ASC), INDEX `internal_coordinator_id` (`internal_coordinator_id` ASC), CONSTRAINT `project_ibfk_1` FOREIGN KEY (`internal_coordinator_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `processed_sample` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `processed_sample` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `sample_id` INT(11) NOT NULL, `process_id` INT(2) NOT NULL, `sequencing_run_id` INT(11) NULL DEFAULT NULL, `lane` varchar(15) NOT NULL COMMENT 'Comma-separated lane list (1-8)', `mid1_i7` INT(11) NULL DEFAULT NULL, `mid2_i5` INT(11) NULL DEFAULT NULL, `operator_id` INT(11) NULL DEFAULT NULL, `processing_system_id` INT(11) NOT NULL, `comment` TEXT NULL DEFAULT NULL, `project_id` INT(11) NOT NULL, `processing_input` FLOAT NULL DEFAULT NULL, `molarity` FLOAT NULL DEFAULT NULL, `normal_id` INT(11) NULL DEFAULT NULL COMMENT 'For tumor samples, a normal sample can be given here which is used as reference sample during the data analysis.', `quality` ENUM('n/a','good','medium','bad') NOT NULL DEFAULT 'n/a', PRIMARY KEY (`id`), UNIQUE INDEX `sample_psid_unique` (`sample_id` ASC, `process_id` ASC), INDEX `fk_processed_sample_samples1` (`sample_id` ASC), INDEX `fk_processed_sample_mid1` (`mid1_i7` ASC), INDEX `fk_processed_sample_processing_system1` (`processing_system_id` ASC), INDEX `fk_processed_sample_run1` (`sequencing_run_id` ASC), INDEX `fk_processed_sample_mid2` (`mid2_i5` ASC), INDEX `project_id` (`project_id` ASC), INDEX `operator_id` (`operator_id` ASC), INDEX `normal_id_INDEX` (`normal_id` ASC), INDEX `quality` (`quality` ASC), CONSTRAINT `fk_processed_sample_mid1` FOREIGN KEY (`mid1_i7`) REFERENCES `mid` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_processed_sample_mid2` FOREIGN KEY (`mid2_i5`) REFERENCES `mid` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_processed_sample_processing_system1` FOREIGN KEY (`processing_system_id`) REFERENCES `processing_system` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_processed_sample_run1` FOREIGN KEY (`sequencing_run_id`) REFERENCES `sequencing_run` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_processed_sample_sample2` FOREIGN KEY (`normal_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_processed_sample_samples1` FOREIGN KEY (`sample_id`) REFERENCES `sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `processed_sample_ibfk_1` FOREIGN KEY (`project_id`) REFERENCES `project` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `processed_sample_ibfk_2` FOREIGN KEY (`operator_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `variant` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `variant` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `chr` ENUM('chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrY','chrX','chrMT') NOT NULL, `start` INT(11) NOT NULL, `end` INT(11) NOT NULL, `ref` TEXT NOT NULL, `obs` TEXT NOT NULL, `1000g` FLOAT NULL DEFAULT NULL, `gnomad` FLOAT NULL DEFAULT NULL, `coding` TEXT NULL DEFAULT NULL, `comment` TEXT NULL DEFAULT NULL, `cadd` FLOAT NULL DEFAULT NULL, `spliceai` FLOAT NULL DEFAULT NULL, `germline_het` INT(11) NOT NULL DEFAULT '0', `germline_hom` INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE INDEX `variant_UNIQUE` (`chr` ASC, `start` ASC, `end` ASC, `ref`(255) ASC, `obs`(255) ASC), INDEX `1000g` (`1000g` ASC), INDEX `gnomad` (`gnomad` ASC), INDEX `comment` (`comment`(50) ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `variant_publication` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `variant_publication` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `sample_id` INT(11) NOT NULL, `variant_id` INT(11) NOT NULL, `db` ENUM('LOVD','ClinVar') NOT NULL, `class` ENUM('1','2','3','4','5', 'M') NOT NULL, `details` TEXT NOT NULL, `user_id` INT(11) NOT NULL, `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `result` TEXT DEFAULT NULL, `replaced` BOOLEAN NOT NULL DEFAULT FALSE, PRIMARY KEY (`id`), CONSTRAINT `fk_variant_publication_has_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_variant_publication_has_sample` FOREIGN KEY (`sample_id`) REFERENCES `sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_variant_publication_has_variant` FOREIGN KEY (`variant_id`) REFERENCES `variant` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `variant_classification` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `variant_classification` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `variant_id` INT(11) NOT NULL, `class` ENUM('n/a','1','2','3','4','5','M') NOT NULL, `comment` TEXT NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `fk_variant_classification_has_variant` (`variant_id`), CONSTRAINT `fk_variant_classification_has_variant` FOREIGN KEY (`variant_id`) REFERENCES `variant` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, INDEX `class` (`class` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `somatic_variant_classification` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `somatic_variant_classification` ( `id` int(11) NOT NULL AUTO_INCREMENT, `variant_id` int(11) NOT NULL, `class` ENUM('n/a','activating','likely_activating','inactivating','likely_inactivating','unclear','test_dependent') NOT NULL, `comment` TEXT, PRIMARY KEY (`id`), UNIQUE KEY `somatic_variant_classification_has_variant` (`variant_id`), CONSTRAINT `somatic_variant_classification_has_variant` FOREIGN KEY (`variant_id`) REFERENCES `variant` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `somatic_vicc_interpretation` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `somatic_vicc_interpretation` ( `id` int(11) NOT NULL AUTO_INCREMENT, `variant_id` int(11) NOT NULL, `null_mutation_in_tsg` BOOLEAN NULL DEFAULT NULL, `known_oncogenic_aa` BOOLEAN NULL DEFAULT NULL, `oncogenic_funtional_studies` BOOLEAN NULL DEFAULT NULL, `strong_cancerhotspot` BOOLEAN NULL DEFAULT NULL, `located_in_canerhotspot` BOOLEAN NULL DEFAULT NULL, `absent_from_controls` BOOLEAN NULL DEFAULT NULL, `protein_length_change` BOOLEAN NULL DEFAULT NULL, `other_aa_known_oncogenic` BOOLEAN NULL DEFAULT NULL, `weak_cancerhotspot` BOOLEAN NULL DEFAULT NULL, `computational_evidence` BOOLEAN NULL DEFAULT NULL, `mutation_in_gene_with_etiology` BOOLEAN NULL DEFAULT NULL, `very_weak_cancerhotspot` BOOLEAN NULL DEFAULT NULL, `very_high_maf` BOOLEAN NULL DEFAULT NULL, `benign_functional_studies` BOOLEAN NULL DEFAULT NULL, `high_maf` BOOLEAN NULL DEFAULT NULL, `benign_computational_evidence` BOOLEAN NULL DEFAULT NULL, `synonymous_mutation` BOOLEAN NULL DEFAULT NULL, `comment` TEXT NULL DEFAULT NULL, `created_by` int(11) DEFAULT NULL, `created_date` DATETIME NOT NULL, `last_edit_by` int(11) DEFAULT NULL, `last_edit_date` TIMESTAMP NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `somatic_vicc_interpretation_has_variant` (`variant_id`), CONSTRAINT `somatic_vicc_interpretation_has_variant` FOREIGN KEY (`variant_id`) REFERENCES `variant` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `somatic_vicc_interpretation_created_by_user` FOREIGN KEY (`created_by`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `somatic_vicc_interpretation_last_edit_by_user` FOREIGN KEY (`last_edit_by`) REFERENCES `user` (`id`) ON DELETE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `somatic_gene_role` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `somatic_gene_role` ( `id` int(11) NOT NULL AUTO_INCREMENT, `symbol` VARCHAR(40) NOT NULL, `gene_role` ENUM('activating','loss_of_function', 'ambiguous') NOT NULL, `high_evidence` BOOLEAN DEFAULT FALSE, `comment` TEXT NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY (`symbol`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `detected_variant` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `detected_variant` ( `processed_sample_id` INT(11) NOT NULL, `variant_id` INT(11) NOT NULL, `genotype` ENUM('hom','het') NOT NULL, PRIMARY KEY (`processed_sample_id`, `variant_id`), INDEX `fk_detected_variant_variant1` (`variant_id` ASC), CONSTRAINT `fk_processed_sample_has_variant_processed_sample1` FOREIGN KEY (`processed_sample_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_processed_sample_has_variant_variant1` FOREIGN KEY (`variant_id`) REFERENCES `variant` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `qc_terms` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `qc_terms` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `qcml_id` VARCHAR(10) NULL DEFAULT NULL, `name` VARCHAR(45) NOT NULL, `description` TEXT NOT NULL, `type` ENUM('float', 'int', 'string') NOT NULL, `obsolete` TINYINT(1) NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `name_UNIQUE` (`name` ASC), UNIQUE INDEX `qcml_id_UNIQUE` (`qcml_id` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `processed_sample_qc` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `processed_sample_qc` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `processed_sample_id` INT(11) NOT NULL, `qc_terms_id` INT(11) NOT NULL, `value` TEXT NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `c_processing_id_qc_terms_id` (`processed_sample_id` ASC, `qc_terms_id` ASC), INDEX `fk_qcvalues_processing1` (`processed_sample_id` ASC), INDEX `fk_processed_sample_annotaiton_qcml1` (`qc_terms_id` ASC), CONSTRAINT `fk_processed_sample_annotaiton_qcml1` FOREIGN KEY (`qc_terms_id`) REFERENCES `qc_terms` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_qcvalues_processing1` FOREIGN KEY (`processed_sample_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `sample_group` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sample_group` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NOT NULL, `comment` TEXT NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `name_UNIQUE` (`name` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `nm_sample_sample_group` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `nm_sample_sample_group` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `sample_group_id` INT(11) NOT NULL, `sample_id` INT(11) NOT NULL, PRIMARY KEY (`id`), INDEX `fk_sample_group_has_sample_sample1` (`sample_id` ASC), INDEX `fk_sample_group_has_sample_sample_group1` (`sample_group_id` ASC), CONSTRAINT `fk_sample_group_has_sample_sample1` FOREIGN KEY (`sample_id`) REFERENCES `sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_sample_group_has_sample_sample_group1` FOREIGN KEY (`sample_group_id`) REFERENCES `sample_group` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `detected_somatic_variant` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `detected_somatic_variant` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `processed_sample_id_tumor` INT(11) NOT NULL, `processed_sample_id_normal` INT(11) NULL DEFAULT NULL, `variant_id` INT(11) NOT NULL, `variant_frequency` FLOAT NOT NULL, `depth` INT(11) NOT NULL, `quality_snp` FLOAT NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `detected_somatic_variant_UNIQUE` (`processed_sample_id_tumor` ASC, `processed_sample_id_normal` ASC, `variant_id` ASC), INDEX `variant_id_INDEX` (`variant_id` ASC), INDEX `processed_sample_id_tumor_INDEX` (`processed_sample_id_tumor` ASC), INDEX `processed_sample_id_normal_INDEX` (`processed_sample_id_normal` ASC), INDEX `fk_dsv_has_ps1` (`processed_sample_id_tumor` ASC), INDEX `fk_dsv_has_ps2` (`processed_sample_id_normal` ASC), CONSTRAINT `fk_dsv_has_ps1` FOREIGN KEY (`processed_sample_id_tumor`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_dsv_has_ps2` FOREIGN KEY (`processed_sample_id_normal`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_dsv_has_v` FOREIGN KEY (`variant_id`) REFERENCES `variant` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `diag_status` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `diag_status` ( `processed_sample_id` INT(11) NOT NULL, `status` ENUM('pending','in progress','done','done - follow up pending','cancelled','not usable because of data quality') NOT NULL, `user_id` INT(11) NOT NULL, `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `outcome` ENUM('n/a','no significant findings','uncertain','significant findings','significant findings - second method', 'significant findings - non-genetic', 'candidate gene') NOT NULL DEFAULT 'n/a', `comment` TEXT NULL DEFAULT NULL, PRIMARY KEY (`processed_sample_id`), INDEX `user_id` (`user_id` ASC), CONSTRAINT `diag_status_ibfk_1` FOREIGN KEY (`processed_sample_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `diag_status_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `kasp_status` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `kasp_status` ( `processed_sample_id` INT(11) NOT NULL, `random_error_prob` FLOAT UNSIGNED NOT NULL, `snps_evaluated` INT(10) UNSIGNED NOT NULL, `snps_match` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`processed_sample_id`), CONSTRAINT `processed_sample0` FOREIGN KEY (`processed_sample_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `hpo_term` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `hpo_term` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `hpo_id` VARCHAR(10) NOT NULL, `name` TEXT NOT NULL, `definition` TEXT NOT NULL, `synonyms` TEXT NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `hpo_id` (`hpo_id` ASC), INDEX `name` (`name`(100) ASC), INDEX `synonyms` (`synonyms`(100) ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `hpo_genes` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `hpo_genes` ( `hpo_term_id` INT(10) UNSIGNED NOT NULL, `gene` VARCHAR(40) CHARACTER SET 'utf8' NOT NULL, `details` TEXT COMMENT 'Semicolon seperated pairs of database sources with evidences of where the connection was found (Source, Original Evidence, Evidence translated; Source2, ....)', `evidence` ENUM('n/a','low','medium','high') NOT NULL DEFAULT 'n/a', PRIMARY KEY (`hpo_term_id`, `gene`), CONSTRAINT `hpo_genes_ibfk_1` FOREIGN KEY (`hpo_term_id`) REFERENCES `hpo_term` (`id`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `hpo_parent` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `hpo_parent` ( `parent` INT(10) UNSIGNED NOT NULL, `child` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`parent`, `child`), INDEX `child` (`child` ASC), CONSTRAINT `hpo_parent_ibfk_2` FOREIGN KEY (`child`) REFERENCES `hpo_term` (`id`), CONSTRAINT `hpo_parent_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `hpo_term` (`id`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `analysis_job` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `analysis_job` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `type` enum('single sample','multi sample','trio','somatic') NOT NULL, `high_priority` TINYINT(1) NOT NULL, `args` text NOT NULL, `sge_id` varchar(10) DEFAULT NULL, `sge_queue` varchar(50) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- -- Table `analysis_job_sample` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `analysis_job_sample` ( `id` int(11) NOT NULL AUTO_INCREMENT, `analysis_job_id` int(11) NOT NULL, `processed_sample_id` int(11) NOT NULL, `info` text NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `fk_analysis_job_id` FOREIGN KEY (`analysis_job_id` ) REFERENCES `analysis_job` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_processed_sample_id` FOREIGN KEY (`processed_sample_id` ) REFERENCES `processed_sample` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- -- Table `analysis_job_history` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `analysis_job_history` ( `id` int(11) NOT NULL AUTO_INCREMENT, `analysis_job_id` int(11) NOT NULL, `time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `user_id` int(11) DEFAULT NULL, `status` enum('queued','started','finished','cancel','canceled','error') NOT NULL, `output` text DEFAULT NULL, PRIMARY KEY (`id`), CONSTRAINT `fk_analysis_job_id2` FOREIGN KEY (`analysis_job_id` ) REFERENCES `analysis_job` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_user_id2` FOREIGN KEY (`user_id` ) REFERENCES `user` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- -- Table `omim_gene` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `omim_gene` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `gene` VARCHAR(40) CHARACTER SET 'utf8' NOT NULL, `mim` VARCHAR(10) CHARACTER SET 'utf8' NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `mim_unique` (`mim`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `omim_phenotype` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `omim_phenotype` ( `omim_gene_id` INT(11) UNSIGNED NOT NULL, `phenotype` VARCHAR(255) CHARACTER SET 'utf8' NOT NULL, PRIMARY KEY (`omim_gene_id`, `phenotype`), CONSTRAINT `omim_gene_id_FK` FOREIGN KEY (`omim_gene_id` ) REFERENCES `omim_gene` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `omim_preferred_phenotype` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `omim_preferred_phenotype` ( `gene` VARCHAR(40) CHARACTER SET 'utf8' NOT NULL, `disease_group` ENUM('Neoplasms','Diseases of the blood or blood-forming organs','Diseases of the immune system','Endocrine, nutritional or metabolic diseases','Mental, behavioural or neurodevelopmental disorders','Sleep-wake disorders','Diseases of the nervous system','Diseases of the visual system','Diseases of the ear or mastoid process','Diseases of the circulatory system','Diseases of the respiratory system','Diseases of the digestive system','Diseases of the skin','Diseases of the musculoskeletal system or connective tissue','Diseases of the genitourinary system','Developmental anomalies','Other diseases') NOT NULL, `phenotype_accession` VARCHAR(6) CHARACTER SET 'utf8' NOT NULL, PRIMARY KEY (`gene`,`disease_group`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `merged_processed_samples` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `merged_processed_samples` ( `processed_sample_id` INT(11) NOT NULL, `merged_into` INT(11) NOT NULL, PRIMARY KEY (`processed_sample_id`), CONSTRAINT `merged_processed_samples_ps_id` FOREIGN KEY (`processed_sample_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `merged_processed_samples_merged_into` FOREIGN KEY (`merged_into`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `somatic_report_configuration` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `somatic_report_configuration` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ps_tumor_id` int(11) NOT NULL, `ps_normal_id` int(11) NOT NULL, `created_by` int(11) NOT NULL, `created_date` DATETIME NOT NULL, `last_edit_by` int(11) DEFAULT NULL, `last_edit_date` timestamp NULL DEFAULT NULL, `mtb_xml_upload_date` timestamp NULL DEFAULT NULL, `target_file` VARCHAR(255) NULL DEFAULT NULL COMMENT 'filename of sub-panel BED file without path', `tum_content_max_af` BOOLEAN NOT NULL DEFAULT FALSE COMMENT 'include tumor content calculated by median value maximum allele frequency', `tum_content_max_clonality` BOOLEAN NOT NULL DEFAULT FALSE COMMENT 'include tumor content calculated by maximum CNV clonality', `tum_content_hist` BOOLEAN NOT NULL DEFAULT FALSE COMMENT 'include histological tumor content estimate ', `msi_status` BOOLEAN NOT NULL DEFAULT FALSE COMMENT 'include microsatellite instability status', `cnv_burden` BOOLEAN NOT NULL DEFAULT FALSE, `hrd_score` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'homologous recombination deficiency score, determined manually by user', `hrd_statement` ENUM('no proof', 'proof', 'undeterminable') NULL DEFAULT NULL COMMENT 'comment to be shown in somatic report about HRD score', `cnv_loh_count` INT(11) NULL DEFAULT NULL COMMENT 'number of somatic LOH events, determined from CNV file', `cnv_tai_count` INT(11) NULL DEFAULT NULL COMMENT 'number of somatic telomer allelic imbalance events, determined from CNV file', `cnv_lst_count` INT(11) NULL DEFAULT NULL COMMENT 'number of somatic long state transitions events, determined from CNV file', `tmb_ref_text` VARCHAR(200) NULL DEFAULT NULL COMMENT 'reference data as free text for tumor mutation burden', `quality` ENUM('no abnormalities','tumor cell content too low', 'quality of tumor DNA too low', 'DNA quantity too low', 'heterogeneous sample') NULL DEFAULT NULL COMMENT 'user comment on the quality of the DNA', `fusions_detected` BOOLEAN NOT NULL DEFAULT FALSE COMMENT 'fusions or other SVs were detected. Cannot be determined automatically, because manta files contain too many false positives', `cin_chr` TEXT NULL DEFAULT NULL COMMENT 'comma separated list of instable chromosomes', `limitations` TEXT NULL DEFAULT NULL COMMENT 'manually created text if the analysis has special limitations', `filter` VARCHAR(255) NULL DEFAULT NULL COMMENT 'name of the variant filter', PRIMARY KEY (`id`), UNIQUE INDEX `combo_som_rep_conf_ids` (`ps_tumor_id` ASC, `ps_normal_id` ASC), CONSTRAINT `somatic_report_config_created_by_user` FOREIGN KEY (`created_by`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `somatic_report_config_last_edit_by_user` FOREIGN KEY (`last_edit_by`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `somatic_report_config_ps_normal_id` FOREIGN KEY (`ps_normal_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `somatic_report_config_ps_tumor_id` FOREIGN KEY (`ps_tumor_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARSET = utf8; -- ----------------------------------------------------- -- Table `somatic_report_configuration_variant` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `somatic_report_configuration_variant` ( `id` int(11) NOT NULL AUTO_INCREMENT, `somatic_report_configuration_id` int(11) NOT NULL, `variant_id` int(11) NOT NULL, `exclude_artefact` BOOLEAN NOT NULL, `exclude_low_tumor_content` BOOLEAN NOT NULL, `exclude_low_copy_number` BOOLEAN NOT NULL, `exclude_high_baf_deviation` BOOLEAN NOT NULL, `exclude_other_reason` BOOLEAN NOT NULL, `include_variant_alteration` text DEFAULT NULL, `include_variant_description` text DEFAULT NULL, `comment` text NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `som_rep_conf_var_has_som_rep_conf_id` FOREIGN KEY (`somatic_report_configuration_id`) REFERENCES `somatic_report_configuration` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `somatic_report_configuration_variant_has_variant_id` FOREIGN KEY (`variant_id`) REFERENCES `variant` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, UNIQUE INDEX `som_conf_var_combo_uniq_index` (`somatic_report_configuration_id` ASC, `variant_id` ASC) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- -- Table `somatic_report_configuration_germl_snv` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `somatic_report_configuration_germl_var` ( `id` int(11) NOT NULL AUTO_INCREMENT, `somatic_report_configuration_id` int(11) NOT NULL, `variant_id` int(11) NOT NULL, `tum_freq` FLOAT UNSIGNED NULL DEFAULT NULL COMMENT 'frequency of this variant in the tumor sample.', `tum_depth` int(11) UNSIGNED NULL DEFAULT NULL COMMENT 'depth of this variant in the tumor sample.', PRIMARY KEY (`id`), CONSTRAINT `som_rep_conf_germl_var_has_rep_conf_id` FOREIGN KEY (`somatic_report_configuration_id`) REFERENCES `somatic_report_configuration` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `som_rep_germl_var_has_var_id` FOREIGN KEY (`variant_id`) REFERENCES `variant` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, UNIQUE INDEX `som_conf_germl_var_combo_uni_idx` (`somatic_report_configuration_id` ASC, `variant_id` ASC) ) COMMENT='variants detected in control tissue that are marked as tumor related by the user' ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- -- Table `somatic_cnv_callset` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `somatic_cnv_callset` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `ps_tumor_id` INT(11) NOT NULL, `ps_normal_id` INT(11) NOT NULL, `caller` ENUM('ClinCNV') NOT NULL, `caller_version` varchar(25) NOT NULL, `call_date` DATETIME NOT NULL, `quality_metrics` TEXT DEFAULT NULL COMMENT 'quality metrics as JSON key-value array', `quality` ENUM('n/a','good','medium','bad') NOT NULL DEFAULT 'n/a', PRIMARY KEY (`id`), INDEX `caller` (`caller` ASC), INDEX `call_date` (`call_date` ASC), INDEX `quality` (`quality` ASC), UNIQUE INDEX `combo_ids` (`ps_tumor_id` ASC, `ps_normal_id` ASC), CONSTRAINT `som_cnv_callset_ps_normal_id` FOREIGN KEY (`ps_normal_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `som_cnv_callset_ps_tumor_id` FOREIGN KEY (`ps_tumor_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT='somatic CNV call set'; -- ----------------------------------------------------- -- Table `somatic_cnv` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `somatic_cnv` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `somatic_cnv_callset_id` INT(11) UNSIGNED NOT NULL, `chr` ENUM('chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrY','chrX','chrMT') NOT NULL, `start` INT(11) UNSIGNED NOT NULL, `end` INT(11) UNSIGNED NOT NULL, `cn` FLOAT UNSIGNED NOT NULL COMMENT 'copy-number change in whole sample, including normal parts', `tumor_cn` INT(11) UNSIGNED NOT NULL COMMENT 'copy-number change normalized to tumor tissue only', `tumor_clonality` FLOAT NOT NULL COMMENT 'tumor clonality, i.e. fraction of tumor cells', `quality_metrics` TEXT DEFAULT NULL COMMENT 'quality metrics as JSON key-value array', PRIMARY KEY (`id`), CONSTRAINT `som_cnv_references_cnv_callset` FOREIGN KEY (`somatic_cnv_callset_id`) REFERENCES `somatic_cnv_callset` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `unique_callset_cnv_pair` UNIQUE(`somatic_cnv_callset_id`,`chr`,`start`,`end`), INDEX `chr` (`chr` ASC), INDEX `start` (`start` ASC), INDEX `end` (`end` ASC), INDEX `tumor_cn` (`tumor_cn` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT='somatic CNV'; -- ----------------------------------------------------- -- Table `somatic_report_configuration_cnv` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `somatic_report_configuration_cnv` ( `id` int(11) NOT NULL AUTO_INCREMENT, `somatic_report_configuration_id` int(11) NOT NULL, `somatic_cnv_id` int(11) UNSIGNED NOT NULL, `exclude_artefact` BOOLEAN NOT NULL, `exclude_low_tumor_content` BOOLEAN NOT NULL, `exclude_low_copy_number` BOOLEAN NOT NULL, `exclude_high_baf_deviation` BOOLEAN NOT NULL, `exclude_other_reason` BOOLEAN NOT NULL, `comment` text NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `som_rep_conf_cnv_has_som_rep_conf_id` FOREIGN KEY (`somatic_report_configuration_id`) REFERENCES `somatic_report_configuration` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `som_report_conf_cnv_has_som_cnv_id` FOREIGN KEY (`somatic_cnv_id`) REFERENCES `somatic_cnv` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, UNIQUE INDEX `som_conf_cnv_combo_uniq_index` (`somatic_report_configuration_id` ASC, `somatic_cnv_id` ASC) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- ----------------------------------------------------- -- Table `report_configuration` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `report_configuration` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `processed_sample_id` INT(11) NOT NULL, `created_by` int(11) NOT NULL, `created_date` DATETIME NOT NULL, `last_edit_by` int(11) DEFAULT NULL, `last_edit_date` TIMESTAMP NULL DEFAULT NULL, `finalized_by` int(11) DEFAULT NULL, `finalized_date` TIMESTAMP NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `processed_sample_id_unique` (`processed_sample_id`), CONSTRAINT `fk_processed_sample_id2` FOREIGN KEY (`processed_sample_id` ) REFERENCES `processed_sample` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `report_configuration_created_by` FOREIGN KEY (`created_by`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `report_configuration_last_edit_by` FOREIGN KEY (`last_edit_by`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `report_configuration_finalized_by` FOREIGN KEY (`finalized_by`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `report_configuration_variant` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `report_configuration_variant` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `report_configuration_id` INT(11) NOT NULL, `variant_id` INT(11) NOT NULL, `type` ENUM('diagnostic variant', 'candidate variant', 'incidental finding') NOT NULL, `causal` BOOLEAN NOT NULL, `inheritance` ENUM('n/a', 'AR','AD','XLR','XLD','MT') NOT NULL, `de_novo` BOOLEAN NOT NULL, `mosaic` BOOLEAN NOT NULL, `compound_heterozygous` BOOLEAN NOT NULL, `exclude_artefact` BOOLEAN NOT NULL, `exclude_frequency` BOOLEAN NOT NULL, `exclude_phenotype` BOOLEAN NOT NULL, `exclude_mechanism` BOOLEAN NOT NULL, `exclude_other` BOOLEAN NOT NULL, `comments` text NOT NULL, `comments2` text NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `fk_report_configuration` FOREIGN KEY (`report_configuration_id` ) REFERENCES `report_configuration` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_report_configuration_variant_has_variant` FOREIGN KEY (`variant_id`) REFERENCES `variant` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, UNIQUE INDEX `config_variant_combo_uniq` (`report_configuration_id` ASC, `variant_id` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `disease_term` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `disease_term` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `source` ENUM('OrphaNet') NOT NULL, `identifier` VARCHAR(40) CHARACTER SET 'utf8' NOT NULL, `name` TEXT CHARACTER SET 'utf8' NOT NULL, `synonyms` TEXT CHARACTER SET 'utf8' DEFAULT NULL, PRIMARY KEY (`id`), INDEX `disease_source` (`source` ASC), UNIQUE KEY `disease_id` (`identifier`), INDEX `disease_name` (`name`(50) ASC), INDEX `disease_synonyms` (`synonyms`(50) ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `disease_gene` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `disease_gene` ( `disease_term_id` INT(11) UNSIGNED NOT NULL, `gene` VARCHAR(40) CHARACTER SET 'utf8' NOT NULL, PRIMARY KEY (`disease_term_id`, `gene`), CONSTRAINT `disease_genes_ibfk_1` FOREIGN KEY (`disease_term_id`) REFERENCES `disease_term` (`id`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `cnv_callset` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `cnv_callset` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `processed_sample_id` INT(11) NOT NULL, `caller` ENUM('CnvHunter', 'ClinCNV') NOT NULL, `caller_version` varchar(25) NOT NULL, `call_date` DATETIME DEFAULT NULL, `quality_metrics` TEXT DEFAULT NULL COMMENT 'quality metrics as JSON key-value array', `quality` ENUM('n/a','good','medium','bad') NOT NULL DEFAULT 'n/a', PRIMARY KEY (`id`), INDEX `caller` (`quality` ASC), INDEX `call_date` (`call_date` ASC), INDEX `quality` (`quality` ASC), UNIQUE KEY `cnv_callset_references_processed_sample` (`processed_sample_id`), CONSTRAINT `cnv_callset_references_processed_sample` FOREIGN KEY (`processed_sample_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT='germline CNV call set'; -- ----------------------------------------------------- -- Table `cnv` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `cnv` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `cnv_callset_id` INT(11) UNSIGNED NOT NULL, `chr` ENUM('chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrY','chrX','chrMT') NOT NULL, `start` INT(11) UNSIGNED NOT NULL, `end` INT(11) UNSIGNED NOT NULL, `cn` INT(11) UNSIGNED NOT NULL COMMENT 'copy-number', `quality_metrics` TEXT DEFAULT NULL COMMENT 'quality metrics as JSON key-value array', PRIMARY KEY (`id`), CONSTRAINT `cnv_references_cnv_callset` FOREIGN KEY (`cnv_callset_id`) REFERENCES `cnv_callset` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, INDEX `chr` (`chr` ASC), INDEX `start` (`start` ASC), INDEX `end` (`end` ASC), INDEX `cn` (`cn` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT='germline CNV'; -- ----------------------------------------------------- -- Table `report_configuration_cnv` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `report_configuration_cnv` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `report_configuration_id` INT(11) NOT NULL, `cnv_id` INT(11) UNSIGNED NOT NULL, `type` ENUM('diagnostic variant', 'candidate variant', 'incidental finding') NOT NULL, `causal` BOOLEAN NOT NULL, `class` ENUM('n/a','1','2','3','4','5','M') NOT NULL, `inheritance` ENUM('n/a', 'AR','AD','XLR','XLD','MT') NOT NULL, `de_novo` BOOLEAN NOT NULL, `mosaic` BOOLEAN NOT NULL, `compound_heterozygous` BOOLEAN NOT NULL, `exclude_artefact` BOOLEAN NOT NULL, `exclude_frequency` BOOLEAN NOT NULL, `exclude_phenotype` BOOLEAN NOT NULL, `exclude_mechanism` BOOLEAN NOT NULL, `exclude_other` BOOLEAN NOT NULL, `comments` text NOT NULL, `comments2` text NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `fk_report_configuration2` FOREIGN KEY (`report_configuration_id` ) REFERENCES `report_configuration` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_report_configuration_cnv_has_cnv` FOREIGN KEY (`cnv_id`) REFERENCES `cnv` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, UNIQUE INDEX `config_variant_combo_uniq` (`report_configuration_id` ASC, `cnv_id` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `sv_callset` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sv_callset` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `processed_sample_id` INT(11) NOT NULL, `caller` ENUM('Manta') NOT NULL, `caller_version` varchar(25) NOT NULL, `call_date` DATETIME DEFAULT NULL, PRIMARY KEY (`id`), INDEX `call_date` (`call_date` ASC), UNIQUE KEY `sv_callset_references_processed_sample` (`processed_sample_id`), CONSTRAINT `sv_callset_references_processed_sample` FOREIGN KEY (`processed_sample_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT='SV call set'; -- ----------------------------------------------------- -- Table `sv_deletion` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sv_deletion` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `sv_callset_id` INT(11) UNSIGNED NOT NULL, `chr` ENUM('chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrY','chrX','chrMT') NOT NULL, `start_min` INT(11) UNSIGNED NOT NULL, `start_max` INT(11) UNSIGNED NOT NULL, `end_min` INT(11) UNSIGNED NOT NULL, `end_max` INT(11) UNSIGNED NOT NULL, `quality_metrics` TEXT DEFAULT NULL COMMENT 'quality metrics as JSON key-value array', PRIMARY KEY (`id`), CONSTRAINT `sv_del_references_sv_callset` FOREIGN KEY (`sv_callset_id`) REFERENCES `sv_callset` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, INDEX `exact_match` (`chr`, `start_min`, `start_max`, `end_min`, `end_max`), INDEX `overlap_match` (`chr`, `start_min`, `end_max`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT='SV deletion'; -- ----------------------------------------------------- -- Table `sv_duplication` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sv_duplication` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `sv_callset_id` INT(11) UNSIGNED NOT NULL, `chr` ENUM('chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrY','chrX','chrMT') NOT NULL, `start_min` INT(11) UNSIGNED NOT NULL, `start_max` INT(11) UNSIGNED NOT NULL, `end_min` INT(11) UNSIGNED NOT NULL, `end_max` INT(11) UNSIGNED NOT NULL, `quality_metrics` TEXT DEFAULT NULL COMMENT 'quality metrics as JSON key-value array', PRIMARY KEY (`id`), CONSTRAINT `sv_dup_references_sv_callset` FOREIGN KEY (`sv_callset_id`) REFERENCES `sv_callset` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, INDEX `exact_match` (`chr`, `start_min`, `start_max`, `end_min`, `end_max`), INDEX `overlap_match` (`chr`, `start_min`, `end_max`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT='SV duplication'; -- ----------------------------------------------------- -- Table `sv_insertion` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sv_insertion` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `sv_callset_id` INT(11) UNSIGNED NOT NULL, `chr` ENUM('chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrY','chrX','chrMT') NOT NULL, `pos`INT(11) UNSIGNED NOT NULL, `ci_lower` INT(5) UNSIGNED NOT NULL DEFAULT 0, `ci_upper` INT(5) UNSIGNED NOT NULL, `inserted_sequence` TEXT DEFAULT NULL, `known_left` TEXT DEFAULT NULL, `known_right` TEXT DEFAULT NULL, `quality_metrics` TEXT DEFAULT NULL COMMENT 'quality metrics as JSON key-value array', PRIMARY KEY (`id`), CONSTRAINT `sv_ins_references_sv_callset` FOREIGN KEY (`sv_callset_id`) REFERENCES `sv_callset` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, INDEX `match` (`chr`, `pos`, `ci_upper`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT='SV insertion'; -- ----------------------------------------------------- -- Table `sv_inversion` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sv_inversion` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `sv_callset_id` INT(11) UNSIGNED NOT NULL, `chr` ENUM('chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrY','chrX','chrMT') NOT NULL, `start_min` INT(11) UNSIGNED NOT NULL, `start_max` INT(11) UNSIGNED NOT NULL, `end_min` INT(11) UNSIGNED NOT NULL, `end_max` INT(11) UNSIGNED NOT NULL, `quality_metrics` TEXT DEFAULT NULL COMMENT 'quality metrics as JSON key-value array', PRIMARY KEY (`id`), CONSTRAINT `sv_inv_references_sv_callset` FOREIGN KEY (`sv_callset_id`) REFERENCES `sv_callset` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, INDEX `exact_match` (`chr`, `start_min`, `start_max`, `end_min`, `end_max`), INDEX `overlap_match` (`chr`, `start_min`, `end_max`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT='SV inversion'; -- ----------------------------------------------------- -- Table `sv_translocation` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `sv_translocation` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `sv_callset_id` INT(11) UNSIGNED NOT NULL, `chr1` ENUM('chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrY','chrX','chrMT') NOT NULL, `start1` INT(11) UNSIGNED NOT NULL, `end1` INT(11) UNSIGNED NOT NULL, `chr2` ENUM('chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrY','chrX','chrMT') NOT NULL, `start2` INT(11) UNSIGNED NOT NULL, `end2` INT(11) UNSIGNED NOT NULL, `quality_metrics` TEXT DEFAULT NULL COMMENT 'quality metrics as JSON key-value array', PRIMARY KEY (`id`), CONSTRAINT `sv_bnd_references_sv_callset` FOREIGN KEY (`sv_callset_id`) REFERENCES `sv_callset` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, INDEX `match` (`chr1`, `start1`, `end1`, `chr2`, `start2`, `end2`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT='SV translocation'; -- ----------------------------------------------------- -- Table `report_configuration_sv` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `report_configuration_sv` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `report_configuration_id` INT(11) NOT NULL, `sv_deletion_id` INT(11) UNSIGNED DEFAULT NULL, `sv_duplication_id` INT(11) UNSIGNED DEFAULT NULL, `sv_insertion_id` INT(11) UNSIGNED DEFAULT NULL, `sv_inversion_id` INT(11) UNSIGNED DEFAULT NULL, `sv_translocation_id` INT(11) UNSIGNED DEFAULT NULL, `type` ENUM('diagnostic variant', 'candidate variant', 'incidental finding') NOT NULL, `causal` BOOLEAN NOT NULL, `class` ENUM('n/a','1','2','3','4','5','M') NOT NULL, `inheritance` ENUM('n/a', 'AR','AD','XLR','XLD','MT') NOT NULL, `de_novo` BOOLEAN NOT NULL, `mosaic` BOOLEAN NOT NULL, `compound_heterozygous` BOOLEAN NOT NULL, `exclude_artefact` BOOLEAN NOT NULL, `exclude_frequency` BOOLEAN NOT NULL, `exclude_phenotype` BOOLEAN NOT NULL, `exclude_mechanism` BOOLEAN NOT NULL, `exclude_other` BOOLEAN NOT NULL, `comments` text NOT NULL, `comments2` text NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `fk_report_configuration3` FOREIGN KEY (`report_configuration_id` ) REFERENCES `report_configuration` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_report_configuration_sv_has_sv_deletion` FOREIGN KEY (`sv_deletion_id`) REFERENCES `sv_deletion` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_report_configuration_sv_has_sv_duplication` FOREIGN KEY (`sv_duplication_id`) REFERENCES `sv_duplication` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_report_configuration_sv_has_sv_insertion` FOREIGN KEY (`sv_insertion_id`) REFERENCES `sv_insertion` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_report_configuration_sv_has_sv_inversion` FOREIGN KEY (`sv_inversion_id`) REFERENCES `sv_inversion` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_report_configuration_sv_has_sv_translocation` FOREIGN KEY (`sv_translocation_id`) REFERENCES `sv_translocation` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, UNIQUE INDEX `config_variant_combo_uniq` (`report_configuration_id` ASC, `sv_deletion_id` ASC, `sv_duplication_id` ASC, `sv_insertion_id` ASC, `sv_inversion_id` ASC, `sv_translocation_id` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `evaluation_sheet_data` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `evaluation_sheet_data` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `processed_sample_id` INT(11) NOT NULL, `dna_rna_id` TEXT CHARACTER SET 'utf8' DEFAULT NULL, `reviewer1` INT NOT NULL, `review_date1` DATE NOT NULL, `reviewer2` INT NOT NULL, `review_date2` DATE NOT NULL, `analysis_scope` TEXT CHARACTER SET 'utf8' DEFAULT NULL, `acmg_requested` BOOLEAN DEFAULT FALSE NOT NULL, `acmg_analyzed` BOOLEAN DEFAULT FALSE NOT NULL, `acmg_noticeable` BOOLEAN DEFAULT FALSE NOT NULL, `filtered_by_freq_based_dominant` BOOLEAN DEFAULT FALSE NOT NULL, `filtered_by_freq_based_recessive` BOOLEAN DEFAULT FALSE NOT NULL, `filtered_by_mito` BOOLEAN DEFAULT FALSE NOT NULL, `filtered_by_x_chr` BOOLEAN DEFAULT FALSE NOT NULL, `filtered_by_cnv` BOOLEAN DEFAULT FALSE NOT NULL, `filtered_by_svs` BOOLEAN DEFAULT FALSE NOT NULL, `filtered_by_res` BOOLEAN DEFAULT FALSE NOT NULL, `filtered_by_mosaic` BOOLEAN DEFAULT FALSE NOT NULL, `filtered_by_phenotype` BOOLEAN DEFAULT FALSE NOT NULL, `filtered_by_multisample` BOOLEAN DEFAULT FALSE NOT NULL, `filtered_by_trio_stringent` BOOLEAN DEFAULT FALSE NOT NULL, `filtered_by_trio_relaxed` BOOLEAN DEFAULT FALSE NOT NULL, PRIMARY KEY (`id`), INDEX `processed_sample_id` (`processed_sample_id` ASC), UNIQUE KEY `evaluation_sheet_data_references_processed_sample` (`processed_sample_id`), CONSTRAINT `evaluation_sheet_data_references_processed_sample` FOREIGN KEY (`processed_sample_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `evaluation_sheet_data_references_user1` FOREIGN KEY (`reviewer1`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `evaluation_sheet_data_references_user2` FOREIGN KEY (`reviewer2`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `preferred_transcripts` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `preferred_transcripts` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` varchar(40) NOT NULL, `added_by` INT(11) NOT NULL, `added_date` timestamp NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `combo_som_rep_conf_ids` (`name` ASC), CONSTRAINT `preferred_transcriptsg_created_by_user` FOREIGN KEY (`added_by`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; -- ----------------------------------------------------- -- Table `variant_validation` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `variant_validation` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `user_id` INT(11) NOT NULL, `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `sample_id` INT(11) NOT NULL, `variant_type` ENUM('SNV_INDEL', 'CNV', 'SV') NOT NULL, `variant_id` INT(11) DEFAULT NULL, `cnv_id` INT(11) UNSIGNED DEFAULT NULL, `sv_deletion_id` INT(11) UNSIGNED DEFAULT NULL, `sv_duplication_id` INT(11) UNSIGNED DEFAULT NULL, `sv_insertion_id` INT(11) UNSIGNED DEFAULT NULL, `sv_inversion_id` INT(11) UNSIGNED DEFAULT NULL, `sv_translocation_id` INT(11) UNSIGNED DEFAULT NULL, `genotype` ENUM('hom','het') DEFAULT NULL, `validation_method` ENUM('Sanger sequencing', 'breakpoint PCR', 'qPCR', 'MLPA', 'Array', 'shallow WGS', 'fragment length analysis', 'n/a') NOT NULL DEFAULT 'n/a', `status` ENUM('n/a','to validate','to segregate','for reporting','true positive','false positive','wrong genotype') NOT NULL DEFAULT 'n/a', `comment` TEXT NULL DEFAULT NULL, PRIMARY KEY (`id`), INDEX `fk_user_id` (`user_id` ASC), CONSTRAINT `vv_user` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_variant_validation_has_sample` FOREIGN KEY (`sample_id`) REFERENCES `sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_variant_validation_has_variant` FOREIGN KEY (`variant_id`) REFERENCES `variant` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_variant_validation_has_cnv` FOREIGN KEY (`cnv_id`) REFERENCES `cnv` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_variant_validation_has_sv_deletion` FOREIGN KEY (`sv_deletion_id`) REFERENCES `sv_deletion` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_variant_validation_has_sv_duplication` FOREIGN KEY (`sv_duplication_id`) REFERENCES `sv_duplication` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_variant_validation_has_sv_insertion` FOREIGN KEY (`sv_insertion_id`) REFERENCES `sv_insertion` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_variant_validation_has_sv_inversion` FOREIGN KEY (`sv_inversion_id`) REFERENCES `sv_inversion` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_variant_validation_has_sv_translocation` FOREIGN KEY (`sv_translocation_id`) REFERENCES `sv_translocation` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, UNIQUE INDEX `variant_validation_unique_var` (`sample_id`, `variant_id`, `cnv_id`, `sv_deletion_id`, `sv_duplication_id`, `sv_insertion_id`, `sv_inversion_id`, `sv_translocation_id`), INDEX `status` (`status` ASC), INDEX `variant_type` (`variant_type` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `study` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `study` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) NOT NULL, `description` TEXT NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `name_UNIQUE` (`name` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `study_sample` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `study_sample` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `study_id` INT(11) NOT NULL, `processed_sample_id` INT(11) NOT NULL, `study_sample_idendifier` VARCHAR(50) DEFAULT NULL, PRIMARY KEY (`id`), CONSTRAINT `fk_study_sample_has_study` FOREIGN KEY (`study_id`) REFERENCES `study` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_study_sample_has_ps` FOREIGN KEY (`processed_sample_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, UNIQUE INDEX `unique_sample_ps` (`study_id`, `processed_sample_id`), INDEX `i_study_sample_idendifier` (`study_sample_idendifier` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `secondary_analysis` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `secondary_analysis` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `type` enum('multi sample','trio','somatic') NOT NULL, `gsvar_file` VARCHAR(1000) NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `unique_gsvar` (`gsvar_file`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `gaps` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `gaps` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `chr` ENUM('chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrY','chrX','chrMT') NOT NULL, `start` INT(11) UNSIGNED NOT NULL, `end` INT(11) UNSIGNED NOT NULL, `processed_sample_id` INT(11) NOT NULL, `status` enum('checked visually','to close','in progress','closed','canceled') NOT NULL, `history` TEXT, PRIMARY KEY (`id`), INDEX `gap_index` (`chr` ASC, `start` ASC, `end` ASC), INDEX `processed_sample_id` (`processed_sample_id` ASC), INDEX `status` (`status` ASC), CONSTRAINT `fk_gap_has_processed_sample1` FOREIGN KEY (`processed_sample_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `gene_pseudogene_relation` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `gene_pseudogene_relation` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `parent_gene_id` int(10) unsigned NOT NULL, `pseudogene_gene_id` int(10) unsigned DEFAULT NULL, `gene_name` varchar(40) DEFAULT NULL, PRIMARY KEY (`id`), CONSTRAINT `fk_parent_gene_id` FOREIGN KEY (`parent_gene_id` ) REFERENCES `gene` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_pseudogene_gene_id` FOREIGN KEY (`pseudogene_gene_id` ) REFERENCES `gene` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, UNIQUE KEY `pseudo_gene_relation` (`parent_gene_id`, `pseudogene_gene_id`, `gene_name`), INDEX `parent_gene_id` (`parent_gene_id` ASC), INDEX `pseudogene_gene_id` (`pseudogene_gene_id` ASC) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Gene-Pseudogene relation'; -- ----------------------------------------------------- -- Table `processed_sample_ancestry` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `processed_sample_ancestry` ( `processed_sample_id` INT(11) NOT NULL, `num_snps` INT(11) NOT NULL, `score_afr` FLOAT NOT NULL, `score_eur` FLOAT NOT NULL, `score_sas` FLOAT NOT NULL, `score_eas` FLOAT NOT NULL, `population` enum('AFR','EUR','SAS','EAS','ADMIXED/UNKNOWN') NOT NULL, PRIMARY KEY (`processed_sample_id`), CONSTRAINT `fk_processed_sample_ancestry_has_processed_sample` FOREIGN KEY (`processed_sample_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `subpanels` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `subpanels` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `name` varchar(200) NOT NULL, `created_by` int(11) DEFAULT NULL, `created_date` DATE NOT NULL, `mode` ENUM('exon', 'gene') NOT NULL, `extend` INT(11) NOT NULL, `genes` MEDIUMTEXT NOT NULL, `roi` MEDIUMTEXT NOT NULL, `archived` TINYINT(1) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), INDEX(`created_by`), INDEX(`created_date`), INDEX(`archived`), CONSTRAINT `subpanels_created_by_user` FOREIGN KEY (`created_by`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `cfdna_panels` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `cfdna_panels` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `tumor_id` INT(11) NOT NULL, `cfdna_id` INT(11) DEFAULT NULL, `created_by` INT(11) DEFAULT NULL, `created_date` DATE NOT NULL, `processing_system_id` INT(11) NOT NULL, `bed` MEDIUMTEXT NOT NULL, `vcf` MEDIUMTEXT NOT NULL, `excluded_regions` MEDIUMTEXT DEFAULT NULL, PRIMARY KEY (`id`), INDEX(`created_by`), INDEX(`created_date`), INDEX(`tumor_id`), UNIQUE `unique_cfdna_panel`(`tumor_id`, `processing_system_id`), CONSTRAINT `cfdna_panels_tumor_id` FOREIGN KEY (`tumor_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `cfdna_panels_cfdna_id` FOREIGN KEY (`cfdna_id`) REFERENCES `processed_sample` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `cfdna_panels_created_by_user` FOREIGN KEY (`created_by`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `cfdna_panels_processing_system_id` FOREIGN KEY (`processing_system_id`) REFERENCES `processing_system` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `cfdna_panel_genes` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `cfdna_panel_genes` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `gene_name` VARCHAR(40) CHARACTER SET 'utf8' NOT NULL, `chr` ENUM('chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrY','chrX','chrMT') NOT NULL, `start` INT(11) UNSIGNED NOT NULL, `end` INT(11) UNSIGNED NOT NULL, `date` DATE NOT NULL, `bed` MEDIUMTEXT NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX(`gene_name`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `variant_literature` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `variant_literature` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `variant_id` INT(11) NOT NULL, `pubmed` VARCHAR(12) CHARACTER SET 'utf8' NOT NULL, PRIMARY KEY (`id`), INDEX(`variant_id`), UNIQUE INDEX `variant_literature_UNIQUE` (`variant_id` ASC, `pubmed` ASC), CONSTRAINT `variant_literature_variant_id` FOREIGN KEY (`variant_id`) REFERENCES `variant` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8;
imgag/ngs-bits
src/cppNGSD/resources/NGSD_schema.sql
SQL
mit
79,928
#ifndef ABSTRACTTRANSFORM_H #define ABSTRACTTRANSFORM_H #include <new> #include <mfapi.h> #include <mftransform.h> #include <mfidl.h> #include <mferror.h> #include <strsafe.h> #include <assert.h> // Note: The Direct2D helper library is included for its 2D matrix operations. #include <D2d1helper.h> #include <wrl\implements.h> #include <wrl\module.h> #include <windows.media.h> #include <INITGUID.H> #include "Common.h" #include "Interop\MessengerInterface.h" // Forward declaration class ImageAnalyzer; class ImageProcessingUtils; class Settings; class CAbstractTransform : public Microsoft::WRL::RuntimeClass< Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::RuntimeClassType::WinRtClassicComMix>, ABI::Windows::Media::IMediaExtension, IMFTransform> { public: CAbstractTransform(); virtual ~CAbstractTransform(); STDMETHOD(RuntimeClassInitialize)(); // IMediaExtension virtual STDMETHODIMP SetProperties(ABI::Windows::Foundation::Collections::IPropertySet *pConfiguration); // IMFTransform STDMETHODIMP GetStreamLimits( DWORD *pdwInputMinimum, DWORD *pdwInputMaximum, DWORD *pdwOutputMinimum, DWORD *pdwOutputMaximum ); STDMETHODIMP GetStreamCount( DWORD *pcInputStreams, DWORD *pcOutputStreams ); STDMETHODIMP GetStreamIDs( DWORD dwInputIDArraySize, DWORD *pdwInputIDs, DWORD dwOutputIDArraySize, DWORD *pdwOutputIDs ); STDMETHODIMP GetInputStreamInfo( DWORD dwInputStreamID, MFT_INPUT_STREAM_INFO * pStreamInfo ); STDMETHODIMP GetOutputStreamInfo( DWORD dwOutputStreamID, MFT_OUTPUT_STREAM_INFO * pStreamInfo ); STDMETHODIMP GetAttributes(IMFAttributes** pAttributes); STDMETHODIMP GetInputStreamAttributes( DWORD dwInputStreamID, IMFAttributes **ppAttributes ); STDMETHODIMP GetOutputStreamAttributes( DWORD dwOutputStreamID, IMFAttributes **ppAttributes ); STDMETHODIMP DeleteInputStream(DWORD dwStreamID); STDMETHODIMP AddInputStreams( DWORD cStreams, DWORD *adwStreamIDs ); STDMETHODIMP GetInputAvailableType( DWORD dwInputStreamID, DWORD dwTypeIndex, // 0-based IMFMediaType **ppType ); STDMETHODIMP GetOutputAvailableType( DWORD dwOutputStreamID, DWORD dwTypeIndex, // 0-based IMFMediaType **ppType ); STDMETHODIMP SetInputType( DWORD dwInputStreamID, IMFMediaType *pType, DWORD dwFlags ); STDMETHODIMP SetOutputType( DWORD dwOutputStreamID, IMFMediaType *pType, DWORD dwFlags ); STDMETHODIMP GetInputCurrentType( DWORD dwInputStreamID, IMFMediaType **ppType ); STDMETHODIMP GetOutputCurrentType( DWORD dwOutputStreamID, IMFMediaType **ppType ); STDMETHODIMP GetInputStatus( DWORD dwInputStreamID, DWORD *pdwFlags ); STDMETHODIMP GetOutputStatus(DWORD *pdwFlags); STDMETHODIMP SetOutputBounds( LONGLONG hnsLowerBound, LONGLONG hnsUpperBound ); STDMETHODIMP ProcessEvent( DWORD dwInputStreamID, IMFMediaEvent *pEvent ); STDMETHODIMP ProcessMessage( MFT_MESSAGE_TYPE eMessage, ULONG_PTR ulParam ); virtual STDMETHODIMP ProcessInput( DWORD dwInputStreamID, IMFSample *pSample, DWORD dwFlags ); virtual STDMETHODIMP ProcessOutput( DWORD dwFlags, DWORD cOutputBufferCount, MFT_OUTPUT_DATA_BUFFER *pOutputSamples, // one per stream DWORD *pdwStatus ); protected: // HasPendingOutput: Returns TRUE if the MFT is holding an input sample. BOOL HasPendingOutput() const { return m_pSample != NULL; } // IsValidInputStream: Returns TRUE if dwInputStreamID is a valid input stream identifier. BOOL IsValidInputStream(DWORD dwInputStreamID) const { return dwInputStreamID == 0; } // IsValidOutputStream: Returns TRUE if dwOutputStreamID is a valid output stream identifier. BOOL IsValidOutputStream(DWORD dwOutputStreamID) const { return dwOutputStreamID == 0; } HRESULT OnGetPartialType(DWORD dwTypeIndex, IMFMediaType **ppmt); HRESULT OnCheckInputType(IMFMediaType *pmt); HRESULT OnCheckOutputType(IMFMediaType *pmt); HRESULT OnCheckMediaType(IMFMediaType *pmt); void OnSetInputType(IMFMediaType *pmt); void OnSetOutputType(IMFMediaType *pmt); HRESULT OnFlush(); virtual HRESULT UpdateFormatInfo(); virtual HRESULT BeginStreaming(); virtual HRESULT EndStreaming(); virtual HRESULT OnProcessOutput(IMFMediaBuffer *pIn, IMFMediaBuffer *pOut) = 0; virtual void OnMfMtSubtypeResolved(const GUID subtype); protected: // Members CRITICAL_SECTION m_critSec; D2D_RECT_U m_rcDest; // Destination rectangle for the effect. // Streaming bool m_bStreamingInitialized; IMFSample *m_pSample; // Input sample. IMFMediaType *m_pInputType; // Input media type. IMFMediaType *m_pOutputType; // Output media type. // Fomat information UINT32 m_imageWidthInPixels; UINT32 m_imageHeightInPixels; DWORD m_cbImageSize; // Image size, in bytes. IMFAttributes *m_pAttributes; VideoEffect::MessengerInterface ^m_messenger; ImageAnalyzer *m_imageAnalyzer; ImageProcessingUtils *m_imageProcessingUtils; Settings *m_settings; GUID m_videoFormatSubtype; }; #endif // ABSTRACTTRANSFORM_H
tompaana/object-tracking-demo
VideoEffect/VideoEffect.Shared/Transforms/AbstractTransform.h
C
mit
6,350
package com.cnpc.framework.base.service.impl; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.springframework.stereotype.Service; import com.alibaba.fastjson.JSON; import com.cnpc.framework.base.entity.Dict; import com.cnpc.framework.base.pojo.TreeNode; import com.cnpc.framework.base.service.DictService; import com.cnpc.framework.constant.RedisConstant; import com.cnpc.framework.utils.StrUtil; import com.cnpc.framework.utils.TreeUtil; @Service("dictService") public class DictServiceImpl extends BaseServiceImpl implements DictService { @Override public List<TreeNode> getTreeData() { // 获取数据 String key = RedisConstant.DICT_PRE+"tree"; List<TreeNode> tnlist = null; String tnStr = redisDao.get(key); if(!StrUtil.isEmpty(key)) { tnlist = JSON.parseArray(tnStr,TreeNode.class); } if (tnlist != null) { return tnlist; } else { String hql = "from Dict order by levelCode asc"; List<Dict> dicts = this.find(hql); Map<String, TreeNode> nodelist = new LinkedHashMap<String, TreeNode>(); for (Dict dict : dicts) { TreeNode node = new TreeNode(); node.setText(dict.getName()); node.setId(dict.getId()); node.setParentId(dict.getParentId()); node.setLevelCode(dict.getLevelCode()); nodelist.put(node.getId(), node); } // 构造树形结构 tnlist = TreeUtil.getNodeList(nodelist); redisDao.save(key, tnlist); return tnlist; } } public List<Dict> getDictsByCode(String code) { String key = RedisConstant.DICT_PRE+ code; List dicts = redisDao.get(key, List.class); if (dicts == null) { String hql = "from Dict where code='" + code + "'"; Dict dict = this.get(hql); dicts = this.find("from Dict where parentId='" + dict.getId() + "' order by levelCode"); redisDao.add(key, dicts); return dicts; } else { return dicts; } } @Override public List<TreeNode> getTreeDataByCode(String code) { // 获取数据 String key = RedisConstant.DICT_PRE + code + "s"; List<TreeNode> tnlist = null; String tnStr = redisDao.get(key); if(!StrUtil.isEmpty(key)) { tnlist = JSON.parseArray(tnStr,TreeNode.class); } if (tnlist != null) { return tnlist; } else { String hql = "from Dict where code='" + code + "' order by levelCode asc"; List<Dict> dicts = this.find(hql); hql = "from Dict where code='" + code + "' or parent_id = '" +dicts.get(0).getId()+ "' order by levelCode asc"; dicts = this.find(hql); Map<String, TreeNode> nodelist = new LinkedHashMap<String, TreeNode>(); for (Dict dict : dicts) { TreeNode node = new TreeNode(); node.setText(dict.getName()); node.setId(dict.getId()); node.setParentId(dict.getParentId()); node.setLevelCode(dict.getLevelCode()); nodelist.put(node.getId(), node); } // 构造树形结构 tnlist = TreeUtil.getNodeList(nodelist); redisDao.save(key, tnlist); return tnlist; } } @Override public List<TreeNode> getMeasureTreeData() { // 获取数据 String hql = "from Dict WHERE (levelCode LIKE '000026%' OR levelCode LIKE '000027%') order by levelCode asc"; List<Dict> funcs = this.find(hql); Map<String, TreeNode> nodelist = new LinkedHashMap<String, TreeNode>(); for (Dict dict : funcs) { TreeNode node = new TreeNode(); node.setText(dict.getName()); node.setId(dict.getId()); node.setParentId(dict.getParentId()); node.setLevelCode(dict.getLevelCode()); nodelist.put(node.getId(), node); } // 构造树形结构 return TreeUtil.getNodeList(nodelist); } }
Squama/Master
AdminEAP-framework/src/main/java/com/cnpc/framework/base/service/impl/DictServiceImpl.java
Java
mit
4,363
#include "unicorn/format.hpp" #include <cmath> #include <cstdio> using namespace RS::Unicorn::Literals; using namespace std::chrono; using namespace std::literals; namespace RS::Unicorn { namespace UnicornDetail { namespace { // These will always be called with x>=0 and prec>=0 Ustring float_print(long double x, int prec, bool exp) { std::vector<char> buf(32); int len = 0; for (;;) { if (exp) len = snprintf(buf.data(), buf.size(), "%.*Le", prec, x); else len = snprintf(buf.data(), buf.size(), "%.*Lf", prec, x); if (len < int(buf.size())) return buf.data(); buf.resize(2 * buf.size()); } } void float_strip(Ustring& str) { static const Regex pattern("(.*)(\\.(?:\\d*[1-9])?)(0+)(e.*)?", Regex::full); auto match = pattern(str); if (match) { Ustring result(match[1]); if (match.count(2) != 1) result += match[2]; result += match[4]; str.swap(result); } } Ustring float_digits(long double x, int prec) { prec = std::max(prec, 1); auto result = float_print(x, prec - 1, true); auto epos = result.find_first_of("Ee"); auto exponent = strtol(result.data() + epos + 1, nullptr, 10); result.resize(epos); if (exponent < 0) { if (prec > 1) result.erase(1, 1); result.insert(0, 1 - exponent, '0'); result[1] = '.'; } else if (exponent >= prec - 1) { if (prec > 1) result.erase(1, 1); result.insert(result.end(), exponent - prec + 1, '0'); } else if (exponent > 0) { result.erase(1, 1); result.insert(exponent + 1, 1, '.'); } return result; } Ustring float_exp(long double x, int prec) { prec = std::max(prec, 1); auto result = float_print(x, prec - 1, true); auto epos = result.find_first_of("Ee"); char esign = 0; if (result[epos + 1] == '-') esign = '-'; auto epos2 = result.find_first_not_of("+-0", epos + 1); Ustring exponent; if (epos2 < result.size()) exponent = result.substr(epos2); result.resize(epos); result += 'e'; if (esign) result += esign; if (exponent.empty()) result += '0'; else result += exponent; return result; } Ustring float_fixed(long double x, int prec) { return float_print(x, prec, false); } Ustring float_general(long double x, int prec) { using std::floor; using std::log10; if (x == 0) return float_digits(x, prec); auto exp = int(floor(log10(x))); auto d_estimate = exp < 0 ? prec + 1 - exp : exp < prec - 1 ? prec + 1 : exp + 1; auto e_estimate = exp < 0 ? prec + 4 : prec + 3; auto e_vs_d = e_estimate - d_estimate; if (e_vs_d <= -2) return float_exp(x, prec); if (e_vs_d >= 2) return float_digits(x, prec); auto dform = float_digits(x, prec); auto eform = float_exp(x, prec); return dform.size() <= eform.size() ? dform : eform; } Ustring string_escape(const Ustring& s, uint64_t mode) { Ustring result; result.reserve(s.size() + 2); if (mode & Format::quote) result += '\"'; for (auto i = utf_begin(s), e = utf_end(s); i != e; ++i) { switch (*i) { case U'\0': result += "\\0"; break; case U'\t': result += "\\t"; break; case U'\n': result += "\\n"; break; case U'\f': result += "\\f"; break; case U'\r': result += "\\r"; break; case U'\\': result += "\\\\"; break; case U'\"': if (mode & Format::quote) result += '\\'; result += '\"'; break; default: if (*i >= 32 && *i <= 126) { result += char(*i); } else if (*i >= 0xa0 && ! (mode & Format::ascii)) { result.append(s, i.offset(), i.count()); } else if (*i <= 0xff) { result += "\\x"; result += format_radix(*i, 16, 2); } else { result += "\\x{"; result += format_radix(*i, 16, 1); result += '}'; } break; } } if (mode & Format::quote) result += '\"'; return result; } template <typename Range> Ustring string_values(const Range& s, int base, int prec, int defprec) { if (prec < 0) prec = defprec; Ustring result; for (auto c: s) { result += format_radix(char_to_uint(c), base, prec); result += ' '; } if (! result.empty()) result.pop_back(); return result; } } // Formatting for specific types void translate_flags(const Ustring& str, uint64_t& flags, int& prec, size_t& width, char32_t& pad) { flags = 0; prec = -1; width = 0; pad = U' '; auto i = utf_begin(str), end = utf_end(str); while (i != end) { if (*i == U'<' || *i == U'=' || *i == U'>') { if (*i == U'<') flags |= Format::left; else if (*i == U'=') flags |= Format::centre; else flags |= Format::right; ++i; if (i != end && ! char_is_digit(*i)) pad = *i++; if (i != end && char_is_digit(*i)) i = str_to_int<size_t>(width, i); } else if (char_is_ascii(*i) && ascii_isalpha(char(*i))) { flags |= letter_to_mask(char(*i++)); } else if (char_is_digit(*i)) { i = str_to_int<int>(prec, i); } else { ++i; } } } Ustring format_ldouble(long double t, uint64_t flags, int prec) { using std::fabs; static constexpr auto format_flags = Format::digits | Format::exp | Format::fixed | Format::general; static constexpr auto sign_flags = Format::sign | Format::signz; if (popcount(flags & format_flags) > 1 || popcount(flags & sign_flags) > 1) throw std::invalid_argument("Inconsistent formatting flags"); if (prec < 0) prec = 6; auto mag = fabs(t); Ustring s; if (flags & Format::digits) s = float_digits(mag, prec); else if (flags & Format::exp) s = float_exp(mag, prec); else if (flags & Format::fixed) s = float_fixed(mag, prec); else s = float_general(mag, prec); if (flags & Format::stripz) float_strip(s); if (t < 0 || (flags & Format::sign) || (t > 0 && (flags & Format::signz))) s.insert(s.begin(), t < 0 ? '-' : '+'); return s; } // Alignment and padding Ustring format_align(Ustring src, uint64_t flags, size_t width, char32_t pad) { if (popcount(flags & (Format::left | Format::centre | Format::right)) > 1) throw std::invalid_argument("Inconsistent formatting alignment flags"); if (popcount(flags & (Format::lower | Format::title | Format::upper)) > 1) throw std::invalid_argument("Inconsistent formatting case conversion flags"); if (flags & Format::lower) str_lowercase_in(src); else if (flags & Format::title) str_titlecase_in(src); else if (flags & Format::upper) str_uppercase_in(src); size_t len = str_length(src, flags & format_length_flags); if (width <= len) return src; size_t extra = width - len; Ustring dst; if (flags & Format::right) str_append_chars(dst, extra, pad); else if (flags & Format::centre) str_append_chars(dst, extra / 2, pad); dst += src; if (flags & Format::left) str_append_chars(dst, extra, pad); else if (flags & Format::centre) str_append_chars(dst, (extra + 1) / 2, pad); return dst; } } // Basic formattng functions Ustring format_type(bool t, uint64_t flags, int /*prec*/) { static constexpr auto format_flags = Format::binary | Format::tf | Format::yesno; if (popcount(flags & format_flags) > 1) throw std::invalid_argument("Inconsistent formatting flags"); if (flags & Format::binary) return t ? "1" : "0"; else if (flags & Format::yesno) return t ? "yes" : "no"; else return t ? "true" : "false"; } Ustring format_type(const Ustring& t, uint64_t flags, int prec) { using namespace UnicornDetail; static constexpr auto format_flags = Format::ascii | Format::ascquote | Format::escape | Format::decimal | Format::hex | Format::hex8 | Format::hex16 | Format::quote; if (popcount(flags & format_flags) > 1) throw std::invalid_argument("Inconsistent formatting flags"); if (flags & Format::quote) return string_escape(t, Format::quote); else if (flags & Format::ascquote) return string_escape(t, Format::quote | Format::ascii); else if (flags & Format::escape) return string_escape(t, 0); else if (flags & Format::ascii) return string_escape(t, Format::ascii); else if (flags & Format::decimal) return string_values(utf_range(t), 10, prec, 1); else if (flags & Format::hex8) return string_values(t, 16, prec, 2); else if (flags & Format::hex16) return string_values(to_utf16(t), 16, prec, 4); else if (flags & Format::hex) return string_values(utf_range(t), 16, prec, 1); else return t; } Ustring format_type(system_clock::time_point t, uint64_t flags, int prec) { static constexpr auto format_flags = Format::iso | Format::common; if (popcount(flags & format_flags) > 1) throw std::invalid_argument("Inconsistent formatting flags"); auto zone = flags & Format::local ? local_zone : utc_zone; if (flags & Format::common) return format_date(t, "%c"s, zone); auto result = format_date(t, prec, zone); if (flags & Format::iso) { auto pos = result.find(' '); if (pos != npos) result[pos] = 'T'; } return result; } // Formatter class Format::Format(const Ustring& format): fmt(format), seq() { auto i = utf_begin(format), end = utf_end(format); while (i != end) { auto j = std::find(i, end, U'$'); add_literal(u_str(i, j)); i = std::next(j); if (i == end) break; Ustring prefix, suffix; if (char_is_digit(*i)) { auto k = std::find_if_not(i, end, char_is_digit); j = std::find_if_not(k, end, char_is_alphanumeric); prefix = u_str(i, k); suffix = u_str(k, j); } else if (*i == U'{') { auto k = std::next(i); if (char_is_digit(*k)) { auto l = std::find_if_not(k, end, char_is_digit); j = std::find(l, end, U'}'); if (j != end) { prefix = u_str(k, l); suffix = u_str(l, j); ++j; } } } if (prefix.empty()) { add_literal(i.str()); ++i; } else { add_index(str_to_int<unsigned>(prefix), suffix); i = j; } } } void Format::add_index(unsigned index, const Ustring& flags) { using namespace UnicornDetail; element elem; elem.index = index; translate_flags(to_utf8(flags), elem.flags, elem.prec, elem.width, elem.pad); seq.push_back(elem); if (index > 0 && index > num) num = index; } void Format::add_literal(const Ustring& text) { if (! text.empty()) { if (seq.empty() || seq.back().index != 0) seq.push_back({0, text, 0, 0, 0, 0}); else seq.back().text += text; } } }
CaptainCrowbar/unicorn-lib
unicorn/format.cpp
C++
mit
14,380
// // IOService.cpp // Firedrake // // Created by Sidney Just // Copyright (c) 2015 by Sidney Just // 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. // #include "IOService.h" namespace IO { IODefineMeta(Service, RegistryEntry) String *kServiceProviderMatchKey; String *kServiceClassMatchKey; String *kServicePropertiesMatchKey; extern void RegisterClass(MetaClass *meta, Dictionary *properties); extern void RegisterProvider(Service *provider); extern void EnumerateClassesForProvider(Service *provider, const Function<bool (MetaClass *meta, Dictionary *properties)> &callback); void Service::InitialWakeUp(MetaClass *meta) { if(meta == Service::GetMetaClass()) { kServiceProviderMatchKey = String::Alloc()->InitWithCString("kServiceProviderMatchKey"); kServiceClassMatchKey = String::Alloc()->InitWithCString("kServiceClassMatchKey"); kServicePropertiesMatchKey = String::Alloc()->InitWithCString("kServicePropertiesMatchKey"); } RegistryEntry::InitialWakeUp(meta); } void Service::RegisterService(MetaClass *meta, Dictionary *properties) { RegisterClass(meta, properties); } Service *Service::InitWithProperties(Dictionary *properties) { if(!RegistryEntry::Init()) return nullptr; _started = false; _properties = properties->Retain(); return this; } Dictionary *Service::GetProperties() const { return _properties; } void Service::Start() { _started = true; } void Service::Stop() {} // Matching void Service::RegisterProvider() { IO::RegisterProvider(this); } bool Service::MatchProperties(__unused Dictionary *properties) { return true; } void Service::StartMatching() { DoMatch(); } void Service::DoMatch() { EnumerateClassesForProvider(this, [this](MetaClass *meta, Dictionary *properties) { if(MatchProperties(properties)) { Service *service = static_cast<Service *>(meta->Alloc()); service = service->InitWithProperties(properties); if(service) { PublishService(service); return true; } } return false; }); } void Service::PublishService(Service *service) { AttachChild(service); } void Service::AttachToParent(RegistryEntry *parent) { RegistryEntry::AttachToParent(parent); Start(); } }
JustSid/Firedrake
slib/libio/service/IOService.cpp
C++
mit
3,272
//----------------------------------------------------------------------- // <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
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
--- 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
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
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
# Amaretti.js [![Join the chat at https://gitter.im/VincentCasse/amaretti.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/VincentCasse/amaretti.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/VincentCasse/amaretti.js.svg)](https://travis-ci.org/VincentCasse/amaretti.js.svg) [![Coverage Status](https://coveralls.io/repos/VincentCasse/amaretti.js/badge.svg?branch=master&service=github)](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
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
/** * 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("ui.username=nobody@nowhere.net"); } 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
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
/*--------------------------------------------------------------------------------------------- * 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
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
<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
<?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>&lt;b&gt;GulfCoin&lt;/b&gt; version</source> <translation>&lt;b&gt;位元幣&lt;/b&gt;版本</translation> </message> <message> <location line="+57"/> <source> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source> <translation> 這是一套實驗性的軟體. 此軟體是依據 MIT/X11 軟體授權條款散布, 詳情請見附帶的 COPYING 檔案, 或是以下網站: http://www.opensource.org/licenses/mit-license.php. 此產品也包含了由 OpenSSL Project 所開發的 OpenSSL Toolkit (http://www.openssl.org/) 軟體, 由 Eric Young (eay@cryptsoft.com) 撰寫的加解密軟體, 以及由 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>&amp;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>&amp;Copy Address</source> <translation>複製位址</translation> </message> <message> <location line="+11"/> <source>Show &amp;QR Code</source> <translation>顯示 &amp;QR 條碼</translation> </message> <message> <location line="+11"/> <source>Sign a message to prove you own a GulfCoin address</source> <translation>簽署訊息是用來證明位元幣位址是你的</translation> </message> <message> <location line="+3"/> <source>Sign &amp;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>&amp;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>&amp;Verify Message</source> <translation>訊息驗證</translation> </message> <message> <location line="+14"/> <source>&amp;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 &amp;Label</source> <translation>複製標記</translation> </message> <message> <location line="+1"/> <source>&amp;Edit</source> <translation>編輯</translation> </message> <message> <location line="+1"/> <source>Send &amp;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.&lt;br/&gt;Please use a passphrase of &lt;b&gt;10 or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation>輸入錢包的新密碼.&lt;br/&gt;請用&lt;b&gt;10個以上的字元&lt;/b&gt;, 或是&lt;b&gt;8個以上的單字&lt;/b&gt;.</translation> </message> <message> <location line="+1"/> <source>Encrypt wallet</source> <translation>錢包加密</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation>這個動作需要用你的錢包密碼來解鎖</translation> </message> <message> <location line="+5"/> <source>Unlock wallet</source> <translation>錢包解鎖</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation>這個動作需要用你的錢包密碼來解密</translation> </message> <message> <location line="+5"/> <source>Decrypt wallet</source> <translation>錢包解密</translation> </message> <message> <location line="+3"/> <source>Change passphrase</source> <translation>變更密碼</translation> </message> <message> <location line="+1"/> <source>Enter the old and new passphrase to the wallet.</source> <translation>輸入錢包的新舊密碼.</translation> </message> <message> <location line="+46"/> <source>Confirm wallet encryption</source> <translation>錢包加密確認</translation> </message> <message> <location line="+1"/> <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR BITCOINS&lt;/b&gt;!</source> <translation>警告: 如果將錢包加密後忘記密碼, 你會&lt;b&gt;失去其中所有的位元幣&lt;/b&gt;!</translation> </message> <message> <location line="+0"/> <source>Are you sure you wish to encrypt your wallet?</source> <translation>你確定要將錢包加密嗎?</translation> </message> <message> <location line="+15"/> <source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source> <translation>重要: 請改用新產生有加密的錢包檔, 來取代之前錢包檔的備份. 為了安全性的理由, 當你開始使用新的有加密的錢包時, 舊錢包的備份就不能再使用了.</translation> </message> <message> <location line="+100"/> <location line="+24"/> <source>Warning: The Caps Lock key is on!</source> <translation>警告: 大寫字母鎖定作用中!</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 &amp;message...</source> <translation>訊息簽署...</translation> </message> <message> <location line="+246"/> <source>Synchronizing with network...</source> <translation>網路同步中...</translation> </message> <message> <location line="-321"/> <source>&amp;Overview</source> <translation>總覽</translation> </message> <message> <location line="+1"/> <source>Show general overview of wallet</source> <translation>顯示錢包一般總覽</translation> </message> <message> <location line="+20"/> <source>&amp;Transactions</source> <translation>交易</translation> </message> <message> <location line="+1"/> <source>Browse transaction history</source> <translation>瀏覽交易紀錄</translation> </message> <message> <location line="+7"/> <source>Edit the list of stored addresses and labels</source> <translation>編輯位址與標記的儲存列表</translation> </message> <message> <location line="-14"/> <source>Show the list of addresses for receiving payments</source> <translation>顯示收款位址的列表</translation> </message> <message> <location line="+31"/> <source>E&amp;xit</source> <translation>結束</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 &amp;Qt</source> <translation>關於 &amp;Qt</translation> </message> <message> <location line="+1"/> <source>Show information about Qt</source> <translation>顯示有關於 Qt 的資訊</translation> </message> <message> <location line="+2"/> <source>&amp;Options...</source> <translation>選項...</translation> </message> <message> <location line="+9"/> <source>&amp;Encrypt Wallet...</source> <translation>錢包加密...</translation> </message> <message> <location line="+3"/> <source>&amp;Backup Wallet...</source> <translation>錢包備份...</translation> </message> <message> <location line="+2"/> <source>&amp;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>&amp;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>&amp;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>&amp;Send</source> <translation>付出</translation> </message> <message> <location line="+7"/> <source>&amp;Receive</source> <translation>收受</translation> </message> <message> <location line="+14"/> <source>&amp;Addresses</source> <translation>位址</translation> </message> <message> <location line="+23"/> <location line="+2"/> <source>&amp;About GulfCoin</source> <translation>關於位元幣</translation> </message> <message> <location line="+10"/> <location line="+2"/> <source>&amp;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>&amp;File</source> <translation>檔案</translation> </message> <message> <location line="+7"/> <source>&amp;Settings</source> <translation>設定</translation> </message> <message> <location line="+6"/> <source>&amp;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 &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation>錢包&lt;b&gt;已加密&lt;/b&gt;並且正&lt;b&gt;解鎖中&lt;/b&gt;</translation> </message> <message> <location line="+8"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation>錢包&lt;b&gt;已加密&lt;/b&gt;並且正&lt;b&gt;上鎖中&lt;/b&gt;</translation> </message> <message> <location filename="../bitcoin.cpp" line="+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>&amp;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>&amp;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 &quot;%1&quot; is already in the address book.</source> <translation>輸入的位址&quot;%1&quot;已存在於位址簿中.</translation> </message> <message> <location line="-5"/> <source>The entered address &quot;%1&quot; is not a valid GulfCoin address.</source> <translation>輸入的位址 &quot;%1&quot; 並不是有效的位元幣位址.</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 &quot;de_DE&quot; (default: system locale)</source> <translation>設定語言, 比如說 &quot;de_DE&quot; (預設: 系統語系)</translation> </message> <message> <location line="+1"/> <source>Start minimized</source> <translation>啓動時最小化 </translation> </message> <message> <location line="+1"/> <source>Show splash screen on startup (default: 1)</source> <translation>顯示啓動畫面 (預設: 1)</translation> </message> <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>歡迎使用&quot;位元幣-Qt&quot;</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>由於這是程式第一次啓動, 你可以選擇&quot;位元幣-Qt&quot;儲存資料的地方.</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>&amp;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 &amp;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>&amp;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>&amp;Reset Options</source> <translation>選項回復</translation> </message> <message> <location line="+13"/> <source>&amp;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 &amp;UPnP</source> <translation>用 &amp;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>&amp;Connect through SOCKS proxy:</source> <translation>透過 SOCKS 代理伺服器連線:</translation> </message> <message> <location line="+9"/> <source>Proxy &amp;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>&amp;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 &amp;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>&amp;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>&amp;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&amp;inimize on close</source> <translation>關閉時最小化</translation> </message> <message> <location line="+21"/> <source>&amp;Display</source> <translation>顯示</translation> </message> <message> <location line="+8"/> <source>User Interface &amp;language:</source> <translation>使用界面語言</translation> </message> <message> <location line="+13"/> <source>The user interface language can be set here. This setting will take effect after restarting GulfCoin.</source> <translation>可以在這裡設定使用者介面的語言. 這個設定在位元幣程式重啓後才會生效.</translation> </message> <message> <location line="+11"/> <source>&amp;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>&amp;Display addresses in transaction list</source> <translation>在交易列表顯示位址</translation> </message> <message> <location line="+71"/> <source>&amp;OK</source> <translation>好</translation> </message> <message> <location line="+7"/> <source>&amp;Cancel</source> <translation>取消</translation> </message> <message> <location line="+10"/> <source>&amp;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>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation>&lt;b&gt;最近交易&lt;/b&gt;</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 &quot;%1&quot; does not exist.</source> <translation>錯誤: 不存在指定的資料目錄 &quot;%1&quot;.</translation> </message> <message> <location filename="../intro.cpp" line="+1"/> <source>Error: Specified data directory &quot;%1&quot; can not be created.</source> <translation>錯誤: 無法新增指定的資料目錄 &quot;%1&quot;.</translation> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="+14"/> <source>QR Code Dialog</source> <translation>QR 條碼對話視窗</translation> </message> <message> <location line="+59"/> <source>Request Payment</source> <translation>付款單</translation> </message> <message> <location line="+56"/> <source>Amount:</source> <translation>金額:</translation> </message> <message> <location line="-44"/> <source>Label:</source> <translation>標記:</translation> </message> <message> <location line="+19"/> <source>Message:</source> <translation>訊息:</translation> </message> <message> <location line="+71"/> <source>&amp;Save As...</source> <translation>儲存為...</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>&amp;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>&amp;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>顯示&quot;位元幣-Qt&quot;的求助訊息, 來取得可用的命令列選項列表.</translation> </message> <message> <location line="+3"/> <source>&amp;Show</source> <translation>顯示</translation> </message> <message> <location line="+24"/> <source>&amp;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 &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source> <translation>請用上下游標鍵來瀏覽歷史指令, 且可用 &lt;b&gt;Ctrl-L&lt;/b&gt; 來清理畫面.</translation> </message> <message> <location line="+1"/> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation>請打 &lt;b&gt;help&lt;/b&gt; 來看可用指令的簡介.</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 &amp;Recipient</source> <translation>加收款人</translation> </message> <message> <location line="+20"/> <source>Remove all transaction fields</source> <translation>移除所有交易欄位</translation> </message> <message> <location line="+3"/> <source>Clear &amp;All</source> <translation>全部清掉</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&amp;end</source> <translation>付出</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="-62"/> <location line="+2"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation>&lt;b&gt;%1&lt;/b&gt; 給 %2 (%3)</translation> </message> <message> <location line="+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&amp;mount:</source> <translation>金額:</translation> </message> <message> <location line="+13"/> <source>Pay &amp;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>&amp;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>&amp;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 &amp;Message</source> <translation>訊息簽署</translation> </message> <message> <location line="+14"/> <source>Reset all sign message fields</source> <translation>重置所有訊息簽署欄位</translation> </message> <message> <location line="+3"/> <location line="+146"/> <source>Clear &amp;All</source> <translation>全部清掉</translation> </message> <message> <location line="-87"/> <source>&amp;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>請在下面輸入簽署的位址, 訊息(請確認完整複製了所包含的換行, 空格, 跳位符號等等), 與簽章, 以驗證該訊息. 請小心, 除了訊息內容外, 不要對簽章本身過度解讀, 以避免被用&quot;中間人攻擊法&quot;詐騙.</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 &amp;Message</source> <translation>訊息驗證</translation> </message> <message> <location line="+14"/> <source>Reset all verify message fields</source> <translation>重置所有訊息驗證欄位</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="+27"/> <location line="+3"/> <source>Enter a GulfCoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</source> <translation>輸入位元幣位址 (比如說 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</translation> </message> <message> <location line="-2"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation>按&quot;訊息簽署&quot;來產生簽章</translation> </message> <message> <location line="+3"/> <source>Enter 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 &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation>生產出來的錢要再等 1 個區塊熟成之後, 才能夠花用. 當你產出區塊時, 它會被公布到網路上, 以被串連至區塊鎖鏈. 如果串連失敗了, 它的狀態就會變成&quot;不被接受&quot;, 且不能被花用. 當你產出區塊的幾秒鐘內, 也有其他節點產出區塊的話, 有時候就會發生這種情形.</translation> </message> <message> <location line="+7"/> <source>Debug information</source> <translation>除錯資訊</translation> </message> <message> <location line="+8"/> <source>Transaction</source> <translation>交易</translation> </message> <message> <location line="+3"/> <source>Inputs</source> <translation>輸入</translation> </message> <message> <location line="+23"/> <source>Amount</source> <translation>金額</translation> </message> <message> <location line="+1"/> <source>true</source> <translation>是</translation> </message> <message> <location line="+0"/> <source>false</source> <translation>否</translation> </message> <message> <location line="-209"/> <source>, has not been successfully broadcast yet</source> <translation>, 尚未成功公告出去</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>&amp;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 &lt;port&gt; (default: 12401 or testnet: 22401)</source> <translation>在通訊埠 &lt;port&gt; 聽候連線 (預設: 12401, 或若為測試網路: 22401)</translation> </message> <message> <location line="+5"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation>維持與節點連線數的上限為 &lt;n&gt; 個 (預設: 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 &lt;port&gt; (default: 12402 or testnet: 22402)</source> <translation>在通訊埠 &lt;port&gt; 聽候 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 &quot;GulfCoin Alert&quot; admin@foo.com </source> <translation>%s, 你必須要在以下設定檔中設定 RPC 密碼(rpcpassword): %s 建議你使用以下隨機產生的密碼: rpcuser=gulfcoinrpc rpcpassword=%s (你不用記住這個密碼) 使用者名稱(rpcuser)和密碼(rpcpassword)不可以相同! 如果設定檔還不存在, 請在新增時, 設定檔案權限為&quot;只有主人才能讀取&quot;. 也建議你設定警示通知, 發生問題時你才會被通知到; 比如說設定為: alertnotify=echo %%s | mail -s &quot;GulfCoin Alert&quot; admin@foo.com </translation> </message> <message> <location line="+17"/> <source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source> <translation>設定在 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 請用 &quot;[主機]:通訊埠&quot; 這種格式</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&apos;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, &lt;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: &apos;%s&apos;</source> <translation>無效的 -tor 位址: &apos;%s&apos;</translation> </message> <message> <location line="+1"/> <source>Invalid amount for -minrelaytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation>設定 -minrelaytxfee=&lt;金額&gt; 的金額無效: &apos;%s&apos;</translation> </message> <message> <location line="+1"/> <source>Invalid amount for -mintxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation>設定 -mintxfee=&lt;amount&gt; 的金額無效: &apos;%s&apos;</translation> </message> <message> <location line="+8"/> <source>Maintain a full transaction index (default: 0)</source> <translation>維護全部交易的索引 (預設為 0)</translation> </message> <message> <location line="+2"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source> <translation>每個連線的接收緩衝區大小上限為 &lt;n&gt;*1000 個位元組 (預設: 5000)</translation> </message> <message> <location line="+1"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source> <translation>每個連線的傳送緩衝區大小上限為 &lt;n&gt;*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 &lt;net&gt; (IPv4, IPv6 or Tor)</source> <translation>只和 &lt;net&gt; 網路上的節點連線 (IPv4, IPv6, 或 Tor)</translation> </message> <message> <location line="+2"/> <source>Output extra debugging information. Implies all other -debug* options</source> <translation>輸出額外的除錯資訊. 包含了其它所有的 -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 &lt;ip&gt; (default: 127.0.0.1)</source> <translation>送指令給在 &lt;ip&gt; 的節點 (預設: 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 &lt;n&gt; (default: 100)</source> <translation>設定密鑰池大小為 &lt;n&gt; (預設: 100) </translation> </message> <message> <location line="-12"/> <source>Rescan the block chain for missing wallet transactions</source> <translation>重新掃描區塊鎖鏈, 以尋找錢包所遺漏的交易.</translation> </message> <message> <location line="+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: &apos;%s&apos;</source> <translation>無效的 -proxy 位址: &apos;%s&apos;</translation> </message> <message> <location line="+57"/> <source>Unknown network specified in -onlynet: &apos;%s&apos;</source> <translation>在 -onlynet 指定了不明的網路別: &apos;%s&apos;</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: &apos;%s&apos;</source> <translation>無法解析 -bind 位址: &apos;%s&apos;</translation> </message> <message> <location line="+1"/> <source>Cannot resolve -externalip address: &apos;%s&apos;</source> <translation>無法解析 -externalip 位址: &apos;%s&apos;</translation> </message> <message> <location line="+45"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation>設定 -paytxfee=&lt;金額&gt; 的金額無效: &apos;%s&apos;</translation> </message> <message> <location line="+1"/> <source>Invalid amount</source> <translation>無效的金額</translation> </message> <message> <location line="-6"/> <source>Insufficient funds</source> <translation>累積金額不足</translation> </message> <message> <location line="+10"/> <source>Loading block index...</source> <translation>載入區塊索引中...</translation> </message> <message> <location line="-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=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation>你必須在下列設定檔中設定 RPC 密碼(rpcpassword=&lt;password&gt;): %s 如果這個檔案還不存在, 請在新增時, 設定檔案權限為&quot;只有主人才能讀取&quot;.</translation> </message> </context> </TS>
coingulf/gulfcoin
src/qt/locale/bitcoin_zh_TW.ts
TypeScript
mit
119,082
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
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
<?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
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
#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
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
/** * 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&lt;void(bool&amp;,Derived*)&gt; 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&lt;void(bool&amp;,Derived*)&gt; 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&lt;void(bool&amp;,Derived*)&gt; 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,&currentpath](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 &current){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
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
<!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
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
<!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
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
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
<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
<?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
--- 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
.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
/** * 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
--- 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&rsquo;re excited to have Jonathan Leibiusky join Gilt&rsquo;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&rsquo;s originally from Argentina, but spent some of his childhood in Israel</li> <li>Previous job: Head of Research &amp; Development for <a href="http://www.mercadolibre.com/" target="_blank">MercadoLibre</a></li> <li>He&rsquo;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> &amp; <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
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
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; // Ý’èƒNƒ‰ƒX‚ð€”õ 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; // Ý’èƒNƒ‰ƒX‚ð‰ð•ú 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‚µ‚½ê‡A‘I‘ð 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()); // ƒƒbƒZ[ƒW‚ð•\Ž¦ Toast.makeText( this.getApplicationContext(), R.string.setting_save_toast, Toast.LENGTH_SHORT ).show(); this.finish(); } /** * Ý’è‚Ì•Û‘¶‚ðƒLƒƒƒ“ƒZƒ‹‚·‚é */ private void cancelSettings() { Toast.makeText( this.getApplicationContext(), R.string.setting_cancel_toast, Toast.LENGTH_SHORT ).show(); this.finish(); } private void loadPrefectures() { // ƒ[ƒfƒBƒ“ƒOƒƒbƒZ[ƒ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
/* * 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
/*--------------------------------------------------------------------------------------------- * 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
// 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
/* * 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
/** @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
// 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> \ &nbsp;&nbsp;&nbsp;&nbsp;title={<span id="bibtitle"></span>},<br> \ &nbsp;&nbsp;&nbsp;&nbsp;author={<span id="bibauthor"></span>},<br> \ &nbsp;&nbsp;&nbsp;&nbsp;journal={<span id="bibjournal"></span>},<br> \ &nbsp;&nbsp;&nbsp;&nbsp;year={<span id="bibyear"></span>},<br> \ &nbsp;&nbsp;&nbsp;&nbsp;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
/* * 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
{% 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
# MyLibSwift
arise-yoshimoto/MyLibSwift
README.md
Markdown
mit
12