code stringlengths 5 1.01M | repo_name stringlengths 5 84 | path stringlengths 4 311 | language stringclasses 30 values | license stringclasses 15 values | size int64 5 1.01M | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
/**
* Created by jiamiu on 14-4-10.
*/
var _=require('lodash')
function A(){}
A.prototype.fn = function(){
}
var a = new A
a.pro = {}
var b = _.cloneDeep(a)
//console.log(b.fn,a.fn)
var c = {}
c.__proto__ = A.prototype
_.assign( c, a )
c.own = {}
console.log( c.fn === a.fn,a.pro === c.pro, c.own ===a.own)
| sskyy/icejs | test/lodash.js | JavaScript | mit | 322 | [
30522,
1013,
1008,
1008,
1008,
2580,
2011,
25871,
4328,
2226,
2006,
2403,
1011,
1018,
1011,
2184,
1012,
1008,
1013,
13075,
1035,
1027,
5478,
1006,
1005,
8840,
8883,
2232,
1005,
1007,
3853,
1037,
1006,
1007,
1063,
1065,
1037,
1012,
8773,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import { Component, Input } from '@angular/core';
import { Router } from '@angular/router';
import { IInputButtons } from './toolbar';
@Component({
selector: 'app-toolbar',
templateUrl: './toolbar.component.html',
styleUrls: ['./toolbar.component.scss']
})
export class ToolbarComponent {
@Input() buttons: IInputButtons;
constructor(
private router: Router
) { }
logout() {
localStorage.removeItem('token');
this.router.navigate(['/login']);
}
}
| gios/diploma-nets | src/app/shared/toolbar/toolbar.component.ts | TypeScript | bsd-3-clause | 479 | [
30522,
12324,
1063,
6922,
1010,
7953,
1065,
2013,
1005,
1030,
16108,
1013,
4563,
1005,
1025,
12324,
1063,
2799,
2099,
1065,
2013,
1005,
1030,
16108,
1013,
2799,
2099,
1005,
1025,
12324,
1063,
2462,
16275,
4904,
8569,
15474,
2015,
1065,
2013... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Globalization;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Diagnostics
{
internal sealed class DiagnosticData
{
public static readonly CultureInfo USCultureInfo = CultureInfo.GetCultureInfo("en-US");
public readonly string Id;
public readonly string Category;
public readonly string Message;
public readonly string Description;
public readonly string Title;
public readonly string HelpLink;
public readonly DiagnosticSeverity Severity;
public readonly DiagnosticSeverity DefaultSeverity;
public readonly bool IsEnabledByDefault;
public readonly int WarningLevel;
public readonly IReadOnlyList<string> CustomTags;
public readonly ImmutableDictionary<string, string> Properties;
public readonly string ENUMessageForBingSearch;
public readonly Workspace Workspace;
public readonly ProjectId ProjectId;
public readonly DocumentId DocumentId;
/// <summary>
/// Null if path is not mapped and <see cref="OriginalFilePath"/> contains the actual path.
/// Note that the value might be a relative path. In that case <see cref="OriginalFilePath"/> should be used
/// as a base path for path resolution.
/// </summary>
public readonly string MappedFilePath;
public readonly string OriginalFilePath;
public readonly int MappedStartLine;
public readonly int MappedStartColumn;
public readonly int MappedEndLine;
public readonly int MappedEndColumn;
public readonly int OriginalStartLine;
public readonly int OriginalStartColumn;
public readonly int OriginalEndLine;
public readonly int OriginalEndColumn;
// text can be either given or calculated from original line/column
private readonly TextSpan? _textSpan;
public DiagnosticData(
string id,
string category,
string message,
string enuMessageForBingSearch,
DiagnosticSeverity severity,
bool isEnabledByDefault,
int warningLevel,
Workspace workspace,
ProjectId projectId,
DocumentId documentId = null,
TextSpan? span = null,
string originalFilePath = null,
int originalStartLine = 0,
int originalStartColumn = 0,
int originalEndLine = 0,
int originalEndColumn = 0,
string title = null,
string description = null,
string helpLink = null) :
this(
id, category, message, enuMessageForBingSearch,
severity, severity, isEnabledByDefault, warningLevel,
ImmutableArray<string>.Empty, ImmutableDictionary<string, string>.Empty,
workspace, projectId, documentId, span,
null, originalStartLine, originalStartColumn, originalEndLine, originalEndColumn,
originalFilePath, originalStartLine, originalStartColumn, originalEndLine, originalEndColumn,
title, description, helpLink)
{
}
public DiagnosticData(
string id,
string category,
string message,
string enuMessageForBingSearch,
DiagnosticSeverity severity,
DiagnosticSeverity defaultSeverity,
bool isEnabledByDefault,
int warningLevel,
IReadOnlyList<string> customTags,
ImmutableDictionary<string, string> properties,
Workspace workspace,
ProjectId projectId,
DocumentId documentId = null,
TextSpan? span = null,
string mappedFilePath = null,
int mappedStartLine = 0,
int mappedStartColumn = 0,
int mappedEndLine = 0,
int mappedEndColumn = 0,
string originalFilePath = null,
int originalStartLine = 0,
int originalStartColumn = 0,
int originalEndLine = 0,
int originalEndColumn = 0,
string title = null,
string description = null,
string helpLink = null)
{
this.Id = id;
this.Category = category;
this.Message = message;
this.ENUMessageForBingSearch = enuMessageForBingSearch;
this.Severity = severity;
this.DefaultSeverity = defaultSeverity;
this.IsEnabledByDefault = isEnabledByDefault;
this.WarningLevel = warningLevel;
this.CustomTags = customTags;
this.Properties = properties;
this.Workspace = workspace;
this.ProjectId = projectId;
this.DocumentId = documentId;
this.MappedStartLine = mappedStartLine;
this.MappedStartColumn = mappedStartColumn;
this.MappedEndLine = mappedEndLine;
this.MappedEndColumn = mappedEndColumn;
this.MappedFilePath = mappedFilePath;
this.OriginalStartLine = originalStartLine;
this.OriginalStartColumn = originalStartColumn;
this.OriginalEndLine = originalEndLine;
this.OriginalEndColumn = originalEndColumn;
this.OriginalFilePath = originalFilePath;
_textSpan = span;
this.Title = title;
this.Description = description;
this.HelpLink = helpLink;
}
public bool HasTextSpan { get { return _textSpan.HasValue; } }
/// <summary>
/// return TextSpan if it exists, otherwise it will throw
///
/// some diagnostic data such as created from build will have original line/column but not text span
/// in those cases, use GetTextSpan method instead to calculate one from original line/column
/// </summary>
public TextSpan TextSpan { get { return _textSpan.Value; } }
public override bool Equals(object obj)
{
DiagnosticData other = obj as DiagnosticData;
if (other == null)
{
return false;
}
return Id == other.Id &&
Category == other.Category &&
Message == other.Message &&
Severity == other.Severity &&
WarningLevel == other.WarningLevel &&
ProjectId == other.ProjectId &&
DocumentId == other.DocumentId &&
OriginalStartLine == other.OriginalStartLine &&
OriginalStartColumn == other.OriginalStartColumn;
}
public override int GetHashCode()
{
return Hash.Combine(this.Id,
Hash.Combine(this.Category,
Hash.Combine(this.Message,
Hash.Combine(this.WarningLevel,
Hash.Combine(this.ProjectId,
Hash.Combine(this.DocumentId,
Hash.Combine(this.OriginalStartLine,
Hash.Combine(this.OriginalStartColumn, (int)this.Severity))))))));
}
public override string ToString()
{
return string.Format("{0} {1} {2} {3} {4} {5} ({5}, {6}) [original: {7} ({8}, {9})]",
Id,
Severity,
Message,
ProjectId,
MappedFilePath ?? "",
MappedStartLine,
MappedStartColumn,
OriginalFilePath ?? "",
OriginalStartLine,
OriginalStartColumn);
}
public Diagnostic ToDiagnostic(SyntaxTree tree)
{
var location = Location.None;
if (tree != null)
{
var span = _textSpan.HasValue ? _textSpan.Value : GetTextSpan(tree.GetText());
location = tree.GetLocation(span);
}
return Diagnostic.Create(this.Id, this.Category, this.Message, this.Severity, this.DefaultSeverity, this.IsEnabledByDefault, this.WarningLevel, this.Title, this.Description, this.HelpLink, location, customTags: this.CustomTags, properties: this.Properties);
}
public TextSpan GetExistingOrCalculatedTextSpan(SourceText text)
{
return _textSpan.HasValue ? _textSpan.Value : GetTextSpan(text);
}
public TextSpan GetTextSpan(SourceText text)
{
var lines = text.Lines;
if (lines.Count == 0)
{
return default(TextSpan);
}
if (this.OriginalStartLine >= lines.Count)
{
return new TextSpan(text.Length, 0);
}
int startLine, startColumn, endLine, endColumn;
AdjustBoundaries(lines, out startLine, out startColumn, out endLine, out endColumn);
var startLinePosition = new LinePosition(startLine, startColumn);
var endLinePosition = new LinePosition(endLine, endColumn);
SwapIfNeeded(ref startLinePosition, ref endLinePosition);
var span = text.Lines.GetTextSpan(new LinePositionSpan(startLinePosition, endLinePosition));
return TextSpan.FromBounds(Math.Min(Math.Max(span.Start, 0), text.Length), Math.Min(Math.Max(span.End, 0), text.Length));
}
private void AdjustBoundaries(
TextLineCollection lines, out int startLine, out int startColumn, out int endLine, out int endColumn)
{
startLine = this.OriginalStartLine;
startColumn = Math.Max(this.OriginalStartColumn, 0);
if (startLine < 0)
{
startLine = 0;
startColumn = 0;
}
endLine = this.OriginalEndLine;
endColumn = Math.Max(this.OriginalEndColumn, 0);
if (endLine < 0)
{
endLine = startLine;
endColumn = startColumn;
}
else if (endLine >= lines.Count)
{
endLine = lines.Count - 1;
endColumn = lines[endLine].EndIncludingLineBreak;
}
}
private static void SwapIfNeeded(ref LinePosition startLinePosition, ref LinePosition endLinePosition)
{
if (endLinePosition < startLinePosition)
{
var temp = startLinePosition;
startLinePosition = endLinePosition;
endLinePosition = temp;
}
}
public static DiagnosticData Create(Workspace workspace, Diagnostic diagnostic)
{
Contract.Requires(diagnostic.Location == null || !diagnostic.Location.IsInSource);
return new DiagnosticData(
diagnostic.Id,
diagnostic.Descriptor.Category,
diagnostic.GetMessage(CultureInfo.CurrentUICulture),
diagnostic.GetMessage(USCultureInfo), // We use the ENU version of the message for bing search.
diagnostic.Severity,
diagnostic.DefaultSeverity,
diagnostic.Descriptor.IsEnabledByDefault,
diagnostic.WarningLevel,
diagnostic.Descriptor.CustomTags.AsImmutableOrEmpty(),
diagnostic.Properties,
workspace,
projectId: null,
title: diagnostic.Descriptor.Title.ToString(CultureInfo.CurrentUICulture),
description: diagnostic.Descriptor.Description.ToString(CultureInfo.CurrentUICulture),
helpLink: diagnostic.Descriptor.HelpLinkUri);
}
public static DiagnosticData Create(Project project, Diagnostic diagnostic)
{
Contract.Requires(diagnostic.Location == null || !diagnostic.Location.IsInSource);
return new DiagnosticData(
diagnostic.Id,
diagnostic.Descriptor.Category,
diagnostic.GetMessage(CultureInfo.CurrentUICulture),
diagnostic.GetMessage(USCultureInfo), // We use the ENU version of the message for bing search.
diagnostic.Severity,
diagnostic.DefaultSeverity,
diagnostic.Descriptor.IsEnabledByDefault,
diagnostic.WarningLevel,
diagnostic.Descriptor.CustomTags.AsImmutableOrEmpty(),
diagnostic.Properties,
project.Solution.Workspace,
project.Id,
title: diagnostic.Descriptor.Title.ToString(CultureInfo.CurrentUICulture),
description: diagnostic.Descriptor.Description.ToString(CultureInfo.CurrentUICulture),
helpLink: diagnostic.Descriptor.HelpLinkUri);
}
public static DiagnosticData Create(Document document, Diagnostic diagnostic)
{
var location = diagnostic.Location;
TextSpan sourceSpan;
FileLinePositionSpan mappedLineInfo;
FileLinePositionSpan originalLineInfo;
GetLocationInfo(document, location, out sourceSpan, out originalLineInfo, out mappedLineInfo);
var mappedStartLine = mappedLineInfo.StartLinePosition.Line;
var mappedStartColumn = mappedLineInfo.StartLinePosition.Character;
var mappedEndLine = mappedLineInfo.EndLinePosition.Line;
var mappedEndColumn = mappedLineInfo.EndLinePosition.Character;
var originalStartLine = originalLineInfo.StartLinePosition.Line;
var originalStartColumn = originalLineInfo.StartLinePosition.Character;
var originalEndLine = originalLineInfo.EndLinePosition.Line;
var originalEndColumn = originalLineInfo.EndLinePosition.Character;
return new DiagnosticData(
diagnostic.Id,
diagnostic.Descriptor.Category,
diagnostic.GetMessage(CultureInfo.CurrentUICulture),
diagnostic.GetMessage(USCultureInfo), // We use the ENU version of the message for bing search.
diagnostic.Severity,
diagnostic.DefaultSeverity,
diagnostic.Descriptor.IsEnabledByDefault,
diagnostic.WarningLevel,
diagnostic.Descriptor.CustomTags.AsImmutableOrEmpty(),
diagnostic.Properties,
document.Project.Solution.Workspace,
document.Project.Id,
document.Id,
sourceSpan,
mappedLineInfo.GetMappedFilePathIfExist(),
mappedStartLine,
mappedStartColumn,
mappedEndLine,
mappedEndColumn,
originalLineInfo.Path,
originalStartLine,
originalStartColumn,
originalEndLine,
originalEndColumn,
title: diagnostic.Descriptor.Title.ToString(CultureInfo.CurrentUICulture),
description: diagnostic.Descriptor.Description.ToString(CultureInfo.CurrentUICulture),
helpLink: diagnostic.Descriptor.HelpLinkUri);
}
private static void GetLocationInfo(Document document, Location location, out TextSpan sourceSpan, out FileLinePositionSpan originalLineInfo, out FileLinePositionSpan mappedLineInfo)
{
var diagnosticSpanMappingService = document.Project.Solution.Workspace.Services.GetService<IWorkspaceVenusSpanMappingService>();
if (diagnosticSpanMappingService != null)
{
diagnosticSpanMappingService.GetAdjustedDiagnosticSpan(document.Id, location, out sourceSpan, out originalLineInfo, out mappedLineInfo);
return;
}
sourceSpan = location.SourceSpan;
originalLineInfo = location.GetLineSpan();
mappedLineInfo = location.GetMappedLineSpan();
}
}
}
| marksantos/roslyn | src/Features/Core/Diagnostics/DiagnosticData.cs | C# | apache-2.0 | 16,346 | [
30522,
1013,
1013,
9385,
30524,
7117,
2005,
6105,
2592,
1012,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
6407,
1012,
10047,
28120,
3085,
1025,
2478,
2291,
1012,
24370,
1025,
2478,
7513,
1012,
3642,
25902,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"25080570","logradouro":"Rua Barbosa Ara\u00fajo","bairro":"Parque Felicidade","cidade":"Duque de Caxias","uf":"RJ","estado":"Rio de Janeiro"});
| lfreneda/cepdb | api/v1/25080570.jsonp.js | JavaScript | cc0-1.0 | 158 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
5539,
17914,
28311,
2692,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
21766,
2050,
3347,
15853,
2050,
19027,
1032,
1057,
8889,
7011,
5558,
1000,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*
* The Apereo Foundation licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.unitime.timetable.reports;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.unitime.timetable.reports.AbstractReport.Line;
import org.unitime.timetable.util.Constants;
import org.unitime.timetable.util.PdfFont;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
/**
* @author Tomas Muller
*/
public class PdfLegacyReport implements ReportWriter {
protected int iNrChars = 133;
protected int iNrLines = 50;
private OutputStream iOut = null;
private Document iDoc = null;
private StringBuffer iBuffer = new StringBuffer();
private PrintWriter iPrint = null;
private String iTitle, iTitle2, iSubject;
private String iSession;
private int iPageNo = 0;
private int iLineNo = 0;
private String iPageId = null;
private String iCont = null;
private String iHeader[] = null;
private String iFooter = null;
private Line iHeaderLine[] = null;
private int iMode = sModeNormal;
private Listener iListner;
private boolean iEmpty = true;
public static final int sModeNormal = 0;
public static final int sModeLedger = 1;
public static final int sModeText = 2;
public PdfLegacyReport(int mode, File file, String title, String title2, String subject, String session) throws IOException, DocumentException{
iTitle = title;
iTitle2 = title2;
iSubject = subject;
iSession = session;
iMode = mode;
if (file!=null) open(new FileOutputStream(file));
}
public PdfLegacyReport(int mode, OutputStream out, String title, String title2, String subject, String session) throws IOException, DocumentException{
iTitle = title;
iTitle2 = title2;
iSubject = subject;
iSession = session;
iMode = mode;
if (out!=null) open(out);
}
public void open(File file, int mode) throws DocumentException, IOException {
iMode = mode;
open(new FileOutputStream(file));
}
public void open(OutputStream out, int mode) throws DocumentException, IOException {
iMode = mode;
open(out);
}
public void open(OutputStream out) throws DocumentException, IOException {
iOut = out;
if (iMode==sModeText) {
iPrint = new PrintWriter(iOut);
} else {
iNrLines = (iMode==sModeLedger?116:50);
iDoc = new Document(iMode==sModeLedger?PageSize.LEDGER.rotate():PageSize.LETTER.rotate());
PdfWriter.getInstance(iDoc, iOut);
iDoc.addTitle(iTitle);
iDoc.addAuthor("UniTime "+Constants.getVersion()+", www.unitime.org");
iDoc.addSubject(iSubject);
iDoc.addCreator("UniTime "+Constants.getVersion()+", www.unitime.org");
iDoc.open();
}
iEmpty = true;
iPageNo = 0; iLineNo = 0;
}
@Override
public void setPageName(String pageName) {
iPageId = pageName;
}
@Override
public void setCont(String cont) {
iCont = cont;
}
public void setHeader(String[] header) {
iHeader = header;
}
@Override
public void setHeader(Line... line) {
iHeaderLine = line;
}
@Override
public Line[] getHeader() {
return iHeaderLine;
}
@Override
public void setFooter(String footer) {
iFooter = footer;
}
protected void out(String text) throws DocumentException {
if (iBuffer.length()>0) iBuffer.append("\n");
iBuffer.append(text);
}
protected static String rep(char ch, int cnt) {
String ret = "";
for (int i=0;i<cnt;i++) ret+=ch;
return ret;
}
protected void outln(char ch) throws DocumentException {
out(rep(ch,iNrChars));
}
public String lpad(String s, char ch, int len) {
if (s==null) s="";
if (s.length()>len) return s.substring(0,len);
while (s.length()<len) s = ch + s;
return s;
}
public String lpad(String s, int len) {
if (s==null) s="";
if (s.length()>len) return s.substring(0,len);
return lpad(s,' ',len);
}
protected String rpad(String s, char ch, int len) {
if (s==null) s="";
if (s.length()>len) return s.substring(0,len);
while (s.length()<len) s = s + ch;
return s;
}
public String rpad(String s, int len) {
if (s==null) s="";
if (s.length()>len) return s.substring(0,len);
return rpad(s,' ',len);
}
protected String mpad(String s, char ch, int len) {
if (s==null) s="";
if (s.length()>len) return s.substring(0,len);
while (s.length()<len)
if (s.length()%2==0) s = s + ch; else s = ch + s;
return s;
}
public String mpad(String s, int len) {
return mpad(s,' ',len);
}
protected String mpad(String s1, String s2, char ch, int len) {
String m = "";
while ((s1+m+s2).length()<len) m += ch;
return s1+m+s2;
}
protected String render(String line, String s, int idx) {
String a = (line.length()<=idx?rpad(line,' ',idx):line.substring(0,idx));
String b = (line.length()<=idx+s.length()?"":line.substring(idx+s.length()));
return a + s + b;
}
protected String renderMiddle(String line, String s) {
return render(line, s, (iNrChars - s.length())/2);
}
protected String renderEnd(String line, String s) {
return render(line, s, iNrChars-s.length());
}
public void printHeader() throws DocumentException {
printHeader(true);
}
public void printHeader(boolean newPage) throws DocumentException {
if (newPage) {
out(renderEnd(
renderMiddle("UniTime "+Constants.getVersion(),iTitle),
iTitle2));
out(mpad(
new SimpleDateFormat("EEE MMM dd, yyyy").format(new Date()),
iSession,' ',iNrChars));
outln('=');
iLineNo=0;
if (iCont!=null && iCont.length()>0)
println("("+iCont+" Continued)");
}
if (iHeader!=null) for (int i=0;i<iHeader.length;i++) println(iHeader[i]);
if (iHeaderLine != null) for (int i=0;i<iHeaderLine.length;i++) printLine(iHeaderLine[i]);
if (iListner != null) iListner.headerPrinted();
}
protected void printFooter() throws DocumentException {
iEmpty=false;
out("");
out(renderEnd(renderMiddle((iFooter==null?"":iFooter),"Page "+(iPageNo+1)),(iPageId==null||iPageId.length()==0?"":iPageId)+" "));
if (iPrint!=null) {
iPrint.print(iBuffer);
} else {
//FIXME: For some reason when a line starts with space, the line is shifted by one space in the resulting PDF (when using iText 5.0.2)
Paragraph p = new Paragraph(iBuffer.toString().replace("\n ", "\n "), PdfFont.getFixedFont());
p.setLeading(9.5f); //was 13.5f
iDoc.add(p);
}
iBuffer = new StringBuffer();
iPageNo++;
}
public void lastPage() throws DocumentException {
while (iLineNo<iNrLines) {
out(""); iLineNo++;
}
printFooter();
}
@Override
public void newPage() throws DocumentException {
while (iLineNo<iNrLines) {
out(""); iLineNo++;
}
printFooter();
if (iPrint!=null) {
iPrint.print("\f\n");
} else {
iDoc.newPage();
}
printHeader();
}
public int getLineNumber() {
return iLineNo;
}
public int getNrLinesPerPage() {
return iNrLines;
}
public void println(String text) throws DocumentException {
out(text);
iLineNo++;
if (iLineNo>=iNrLines) newPage();
}
public boolean isEmpty() {
return iEmpty;
}
public void close() throws IOException, DocumentException {
if (isEmpty()) { println("Nothing to report."); lastPage(); }
if (iPrint!=null) {
iPrint.flush(); iPrint.close();
} else {
iDoc.close();
iOut.close();
}
}
public int getNrCharsPerLine() {
return iNrChars;
}
@Override
public void printLine(Line line) throws DocumentException {
println(line.render());
}
@Override
public void printSeparator(Line line) throws DocumentException {
if (line != null) {
printLine(line);
} else {
if (iHeader != null && iHeader.length > 0)
println(iHeader[iHeader.length - 1]);
if (iHeaderLine != null && iHeaderLine.length > 0)
printLine(iHeaderLine[iHeaderLine.length - 1]);
}
}
@Override
public int getSeparatorNrLines() {
return 1;
}
@Override
public void setListener(Listener listener) {
iListner = listener;
}
@Override
public boolean isSkipRepeating() { return true; }
}
| UniTime/unitime | JavaSource/org/unitime/timetable/reports/PdfLegacyReport.java | Java | apache-2.0 | 10,138 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
23957,
2890,
2080,
3192,
2104,
2028,
2030,
2062,
12130,
6105,
1008,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
2023,
2147,
2005,
1008,
3176,
2592,
4953,
9385,
6095,
1012,
1008,
1008,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#define FSA9685_OPEN 0
#define FSA9685_USB1 1
#define FSA9685_USB2 2
#define FSA9685_MHL 4
#define FSA9685_USB1_ID_TO_IDBYPASS 1
struct switch_usb_info {
struct atomic_notifier_head charger_type_notifier_head;
spinlock_t reg_flag_lock;
};
extern int fsa9685_manual_sw(int input_select);
extern int fsa9685_manual_detach(void);
| gabry3795/android_kernel_huawei_mt7_l09 | drivers/huawei_platform/usb/switch/switch_usb_class.h | C | gpl-2.0 | 375 | [
30522,
1001,
9375,
1042,
3736,
2683,
2575,
27531,
1035,
2330,
1014,
1001,
9375,
1042,
3736,
2683,
2575,
27531,
1035,
18833,
2487,
1015,
1001,
9375,
1042,
3736,
2683,
2575,
27531,
1035,
18833,
2475,
1016,
1001,
9375,
1042,
3736,
2683,
2575,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Psychotria balfouriana Verdc. SPECIES
#### Status
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Gentianales/Rubiaceae/Psychotria/Psychotria balfouriana/README.md | Markdown | apache-2.0 | 187 | [
30522,
1001,
18224,
18886,
2050,
27560,
11410,
2310,
4103,
2278,
1012,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254,
2249,
1001,
1001,
1001,
1001,
2405,
1999,
19701,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import json
import os
import shutil
import tempfile
from unittest import TestCase
from transformers import BartTokenizer, BartTokenizerFast, DPRQuestionEncoderTokenizer, DPRQuestionEncoderTokenizerFast
from transformers.file_utils import is_datasets_available, is_faiss_available, is_torch_available
from transformers.models.bart.configuration_bart import BartConfig
from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES as DPR_VOCAB_FILES_NAMES
from transformers.models.dpr.configuration_dpr import DPRConfig
from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES as BART_VOCAB_FILES_NAMES
from transformers.testing_utils import require_faiss, require_tokenizers, require_torch, slow
if is_torch_available() and is_datasets_available() and is_faiss_available():
from transformers.models.rag.configuration_rag import RagConfig
from transformers.models.rag.tokenization_rag import RagTokenizer
@require_faiss
@require_torch
class RagTokenizerTest(TestCase):
def setUp(self):
self.tmpdirname = tempfile.mkdtemp()
self.retrieval_vector_size = 8
# DPR tok
vocab_tokens = [
"[UNK]",
"[CLS]",
"[SEP]",
"[PAD]",
"[MASK]",
"want",
"##want",
"##ed",
"wa",
"un",
"runn",
"##ing",
",",
"low",
"lowest",
]
dpr_tokenizer_path = os.path.join(self.tmpdirname, "dpr_tokenizer")
os.makedirs(dpr_tokenizer_path, exist_ok=True)
self.vocab_file = os.path.join(dpr_tokenizer_path, DPR_VOCAB_FILES_NAMES["vocab_file"])
with open(self.vocab_file, "w", encoding="utf-8") as vocab_writer:
vocab_writer.write("".join([x + "\n" for x in vocab_tokens]))
# BART tok
vocab = [
"l",
"o",
"w",
"e",
"r",
"s",
"t",
"i",
"d",
"n",
"\u0120",
"\u0120l",
"\u0120n",
"\u0120lo",
"\u0120low",
"er",
"\u0120lowest",
"\u0120newer",
"\u0120wider",
"<unk>",
]
vocab_tokens = dict(zip(vocab, range(len(vocab))))
merges = ["#version: 0.2", "\u0120 l", "\u0120l o", "\u0120lo w", "e r", ""]
self.special_tokens_map = {"unk_token": "<unk>"}
bart_tokenizer_path = os.path.join(self.tmpdirname, "bart_tokenizer")
os.makedirs(bart_tokenizer_path, exist_ok=True)
self.vocab_file = os.path.join(bart_tokenizer_path, BART_VOCAB_FILES_NAMES["vocab_file"])
self.merges_file = os.path.join(bart_tokenizer_path, BART_VOCAB_FILES_NAMES["merges_file"])
with open(self.vocab_file, "w", encoding="utf-8") as fp:
fp.write(json.dumps(vocab_tokens) + "\n")
with open(self.merges_file, "w", encoding="utf-8") as fp:
fp.write("\n".join(merges))
def get_dpr_tokenizer(self) -> DPRQuestionEncoderTokenizer:
return DPRQuestionEncoderTokenizer.from_pretrained(os.path.join(self.tmpdirname, "dpr_tokenizer"))
def get_bart_tokenizer(self) -> BartTokenizer:
return BartTokenizer.from_pretrained(os.path.join(self.tmpdirname, "bart_tokenizer"))
def tearDown(self):
shutil.rmtree(self.tmpdirname)
@require_tokenizers
def test_save_load_pretrained_with_saved_config(self):
save_dir = os.path.join(self.tmpdirname, "rag_tokenizer")
rag_config = RagConfig(question_encoder=DPRConfig().to_dict(), generator=BartConfig().to_dict())
rag_tokenizer = RagTokenizer(question_encoder=self.get_dpr_tokenizer(), generator=self.get_bart_tokenizer())
rag_config.save_pretrained(save_dir)
rag_tokenizer.save_pretrained(save_dir)
new_rag_tokenizer = RagTokenizer.from_pretrained(save_dir, config=rag_config)
self.assertIsInstance(new_rag_tokenizer.question_encoder, DPRQuestionEncoderTokenizerFast)
self.assertEqual(new_rag_tokenizer.question_encoder.get_vocab(), rag_tokenizer.question_encoder.get_vocab())
self.assertIsInstance(new_rag_tokenizer.generator, BartTokenizerFast)
self.assertEqual(new_rag_tokenizer.generator.get_vocab(), rag_tokenizer.generator.get_vocab())
@slow
def test_pretrained_token_nq_tokenizer(self):
tokenizer = RagTokenizer.from_pretrained("facebook/rag-token-nq")
input_strings = [
"who got the first nobel prize in physics",
"when is the next deadpool movie being released",
"which mode is used for short wave broadcast service",
"who is the owner of reading football club",
"when is the next scandal episode coming out",
"when is the last time the philadelphia won the superbowl",
"what is the most current adobe flash player version",
"how many episodes are there in dragon ball z",
"what is the first step in the evolution of the eye",
"where is gall bladder situated in human body",
"what is the main mineral in lithium batteries",
"who is the president of usa right now",
"where do the greasers live in the outsiders",
"panda is a national animal of which country",
"what is the name of manchester united stadium",
]
input_dict = tokenizer(input_strings)
self.assertIsNotNone(input_dict)
@slow
def test_pretrained_sequence_nq_tokenizer(self):
tokenizer = RagTokenizer.from_pretrained("facebook/rag-sequence-nq")
input_strings = [
"who got the first nobel prize in physics",
"when is the next deadpool movie being released",
"which mode is used for short wave broadcast service",
"who is the owner of reading football club",
"when is the next scandal episode coming out",
"when is the last time the philadelphia won the superbowl",
"what is the most current adobe flash player version",
"how many episodes are there in dragon ball z",
"what is the first step in the evolution of the eye",
"where is gall bladder situated in human body",
"what is the main mineral in lithium batteries",
"who is the president of usa right now",
"where do the greasers live in the outsiders",
"panda is a national animal of which country",
"what is the name of manchester united stadium",
]
input_dict = tokenizer(input_strings)
self.assertIsNotNone(input_dict)
| huggingface/transformers | tests/rag/test_tokenization_rag.py | Python | apache-2.0 | 7,364 | [
30522,
1001,
9385,
12609,
1996,
17662,
12172,
2136,
1012,
2035,
2916,
9235,
1012,
1001,
1001,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1001,
2017,
2089,
2025,
2224,
2023,
5371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//- Copyright © 2008-2011 8th Light, Inc. All Rights Reserved.
//- Limelight and all included source files are distributed under terms of the MIT License.
package limelight;
import limelight.util.Version;
public class About
{
public static Version version = new Version(0, 6, 19);
}
| slagyr/limelight | src/limelight/About.java | Java | mit | 289 | [
30522,
1013,
1013,
1011,
9385,
1075,
2263,
1011,
2249,
5893,
2422,
1010,
4297,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
1011,
14123,
7138,
1998,
2035,
2443,
3120,
6764,
2024,
5500,
2104,
3408,
1997,
1996,
10210,
6105,
1012,
7427,
14123,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require "mscorlib"
require "System.Reflection, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
require "System.Runtime.CompilerServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
require "System.Runtime.InteropServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
# General Information about an assembly is controlled through the following
# set of attributes. Change these attribute values to modify the information
# associated with an assembly.
"CodeBuilder.WinForm""CodeBuilder GUI""""www.dengzhiwei.com""CodeBuilder.WinForm""Copyright © Tom Deng 2009-2012"""""# Setting ComVisible to false makes the types in this assembly not visible
# to COM components. If you need to access a dbType in this assembly from
# COM, set the ComVisible attribute to true on that dbType.
false# The following GUID is for the ID of the typelib if this project is exposed to COM
"464a1f61-cccf-4327-9c40-6a90f2d10a76"# Version information for an assembly consists of the following four values:
#
# Major Version
# Minor Version
# Build Number
# Revision
#
# You can specify all the values or you can default the Build and Revision Numbers
# by using the '*' as shown below:
# [assembly: AssemblyVersion("1.0.*")]
"1.0.11.1210""1.0.11.1210" | xianrendzw/CodeBuilder.Ruby | CodeBuilder.WinForm/Properties/AssemblyInfo.rb | Ruby | mit | 1,320 | [
30522,
5478,
1000,
23794,
2953,
29521,
1000,
5478,
1000,
2291,
1012,
9185,
1010,
2544,
1027,
1016,
1012,
1014,
1012,
1014,
1012,
1014,
1010,
3226,
1027,
8699,
1010,
2270,
14839,
18715,
2368,
1027,
1038,
2692,
2509,
2546,
2629,
2546,
2581,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
(function () {
'use strict';
function foo () {
return embiggen( 6, 7 );
}
/**
* Embiggens a number
* @param {number} num - the number to embiggen
* @param {number} factor - the factor to embiggen it by
* @returns {number}
*/
function embiggen ( num, factor ) {
return num * factor;
}
alert( foo() );
}());
| corneliusweig/rollup | test/form/samples/block-comments/_expected/iife.js | JavaScript | mit | 331 | [
30522,
1006,
3853,
1006,
1007,
1063,
1005,
2224,
9384,
1005,
1025,
3853,
29379,
1006,
1007,
1063,
2709,
7861,
5638,
13871,
2368,
1006,
1020,
1010,
1021,
1007,
1025,
1065,
1013,
1008,
1008,
1008,
7861,
5638,
13871,
6132,
1037,
2193,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
declare(strict_types=1);
namespace Doctrine\ODM\MongoDB\Tests\Functional;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
use Doctrine\ODM\MongoDB\Tests\BaseTest;
use Documents\SchemaValidated;
use function MongoDB\BSON\fromJSON;
use function MongoDB\BSON\fromPHP;
use function MongoDB\BSON\toCanonicalExtendedJSON;
use function MongoDB\BSON\toPHP;
class ValidationTest extends BaseTest
{
public function testCreateUpdateValidatedDocument(): void
{
$this->requireVersion($this->getServerVersion(), '3.6.0', '<', 'MongoDB cannot perform JSON schema validation before version 3.6');
// Test creation of SchemaValidated collection
$cm = $this->dm->getClassMetadata(SchemaValidated::class);
$this->dm->getSchemaManager()->createDocumentCollection($cm->name);
$expectedValidatorJson = <<<'EOT'
{
"$jsonSchema": {
"required": ["name"],
"properties": {
"name": {
"bsonType": "string",
"description": "must be a string and is required"
}
}
},
"$or": [
{ "phone": { "$type": "string" } },
{ "email": { "$regex": { "$regularExpression" : { "pattern": "@mongodb\\.com$", "options": "" } } } },
{ "status": { "$in": [ "Unknown", "Incomplete" ] } }
]
}
EOT;
$expectedValidatorBson = fromJSON($expectedValidatorJson);
$expectedValidator = toPHP($expectedValidatorBson, []);
$expectedOptions = [
'validator' => $expectedValidator,
'validationLevel' => ClassMetadata::SCHEMA_VALIDATION_LEVEL_MODERATE,
'validationAction' => ClassMetadata::SCHEMA_VALIDATION_ACTION_WARN,
];
$expectedOptionsBson = fromPHP($expectedOptions);
$expectedOptionsJson = toCanonicalExtendedJSON($expectedOptionsBson);
$collections = $this->dm->getDocumentDatabase($cm->name)->listCollections();
$assertNb = 0;
foreach ($collections as $collection) {
if ($collection->getName() !== $cm->getCollection()) {
continue;
}
$assertNb++;
$collectionOptionsBson = fromPHP($collection->getOptions());
$collectionOptionsJson = toCanonicalExtendedJSON($collectionOptionsBson);
$this->assertJsonStringEqualsJsonString($expectedOptionsJson, $collectionOptionsJson);
}
$this->assertEquals(1, $assertNb);
// Test updating the same collection, this time removing the validators and resetting to default options
$cmUpdated = $this->dm->getClassMetadata(SchemaValidatedUpdate::class);
$this->dm->getSchemaManager()->updateDocumentValidator($cmUpdated->name);
// We expect the default values set by MongoDB
// See: https://docs.mongodb.com/manual/reference/command/collMod/#document-validation
$expectedOptions = [
'validationLevel' => ClassMetadata::SCHEMA_VALIDATION_LEVEL_STRICT,
'validationAction' => ClassMetadata::SCHEMA_VALIDATION_ACTION_ERROR,
];
$collections = $this->dm->getDocumentDatabase($cmUpdated->name)->listCollections();
$assertNb = 0;
foreach ($collections as $collection) {
if ($collection->getName() !== $cm->getCollection()) {
continue;
}
$assertNb++;
$this->assertEquals($expectedOptions, $collection->getOptions());
}
$this->assertEquals(1, $assertNb);
}
}
/**
* @ODM\Document(collection="SchemaValidated")
*/
class SchemaValidatedUpdate extends SchemaValidated
{
}
| doctrine/mongodb-odm | tests/Doctrine/ODM/MongoDB/Tests/Functional/ValidationTest.php | PHP | mit | 3,718 | [
30522,
1026,
1029,
25718,
13520,
1006,
9384,
1035,
4127,
1027,
1015,
1007,
1025,
3415,
15327,
8998,
1032,
1051,
22117,
1032,
12256,
3995,
18939,
1032,
5852,
1032,
8360,
1025,
2224,
8998,
1032,
1051,
22117,
1032,
12256,
3995,
18939,
1032,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
$_lang['mail_err_address_ns'] = 'Для отправки письма вы должны предоставить электронный почтовый адрес получателя.';
$_lang['mail_err_derive_getmailer'] = 'Произошла попытка вызова абстрактного метода _getMailer() в классе modMail. Вы должны переопределить этот метод в наследуемом классе.';
$_lang['mail_err_attr_nv'] = '[[+attr]] это неправильный атрибут класса PHPMailer и будет игнорирован системой.';
$_lang['mail_err_unset_spec'] = 'класс modPHPMailer не поддерживает отмену отправки по некоторым адресам. Используйте метод reset() для очистки всех получателей и после этого добавьте нужных получателей снова.'; | yenbekbay/clinic | core/lexicon/ru/mail.inc.php | PHP | mit | 976 | [
30522,
1026,
1029,
25718,
1002,
1035,
11374,
1031,
1005,
5653,
1035,
9413,
2099,
1035,
4769,
1035,
24978,
1005,
1033,
1027,
1005,
1184,
29436,
17432,
1193,
22919,
29746,
16856,
10260,
25529,
23925,
10325,
1194,
10325,
29747,
23742,
29745,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.getroadmap.r2rlib.models;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
* Created by jan on 28/08/2017.
* test dayflag bitwise and operator
*/
public class DayFlagsTest {
@Test
public void isSunday() throws Exception {
DayFlags dayFlags = new DayFlags(DayFlags.Companion.getSUNDAY());
assertThat(dayFlags.isDay(DayFlags.Companion.getSUNDAY()), is(true));
}
@Test
public void isWeekday() throws Exception {
DayFlags dayFlags = new DayFlags(DayFlags.Companion.getWEEKDAYS());
assertThat(dayFlags.isDay(DayFlags.Companion.getFRIDAY()), is(true));
}
@Test
public void isNotWeekday() throws Exception {
DayFlags dayFlags = new DayFlags(DayFlags.Companion.getWEEKDAYS());
assertThat(dayFlags.isDay(DayFlags.Companion.getSUNDAY()), is(false));
}
@Test
public void isWeekend() throws Exception {
DayFlags dayFlags = new DayFlags(DayFlags.Companion.getWEEKENDS());
assertThat(dayFlags.isDay(DayFlags.Companion.getSATURDAY()), is(true));
}
@Test
public void isNotWeekend() throws Exception {
DayFlags dayFlags = new DayFlags(DayFlags.Companion.getWEEKENDS());
assertThat(dayFlags.isDay(DayFlags.Companion.getTHURSDAY()), is(false));
}
@Test
public void isAlways() throws Exception {
DayFlags dayFlags = new DayFlags(DayFlags.Companion.getEVERYDAY());
assertThat(dayFlags.isDay(DayFlags.Companion.getSATURDAY()), is(true));
}
@Test
public void isAlwaysWeekend() throws Exception {
DayFlags dayFlags = new DayFlags(DayFlags.Companion.getEVERYDAY());
assertThat(dayFlags.isDay(DayFlags.Companion.getWEEKENDS()), is(true));
}
@Test
public void isNever() throws Exception {
DayFlags dayFlags = new DayFlags(DayFlags.Companion.getNEVER());
assertThat(dayFlags.isDay(DayFlags.Companion.getSATURDAY()), is(false));
}
} | roadmaptravel/Rome2RioAndroid | library/src/test/java/com/getroadmap/r2rlib/models/DayFlagsTest.java | Java | apache-2.0 | 2,022 | [
30522,
7427,
4012,
1012,
2131,
3217,
4215,
2863,
2361,
1012,
1054,
2475,
12190,
12322,
1012,
4275,
1025,
12324,
8917,
1012,
12022,
4183,
1012,
3231,
1025,
12324,
10763,
8917,
1012,
10654,
25313,
1012,
4563,
1012,
2003,
1012,
2003,
1025,
123... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
* under the License.
*/
package org.apache.fontbox.cff.charset;
/**
* This is specialized CFFCharset. It's used if the CharsetId of a font is set to 1.
*
* @author Villu Ruusmann
* @version $Revision$
*/
public class CFFExpertCharset extends CFFCharset {
private CFFExpertCharset() {
}
/**
* Returns an instance of the CFFExpertCharset class.
*
* @return an instance of CFFExpertCharset
*/
public static CFFExpertCharset getInstance() {
return CFFExpertCharset.INSTANCE;
}
private static final CFFExpertCharset INSTANCE = new CFFExpertCharset();
static {
INSTANCE.register(1, "space");
INSTANCE.register(13, "comma");
INSTANCE.register(14, "hyphen");
INSTANCE.register(15, "period");
INSTANCE.register(27, "colon");
INSTANCE.register(28, "semicolon");
INSTANCE.register(99, "fraction");
INSTANCE.register(109, "fi");
INSTANCE.register(110, "fl");
INSTANCE.register(150, "onesuperior");
INSTANCE.register(155, "onehalf");
INSTANCE.register(158, "onequarter");
INSTANCE.register(163, "threequarters");
INSTANCE.register(164, "twosuperior");
INSTANCE.register(169, "threesuperior");
INSTANCE.register(229, "exclamsmall");
INSTANCE.register(230, "Hungarumlautsmall");
INSTANCE.register(231, "dollaroldstyle");
INSTANCE.register(232, "dollarsuperior");
INSTANCE.register(233, "ampersandsmall");
INSTANCE.register(234, "Acutesmall");
INSTANCE.register(235, "parenleftsuperior");
INSTANCE.register(236, "parenrightsuperior");
INSTANCE.register(237, "twodotenleader");
INSTANCE.register(238, "onedotenleader");
INSTANCE.register(239, "zerooldstyle");
INSTANCE.register(240, "oneoldstyle");
INSTANCE.register(241, "twooldstyle");
INSTANCE.register(242, "threeoldstyle");
INSTANCE.register(243, "fouroldstyle");
INSTANCE.register(244, "fiveoldstyle");
INSTANCE.register(245, "sixoldstyle");
INSTANCE.register(246, "sevenoldstyle");
INSTANCE.register(247, "eightoldstyle");
INSTANCE.register(248, "nineoldstyle");
INSTANCE.register(249, "commasuperior");
INSTANCE.register(250, "threequartersemdash");
INSTANCE.register(251, "periodsuperior");
INSTANCE.register(252, "questionsmall");
INSTANCE.register(253, "asuperior");
INSTANCE.register(254, "bsuperior");
INSTANCE.register(255, "centsuperior");
INSTANCE.register(256, "dsuperior");
INSTANCE.register(257, "esuperior");
INSTANCE.register(258, "isuperior");
INSTANCE.register(259, "lsuperior");
INSTANCE.register(260, "msuperior");
INSTANCE.register(261, "nsuperior");
INSTANCE.register(262, "osuperior");
INSTANCE.register(263, "rsuperior");
INSTANCE.register(264, "ssuperior");
INSTANCE.register(265, "tsuperior");
INSTANCE.register(266, "ff");
INSTANCE.register(267, "ffi");
INSTANCE.register(268, "ffl");
INSTANCE.register(269, "parenleftinferior");
INSTANCE.register(270, "parenrightinferior");
INSTANCE.register(271, "Circumflexsmall");
INSTANCE.register(272, "hyphensuperior");
INSTANCE.register(273, "Gravesmall");
INSTANCE.register(274, "Asmall");
INSTANCE.register(275, "Bsmall");
INSTANCE.register(276, "Csmall");
INSTANCE.register(277, "Dsmall");
INSTANCE.register(278, "Esmall");
INSTANCE.register(279, "Fsmall");
INSTANCE.register(280, "Gsmall");
INSTANCE.register(281, "Hsmall");
INSTANCE.register(282, "Ismall");
INSTANCE.register(283, "Jsmall");
INSTANCE.register(284, "Ksmall");
INSTANCE.register(285, "Lsmall");
INSTANCE.register(286, "Msmall");
INSTANCE.register(287, "Nsmall");
INSTANCE.register(288, "Osmall");
INSTANCE.register(289, "Psmall");
INSTANCE.register(290, "Qsmall");
INSTANCE.register(291, "Rsmall");
INSTANCE.register(292, "Ssmall");
INSTANCE.register(293, "Tsmall");
INSTANCE.register(294, "Usmall");
INSTANCE.register(295, "Vsmall");
INSTANCE.register(296, "Wsmall");
INSTANCE.register(297, "Xsmall");
INSTANCE.register(298, "Ysmall");
INSTANCE.register(299, "Zsmall");
INSTANCE.register(300, "colonmonetary");
INSTANCE.register(301, "onefitted");
INSTANCE.register(302, "rupiah");
INSTANCE.register(303, "Tildesmall");
INSTANCE.register(304, "exclamdownsmall");
INSTANCE.register(305, "centoldstyle");
INSTANCE.register(306, "Lslashsmall");
INSTANCE.register(307, "Scaronsmall");
INSTANCE.register(308, "Zcaronsmall");
INSTANCE.register(309, "Dieresissmall");
INSTANCE.register(310, "Brevesmall");
INSTANCE.register(311, "Caronsmall");
INSTANCE.register(312, "Dotaccentsmall");
INSTANCE.register(313, "Macronsmall");
INSTANCE.register(314, "figuredash");
INSTANCE.register(315, "hypheninferior");
INSTANCE.register(316, "Ogoneksmall");
INSTANCE.register(317, "Ringsmall");
INSTANCE.register(318, "Cedillasmall");
INSTANCE.register(319, "questiondownsmall");
INSTANCE.register(320, "oneeighth");
INSTANCE.register(321, "threeeighths");
INSTANCE.register(322, "fiveeighths");
INSTANCE.register(323, "seveneighths");
INSTANCE.register(324, "onethird");
INSTANCE.register(325, "twothirds");
INSTANCE.register(326, "zerosuperior");
INSTANCE.register(327, "foursuperior");
INSTANCE.register(328, "fivesuperior");
INSTANCE.register(329, "sixsuperior");
INSTANCE.register(330, "sevensuperior");
INSTANCE.register(331, "eightsuperior");
INSTANCE.register(332, "ninesuperior");
INSTANCE.register(333, "zeroinferior");
INSTANCE.register(334, "oneinferior");
INSTANCE.register(335, "twoinferior");
INSTANCE.register(336, "threeinferior");
INSTANCE.register(337, "fourinferior");
INSTANCE.register(338, "fiveinferior");
INSTANCE.register(339, "sixinferior");
INSTANCE.register(340, "seveninferior");
INSTANCE.register(341, "eightinferior");
INSTANCE.register(342, "nineinferior");
INSTANCE.register(343, "centinferior");
INSTANCE.register(344, "dollarinferior");
INSTANCE.register(345, "periodinferior");
INSTANCE.register(346, "commainferior");
INSTANCE.register(347, "Agravesmall");
INSTANCE.register(348, "Aacutesmall");
INSTANCE.register(349, "Acircumflexsmall");
INSTANCE.register(350, "Atildesmall");
INSTANCE.register(351, "Adieresissmall");
INSTANCE.register(352, "Aringsmall");
INSTANCE.register(353, "AEsmall");
INSTANCE.register(354, "Ccedillasmall");
INSTANCE.register(355, "Egravesmall");
INSTANCE.register(356, "Eacutesmall");
INSTANCE.register(357, "Ecircumflexsmall");
INSTANCE.register(358, "Edieresissmall");
INSTANCE.register(359, "Igravesmall");
INSTANCE.register(360, "Iacutesmall");
INSTANCE.register(361, "Icircumflexsmall");
INSTANCE.register(362, "Idieresissmall");
INSTANCE.register(363, "Ethsmall");
INSTANCE.register(364, "Ntildesmall");
INSTANCE.register(365, "Ogravesmall");
INSTANCE.register(366, "Oacutesmall");
INSTANCE.register(367, "Ocircumflexsmall");
INSTANCE.register(368, "Otildesmall");
INSTANCE.register(369, "Odieresissmall");
INSTANCE.register(370, "OEsmall");
INSTANCE.register(371, "Oslashsmall");
INSTANCE.register(372, "Ugravesmall");
INSTANCE.register(373, "Uacutesmall");
INSTANCE.register(374, "Ucircumflexsmall");
INSTANCE.register(375, "Udieresissmall");
INSTANCE.register(376, "Yacutesmall");
INSTANCE.register(377, "Thornsmall");
INSTANCE.register(378, "Ydieresissmall");
}
} | sencko/NALB | nalb2013/src/org/apache/fontbox/cff/charset/CFFExpertCharset.java | Java | gpl-2.0 | 8,359 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
2023,
2147,
1008,
2005,
3176,
2592,
4953,
9385,
6095,
1012,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.ap.straight.unsupported;
import java.sql.*;
import java.sql.ResultSet;
public abstract class AbstractStatement implements Statement {
public int getResultSetHoldability() throws SQLException {
throw new UnsupportedOperationException();
}
public boolean getMoreResults(int current) throws SQLException {
throw new UnsupportedOperationException();
}
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
throw new UnsupportedOperationException();
}
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
throw new UnsupportedOperationException();
}
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
throw new UnsupportedOperationException();
}
public boolean execute(String sql, int[] columnIndexes) throws SQLException {
throw new UnsupportedOperationException();
}
public java.sql.ResultSet getGeneratedKeys() throws SQLException {
throw new UnsupportedOperationException();
}
public int executeUpdate(String sql, String[] columnNames) throws SQLException {
throw new UnsupportedOperationException();
}
public boolean execute(String sql, String[] columnNames) throws SQLException {
throw new UnsupportedOperationException();
}
public boolean isClosed() throws SQLException {
throw new UnsupportedOperationException();
}
public void setPoolable(boolean poolable) throws SQLException {
throw new UnsupportedOperationException();
}
public boolean isPoolable() throws SQLException {
throw new UnsupportedOperationException();
}
public void closeOnCompletion() throws SQLException {
throw new UnsupportedOperationException();
}
public boolean isCloseOnCompletion() throws SQLException {
throw new UnsupportedOperationException();
}
}
| jeanlazarou/straight | src/com/ap/straight/unsupported/AbstractStatement.java | Java | bsd-3-clause | 1,965 | [
30522,
7427,
4012,
1012,
9706,
1012,
3442,
1012,
4895,
6342,
9397,
15613,
1025,
12324,
9262,
1012,
29296,
1012,
1008,
1025,
12324,
9262,
1012,
29296,
1012,
3463,
3388,
1025,
2270,
10061,
2465,
29474,
12259,
30524,
11618,
29296,
10288,
24422,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
;(function () {
'use strict';
angular.module('angularGAPI')
.factory('User', ['GAPI', userFact]);
function userFact(GAPI) {
var User = new GAPI('plus', 'v1', {});
User.getUserInfo = function(params) {
return User.get('people', 'me', undefined, params);
};
return User;
}
})();
| Quivr/angular-GAPI | lib/plugin/gapi.user.factory.js | JavaScript | mit | 314 | [
30522,
1025,
1006,
3853,
1006,
1007,
1063,
1005,
2224,
9384,
1005,
1025,
16108,
1012,
11336,
1006,
1005,
16108,
3654,
8197,
1005,
1007,
1012,
4713,
1006,
1005,
5310,
1005,
1010,
1031,
1005,
6578,
2072,
1005,
1010,
5310,
7011,
6593,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Masdevallia torta Rchb.f. SPECIES
#### Status
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Masdevallia/Masdevallia torta/README.md | Markdown | apache-2.0 | 183 | [
30522,
1001,
16137,
24844,
8095,
2401,
17153,
2696,
22110,
2232,
2497,
1012,
1042,
1012,
2427,
1001,
1001,
1001,
1001,
3570,
3970,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254,
2249,
1001,
1001,
1001,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
namespace Twilio.Pricing
{
/// <summary>
/// Represents Twilio Messaging pricing country.
/// </summary>
public class Country : TwilioBase
{
/// <summary>
/// The full name of the country.
/// </summary>
/// <value>Country name.</value>
public string Country { get; set; }
/// <summary>
/// The abbreviated country identifier according to ISO 3166-1 alpha-2,
/// e.g. "US" for United States or "GB" for Great Britain.
/// </summary>
/// <value>Two-letter ISO country abbreviation.</value>
public string IsoCountry { get; set; }
/// <summary>
/// The Absolute Url of the country.
/// </summary>
/// <value>Absolute country Url.</value>
public string Url { get; set; }
}
}
| mplacona/twilio-csharp | src/Twilio.Pricing/Model/Country.cs | C# | apache-2.0 | 876 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
3415,
15327,
1056,
29602,
3695,
1012,
20874,
1063,
1013,
1013,
1013,
1026,
12654,
1028,
1013,
1013,
1013,
5836,
1056,
29602,
3695,
24732,
20874,
2406,
1012,
1013,
1013,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package fredboat.util.rest;
import fredboat.util.rest.models.weather.RetrievedWeather;
import javax.annotation.Nonnull;
/**
* Interface for the command class to call the model to get different
* implementation(s) of weather provider.
* <p>
* To add other provider, just implement this interface for their data model.
*/
public interface Weather {
/**
* Get current weather by the city.
*
* @param query Query for querying the weather.
* @return Weather object that contains information from the query.
* @throws APILimitException If the API rate has been exceeded.
*/
RetrievedWeather getCurrentWeatherByCity(@Nonnull String query) throws APILimitException;
}
| napstr/FredBoat | FredBoat/src/main/java/fredboat/util/rest/Weather.java | Java | mit | 706 | [
30522,
7427,
5965,
11975,
1012,
21183,
4014,
1012,
2717,
1025,
12324,
5965,
11975,
1012,
21183,
4014,
1012,
2717,
1012,
4275,
1012,
4633,
1012,
5140,
28949,
1025,
12324,
9262,
2595,
1012,
5754,
17287,
3508,
1012,
2512,
11231,
3363,
1025,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System.Threading.Tasks;
using OrchardCore.Deployment;
using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.DisplayManagement.ModelBinding;
using OrchardCore.DisplayManagement.Views;
using OrchardCore.Templates.ViewModels;
namespace OrchardCore.Templates.Deployment
{
public class AllAdminTemplatesDeploymentStepDriver : DisplayDriver<DeploymentStep, AllAdminTemplatesDeploymentStep>
{
public override IDisplayResult Display(AllAdminTemplatesDeploymentStep step)
{
return
Combine(
View("AllAdminTemplatesDeploymentStep_Summary", step).Location("Summary", "Content"),
View("AllAdminTemplatesDeploymentStep_Thumbnail", step).Location("Thumbnail", "Content")
);
}
public override IDisplayResult Edit(AllAdminTemplatesDeploymentStep step)
{
return Initialize<AllAdminTemplatesDeploymentStepViewModel>("AllAdminTemplatesDeploymentStep_Fields_Edit", model => model.ExportAsFiles = step.ExportAsFiles).Location("Content");
}
public override async Task<IDisplayResult> UpdateAsync(AllAdminTemplatesDeploymentStep step, IUpdateModel updater)
{
await updater.TryUpdateModelAsync(step, Prefix, x => x.ExportAsFiles);
return Edit(step);
}
}
}
| xkproject/Orchard2 | src/OrchardCore.Modules/OrchardCore.Templates/Deployment/AllAdminTemplatesDeploymentStepDriver.cs | C# | bsd-3-clause | 1,354 | [
30522,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
2478,
15623,
17345,
1012,
10813,
1025,
2478,
15623,
17345,
1012,
4653,
24805,
20511,
1012,
28213,
2015,
1025,
2478,
15623,
17345,
1012,
4653,
24805,
20511,
1012,
2944,
8428,
4667,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?xml version="1.0" encoding="UTF-8" ?>
<!--
If you are working with a multi language form keep the order!
<option lang="de">Deutschland</option>
<option lang="de">Groß Britannien</option>
<option lang="en">Germany</option>
<option lang="en">United Kingdom</option>
If you don't keep the order and the user switches the country you
will have a wrong translation!
-->
<select_countries>
<option lang="de">Deutschland</option>
<option lang="de">Groß Britannien</option>
<option lang="de">Frankreich</option>
<option lang="de">Österreich</option>
<option lang="en">Germany</option>
<option lang="en">United Kingdom</option>
<option lang="en">France</option>
<option lang="en">Austria</option>
</select_countries> | bjoernmainz/simple-contact-form | config/select_countries.xml.php | PHP | gpl-2.0 | 755 | [
30522,
1026,
1029,
20950,
2544,
1027,
1000,
1015,
1012,
1014,
1000,
17181,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1029,
1028,
1026,
999,
1011,
1011,
2065,
2017,
2024,
2551,
2007,
1037,
4800,
2653,
2433,
2562,
1996,
2344,
999,
1026,
57... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 1995, David Greenman
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice unmodified, this list of conditions, and the following
* disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/dev/fxp/if_fxpvar.h,v 1.22 2002/11/07 16:04:07 iedowse Exp $
*/
/*
* Misc. defintions for the Intel EtherExpress Pro/100B PCI Fast
* Ethernet driver
*/
/*
* Number of transmit control blocks. This determines the number
* of transmit buffers that can be chained in the CB list.
* This must be a power of two.
*/
#define FXP_NTXCB 128
/*
* Number of completed TX commands at which point an interrupt
* will be generated to garbage collect the attached buffers.
* Must be at least one less than FXP_NTXCB, and should be
* enough less so that the transmitter doesn't becomes idle
* during the buffer rundown (which would reduce performance).
*/
#define FXP_CXINT_THRESH 120
/*
* TxCB list index mask. This is used to do list wrap-around.
*/
#define FXP_TXCB_MASK (FXP_NTXCB - 1)
/*
* Number of receive frame area buffers. These are large so chose
* wisely.
*/
#ifdef DEVICE_POLLING
#define FXP_NRFABUFS 192
#else
#define FXP_NRFABUFS 64
#endif
/*
* Maximum number of seconds that the receiver can be idle before we
* assume it's dead and attempt to reset it by reprogramming the
* multicast filter. This is part of a work-around for a bug in the
* NIC. See fxp_stats_update().
*/
#define FXP_MAX_RX_IDLE 15
/*
* Default maximum time, in microseconds, that an interrupt may be delayed
* in an attempt to coalesce interrupts. This is only effective if the Intel
* microcode is loaded, and may be changed via either loader tunables or
* sysctl. See also the CPUSAVER_DWORD entry in rcvbundl.h.
*/
#define TUNABLE_INT_DELAY 1000
/*
* Default number of packets that will be bundled, before an interrupt is
* generated. This is only effective if the Intel microcode is loaded, and
* may be changed via either loader tunables or sysctl. This may not be
* present in all microcode revisions, see also the CPUSAVER_BUNDLE_MAX_DWORD
* entry in rcvbundl.h.
*/
#define TUNABLE_BUNDLE_MAX 6
#if __FreeBSD_version < 500000
#define FXP_LOCK(_sc)
#define FXP_UNLOCK(_sc)
#define mtx_init(a, b, c, d)
#define mtx_destroy(a)
struct mtx { int dummy; };
#else
#define FXP_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
#define FXP_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
#endif
#ifdef __alpha__
#undef vtophys
#define vtophys(va) alpha_XXX_dmamap((vm_offset_t)(va))
#endif /* __alpha__ */
/*
* NOTE: Elements are ordered for optimal cacheline behavior, and NOT
* for functional grouping.
*/
struct fxp_softc {
struct arpcom arpcom; /* per-interface network data */
struct resource *mem; /* resource descriptor for registers */
int rtp; /* register resource type */
int rgd; /* register descriptor in use */
struct resource *irq; /* resource descriptor for interrupt */
void *ih; /* interrupt handler cookie */
struct mtx sc_mtx;
bus_space_tag_t sc_st; /* bus space tag */
bus_space_handle_t sc_sh; /* bus space handle */
struct mbuf *rfa_headm; /* first mbuf in receive frame area */
struct mbuf *rfa_tailm; /* last mbuf in receive frame area */
struct fxp_cb_tx *cbl_first; /* first active TxCB in list */
int tx_queued; /* # of active TxCB's */
int need_mcsetup; /* multicast filter needs programming */
struct fxp_cb_tx *cbl_last; /* last active TxCB in list */
struct fxp_stats *fxp_stats; /* Pointer to interface stats */
int rx_idle_secs; /* # of seconds RX has been idle */
struct callout_handle stat_ch; /* Handle for canceling our stat timeout */
struct fxp_cb_tx *cbl_base; /* base of TxCB list */
struct fxp_cb_mcs *mcsp; /* Pointer to mcast setup descriptor */
struct ifmedia sc_media; /* media information */
device_t miibus;
device_t dev;
struct sysctl_ctx_list sysctl_ctx;
struct sysctl_oid *sysctl_tree;
int tunable_int_delay; /* interrupt delay value for ucode */
int tunable_bundle_max; /* max # frames per interrupt (ucode) */
int eeprom_size; /* size of serial EEPROM */
int suspended; /* 0 = normal 1 = suspended (APM) */
int cu_resume_bug;
int revision;
int flags;
u_int32_t saved_maps[5]; /* pci data */
u_int32_t saved_biosaddr;
u_int8_t saved_intline;
u_int8_t saved_cachelnsz;
u_int8_t saved_lattimer;
};
#define FXP_FLAG_MWI_ENABLE 0x0001 /* MWI enable */
#define FXP_FLAG_READ_ALIGN 0x0002 /* align read access with cacheline */
#define FXP_FLAG_WRITE_ALIGN 0x0004 /* end write on cacheline */
#define FXP_FLAG_EXT_TXCB 0x0008 /* enable use of extended TXCB */
#define FXP_FLAG_SERIAL_MEDIA 0x0010 /* 10Mbps serial interface */
#define FXP_FLAG_LONG_PKT_EN 0x0020 /* enable long packet reception */
#define FXP_FLAG_ALL_MCAST 0x0040 /* accept all multicast frames */
#define FXP_FLAG_CU_RESUME_BUG 0x0080 /* requires workaround for CU_RESUME */
#define FXP_FLAG_UCODE 0x0100 /* ucode is loaded */
#define FXP_FLAG_DEFERRED_RNR 0x0200 /* DEVICE_POLLING deferred RNR */
/* Macros to ease CSR access. */
#define CSR_READ_1(sc, reg) \
bus_space_read_1((sc)->sc_st, (sc)->sc_sh, (reg))
#define CSR_READ_2(sc, reg) \
bus_space_read_2((sc)->sc_st, (sc)->sc_sh, (reg))
#define CSR_READ_4(sc, reg) \
bus_space_read_4((sc)->sc_st, (sc)->sc_sh, (reg))
#define CSR_WRITE_1(sc, reg, val) \
bus_space_write_1((sc)->sc_st, (sc)->sc_sh, (reg), (val))
#define CSR_WRITE_2(sc, reg, val) \
bus_space_write_2((sc)->sc_st, (sc)->sc_sh, (reg), (val))
#define CSR_WRITE_4(sc, reg, val) \
bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val))
#define sc_if arpcom.ac_if
#define FXP_UNIT(_sc) (_sc)->arpcom.ac_if.if_unit
| MarginC/kame | freebsd5/sys/dev/fxp/if_fxpvar.h | C | bsd-3-clause | 6,902 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2786,
1010,
2585,
2665,
2386,
1008,
2035,
2916,
9235,
1012,
1008,
1008,
25707,
1998,
2224,
1999,
3120,
1998,
12441,
3596,
1010,
2007,
2030,
2302,
1008,
14080,
1010,
2024,
7936,
3024,
2008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import chainer
from chainer import backend
from chainer import utils
def sign(x):
"""Elementwise sign function.
For a given input :math:`x`, this function returns :math:`sgn(x)`
defined as
.. math::
sgn(x) = \\left \\{ \\begin{array}{cc}
-1 & {\\rm if~x < 0} \\\\
0 & {\\rm if~x = 0} \\\\
1 & {\\rm if~x > 0} \\\\
\\end{array} \\right.
.. note::
The gradient of this function is ``None`` everywhere and therefore
unchains the computational graph.
Args:
x (:class:`~chainer.Variable` or :ref:`ndarray`):
Input variable for which the sign is computed.
Returns:
~chainer.Variable: Output variable.
"""
if isinstance(x, chainer.variable.Variable):
x = x.array
xp = backend.get_array_module(x)
return chainer.as_variable(utils.force_array(xp.sign(x)))
| okuta/chainer | chainer/functions/math/sign.py | Python | mit | 893 | [
30522,
12324,
4677,
2121,
2013,
4677,
2121,
12324,
2067,
10497,
2013,
4677,
2121,
12324,
21183,
12146,
13366,
3696,
1006,
1060,
1007,
1024,
1000,
1000,
1000,
5783,
14244,
3696,
3853,
1012,
2005,
1037,
2445,
7953,
1024,
8785,
1024,
1036,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<div>
<h1 x-large class="sample-content">Your Content Here</h1>
<div *ngFor="let node of nodes">
<metadata [node]="node"></metadata>
</div>
<hr>
<div>
For hot module reloading run
<pre>npm run start:hmr</pre>
</div>
<hr>
<div>
<h4>Local State</h4>
<form (ngSubmit)="submitState(localState.value)" autocomplete="off">
<input
[value]="localState.value"
(input)="localState.value = $event.target.value"
placeholder="Submit Local State to App State"
autofocus>
<button>Submit Value</button>
</form>
<!--
<input type="text" [value]="localState.value" (input)="localState.value = $event.target.value" autofocus>
Rather than wiring up two-way data-binding ourselves with [value] and (input)
we can use Angular's [(ngModel)] syntax
<input type="text" name="textInput" [(ngModel)]="localState.value" autofocus>
-->
<pre>this.localState = {{ localState | json }}</pre>
</div>
</div>
| egucciar/angular2-webpack-starter-primeng-working | src/app/old-home/home.component.html | HTML | mit | 1,016 | [
30522,
1026,
4487,
2615,
1028,
1026,
1044,
2487,
1060,
1011,
2312,
2465,
1027,
1000,
7099,
1011,
4180,
1000,
1028,
2115,
4180,
2182,
1026,
1013,
1044,
2487,
1028,
1026,
4487,
2615,
1008,
12835,
29278,
1027,
1000,
2292,
13045,
1997,
14164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* rrdcached_tree.inc.php
*
* Generates a graph of the tree stats for rrdcached
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* @link https://www.librenms.org
*
* @copyright 2016 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
include 'rrdcached.inc.php';
$colours = 'blues';
$rrd_list = [
[
'ds' => 'tree_depth',
'filename' => $rrd_filename,
'descr' => 'Tree Depth',
],
[
'ds' => 'tree_nodes_number',
'filename' => $rrd_filename,
'descr' => 'Tree Nodes',
],
];
require 'includes/html/graphs/generic_multi.inc.php';
| arrmo/librenms | includes/html/graphs/application/rrdcached_tree.inc.php | PHP | gpl-3.0 | 1,228 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
25269,
16409,
15395,
2094,
1035,
3392,
1012,
4297,
1012,
25718,
1008,
1008,
19421,
1037,
10629,
1997,
1996,
3392,
26319,
2005,
25269,
16409,
15395,
2094,
1008,
1008,
2023,
2565,
2003,
2489,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) Under one or more
contributor license agreements. See the NOTICE file distributed with
this work for Additional information regarding copyright ownership.
The ASF licenses this file to You 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.
==================================================================== */
namespace AL.Utils.NPOI.SS.Formula.PTG
{
using System;
using System.Text;
using AL.Utils.NPOI.HSSF.Record;
using AL.Utils.NPOI.Util;
/**
* RefError - handles deleted cell reference
* @author Jason Height (jheight at chariot dot net dot au)
*/
public class RefErrorPtg : OperandPtg
{
private static int SIZE = 5;
public const byte sid = 0x2a;
private int field_1_reserved;
public RefErrorPtg()
{
field_1_reserved = 0;
}
public RefErrorPtg(ILittleEndianInput in1)
{
field_1_reserved = in1.ReadInt();
}
public override String ToString()
{
StringBuilder buffer = new StringBuilder("[RefError]\n");
buffer.Append("reserved = ").Append(Reserved).Append("\n");
return buffer.ToString();
}
public override void Write(ILittleEndianOutput out1)
{
out1.WriteByte(sid + PtgClass);
out1.WriteInt(field_1_reserved);
}
public int Reserved
{
get{return field_1_reserved;}
set { field_1_reserved = value; }
}
public override int Size
{
get { return SIZE; }
}
public override String ToFormulaString()
{
//TODO -- should we store a cellreference instance in this ptg?? but .. memory is an Issue, i believe!
return "#REF!";
}
public override byte DefaultOperandClass
{
get { return Ptg.CLASS_REF; }
}
}
} | alexchentao/AL.Web | AL.Utils/Document/Excel/NPOI/SS/Formula/PTG/RefErrorPtg.cs | C# | gpl-2.0 | 2,556 | [
30522,
1013,
1008,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
1027,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
/*
Sonic Visualiser
An audio file viewer and annotation editor.
Centre for Digital Music, Queen Mary, University of London.
This file copyright 2008 QMUL.
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. See the file
COPYING included with this distribution for more information.
*/
#ifndef _MODEL_DATA_TABLE_MODEL_H_
#define _MODEL_DATA_TABLE_MODEL_H_
#include <QAbstractItemModel>
#include <vector>
#include "PraalineCore/Base/BaseTypes.h"
class TabularModel;
class UndoableCommand;
class ModelDataTableModel : public QAbstractItemModel
{
Q_OBJECT
public:
ModelDataTableModel(TabularModel *m);
virtual ~ModelDataTableModel();
QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
bool insertRow(int row, const QModelIndex &parent = QModelIndex());
bool removeRow(int row, const QModelIndex &parent = QModelIndex());
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column,
const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QModelIndex getModelIndexForFrame(sv_frame_t frame) const;
sv_frame_t getFrameForModelIndex(const QModelIndex &) const;
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
QModelIndex findText(QString text) const;
void setCurrentRow(int row);
int getCurrentRow() const;
signals:
void frameSelected(int);
void addCommand(UndoableCommand *);
void currentChanged(const QModelIndex &);
void modelRemoved();
protected slots:
void modelChanged();
void modelChangedWithin(sv_frame_t, sv_frame_t);
void modelAboutToBeDeleted();
protected:
TabularModel *m_model;
int m_sortColumn;
Qt::SortOrder m_sortOrdering;
int m_currentRow;
typedef std::vector<int> RowList;
mutable RowList m_sort;
mutable RowList m_rsort;
int getSorted(int row) const;
int getUnsorted(int row) const;
void resort() const;
void resortNumeric() const;
void resortAlphabetical() const;
void clearSort();
};
#endif
| praaline/Praaline | svcore/data/model/ModelDataTableModel.h | C | gpl-3.0 | 2,739 | [
30522,
1013,
1008,
1011,
1008,
1011,
1039,
1011,
3937,
1011,
16396,
1024,
1018,
27427,
4765,
1011,
21628,
2015,
1011,
5549,
1024,
9152,
2140,
1011,
1008,
1011,
6819,
1024,
2275,
24529,
1027,
1022,
8541,
1027,
1018,
25430,
1027,
1018,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ClickCloud | Rapid deployment</title>
<link rel="stylesheet" type="text/css" href="static/styles/font-awesome.css" />
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="static/styles/font-awesome-ie7.min.css">
<![endif]-->
<link rel="stylesheet" type="text/css" href="static/styles/master.css" />
<link rel="stylesheet" type="text/css" href="static/styles/index.css" /><!-- Only Hadoop Install -->
<script type="text/javascript" src="static/scripts/jquery.js"></script>
<script type="text/javascript" src="static/scripts/click.js"></script>
<script type="text/javascript">
window.addEventListener('load', function () {
crumbsContent = crumbs([{ name: 'Home', url: 'index.html' }, { name: 'Hadoop', url: '' }]);
var crumbs_ = document.getElementById('crumbs');
if (!!crumbs_) {
crumbs_.insertAdjacentHTML('afterBegin', crumbsContent);
}
clickgo(document.getElementsByClassName('alert'));
clicktoggle(document.getElementById('_01'),
document.getElementById('_01_'));
clicktoggle(document.getElementById('_02'),
document.getElementById('_02_'));
clickfocus(document.getElementsByClassName('_focus_'));
__IFRAME__ = document.getElementById('iframe_just_me');
window.switch_ = function (flag) {
switch (flag) {
case 'clusters':
iframe_switch('My Cluster', '>> Cluster list', [
{ url: 'parts/clusters', d: {} },
]);
break;
case 'host-add':
iframe_switch('Add Host', '>> Register your machine to the system', [
{ url: 'parts/host-add', d: {} },
]);
break;
case 'hosts':
iframe_switch('My Hosts', '>> Registered host', [
{ url: 'parts/hosts', d: {} },
]);
break;
case 'dns':
iframe_switch('Domain Name System', '>> Configuration /etc/hosts', [
{ url: 'parts/dns', d: {} },
]);
break;
case 'hs':
iframe_switch('Install Hadoop and Spark Enviroment', '>> include HDFS and YARN cluster', [
{ url: 'parts/hs', d: {} },
]);
break;
}
}
});
</script>
</head>
<body>
<div class="row-head">
<div class="column-logo">
</div>
</div>
<div class="row-navigation">
<div class="column-icons">
</div>
<div class="column-crumbs">
<div class="crumbs" id="crumbs"></div>
</div>
</div>
<div class="row-main">
<div class="column-list">
<ul>
<li><a class="_focus_" href="javascript:void(0);"><i class="icon-dashboard icon-large"></i>Dashboard</a></li>
<li><a class="_focus_" href="javascript:switch_('dns');"><i class="icon-book icon-large"></i>DNS</a></li>
<li>
<a id="_01" focus="1" href="javascript:void(0);"><i class="icon-book icon-large"></i>Hadoop</a>
<ul id="_01_">
<li><a class="_focus_" href="javascript:switch_('hs');">Install Hadoop and Spark</a></li>
</ul>
</li>
<li><a class="_focus_" href="javascript:void(0);"><i class="icon-tasks icon-large"></i>Tasks</a></li>
<li><a class="_focus_" href="javascript:void(0);"><i class="icon-bar-chart icon-large"></i>Monitor</a></li>
<li>
<a id="_02" focus="1" href="javascript:void(0);"><i class="icon-sitemap icon-large"></i>My Cluster</a>
<ul id="_02_">
<li><a class="_focus_" href="javascript:switch_('clusters');">Clusters</a></li>
<li><a class="_focus_" href="javascript:switch_('host-add');">Add Host</a></li>
<li><a class="_focus_" href="javascript:switch_('hosts');">Hosts</a></li>
</ul>
</li>
<li><a class="_focus_" href="javascript:void(0);"><i class="icon-lightbulb icon-large"></i>Issues</a></li>
<li><a class="_focus_" href="javascript:void(0);"><i class="icon-file icon-large"></i>Other Pages</a></li>
</ul>
</div>
<div class="column-board" id="board-main" style="display:none;">
<div class="title">
<span class="maintitle" id="board-main-title"></span>
<span class="subtitle" id="board-sub-title"></span>
</div>
<div class="alert">
<i class="icon-ok"></i> Welcome to use <b>ClickCloud</b> Deployment Service, the rapid deployment plan
</div>
<div id="iframe_just_me">
<!-- append to here-->
</div>
</div>
</div>
</body>
</html>
| codemeow5/deployment | web2/html/index.html | HTML | apache-2.0 | 5,598 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2013-2015 mogemimi.
// Distributed under the MIT license. See LICENSE.md file for details.
#include <Pomdog/Input/KeyboardState.hpp>
#include <Pomdog/Input/Keys.hpp>
#include <gtest/iutest_switch.hpp>
using Pomdog::KeyboardState;
using Pomdog::Keys;
using Pomdog::KeyState;
TEST(KeyboardState, KeysToInteger)
{
using std::uint32_t;
EXPECT_GT(128U, static_cast<uint32_t>(Keys::None));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::BackSpace));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::A));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Z));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Alpha0));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Alpha1));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Alpha9));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Keypad0));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Keypad1));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Keypad9));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::F1));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::F9));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::F10));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::F12));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::LeftAlt));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::RightAlt));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::LeftApple));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::RightApple));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::LeftWindows));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::RightWindows));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::IMEConvert));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::IMENoConvert));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::KanaMode));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::KanjiMode));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::HangulMode));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Comma));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Equals));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Semicolon));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Plus));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Period));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Slash));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Minus));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Question));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Quote));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::DoubleQuote));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::AccentGrave));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Backslash));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::Tilde));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::OpenBracket));
EXPECT_GT(128U, static_cast<uint32_t>(Keys::CloseBracket));
}
| bis83/pomdog | test/FrameworkTest/Input/KeyboardStateTest.cpp | C++ | mit | 2,720 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2286,
1011,
2325,
9587,
3351,
4328,
4328,
1012,
1013,
1013,
5500,
2104,
1996,
10210,
6105,
1012,
2156,
6105,
1012,
9108,
5371,
2005,
4751,
1012,
1001,
2421,
1026,
13433,
26876,
8649,
1013,
7953,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package saberapplications.pawpads.databinding;
import android.databinding.BaseObservable;
import android.databinding.BindingAdapter;
import android.databinding.BindingConversion;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import saberapplications.pawpads.R;
/**
* Created by Stanislav Volnjanskij on 25.08.16.
*/
public class BindableDouble extends BaseObservable {
private Double value;
private String format="%f";
public Double get() {
return value;
}
public void set(double value) {
if (this.value == null || !this.value.equals(value)) {
this.value = value;
notifyChange();
}
}
public void setSilent(double value) {
if (this.value == null || !this.value.equals(value)) {
this.value = value;
}
}
public BindableDouble(double value) {
super();
this.value = value;
}
public BindableDouble() {
super();
}
@BindingConversion
public static String convertIntegerToString(BindableDouble value) {
if (value != null && value.get()!=null)
return String.format(value.getFormat(), value.get());
else {
return null;
}
}
@BindingAdapter({"binding2way"})
public static void bindEditText(EditText view,
final BindableDouble bindableDouble) {
if (view.getTag(R.id.BIND_ID) == null) {
view.setTag(R.id.BIND_ID, true);
view.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start,
int before, int count) {
try {
bindableDouble.setSilent(Double.parseDouble(s.toString()));
} catch (Exception e) {
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
//initial value
if (bindableDouble == null) return;
Double newValue = bindableDouble.get();
if (newValue == null) return;
String strValue= String.format(bindableDouble.getFormat(),newValue);
if (!view.getText().toString().equals(strValue) ) {
view.setText(strValue);
}
}
/**
* Number format to display in text field
* @return
*/
public String getFormat() {
return format;
}
/**
*Set number format to display in text field
* @param format
*/
public void setFormat(String format) {
this.format = format;
}
}
| castaway2000/Pawpads | app/src/main/java/saberapplications/pawpads/databinding/BindableDouble.java | Java | mit | 2,887 | [
30522,
7427,
25653,
29098,
19341,
9285,
1012,
22195,
15455,
2015,
1012,
2951,
8428,
4667,
1025,
12324,
11924,
1012,
2951,
8428,
4667,
1012,
2918,
16429,
8043,
12423,
1025,
12324,
11924,
1012,
2951,
8428,
4667,
1012,
8031,
8447,
13876,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package edu.itla.itlaracer.graphics;
import java.awt.Graphics;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
public class TrackLane extends JPanel{
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void paintComponent(Graphics g) {
ImageIcon image = new ImageIcon("track_lane.png");
super.setOpaque(false);
g.drawImage(image.getImage(), 0, 0, null);
super.paintComponent(g);
}
}
| raydelto/itla_racer | src/edu/itla/itlaracer/graphics/TrackLane.java | Java | gpl-3.0 | 444 | [
30522,
7427,
3968,
2226,
1012,
2009,
2721,
1012,
2009,
8017,
10732,
2099,
1012,
8389,
1025,
12324,
9262,
1012,
22091,
2102,
1012,
8389,
1025,
12324,
9262,
2595,
1012,
7370,
1012,
3746,
28524,
1025,
12324,
9262,
2595,
1012,
7370,
1012,
16545... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var files =
[
[ "Code", "dir_a44bec13de8698b1b3f25058862347f8.html", "dir_a44bec13de8698b1b3f25058862347f8" ]
]; | crurik/GrapeFS | Doxygen/html/files.js | JavaScript | bsd-2-clause | 116 | [
30522,
13075,
6764,
1027,
1031,
1031,
1000,
3642,
1000,
1010,
1000,
16101,
1035,
1037,
22932,
4783,
2278,
17134,
3207,
20842,
2683,
2620,
2497,
2487,
2497,
2509,
2546,
17788,
2692,
27814,
20842,
21926,
22610,
2546,
2620,
1012,
16129,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package mil.nga.mapcache;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.view.MenuItem;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import com.ipaulpro.afilechooser.utils.FileUtils;
import org.piwik.sdk.Piwik;
import org.piwik.sdk.Tracker;
import org.piwik.sdk.TrackerConfig;
import org.piwik.sdk.extra.TrackHelper;
import mil.nga.mapcache.io.MapCacheFileUtils;
//import org.matomo.sdk.Matomo;
//import org.matomo.sdk.TrackMe;
//import org.matomo.sdk.Tracker;
//import org.matomo.sdk.TrackerBuilder;
//import org.matomo.sdk.extra.MatomoApplication;
//import org.matomo.sdk.extra.TrackHelper;
/**
* Main Activity
*
* @author osbornb
*/
public class MainActivity extends AppCompatActivity {
/**
* Map permissions request code for accessing fine locations
*/
public static final int MAP_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION = 100;
/**
* Manager permissions request code for importing a GeoPackage as an external link
*/
public static final int MANAGER_PERMISSIONS_REQUEST_ACCESS_IMPORT_EXTERNAL = 200;
/**
* Manager permissions request code for reading / writing to GeoPackages already externally linked
*/
public static final int MANAGER_PERMISSIONS_REQUEST_ACCESS_EXISTING_EXTERNAL = 201;
/**
* Manager permissions request code for exporting a GeoPackage to external storage
*/
public static final int MANAGER_PERMISSIONS_REQUEST_ACCESS_EXPORT_DATABASE = 202;
/**
* Used to store the last screen title. For use in
* {@link #hideActionBar()}.
*/
private CharSequence title;
/**
* Map fragment
*/
private GeoPackageMapFragment mapFragment;
/**
* Manager fragment
*/
// private GeoPackageManagerFragment managerFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set the content view
setContentView(R.layout.activity_main);
// Retrieve the fragments
// managerFragment = (GeoPackageManagerFragment) getSupportFragmentManager()
// .findFragmentById(R.id.fragment_manager);
mapFragment = (GeoPackageMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.fragment_map);
// Set up the map fragment
createMainFragment();
hideActionBar();
// Handle opening and importing GeoPackages
if(getIntent() != null) {
Intent intent = getIntent();
Uri uri = intent.getData();
if (uri == null) {
Bundle bundle = intent.getExtras();
if (bundle != null) {
Object objectUri = bundle.get(Intent.EXTRA_STREAM);
if (objectUri != null) {
uri = (Uri) objectUri;
}
}
}
if (uri != null) {
handleIntentUri(uri, intent);
}
}
/**
* Use Matomo to track when users open the app
*/
String siteUrl = getString(R.string.matomo_url);
int siteId = getResources().getInteger(R.integer.matomo_site_id);
Tracker piwik = Piwik.getInstance(getApplicationContext()).newTracker(new TrackerConfig(siteUrl, siteId, "MapCacheTracker"));
String androidId = Settings.Secure.getString(getBaseContext().getContentResolver(),
Settings.Secure.ANDROID_ID);
TrackHelper.track().screen("/Main Activity").title("App Opened").with(piwik);
piwik.dispatch();
}
/**
* Set up the map fragment
*/
private void createMainFragment(){
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.show(mapFragment);
title = getString(R.string.title_map);
transaction.commit();
}
/**
* Handle the URI from an intent for opening or importing a GeoPackage
*
* @param uri intent uri
*/
private void handleIntentUri(final Uri uri, Intent intent) {
String path = FileUtils.getPath(this, uri);
String name = MapCacheFileUtils.getDisplayName(this, uri, path);
try {
if (path != null) {
// managerFragment.importGeoPackageExternalLinkWithPermissions(name, uri, path);
mapFragment.startImportTaskWithPermissions(name, uri, path, intent);
} else {
// managerFragment.importGeoPackage(name, uri, path);
mapFragment.startImportTask(name, uri, path, intent);
}
} catch (final Exception e) {
try {
runOnUiThread(
new Runnable() {
@Override
public void run() {
GeoPackageUtils.showMessage(MainActivity.this,
"Open GeoPackage",
"Could not open file as a GeoPackage"
+ "\n\n"
+ e.getMessage());
}
});
} catch (Exception e2) {
// eat
}
}
}
/**
* {@inheritDoc}
*/
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
/**
* Hide the action bar
*/
public void hideActionBar() {
ActionBar actionBar = getSupportActionBar();
// actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
// actionBar.setDisplayShowTitleEnabled(true);
// actionBar.setTitle(title);
actionBar.hide();
}
/**
* {@inheritDoc}
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (mapFragment.handleMenuClick(item)) {
return true;
}
// if (managerFragment.handleMenuClick(item)) {
// return true;
// }
return super.onOptionsItemSelected(item);
}
/**
* {@inheritDoc}
*/
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
// Check if permission was granted
boolean granted = grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED;
switch(requestCode) {
case MAP_PERMISSIONS_REQUEST_ACCESS_FINE_LOCATION:
mapFragment.setMyLocationEnabled();
break;
case MANAGER_PERMISSIONS_REQUEST_ACCESS_IMPORT_EXTERNAL:
mapFragment.importGeopackageFromFile();
break;
case MANAGER_PERMISSIONS_REQUEST_ACCESS_EXPORT_DATABASE:
mapFragment.exportGeoPackageToExternal();
break;
case MANAGER_PERMISSIONS_REQUEST_ACCESS_EXISTING_EXTERNAL:
// managerFragment.update(granted);
break;
}
}
}
| ngageoint/geopackage-mapcache-android | mapcache/src/main/java/mil/nga/mapcache/MainActivity.java | Java | mit | 7,404 | [
30522,
7427,
23689,
1012,
12835,
2050,
1012,
4949,
3540,
5403,
1025,
12324,
11924,
1012,
4180,
1012,
7848,
1025,
12324,
11924,
1012,
4180,
1012,
7610,
1012,
7427,
24805,
4590,
1025,
12324,
11924,
1012,
5658,
1012,
24471,
2072,
1025,
12324,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
const path = require('path');
module.exports = {
HOST: 'localhost',
PORT: 3000,
URL: {
ROOT: 'https://bootflex.herokuapp.com',
API: 'https://bootflex.herokuapp.com/api'
},
PATH: {
ROOT: path.join(__dirname, '..')
}
};
| zrosenbauer/bootflex | doc-viewer/configs/production.js | JavaScript | mit | 243 | [
30522,
9530,
3367,
4130,
1027,
5478,
1006,
1005,
4130,
1005,
1007,
1025,
11336,
1012,
14338,
1027,
1063,
3677,
1024,
1005,
2334,
15006,
2102,
1005,
1010,
3417,
1024,
11910,
1010,
24471,
2140,
1024,
1063,
7117,
1024,
1005,
16770,
1024,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# orm/exc.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""SQLAlchemy ORM exceptions."""
from .. import exc as sa_exc
from .. import util
NO_STATE = (AttributeError, KeyError)
"""Exception types that may be raised by instrumentation implementations."""
class StaleDataError(sa_exc.SQLAlchemyError):
"""An operation encountered database state that is unaccounted for.
Conditions which cause this to happen include:
* A flush may have attempted to update or delete rows
and an unexpected number of rows were matched during
the UPDATE or DELETE statement. Note that when
version_id_col is used, rows in UPDATE or DELETE statements
are also matched against the current known version
identifier.
* A mapped object with version_id_col was refreshed,
and the version number coming back from the database does
not match that of the object itself.
* A object is detached from its parent object, however
the object was previously attached to a different parent
identity which was garbage collected, and a decision
cannot be made if the new parent was really the most
recent "parent".
"""
ConcurrentModificationError = StaleDataError
class FlushError(sa_exc.SQLAlchemyError):
"""A invalid condition was detected during flush()."""
class UnmappedError(sa_exc.InvalidRequestError):
"""Base for exceptions that involve expected mappings not present."""
class ObjectDereferencedError(sa_exc.SQLAlchemyError):
"""An operation cannot complete due to an object being garbage
collected.
"""
class DetachedInstanceError(sa_exc.SQLAlchemyError):
"""An attempt to access unloaded attributes on a
mapped instance that is detached."""
code = "bhk3"
class UnmappedInstanceError(UnmappedError):
"""An mapping operation was requested for an unknown instance."""
@util.dependencies("sqlalchemy.orm.base")
def __init__(self, base, obj, msg=None):
if not msg:
try:
base.class_mapper(type(obj))
name = _safe_cls_name(type(obj))
msg = (
"Class %r is mapped, but this instance lacks "
"instrumentation. This occurs when the instance "
"is created before sqlalchemy.orm.mapper(%s) "
"was called." % (name, name)
)
except UnmappedClassError:
msg = _default_unmapped(type(obj))
if isinstance(obj, type):
msg += (
"; was a class (%s) supplied where an instance was "
"required?" % _safe_cls_name(obj)
)
UnmappedError.__init__(self, msg)
def __reduce__(self):
return self.__class__, (None, self.args[0])
class UnmappedClassError(UnmappedError):
"""An mapping operation was requested for an unknown class."""
def __init__(self, cls, msg=None):
if not msg:
msg = _default_unmapped(cls)
UnmappedError.__init__(self, msg)
def __reduce__(self):
return self.__class__, (None, self.args[0])
class ObjectDeletedError(sa_exc.InvalidRequestError):
"""A refresh operation failed to retrieve the database
row corresponding to an object's known primary key identity.
A refresh operation proceeds when an expired attribute is
accessed on an object, or when :meth:`_query.Query.get` is
used to retrieve an object which is, upon retrieval, detected
as expired. A SELECT is emitted for the target row
based on primary key; if no row is returned, this
exception is raised.
The true meaning of this exception is simply that
no row exists for the primary key identifier associated
with a persistent object. The row may have been
deleted, or in some cases the primary key updated
to a new value, outside of the ORM's management of the target
object.
"""
@util.dependencies("sqlalchemy.orm.base")
def __init__(self, base, state, msg=None):
if not msg:
msg = (
"Instance '%s' has been deleted, or its "
"row is otherwise not present." % base.state_str(state)
)
sa_exc.InvalidRequestError.__init__(self, msg)
def __reduce__(self):
return self.__class__, (None, self.args[0])
class UnmappedColumnError(sa_exc.InvalidRequestError):
"""Mapping operation was requested on an unknown column."""
class NoResultFound(sa_exc.InvalidRequestError):
"""A database result was required but none was found."""
class MultipleResultsFound(sa_exc.InvalidRequestError):
"""A single database result was required but more than one were found."""
class LoaderStrategyException(sa_exc.InvalidRequestError):
"""A loader strategy for an attribute does not exist."""
def __init__(
self,
applied_to_property_type,
requesting_property,
applies_to,
actual_strategy_type,
strategy_key,
):
if actual_strategy_type is None:
sa_exc.InvalidRequestError.__init__(
self,
"Can't find strategy %s for %s"
% (strategy_key, requesting_property),
)
else:
sa_exc.InvalidRequestError.__init__(
self,
'Can\'t apply "%s" strategy to property "%s", '
'which is a "%s"; this loader strategy is intended '
'to be used with a "%s".'
% (
util.clsname_as_plain_name(actual_strategy_type),
requesting_property,
util.clsname_as_plain_name(applied_to_property_type),
util.clsname_as_plain_name(applies_to),
),
)
def _safe_cls_name(cls):
try:
cls_name = ".".join((cls.__module__, cls.__name__))
except AttributeError:
cls_name = getattr(cls, "__name__", None)
if cls_name is None:
cls_name = repr(cls)
return cls_name
@util.dependencies("sqlalchemy.orm.base")
def _default_unmapped(base, cls):
try:
mappers = base.manager_of_class(cls).mappers
except NO_STATE:
mappers = {}
except TypeError:
mappers = {}
name = _safe_cls_name(cls)
if not mappers:
return "Class '%s' is not mapped" % name
| gltn/stdm | stdm/third_party/sqlalchemy/orm/exc.py | Python | gpl-2.0 | 6,616 | [
30522,
1001,
2030,
2213,
1013,
4654,
2278,
1012,
1052,
2100,
1001,
9385,
1006,
1039,
1007,
2384,
1011,
12609,
1996,
29296,
2389,
5403,
8029,
6048,
1998,
16884,
1001,
1026,
2156,
6048,
5371,
1028,
1001,
1001,
2023,
11336,
2003,
2112,
1997,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Pango {
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
#region Autogenerated code
public partial class FontFace : GLib.Object {
public FontFace (IntPtr raw) : base(raw) {}
protected FontFace() : base(IntPtr.Zero)
{
CreateNativeObject (new string [0], new GLib.Value [0]);
}
[DllImport("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_font_face_describe(IntPtr raw);
public Pango.FontDescription Describe() {
IntPtr raw_ret = pango_font_face_describe(Handle);
Pango.FontDescription ret = raw_ret == IntPtr.Zero ? null : (Pango.FontDescription) GLib.Opaque.GetOpaque (raw_ret, typeof (Pango.FontDescription), true);
return ret;
}
[DllImport("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_font_face_get_face_name(IntPtr raw);
public string FaceName {
get {
IntPtr raw_ret = pango_font_face_get_face_name(Handle);
string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
return ret;
}
}
[DllImport("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr pango_font_face_get_type();
public static new GLib.GType GType {
get {
IntPtr raw_ret = pango_font_face_get_type();
GLib.GType ret = new GLib.GType(raw_ret);
return ret;
}
}
[DllImport("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool pango_font_face_is_synthesized(IntPtr raw);
public bool IsSynthesized {
get {
bool raw_ret = pango_font_face_is_synthesized(Handle);
bool ret = raw_ret;
return ret;
}
}
[DllImport("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void pango_font_face_list_sizes(IntPtr raw, out int sizes, out int n_sizes);
public void ListSizes(out int sizes, out int n_sizes) {
pango_font_face_list_sizes(Handle, out sizes, out n_sizes);
}
#endregion
}
}
| akrisiun/gtk-sharp | pango/generated/Pango/FontFace.cs | C# | lgpl-2.1 | 2,141 | [
30522,
1013,
1013,
2023,
5371,
2001,
7013,
2011,
1996,
14181,
2243,
1001,
3642,
13103,
1012,
1013,
1013,
2151,
3431,
2081,
2097,
2022,
2439,
2065,
19723,
24454,
4383,
1012,
3415,
15327,
20657,
2080,
1063,
2478,
2291,
1025,
2478,
2291,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Copyright 2015-2018 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from . import mass_reconcile
from . import advanced_reconciliation
| OCA/bank-statement-reconcile | account_mass_reconcile_ref_deep_search/models/__init__.py | Python | agpl-3.0 | 171 | [
30522,
1001,
9385,
2325,
1011,
2760,
3409,
3406,
26468,
7842,
1001,
6105,
12943,
24759,
1011,
1017,
1012,
1014,
2030,
2101,
1006,
8299,
1024,
1013,
1013,
7479,
1012,
27004,
1012,
8917,
1013,
15943,
1013,
12943,
24759,
1012,
16129,
1007,
201... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using Server.Spells.Fourth;
using Server.Targeting;
using System.Linq;
namespace Server.Spells.Sixth
{
public class MassCurseSpell : MagerySpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Mass Curse", "Vas Des Sanct",
218,
9031,
false,
Reagent.Garlic,
Reagent.Nightshade,
Reagent.MandrakeRoot,
Reagent.SulfurousAsh);
public MassCurseSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override SpellCircle Circle => SpellCircle.Sixth;
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}
public void Target(IPoint3D p)
{
if (!Caster.CanSee(p))
{
Caster.SendLocalizedMessage(500237); // Target can not be seen.
}
else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
{
SpellHelper.Turn(Caster, p);
SpellHelper.GetSurfaceTop(ref p);
foreach (Mobile m in AcquireIndirectTargets(p, 2).OfType<Mobile>())
{
CurseSpell.DoCurse(Caster, m, true);
}
}
FinishSequence();
}
private class InternalTarget : Target
{
private readonly MassCurseSpell m_Owner;
public InternalTarget(MassCurseSpell owner)
: base(10, true, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
IPoint3D p = o as IPoint3D;
if (p != null)
m_Owner.Target(p);
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}
| Argalep/ServUO | Scripts/Spells/Sixth/MassCurse.cs | C# | gpl-2.0 | 1,999 | [
30522,
2478,
8241,
1012,
11750,
1012,
2959,
1025,
2478,
8241,
1012,
14126,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
3415,
15327,
8241,
1012,
11750,
1012,
4369,
1063,
2270,
2465,
3742,
10841,
22573,
13102,
5349,
1024,
17454,
24769,
11880,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright 2020 Nick Brassel (tzarc)
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include_next "mcuconf.h"
#undef STM32_I2C_USE_I2C1
#define STM32_I2C_USE_I2C1 TRUE
#undef STM32_PWM_USE_TIM5
#define STM32_PWM_USE_TIM5 TRUE
| kmtoki/qmk_firmware | keyboards/handwired/onekey/blackpill_f411/mcuconf.h | C | gpl-2.0 | 861 | [
30522,
1013,
1008,
9385,
12609,
4172,
8782,
2884,
1006,
1056,
9057,
2278,
1007,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1024,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
1008,
2009,
2104,
1996,
3408,
1997,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
// with Composer
require_once 'vendor/autoload.php';
use AlejandroSosa\YiiPowerPoint\PowerPoint;
//setting file
$options = [
//file
'fileName' => Yii::t('app', 'demo'),
//properties of file
'fileProperties' => [
'creator' => Yii::t('app', 'MyCompany'),
'title' => Yii::t('app', 'Financial Statement 2016'),
'subject' => Yii::t('app', 'General resume'),
'description' => Yii::t('app', 'Budget report')
],
//design all ppt
'layout' => [
'background' => Yii::getPathOfAlias('images') .'/bg.png'
],
];
//slides of ppt
$slides = [
[
//array of text
'texts' => [
[
'text'=>Yii::t('app', 'My PPT'),
'options'=>[
'height'=>82, 'width'=>816, 'ox'=>72, 'oy'=>170,
'bold'=> true, 'size'=>44, 'color'=>PowerPoint::COLOR_CYAN,
'align'=>PowerPoint::TEXT_ALIGN_HORIZONTAL_CENTER,
],
],
[
'text'=>Yii::t('app', 'My custom ppt example 2016'),
'options'=>[
'height'=>82, 'width'=>816,
'ox'=>72, 'oy'=>291,
'bold'=> false, 'size'=>40, 'color'=>PowerPoint::COLOR_PRIMARY_TEXT,
'align'=>PowerPoint::TEXT_ALIGN_HORIZONTAL_CENTER,
],
],
]
],
[
//array of text
'texts' => [
[
'text'=>Yii::t('app', 'Available options'),
'options'=>[
'height'=>38, 'width'=>360, 'ox'=>345, 'oy'=>52,
'bold'=> true, 'size'=>18, 'color'=>PowerPoint::COLOR_CYAN,
'align'=>PowerPoint::TEXT_ALIGN_VERTICAL_CENTER,
],
],
[
'text'=>Yii::t('app', 'Table of Contents'),
'options'=>[
'height'=>38, 'width'=>413, 'ox'=>50, 'oy'=>110,
'bold'=> true, 'size'=>18, 'color'=>PowerPoint::COLOR_PRIMARY_TEXT,
'align'=>PowerPoint::TEXT_ALIGN_VERTICAL_CENTER,
],
],
[
'text'=>Yii::t('app', 'Page'),
'options'=>[
'height'=>38, 'width'=>91, 'ox'=>706, 'oy'=>110,
'bold'=> true, 'size'=>18, 'color'=>PowerPoint::COLOR_PRIMARY_TEXT,
'align'=>PowerPoint::TEXT_ALIGN_VERTICAL_CENTER,
],
],
[
'text'=>Yii::t('app', '3{break}4{break}5{break}6{break}7{break}8{break}9{break}10',
['{break}'=>PowerPoint::TEXT_BREAK]),
'options'=>[
'height'=>220, 'width'=>91, 'ox'=>706, 'oy'=>163,
'bold'=> false, 'size'=>14, 'color'=>PowerPoint::COLOR_PRIMARY_TEXT,
'align'=>PowerPoint::TEXT_ALIGN_VERTICAL_CENTER,
],
],
[
'text'=>Yii::t('app','1. Tables {break}2. Chart bar {break}3. Chart bar horizontal {break}4. Chart bar horizontal percent stacked {break}5. Chart bar 3D {break}6. Chart scatter {break}7. Chart pie {break}8. Chart pie 3D',
['{break}'=>PowerPoint::TEXT_BREAK]),
'options'=>[
'height'=>220, 'width'=>604, 'ox'=>102, 'oy'=>163,
'bold'=>false, 'size'=>14, 'color'=>PowerPoint::COLOR_PRIMARY_TEXT,
'align'=>PowerPoint::TEXT_ALIGN_HORIZONTAL_LEFT,
]
],
],
'images' => [
'path'=>Yii::getPathOfAlias('images') . '/ppt/pptflujo.png',
'height'=>143, 'width'=>793, 'ox'=>120, 'oy'=>180,
'resizeProportional'=> false,
'name'=>Yii::t('app', 'Name of image'),
'description'=>Yii::t('app', 'This is a demo description')
]
],
[
//array of text
'texts' => [
[
'text'=>Yii::t('app', 'Table'),
'options'=>[
'height'=>38, 'width'=>360, 'ox'=>345, 'oy'=>34,
'bold'=> true, 'size'=>18, 'color'=>PowerPoint::COLOR_CYAN,
'align'=>PowerPoint::TEXT_ALIGN_VERTICAL_CENTER,
]
]
],
'tables' => [
[
'height'=>400, 'width'=>900, 'ox'=>26, 'oy'=>163,
'header' => [
'columns'=> [
['text'=>'Main Title', 'style'=>['width'=>268]],
['text'=>'Title', 'style'=>['width'=>88]],
['text'=>'Title', 'style'=>['width'=>88]],
['text'=>'Title', 'style'=>['width'=>88]],
['text'=>'Title', 'style'=>['width'=>88]],
['text'=>'Title', 'style'=>['width'=>88]],
['text'=>'Title', 'style'=>['width'=>88]],
['text'=>'Title', 'style'=>['width'=>88]],
],
'style'=>[
'background'=>'FFC6D9F1', 'bold'=> true, 'size'=>9, 'color'=>PowerPoint::COLOR_PRIMARY_TEXT,
'align'=>PowerPoint::TEXT_ALIGN_HORIZONTAL_CENTER, 'height'=>35
],
],
'rows'=>[
[
'columns'=>[
//with style
['text'=>'Title of this row', 'style'=>['align'=>PowerPoint::TEXT_ALIGN_HORIZONTAL_LEFT]],
//without style
'2.140',
'26,07%',
'9.00',
'2.121',
'1.554',
'7.000',
'73,27%'
],
'style'=>[
'background'=>'FFD7E4BD', 'bold'=> true, 'size'=>10, 'color'=>PowerPoint::COLOR_PRIMARY_TEXT,
'align'=>PowerPoint::TEXT_ALIGN_HORIZONTAL_RIGHT, 'height'=>17
]
],
[
'columns'=>[
//with style
['text'=>'Second title of this row', 'style'=>['align'=>PowerPoint::TEXT_ALIGN_HORIZONTAL_LEFT]],
//without style
'2.140',
'26,07%',
'9.00',
'2.121',
'1.554',
'7.000',
'73,27%'
],
'style'=>[
'background'=>'FFE9EDF4', 'bold'=> false, 'size'=>10, 'color'=>PowerPoint::COLOR_PRIMARY_TEXT,
'align'=>PowerPoint::TEXT_ALIGN_HORIZONTAL_RIGHT, 'height'=>17
]
],
],
],
],
],
[
//array of text
'texts' => [
[
'text'=>Yii::t('app', 'Chart Bar'),
'options'=>[
'height'=>38, 'width'=>360, 'ox'=>345, 'oy'=>34,
'bold'=> true, 'size'=>18, 'color'=>PowerPoint::COLOR_CYAN,
'align'=>PowerPoint::TEXT_ALIGN_VERTICAL_CENTER,
],
]
],
'charts' => [
[
'title'=>Yii::t('app', 'My first chart bar'),
'series'=>
[
['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
['Monday' => 7, 'Tuesday' => 9, 'Wednesday' => 19, 'Thursday' => 16, 'Friday' => 8, 'Saturday' => 11],
['Monday' => 12, 'Tuesday' => 20, 'Wednesday' => 13, 'Thursday' => 7, 'Friday' => 4, 'Saturday' => 9]
],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR, 'seriesName'=> ['2014', '2015', '2016'], 'showSeriesName'=> false,
'legendItalic' => true, 'legendOx'=> 20,'legendOy'=> 20,
'titleItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>117
]
],
[
'title'=>Yii::t('app', 'My second chart bar'),
'series'=> ['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR, 'seriesName'=> ['2009', '2010'], 'showSeriesName'=> false,
'legendItalic' => true, 'legendOx'=> 20,'legendOy'=> 20, 'legendBackground'=>PowerPoint::COLOR_AMBER,
'titleItalic' => true, 'background' => PowerPoint::COLOR_BLUE,
'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>117
]
],
[
'title'=>Yii::t('app', 'My third chart bar'),
'series'=>
[
['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
['Monday' => 12, 'Tuesday' => 20, 'Wednesday' => 13, 'Thursday' => 7, 'Friday' => 4, 'Saturday' => 9]
],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR, 'seriesName'=> ['2009', '2010'], 'showSeriesName'=> false,
'titleItalic' => true, 'legendItalic' => true, 'legendVisible' => false,
'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>367
]
],
[
'title'=>Yii::t('app', 'My quarter chart bar'),
'series'=>
[
['October' => 12, 'November' => 15, 'December' => 13],
['October' => 11, 'November' => 20, 'December' => 14]
],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR, 'seriesName'=> ['2014', '2015'], 'showSeriesName'=> false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>367
]
]
],
],
[
//array of text
'texts' => [
[
'text'=>Yii::t('app', 'Chart bar horizontal'),
'options'=>[
'height'=>38, 'width'=>360, 'ox'=>345, 'oy'=>34,
'bold'=> true, 'size'=>18, 'color'=>PowerPoint::COLOR_CYAN,
'align'=>PowerPoint::TEXT_ALIGN_VERTICAL_CENTER,
],
]
],
'charts' => [
[
'title'=>Yii::t('app', 'My first chart bar horizontal'),
'series'=>
[
['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
['Monday' => 7, 'Tuesday' => 9, 'Wednesday' => 19, 'Thursday' => 16, 'Friday' => 8, 'Saturday' => 11],
['Monday' => 12, 'Tuesday' => 20, 'Wednesday' => 13, 'Thursday' => 7, 'Friday' => 4, 'Saturday' => 9]
],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR_HORIZONTAL, 'seriesName'=> ['2014', '2015', '2016'], 'showSeriesName'=> false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>117
]
],
[
'title'=>Yii::t('app', 'My second chart bar horizontal'),
'series'=> ['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR_HORIZONTAL, 'seriesName'=> ['2009', '2010'], 'showSeriesName'=> false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>117
]
],
[
'title'=>Yii::t('app', 'My third chart bar horizontal'),
'series'=>
[
['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
['Monday' => 12, 'Tuesday' => 20, 'Wednesday' => 13, 'Thursday' => 7, 'Friday' => 4, 'Saturday' => 9]
],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR_HORIZONTAL, 'seriesName'=> ['2009', '2010'], 'showSeriesName'=> false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>367
]
],
[
'title'=>Yii::t('app', 'My quarter chart bar horizontal'),
'series'=>
[
['October' => 12, 'November' => 15, 'December' => 13],
['October' => 11, 'November' => 20, 'December' => 14]
],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR_HORIZONTAL, 'seriesName'=> ['2014', '2015'], 'showSeriesName'=> false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>367
]
]
],
],
[
//array of text
'texts' => [
[
'text'=>Yii::t('app', 'Chart bar horizontal percent stacked'),
'options'=>[
'height'=>38, 'width'=>360, 'ox'=>345, 'oy'=>34,
'bold'=> true, 'size'=>18, 'color'=>PowerPoint::COLOR_CYAN,
'align'=>PowerPoint::TEXT_ALIGN_VERTICAL_CENTER,
],
]
],
'charts' => [
[
'title'=>Yii::t('app', 'My first chart bar horizontal percent stacked'),
'series'=>
[
['Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293],
['Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379],
['Jan' => 233, 'Feb' => 146, 'Mar' => 238, 'Apr' => 175, 'May' => 108, 'Jun' => 257, 'Jul' => 199, 'Aug' => 201, 'Sep' => 88, 'Oct' => 147, 'Nov' => 287, 'Dec' => 105]
],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR_PERCENT_STACKED, 'seriesName'=> ['2015', '2016', '2017'],
'showSeriesName'=> false, 'showValue'=>true, 'showPercente'=>false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>117
]
],
[
'title'=>Yii::t('app', 'My second chart bar horizontal percent stacked'),
'series'=> ['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR_PERCENT_STACKED, 'seriesName'=> ['2015'],
'showSeriesName'=> false, 'showValue'=>true, 'showPercente'=>false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>117
]
],
[
'title'=>Yii::t('app', 'My third chart bar horizontal percent stacked'),
'series'=>
[
['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
['Monday' => 12, 'Tuesday' => 20, 'Wednesday' => 13, 'Thursday' => 7, 'Friday' => 4, 'Saturday' => 9]
],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR_PERCENT_STACKED, 'seriesName'=> ['2015', '2016'],
'showSeriesName'=> false, 'showValue'=>true, 'showPercente'=>false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>367
]
],
[
'title'=>Yii::t('app', 'My quarter chart bar horizontal percent stacked'),
'series'=>
[
['October' => 12, 'November' => 15, 'December' => 13],
['October' => 11, 'November' => 20, 'December' => 14]
],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR_PERCENT_STACKED, 'seriesName'=> ['2015', '2016'],
'showSeriesName'=> false, 'showValue'=>true, 'showPercente'=>false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>367
]
]
],
],
[
//array of text
'texts' => [
[
'text'=>Yii::t('app', 'Chart bar 3D'),
'options'=>[
'height'=>38, 'width'=>360, 'ox'=>345, 'oy'=>34,
'bold'=> true, 'size'=>18, 'color'=>PowerPoint::COLOR_CYAN,
'align'=>PowerPoint::TEXT_ALIGN_VERTICAL_CENTER,
],
]
],
'charts' => [
[
'title'=>Yii::t('app', 'My first chart bar 3D'),
'series'=>
[
['Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293],
['Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379],
['Jan' => 233, 'Feb' => 146, 'Mar' => 238, 'Apr' => 175, 'May' => 108, 'Jun' => 257, 'Jul' => 199, 'Aug' => 201, 'Sep' => 88, 'Oct' => 147, 'Nov' => 287, 'Dec' => 105]
],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR_3D, 'seriesName'=> ['2015', '2016', '2017'],
'showSeriesName'=> false, 'showValue'=>true, 'showPercente'=>false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>117
]
],
[
'title'=>Yii::t('app', 'My second chart bar 3D'),
'series'=> ['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR_3D, 'seriesName'=> ['2015'],
'showSeriesName'=> false, 'showValue'=>true, 'showPercente'=>false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>117
]
],
[
'title'=>Yii::t('app', 'My third chart bar 3D'),
'series'=>
[
['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
['Monday' => 12, 'Tuesday' => 20, 'Wednesday' => 13, 'Thursday' => 7, 'Friday' => 4, 'Saturday' => 9]
],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR_3D, 'seriesName'=> ['2015', '2016'],
'showSeriesName'=> false, 'showValue'=>true, 'showPercente'=>false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>367
]
],
[
'title'=>Yii::t('app', 'My quarter chart bar 3D'),
'series'=>
[
['October' => 12, 'November' => 15, 'December' => 13],
['October' => 11, 'November' => 20, 'December' => 14]
],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_BAR_3D, 'seriesName'=> ['2015', '2016'],
'showSeriesName'=> false, 'showValue'=>true, 'showPercente'=>false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>367
]
]
],
],
[
//array of text
'texts' => [
[
'text'=>Yii::t('app', 'Chart scatter'),
'options'=>[
'height'=>38, 'width'=>360, 'ox'=>345, 'oy'=>34,
'bold'=> true, 'size'=>18, 'color'=>PowerPoint::COLOR_CYAN,
'align'=>PowerPoint::TEXT_ALIGN_VERTICAL_CENTER,
],
]
],
'charts' => [
[
'title'=>Yii::t('app', 'My first chart scatter'),
'series'=> ['Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_SCATTER, 'seriesName'=> ['2015'],
'showSeriesName'=> false, 'showValue'=>true, 'showPercente'=>false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>117
]
],
[
'title'=>Yii::t('app', 'My second chart scatter'),
'series'=> ['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_SCATTER, 'seriesName'=> ['2015'],
'showSeriesName'=> false, 'showValue'=>true, 'showPercente'=>false,
'showSymbol' => true, 'typeSymbol' => PowerPoint::SYMBOL_STAR,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>117
]
],
[
'title'=>Yii::t('app', 'My third chart scatter'),
'series'=>['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_SCATTER, 'seriesName'=> ['2015', '2016'],
'showSeriesName'=> false, 'showValue'=>true, 'showPercente'=>false,
'showSymbol' => false,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>367
]
],
[
'title'=>Yii::t('app', 'My quarter chart scatter'),
'series'=> [
['October' => 12, 'November' => 15, 'December' => 13],
['October' => 20, 'November' => 18, 'December' => 15],
],
'options'=>[
'type'=>PowerPoint::CHART_TYPE_SCATTER, 'seriesName'=> ['2015', '2016'],
'showSeriesName'=> false, 'showValue'=>true, 'showPercente'=>false,
'showSymbol' => true, 'typeSymbol' => PowerPoint::SYMBOL_DIAMOND,
'titleItalic' => true, 'legendItalic' => true,
'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>367
]
]
],
],
[
//array of text
'texts' => [
[
'text'=>Yii::t('app', 'Chart pie'),
'options'=>[
'height'=>38, 'width'=>360, 'ox'=>345, 'oy'=>34,
'bold'=> true, 'size'=>18, 'color'=>PowerPoint::COLOR_CYAN,
'align'=>PowerPoint::TEXT_ALIGN_VERTICAL_CENTER,
],
]
],
'charts' => [
[
'title'=>Yii::t('app', 'My first chart pie'),
'series'=>['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7],
'options'=>['type'=>PowerPoint::CHART_TYPE_PIE,'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>117]
],
[
'title'=>Yii::t('app', 'My second chart pie'),
'series'=>['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17],
'options'=>['type'=>PowerPoint::CHART_TYPE_PIE,'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>117]
],
[
'title'=>Yii::t('app', 'My third chart pie'),
'series'=>['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7],
'options'=>['type'=>PowerPoint::CHART_TYPE_PIE,'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>367]
],
[
'title'=>Yii::t('app', 'My quarter chart pie'),
'series'=>['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
'options'=>['type'=>PowerPoint::CHART_TYPE_PIE,'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>367]
]
],
],
[
//array of text
'texts' => [
[
'text'=>Yii::t('app', 'Chart pie 3D'),
'options'=>[
'height'=>38, 'width'=>360, 'ox'=>345, 'oy'=>34,
'bold'=> true, 'size'=>18, 'color'=>PowerPoint::COLOR_CYAN,
'align'=>PowerPoint::TEXT_ALIGN_VERTICAL_CENTER,
],
]
],
'charts' => [
[
'title'=>Yii::t('app', 'My first chart pie 3D'),
'series'=>['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7],
'options'=>['type'=>PowerPoint::CHART_TYPE_PIE_3D,'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>117]
],
[
'title'=>Yii::t('app', 'My second chart pie 3D'),
'series'=>['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17],
'options'=>['type'=>PowerPoint::CHART_TYPE_PIE_3D,'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>117]
],
[
'title'=>Yii::t('app', 'My third chart pie 3D'),
'series'=>['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7],
'options'=>['type'=>PowerPoint::CHART_TYPE_PIE_3D,'height'=>234, 'width'=>450, 'ox'=>18, 'oy'=>367]
],
[
'title'=>Yii::t('app', 'My quarter chart pie 3D'),
'series'=>['Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9],
'options'=>['type'=>PowerPoint::CHART_TYPE_PIE_3D,'height'=>234, 'width'=>450, 'ox'=>487, 'oy'=>367]
]
],
],
];
//generate ppt
Yii::app()->ppt->generate($options, $slides); | alejandrososa/Yii-PowerPoint-Component | samples/Sample_full.php | PHP | bsd-2-clause | 27,919 | [
30522,
1026,
1029,
25718,
1013,
1013,
2007,
4543,
5478,
1035,
2320,
1005,
21431,
1013,
8285,
11066,
1012,
25718,
1005,
1025,
2224,
16810,
17063,
2050,
1032,
12316,
11514,
25114,
8400,
1032,
2373,
8400,
1025,
1013,
1013,
4292,
5371,
1002,
70... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package eu.netide.core.logpub;
import java.util.LinkedList;
import eu.netide.core.api.Constants;
import eu.netide.core.api.MessageHandlingResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zeromq.ZFrame;
import org.zeromq.ZMQ;
import org.zeromq.ZMQException;
import org.zeromq.ZMsg;
import eu.netide.core.api.IBackendManager;
import eu.netide.core.api.IBackendMessageListener;
import eu.netide.core.api.IManagementMessageListener;
import eu.netide.core.api.IShimManager;
import eu.netide.core.api.IShimMessageListener;
import eu.netide.lib.netip.ManagementMessage;
import eu.netide.lib.netip.Message;
import eu.netide.lib.netip.NetIPConverter;
public class LogPub implements IBackendMessageListener, IShimMessageListener, IManagementMessageListener, Runnable{
private static final String STOP_COMMAND = "Control.STOP";
private static final String CONTROL_ADDRESS = "inproc://LogPubControl";
private static final int DEFAULT_PUB_PORT = 5557;
private static final int DEFAULT_SUB_PORT = 5558;
private static final Logger log = LoggerFactory.getLogger(LogPub.class);
private int pubPort;
private int subPort;
private IShimManager shimManager;
private IBackendManager backendManager;
private ZMQ.Context context;
private Thread thread;
public LogPub() {
log.info("LogPub Constructor.");
}
public void Start() {
log.info("LogPub Start().");
context = ZMQ.context(1);
thread = new Thread(this);
thread.setName("LogPub Receive Loop");
thread.start();
}
public void Stop() {
if (thread != null) {
ZMQ.Socket stopSocket = context.socket(ZMQ.PUSH);
stopSocket.connect(CONTROL_ADDRESS);
stopSocket.send(STOP_COMMAND);
stopSocket.close();
try {
thread.join();
context.term();
} catch (InterruptedException e) {
log.error("", e);
}
}
log.info("LogPub stopped.");
}
@Override
public void run() {
log.info("LogPub started.");
ZMQ.Socket pubSocket = context.socket(ZMQ.PUB);
try{
pubSocket.bind("tcp://*:" + (pubPort==0?DEFAULT_PUB_PORT:pubPort));
}catch(ZMQException e){
log.error("PUB address already in use!");
Stop();
}
log.info("Listening PUB queue on port " + (pubPort==0?DEFAULT_PUB_PORT:pubPort));
ZMQ.Socket subSocket = context.socket(ZMQ.ROUTER);
subSocket.setIdentity("logpub".getBytes(ZMQ.CHARSET));
try{
subSocket.bind("tcp://*:" + (subPort==0?DEFAULT_SUB_PORT:subPort));
}catch(ZMQException e){
log.error("PUB address already in use!");
Stop();
}
log.info("Listening SUB queue on port " + (subPort==0?DEFAULT_SUB_PORT:subPort));
ZMQ.Socket controlSocket = context.socket(ZMQ.PULL);
controlSocket.bind(CONTROL_ADDRESS);
log.info("Control queue on address: " + CONTROL_ADDRESS);
// Register the queues in the poller
try{
ZMQ.Poller poller = new ZMQ.Poller(2);
poller.register(subSocket, ZMQ.Poller.POLLIN);
poller.register(controlSocket, ZMQ.Poller.POLLIN);
while (!Thread.currentThread().isInterrupted()) {
poller.poll(10);
if (poller.pollin(0)) {
ZMsg zmqMessage = ZMsg.recvMsg(subSocket);
String dst = null;
byte[] data = null;
try{
ZFrame header = zmqMessage.pop();
dst = zmqMessage.popString();
data = zmqMessage.getLast().getData();
Message netideMessage = NetIPConverter.parseRawMessage(data);
log.debug("Data received in SUB queue: to "+dst+ ". (data:"+netideMessage.toByteRepresentation()+")");
if (dst.startsWith("1_"))
// send message to shim
try{
shimManager.sendMessage(netideMessage);
}catch (NullPointerException e) {
log.error("shim manager not set");
}
else if (dst.startsWith("0_"))
// send message to backend
try{
backendManager.sendMessage(netideMessage);
}catch (NullPointerException e) {
log.error("backend manager not set");
}
else
log.error("Got unknown message in SUB queue:" + netideMessage.toString());
}catch(NullPointerException | IllegalArgumentException e){
log.error("Error in LogPub:");e.printStackTrace();
}
}
if (poller.pollin(1)) {
ZMsg message = ZMsg.recvMsg(controlSocket);
if (message.getFirst().toString().equals(STOP_COMMAND)) {
log.info("Received STOP command.\nExiting...");
break;
} else {
log.debug("Sending message to PUB queue");
message.send(pubSocket);
}
}
}
} catch (Exception ex) {
log.error("Error in ZeroMQBasedConnector receive loop.", ex);
} finally {
pubSocket.close();
subSocket.close();
controlSocket.close();
}
}
public void setPubPort(int pub_port) {
this.pubPort = pub_port;
}
public int getPubPort() {
return pubPort;
}
public void setSubPort(int sub_port) {
this.subPort = sub_port;
}
public int getSubPort()
{
return subPort;
}
@Override
public MessageHandlingResult OnBackendMessage(Message message, String originId) {
log.debug("Received message from backend");
OnShimAndBackendMessage(message, "0", originId);
return MessageHandlingResult.RESULT_PASS;
}
@Override
public MessageHandlingResult OnShimMessage(Message message, String originId) {
log.debug("Received message from shim");
OnShimAndBackendMessage(message, "1", originId);
return MessageHandlingResult.RESULT_PASS;
}
@Override
public void OnOutgoingBackendMessage(Message message, String backendId) {
log.debug("Received message to backend");
OnShimAndBackendMessage(message, "2", backendId);
}
@Override
public void OnUnhandledBackendMessage(Message message, String originId) {
}
@Override
public void OnOutgoingShimMessage(Message message) {
log.debug("Received message to shim");
OnShimAndBackendMessage(message, "3", Constants.SHIM);
}
@Override
public void OnUnhandeldShimMessage(Message message, String originId) {
}
private void OnShimAndBackendMessage(Message message, String origin, String originId){
log.debug("Received message from "+origin+"_"+originId+":" + message.toString());
ZMQ.Socket sendSocket = context.socket(ZMQ.PUSH);
sendSocket.connect(CONTROL_ADDRESS);
sendSocket.sendMore("*"); // TODO : Add topic handling
sendSocket.sendMore(origin+"_"+originId);
sendSocket.send(message.toByteRepresentation());
sendSocket.close();
}
@Override
public void OnManagementMessage(ManagementMessage message) {
log.debug("Received message from management:" + message.toString());
ZMQ.Socket sendSocket = context.socket(ZMQ.PUSH);
sendSocket.connect(CONTROL_ADDRESS);
sendSocket.send(message.getPayloadString());
sendSocket.close();
}
/**
* Sets the shim manager.
*
* @param manager the manager
*/
public void setShimManager(IShimManager manager) {
shimManager = manager;
log.debug("ShimManager set.");
}
/**
* Gets the shim manager.
*
* @return the shim manager
*/
public IShimManager getShimManager() {
return shimManager;
}
/**
* Sets the backend manager.
*
* @param manager the manager
*/
public void setBackendManager(IBackendManager manager) {
backendManager = manager;
log.debug("BackendManager set.");
}
/**
* Gets the backend manager.
*
* @return the backend manager
*/
public IBackendManager getBackendManager() {
return backendManager;
}
@Override
public void OnBackendRemoved(String backEndName, LinkedList<Integer> removedModules) {
// TODO : Send message to the PUB queue?
}
} | fp7-netide/Engine | core/core.logpub/src/main/java/eu/netide/core/logpub/LogPub.java | Java | epl-1.0 | 7,421 | [
30522,
7427,
7327,
1012,
5658,
5178,
1012,
4563,
1012,
8833,
14289,
2497,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
5799,
9863,
1025,
12324,
7327,
1012,
5658,
5178,
1012,
4563,
1012,
17928,
1012,
5377,
2015,
1025,
12324,
7327,
1012,
5658,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
ALTER TABLE [dbo].[StockTechnicalIndicators] WITH CHECK ADD CONSTRAINT [FK_StockTechnicalIndicators_Stock] FOREIGN KEY([StockNo])
REFERENCES [dbo].[Stock] ([StockNo])
GO
ALTER TABLE [dbo].[StockTechnicalIndicators] CHECK CONSTRAINT [FK_StockTechnicalIndicators_Stock]
GO
| flight-tom/StockCrawler | database/MSSQL/30_foreign_keys/StockTechnicalIndicators.FK.sql | SQL | lgpl-3.0 | 274 | [
30522,
11477,
2795,
1031,
16962,
2080,
1033,
1012,
1031,
4518,
15007,
20913,
22254,
30524,
15007,
20913,
22254,
5555,
6591,
1035,
4518,
1033,
3097,
3145,
1006,
1031,
4518,
3630,
1033,
1007,
7604,
1031,
16962,
2080,
1033,
1012,
1031,
4518,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Lambda Zoo
Implemented:
* untyped
* simply-typed
* simply-typed with higher-kinded type operators (Weak Lambda Omega)
* system f
* system f omega
* lambda pi
# Useful links
* http://www.rbjones.com/rbjpub/logic/cl/tlc001.htm
* https://cstheory.stackexchange.com/a/36071
| ak3n/lambda-zoo | README.md | Markdown | bsd-3-clause | 276 | [
30522,
1001,
23375,
9201,
7528,
1024,
1008,
4895,
13874,
2094,
1008,
3432,
1011,
21189,
1008,
3432,
1011,
21189,
2007,
3020,
1011,
2785,
2098,
2828,
9224,
1006,
5410,
23375,
14827,
1007,
1008,
2291,
1042,
1008,
2291,
1042,
14827,
1008,
2337... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include "GateTask.hpp"
#include "Robosub/ModuleEnableMsg.h"
#include "Robosub/Point.h"
#include "std_msgs/String.h"
//#include "Positioning.hpp"
#include <stdio.h>
#include <math.h>
#include <float.h>
GateTask::GateTask()
: m_nodeHandle(),
m_gateSubscriber(),
m_taskStateSubscriber(),
m_centerPointPublisher(),
m_taskCompletePublisher(),
m_highLevelMotorPublisher(),
m_isEnabled(false),
m_identifiedCenter(false),
m_haveBothLegs(false),
m_center(),
m_zeroth(),
m_lastId(-1)
{
m_gateSubscriber = m_nodeHandle.subscribe("img_rec/gate", 10, &GateTask::gateCallback, this);
m_taskStateSubscriber = m_nodeHandle.subscribe("Module_Enable", 10, &GateTask::moduleEnableCallback, this);
m_centerPointPublisher = m_nodeHandle.advertise<Robosub::Point>("Center_On_Point", 10);
m_taskCompletePublisher = m_nodeHandle.advertise<std_msgs::String>("Task_Completion", 10);
m_highLevelMotorPublisher = m_nodeHandle.advertise<Robosub::HighLevelControl>("High_Level_Motion", 10);
}
GateTask::~GateTask()
{
}
void GateTask::run()
{
while (ros::ok())
{
ros::spin();
}
}
void GateTask::moduleEnableCallback(const Robosub::ModuleEnableMsg& msg)
{
if (msg.Module == "GateTask")
{
if (msg.State == true)
{
printf("GateTask: enabled\n");
m_isEnabled = true;
m_identifiedCenter = m_haveBothLegs = false;
}
else
{
printf("GateTask: Disabled\n");
m_isEnabled = false;
}
}
}
void GateTask::gateCallback(const SubImageRecognition::ImgRecObject& msg)
{
// vvvvvv This only works on gate Id 0
if (m_isEnabled && msg.id == 0) //It this ID the left gate?
{
float pixPerInch = getPixelsPerInch(msg.width, 3.0f);
float dist = getDistance(msg.width, 3.0f);
float x = (msg.center_x / pixPerInch) + 36.0f; //add a 3 feet
float leftMost = msg.center_x - (msg.width/2.0f);
float rightMost = msg.center_x + (msg.width/2.0f);
//This code could be replaced by publishing to center on point,
//if the Navigation Control module were working
if ((x < -10.0f || x > 10.0f) && (leftMost > -230.0f && rightMost < 230.0f)) //if we are too close to the edge, just drive straight
{
printf("Strafing by %f\n", x/12.0f);
publishMotor("Straf", "Offset", x/12.0f);
}
if (leftMost > -230.0 && rightMost < 230.0)
{
printf("Forward by %f\n", dist + 4);
publishMotor("Forward", "Offset", dist + 4);
}
else
{
printf("Disabling\n");
reportSuccess(true);
}
}
}
/**
* @brief Calculate the distance the center of the object is off from the center of the camera in inches
*
* @param centerDir The current center direction
* @param width The width of the object
*
* @return The distance in inches
*/
float GateTask::calculateDistanceFromCenter(float centerDir, float width)
{
float pxlPerInch = getPixelsPerInch(width, 3.0f);
return centerDir * pxlPerInch;
}
/**
* @brief Get the number of pixels per inch
*
* @param curWidthPixels The current width of a known object in pixels
* @param expectedWidthInches The expected with of an object in inches
*
* @return The number of pixels per inch if everything goes well, or float_max if inputs were unacceptable
*/
float GateTask::getPixelsPerInch(float curWidthPixels, float expectedWidthInches)
{
float dist = getDistance(curWidthPixels, expectedWidthInches);
return curWidthPixels/dist;
}
/**
* @brief Calculate the distance to the object
*
* @param curObjSize The objects current size
* @param actualObjSize The objects expected size
*
* @return The distance
*/
float GateTask::getDistance(float curObjSize, float actualObjSize)
{
//FIXIT: What formula is this?
return (actualObjSize/(2.0f*tan(((curObjSize * (M_PI/4.0))/960.0f))));
}
/**
* @brief plubish to the high level motor controller topic
*
* @param direction The direction: Forward, Straf, Turn
* @param motion The motion type: Manual, Offset
* @param value The value
*/
void GateTask::publishMotor(std::string direction, std::string motion, float value)
{
Robosub::HighLevelControl msg;
msg.Direction = direction;
msg.MotionType = motion;
msg.Value = value;
m_highLevelMotorPublisher.publish(msg);
}
/**
* @brief report the success or failure of the module
*
* @param success The success or failure
*/
void GateTask::reportSuccess(bool success)
{
std_msgs::String msg;
msg.data = "PathTask";
if (success)
{
msg.data += " Success";
}
else
{
msg.data = " Failure";
}
m_taskCompletePublisher.publish(msg);
}
| USU-Robosub/Gilligan | rosWorkspace/GateTask/src/GateTask.cpp | C++ | apache-2.0 | 4,576 | [
30522,
1001,
2421,
1000,
4796,
10230,
2243,
1012,
6522,
2361,
1000,
1001,
2421,
1000,
6487,
2891,
12083,
1013,
11336,
8189,
3468,
5244,
2290,
1012,
1044,
1000,
1001,
2421,
1000,
6487,
2891,
12083,
1013,
2391,
1012,
1044,
1000,
1001,
2421,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
namespace Gu.Wpf.FlipView.Gestures
{
using System.Windows;
/// <summary>
/// A point in a gesture, can be a timestamped position in a mouse move.
/// </summary>
public struct GesturePoint
{
/// <summary>
/// The position.
/// </summary>
public readonly Point Point;
/// <summary>
/// The time when the input occurred.
/// </summary>
public readonly int Time;
/// <summary>
/// Initializes a new instance of the <see cref="GesturePoint"/> struct.
/// </summary>
/// <param name="point">The position.</param>
/// <param name="time">The time when the input occurred.</param>
public GesturePoint(Point point, int time)
{
this.Point = point;
this.Time = time;
}
}
} | JohanLarsson/Gu.Wpf.FlipView | Gu.Wpf.FlipView/Gestures/GesturePoint.cs | C# | mit | 843 | [
30522,
3415,
15327,
19739,
1012,
1059,
14376,
1012,
11238,
8584,
1012,
18327,
1063,
2478,
2291,
1012,
3645,
1025,
1013,
1013,
1013,
1026,
12654,
1028,
1013,
1013,
1013,
1037,
2391,
1999,
1037,
9218,
1010,
2064,
2022,
1037,
2335,
15464,
5669... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.
* The license is detailed in the file LICENSE.md, and applies to this file.
*
* Written by Nir Drucker and Shay Gueron
* AWS Cryptographic Algorithms Group.
* (ndrucker@amazon.com, gueron@amazon.com)
*/
#include <string.h>
#include "bike_r1_kem.h"
#include "decode.h"
#include "gf2x.h"
#include "parallel_hash.h"
#include "sampling.h"
_INLINE_ ret_t
encrypt(OUT ct_t *ct,
IN const pk_t *pk,
IN const seed_t *seed,
IN const split_e_t *splitted_e)
{
DEFER_CLEANUP(padded_r_t m = {0}, padded_r_cleanup);
DEFER_CLEANUP(dbl_pad_ct_t p_ct, dbl_pad_ct_cleanup);
// Pad the public key
pad_pk_t p_pk = {0};
VAL(p_pk[0]) = PTRV(pk)[0];
VAL(p_pk[1]) = PTRV(pk)[1];
DMSG(" Sampling m.\n");
GUARD(sample_uniform_r_bits(VAL(m).raw, seed, NO_RESTRICTION));
EDMSG("m: ");
print((uint64_t *)VAL(m).raw, R_BITS);
DMSG(" Calculating the ciphertext.\n");
GUARD(gf2x_mod_mul(p_ct[0].u.qw, m.u.qw, p_pk[0].u.qw));
GUARD(gf2x_mod_mul(p_ct[1].u.qw, m.u.qw, p_pk[1].u.qw));
DMSG(" Addding Error to the ciphertext.\n");
GUARD(gf2x_add(VAL(p_ct[0]).raw, VAL(p_ct[0]).raw, PTRV(splitted_e)[0].raw,
R_SIZE));
GUARD(gf2x_add(VAL(p_ct[1]).raw, VAL(p_ct[1]).raw, PTRV(splitted_e)[1].raw,
R_SIZE));
// Copy the data outside
PTRV(ct)[0] = VAL(p_ct[0]);
PTRV(ct)[1] = VAL(p_ct[1]);
EDMSG("c0: ");
print((uint64_t *)PTRV(ct)[0].raw, R_BITS);
EDMSG("c1: ");
print((uint64_t *)PTRV(ct)[1].raw, R_BITS);
return SUCCESS;
}
_INLINE_ ret_t
calc_pk(OUT pk_t *pk, IN const seed_t *g_seed, IN const pad_sk_t p_sk)
{
// PK is dbl padded because modmul require scratch space for the multiplication
// result
dbl_pad_pk_t p_pk = {0};
// Must intialized padding to zero!!
DEFER_CLEANUP(padded_r_t g = {0}, padded_r_cleanup);
GUARD(sample_uniform_r_bits(VAL(g).raw, g_seed, MUST_BE_ODD));
EDMSG("g: ");
print((uint64_t *)VAL(g).raw, R_BITS);
// Calculate (g0, g1) = (g*h1, g*h0)
GUARD(gf2x_mod_mul(p_pk[0].u.qw, g.u.qw, p_sk[1].u.qw));
GUARD(gf2x_mod_mul(p_pk[1].u.qw, g.u.qw, p_sk[0].u.qw));
// Copy the data outside
PTRV(pk)[0] = VAL(p_pk[0]);
PTRV(pk)[1] = VAL(p_pk[1]);
EDMSG("g0: ");
print((uint64_t *)PTRV(pk)[0].raw, R_BITS);
EDMSG("g1: ");
print((uint64_t *)PTRV(pk)[1].raw, R_BITS);
return SUCCESS;
}
// Generate the Shared Secret (K(e))
_INLINE_ void
get_ss(OUT ss_t *out, IN const e_t *e)
{
DMSG(" Enter get_ss.\n");
// Calculate the hash
sha_hash_t hash = {0};
parallel_hash(&hash, e->raw, sizeof(*e));
// Truncate the final hash into K by copying only the LSBs
memcpy(out->raw, hash.u.raw, sizeof(*out));
secure_clean(hash.u.raw, sizeof(hash));
DMSG(" Exit get_ss.\n");
}
////////////////////////////////////////////////////////////////
// The three APIs below (keygeneration, encapsulate, decapsulate) are defined by
// NIST: In addition there are two KAT versions of this API as defined.
////////////////////////////////////////////////////////////////
int
BIKE1_L1_R1_crypto_kem_keypair(OUT unsigned char *pk, OUT unsigned char *sk)
{
// Convert to this implementation types
sk_t *l_sk = (sk_t *)sk;
pk_t *l_pk = (pk_t *)pk;
// For DRBG and AES_PRF
DEFER_CLEANUP(double_seed_t seeds = {0}, double_seed_cleanup);
DEFER_CLEANUP(aes_ctr_prf_state_t h_prf_state = {0}, aes_ctr_prf_state_cleanup);
// Padded for internal use
// We don't want to send the padded data outside to save BW.
DEFER_CLEANUP(pad_sk_t p_sk = {0}, pad_sk_cleanup);
// Get the entrophy seeds
GUARD(get_seeds(&seeds));
DMSG(" Enter crypto_kem_keypair.\n");
DMSG(" Calculating the secret key.\n");
// Both h0 and h1 use the same context
GUARD(init_aes_ctr_prf_state(&h_prf_state, MAX_AES_INVOKATION, &seeds.u.v.s1));
// Make sure that the wlists are zeroed for the KATs.
memset(l_sk, 0, sizeof(sk_t));
GUARD(generate_sparse_fake_rep(p_sk[0].u.qw, PTR(l_sk).wlist[0].val,
sizeof(p_sk[0]), &h_prf_state));
// Copy data
PTR(l_sk).bin[0] = VAL(p_sk[0]);
GUARD(generate_sparse_fake_rep(p_sk[1].u.qw, PTR(l_sk).wlist[1].val,
sizeof(p_sk[1]), &h_prf_state));
// Copy data
PTR(l_sk).bin[1] = VAL(p_sk[1]);
DMSG(" Calculating the public key.\n");
GUARD(calc_pk(l_pk, &seeds.u.v.s2, p_sk));
EDMSG("h0: ");
print((uint64_t *)&PTR(l_sk).bin[0], R_BITS);
EDMSG("h1: ");
print((uint64_t *)&PTR(l_sk).bin[1], R_BITS);
EDMSG("h0c:");
print((uint64_t *)&PTR(l_sk).wlist[0], SIZEOF_BITS(compressed_idx_dv_t));
EDMSG("h1c:");
print((uint64_t *)&PTR(l_sk).wlist[1], SIZEOF_BITS(compressed_idx_dv_t));
DMSG(" Exit crypto_kem_keypair.\n");
return SUCCESS;
}
// Encapsulate - pk is the public key,
// ct is a key encapsulation message (ciphertext),
// ss is the shared secret.
int
BIKE1_L1_R1_crypto_kem_enc(OUT unsigned char * ct,
OUT unsigned char * ss,
IN const unsigned char *pk)
{
DMSG(" Enter crypto_kem_enc.\n");
// Convert to this implementation types
const pk_t *l_pk = (const pk_t *)pk;
ct_t * l_ct = (ct_t *)ct;
ss_t * l_ss = (ss_t *)ss;
DEFER_CLEANUP(padded_e_t e = {0}, padded_e_cleanup);
// For NIST DRBG_CTR
DEFER_CLEANUP(double_seed_t seeds = {0}, double_seed_cleanup);
DEFER_CLEANUP(aes_ctr_prf_state_t e_prf_state = {0}, aes_ctr_prf_state_cleanup);
// Get the entrophy seeds
GUARD(get_seeds(&seeds));
// Random data generator
// Using first seed
GUARD(init_aes_ctr_prf_state(&e_prf_state, MAX_AES_INVOKATION, &seeds.u.v.s1));
DMSG(" Generating error.\n");
compressed_idx_t_t dummy;
GUARD(generate_sparse_rep(e.u.qw, dummy.val, T1, N_BITS, sizeof(e),
&e_prf_state));
EDMSG("e: ");
print((uint64_t *)VAL(e).raw, sizeof(e) * 8);
// Split e into e0 and e1. Initialization is done in split_e
DEFER_CLEANUP(split_e_t splitted_e, split_e_cleanup);
split_e(&splitted_e, &VAL(e));
EDMSG("e0: ");
print((uint64_t *)VAL(splitted_e)[0].raw, R_BITS);
EDMSG("e1: ");
print((uint64_t *)VAL(splitted_e)[1].raw, R_BITS);
// Computing ct = enc(pk, e)
// Using second seed
DMSG(" Encrypting.\n");
GUARD(encrypt(l_ct, l_pk, &seeds.u.v.s2, &splitted_e));
DMSG(" Generating shared secret.\n");
get_ss(l_ss, &VAL(e));
EDMSG("ss: ");
print((uint64_t *)l_ss->raw, SIZEOF_BITS(*l_ss));
DMSG(" Exit crypto_kem_enc.\n");
return SUCCESS;
}
// Decapsulate - ct is a key encapsulation message (ciphertext),
// sk is the private key,
// ss is the shared secret
int
BIKE1_L1_R1_crypto_kem_dec(OUT unsigned char * ss,
IN const unsigned char *ct,
IN const unsigned char *sk)
{
DMSG(" Enter crypto_kem_dec.\n");
// Convert to this implementation types
const sk_t *l_sk = (const sk_t *)sk;
const ct_t *l_ct = (const ct_t *)ct;
ss_t * l_ss = (ss_t *)ss;
// Force zero initialization
DEFER_CLEANUP(syndrome_t syndrome = {0}, syndrome_cleanup);
DEFER_CLEANUP(e_t e = {0}, e_cleanup);
DMSG(" Computing s.\n");
GUARD(compute_syndrome(&syndrome, l_ct, l_sk));
DMSG(" Decoding.\n");
GUARD(decode(&e, &syndrome, l_ct, l_sk, U_ERR));
// Check if the error weight equals T1
if(count_ones(e.raw, sizeof(e)) != T1)
{
MSG(" Error weight is not t\n");
BIKE_ERROR(E_ERROR_WEIGHT_IS_NOT_T);
}
get_ss(l_ss, &e);
DMSG(" Exit crypto_kem_dec.\n");
return SUCCESS;
}
| alexeblee/s2n | pq-crypto/bike_r1/bike_r1_kem.c | C | apache-2.0 | 8,134 | [
30522,
1013,
1008,
1008,
9385,
9733,
1012,
4012,
1010,
4297,
1012,
2030,
2049,
18460,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1012,
1008,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/env python
# import sys
# sys.path.insert(0, '../')
import pyarchey.pyarchey as py
# o = py.Output()
# print 'Distro Name Pretty Name'
# print '---------------------------'
# print o.readDistro('./slack.test')
# print o.readDistro('./arch.test')
# print o.readDistro('./raspbian.test')
def test_slack():
o = py.Output()
assert o.readDistro('./test/slack.test') == ('Slackware', 'Slackware 14.1')
def test_arch():
o = py.Output()
assert o.readDistro('./test/arch.test') == ('Arch Linux', 'Arch Linux')
def test_raspbian():
o = py.Output()
assert o.readDistro('./test/raspbian.test') == ('Raspbian', 'Raspbian 7 (wheezy)') | walchko/pyarchey | test.py | Python | gpl-3.0 | 646 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
1001,
12324,
25353,
2015,
1001,
25353,
2015,
1012,
4130,
1012,
19274,
1006,
1014,
1010,
1005,
1012,
1012,
1013,
1005,
1007,
12324,
1052,
13380,
5403,
2100,
1012,
1052,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* hci_userchan.c - HCI user channel Bluetooth handling */
/*
* Copyright (c) 2015-2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <errno.h>
#include <sys/atomic.h>
#include <sys/byteorder.h>
#include <drivers/bluetooth/hci_driver.h>
#include <bluetooth/buf.h>
#include <bluetooth/hci_raw.h>
#include <bluetooth/l2cap.h>
#include <bluetooth/iso.h>
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_CORE)
#define LOG_MODULE_NAME bt_hci_raw
#include "common/log.h"
#include "hci_ecc.h"
#include "monitor.h"
#include "hci_raw_internal.h"
#define H4_CMD 0x01
#define H4_ACL 0x02
#define H4_SCO 0x03
#define H4_EVT 0x04
#define H4_ISO 0x05
static struct k_fifo *raw_rx;
#if defined(CONFIG_BT_HCI_RAW_H4_ENABLE)
static uint8_t raw_mode = BT_HCI_RAW_MODE_H4;
#else
static uint8_t raw_mode;
#endif
#define BT_BUF_RX_COUNT MAX(CONFIG_BT_BUF_EVT_RX_COUNT, CONFIG_BT_BUF_ACL_RX_COUNT)
NET_BUF_POOL_FIXED_DEFINE(hci_rx_pool, BT_BUF_RX_COUNT,
BT_BUF_RX_SIZE, NULL);
NET_BUF_POOL_FIXED_DEFINE(hci_cmd_pool, CONFIG_BT_BUF_CMD_TX_COUNT,
BT_BUF_CMD_SIZE(CONFIG_BT_BUF_CMD_TX_SIZE), NULL);
NET_BUF_POOL_FIXED_DEFINE(hci_acl_pool, CONFIG_BT_BUF_ACL_TX_COUNT,
BT_BUF_ACL_SIZE(CONFIG_BT_BUF_ACL_TX_SIZE), NULL);
#if defined(CONFIG_BT_ISO)
NET_BUF_POOL_FIXED_DEFINE(hci_iso_pool, CONFIG_BT_ISO_TX_BUF_COUNT,
BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU), NULL);
#endif /* CONFIG_BT_ISO */
struct bt_dev_raw bt_dev;
struct bt_hci_raw_cmd_ext *cmd_ext;
static size_t cmd_ext_size;
int bt_hci_driver_register(const struct bt_hci_driver *drv)
{
if (bt_dev.drv) {
return -EALREADY;
}
if (!drv->open || !drv->send) {
return -EINVAL;
}
bt_dev.drv = drv;
BT_DBG("Registered %s", drv->name ? drv->name : "");
bt_monitor_new_index(BT_MONITOR_TYPE_PRIMARY, drv->bus,
BT_ADDR_ANY, drv->name ? drv->name : "bt0");
return 0;
}
struct net_buf *bt_buf_get_rx(enum bt_buf_type type, k_timeout_t timeout)
{
struct net_buf *buf;
switch (type) {
case BT_BUF_EVT:
case BT_BUF_ACL_IN:
case BT_BUF_ISO_IN:
break;
default:
BT_ERR("Invalid rx type: %u", type);
return NULL;
}
buf = net_buf_alloc(&hci_rx_pool, timeout);
if (!buf) {
return buf;
}
net_buf_reserve(buf, BT_BUF_RESERVE);
bt_buf_set_type(buf, type);
return buf;
}
struct net_buf *bt_buf_get_tx(enum bt_buf_type type, k_timeout_t timeout,
const void *data, size_t size)
{
struct net_buf_pool *pool;
struct net_buf *buf;
switch (type) {
case BT_BUF_CMD:
pool = &hci_cmd_pool;
break;
case BT_BUF_ACL_OUT:
pool = &hci_acl_pool;
break;
#if defined(CONFIG_BT_ISO)
case BT_BUF_ISO_OUT:
pool = &hci_iso_pool;
break;
#endif /* CONFIG_BT_ISO */
case BT_BUF_H4:
if (IS_ENABLED(CONFIG_BT_HCI_RAW_H4) &&
raw_mode == BT_HCI_RAW_MODE_H4) {
switch (((uint8_t *)data)[0]) {
case H4_CMD:
type = BT_BUF_CMD;
pool = &hci_cmd_pool;
break;
case H4_ACL:
type = BT_BUF_ACL_OUT;
pool = &hci_acl_pool;
break;
#if defined(CONFIG_BT_ISO)
case H4_ISO:
type = BT_BUF_ISO_OUT;
pool = &hci_iso_pool;
break;
#endif /* CONFIG_BT_ISO */
default:
LOG_ERR("Unknown H4 type %u", type);
return NULL;
}
/* Adjust data pointer to discard the header */
data = (uint8_t *)data + 1;
size--;
break;
}
__fallthrough;
default:
BT_ERR("Invalid tx type: %u", type);
return NULL;
}
buf = net_buf_alloc(pool, timeout);
if (!buf) {
return buf;
}
net_buf_reserve(buf, BT_BUF_RESERVE);
bt_buf_set_type(buf, type);
if (data && size) {
net_buf_add_mem(buf, data, size);
}
return buf;
}
struct net_buf *bt_buf_get_cmd_complete(k_timeout_t timeout)
{
return bt_buf_get_rx(BT_BUF_EVT, timeout);
}
struct net_buf *bt_buf_get_evt(uint8_t evt, bool discardable, k_timeout_t timeout)
{
return bt_buf_get_rx(BT_BUF_EVT, timeout);
}
int bt_recv(struct net_buf *buf)
{
BT_DBG("buf %p len %u", buf, buf->len);
bt_monitor_send(bt_monitor_opcode(buf), buf->data, buf->len);
if (IS_ENABLED(CONFIG_BT_HCI_RAW_H4) &&
raw_mode == BT_HCI_RAW_MODE_H4) {
switch (bt_buf_get_type(buf)) {
case BT_BUF_EVT:
net_buf_push_u8(buf, H4_EVT);
break;
case BT_BUF_ACL_IN:
net_buf_push_u8(buf, H4_ACL);
break;
case BT_BUF_ISO_IN:
if (IS_ENABLED(CONFIG_BT_ISO)) {
net_buf_push_u8(buf, H4_ISO);
break;
}
__fallthrough;
default:
BT_ERR("Unknown type %u", bt_buf_get_type(buf));
return -EINVAL;
}
}
/* Queue to RAW rx queue */
net_buf_put(raw_rx, buf);
return 0;
}
int bt_recv_prio(struct net_buf *buf)
{
if (bt_buf_get_type(buf) == BT_BUF_EVT) {
struct bt_hci_evt_hdr *hdr = (void *)buf->data;
uint8_t evt_flags = bt_hci_evt_get_flags(hdr->evt);
if ((evt_flags & BT_HCI_EVT_FLAG_RECV_PRIO) &&
(evt_flags & BT_HCI_EVT_FLAG_RECV)) {
/* Avoid queuing the event twice */
return 0;
}
}
return bt_recv(buf);
}
static void bt_cmd_complete_ext(uint16_t op, uint8_t status)
{
struct net_buf *buf;
struct bt_hci_evt_cc_status *cc;
if (status == BT_HCI_ERR_EXT_HANDLED) {
return;
}
buf = bt_hci_cmd_complete_create(op, sizeof(*cc));
cc = net_buf_add(buf, sizeof(*cc));
cc->status = status;
bt_recv(buf);
}
static uint8_t bt_send_ext(struct net_buf *buf)
{
struct bt_hci_cmd_hdr *hdr;
struct net_buf_simple_state state;
int i;
uint16_t op;
uint8_t status;
status = BT_HCI_ERR_SUCCESS;
if (!cmd_ext) {
return status;
}
net_buf_simple_save(&buf->b, &state);
if (buf->len < sizeof(*hdr)) {
BT_ERR("No HCI Command header");
return BT_HCI_ERR_INVALID_PARAM;
}
hdr = net_buf_pull_mem(buf, sizeof(*hdr));
if (buf->len < hdr->param_len) {
BT_ERR("Invalid HCI CMD packet length");
return BT_HCI_ERR_INVALID_PARAM;
}
op = sys_le16_to_cpu(hdr->opcode);
for (i = 0; i < cmd_ext_size; i++) {
struct bt_hci_raw_cmd_ext *cmd = &cmd_ext[i];
if (cmd->op == op) {
if (buf->len < cmd->min_len) {
status = BT_HCI_ERR_INVALID_PARAM;
} else {
status = cmd->func(buf);
}
break;
}
}
if (status) {
bt_cmd_complete_ext(op, status);
return status;
}
net_buf_simple_restore(&buf->b, &state);
return status;
}
int bt_send(struct net_buf *buf)
{
BT_DBG("buf %p len %u", buf, buf->len);
bt_monitor_send(bt_monitor_opcode(buf), buf->data, buf->len);
if (IS_ENABLED(CONFIG_BT_HCI_RAW_CMD_EXT) &&
bt_buf_get_type(buf) == BT_BUF_CMD) {
uint8_t status;
status = bt_send_ext(buf);
if (status) {
return status;
}
}
if (IS_ENABLED(CONFIG_BT_TINYCRYPT_ECC)) {
return bt_hci_ecc_send(buf);
}
return bt_dev.drv->send(buf);
}
int bt_hci_raw_set_mode(uint8_t mode)
{
BT_DBG("mode %u", mode);
if (IS_ENABLED(CONFIG_BT_HCI_RAW_H4)) {
switch (mode) {
case BT_HCI_RAW_MODE_PASSTHROUGH:
case BT_HCI_RAW_MODE_H4:
raw_mode = mode;
return 0;
}
}
return -EINVAL;
}
uint8_t bt_hci_raw_get_mode(void)
{
if (IS_ENABLED(CONFIG_BT_HCI_RAW_H4)) {
return raw_mode;
}
return BT_HCI_RAW_MODE_PASSTHROUGH;
}
void bt_hci_raw_cmd_ext_register(struct bt_hci_raw_cmd_ext *cmds, size_t size)
{
if (IS_ENABLED(CONFIG_BT_HCI_RAW_CMD_EXT)) {
cmd_ext = cmds;
cmd_ext_size = size;
}
}
int bt_enable_raw(struct k_fifo *rx_queue)
{
const struct bt_hci_driver *drv = bt_dev.drv;
int err;
BT_DBG("");
raw_rx = rx_queue;
if (!bt_dev.drv) {
BT_ERR("No HCI driver registered");
return -ENODEV;
}
if (IS_ENABLED(CONFIG_BT_TINYCRYPT_ECC)) {
bt_hci_ecc_init();
}
err = drv->open();
if (err) {
BT_ERR("HCI driver open failed (%d)", err);
return err;
}
BT_INFO("Bluetooth enabled in RAW mode");
return 0;
}
| finikorg/zephyr | subsys/bluetooth/host/hci_raw.c | C | apache-2.0 | 7,565 | [
30522,
1013,
1008,
16731,
2072,
1035,
5310,
14856,
1012,
1039,
30524,
1001,
2421,
1026,
25353,
2015,
1013,
9593,
1012,
1044,
1028,
1001,
2421,
1026,
25353,
2015,
1013,
24880,
8551,
2121,
1012,
1044,
1028,
1001,
2421,
1026,
6853,
1013,
2630,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.jim.portal.controller;
import com.jim.portal.entity.BooksEntity;
import com.jim.portal.hibernate.BookManagementRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* Created by jim on 2017/1/5.
* This class is ...
*/
@Controller
@RequestMapping(value = "/book")
public class BookController extends BaseController {
@Autowired
private BookManagementRepository bookManagementRepository;
@RequestMapping(value = "/updateBook", method = RequestMethod.GET)
public String updateBook(){
return "system/book/update-book";
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String update(BooksEntity booksEntity, String id){
result.clear();
try {
bookManagementRepository.update(booksEntity, id);
result.put("result", 0);
}catch (Exception ex){
result.put("result", 1);
result.put("msg", ex.toString());
}
return gson.toJson(result);
}
@RequestMapping(value = "/createBook", method = RequestMethod.GET)
public String createBook(){
return "system/book/create-book";
}
@RequestMapping(value = "/save", method = RequestMethod.POST)
public String save(BooksEntity booksEntity){
result.clear();
try {
BooksEntity book = bookManagementRepository.create(booksEntity);
result.put("result", 0);
result.put("msg", book);
}catch (Exception ex){
result.put("result", 1);
result.put("msg", ex.toString());
}
return gson.toJson(result);
}
}
| liu1084/springmvc-cookbook | cloudstreetmarket-parent/cloudstreetmarket-webapp/src/main/java/com/jim/portal/controller/BookController.java | Java | mit | 1,630 | [
30522,
7427,
4012,
1012,
3958,
1012,
9445,
1012,
11486,
1025,
12324,
4012,
1012,
3958,
1012,
9445,
1012,
9178,
1012,
2808,
4765,
3012,
1025,
12324,
4012,
1012,
3958,
1012,
9445,
1012,
7632,
5677,
12556,
1012,
2338,
24805,
20511,
2890,
6873,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/bin/bash
#
# SLURM batch script to launch BLAST
#
#SBATCH -p nbi-medium # partition (queue)
#SBATCH -N 1 # number of nodes
#SBATCH -n 1 # number of cores
#SBATCH --mem 30000 # memory pool for all cores
#SBATCH -t 2-00:00 # time (D-HH:MM)
#SBATCH -o /nbi/Research-Groups/NBI/Cristobal-Uauy/PB_AFLF/control_timecourse/TF_analysis/slurm_output/extractNAC.%N.%j.out # STDOUT
#SBATCH -e /nbi/Research-Groups/NBI/Cristobal-Uauy/PB_AFLF/control_timecourse/TF_analysis/slurm_output/extractNAC.%N.%j.err # STDERR
#SBATCH -J extractNAC
#SBATCH --mail-type=END,FAIL # notifications for job done & fail
#SBATCH --mail-user=philippa.borrill\@jic.ac.uk # send-to address
source perl-5.22.1
cd /nbi/Research-Groups/NBI/Cristobal-Uauy/PB_AFLF/control_timecourse/TF_analysis/
perl /nbi/Research-Groups/NBI/Cristobal-Uauy/PB_AFLF/control_timecourse/scripts/fasta_extract_by_pattern.pl -r -p "|NAC|" Tritcum_aestivum_seq.fas > Triticum_aestivum_NAC.fa | philippaborrill/AFLF_timecourse_control | run_extract_by_pattern.sh | Shell | gpl-3.0 | 937 | [
30522,
1001,
999,
1013,
8026,
1013,
24234,
1001,
1001,
22889,
3126,
2213,
14108,
5896,
2000,
4888,
8479,
1001,
1001,
24829,
4017,
2818,
1011,
1052,
1050,
5638,
1011,
5396,
1001,
13571,
1006,
24240,
1007,
1001,
24829,
4017,
2818,
1011,
1050,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import java.sql.*;
public class ConnessioneDB {
static {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "calcio";
String userName = "root";
String password = "";
/*
String url = "jdbc:mysql://127.11.139.2:3306/";
String dbName = "sirio";
String userName = "adminlL8hBfI";
String password = "HPZjQCQsnVG4";
*/
public Connection openConnection(){
try {
conn = DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connessione al DataBase stabilita!");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return conn;
}
public void closeConnection(Connection conn){
try {
conn.close();
System.out.println(" Chiusa connessione al DB!");
}
catch (SQLException e) {
e.printStackTrace();
}
}
}
| nicolediana/progetto | ServletExample/src/ConnessioneDB.java | Java | epl-1.0 | 1,248 | [
30522,
12324,
9262,
1012,
29296,
1012,
1008,
1025,
2270,
2465,
9530,
2791,
19798,
2497,
1063,
10763,
1063,
3046,
1063,
2465,
1012,
2005,
18442,
1006,
1000,
4012,
1012,
2026,
2015,
4160,
2140,
1012,
26219,
9818,
1012,
4062,
1000,
1007,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// --------------------------------------------------------------------------------------------------
// Copyright (c) 2016 Microsoft Corporation
//
// 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 com.microsoft.Malmo.Utils;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.stats.StatBase;
import net.minecraft.stats.StatFileWriter;
import net.minecraft.stats.StatList;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ResourceLocation;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
/**
* Helper class for building the "World data" to be passed from Minecraft back to the agent.<br>
* This class contains helper methods to build up a JSON tree of useful information, such as health, XP, food levels, distance travelled, etc.etc.<br>
* It can also build up a grid of the block types around the player.
* Call this on the Server side only.
*/
public class JSONWorldDataHelper
{
/**
* Simple class to hold the dimensions of the environment around the player
* that we want to return in the World Data.<br>
* Min and max define an inclusive range, where the player's feet are situated at (0,0,0)
*/
static public class ImmediateEnvironmentDimensions {
public int xMin;
public int xMax;
public int yMin;
public int yMax;
public int zMin;
public int zMax;
/**
* Default constructor asks for an environment just big enough to contain
* the player and one block all around him.
*/
public ImmediateEnvironmentDimensions() {
this.xMin = -1; this.xMax = 1;
this.zMin = -1; this.zMax = 1;
this.yMin = -1; this.yMax = 2;
}
/**
* Convenient constructor - effectively specifies the margin around the player<br>
* Passing (1,1,1) will have the same effect as the default constructor.
* @param xMargin number of blocks to the left and right of the player
* @param yMargin number of blocks above and below player
* @param zMargin number of blocks in front of and behind player
*/
public ImmediateEnvironmentDimensions(int xMargin, int yMargin, int zMargin) {
this.xMin = -xMargin; this.xMax = xMargin;
this.yMin = -yMargin; this.yMax = yMargin + 1; // +1 because the player is two blocks tall.
this.zMin = -zMargin; this.zMax = zMargin;
}
/**
* Convenient constructor for the case where all that is required is the flat patch of ground<br>
* around the player's feet.
* @param xMargin number of blocks around the player in the x-axis
* @param zMargin number of blocks around the player in the z-axis
*/
public ImmediateEnvironmentDimensions(int xMargin, int zMargin) {
this.xMin = -xMargin; this.xMax = xMargin;
this.yMin = -1; this.yMax = -1; // Flat patch of ground at the player's feet.
this.zMin = -zMargin; this.zMax = zMargin;
}
};
/** Builds the basic achievement world data to be used as observation signals by the listener.
* @param json a JSON object into which the achievement stats will be added.
*/
public static void buildAchievementStats(JsonObject json, EntityPlayerMP player)
{
StatFileWriter sfw = player.getStatFile();
json.addProperty("DistanceTravelled",
sfw.readStat((StatBase)StatList.distanceWalkedStat)
+ sfw.readStat((StatBase)StatList.distanceSwumStat)
+ sfw.readStat((StatBase)StatList.distanceDoveStat)
+ sfw.readStat((StatBase)StatList.distanceFallenStat)
); // TODO: there are many other ways of moving!
json.addProperty("TimeAlive", sfw.readStat((StatBase)StatList.timeSinceDeathStat));
json.addProperty("MobsKilled", sfw.readStat((StatBase)StatList.mobKillsStat));
json.addProperty("DamageTaken", sfw.readStat((StatBase)StatList.damageTakenStat));
/* Other potential reinforcement signals that may be worth researching:
json.addProperty("BlocksDestroyed", sfw.readStat((StatBase)StatList.objectBreakStats) - but objectBreakStats is an array of 32000 StatBase objects - indexed by block type.);
json.addProperty("Blocked", ev.player.isMovementBlocked()) - but isMovementBlocker() is a protected method (can get round this with reflection)
*/
}
/** Builds the basic life world data to be used as observation signals by the listener.
* @param json a JSON object into which the life stats will be added.
*/
public static void buildLifeStats(JsonObject json, EntityPlayerMP player)
{
json.addProperty("Life", player.getHealth());
json.addProperty("Score", player.getScore()); // Might always be the same as XP?
json.addProperty("Food", player.getFoodStats().getFoodLevel());
json.addProperty("XP", player.experienceTotal);
json.addProperty("IsAlive", !player.isDead);
json.addProperty("Air", player.getAir());
}
/** Builds the player position data to be used as observation signals by the listener.
* @param json a JSON object into which the positional information will be added.
*/
public static void buildPositionStats(JsonObject json, EntityPlayerMP player)
{
json.addProperty("XPos", player.posX);
json.addProperty("YPos", player.posY);
json.addProperty("ZPos", player.posZ);
json.addProperty("Pitch", player.rotationPitch);
json.addProperty("Yaw", player.rotationYaw);
}
/**
* Build a signal for the cubic block grid centred on the player.<br>
* Default is 3x3x4. (One cube all around the player.)<br>
* Blocks are returned as a 1D array, in order
* along the x, then z, then y axes.<br>
* Data will be returned in an array called "Cells"
* @param json a JSON object into which the info for the object under the mouse will be added.
* @param environmentDimensions object which specifies the required dimensions of the grid to be returned.
* @param jsonName name to use for identifying the returned JSON array.
*/
public static void buildGridData(JsonObject json, ImmediateEnvironmentDimensions environmentDimensions, EntityPlayerMP player, String jsonName)
{
if (player == null || json == null)
return;
JsonArray arr = new JsonArray();
BlockPos pos = player.getPosition();
for (int y = environmentDimensions.yMin; y <= environmentDimensions.yMax; y++)
{
for (int z = environmentDimensions.zMin; z <= environmentDimensions.zMax; z++)
{
for (int x = environmentDimensions.xMin; x <= environmentDimensions.xMax; x++)
{
BlockPos p = pos.add(x, y, z);
String name = "";
IBlockState state = player.worldObj.getBlockState(p);
Object blockName = Block.blockRegistry.getNameForObject(state.getBlock());
if (blockName instanceof ResourceLocation)
{
name = ((ResourceLocation)blockName).getResourcePath();
}
JsonElement element = new JsonPrimitive(name);
arr.add(element);
}
}
}
json.add(jsonName, arr);
}
}
| maxfoow/MalmoExperience | Malmo-0.16.0-Windows-64bit/Minecraft/src/main/java/com/microsoft/Malmo/Utils/JSONWorldDataHelper.java | Java | gpl-3.0 | 8,861 | [
30522,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
#ifndef V8SVGAnimatedTransformList_h
#define V8SVGAnimatedTransformList_h
#include "bindings/core/v8/ScriptWrappable.h"
#include "bindings/core/v8/ToV8.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8DOMWrapper.h"
#include "bindings/core/v8/WrapperTypeInfo.h"
#include "core/CoreExport.h"
#include "core/svg/SVGAnimatedTransformList.h"
#include "platform/heap/Handle.h"
namespace blink {
class V8SVGAnimatedTransformList {
public:
CORE_EXPORT static bool hasInstance(v8::Local<v8::Value>, v8::Isolate*);
static v8::Local<v8::Object> findInstanceInPrototypeChain(v8::Local<v8::Value>, v8::Isolate*);
CORE_EXPORT static v8::Local<v8::FunctionTemplate> domTemplate(v8::Isolate*);
static SVGAnimatedTransformList* toImpl(v8::Local<v8::Object> object)
{
return toScriptWrappable(object)->toImpl<SVGAnimatedTransformList>();
}
CORE_EXPORT static SVGAnimatedTransformList* toImplWithTypeCheck(v8::Isolate*, v8::Local<v8::Value>);
CORE_EXPORT static const WrapperTypeInfo wrapperTypeInfo;
static void refObject(ScriptWrappable*);
static void derefObject(ScriptWrappable*);
template<typename VisitorDispatcher>
static void trace(VisitorDispatcher visitor, ScriptWrappable* scriptWrappable)
{
#if ENABLE(OILPAN)
visitor->trace(scriptWrappable->toImpl<SVGAnimatedTransformList>());
#endif
}
static void visitDOMWrapper(v8::Isolate*, ScriptWrappable*, const v8::Persistent<v8::Object>&);
static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
static void installConditionallyEnabledProperties(v8::Local<v8::Object>, v8::Isolate*) { }
static void preparePrototypeObject(v8::Isolate*, v8::Local<v8::Object> prototypeObject, v8::Local<v8::FunctionTemplate> interfaceTemplate) { }
};
template <>
struct V8TypeOf<SVGAnimatedTransformList> {
typedef V8SVGAnimatedTransformList Type;
};
} // namespace blink
#endif // V8SVGAnimatedTransformList_h
| zero-rp/miniblink49 | gen/blink/bindings/core/v8/V8SVGAnimatedTransformList.h | C | apache-2.0 | 2,271 | [
30522,
1013,
1013,
9385,
2297,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
1013,
2179,
1999,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
"""proyectoP4 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Add an import: from blog import urls as blog_urls
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url, patterns
from django.contrib import admin
from Workinout import views
from django.conf import settings
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^Workinout/', include('Workinout.urls')), # ADD THIS NEW TUPLE!media/(?P<path>.*)
]
if settings.DEBUG:
urlpatterns += patterns(
'django.views.static',
(r'media/(?P<path>.*)',
'serve',
{'document_root': settings.MEDIA_ROOT}), )
else:
urlpatterns += patterns('', url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_PATH}),
)
| jesmorc/Workinout | proyectoP4/urls.py | Python | gpl-3.0 | 1,273 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
1000,
1000,
1000,
4013,
6672,
6593,
7361,
2549,
24471,
2140,
9563,
1996,
1036,
24471,
14277,
20097,
3619,
1036,
2862,
5847,
24471,
4877,
2000,
5328,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package de.maxgb.vertretungsplan.manager;
import android.content.Context;
import android.os.AsyncTask;
import de.maxgb.android.util.Logger;
import de.maxgb.vertretungsplan.util.Constants;
import de.maxgb.vertretungsplan.util.Stunde;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
public class StundenplanManager {
public static final int BEGINN_NACHMITTAG = 8;
public static final int ANZAHL_SAMSTAG = 4;
public static final int ANZAHL_NACHMITTAG = 2;
private static StundenplanManager instance;
public static synchronized StundenplanManager getInstance(Context context) {
if (instance == null) {
instance = new StundenplanManager(context);
}
return instance;
}
private final String TAG = "StundenplanManager";
private int lastResult = 0;
private ArrayList<Stunde[]> woche;
private Context context;
// Listener-------------
private ArrayList<OnUpdateListener> listener = new ArrayList<OnUpdateListener>();
private StundenplanManager(Context context) {
this.context = context;
auswerten();
}
public void asyncAuswerten() {
AuswertenTask task = new AuswertenTask();
task.execute();
}
public void auswerten() {
lastResult = dateiAuswerten();
if (lastResult == -1) {
} else {
woche = null;
}
}
public void auswertenWithNotify() {
auswerten();
notifyListener();
}
public ArrayList<Stunde[]> getClonedStundenplan() {
if (woche == null) return null;
ArrayList<Stunde[]> clone;
try {
clone = new ArrayList<Stunde[]>(woche.size());
for (Stunde[] item : woche) {
Stunde[] clone2 = new Stunde[item.length];
for (int i = 0; i < item.length; i++) {
clone2[i] = item[i].clone();
}
clone.add(clone2);
}
return clone;
} catch (NullPointerException e) {
Logger.e(TAG, "Failed to clone stundenplan", e);
return null;
}
}
public String getLastResult() {
switch (lastResult) {
case -1:
return "Erfolgreich ausgewertet";
case 1:
return "Datei existiert nicht";
case 2:
return "Kann Datei nicht lesen";
case 3:
return "Zugriffsfehler";
case 4:
return "Parsingfehler";
default:
return "Noch nicht ausgewertet";
}
}
public ArrayList<Stunde[]> getStundenplan() {
return woche;
}
public void notifyListener() {
for (int i = 0; i < listener.size(); i++) {
if (listener.get(i) != null) {
listener.get(i).onStundenplanUpdate();
}
}
}
public void registerOnUpdateListener(OnUpdateListener listener) {
this.listener.add(listener);
}
public void unregisterOnUpdateListener(OnUpdateListener listener) {
this.listener.remove(listener);
}
private Stunde[] convertJSONArrayToStundenArray(JSONArray tag) throws JSONException {
Stunde[] result = new Stunde[BEGINN_NACHMITTAG - 1 + ANZAHL_NACHMITTAG];
for (int i = 0; i < BEGINN_NACHMITTAG - 1 + ANZAHL_NACHMITTAG; i++) {
JSONArray stunde = tag.getJSONArray(i);
if (i >= BEGINN_NACHMITTAG - 1) {
result[i] = new Stunde(stunde.getString(0), stunde.getString(1), i + 1, stunde.getString(2));
} else {
result[i] = new Stunde(stunde.getString(0), stunde.getString(1), i + 1);
}
}
return result;
}
/**
* Wertet die Stundenplandatei aus
*
* @return Fehlercode -1 bei Erfolg,1 Datei existiert nicht, 2 Datei kann nicht gelesen werden,3 Fehler beim Lesen,4 Fehler
* beim Parsen
*
*/
private int dateiAuswerten() {
File loadoutFile = new File(context.getFilesDir(), Constants.SP_FILE_NAME);
ArrayList<Stunde[]> w = new ArrayList<Stunde[]>();
if (!loadoutFile.exists()) {
Logger.w(TAG, "Stundenplan file doesn´t exist");
return 1;
}
if (!loadoutFile.canRead()) {
Logger.w(TAG, "Can´t read Stundenplan file");
return 2;
}
try {
BufferedReader br = new BufferedReader(new FileReader(loadoutFile));
String line = br.readLine();
br.close();
JSONObject stundenplan = new JSONObject(line);
JSONArray mo = stundenplan.getJSONArray("mo");
JSONArray di = stundenplan.getJSONArray("di");
JSONArray mi = stundenplan.getJSONArray("mi");
JSONArray d = stundenplan.getJSONArray("do");
JSONArray fr = stundenplan.getJSONArray("fr");
JSONObject sa = stundenplan.getJSONObject("sa");
// Samstag
Stunde[] samstag = new Stunde[9];
JSONArray eins = sa.getJSONArray("0");
JSONArray zwei = sa.getJSONArray("1");
JSONArray drei = sa.getJSONArray("2");
JSONArray vier = sa.getJSONArray("3");
JSONArray acht = sa.getJSONArray("7");
JSONArray neun = sa.getJSONArray("8");
samstag[0] = new Stunde(eins.getString(0), eins.getString(1), 1);
samstag[1] = new Stunde(zwei.getString(0), zwei.getString(1), 2);
samstag[2] = new Stunde(drei.getString(0), drei.getString(1), 3);
samstag[3] = new Stunde(vier.getString(0), vier.getString(1), 4);
samstag[4] = new Stunde("", "", 5);
samstag[5] = new Stunde("", "", 6);
samstag[6] = new Stunde("", "", 7);
samstag[7] = new Stunde(acht.getString(0), acht.getString(1), 8, acht.getString(2));
samstag[8] = new Stunde(neun.getString(0), neun.getString(1), 9, neun.getString(2));
w.add(convertJSONArrayToStundenArray(mo));
w.add(convertJSONArrayToStundenArray(di));
w.add(convertJSONArrayToStundenArray(mi));
w.add(convertJSONArrayToStundenArray(d));
w.add(convertJSONArrayToStundenArray(fr));
w.add(samstag);
/*
* for(int i=0;i<w.size();i++){ for(int j=0;j<w.get(i).length;j++){ System.out.println(w.get(i)[j].toString()); } }
*/
} catch (IOException e) {
Logger.e(TAG, "Fehler beim Lesen der Datei", e);
return 3;
} catch (JSONException e) {
Logger.e(TAG, "Fehler beim Parsen der Datei", e);
return 4;
}
woche = w;
return -1;
}
public interface OnUpdateListener {
void onStundenplanUpdate();
}
// ------------------------
private class AuswertenTask extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
auswerten();
return null;
}
@Override
protected void onPostExecute(Void v) {
notifyListener();
}
}
}
| maxanier/Vertretungsplan | app/src/main/java/de/maxgb/vertretungsplan/manager/StundenplanManager.java | Java | mpl-2.0 | 6,174 | [
30522,
7427,
2139,
1012,
4098,
18259,
1012,
2310,
5339,
13465,
5575,
13102,
5802,
1012,
3208,
1025,
12324,
11924,
1012,
4180,
1012,
6123,
1025,
12324,
11924,
1012,
9808,
1012,
2004,
6038,
25572,
6711,
1025,
12324,
2139,
1012,
4098,
18259,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'spec_helper'
require './spec/sisimai/lhost/code'
enginename = 'MailMarshalSMTP'
isexpected = [
{ 'n' => '02', 's' => /\A5[.]1[.]1\z/, 'r' => /userunknown/, 'b' => /\A0\z/ },
]
Sisimai::Lhost::Code.maketest(enginename, isexpected)
| azumakuniyuki/rb-Sisimai | spec/sisimai/lhost/public-mailmarshalsmtp_spec.rb | Ruby | bsd-2-clause | 242 | [
30522,
5478,
1005,
28699,
1035,
2393,
2121,
1005,
5478,
1005,
1012,
1013,
28699,
1013,
24761,
9581,
2072,
1013,
1048,
15006,
2102,
1013,
3642,
1005,
3194,
18442,
1027,
1005,
5653,
7849,
7377,
4877,
20492,
2361,
1005,
2003,
10288,
5051,
1098... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
KeePass Password Safe - The Open-Source Password Manager
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
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
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;
using System.Xml.Xsl;
using System.Windows.Forms;
using System.Diagnostics;
using System.Drawing;
using KeePass.App;
using KeePass.Resources;
using KeePass.UI;
using KeePassLib;
using KeePassLib.Interfaces;
using KeePassLib.Serialization;
using KeePassLib.Utility;
namespace KeePass.DataExchange.Formats
{
internal sealed class XslTransform2x : FileFormatProvider
{
private const string ParamXslFile = "XslFile";
public override bool SupportsImport { get { return false; } }
public override bool SupportsExport { get { return true; } }
public override string FormatName { get { return KPRes.XslExporter; } }
public override string ApplicationGroup { get { return KPRes.General; } }
public override Image SmallIcon
{
get { return KeePass.Properties.Resources.B16x16_CompFile; }
}
public override bool Export(PwExportInfo pwExportInfo, Stream sOutput,
IStatusLogger slLogger)
{
string strXslFile;
pwExportInfo.Parameters.TryGetValue(ParamXslFile, out strXslFile);
if(string.IsNullOrEmpty(strXslFile))
{
strXslFile = UIGetXslFile();
if(string.IsNullOrEmpty(strXslFile))
return false;
}
return ExportEx(pwExportInfo, sOutput, slLogger, strXslFile);
}
private static string UIGetXslFile()
{
string strFilter = UIUtil.CreateFileTypeFilter("xsl", KPRes.XslFileType, true);
OpenFileDialogEx dlgXsl = UIUtil.CreateOpenFileDialog(KPRes.XslSelectFile,
strFilter, 1, "xsl", false, AppDefs.FileDialogContext.Xsl);
if(dlgXsl.ShowDialog() != DialogResult.OK) return null;
return dlgXsl.FileName;
}
private bool ExportEx(PwExportInfo pwExportInfo, Stream sOutput,
IStatusLogger slLogger, string strXslFile)
{
XslCompiledTransform xsl = new XslCompiledTransform();
try { xsl.Load(strXslFile); }
catch(Exception exXsl)
{
throw new NotSupportedException(strXslFile + MessageService.NewParagraph +
KPRes.NoXslFile + MessageService.NewParagraph + exXsl.Message);
}
byte[] pbData;
using(MemoryStream ms = new MemoryStream())
{
PwDatabase pd = (pwExportInfo.ContextDatabase ?? new PwDatabase());
KdbxFile f = new KdbxFile(pd);
f.Save(ms, pwExportInfo.DataGroup, KdbxFormat.PlainXml, slLogger);
pbData = ms.ToArray();
}
if(pbData == null) throw new OutOfMemoryException();
XmlWriterSettings xws = xsl.OutputSettings;
if(xws == null)
{
xws = new XmlWriterSettings();
xws.CheckCharacters = false;
xws.ConformanceLevel = ConformanceLevel.Auto;
xws.Encoding = StrUtil.Utf8;
// xws.Indent = false;
xws.IndentChars = "\t";
xws.NewLineChars = MessageService.NewLine;
xws.NewLineHandling = NewLineHandling.None;
xws.OmitXmlDeclaration = true;
}
using(MemoryStream msIn = new MemoryStream(pbData, false))
{
using(XmlReader xrIn = XmlReader.Create(msIn))
{
using(XmlWriter xwOut = XmlWriter.Create(sOutput, xws))
{
xsl.Transform(xrIn, xwOut);
}
}
}
MemUtil.ZeroByteArray(pbData);
return true;
}
}
}
| Stoom/KeePass | KeePass/DataExchange/Formats/XslTransform2x.cs | C# | gpl-2.0 | 3,970 | [
30522,
1013,
1008,
2562,
12054,
20786,
3647,
1011,
1996,
2330,
1011,
3120,
20786,
3208,
9385,
1006,
1039,
1007,
2494,
1011,
2418,
14383,
5498,
2243,
14365,
2140,
1026,
14383,
5498,
2243,
1012,
14365,
2140,
1030,
1056,
1011,
3784,
1012,
2139... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Behat\Context\Ui\Admin;
use Behat\Behat\Context\Context;
use Sylius\Behat\NotificationType;
use Sylius\Behat\Page\Admin\Crud\IndexPageInterface;
use Sylius\Behat\Page\Admin\PromotionCoupon\CreatePageInterface;
use Sylius\Behat\Page\Admin\PromotionCoupon\GeneratePageInterface;
use Sylius\Behat\Page\Admin\PromotionCoupon\UpdatePageInterface;
use Sylius\Behat\Service\NotificationCheckerInterface;
use Sylius\Behat\Service\Resolver\CurrentPageResolverInterface;
use Sylius\Component\Core\Model\PromotionCouponInterface;
use Sylius\Component\Promotion\Model\PromotionInterface;
use Webmozart\Assert\Assert;
final class ManagingPromotionCouponsContext implements Context
{
/** @var CreatePageInterface */
private $createPage;
/** @var GeneratePageInterface */
private $generatePage;
/** @var IndexPageInterface */
private $indexPage;
/** @var UpdatePageInterface */
private $updatePage;
/** @var CurrentPageResolverInterface */
private $currentPageResolver;
/** @var NotificationCheckerInterface */
private $notificationChecker;
public function __construct(
CreatePageInterface $createPage,
GeneratePageInterface $generatePage,
IndexPageInterface $indexPage,
UpdatePageInterface $updatePage,
CurrentPageResolverInterface $currentPageResolver,
NotificationCheckerInterface $notificationChecker
) {
$this->createPage = $createPage;
$this->generatePage = $generatePage;
$this->indexPage = $indexPage;
$this->updatePage = $updatePage;
$this->currentPageResolver = $currentPageResolver;
$this->notificationChecker = $notificationChecker;
}
/**
* @Given /^I browse coupons of (this promotion)$/
* @Given /^I want to view all coupons of (this promotion)$/
* @When /^I browse all coupons of ("[^"]+" promotion)$/
*/
public function iWantToViewAllCouponsOfThisPromotion(PromotionInterface $promotion)
{
$this->indexPage->open(['promotionId' => $promotion->getId()]);
}
/**
* @Given /^I want to create a new coupon for (this promotion)$/
*/
public function iWantToCreateANewCouponForThisPromotion(PromotionInterface $promotion)
{
$this->createPage->open(['promotionId' => $promotion->getId()]);
}
/**
* @Given /^I want to modify the ("[^"]+" coupon) for (this promotion)$/
*/
public function iWantToModifyTheCoupon(PromotionCouponInterface $coupon, PromotionInterface $promotion)
{
$this->updatePage->open(['id' => $coupon->getId(), 'promotionId' => $promotion->getId()]);
}
/**
* @Given /^I want to generate a new coupons for (this promotion)$/
*/
public function iWantToGenerateANewCouponsForThisPromotion(PromotionInterface $promotion)
{
$this->generatePage->open(['promotionId' => $promotion->getId()]);
}
/**
* @When /^I specify its code length as (\d+)$/
* @When I do not specify its code length
*/
public function iSpecifyItsCodeLengthAs($codeLength = null)
{
$this->generatePage->specifyCodeLength($codeLength);
}
/**
* @When /^I limit generated coupons usage to (\d+) times$/
*/
public function iSetGeneratedCouponsUsageLimitTo($limit)
{
$this->generatePage->setUsageLimit($limit);
}
/**
* @When I make generated coupons valid until :date
*/
public function iMakeGeneratedCouponsValidUntil(\DateTimeInterface $date)
{
$this->generatePage->setExpiresAt($date);
}
/**
* @When I specify its code as :code
* @When I do not specify its code
*/
public function iSpecifyItsCodeAs($code = null)
{
$this->createPage->specifyCode($code);
}
/**
* @When I limit its usage to :limit times
*/
public function iLimitItsUsageLimitTo($limit)
{
$this->createPage->setUsageLimit($limit);
}
/**
* @When I change its usage limit to :limit
*/
public function iChangeItsUsageLimitTo($limit)
{
$this->updatePage->setUsageLimit($limit);
}
/**
* @When I specify its amount as :amount
* @When I do not specify its amount
*/
public function iSpecifyItsAmountAs($amount = null)
{
$this->generatePage->specifyAmount($amount);
}
/**
* @When I limit its per customer usage to :limit times
*/
public function iLimitItsPerCustomerUsageLimitTo($limit)
{
$this->createPage->setCustomerUsageLimit($limit);
}
/**
* @When I change its per customer usage limit to :limit
*/
public function iChangeItsPerCustomerUsageLimitTo($limit)
{
$this->updatePage->setCustomerUsageLimit($limit);
}
/**
* @When I make it valid until :date
*/
public function iMakeItValidUntil(\DateTimeInterface $date)
{
$this->createPage->setExpiresAt($date);
}
/**
* @When I change expires date to :date
*/
public function iChangeExpiresDateTo(\DateTimeInterface $date)
{
$this->updatePage->setExpiresAt($date);
}
/**
* @When I add it
* @When I try to add it
*/
public function iAddIt()
{
$this->createPage->create();
}
/**
* @When I save my changes
*/
public function iSaveMyChanges()
{
$this->updatePage->saveChanges();
}
/**
* @When I generate it
* @When I try to generate it
*/
public function iGenerateIt()
{
$this->generatePage->generate();
}
/**
* @When /^I delete ("[^"]+" coupon) related to (this promotion)$/
* @When /^I try to delete ("[^"]+" coupon) related to (this promotion)$/
*/
public function iDeleteCouponRelatedToThisPromotion(PromotionCouponInterface $coupon, PromotionInterface $promotion)
{
$this->indexPage->open(['promotionId' => $promotion->getId()]);
$this->indexPage->deleteResourceOnPage(['code' => $coupon->getCode()]);
}
/**
* @When I check (also) the :couponCode coupon
*/
public function iCheckTheCoupon(string $couponCode): void
{
$this->indexPage->checkResourceOnPage(['code' => $couponCode]);
}
/**
* @When I delete them
*/
public function iDeleteThem(): void
{
$this->indexPage->bulkDelete();
}
/**
* @Then /^there should be (\d+) coupon related to (this promotion)$/
*/
public function thereShouldBeCouponRelatedTo($number, PromotionInterface $promotion)
{
$this->indexPage->open(['promotionId' => $promotion->getId()]);
Assert::same($this->indexPage->countItems(), (int) $number);
}
/**
* @Then I should see a single coupon in the list
*/
public function iShouldSeeASingleCouponInTheList(): void
{
Assert::same($this->indexPage->countItems(), 1);
}
/**
* @Then /^there should be coupon with code "([^"]+)"$/
*/
public function thereShouldBeCouponWithCode($code)
{
Assert::true($this->indexPage->isSingleResourceOnPage(['code' => $code]));
}
/**
* @Then this coupon should be valid until :date
*/
public function thisCouponShouldBeValidUntil(\DateTimeInterface $date)
{
Assert::true($this->indexPage->isSingleResourceOnPage(['expiresAt' => date('d-m-Y', $date->getTimestamp())]));
}
/**
* @Then /^this coupon should have (\d+) usage limit$/
*/
public function thisCouponShouldHaveUsageLimit($limit)
{
Assert::true($this->indexPage->isSingleResourceOnPage(['usageLimit' => $limit]));
}
/**
* @Then /^("[^"]+" coupon) should be used (\d+) time(?:|s)$/
*/
public function couponShouldHaveUsageLimit(PromotionCouponInterface $promotionCoupon, $used)
{
Assert::true($this->indexPage->isSingleResourceOnPage(['code' => $promotionCoupon->getCode(), 'used' => $used]));
}
/**
* @Then /^this coupon should have (\d+) per customer usage limit$/
*/
public function thisCouponShouldHavePerCustomerUsageLimit($limit)
{
Assert::true($this->indexPage->isSingleResourceOnPage(['perCustomerUsageLimit' => $limit]));
}
/**
* @Then the code field should be disabled
*/
public function theCodeFieldShouldBeDisabled()
{
Assert::true($this->updatePage->isCodeDisabled());
}
/**
* @Then /^I should be notified that coupon with this code already exists$/
*/
public function iShouldBeNotifiedThatCouponWithThisCodeAlreadyExists()
{
/** @var CreatePageInterface|UpdatePageInterface $currentPage */
$currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
Assert::same($currentPage->getValidationMessage('code'), 'This coupon already exists.');
}
/**
* @Then I should be notified that :element is required
*/
public function iShouldBeNotifiedThatIsRequired($element)
{
/** @var CreatePageInterface|UpdatePageInterface $currentPage */
$currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
Assert::same($currentPage->getValidationMessage($element), sprintf('Please enter coupon %s.', $element));
}
/**
* @Then I should be notified that generate amount is required
*/
public function iShouldBeNotifiedThatGenerateAmountIsRequired()
{
Assert::true($this->generatePage->checkAmountValidation('Please enter amount of coupons to generate.'));
}
/**
* @Then I should be notified that generate code length is required
*/
public function iShouldBeNotifiedThatCodeLengthIsRequired()
{
Assert::true($this->generatePage->checkCodeLengthValidation('Please enter coupon code length.'));
}
/**
* @Then /^there should still be only one coupon with code "([^"]+)" related to (this promotion)$/
*/
public function thereShouldStillBeOnlyOneCouponWithCodeRelatedTo($code, PromotionInterface $promotion)
{
$this->indexPage->open(['promotionId' => $promotion->getId()]);
Assert::true($this->indexPage->isSingleResourceOnPage(['code' => $code]));
}
/**
* @Then I should be notified that coupon usage limit must be at least one
*/
public function iShouldBeNotifiedThatCouponUsageLimitMustBeAtLeast()
{
/** @var CreatePageInterface|UpdatePageInterface $currentPage */
$currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
Assert::same($currentPage->getValidationMessage('usage_limit'), 'Coupon usage limit must be at least 1.');
}
/**
* @Then /^(this coupon) should no longer exist in the coupon registry$/
*/
public function couponShouldNotExistInTheRegistry(PromotionCouponInterface $coupon)
{
Assert::false($this->indexPage->isSingleResourceOnPage(['code' => $coupon->getCode()]));
}
/**
* @Then I should be notified that it has been successfully generated
*/
public function iShouldBeNotifiedThatItHasBeenSuccessfullyGenerated()
{
$this->notificationChecker->checkNotification('Success Promotion coupons have been successfully generated.', NotificationType::success());
}
/**
* @Then I should be notified that it is in use and cannot be deleted
*/
public function iShouldBeNotifiedOfFailure()
{
$this->notificationChecker->checkNotification(
'Error Cannot delete, the promotion coupon is in use.',
NotificationType::failure()
);
}
/**
* @Then /^(this coupon) should still exist in the registry$/
*/
public function couponShouldStillExistInTheRegistry(PromotionCouponInterface $coupon)
{
Assert::true($this->indexPage->isSingleResourceOnPage(['code' => $coupon->getCode()]));
}
/**
* @Then /^I should be notified that generating (\d+) coupons with code length equal to (\d+) is not possible$/
*/
public function iShouldBeNotifiedThatGeneratingCouponsWithCodeLengthIsNotPossible($amount, $codeLength)
{
$message = sprintf('Invalid coupons code length or coupons amount. It is not possible to generate %d unique coupons with code length equals %d. Possible generate amount is 8.', $amount, $codeLength);
Assert::true($this->generatePage->checkGenerationValidation($message));
}
/**
* @Then I should see the coupon :couponCode in the list
*/
public function iShouldSeeTheCouponInTheList(string $couponCode): void
{
Assert::true($this->indexPage->isSingleResourceOnPage(['code' => $couponCode]));
}
}
| torinaki/Sylius | src/Sylius/Behat/Context/Ui/Admin/ManagingPromotionCouponsContext.php | PHP | mit | 13,089 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
25353,
15513,
7427,
1012,
1008,
1008,
1006,
1039,
1007,
22195,
2063,
18818,
24401,
15378,
20518,
7974,
5488,
1008,
1008,
2005,
1996,
2440,
9385,
1998,
6105,
259... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2008-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.btrace.samples;
import com.sun.btrace.annotations.*;
import static com.sun.btrace.BTraceUtils.*;
/*
* A simple sample that dumps heap of the target at start and exits.
* This BTrace program mimics the jmap tool (with -dump option).
*/
@BTrace
public class JMap {
static {
String name;
if (Sys.$length() == 3) {
name = Sys.$(2);
} else {
name = "heap.bin";
}
Sys.Memory.dumpHeap(name);
println("heap dumped!");
Sys.exit(0);
}
}
| karahiyo/btrace | samples/JMap.java | Java | gpl-2.0 | 1,743 | [
30522,
1013,
1008,
1008,
9385,
2263,
1011,
2230,
3103,
12702,
29390,
1010,
4297,
1012,
2035,
2916,
9235,
1012,
1008,
2079,
2025,
11477,
2030,
6366,
9385,
14444,
2030,
2023,
5371,
20346,
1012,
1008,
1008,
2023,
3642,
2003,
2489,
4007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#ifndef IVL_entity_H
#define IVL_entity_H
/*
* Copyright (c) 2011-2014 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form 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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
# include <map>
# include <list>
# include <vector>
# include <iostream>
# include "vtype.h"
# include "StringHeap.h"
# include "LineInfo.h"
typedef enum { PORT_NONE=0, PORT_IN, PORT_OUT, PORT_INOUT } port_mode_t;
class Architecture;
class Expression;
class InterfacePort : public LineInfo {
public:
InterfacePort(port_mode_t mod = PORT_NONE,
perm_string nam = empty_perm_string,
const VType*typ = NULL,
Expression*exp = NULL)
: mode(mod), name(nam), type(typ), expr(exp)
{}
explicit InterfacePort(const VType*typ)
: mode(PORT_NONE), type(typ), expr(NULL)
{}
InterfacePort(const VType*typ, port_mode_t mod)
: mode(mod), type(typ), expr(NULL)
{}
// Port direction from the source code.
port_mode_t mode;
// Name of the port from the source code
perm_string name;
// Name of interface type as given in the source code.
const VType*type;
// Default value expression (or nil)
Expression*expr;
};
/*
* The ComponentBase class represents the base entity
* declaration. When used as is, then this represents a forward
* declaration of an entity. Elaboration will match it to a proper
* entity. Or this can be the base class for a full-out Entity.
*/
class ComponentBase : public LineInfo {
public:
explicit ComponentBase(perm_string name);
~ComponentBase();
// Entities have names.
perm_string get_name() const { return name_; }
const InterfacePort* find_port(perm_string by_name) const;
const InterfacePort* find_generic(perm_string by_name) const;
const std::vector<InterfacePort*>& get_generics() const { return parms_; }
// Declare the ports for the entity. The parser calls this
// method with a list of interface elements that were parsed
// for the entity. This method collects those entities, and
// empties the list in the process.
void set_interface(std::list<InterfacePort*>*parms,
std::list<InterfacePort*>*ports);
void write_to_stream(std::ostream&fd) const;
public:
void dump_generics(std::ostream&out, int indent =0) const;
void dump_ports(std::ostream&out, int indent = 0) const;
private:
perm_string name_;
protected:
std::vector<InterfacePort*> parms_;
std::vector<InterfacePort*> ports_;
};
/*
* Entities are fully declared components.
*/
class Entity : public ComponentBase {
public:
explicit Entity(perm_string name);
~Entity();
// bind an architecture to the entity, and return the
// Architecture that was bound. If there was a previous
// architecture with the same name bound, then do not replace
// the architecture and instead return the old
// value. The caller can tell that the bind worked if the
// returned pointer is the same as the passed pointer.
Architecture* add_architecture(Architecture*);
// After the architecture is bound, elaboration calls this
// method to elaborate this entity. This method arranges for
// elaboration to happen all the way through the architecture
// that is bound to this entity.
int elaborate();
// During elaboration, it may be discovered that a port is
// used as an l-value in an assignment. This method tweaks the
// declaration to allow for that case.
void set_declaration_l_value(perm_string by_name, bool flag);
int emit(ostream&out);
void dump(ostream&out, int indent = 0) const;
private:
std::map<perm_string,Architecture*>arch_;
Architecture*bind_arch_;
map<perm_string,VType::decl_t> declarations_;
int elaborate_generic_exprs_(void);
int elaborate_ports_(void);
};
/*
* As the parser parses entities, it puts them into this map. It uses
* a map because sometimes it needs to look back at an entity by name.
*/
extern std::map<perm_string,Entity*> design_entities;
/*
* Elaborate the collected entities, and return the number of
* elaboration errors.
*/
extern int elaborate_entities(void);
extern int emit_entities(void);
/*
* Use this function to dump a description of the design entities to a
* file. This is for debug, not for any useful purpose.
*/
extern void dump_design_entities(ostream&file);
#endif /* IVL_entity_H */
| CastMi/iverilog | vhdlpp/entity.h | C | lgpl-2.1 | 5,201 | [
30522,
1001,
2065,
13629,
2546,
4921,
2140,
1035,
9178,
1035,
1044,
1001,
9375,
4921,
2140,
1035,
9178,
1035,
1044,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2249,
1011,
2297,
4459,
3766,
1006,
3889,
1030,
24582,
29133,
1012,
4012,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @package Yendif Player
* @author Yendif Technologies Pvt Ltd. (email : admin@yendifplayer.com)
* @license GPL-2.0+
* @link http://yendifplayer.com/
* @copyright 2014 Yendif Technologies Pvt Ltd.
*/
class Yendif_Player_Settings_View {
/**
* Instance of the model object.
*
* @since 1.0.0
*
* @var object
*/
private $model = null;
/**
* Constructor of this class.
*
* @since 1.0.0
*/
public function __construct( $model ) {
$this->model = $model;
}
/**
* Load the default layout
*
* @since 1.0.0
*/
public function default_layout() {
$item = $this->model->item();
include_once( 'tmpl/default.php' );
}
} | AASP/cosmic-wordpress | wp-content/plugins/yendif-player/admin/views/settings/view.html.php | PHP | gpl-2.0 | 741 | [
30522,
1026,
1029,
30524,
1030,
3166,
18371,
4305,
2546,
6786,
26189,
2102,
5183,
1012,
1006,
10373,
1024,
4748,
10020,
1030,
18371,
4305,
22540,
24314,
1012,
4012,
1007,
1008,
1030,
6105,
14246,
2140,
1011,
1016,
1012,
1014,
1009,
1008,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/nix/mime_util_xdg.h"
#include <cstdlib>
#include <list>
#include <map>
#include <vector>
#include "base/environment.h"
#include "base/file_util.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/nix/xdg_util.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/synchronization/lock.h"
#include "base/third_party/xdg_mime/xdgmime.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
namespace base {
namespace nix {
namespace {
class IconTheme;
// None of the XDG stuff is thread-safe, so serialize all access under
// this lock.
LazyInstance<Lock>::Leaky g_mime_util_xdg_lock = LAZY_INSTANCE_INITIALIZER;
class MimeUtilConstants {
public:
typedef std::map<std::string, IconTheme*> IconThemeMap;
typedef std::map<FilePath, Time> IconDirMtimeMap;
typedef std::vector<std::string> IconFormats;
// Specified by XDG icon theme specs.
static const int kUpdateIntervalInSeconds = 5;
static const size_t kDefaultThemeNum = 4;
static MimeUtilConstants* GetInstance() {
return Singleton<MimeUtilConstants>::get();
}
// Store icon directories and their mtimes.
IconDirMtimeMap icon_dirs_;
// Store icon formats.
IconFormats icon_formats_;
// Store loaded icon_theme.
IconThemeMap icon_themes_;
// The default theme.
IconTheme* default_themes_[kDefaultThemeNum];
TimeTicks last_check_time_;
// The current icon theme, usually set through GTK theme integration.
std::string icon_theme_name_;
private:
MimeUtilConstants() {
icon_formats_.push_back(".png");
icon_formats_.push_back(".svg");
icon_formats_.push_back(".xpm");
for (size_t i = 0; i < kDefaultThemeNum; ++i)
default_themes_[i] = NULL;
}
~MimeUtilConstants();
friend struct DefaultSingletonTraits<MimeUtilConstants>;
DISALLOW_COPY_AND_ASSIGN(MimeUtilConstants);
};
// IconTheme represents an icon theme as defined by the xdg icon theme spec.
// Example themes on GNOME include 'Human' and 'Mist'.
// Example themes on KDE include 'crystalsvg' and 'kdeclassic'.
class IconTheme {
public:
// A theme consists of multiple sub-directories, like '32x32' and 'scalable'.
class SubDirInfo {
public:
// See spec for details.
enum Type {
Fixed,
Scalable,
Threshold
};
SubDirInfo()
: size(0),
type(Threshold),
max_size(0),
min_size(0),
threshold(2) {
}
size_t size; // Nominal size of the icons in this directory.
Type type; // Type of the icon size.
size_t max_size; // Maximum size that the icons can be scaled to.
size_t min_size; // Minimum size that the icons can be scaled to.
size_t threshold; // Maximum difference from desired size. 2 by default.
};
explicit IconTheme(const std::string& name);
~IconTheme() {}
// Returns the path to an icon with the name |icon_name| and a size of |size|
// pixels. If the icon does not exist, but |inherits| is true, then look for
// the icon in the parent theme.
FilePath GetIconPath(const std::string& icon_name, int size, bool inherits);
// Load a theme with the name |theme_name| into memory. Returns null if theme
// is invalid.
static IconTheme* LoadTheme(const std::string& theme_name);
private:
// Returns the path to an icon with the name |icon_name| in |subdir|.
FilePath GetIconPathUnderSubdir(const std::string& icon_name,
const std::string& subdir);
// Whether the theme loaded properly.
bool IsValid() {
return index_theme_loaded_;
}
// Read and parse |file| which is usually named 'index.theme' per theme spec.
bool LoadIndexTheme(const FilePath& file);
// Checks to see if the icons in |info| matches |size| (in pixels). Returns
// 0 if they match, or the size difference in pixels.
size_t MatchesSize(SubDirInfo* info, size_t size);
// Yet another function to read a line.
std::string ReadLine(FILE* fp);
// Set directories to search for icons to the comma-separated list |dirs|.
bool SetDirectories(const std::string& dirs);
bool index_theme_loaded_; // True if an instance is properly loaded.
// store the scattered directories of this theme.
std::list<FilePath> dirs_;
// store the subdirs of this theme and array index of |info_array_|.
std::map<std::string, int> subdirs_;
scoped_ptr<SubDirInfo[]> info_array_; // List of sub-directories.
std::string inherits_; // Name of the theme this one inherits from.
};
IconTheme::IconTheme(const std::string& name)
: index_theme_loaded_(false) {
ThreadRestrictions::AssertIOAllowed();
// Iterate on all icon directories to find directories of the specified
// theme and load the first encountered index.theme.
MimeUtilConstants::IconDirMtimeMap::iterator iter;
FilePath theme_path;
MimeUtilConstants::IconDirMtimeMap* icon_dirs =
&MimeUtilConstants::GetInstance()->icon_dirs_;
for (iter = icon_dirs->begin(); iter != icon_dirs->end(); ++iter) {
theme_path = iter->first.Append(name);
if (!DirectoryExists(theme_path))
continue;
FilePath theme_index = theme_path.Append("index.theme");
if (!index_theme_loaded_ && PathExists(theme_index)) {
if (!LoadIndexTheme(theme_index))
return;
index_theme_loaded_ = true;
}
dirs_.push_back(theme_path);
}
}
FilePath IconTheme::GetIconPath(const std::string& icon_name, int size,
bool inherits) {
std::map<std::string, int>::iterator subdir_iter;
FilePath icon_path;
for (subdir_iter = subdirs_.begin();
subdir_iter != subdirs_.end();
++subdir_iter) {
SubDirInfo* info = &info_array_[subdir_iter->second];
if (MatchesSize(info, size) == 0) {
icon_path = GetIconPathUnderSubdir(icon_name, subdir_iter->first);
if (!icon_path.empty())
return icon_path;
}
}
// Now looking for the mostly matched.
size_t min_delta_seen = 9999;
for (subdir_iter = subdirs_.begin();
subdir_iter != subdirs_.end();
++subdir_iter) {
SubDirInfo* info = &info_array_[subdir_iter->second];
size_t delta = MatchesSize(info, size);
if (delta < min_delta_seen) {
FilePath path = GetIconPathUnderSubdir(icon_name, subdir_iter->first);
if (!path.empty()) {
min_delta_seen = delta;
icon_path = path;
}
}
}
if (!icon_path.empty() || !inherits || inherits_ == "")
return icon_path;
IconTheme* theme = LoadTheme(inherits_);
// Inheriting from itself means the theme is buggy but we shouldn't crash.
if (theme && theme != this)
return theme->GetIconPath(icon_name, size, inherits);
else
return FilePath();
}
IconTheme* IconTheme::LoadTheme(const std::string& theme_name) {
scoped_ptr<IconTheme> theme;
MimeUtilConstants::IconThemeMap* icon_themes =
&MimeUtilConstants::GetInstance()->icon_themes_;
if (icon_themes->find(theme_name) != icon_themes->end()) {
theme.reset((*icon_themes)[theme_name]);
} else {
theme.reset(new IconTheme(theme_name));
if (!theme->IsValid())
theme.reset();
(*icon_themes)[theme_name] = theme.get();
}
return theme.release();
}
FilePath IconTheme::GetIconPathUnderSubdir(const std::string& icon_name,
const std::string& subdir) {
FilePath icon_path;
std::list<FilePath>::iterator dir_iter;
MimeUtilConstants::IconFormats* icon_formats =
&MimeUtilConstants::GetInstance()->icon_formats_;
for (dir_iter = dirs_.begin(); dir_iter != dirs_.end(); ++dir_iter) {
for (size_t i = 0; i < icon_formats->size(); ++i) {
icon_path = dir_iter->Append(subdir);
icon_path = icon_path.Append(icon_name + (*icon_formats)[i]);
if (PathExists(icon_path))
return icon_path;
}
}
return FilePath();
}
bool IconTheme::LoadIndexTheme(const FilePath& file) {
FILE* fp = base::OpenFile(file, "r");
SubDirInfo* current_info = NULL;
if (!fp)
return false;
// Read entries.
while (!feof(fp) && !ferror(fp)) {
std::string buf = ReadLine(fp);
if (buf == "")
break;
std::string entry;
TrimWhitespaceASCII(buf, TRIM_ALL, &entry);
if (entry.length() == 0 || entry[0] == '#') {
// Blank line or Comment.
continue;
} else if (entry[0] == '[' && info_array_.get()) {
current_info = NULL;
std::string subdir = entry.substr(1, entry.length() - 2);
if (subdirs_.find(subdir) != subdirs_.end())
current_info = &info_array_[subdirs_[subdir]];
}
std::string key, value;
std::vector<std::string> r;
SplitStringDontTrim(entry, '=', &r);
if (r.size() < 2)
continue;
TrimWhitespaceASCII(r[0], TRIM_ALL, &key);
for (size_t i = 1; i < r.size(); i++)
value.append(r[i]);
TrimWhitespaceASCII(value, TRIM_ALL, &value);
if (current_info) {
if (key == "Size") {
current_info->size = atoi(value.c_str());
} else if (key == "Type") {
if (value == "Fixed")
current_info->type = SubDirInfo::Fixed;
else if (value == "Scalable")
current_info->type = SubDirInfo::Scalable;
else if (value == "Threshold")
current_info->type = SubDirInfo::Threshold;
} else if (key == "MaxSize") {
current_info->max_size = atoi(value.c_str());
} else if (key == "MinSize") {
current_info->min_size = atoi(value.c_str());
} else if (key == "Threshold") {
current_info->threshold = atoi(value.c_str());
}
} else {
if (key.compare("Directories") == 0 && !info_array_.get()) {
if (!SetDirectories(value)) break;
} else if (key.compare("Inherits") == 0) {
if (value != "hicolor")
inherits_ = value;
}
}
}
base::CloseFile(fp);
return info_array_.get() != NULL;
}
size_t IconTheme::MatchesSize(SubDirInfo* info, size_t size) {
if (info->type == SubDirInfo::Fixed) {
if (size > info->size)
return size - info->size;
else
return info->size - size;
} else if (info->type == SubDirInfo::Scalable) {
if (size < info->min_size)
return info->min_size - size;
if (size > info->max_size)
return size - info->max_size;
return 0;
} else {
if (size + info->threshold < info->size)
return info->size - size - info->threshold;
if (size > info->size + info->threshold)
return size - info->size - info->threshold;
return 0;
}
}
std::string IconTheme::ReadLine(FILE* fp) {
if (!fp)
return std::string();
std::string result;
const size_t kBufferSize = 100;
char buffer[kBufferSize];
while ((fgets(buffer, kBufferSize - 1, fp)) != NULL) {
result += buffer;
size_t len = result.length();
if (len == 0)
break;
char end = result[len - 1];
if (end == '\n' || end == '\0')
break;
}
return result;
}
bool IconTheme::SetDirectories(const std::string& dirs) {
int num = 0;
std::string::size_type pos = 0, epos;
std::string dir;
while ((epos = dirs.find(',', pos)) != std::string::npos) {
TrimWhitespaceASCII(dirs.substr(pos, epos - pos), TRIM_ALL, &dir);
if (dir.length() == 0) {
DLOG(WARNING) << "Invalid index.theme: blank subdir";
return false;
}
subdirs_[dir] = num++;
pos = epos + 1;
}
TrimWhitespaceASCII(dirs.substr(pos), TRIM_ALL, &dir);
if (dir.length() == 0) {
DLOG(WARNING) << "Invalid index.theme: blank subdir";
return false;
}
subdirs_[dir] = num++;
info_array_.reset(new SubDirInfo[num]);
return true;
}
bool CheckDirExistsAndGetMtime(const FilePath& dir, Time* last_modified) {
if (!DirectoryExists(dir))
return false;
File::Info file_info;
if (!GetFileInfo(dir, &file_info))
return false;
*last_modified = file_info.last_modified;
return true;
}
// Make sure |dir| exists and add it to the list of icon directories.
void TryAddIconDir(const FilePath& dir) {
Time last_modified;
if (!CheckDirExistsAndGetMtime(dir, &last_modified))
return;
MimeUtilConstants::GetInstance()->icon_dirs_[dir] = last_modified;
}
// For a xdg directory |dir|, add the appropriate icon sub-directories.
void AddXDGDataDir(const FilePath& dir) {
if (!DirectoryExists(dir))
return;
TryAddIconDir(dir.Append("icons"));
TryAddIconDir(dir.Append("pixmaps"));
}
// Add all the xdg icon directories.
void InitIconDir() {
FilePath home = GetHomeDir();
if (!home.empty()) {
FilePath legacy_data_dir(home);
legacy_data_dir = legacy_data_dir.AppendASCII(".icons");
if (DirectoryExists(legacy_data_dir))
TryAddIconDir(legacy_data_dir);
}
const char* env = getenv("XDG_DATA_HOME");
if (env) {
AddXDGDataDir(FilePath(env));
} else if (!home.empty()) {
FilePath local_data_dir(home);
local_data_dir = local_data_dir.AppendASCII(".local");
local_data_dir = local_data_dir.AppendASCII("share");
AddXDGDataDir(local_data_dir);
}
env = getenv("XDG_DATA_DIRS");
if (!env) {
AddXDGDataDir(FilePath("/usr/local/share"));
AddXDGDataDir(FilePath("/usr/share"));
} else {
std::string xdg_data_dirs = env;
std::string::size_type pos = 0, epos;
while ((epos = xdg_data_dirs.find(':', pos)) != std::string::npos) {
AddXDGDataDir(FilePath(xdg_data_dirs.substr(pos, epos - pos)));
pos = epos + 1;
}
AddXDGDataDir(FilePath(xdg_data_dirs.substr(pos)));
}
}
void EnsureUpdated() {
MimeUtilConstants* constants = MimeUtilConstants::GetInstance();
if (constants->last_check_time_.is_null()) {
constants->last_check_time_ = TimeTicks::Now();
InitIconDir();
return;
}
// Per xdg theme spec, we should check the icon directories every so often
// for newly added icons.
TimeDelta time_since_last_check =
TimeTicks::Now() - constants->last_check_time_;
if (time_since_last_check.InSeconds() > constants->kUpdateIntervalInSeconds) {
constants->last_check_time_ += time_since_last_check;
bool rescan_icon_dirs = false;
MimeUtilConstants::IconDirMtimeMap* icon_dirs = &constants->icon_dirs_;
MimeUtilConstants::IconDirMtimeMap::iterator iter;
for (iter = icon_dirs->begin(); iter != icon_dirs->end(); ++iter) {
Time last_modified;
if (!CheckDirExistsAndGetMtime(iter->first, &last_modified) ||
last_modified != iter->second) {
rescan_icon_dirs = true;
break;
}
}
if (rescan_icon_dirs) {
constants->icon_dirs_.clear();
constants->icon_themes_.clear();
InitIconDir();
}
}
}
// Find a fallback icon if we cannot find it in the default theme.
FilePath LookupFallbackIcon(const std::string& icon_name) {
MimeUtilConstants* constants = MimeUtilConstants::GetInstance();
MimeUtilConstants::IconDirMtimeMap::iterator iter;
MimeUtilConstants::IconDirMtimeMap* icon_dirs = &constants->icon_dirs_;
MimeUtilConstants::IconFormats* icon_formats = &constants->icon_formats_;
for (iter = icon_dirs->begin(); iter != icon_dirs->end(); ++iter) {
for (size_t i = 0; i < icon_formats->size(); ++i) {
FilePath icon = iter->first.Append(icon_name + (*icon_formats)[i]);
if (PathExists(icon))
return icon;
}
}
return FilePath();
}
// Initialize the list of default themes.
void InitDefaultThemes() {
IconTheme** default_themes =
MimeUtilConstants::GetInstance()->default_themes_;
scoped_ptr<Environment> env(Environment::Create());
base::nix::DesktopEnvironment desktop_env =
base::nix::GetDesktopEnvironment(env.get());
if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE3 ||
desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE4) {
// KDE
std::string kde_default_theme;
std::string kde_fallback_theme;
// TODO(thestig): Figure out how to get the current icon theme on KDE.
// Setting stored in ~/.kde/share/config/kdeglobals under Icons -> Theme.
default_themes[0] = NULL;
// Try some reasonable defaults for KDE.
if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE3) {
// KDE 3
kde_default_theme = "default.kde";
kde_fallback_theme = "crystalsvg";
} else {
// KDE 4
kde_default_theme = "default.kde4";
kde_fallback_theme = "oxygen";
}
default_themes[1] = IconTheme::LoadTheme(kde_default_theme);
default_themes[2] = IconTheme::LoadTheme(kde_fallback_theme);
} else {
// Assume it's Gnome and use GTK to figure out the theme.
default_themes[1] = IconTheme::LoadTheme(
MimeUtilConstants::GetInstance()->icon_theme_name_);
default_themes[2] = IconTheme::LoadTheme("gnome");
}
// hicolor needs to be last per icon theme spec.
default_themes[3] = IconTheme::LoadTheme("hicolor");
for (size_t i = 0; i < MimeUtilConstants::kDefaultThemeNum; i++) {
if (default_themes[i] == NULL)
continue;
// NULL out duplicate pointers.
for (size_t j = i + 1; j < MimeUtilConstants::kDefaultThemeNum; j++) {
if (default_themes[j] == default_themes[i])
default_themes[j] = NULL;
}
}
}
// Try to find an icon with the name |icon_name| that's |size| pixels.
FilePath LookupIconInDefaultTheme(const std::string& icon_name, int size) {
EnsureUpdated();
MimeUtilConstants* constants = MimeUtilConstants::GetInstance();
MimeUtilConstants::IconThemeMap* icon_themes = &constants->icon_themes_;
if (icon_themes->empty())
InitDefaultThemes();
FilePath icon_path;
IconTheme** default_themes = constants->default_themes_;
for (size_t i = 0; i < MimeUtilConstants::kDefaultThemeNum; i++) {
if (default_themes[i]) {
icon_path = default_themes[i]->GetIconPath(icon_name, size, true);
if (!icon_path.empty())
return icon_path;
}
}
return LookupFallbackIcon(icon_name);
}
MimeUtilConstants::~MimeUtilConstants() {
for (size_t i = 0; i < kDefaultThemeNum; i++)
delete default_themes_[i];
}
} // namespace
std::string GetFileMimeType(const FilePath& filepath) {
if (filepath.empty())
return std::string();
ThreadRestrictions::AssertIOAllowed();
AutoLock scoped_lock(g_mime_util_xdg_lock.Get());
return xdg_mime_get_mime_type_from_file_name(filepath.value().c_str());
}
std::string GetDataMimeType(const std::string& data) {
ThreadRestrictions::AssertIOAllowed();
AutoLock scoped_lock(g_mime_util_xdg_lock.Get());
return xdg_mime_get_mime_type_for_data(data.data(), data.length(), NULL);
}
void SetIconThemeName(const std::string& name) {
// If the theme name is already loaded, do nothing. Chrome doesn't respond
// to changes in the system theme, so we never need to set this more than
// once.
if (!MimeUtilConstants::GetInstance()->icon_theme_name_.empty())
return;
MimeUtilConstants::GetInstance()->icon_theme_name_ = name;
}
FilePath GetMimeIcon(const std::string& mime_type, size_t size) {
ThreadRestrictions::AssertIOAllowed();
std::vector<std::string> icon_names;
std::string icon_name;
FilePath icon_file;
if (!mime_type.empty()) {
AutoLock scoped_lock(g_mime_util_xdg_lock.Get());
const char *icon = xdg_mime_get_icon(mime_type.c_str());
icon_name = std::string(icon ? icon : "");
}
if (icon_name.length())
icon_names.push_back(icon_name);
// For text/plain, try text-plain.
icon_name = mime_type;
for (size_t i = icon_name.find('/', 0); i != std::string::npos;
i = icon_name.find('/', i + 1)) {
icon_name[i] = '-';
}
icon_names.push_back(icon_name);
// Also try gnome-mime-text-plain.
icon_names.push_back("gnome-mime-" + icon_name);
// Try "deb" for "application/x-deb" in KDE 3.
size_t x_substr_pos = mime_type.find("/x-");
if (x_substr_pos != std::string::npos) {
icon_name = mime_type.substr(x_substr_pos + 3);
icon_names.push_back(icon_name);
}
// Try generic name like text-x-generic.
icon_name = mime_type.substr(0, mime_type.find('/')) + "-x-generic";
icon_names.push_back(icon_name);
// Last resort
icon_names.push_back("unknown");
for (size_t i = 0; i < icon_names.size(); i++) {
if (icon_names[i][0] == '/') {
icon_file = FilePath(icon_names[i]);
if (PathExists(icon_file))
return icon_file;
} else {
icon_file = LookupIconInDefaultTheme(icon_names[i], size);
if (!icon_file.empty())
return icon_file;
}
}
return FilePath();
}
} // namespace nix
} // namespace base
| elvestar/chromium-base-library | base/nix/mime_util_xdg.cc | C++ | apache-2.0 | 20,684 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2262,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<!-- ===================================================================================================
Instituto Municipal de Planeación y Competitividad (IMPLAN) de Torreón.
3er. generación de la Plataforma del Conocimiento
Desarrollado por Ing. Guillermo Valdés Lozano <guivaloz en movimientolibre.com>
El software que lo construye está bajo la licencia GPL versión 3. © 2014, 2015, 2016, 2017.
Una copia está contenida en el archivo LICENCE al bajar desde GitHub.
Al usar, estudiar y copiar está aceptando los términos de uso de la información y del sitio web:
http://www.trcimplan.gob.mx/terminos/terminos-informacion.html
http://www.trcimplan.gob.mx/terminos/terminos-sitio.html
Descargue, estudie y colabore bajando todo este sitio web:
IMPLAN Torreón https://github.com/TRCIMPLAN/trcimplan.github.io
Agradecemos y compartimos las tecnologías abiertas y gratuitas sobre las que se basa:
PHP http://php.net
Twitter Bootstrap http://getbootstrap.com
StartBootStrap http://startbootstrap.com
Morris.js https://morrisjs.github.io/morris.js/
Font Awesome http://fontawesome.io
DataTables https://www.datatables.net
Carto https://carto.com
GitHub https://github.com
=================================================================================================== -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Colonia Ampliación Zaragoza Sur en Torreón, Coahuila de Zaragoza, México.">
<meta name="author" content="Dirección de Investigación Estratégica">
<meta name="keywords" content="IMPLAN, Torreon, Indicadores, Colonia, Ampliación Zaragoza Sur">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Ampliación Zaragoza Sur - IMPLAN Torreón">
<meta name="twitter:description" content="Colonia Ampliación Zaragoza Sur en Torreón, Coahuila de Zaragoza, México.">
<meta name="twitter:image" content="http://www.trcimplan.gob.mx/ibc-colonias-torreon/../imagenes/imagen-previa.jpg">
<meta name="twitter:url" content="http://www.trcimplan.gob.mx/ibc-colonias-torreon/ampliacion-zaragoza-sur.html">
<meta name="og:title" content="Ampliación Zaragoza Sur - IMPLAN Torreón">
<meta name="og:description" content="Colonia Ampliación Zaragoza Sur en Torreón, Coahuila de Zaragoza, México.">
<meta name="og:image" content="http://www.trcimplan.gob.mx/ibc-colonias-torreon/../imagenes/imagen-previa.jpg">
<meta name="og:url" content="http://www.trcimplan.gob.mx/ibc-colonias-torreon/ampliacion-zaragoza-sur.html">
<title>Ampliación Zaragoza Sur - IMPLAN Torreón</title>
<link rel="shortcut icon" type="image/x-icon" href="../imagenes/apple-touch-icon.png">
<link rel="apple-touch-icon" href="../imagenes/apple-touch-icon.png">
<link rel="apple-touch-icon" href="../imagenes/apple-touch-icon-76x76.png" sizes="76x76">
<link rel="apple-touch-icon" href="../imagenes/apple-touch-icon-120x120.png" sizes="120x120">
<link rel="apple-touch-icon" href="../imagenes/apple-touch-icon-152x152.png" sizes="152x152">
<link rel="apple-touch-icon" href="../imagenes/apple-touch-icon-180x180.png" sizes="180x180">
<link rel="icon" href="../imagenes/icon-hires.png" sizes="192x192">
<link rel="icon" href="../imagenes/icon-normal.png" sizes="128x128">
<link rel="alternate" type="application/rss+xml" href="../rss.xml" title="IMPLAN Torreón">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../vendor/metisMenu/metisMenu.min.css">
<link rel="stylesheet" type="text/css" href="../vendor/datatables-plugins/dataTables.bootstrap.css">
<link rel="stylesheet" type="text/css" href="../vendor/morrisjs/morris.css">
<link rel="stylesheet" type="text/css" href="../vendor/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="../dist/css/sb-admin-2.min.css">
<link rel="stylesheet" type="text/css" href="../dist/css/plataforma-de-conocimiento.css">
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Noto+Sans|Roboto+Condensed:400,700">
<link rel="stylesheet" type="text/css" href="http://libs.cartocdn.com/cartodb.js/v3/3.15/themes/css/cartodb.css">
<link rel="stylesheet" type="text/css" href="../dist/css/estilosvm.css">
<link rel="stylesheet" type="text/css" href="../dist/css/trcimplan.css">
<!-- SOPORTE PARA IE -->
<!--[if lt IE 9]>
<script type="text/javascript" src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script type="text/javascript" src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="wrapper">
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html"><img class="navbar-brand-img" src="../imagenes/implan-barra-logo-chico-gris.png" alt="IMPLAN Torreón"></a>
</div>
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<li class="sidebar-search">
<form method="get" action="http://www.trcimplan.gob.mx/buscador-resultados.html">
<div class="input-group custom-search-form">
<input type="text" class="form-control" placeholder="Google buscar..." value="" name="q">
<span class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
</span>
</div>
</form>
</li>
<li>
<a href="#"><span class="navegacion-icono"><i class="fa fa-lightbulb-o"></i></span> Análisis Publicados<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="../blog/index.html"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Últimos Análisis</a></li>
<li><a href="../excolaboradores/index.html"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Análisis por Autor</a></li>
</ul>
</li>
<li>
<a href="#"><span class="navegacion-icono"><i class="fa fa-area-chart"></i></span> Indicadores<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="../smi/introduccion.html"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Introducción al SMI</a></li>
<li><a href="../indicadores-categorias/index.html"><span class="navegacion-icono"><i class="fa fa-th-list"></i></span> Indicadores por Categoría</a></li>
<li><a href="../smi/por-region.html"><span class="navegacion-icono"><i class="fa fa-table"></i></span> Indicadores por Región</a></li>
<li><a href="../smi/niveles-socioeconomicos.html"><span class="navegacion-icono"><i class="fa fa-bar-chart"></i></span> Niveles Socioeconómicos</a></li>
<li><a href="../monitores/index.html"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Monitores</a></li>
</ul>
</li>
<li class="active">
<a href="#"><span class="navegacion-icono"><i class="fa fa-puzzle-piece"></i></span> Indicadores Básicos de Colonias<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="../ibc/introduccion.html"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Introducción al IBC</a></li>
<li class="active"><a href="../ibc-colonias-torreon/index.html"><span class="navegacion-icono"><i class="fa fa-font"></i></span> Colonias de Torreón</a></li>
<li><a href="https://implantorreon.carto.com/u/sigimplan/builder/907a6bc0-2c7e-451e-9668-b78d952e52ff/embed" target="_blank"><span class="navegacion-icono"><i class="fa fa-external-link"></i></span> Mapa Completo</a></li>
<li><a href="../ibc/torreon-urbano.html"><span class="navegacion-icono"><i class="fa fa-table"></i></span> Torreón Urbano</a></li>
</ul>
</li>
<li>
<a href="#"><span class="navegacion-icono"><i class="fa fa-map-marker"></i></span> Información Geográfica<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="../sig/introduccion.html"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Introducción al SIG</a></li>
<li><a href="../sig-mapas-torreon/temas-sig.html"><span class="navegacion-icono"><i class="fa fa-map-o"></i></span> Mapas por Tema</a></li>
<li><a href="../sig-mapas-torreon/plan-director-desarrollo-urbano.html"><span class="navegacion-icono"><i class="fa fa-map-marker"></i></span> Usos de Suelo</a></li>
</ul>
</li>
<li>
<a href="#"><span class="navegacion-icono"><i class="fa fa-book"></i></span> Plan Estratégico Torreón 2040<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="../pet/indice.html"><span class="navegacion-icono"><i class="fa fa-list-ul"></i></span> Índice General</a></li>
<li><a href="../plan-estrategico-torreon-enfoque-metropolitano-2040/index.html"><span class="navegacion-icono"><i class="fa fa-download"></i></span> Descargar</a></li>
<li><a href="../plan-estrategico-metropolitano/descripcion-del-proceso.html"><span class="navegacion-icono"><i class="fa fa-calendar"></i></span> Descripción del proceso</a></li>
<li><a href="../proyectos/index.html"><span class="navegacion-icono"><i class="fa fa-check-square"></i></span> Proyectos</a></li>
<li><a href="../vision-de-ciudad/vision-de-ciudad.html"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Visión de Ciudad desde IMPLAN</a></li>
</ul>
</li>
<li>
<a href="#"><span class="navegacion-icono"><i class="fa fa-file-pdf-o"></i></span> Documentos<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="../sig-planes/index.html"><span class="navegacion-icono"><i class="fa fa-book"></i></span> Planes y Programas</a></li>
<li><a href="../investigaciones/index.html"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Investigaciones</a></li>
<li><a href="../estudios/index.html"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Estudios</a></li>
</ul>
</li>
<li><a href="../consejo-directivo/integrantes.html"><span class="navegacion-icono"><i class="fa fa-users"></i></span> Consejo Directivo</a></li>
<li><a href="../sala-prensa/index.html"><span class="navegacion-icono"><i class="fa fa-newspaper-o"></i></span> Sala de Prensa</a></li>
<li><a href="../programas-radio/index.html"><span class="navegacion-icono"><i class="fa fa-microphone"></i></span> Programas de Radio</a></li>
<li>
<a href="#"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Consejo Visión Metrópoli<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="../convocatorias/vision-metropoli.html"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Consejo Juvenil</a></li>
<li><a href="../vision-metropoli/integrantes.html"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Integrantes del Consejo</a></li>
<li><a href="../vision-metropoli/index.html"><span class="navegacion-icono"><i class="fa fa-newspaper-o"></i></span> Sala de Prensa</a></li>
<li><a href="../vision-metropoli/publicaciones.html"><span class="navegacion-icono"><i class="fa fa-book"></i></span> Publicaciones</a></li>
<li><a href="../vision-metropoli/reglamento-vision-metropoli-2022.pdf"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Reglamento</a></li>
</ul>
</li>
<li>
<a href="#"><span class="navegacion-icono"><i class="fa fa-building-o"></i></span> Institucional<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="../institucional/vision-mision.html"><span class="navegacion-icono"><i class="fa fa-trophy"></i></span> Misión / Visión</a></li>
<li><a href="../institucional/NuestrosProyectos.html"><span class="navegacion-icono"><i class="fa fa-pencil-square-o"></i></span> Nuestros Proyectos</a></li>
<li><a href="../institucional/mensaje-director.html"><span class="navegacion-icono"><i class="fa fa-comment"></i></span> Mensaje del Director</a></li>
<li><a href="../autores/index.html"><span class="navegacion-icono"><i class="fa fa-user"></i></span> Quienes Somos</a></li>
<li><a href="../institucional/estructura-organica.html"><span class="navegacion-icono"><i class="fa fa-sitemap"></i></span> Estructura Orgánica</a></li>
<li><a href="../institucional/modelo-operativo-universal.html"><span class="navegacion-icono"><i class="fa fa-slideshare"></i></span> Modelo Operativo Univ.</a></li>
<li><a href="../institucional/reglamentos.html"><span class="navegacion-icono"><i class="fa fa-gavel"></i></span> Reglamentos</a></li>
</ul>
</li>
<li>
<a href="#"><span class="navegacion-icono"><i class="fa fa-external-link"></i></span> Transparencia<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="http://www2.icai.org.mx/ipo/dependencia.php?dep=178#pageload" target="_blank"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Transparencia Estatal (ICAI)</a></li>
<li><a href="https://consultapublicamx.inai.org.mx/vut-web/faces/view/consultaPublica.xhtml#inicio" target="_blank"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Plataforma Nacional de Transparencia</a></li>
<li><a href="../transparencia/index.html"><span class="navegacion-icono"><i class="fa fa-file-pdf-o"></i></span> Documentos</a></li>
</ul>
</li>
<li>
<a href="#"><span class="navegacion-icono"><i class="fa fa-download"></i></span> Datos Abiertos<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="../smi/datos-abiertos.html"><span class="navegacion-icono"><i class="fa fa-area-chart"></i></span> Sist. Metropolitano de Indicadores</a></li>
<li><a href="../ibc/datos-abiertos.html"><span class="navegacion-icono"><i class="fa fa-puzzle-piece"></i></span> Indicador Básico de Colonias</a></li>
<li><a href="../sig/datos-abiertos.html"><span class="navegacion-icono"><i class="fa fa-map-marker"></i></span> Sist. Información Geográfica</a></li>
<li><a href="https://arcg.is/0vySSr" target="_blank"><span class="navegacion-icono"><i class="fa fa-globe"></i></span> Atlas de Riesgos</a></li>
</ul>
</li>
<li>
<a href="#"><span class="navegacion-icono"><i class="fa fa-share-alt"></i></span> Términos de Uso<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="../terminos/terminos-informacion.html"><span class="navegacion-icono"><i class="fa fa-cubes"></i></span> De la información</a></li>
<li><a href="../terminos/terminos-sitio.html"><span class="navegacion-icono"><i class="fa fa-globe"></i></span> Del sitio web</a></li>
<li><a href="../terminos/privacidad.html"><span class="navegacion-icono"><i class="fa fa-lock"></i></span> Aviso de Privacidad</a></li>
</ul>
</li>
<li>
<a href="#"><span class="navegacion-icono"><i class="fa fa-phone"></i></span> Contacto<span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a href="../contacto/contacto.html"><span class="navegacion-icono"><i class="fa fa-phone"></i></span> Medios de contacto</a></li>
<li><a href="../preguntas-frecuentes/preguntas-frecuentes.html"><span class="navegacion-icono"><i class="fa fa-question"></i></span> Preguntas Frecuentes</a></li>
<li><a href="http://goo.gl/forms/1rdX4X128PpMOif73" target="_blank"><span class="navegacion-icono"><i class="fa fa-external-link"></i></span> Comentarios y Sugerencias</a></li>
</ul>
</li>
<li><a href="../convocatorias/index.html"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Convocatorias</a></li>
<li><a href="http://177.244.42.17/ovie-torreon/#!" target="_blank"><span class="navegacion-icono"><i class="fa fa-map-marker"></i></span> Oficina Virtual de Información Económica (OVIE)</a></li>
<li><a href="https://arcg.is/0vySSr" target="_blank"><span class="navegacion-icono"><i class="fa fa-globe"></i></span> Atlas Municipal de Riesgos de Torreón</a></li>
<li><a href="../multi-city-challenge/multi-city-challenge.html"><span class="navegacion-icono"><i class="fa fa-file-text-o"></i></span> Multi-City Challenge México 2020</a></li>
</ul>
</div>
</div>
</nav>
<div id="page-wrapper">
<div class="cuerpo">
<article><div itemscope itemtype="http://schema.org/Dataset">
<div class="encabezado">
<h1 itemprop="headline">Ampliación Zaragoza Sur</h1>
<div class="encabezado-descripcion" itemprop="description">Colonia Ampliación Zaragoza Sur en Torreón, Coahuila de Zaragoza, México.</div>
<div class="encabezado-autor-fecha">
Por <span itemprop="author">Dirección de Investigación Estratégica</span> -
<meta itemprop="datePublished" content="2017-06-15T10:51:20">15/06/2017 10:51
</div>
</div>
<div style="display:none" itemprop="spatial" itemscope itemtype="http://schema.org/Place">
<h3 class="titulo" itemprop="name">Ampliación Zaragoza Sur</h3>
<div class="descripcion" itemprop="description">Colonia Ampliación Zaragoza Sur en Torreón, Coahuila de Zaragoza, México.</div>
<div itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">
Latitud: <meta itemprop="latitude" content="25.491551581371">25.491551581371
Longitud: <meta itemprop="longitude" content="-103.37659358569">-103.37659358569
</div>
</div>
<!-- Contenido: Inicia -->
<div>
<ul class="nav nav-tabs lenguetas" role="tablist" id="LenguetasConglomerado">
<li role="presentation" class="active"><a href="#LenguetasConglomeradoResena" aria-controls="LenguetasConglomeradoResena" role="tab" data-toggle="tab">Reseña</a></li>
<li role="presentation"><a href="#LenguetasConglomeradoMapas" aria-controls="LenguetasConglomeradoMapas" role="tab" data-toggle="tab">Mapas</a></li>
<li role="presentation"><a href="#LenguetasConglomeradoDatos" aria-controls="LenguetasConglomeradoDatos" role="tab" data-toggle="tab">Datos</a></li>
<li role="presentation"><a href="#LenguetasConglomeradoGraficas" aria-controls="LenguetasConglomeradoGraficas" role="tab" data-toggle="tab">Gráficas</a></li>
</ul>
<div class="tab-content lengueta-contenido">
<div role="tabpanel" class="tab-pane active" id="LenguetasConglomeradoResena">
<h2>Valor Catastral</h2>
<table class="table table-hover table-bordered">
<tr>
<th><center><b>UBICACIÓN</b></center></th>
<th><center><b>AÑO 2016</b></center></th>
<th><center><b>AÑO 2017</b></center></th>
<th><center><b>AÑO 2018</b></center></th>
</tr>
<tr>
<td><center>AMPLIACIÓN ZARAGOZA SUR</center>
<td><center>$101.00</center></br>
<td><center>$104.54</center></td>
<td><center>$110.81</center></td>
</tr>
</table>
</div>
<div role="tabpanel" class="tab-pane" id="LenguetasConglomeradoMapas">
<div id="MapaLimites" class="mapa"></div>
</div>
<div role="tabpanel" class="tab-pane" id="LenguetasConglomeradoDatos">
<div class="panel-group" id="Datos" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading acordeon-cabecera" role="tab" id="cabeceraDatosDemografia">
<h4 class="panel-title acordeon-titulo">
<a class="acordeon-vinculo" role="button" data-toggle="collapse" data-parent="#Datos" href="#DatosDemografia" aria-expanded="true" aria-controls="DatosDemografia">
Demografía
</a>
</h4>
</div>
<div id="DatosDemografia" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="cabeceraDatosDemografia">
<div class="panel-body">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>Indicador</th>
<th>Valor</th>
</tr>
</thead>
<tbody>
<tr>
<td>Población total</td>
<td class="derecha">7,071</td>
</tr>
<tr>
<td>Porcentaje de población masculina</td>
<td class="derecha">50.79 %</td>
</tr>
<tr>
<td>Porcentaje de población femenina</td>
<td class="derecha">49.21 %</td>
</tr>
<tr>
<td>Porcentaje de población de 0 a 14 años</td>
<td class="derecha">39.96 %</td>
</tr>
<tr>
<td>Porcentaje de población de 15 a 64 años</td>
<td class="derecha">57.25 %</td>
</tr>
<tr>
<td>Porcentaje de población de 65 y más años</td>
<td class="derecha">2.42 %</td>
</tr>
<tr>
<td>Porcentaje de población no especificada</td>
<td class="derecha">0.37 %</td>
</tr>
<tr>
<td>Fecundidad promedio</td>
<td class="derecha">2.48</td>
</tr>
<tr>
<td>Porcentaje de población con discapacidad</td>
<td class="derecha">2.90 %</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading acordeon-cabecera" role="tab" id="cabeceraDatosCaracteristicasEconomicas">
<h4 class="panel-title acordeon-titulo">
<a class="acordeon-vinculo collapsed" role="button" data-toggle="collapse" data-parent="#Datos" href="#DatosCaracteristicasEconomicas" aria-expanded="false" aria-controls="DatosCaracteristicasEconomicas">
Características Económicas
</a>
</h4>
</div>
<div id="DatosCaracteristicasEconomicas" class="panel-collapse collapse" role="tabpanel" aria-labelledby="cabeceraDatosCaracteristicasEconomicas">
<div class="panel-body">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>Indicador</th>
<th>Valor</th>
</tr>
</thead>
<tbody>
<tr>
<td>Población Económicamente Activa</td>
<td class="derecha">52.80 %</td>
</tr>
<tr>
<td>Población Económicamente Activa masculina</td>
<td class="derecha">74.55 %</td>
</tr>
<tr>
<td>Población Económicamente Activa femenina</td>
<td class="derecha">25.45 %</td>
</tr>
<tr>
<td>Población Ocupada</td>
<td class="derecha">90.35 %</td>
</tr>
<tr>
<td>Población Ocupada masculina</td>
<td class="derecha">73.76 %</td>
</tr>
<tr>
<td>Población Ocupada femenina</td>
<td class="derecha">26.24 %</td>
</tr>
<tr>
<td>Población Desocupada</td>
<td class="derecha">9.65 %</td>
</tr>
<tr>
<td>Derechohabiencia</td>
<td class="derecha">62.81 %</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading acordeon-cabecera" role="tab" id="cabeceraDatosViviendas">
<h4 class="panel-title acordeon-titulo">
<a class="acordeon-vinculo collapsed" role="button" data-toggle="collapse" data-parent="#Datos" href="#DatosViviendas" aria-expanded="false" aria-controls="DatosViviendas">
Viviendas
</a>
</h4>
</div>
<div id="DatosViviendas" class="panel-collapse collapse" role="tabpanel" aria-labelledby="cabeceraDatosViviendas">
<div class="panel-body">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>Indicador</th>
<th>Valor</th>
</tr>
</thead>
<tbody>
<tr>
<td>Hogares</td>
<td class="derecha">1,859</td>
</tr>
<tr>
<td>Ocupación por Vivienda</td>
<td class="derecha">3.80</td>
</tr>
<tr>
<td>Viviendas con Electricidad</td>
<td class="derecha">99.37 %</td>
</tr>
<tr>
<td>Viviendas con Agua</td>
<td class="derecha">41.97 %</td>
</tr>
<tr>
<td>Viviendas con Drenaje</td>
<td class="derecha">78.39 %</td>
</tr>
<tr>
<td>Viviendas con Televisión</td>
<td class="derecha">92.96 %</td>
</tr>
<tr>
<td>Viviendas con Automóvil</td>
<td class="derecha">34.95 %</td>
</tr>
<tr>
<td>Viviendas con Computadora</td>
<td class="derecha">13.80 %</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading acordeon-cabecera" role="tab" id="cabeceraDatosUnidadesEconomicas">
<h4 class="panel-title acordeon-titulo">
<a class="acordeon-vinculo collapsed" role="button" data-toggle="collapse" data-parent="#Datos" href="#DatosUnidadesEconomicas" aria-expanded="false" aria-controls="DatosUnidadesEconomicas">
Unidades Económicas
</a>
</h4>
</div>
<div id="DatosUnidadesEconomicas" class="panel-collapse collapse" role="tabpanel" aria-labelledby="cabeceraDatosUnidadesEconomicas">
<div class="panel-body">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>Indicador</th>
<th>Valor</th>
</tr>
</thead>
<tbody>
<tr>
<td>Total Actividades Económicas</td>
<td class="derecha">128</td>
</tr>
<tr>
<td>1° Comercio Menudeo</td>
<td class="derecha">58.59 %</td>
</tr>
<tr>
<td>2° Otros servicios, excepto Gobierno</td>
<td class="derecha">16.41 %</td>
</tr>
<tr>
<td>3° Preparación de Alimentos y Bebidas</td>
<td class="derecha">10.16 %</td>
</tr>
<tr>
<td>4° Industria Manufacturera</td>
<td class="derecha">8.59 %</td>
</tr>
<tr>
<td>5° Educativos</td>
<td class="derecha">3.12 %</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="LenguetasConglomeradoGraficas">
<div class="panel-group" id="Graficas" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading acordeon-cabecera" role="tab" id="cabeceraGraficasDemografia">
<h4 class="panel-title acordeon-titulo">
<a class="acordeon-vinculo" role="button" data-toggle="collapse" data-parent="#Graficas" href="#GraficasDemografia" aria-expanded="true" aria-controls="GraficasDemografia">
Demografía
</a>
</h4>
</div>
<div id="GraficasDemografia" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="cabeceraGraficasDemografia">
<div class="panel-body">
<div id="GraficaPobMasFem" class="grafica"></div>
<div id="GraficaPobRango" class="grafica"></div>
<div id="GraficaPobDisc" class="grafica"></div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading acordeon-cabecera" role="tab" id="cabeceraGraficasCaracteristicasEconomicas">
<h4 class="panel-title acordeon-titulo">
<a class="acordeon-vinculo collapsed" role="button" data-toggle="collapse" data-parent="#Graficas" href="#GraficasCaracteristicasEconomicas" aria-expanded="false" aria-controls="GraficasCaracteristicasEconomicas">
Características Económicas
</a>
</h4>
</div>
<div id="GraficasCaracteristicasEconomicas" class="panel-collapse collapse" role="tabpanel" aria-labelledby="cabeceraGraficasCaracteristicasEconomicas">
<div class="panel-body">
<div id="GraficaPobEcoAct" class="grafica"></div>
<div id="GraficaPobEcoActMasFem" class="grafica"></div>
<div id="GraficaOcu" class="grafica"></div>
<div id="GraficaOcuMasFem" class="grafica"></div>
<div id="GraficaDerechohabiencia" class="grafica"></div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading acordeon-cabecera" role="tab" id="cabeceraGraficasViviendas">
<h4 class="panel-title acordeon-titulo">
<a class="acordeon-vinculo collapsed" role="button" data-toggle="collapse" data-parent="#Graficas" href="#GraficasViviendas" aria-expanded="false" aria-controls="GraficasViviendas">
Viviendas
</a>
</h4>
</div>
<div id="GraficasViviendas" class="panel-collapse collapse" role="tabpanel" aria-labelledby="cabeceraGraficasViviendas">
<div class="panel-body">
<div id="GraficaVivCon" class="grafica"></div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading acordeon-cabecera" role="tab" id="cabeceraGraficasUnidadesEconomicas">
<h4 class="panel-title acordeon-titulo">
<a class="acordeon-vinculo collapsed" role="button" data-toggle="collapse" data-parent="#Graficas" href="#GraficasUnidadesEconomicas" aria-expanded="false" aria-controls="GraficasUnidadesEconomicas">
Unidades Económicas
</a>
</h4>
</div>
<div id="GraficasUnidadesEconomicas" class="panel-collapse collapse" role="tabpanel" aria-labelledby="cabeceraGraficasUnidadesEconomicas">
<div class="panel-body">
<div id="GraficaUniEco" class="grafica"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Contenido: Termina -->
</div></article>
</div>
<div class="mapa-inferior">
<div class="pull-right redes-sociales">
<a class="fa fa-twitter-square" href="http://www.twitter.com/trcimplan" target="_blank"></a>
<a class="fa fa-facebook-square" href="https://facebook.com/trcimplan" target="_blank"></a>
<a class="fa fa-facebook-square" href="http://www.instagram.com/implantorreon" target="_blank"></a>
<a class="fa fa-rss-square" href="../rss.xml"></a>
</div>
</div>
</div>
</div>
<!-- Javascript global inicia -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../vendor/metisMenu/metisMenu.min.js"></script>
<script type="text/javascript" src="../vendor/datatables/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="../vendor/datatables-plugins/dataTables.bootstrap.min.js"></script>
<script type="text/javascript" src="../vendor/datatables-responsive/dataTables.responsive.js"></script>
<script type="text/javascript" src="../vendor/raphael/raphael.min.js"></script>
<script type="text/javascript" src="../vendor/morrisjs/morris.min.js"></script>
<script type="text/javascript" src="../dist/js/sb-admin-2.min.js"></script>
<script type="text/javascript" src="http://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.js"></script>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<!-- Javascript global termina -->
<!-- Javascript inicia -->
<script>
// Google Charts
google.charts.load('current', {'packages':['corechart']});
// Carto mapas
var mapa_limites_cargado = false;
// LenguetaWeb LenguetasConglomeradoMapas ejecuta lo siguiente al mostrar
$('#LenguetasConglomerado a[href="#LenguetasConglomeradoMapas"]').on('shown.bs.tab', function(e){
if (mapa_limites_cargado == false) {
var carto_json = 'https://guivaloz.carto.com/api/v2/viz/f0e6db7c-ac40-11e6-9146-0e3a376473ab/viz.json'
cartodb.createVis('MapaLimites', carto_json, {
center_lat: 25.491551581371,
center_lon: -103.37659358569,
zoom: 14
})
.done(function(vis, layers) {
// Capa colonias
var capa_colonias = layers[1];
// Cambiar la consulta en la subcapa
var sub_capa = capa_colonias.getSubLayer(0);
sub_capa.setSQL("SELECT * FROM ibccoloniastorreon20170524b WHERE nombre = 'Ampliación Zaragoza Sur'");
})
.error(function(err) {
console.log(err);
});
mapa_limites_cargado = true;
}
})
// LenguetaWeb LenguetasConglomeradoGraficas ejecuta lo siguiente al mostrar
$('#LenguetasConglomerado a[href="#LenguetasConglomeradoGraficas"]').on('shown.bs.tab', function(e){
// AcordeonWeb GraficasDemografia
// GraficaPayWeb GraficaPobMasFem
google.charts.setOnLoadCallback(elaborarGraficaPobMasFem);
function elaborarGraficaPobMasFem() {
var data = google.visualization.arrayToDataTable([
['Etiqueta', 'Valor'],
['Masculina', 50.79],
['Femenina', 49.21]
]);
var options = {
chartArea: { width: '100%', height: '80%' },
title: 'Población por género',
slices: [{color: '#006AC8'}, {color: '#C80083'}]
};
var chart = new google.visualization.PieChart(document.getElementById('GraficaPobMasFem'));
chart.draw(data, options);
}
// GraficaPayWeb GraficaPobRango
google.charts.setOnLoadCallback(elaborarGraficaPobRango);
function elaborarGraficaPobRango() {
var data = google.visualization.arrayToDataTable([
['Etiqueta', 'Valor'],
['De 0 a 14 años', 39.96],
['De 15 a 64 años', 57.25],
['De 65 y más años', 2.42],
['No especificada', 0.37]
]);
var options = {
chartArea: { width: '100%', height: '80%' },
title: 'Población por rangos de edad',
slices: [{color: '#89BE85'}, {color: '#57A550'}, {color: '#15630E'}, {color: '#BFBFBF'}]
};
var chart = new google.visualization.PieChart(document.getElementById('GraficaPobRango'));
chart.draw(data, options);
}
// GraficaPayWeb GraficaPobDisc
google.charts.setOnLoadCallback(elaborarGraficaPobDisc);
function elaborarGraficaPobDisc() {
var data = google.visualization.arrayToDataTable([
['Etiqueta', 'Valor'],
['CON discapacidad', 2.9],
['Sin discapacidad', 97.1]
]);
var options = {
chartArea: { width: '100%', height: '80%' },
title: 'Con discapacidad',
slices: [{color: '#A80021'}, {color: '#BFBFBF'}]
};
var chart = new google.visualization.PieChart(document.getElementById('GraficaPobDisc'));
chart.draw(data, options);
}
// AcordeonWeb GraficasCaracteristicasEconomicas ejecuta lo siguiente al mostrar
$('#GraficasCaracteristicasEconomicas').on('shown.bs.collapse', function () {
// GraficaPayWeb GraficaPobEcoAct
google.charts.setOnLoadCallback(elaborarGraficaPobEcoAct);
function elaborarGraficaPobEcoAct() {
var data = google.visualization.arrayToDataTable([
['Etiqueta', 'Valor'],
['Activa', 52.8],
['NO Activa', 47.2]
]);
var options = {
chartArea: { width: '100%', height: '80%' },
title: 'Población Económicamente Activa',
slices: [{color: '#7E00A8'}, {color: '#BFBFBF'}]
};
var chart = new google.visualization.PieChart(document.getElementById('GraficaPobEcoAct'));
chart.draw(data, options);
}
// GraficaPayWeb GraficaPobEcoActMasFem
google.charts.setOnLoadCallback(elaborarGraficaPobEcoActMasFem);
function elaborarGraficaPobEcoActMasFem() {
var data = google.visualization.arrayToDataTable([
['Etiqueta', 'Valor'],
['Masculina', 74.55],
['Femenina', 25.45]
]);
var options = {
chartArea: { width: '100%', height: '80%' },
title: 'Población Económicamente Activa por género',
slices: [{color: '#006AC8'}, {color: '#C80083'}]
};
var chart = new google.visualization.PieChart(document.getElementById('GraficaPobEcoActMasFem'));
chart.draw(data, options);
}
// GraficaPayWeb GraficaOcu
google.charts.setOnLoadCallback(elaborarGraficaOcu);
function elaborarGraficaOcu() {
var data = google.visualization.arrayToDataTable([
['Etiqueta', 'Valor'],
['Ocupada', 90.35],
['Desocupada', 9.65]
]);
var options = {
chartArea: { width: '100%', height: '80%' },
title: 'Población Ocupada',
slices: [{color: '#A8001E'}, {color: '#BFBFBF'}]
};
var chart = new google.visualization.PieChart(document.getElementById('GraficaOcu'));
chart.draw(data, options);
}
// GraficaPayWeb GraficaOcuMasFem
google.charts.setOnLoadCallback(elaborarGraficaOcuMasFem);
function elaborarGraficaOcuMasFem() {
var data = google.visualization.arrayToDataTable([
['Etiqueta', 'Valor'],
['Masculina', 73.76],
['Femenina', 26.24]
]);
var options = {
chartArea: { width: '100%', height: '80%' },
title: 'Población Ocupada por género',
slices: [{color: '#006AC8'}, {color: '#C80083'}]
};
var chart = new google.visualization.PieChart(document.getElementById('GraficaOcuMasFem'));
chart.draw(data, options);
}
// GraficaPayWeb GraficaDerechohabiencia
google.charts.setOnLoadCallback(elaborarGraficaDerechohabiencia);
function elaborarGraficaDerechohabiencia() {
var data = google.visualization.arrayToDataTable([
['Etiqueta', 'Valor'],
['Con Derechohabiencia', 62.81],
['SIN Derechohabiencia', 37.19]
]);
var options = {
chartArea: { width: '100%', height: '80%' },
title: 'Derechohabiencia',
slices: [{color: '#00A898'}, {color: '#BFBFBF'}]
};
var chart = new google.visualization.PieChart(document.getElementById('GraficaDerechohabiencia'));
chart.draw(data, options);
}
})
// AcordeonWeb GraficasViviendas ejecuta lo siguiente al mostrar
$('#GraficasViviendas').on('shown.bs.collapse', function () {
// GraficaBarrasWeb GraficaVivCon
google.charts.setOnLoadCallback(elaborarGraficaVivCon);
function elaborarGraficaVivCon() {
var data = google.visualization.arrayToDataTable([
['Etiqueta', 'Valor', { role: 'style' }, { role: 'annotation' }],
['Electricidad', 99.37, '#C080FF', '99.37 %'],
['Agua', 41.97, '#80C0FF', '41.97 %'],
['Drenaje', 78.39, '#59BFC3', '78.39 %'],
['Televisión', 92.96, '#59C38E', '92.96 %'],
['Automóvil', 34.95, '#8EC359', '34.95 %'],
['Computadora', 13.8, '#C38E59', '13.8 %']
]);
var options = {
chartArea: { width: '60%' },
title: 'Viviendas con...',
hAxis: { title: 'Porcentaje', minValue: 0, maxValue: 100 },
legend: { position: 'none' }
};
var chart = new google.visualization.BarChart(document.getElementById('GraficaVivCon'));
chart.draw(data, options);
}
})
// AcordeonWeb GraficasUnidadesEconomicas ejecuta lo siguiente al mostrar
$('#GraficasUnidadesEconomicas').on('shown.bs.collapse', function () {
// GraficaBarrasWeb GraficaUniEco
google.charts.setOnLoadCallback(elaborarGraficaUniEco);
function elaborarGraficaUniEco() {
var data = google.visualization.arrayToDataTable([
['Etiqueta', 'Valor', { role: 'style' }, { role: 'annotation' }],
['1° Comercio Menudeo', 58.59, '#59C38E', '58.59 %'],
['2° Otros servicios, excepto Gobierno', 16.41, '#8EC359', '16.41 %'],
['3° Preparación de Alimentos y Bebidas', 10.16, '#C38E59', '10.16 %'],
['4° Industria Manufacturera', 8.59, '#80C0FF', '8.59 %'],
['5° Educativos', 3.12, '#59BFC3', '3.12 %']
]);
var options = {
chartArea: { width: '60%' },
title: '128 Unidades Económicas',
hAxis: { title: 'Porcentaje', minValue: 0 },
legend: { position: 'none' }
};
var chart = new google.visualization.BarChart(document.getElementById('GraficaUniEco'));
chart.draw(data, options);
}
})
})
// LenguetasWeb LenguetasConglomerado ordenar que Reseña es la que se mostrará
$(document).ready(function(){
$('#LenguetasConglomerado a[href="#LenguetasConglomeradoResena"]').tab('show')
});
</script>
<!-- Javascript termina -->
<!-- Javascript Google Analytics -->
<script>
// Google Analytics
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-58290501-1', 'auto');ga('send', 'pageview');
</script>
</body>
</html>
| TRCIMPLAN/trcimplan.github.io | ibc-colonias-torreon/ampliacion-zaragoza-sur.html | HTML | gpl-3.0 | 42,640 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
9686,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
999,
1011,
1011,
1027,
1027,
1027,
1027,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyVersion("0.1.3.1")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyInformationalVersion("0.1.3.1-beta")] // trigger pre release package
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: InternalsVisibleTo("Neo4jClient.Extension.Test")]
[assembly: ComVisible(false)] | profet23/Neo4jClient.Extension | SolutionItems/Properties/AssemblyInfoGlobal.cs | C# | mit | 489 | [
30522,
2478,
2291,
1012,
9185,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
21624,
8043,
7903,
2229,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
6970,
11923,
2121,
7903,
2229,
1025,
1031,
3320,
1024,
3320,
3597,
7685,
15950,
1006,
1000,
9385,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Security
{
public partial interface IPermission : ISecurityEncodable
{
IPermission Copy();
void Demand();
IPermission Intersect(IPermission target);
bool IsSubsetOf(IPermission target);
IPermission Union(IPermission target);
}
}
| DnlHarvey/corefx | src/System.Runtime.Extensions/src/System/Security/IPermission.cs | C# | mit | 505 | [
30522,
1013,
1013,
7000,
2000,
1996,
1012,
5658,
3192,
2104,
2028,
2030,
2062,
10540,
1012,
1013,
1013,
1996,
1012,
5658,
3192,
15943,
2023,
5371,
2000,
2017,
2104,
1996,
10210,
6105,
1012,
1013,
1013,
2156,
1996,
6105,
5371,
1999,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
/* globals generateInputCompilerHelper: false */
describe('ngModel', function() {
describe('NgModelController', function() {
/* global NgModelController: false */
var ctrl, scope, element, parentFormCtrl;
beforeEach(inject(function($rootScope, $controller) {
var attrs = {name: 'testAlias', ngModel: 'value'};
parentFormCtrl = {
$$setPending: jasmine.createSpy('$$setPending'),
$setValidity: jasmine.createSpy('$setValidity'),
$setDirty: jasmine.createSpy('$setDirty'),
$$clearControlValidity: noop
};
element = jqLite('<form><input></form>');
scope = $rootScope;
ctrl = $controller(NgModelController, {
$scope: scope,
$element: element.find('input'),
$attrs: attrs
});
//Assign the mocked parentFormCtrl to the model controller
ctrl.$$parentForm = parentFormCtrl;
}));
afterEach(function() {
dealoc(element);
});
it('should init the properties', function() {
expect(ctrl.$untouched).toBe(true);
expect(ctrl.$touched).toBe(false);
expect(ctrl.$dirty).toBe(false);
expect(ctrl.$pristine).toBe(true);
expect(ctrl.$valid).toBe(true);
expect(ctrl.$invalid).toBe(false);
expect(ctrl.$viewValue).toBeDefined();
expect(ctrl.$modelValue).toBeDefined();
expect(ctrl.$formatters).toEqual([]);
expect(ctrl.$parsers).toEqual([]);
expect(ctrl.$name).toBe('testAlias');
});
describe('setValidity', function() {
function expectOneError() {
expect(ctrl.$error).toEqual({someError: true});
expect(ctrl.$$success).toEqual({});
expect(ctrl.$pending).toBeUndefined();
}
function expectOneSuccess() {
expect(ctrl.$error).toEqual({});
expect(ctrl.$$success).toEqual({someError: true});
expect(ctrl.$pending).toBeUndefined();
}
function expectOnePending() {
expect(ctrl.$error).toEqual({});
expect(ctrl.$$success).toEqual({});
expect(ctrl.$pending).toEqual({someError: true});
}
function expectCleared() {
expect(ctrl.$error).toEqual({});
expect(ctrl.$$success).toEqual({});
expect(ctrl.$pending).toBeUndefined();
}
it('should propagate validity to the parent form', function() {
expect(parentFormCtrl.$setValidity).not.toHaveBeenCalled();
ctrl.$setValidity('ERROR', false);
expect(parentFormCtrl.$setValidity).toHaveBeenCalledOnceWith('ERROR', false, ctrl);
});
it('should transition from states correctly', function() {
expectCleared();
ctrl.$setValidity('someError', false);
expectOneError();
ctrl.$setValidity('someError', undefined);
expectOnePending();
ctrl.$setValidity('someError', true);
expectOneSuccess();
ctrl.$setValidity('someError', null);
expectCleared();
});
it('should set valid/invalid with multiple errors', function() {
ctrl.$setValidity('first', false);
expect(ctrl.$valid).toBe(false);
expect(ctrl.$invalid).toBe(true);
ctrl.$setValidity('second', false);
expect(ctrl.$valid).toBe(false);
expect(ctrl.$invalid).toBe(true);
ctrl.$setValidity('third', undefined);
expect(ctrl.$valid).toBeUndefined();
expect(ctrl.$invalid).toBeUndefined();
ctrl.$setValidity('third', null);
expect(ctrl.$valid).toBe(false);
expect(ctrl.$invalid).toBe(true);
ctrl.$setValidity('second', true);
expect(ctrl.$valid).toBe(false);
expect(ctrl.$invalid).toBe(true);
ctrl.$setValidity('first', true);
expect(ctrl.$valid).toBe(true);
expect(ctrl.$invalid).toBe(false);
});
});
describe('setPristine', function() {
it('should set control to its pristine state', function() {
ctrl.$setViewValue('edit');
expect(ctrl.$dirty).toBe(true);
expect(ctrl.$pristine).toBe(false);
ctrl.$setPristine();
expect(ctrl.$dirty).toBe(false);
expect(ctrl.$pristine).toBe(true);
});
});
describe('setDirty', function() {
it('should set control to its dirty state', function() {
expect(ctrl.$pristine).toBe(true);
expect(ctrl.$dirty).toBe(false);
ctrl.$setDirty();
expect(ctrl.$pristine).toBe(false);
expect(ctrl.$dirty).toBe(true);
});
it('should set parent form to its dirty state', function() {
ctrl.$setDirty();
expect(parentFormCtrl.$setDirty).toHaveBeenCalled();
});
});
describe('setUntouched', function() {
it('should set control to its untouched state', function() {
ctrl.$setTouched();
ctrl.$setUntouched();
expect(ctrl.$touched).toBe(false);
expect(ctrl.$untouched).toBe(true);
});
});
describe('setTouched', function() {
it('should set control to its touched state', function() {
ctrl.$setUntouched();
ctrl.$setTouched();
expect(ctrl.$touched).toBe(true);
expect(ctrl.$untouched).toBe(false);
});
});
describe('view -> model', function() {
it('should set the value to $viewValue', function() {
ctrl.$setViewValue('some-val');
expect(ctrl.$viewValue).toBe('some-val');
});
it('should pipeline all registered parsers and set result to $modelValue', function() {
var log = [];
ctrl.$parsers.push(function(value) {
log.push(value);
return value + '-a';
});
ctrl.$parsers.push(function(value) {
log.push(value);
return value + '-b';
});
ctrl.$setViewValue('init');
expect(log).toEqual(['init', 'init-a']);
expect(ctrl.$modelValue).toBe('init-a-b');
});
it('should fire viewChangeListeners when the value changes in the view (even if invalid)',
function() {
var spy = jasmine.createSpy('viewChangeListener');
ctrl.$viewChangeListeners.push(spy);
ctrl.$setViewValue('val');
expect(spy).toHaveBeenCalledOnce();
spy.calls.reset();
// invalid
ctrl.$parsers.push(function() {return undefined;});
ctrl.$setViewValue('val2');
expect(spy).toHaveBeenCalledOnce();
});
it('should reset the model when the view is invalid', function() {
ctrl.$setViewValue('aaaa');
expect(ctrl.$modelValue).toBe('aaaa');
// add a validator that will make any input invalid
ctrl.$parsers.push(function() {return undefined;});
expect(ctrl.$modelValue).toBe('aaaa');
ctrl.$setViewValue('bbbb');
expect(ctrl.$modelValue).toBeUndefined();
});
it('should not reset the model when the view is invalid due to an external validator', function() {
ctrl.$setViewValue('aaaa');
expect(ctrl.$modelValue).toBe('aaaa');
ctrl.$setValidity('someExternalError', false);
ctrl.$setViewValue('bbbb');
expect(ctrl.$modelValue).toBe('bbbb');
});
it('should not reset the view when the view is invalid', function() {
// this test fails when the view changes the model and
// then the model listener in ngModel picks up the change and
// tries to update the view again.
// add a validator that will make any input invalid
ctrl.$parsers.push(function() {return undefined;});
spyOn(ctrl, '$render');
// first digest
ctrl.$setViewValue('bbbb');
expect(ctrl.$modelValue).toBeUndefined();
expect(ctrl.$viewValue).toBe('bbbb');
expect(ctrl.$render).not.toHaveBeenCalled();
expect(scope.value).toBeUndefined();
// further digests
scope.$apply('value = "aaa"');
expect(ctrl.$viewValue).toBe('aaa');
ctrl.$render.calls.reset();
ctrl.$setViewValue('cccc');
expect(ctrl.$modelValue).toBeUndefined();
expect(ctrl.$viewValue).toBe('cccc');
expect(ctrl.$render).not.toHaveBeenCalled();
expect(scope.value).toBeUndefined();
});
it('should call parentForm.$setDirty only when pristine', function() {
ctrl.$setViewValue('');
expect(ctrl.$pristine).toBe(false);
expect(ctrl.$dirty).toBe(true);
expect(parentFormCtrl.$setDirty).toHaveBeenCalledOnce();
parentFormCtrl.$setDirty.calls.reset();
ctrl.$setViewValue('');
expect(ctrl.$pristine).toBe(false);
expect(ctrl.$dirty).toBe(true);
expect(parentFormCtrl.$setDirty).not.toHaveBeenCalled();
});
it('should remove all other errors when any parser returns undefined', function() {
var a, b, val = function(val, x) {
return x ? val : x;
};
ctrl.$parsers.push(function(v) { return val(v, a); });
ctrl.$parsers.push(function(v) { return val(v, b); });
ctrl.$validators.high = function(value) {
return !isDefined(value) || value > 5;
};
ctrl.$validators.even = function(value) {
return !isDefined(value) || value % 2 === 0;
};
a = b = true;
ctrl.$setViewValue('3');
expect(ctrl.$error).toEqual({ high: true, even: true });
ctrl.$setViewValue('10');
expect(ctrl.$error).toEqual({});
a = undefined;
ctrl.$setViewValue('12');
expect(ctrl.$error).toEqual({ parse: true });
a = true;
b = undefined;
ctrl.$setViewValue('14');
expect(ctrl.$error).toEqual({ parse: true });
a = undefined;
b = undefined;
ctrl.$setViewValue('16');
expect(ctrl.$error).toEqual({ parse: true });
a = b = false; //not undefined
ctrl.$setViewValue('2');
expect(ctrl.$error).toEqual({ high: true });
});
it('should not remove external validators when a parser failed', function() {
ctrl.$parsers.push(function(v) { return undefined; });
ctrl.$setValidity('externalError', false);
ctrl.$setViewValue('someValue');
expect(ctrl.$error).toEqual({ externalError: true, parse: true });
});
it('should remove all non-parse-related CSS classes from the form when a parser fails',
inject(function($compile, $rootScope) {
var element = $compile('<form name="myForm">' +
'<input name="myControl" ng-model="value" >' +
'</form>')($rootScope);
var inputElm = element.find('input');
var ctrl = $rootScope.myForm.myControl;
var parserIsFailing = false;
ctrl.$parsers.push(function(value) {
return parserIsFailing ? undefined : value;
});
ctrl.$validators.alwaysFail = function() {
return false;
};
ctrl.$setViewValue('123');
scope.$digest();
expect(element).toHaveClass('ng-valid-parse');
expect(element).not.toHaveClass('ng-invalid-parse');
expect(element).toHaveClass('ng-invalid-always-fail');
parserIsFailing = true;
ctrl.$setViewValue('12345');
scope.$digest();
expect(element).not.toHaveClass('ng-valid-parse');
expect(element).toHaveClass('ng-invalid-parse');
expect(element).not.toHaveClass('ng-invalid-always-fail');
dealoc(element);
}));
it('should set the ng-invalid-parse and ng-valid-parse CSS class when parsers fail and pass', function() {
var pass = true;
ctrl.$parsers.push(function(v) {
return pass ? v : undefined;
});
var input = element.find('input');
ctrl.$setViewValue('1');
expect(input).toHaveClass('ng-valid-parse');
expect(input).not.toHaveClass('ng-invalid-parse');
pass = undefined;
ctrl.$setViewValue('2');
expect(input).not.toHaveClass('ng-valid-parse');
expect(input).toHaveClass('ng-invalid-parse');
});
it('should update the model after all async validators resolve', inject(function($q) {
var defer;
ctrl.$asyncValidators.promiseValidator = function(value) {
defer = $q.defer();
return defer.promise;
};
// set view value on first digest
ctrl.$setViewValue('b');
expect(ctrl.$modelValue).toBeUndefined();
expect(scope.value).toBeUndefined();
defer.resolve();
scope.$digest();
expect(ctrl.$modelValue).toBe('b');
expect(scope.value).toBe('b');
// set view value on further digests
ctrl.$setViewValue('c');
expect(ctrl.$modelValue).toBe('b');
expect(scope.value).toBe('b');
defer.resolve();
scope.$digest();
expect(ctrl.$modelValue).toBe('c');
expect(scope.value).toBe('c');
}));
it('should not throw an error if the scope has been destroyed', function() {
scope.$destroy();
ctrl.$setViewValue('some-val');
expect(ctrl.$viewValue).toBe('some-val');
});
});
describe('model -> view', function() {
it('should set the value to $modelValue', function() {
scope.$apply('value = 10');
expect(ctrl.$modelValue).toBe(10);
});
it('should pipeline all registered formatters in reversed order and set result to $viewValue',
function() {
var log = [];
ctrl.$formatters.unshift(function(value) {
log.push(value);
return value + 2;
});
ctrl.$formatters.unshift(function(value) {
log.push(value);
return value + '';
});
scope.$apply('value = 3');
expect(log).toEqual([3, 5]);
expect(ctrl.$viewValue).toBe('5');
});
it('should $render only if value changed', function() {
spyOn(ctrl, '$render');
scope.$apply('value = 3');
expect(ctrl.$render).toHaveBeenCalledOnce();
ctrl.$render.calls.reset();
ctrl.$formatters.push(function() {return 3;});
scope.$apply('value = 5');
expect(ctrl.$render).not.toHaveBeenCalled();
});
it('should clear the view even if invalid', function() {
spyOn(ctrl, '$render');
ctrl.$formatters.push(function() {return undefined;});
scope.$apply('value = 5');
expect(ctrl.$render).toHaveBeenCalledOnce();
});
it('should render immediately even if there are async validators', inject(function($q) {
spyOn(ctrl, '$render');
ctrl.$asyncValidators.someValidator = function() {
return $q.defer().promise;
};
scope.$apply('value = 5');
expect(ctrl.$viewValue).toBe(5);
expect(ctrl.$render).toHaveBeenCalledOnce();
}));
it('should not rerender nor validate in case view value is not changed', function() {
ctrl.$formatters.push(function(value) {
return 'nochange';
});
spyOn(ctrl, '$render');
ctrl.$validators.spyValidator = jasmine.createSpy('spyValidator');
scope.$apply('value = "first"');
scope.$apply('value = "second"');
expect(ctrl.$validators.spyValidator).toHaveBeenCalledOnce();
expect(ctrl.$render).toHaveBeenCalledOnce();
});
it('should always format the viewValue as a string for a blank input type when the value is present',
inject(function($compile, $rootScope, $sniffer) {
var form = $compile('<form name="form"><input name="field" ng-model="val" /></form>')($rootScope);
$rootScope.val = 123;
$rootScope.$digest();
expect($rootScope.form.field.$viewValue).toBe('123');
$rootScope.val = null;
$rootScope.$digest();
expect($rootScope.form.field.$viewValue).toBe(null);
dealoc(form);
}));
it('should always format the viewValue as a string for a `text` input type when the value is present',
inject(function($compile, $rootScope, $sniffer) {
var form = $compile('<form name="form"><input type="text" name="field" ng-model="val" /></form>')($rootScope);
$rootScope.val = 123;
$rootScope.$digest();
expect($rootScope.form.field.$viewValue).toBe('123');
$rootScope.val = null;
$rootScope.$digest();
expect($rootScope.form.field.$viewValue).toBe(null);
dealoc(form);
}));
it('should always format the viewValue as a string for an `email` input type when the value is present',
inject(function($compile, $rootScope, $sniffer) {
var form = $compile('<form name="form"><input type="email" name="field" ng-model="val" /></form>')($rootScope);
$rootScope.val = 123;
$rootScope.$digest();
expect($rootScope.form.field.$viewValue).toBe('123');
$rootScope.val = null;
$rootScope.$digest();
expect($rootScope.form.field.$viewValue).toBe(null);
dealoc(form);
}));
it('should always format the viewValue as a string for a `url` input type when the value is present',
inject(function($compile, $rootScope, $sniffer) {
var form = $compile('<form name="form"><input type="url" name="field" ng-model="val" /></form>')($rootScope);
$rootScope.val = 123;
$rootScope.$digest();
expect($rootScope.form.field.$viewValue).toBe('123');
$rootScope.val = null;
$rootScope.$digest();
expect($rootScope.form.field.$viewValue).toBe(null);
dealoc(form);
}));
it('should set NaN as the $modelValue when an asyncValidator is present',
inject(function($q) {
ctrl.$asyncValidators.test = function() {
return $q(function(resolve, reject) {
resolve();
});
};
scope.$apply('value = 10');
expect(ctrl.$modelValue).toBe(10);
expect(function() {
scope.$apply(function() {
scope.value = NaN;
});
}).not.toThrow();
expect(ctrl.$modelValue).toBeNaN();
}));
describe('$processModelValue', function() {
// Emulate setting the model on the scope
function setModelValue(ctrl, value) {
ctrl.$modelValue = ctrl.$$rawModelValue = value;
ctrl.$$parserValid = undefined;
}
it('should run the model -> view pipeline', function() {
var log = [];
var input = ctrl.$$element;
ctrl.$formatters.unshift(function(value) {
log.push(value);
return value + 2;
});
ctrl.$formatters.unshift(function(value) {
log.push(value);
return value + '';
});
spyOn(ctrl, '$render');
setModelValue(ctrl, 3);
expect(ctrl.$modelValue).toBe(3);
ctrl.$processModelValue();
expect(ctrl.$modelValue).toBe(3);
expect(log).toEqual([3, 5]);
expect(ctrl.$viewValue).toBe('5');
expect(ctrl.$render).toHaveBeenCalledOnce();
});
it('should add the validation and empty-state classes',
inject(function($compile, $rootScope, $animate) {
var input = $compile('<input name="myControl" maxlength="1" ng-model="value" >')($rootScope);
$rootScope.$digest();
spyOn($animate, 'addClass');
spyOn($animate, 'removeClass');
var ctrl = input.controller('ngModel');
expect(input).toHaveClass('ng-empty');
expect(input).toHaveClass('ng-valid');
setModelValue(ctrl, 3);
ctrl.$processModelValue();
// $animate adds / removes classes in the $$postDigest, which
// we cannot trigger with $digest, because that would set the model from the scope,
// so we simply check if the functions have been called
expect($animate.removeClass.calls.mostRecent().args[0][0]).toBe(input[0]);
expect($animate.removeClass.calls.mostRecent().args[1]).toBe('ng-empty');
expect($animate.addClass.calls.mostRecent().args[0][0]).toBe(input[0]);
expect($animate.addClass.calls.mostRecent().args[1]).toBe('ng-not-empty');
$animate.removeClass.calls.reset();
$animate.addClass.calls.reset();
setModelValue(ctrl, 35);
ctrl.$processModelValue();
expect($animate.addClass.calls.argsFor(1)[0][0]).toBe(input[0]);
expect($animate.addClass.calls.argsFor(1)[1]).toBe('ng-invalid');
expect($animate.addClass.calls.argsFor(2)[0][0]).toBe(input[0]);
expect($animate.addClass.calls.argsFor(2)[1]).toBe('ng-invalid-maxlength');
})
);
// this is analogue to $setViewValue
it('should run the model -> view pipeline even if the value has not changed', function() {
var log = [];
ctrl.$formatters.unshift(function(value) {
log.push(value);
return value + 2;
});
ctrl.$formatters.unshift(function(value) {
log.push(value);
return value + '';
});
spyOn(ctrl, '$render');
setModelValue(ctrl, 3);
ctrl.$processModelValue();
expect(ctrl.$modelValue).toBe(3);
expect(ctrl.$viewValue).toBe('5');
expect(log).toEqual([3, 5]);
expect(ctrl.$render).toHaveBeenCalledOnce();
ctrl.$processModelValue();
expect(ctrl.$modelValue).toBe(3);
expect(ctrl.$viewValue).toBe('5');
expect(log).toEqual([3, 5, 3, 5]);
// $render() is not called if the viewValue didn't change
expect(ctrl.$render).toHaveBeenCalledOnce();
});
});
});
describe('validation', function() {
describe('$validate', function() {
it('should perform validations when $validate() is called', function() {
scope.$apply('value = ""');
var validatorResult = false;
ctrl.$validators.someValidator = function(value) {
return validatorResult;
};
ctrl.$validate();
expect(ctrl.$valid).toBe(false);
validatorResult = true;
ctrl.$validate();
expect(ctrl.$valid).toBe(true);
});
it('should pass the last parsed modelValue to the validators', function() {
ctrl.$parsers.push(function(modelValue) {
return modelValue + 'def';
});
ctrl.$setViewValue('abc');
ctrl.$validators.test = function(modelValue, viewValue) {
return true;
};
spyOn(ctrl.$validators, 'test');
ctrl.$validate();
expect(ctrl.$validators.test).toHaveBeenCalledWith('abcdef', 'abc');
});
it('should set the model to undefined when it becomes invalid', function() {
var valid = true;
ctrl.$validators.test = function(modelValue, viewValue) {
return valid;
};
scope.$apply('value = "abc"');
expect(scope.value).toBe('abc');
valid = false;
ctrl.$validate();
expect(scope.value).toBeUndefined();
});
it('should update the model when it becomes valid', function() {
var valid = true;
ctrl.$validators.test = function(modelValue, viewValue) {
return valid;
};
scope.$apply('value = "abc"');
expect(scope.value).toBe('abc');
valid = false;
ctrl.$validate();
expect(scope.value).toBeUndefined();
valid = true;
ctrl.$validate();
expect(scope.value).toBe('abc');
});
it('should not update the model when it is valid, but there is a parse error', function() {
ctrl.$parsers.push(function(modelValue) {
return undefined;
});
ctrl.$setViewValue('abc');
expect(ctrl.$error.parse).toBe(true);
expect(scope.value).toBeUndefined();
ctrl.$validators.test = function(modelValue, viewValue) {
return true;
};
ctrl.$validate();
expect(ctrl.$error).toEqual({parse: true});
expect(scope.value).toBeUndefined();
});
it('should not set an invalid model to undefined when validity is the same', function() {
ctrl.$validators.test = function() {
return false;
};
scope.$apply('value = "invalid"');
expect(ctrl.$valid).toBe(false);
expect(scope.value).toBe('invalid');
ctrl.$validate();
expect(ctrl.$valid).toBe(false);
expect(scope.value).toBe('invalid');
});
it('should not change a model that has a formatter', function() {
ctrl.$validators.test = function() {
return true;
};
ctrl.$formatters.push(function(modelValue) {
return 'xyz';
});
scope.$apply('value = "abc"');
expect(ctrl.$viewValue).toBe('xyz');
ctrl.$validate();
expect(scope.value).toBe('abc');
});
it('should not change a model that has a parser', function() {
ctrl.$validators.test = function() {
return true;
};
ctrl.$parsers.push(function(modelValue) {
return 'xyz';
});
scope.$apply('value = "abc"');
ctrl.$validate();
expect(scope.value).toBe('abc');
});
});
describe('view -> model update', function() {
it('should always perform validations using the parsed model value', function() {
var captures;
ctrl.$validators.raw = function() {
captures = Array.prototype.slice.call(arguments);
return captures[0];
};
ctrl.$parsers.push(function(value) {
return value.toUpperCase();
});
ctrl.$setViewValue('my-value');
expect(captures).toEqual(['MY-VALUE', 'my-value']);
});
it('should always perform validations using the formatted view value', function() {
var captures;
ctrl.$validators.raw = function() {
captures = Array.prototype.slice.call(arguments);
return captures[0];
};
ctrl.$formatters.push(function(value) {
return value + '...';
});
scope.$apply('value = "matias"');
expect(captures).toEqual(['matias', 'matias...']);
});
it('should only perform validations if the view value is different', function() {
var count = 0;
ctrl.$validators.countMe = function() {
count++;
};
ctrl.$setViewValue('my-value');
expect(count).toBe(1);
ctrl.$setViewValue('my-value');
expect(count).toBe(1);
ctrl.$setViewValue('your-value');
expect(count).toBe(2);
});
});
it('should perform validations twice each time the model value changes within a digest', function() {
var count = 0;
ctrl.$validators.number = function(value) {
count++;
return (/^\d+$/).test(value);
};
scope.$apply('value = ""');
expect(count).toBe(1);
scope.$apply('value = 1');
expect(count).toBe(2);
scope.$apply('value = 1');
expect(count).toBe(2);
scope.$apply('value = ""');
expect(count).toBe(3);
});
it('should only validate to true if all validations are true', function() {
ctrl.$modelValue = undefined;
ctrl.$validators.a = valueFn(true);
ctrl.$validators.b = valueFn(true);
ctrl.$validators.c = valueFn(false);
ctrl.$validate();
expect(ctrl.$valid).toBe(false);
ctrl.$validators.c = valueFn(true);
ctrl.$validate();
expect(ctrl.$valid).toBe(true);
});
it('should treat all responses as boolean for synchronous validators', function() {
var expectValid = function(value, expected) {
ctrl.$modelValue = undefined;
ctrl.$validators.a = valueFn(value);
ctrl.$validate();
expect(ctrl.$valid).toBe(expected);
};
// False tests
expectValid(false, false);
expectValid(undefined, false);
expectValid(null, false);
expectValid(0, false);
expectValid(NaN, false);
expectValid('', false);
// True tests
expectValid(true, true);
expectValid(1, true);
expectValid('0', true);
expectValid('false', true);
expectValid([], true);
expectValid({}, true);
});
it('should register invalid validations on the $error object', function() {
ctrl.$modelValue = undefined;
ctrl.$validators.unique = valueFn(false);
ctrl.$validators.tooLong = valueFn(false);
ctrl.$validators.notNumeric = valueFn(true);
ctrl.$validate();
expect(ctrl.$error.unique).toBe(true);
expect(ctrl.$error.tooLong).toBe(true);
expect(ctrl.$error.notNumeric).not.toBe(true);
});
it('should render a validator asynchronously when a promise is returned', inject(function($q) {
var defer;
ctrl.$asyncValidators.promiseValidator = function(value) {
defer = $q.defer();
return defer.promise;
};
scope.$apply('value = ""');
expect(ctrl.$valid).toBeUndefined();
expect(ctrl.$invalid).toBeUndefined();
expect(ctrl.$pending.promiseValidator).toBe(true);
defer.resolve();
scope.$digest();
expect(ctrl.$valid).toBe(true);
expect(ctrl.$invalid).toBe(false);
expect(ctrl.$pending).toBeUndefined();
scope.$apply('value = "123"');
defer.reject();
scope.$digest();
expect(ctrl.$valid).toBe(false);
expect(ctrl.$invalid).toBe(true);
expect(ctrl.$pending).toBeUndefined();
}));
it('should throw an error when a promise is not returned for an asynchronous validator', inject(function($q) {
ctrl.$asyncValidators.async = function(value) {
return true;
};
expect(function() {
scope.$apply('value = "123"');
}).toThrowMinErr('ngModel', 'nopromise',
'Expected asynchronous validator to return a promise but got \'true\' instead.');
}));
it('should only run the async validators once all the sync validators have passed',
inject(function($q) {
var stages = {};
stages.sync = { status1: false, status2: false, count: 0 };
ctrl.$validators.syncValidator1 = function(modelValue, viewValue) {
stages.sync.count++;
return stages.sync.status1;
};
ctrl.$validators.syncValidator2 = function(modelValue, viewValue) {
stages.sync.count++;
return stages.sync.status2;
};
stages.async = { defer: null, count: 0 };
ctrl.$asyncValidators.asyncValidator = function(modelValue, viewValue) {
stages.async.defer = $q.defer();
stages.async.count++;
return stages.async.defer.promise;
};
scope.$apply('value = "123"');
expect(ctrl.$valid).toBe(false);
expect(ctrl.$invalid).toBe(true);
expect(stages.sync.count).toBe(2);
expect(stages.async.count).toBe(0);
stages.sync.status1 = true;
scope.$apply('value = "456"');
expect(stages.sync.count).toBe(4);
expect(stages.async.count).toBe(0);
stages.sync.status2 = true;
scope.$apply('value = "789"');
expect(stages.sync.count).toBe(6);
expect(stages.async.count).toBe(1);
stages.async.defer.resolve();
scope.$apply();
expect(ctrl.$valid).toBe(true);
expect(ctrl.$invalid).toBe(false);
}));
it('should ignore expired async validation promises once delivered', inject(function($q) {
var defer, oldDefer, newDefer;
ctrl.$asyncValidators.async = function(value) {
defer = $q.defer();
return defer.promise;
};
scope.$apply('value = ""');
oldDefer = defer;
scope.$apply('value = "123"');
newDefer = defer;
newDefer.reject();
scope.$digest();
oldDefer.resolve();
scope.$digest();
expect(ctrl.$valid).toBe(false);
expect(ctrl.$invalid).toBe(true);
expect(ctrl.$pending).toBeUndefined();
}));
it('should clear and ignore all pending promises when the model value changes', inject(function($q) {
ctrl.$validators.sync = function(value) {
return true;
};
var defers = [];
ctrl.$asyncValidators.async = function(value) {
var defer = $q.defer();
defers.push(defer);
return defer.promise;
};
scope.$apply('value = "123"');
expect(ctrl.$pending).toEqual({async: true});
expect(ctrl.$valid).toBeUndefined();
expect(ctrl.$invalid).toBeUndefined();
expect(defers.length).toBe(1);
expect(isObject(ctrl.$pending)).toBe(true);
scope.$apply('value = "456"');
expect(ctrl.$pending).toEqual({async: true});
expect(ctrl.$valid).toBeUndefined();
expect(ctrl.$invalid).toBeUndefined();
expect(defers.length).toBe(2);
expect(isObject(ctrl.$pending)).toBe(true);
defers[1].resolve();
scope.$digest();
expect(ctrl.$valid).toBe(true);
expect(ctrl.$invalid).toBe(false);
expect(isObject(ctrl.$pending)).toBe(false);
}));
it('should clear and ignore all pending promises when a parser fails', inject(function($q) {
var failParser = false;
ctrl.$parsers.push(function(value) {
return failParser ? undefined : value;
});
var defer;
ctrl.$asyncValidators.async = function(value) {
defer = $q.defer();
return defer.promise;
};
ctrl.$setViewValue('x..y..z');
expect(ctrl.$valid).toBeUndefined();
expect(ctrl.$invalid).toBeUndefined();
failParser = true;
ctrl.$setViewValue('1..2..3');
expect(ctrl.$valid).toBe(false);
expect(ctrl.$invalid).toBe(true);
expect(isObject(ctrl.$pending)).toBe(false);
defer.resolve();
scope.$digest();
expect(ctrl.$valid).toBe(false);
expect(ctrl.$invalid).toBe(true);
expect(isObject(ctrl.$pending)).toBe(false);
}));
it('should clear all errors from async validators if a parser fails', inject(function($q) {
var failParser = false;
ctrl.$parsers.push(function(value) {
return failParser ? undefined : value;
});
ctrl.$asyncValidators.async = function(value) {
return $q.reject();
};
ctrl.$setViewValue('x..y..z');
expect(ctrl.$error).toEqual({async: true});
failParser = true;
ctrl.$setViewValue('1..2..3');
expect(ctrl.$error).toEqual({parse: true});
}));
it('should clear all errors from async validators if a sync validator fails', inject(function($q) {
var failValidator = false;
ctrl.$validators.sync = function(value) {
return !failValidator;
};
ctrl.$asyncValidators.async = function(value) {
return $q.reject();
};
ctrl.$setViewValue('x..y..z');
expect(ctrl.$error).toEqual({async: true});
failValidator = true;
ctrl.$setViewValue('1..2..3');
expect(ctrl.$error).toEqual({sync: true});
}));
it('should be possible to extend Object prototype and still be able to do form validation',
inject(function($compile, $rootScope) {
// eslint-disable-next-line no-extend-native
Object.prototype.someThing = function() {};
var element = $compile('<form name="myForm">' +
'<input type="text" name="username" ng-model="username" minlength="10" required />' +
'</form>')($rootScope);
var inputElm = element.find('input');
var formCtrl = $rootScope.myForm;
var usernameCtrl = formCtrl.username;
$rootScope.$digest();
expect(usernameCtrl.$invalid).toBe(true);
expect(formCtrl.$invalid).toBe(true);
usernameCtrl.$setViewValue('valid-username');
$rootScope.$digest();
expect(usernameCtrl.$invalid).toBe(false);
expect(formCtrl.$invalid).toBe(false);
delete Object.prototype.someThing;
dealoc(element);
}));
it('should re-evaluate the form validity state once the asynchronous promise has been delivered',
inject(function($compile, $rootScope, $q) {
var element = $compile('<form name="myForm">' +
'<input type="text" name="username" ng-model="username" minlength="10" required />' +
'<input type="number" name="age" ng-model="age" min="10" required />' +
'</form>')($rootScope);
var inputElm = element.find('input');
var formCtrl = $rootScope.myForm;
var usernameCtrl = formCtrl.username;
var ageCtrl = formCtrl.age;
var usernameDefer;
usernameCtrl.$asyncValidators.usernameAvailability = function() {
usernameDefer = $q.defer();
return usernameDefer.promise;
};
$rootScope.$digest();
expect(usernameCtrl.$invalid).toBe(true);
expect(formCtrl.$invalid).toBe(true);
usernameCtrl.$setViewValue('valid-username');
$rootScope.$digest();
expect(formCtrl.$pending.usernameAvailability).toBeTruthy();
expect(usernameCtrl.$invalid).toBeUndefined();
expect(formCtrl.$invalid).toBeUndefined();
usernameDefer.resolve();
$rootScope.$digest();
expect(usernameCtrl.$invalid).toBe(false);
expect(formCtrl.$invalid).toBe(true);
ageCtrl.$setViewValue(22);
$rootScope.$digest();
expect(usernameCtrl.$invalid).toBe(false);
expect(ageCtrl.$invalid).toBe(false);
expect(formCtrl.$invalid).toBe(false);
usernameCtrl.$setViewValue('valid');
$rootScope.$digest();
expect(usernameCtrl.$invalid).toBe(true);
expect(ageCtrl.$invalid).toBe(false);
expect(formCtrl.$invalid).toBe(true);
usernameCtrl.$setViewValue('another-valid-username');
$rootScope.$digest();
usernameDefer.resolve();
$rootScope.$digest();
expect(usernameCtrl.$invalid).toBe(false);
expect(formCtrl.$invalid).toBe(false);
expect(formCtrl.$pending).toBeFalsy();
expect(ageCtrl.$invalid).toBe(false);
dealoc(element);
}));
it('should always use the most recent $viewValue for validation', function() {
ctrl.$parsers.push(function(value) {
if (value && value.substr(-1) === 'b') {
value = 'a';
ctrl.$setViewValue(value);
ctrl.$render();
}
return value;
});
ctrl.$validators.mock = function(modelValue) {
return true;
};
spyOn(ctrl.$validators, 'mock').and.callThrough();
ctrl.$setViewValue('ab');
expect(ctrl.$validators.mock).toHaveBeenCalledWith('a', 'a');
expect(ctrl.$validators.mock).toHaveBeenCalledTimes(2);
});
it('should validate even if the modelValue did not change', function() {
ctrl.$parsers.push(function(value) {
if (value && value.substr(-1) === 'b') {
value = 'a';
}
return value;
});
ctrl.$validators.mock = function(modelValue) {
return true;
};
spyOn(ctrl.$validators, 'mock').and.callThrough();
ctrl.$setViewValue('a');
expect(ctrl.$validators.mock).toHaveBeenCalledWith('a', 'a');
expect(ctrl.$validators.mock).toHaveBeenCalledTimes(1);
ctrl.$setViewValue('ab');
expect(ctrl.$validators.mock).toHaveBeenCalledWith('a', 'ab');
expect(ctrl.$validators.mock).toHaveBeenCalledTimes(2);
});
it('should validate correctly when $parser name equals $validator key', function() {
ctrl.$validators.parserOrValidator = function(value) {
switch (value) {
case 'allInvalid':
case 'parseValid-validatorsInvalid':
case 'stillParseValid-validatorsInvalid':
return false;
default:
return true;
}
};
ctrl.$validators.validator = function(value) {
switch (value) {
case 'allInvalid':
case 'parseValid-validatorsInvalid':
case 'stillParseValid-validatorsInvalid':
return false;
default:
return true;
}
};
ctrl.$parsers.push(function(value) {
switch (value) {
case 'allInvalid':
case 'stillAllInvalid':
case 'parseInvalid-validatorsValid':
case 'stillParseInvalid-validatorsValid':
ctrl.$$parserName = 'parserOrValidator';
return undefined;
default:
return value;
}
});
//Parser and validators are invalid
scope.$apply('value = "allInvalid"');
expect(scope.value).toBe('allInvalid');
expect(ctrl.$error).toEqual({parserOrValidator: true, validator: true});
ctrl.$validate();
expect(scope.value).toEqual('allInvalid');
expect(ctrl.$error).toEqual({parserOrValidator: true, validator: true});
ctrl.$setViewValue('stillAllInvalid');
expect(scope.value).toBeUndefined();
expect(ctrl.$error).toEqual({parserOrValidator: true});
ctrl.$validate();
expect(scope.value).toBeUndefined();
expect(ctrl.$error).toEqual({parserOrValidator: true});
//Parser is valid, validators are invalid
scope.$apply('value = "parseValid-validatorsInvalid"');
expect(scope.value).toBe('parseValid-validatorsInvalid');
expect(ctrl.$error).toEqual({parserOrValidator: true, validator: true});
ctrl.$validate();
expect(scope.value).toBe('parseValid-validatorsInvalid');
expect(ctrl.$error).toEqual({parserOrValidator: true, validator: true});
ctrl.$setViewValue('stillParseValid-validatorsInvalid');
expect(scope.value).toBeUndefined();
expect(ctrl.$error).toEqual({parserOrValidator: true, validator: true});
ctrl.$validate();
expect(scope.value).toBeUndefined();
expect(ctrl.$error).toEqual({parserOrValidator: true, validator: true});
//Parser is invalid, validators are valid
scope.$apply('value = "parseInvalid-validatorsValid"');
expect(scope.value).toBe('parseInvalid-validatorsValid');
expect(ctrl.$error).toEqual({});
ctrl.$validate();
expect(scope.value).toBe('parseInvalid-validatorsValid');
expect(ctrl.$error).toEqual({});
ctrl.$setViewValue('stillParseInvalid-validatorsValid');
expect(scope.value).toBeUndefined();
expect(ctrl.$error).toEqual({parserOrValidator: true});
ctrl.$validate();
expect(scope.value).toBeUndefined();
expect(ctrl.$error).toEqual({parserOrValidator: true});
});
});
describe('override ModelOptions', function() {
it('should replace the previous model options', function() {
var $options = ctrl.$options;
ctrl.$overrideModelOptions({});
expect(ctrl.$options).not.toBe($options);
});
it('should set the given options', function() {
var $options = ctrl.$options;
ctrl.$overrideModelOptions({ debounce: 1000, updateOn: 'blur' });
expect(ctrl.$options.getOption('debounce')).toEqual(1000);
expect(ctrl.$options.getOption('updateOn')).toEqual('blur');
expect(ctrl.$options.getOption('updateOnDefault')).toBe(false);
});
it('should inherit from a parent model options if specified', inject(function($compile, $rootScope) {
var element = $compile(
'<form name="form" ng-model-options="{debounce: 1000, updateOn: \'blur\'}">' +
' <input ng-model="value" name="input">' +
'</form>')($rootScope);
var ctrl = $rootScope.form.input;
ctrl.$overrideModelOptions({ debounce: 2000, '*': '$inherit' });
expect(ctrl.$options.getOption('debounce')).toEqual(2000);
expect(ctrl.$options.getOption('updateOn')).toEqual('blur');
expect(ctrl.$options.getOption('updateOnDefault')).toBe(false);
dealoc(element);
}));
it('should not inherit from a parent model options if not specified', inject(function($compile, $rootScope) {
var element = $compile(
'<form name="form" ng-model-options="{debounce: 1000, updateOn: \'blur\'}">' +
' <input ng-model="value" name="input">' +
'</form>')($rootScope);
var ctrl = $rootScope.form.input;
ctrl.$overrideModelOptions({ debounce: 2000 });
expect(ctrl.$options.getOption('debounce')).toEqual(2000);
expect(ctrl.$options.getOption('updateOn')).toEqual('');
expect(ctrl.$options.getOption('updateOnDefault')).toBe(true);
dealoc(element);
}));
});
});
describe('CSS classes', function() {
var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
it('should set ng-empty or ng-not-empty when the view value changes',
inject(function($compile, $rootScope, $sniffer) {
var element = $compile('<input ng-model="value" />')($rootScope);
$rootScope.$digest();
expect(element).toBeEmpty();
$rootScope.value = 'XXX';
$rootScope.$digest();
expect(element).toBeNotEmpty();
element.val('');
browserTrigger(element, $sniffer.hasEvent('input') ? 'input' : 'change');
expect(element).toBeEmpty();
element.val('YYY');
browserTrigger(element, $sniffer.hasEvent('input') ? 'input' : 'change');
expect(element).toBeNotEmpty();
}));
it('should set css classes (ng-valid, ng-invalid, ng-pristine, ng-dirty, ng-untouched, ng-touched)',
inject(function($compile, $rootScope, $sniffer) {
var element = $compile('<input type="email" ng-model="value" />')($rootScope);
$rootScope.$digest();
expect(element).toBeValid();
expect(element).toBePristine();
expect(element).toBeUntouched();
expect(element.hasClass('ng-valid-email')).toBe(true);
expect(element.hasClass('ng-invalid-email')).toBe(false);
$rootScope.$apply('value = \'invalid-email\'');
expect(element).toBeInvalid();
expect(element).toBePristine();
expect(element.hasClass('ng-valid-email')).toBe(false);
expect(element.hasClass('ng-invalid-email')).toBe(true);
element.val('invalid-again');
browserTrigger(element, ($sniffer.hasEvent('input')) ? 'input' : 'change');
expect(element).toBeInvalid();
expect(element).toBeDirty();
expect(element.hasClass('ng-valid-email')).toBe(false);
expect(element.hasClass('ng-invalid-email')).toBe(true);
element.val('vojta@google.com');
browserTrigger(element, $sniffer.hasEvent('input') ? 'input' : 'change');
expect(element).toBeValid();
expect(element).toBeDirty();
expect(element.hasClass('ng-valid-email')).toBe(true);
expect(element.hasClass('ng-invalid-email')).toBe(false);
browserTrigger(element, 'blur');
expect(element).toBeTouched();
dealoc(element);
}));
it('should set invalid classes on init', inject(function($compile, $rootScope) {
var element = $compile('<input type="email" ng-model="value" required />')($rootScope);
$rootScope.$digest();
expect(element).toBeInvalid();
expect(element).toHaveClass('ng-invalid-required');
dealoc(element);
}));
});
describe('custom formatter and parser that are added by a directive in post linking', function() {
var inputElm, scope;
beforeEach(module(function($compileProvider) {
$compileProvider.directive('customFormat', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, ngModelCtrl) {
ngModelCtrl.$formatters.push(function(value) {
return value.part;
});
ngModelCtrl.$parsers.push(function(value) {
return {part: value};
});
}
};
});
}));
afterEach(function() {
dealoc(inputElm);
});
function createInput(type) {
inject(function($compile, $rootScope) {
scope = $rootScope;
inputElm = $compile('<input type="' + type + '" ng-model="val" custom-format/>')($rootScope);
});
}
it('should use them after the builtin ones for text inputs', function() {
createInput('text');
scope.$apply('val = {part: "a"}');
expect(inputElm.val()).toBe('a');
inputElm.val('b');
browserTrigger(inputElm, 'change');
expect(scope.val).toEqual({part: 'b'});
});
it('should use them after the builtin ones for number inputs', function() {
createInput('number');
scope.$apply('val = {part: 1}');
expect(inputElm.val()).toBe('1');
inputElm.val('2');
browserTrigger(inputElm, 'change');
expect(scope.val).toEqual({part: 2});
});
it('should use them after the builtin ones for date inputs', function() {
createInput('date');
scope.$apply(function() {
scope.val = {part: new Date(2000, 10, 8)};
});
expect(inputElm.val()).toBe('2000-11-08');
inputElm.val('2001-12-09');
browserTrigger(inputElm, 'change');
expect(scope.val).toEqual({part: new Date(2001, 11, 9)});
});
});
describe('$touched', function() {
it('should set the control touched state on "blur" event', inject(function($compile, $rootScope) {
var element = $compile('<form name="myForm">' +
'<input name="myControl" ng-model="value" >' +
'</form>')($rootScope);
var inputElm = element.find('input');
var control = $rootScope.myForm.myControl;
expect(control.$touched).toBe(false);
expect(control.$untouched).toBe(true);
browserTrigger(inputElm, 'blur');
expect(control.$touched).toBe(true);
expect(control.$untouched).toBe(false);
dealoc(element);
}));
it('should not cause a digest on "blur" event if control is already touched',
inject(function($compile, $rootScope) {
var element = $compile('<form name="myForm">' +
'<input name="myControl" ng-model="value" >' +
'</form>')($rootScope);
var inputElm = element.find('input');
var control = $rootScope.myForm.myControl;
control.$setTouched();
spyOn($rootScope, '$apply');
browserTrigger(inputElm, 'blur');
expect($rootScope.$apply).not.toHaveBeenCalled();
dealoc(element);
}));
it('should digest asynchronously on "blur" event if a apply is already in progress',
inject(function($compile, $rootScope) {
var element = $compile('<form name="myForm">' +
'<input name="myControl" ng-model="value" >' +
'</form>')($rootScope);
var inputElm = element.find('input');
var control = $rootScope.myForm.myControl;
$rootScope.$apply(function() {
expect(control.$touched).toBe(false);
expect(control.$untouched).toBe(true);
browserTrigger(inputElm, 'blur');
expect(control.$touched).toBe(false);
expect(control.$untouched).toBe(true);
});
expect(control.$touched).toBe(true);
expect(control.$untouched).toBe(false);
dealoc(element);
}));
});
describe('nested in a form', function() {
it('should register/deregister a nested ngModel with parent form when entering or leaving DOM',
inject(function($compile, $rootScope) {
var element = $compile('<form name="myForm">' +
'<input ng-if="inputPresent" name="myControl" ng-model="value" required >' +
'</form>')($rootScope);
var isFormValid;
$rootScope.inputPresent = false;
$rootScope.$watch('myForm.$valid', function(value) { isFormValid = value; });
$rootScope.$apply();
expect($rootScope.myForm.$valid).toBe(true);
expect(isFormValid).toBe(true);
expect($rootScope.myForm.myControl).toBeUndefined();
$rootScope.inputPresent = true;
$rootScope.$apply();
expect($rootScope.myForm.$valid).toBe(false);
expect(isFormValid).toBe(false);
expect($rootScope.myForm.myControl).toBeDefined();
$rootScope.inputPresent = false;
$rootScope.$apply();
expect($rootScope.myForm.$valid).toBe(true);
expect(isFormValid).toBe(true);
expect($rootScope.myForm.myControl).toBeUndefined();
dealoc(element);
}));
it('should register/deregister a nested ngModel with parent form when entering or leaving DOM with animations',
function() {
// ngAnimate performs the dom manipulation after digest, and since the form validity can be affected by a form
// control going away we must ensure that the deregistration happens during the digest while we are still doing
// dirty checking.
module('ngAnimate');
inject(function($compile, $rootScope) {
var element = $compile('<form name="myForm">' +
'<input ng-if="inputPresent" name="myControl" ng-model="value" required >' +
'</form>')($rootScope);
var isFormValid;
$rootScope.inputPresent = false;
// this watch ensure that the form validity gets updated during digest (so that we can observe it)
$rootScope.$watch('myForm.$valid', function(value) { isFormValid = value; });
$rootScope.$apply();
expect($rootScope.myForm.$valid).toBe(true);
expect(isFormValid).toBe(true);
expect($rootScope.myForm.myControl).toBeUndefined();
$rootScope.inputPresent = true;
$rootScope.$apply();
expect($rootScope.myForm.$valid).toBe(false);
expect(isFormValid).toBe(false);
expect($rootScope.myForm.myControl).toBeDefined();
$rootScope.inputPresent = false;
$rootScope.$apply();
expect($rootScope.myForm.$valid).toBe(true);
expect(isFormValid).toBe(true);
expect($rootScope.myForm.myControl).toBeUndefined();
dealoc(element);
});
});
it('should keep previously defined watches consistent when changes in validity are made',
inject(function($compile, $rootScope) {
var isFormValid;
$rootScope.$watch('myForm.$valid', function(value) { isFormValid = value; });
var element = $compile('<form name="myForm">' +
'<input name="myControl" ng-model="value" required >' +
'</form>')($rootScope);
$rootScope.$apply();
expect(isFormValid).toBe(false);
expect($rootScope.myForm.$valid).toBe(false);
$rootScope.value = 'value';
$rootScope.$apply();
expect(isFormValid).toBe(true);
expect($rootScope.myForm.$valid).toBe(true);
dealoc(element);
}));
});
describe('animations', function() {
function findElementAnimations(element, queue) {
var node = element[0];
var animations = [];
for (var i = 0; i < queue.length; i++) {
var animation = queue[i];
if (animation.element[0] === node) {
animations.push(animation);
}
}
return animations;
}
function assertValidAnimation(animation, event, classNameA, classNameB) {
expect(animation.event).toBe(event);
expect(animation.args[1]).toBe(classNameA);
if (classNameB) expect(animation.args[2]).toBe(classNameB);
}
var doc, input, scope, model;
beforeEach(module('ngAnimateMock'));
beforeEach(inject(function($rootScope, $compile, $rootElement, $animate) {
scope = $rootScope.$new();
doc = jqLite('<form name="myForm">' +
' <input type="text" ng-model="input" name="myInput" />' +
'</form>');
$rootElement.append(doc);
$compile(doc)(scope);
$animate.queue = [];
input = doc.find('input');
model = scope.myForm.myInput;
}));
afterEach(function() {
dealoc(input);
});
it('should trigger an animation when invalid', inject(function($animate) {
model.$setValidity('required', false);
var animations = findElementAnimations(input, $animate.queue);
assertValidAnimation(animations[0], 'removeClass', 'ng-valid');
assertValidAnimation(animations[1], 'addClass', 'ng-invalid');
assertValidAnimation(animations[2], 'addClass', 'ng-invalid-required');
}));
it('should trigger an animation when valid', inject(function($animate) {
model.$setValidity('required', false);
$animate.queue = [];
model.$setValidity('required', true);
var animations = findElementAnimations(input, $animate.queue);
assertValidAnimation(animations[0], 'addClass', 'ng-valid');
assertValidAnimation(animations[1], 'removeClass', 'ng-invalid');
assertValidAnimation(animations[2], 'addClass', 'ng-valid-required');
assertValidAnimation(animations[3], 'removeClass', 'ng-invalid-required');
}));
it('should trigger an animation when dirty', inject(function($animate) {
model.$setViewValue('some dirty value');
var animations = findElementAnimations(input, $animate.queue);
assertValidAnimation(animations[0], 'removeClass', 'ng-empty');
assertValidAnimation(animations[1], 'addClass', 'ng-not-empty');
assertValidAnimation(animations[2], 'removeClass', 'ng-pristine');
assertValidAnimation(animations[3], 'addClass', 'ng-dirty');
}));
it('should trigger an animation when pristine', inject(function($animate) {
model.$setPristine();
var animations = findElementAnimations(input, $animate.queue);
assertValidAnimation(animations[0], 'removeClass', 'ng-dirty');
assertValidAnimation(animations[1], 'addClass', 'ng-pristine');
}));
it('should trigger an animation when untouched', inject(function($animate) {
model.$setUntouched();
var animations = findElementAnimations(input, $animate.queue);
assertValidAnimation(animations[0], 'setClass', 'ng-untouched');
expect(animations[0].args[2]).toBe('ng-touched');
}));
it('should trigger an animation when touched', inject(function($animate) {
model.$setTouched();
var animations = findElementAnimations(input, $animate.queue);
assertValidAnimation(animations[0], 'setClass', 'ng-touched', 'ng-untouched');
expect(animations[0].args[2]).toBe('ng-untouched');
}));
it('should trigger custom errors as addClass/removeClass when invalid/valid', inject(function($animate) {
model.$setValidity('custom-error', false);
var animations = findElementAnimations(input, $animate.queue);
assertValidAnimation(animations[0], 'removeClass', 'ng-valid');
assertValidAnimation(animations[1], 'addClass', 'ng-invalid');
assertValidAnimation(animations[2], 'addClass', 'ng-invalid-custom-error');
$animate.queue = [];
model.$setValidity('custom-error', true);
animations = findElementAnimations(input, $animate.queue);
assertValidAnimation(animations[0], 'addClass', 'ng-valid');
assertValidAnimation(animations[1], 'removeClass', 'ng-invalid');
assertValidAnimation(animations[2], 'addClass', 'ng-valid-custom-error');
assertValidAnimation(animations[3], 'removeClass', 'ng-invalid-custom-error');
}));
});
});
| mosoft521/angular.js | test/ng/directive/ngModelSpec.js | JavaScript | mit | 60,818 | [
30522,
1005,
2224,
9384,
1005,
1025,
1013,
1008,
3795,
2015,
9699,
2378,
18780,
9006,
22090,
25032,
2884,
4842,
1024,
6270,
1008,
1013,
6235,
1006,
1005,
12835,
5302,
9247,
1005,
1010,
3853,
1006,
1007,
1063,
6235,
1006,
1005,
12835,
5302,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Javascript on Fiber: 成员列表</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="../../logo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Javascript on Fiber
</div>
<div id="projectbrief">基于 Google v8 引擎实现的协程应用开发框架</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'搜索');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="../../index.html"><span>首页</span></a></li>
<li><a href="../../pages.html"><span>教程</span></a></li>
<li><a href="../../namespaces.html"><span>模块</span></a></li>
<li><a href="../../annotated.html"><span>对象</span></a></li>
<li><a href="https://github.com/xicilion/fibjs"><span>下载</span></a></li>
<li><a href="http://named.cn/fibjs"><span>社区</span></a></li>
<li><a href="../../en/index.html"><span>English</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="../../search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="搜索" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d1/d5c/interfaceSslServer.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">SslServer 成员列表</div> </div>
</div><!--header-->
<div class="contents">
<p>成员的完整列表,这些成员属于 <a class="el" href="../../d1/d5c/interfaceSslServer.html">SslServer</a>,包括所有继承而来的类成员</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html#a90e985acd2aaeddff07304e4d4d93c3f">asyncRun</a>()</td><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html">TcpServer</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d1/d5c/interfaceSslServer.html#aa8b252937f34385f025dd7a019b8f9f1">ca</a></td><td class="entry"><a class="el" href="../../d1/d5c/interfaceSslServer.html">SslServer</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../db/d38/interfaceobject.html#a6b88dbc459449d2280338e5b702a68b4">dispose</a>()</td><td class="entry"><a class="el" href="../../db/d38/interfaceobject.html">object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html#a4cc96bf996809c60c59c2e8df5daa653">handler</a></td><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html">TcpServer</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html#a07331365e3d5b0275e00a2f6249a1538">run</a>() async</td><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html">TcpServer</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html#a65ac0b9f39100986818c71192a7a1ef7">socket</a></td><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html">TcpServer</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d1/d5c/interfaceSslServer.html#add3bc709b4b30dc6894afbaeec37703f">SslServer</a>(Array certs, Integer port, Value listener)</td><td class="entry"><a class="el" href="../../d1/d5c/interfaceSslServer.html">SslServer</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d1/d5c/interfaceSslServer.html#a74078f3049c6446198b9cdab87961307">SslServer</a>(Array certs, String addr, Integer port, Value listener)</td><td class="entry"><a class="el" href="../../d1/d5c/interfaceSslServer.html">SslServer</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d1/d5c/interfaceSslServer.html#a66ed2e6f0a79b27c46aaeaef3b701eb5">SslServer</a>(X509Cert crt, PKey key, Integer port, Value listener)</td><td class="entry"><a class="el" href="../../d1/d5c/interfaceSslServer.html">SslServer</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d1/d5c/interfaceSslServer.html#a411f364ef81d954cf3d72456640fbde1">SslServer</a>(X509Cert crt, PKey key, String addr, Integer port, Value listener)</td><td class="entry"><a class="el" href="../../d1/d5c/interfaceSslServer.html">SslServer</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html#ac39165a6d1da69beae4283af1905fe98">stats</a></td><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html">TcpServer</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html#af61a58eaa7b7b6bcc1471713778ec797">stop</a>() async</td><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html">TcpServer</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html#a24820cac0c8a8e4b38fd696156946c33">TcpServer</a>(Integer port, Value listener)</td><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html">TcpServer</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html#afc30a4a16900efa8d275e9f65286f967">TcpServer</a>(String addr, Integer port, Value listener)</td><td class="entry"><a class="el" href="../../d7/d48/interfaceTcpServer.html">TcpServer</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../db/d38/interfaceobject.html#ad66be13eb5b7c5f560fd8511565138c4">toJSON</a>(String key="")</td><td class="entry"><a class="el" href="../../db/d38/interfaceobject.html">object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../db/d38/interfaceobject.html#ac61f07a7d6c5471293371086af3186bd">toString</a>()</td><td class="entry"><a class="el" href="../../db/d38/interfaceobject.html">object</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../db/d38/interfaceobject.html#ab9261a7662bc8bb4a898bc15dc16f206">valueOf</a>()</td><td class="entry"><a class="el" href="../../db/d38/interfaceobject.html">object</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d1/d5c/interfaceSslServer.html#a05763b8ddf655f5bf70986007e9e783b">verification</a></td><td class="entry"><a class="el" href="../../d1/d5c/interfaceSslServer.html">SslServer</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
</div><!-- doc-content -->
<style type="text/css">
body {
color: #666666;
}
a, .contents a:visited {
color: #3399ee;
}
.icona, #nav-sync {
display:none;
}
.directory td.entry, .directory td.desc {
padding: 8px;
}
</style>
</body>
</html> | verdantyang/fibjs_docs | html/d2/de9/interfaceSslServer-members.html | HTML | gpl-3.0 | 9,869 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//// [variadicTuples1.ts]
// Variadics in tuple types
type TV0<T extends unknown[]> = [string, ...T];
type TV1<T extends unknown[]> = [string, ...T, number];
type TV2<T extends unknown[]> = [string, ...T, number, ...T];
type TV3<T extends unknown[]> = [string, ...T, ...number[], ...T];
// Normalization
type TN1 = TV1<[boolean, string]>;
type TN2 = TV1<[]>;
type TN3 = TV1<[boolean?]>;
type TN4 = TV1<string[]>;
type TN5 = TV1<[boolean] | [symbol, symbol]>;
type TN6 = TV1<any>;
type TN7 = TV1<never>;
// Variadics in array literals
function tup2<T extends unknown[], U extends unknown[]>(t: [...T], u: [...U]) {
return [1, ...t, 2, ...u, 3] as const;
}
const t2 = tup2(['hello'], [10, true]);
function concat<T extends unknown[], U extends unknown[]>(t: [...T], u: [...U]): [...T, ...U] {
return [...t, ...u];
}
declare const sa: string[];
const tc1 = concat([], []);
const tc2 = concat(['hello'], [42]);
const tc3 = concat([1, 2, 3], sa);
const tc4 = concat(sa, [1, 2, 3]); // Ideally would be [...string[], number, number, number]
function concat2<T extends readonly unknown[], U extends readonly unknown[]>(t: T, u: U) {
return [...t, ...u]; // (T[number] | U[number])[]
}
const tc5 = concat2([1, 2, 3] as const, [4, 5, 6] as const); // (1 | 2 | 3 | 4 | 5 | 6)[]
// Spread arguments
declare function foo1(a: number, b: string, c: boolean, ...d: number[]): void;
function foo2(t1: [number, string], t2: [boolean], a1: number[]) {
foo1(1, 'abc', true, 42, 43, 44);
foo1(...t1, true, 42, 43, 44);
foo1(...t1, ...t2, 42, 43, 44);
foo1(...t1, ...t2, ...a1);
foo1(...t1); // Error
foo1(...t1, 45); // Error
}
declare function foo3<T extends unknown[]>(x: number, ...args: [...T, number]): T;
function foo4<U extends unknown[]>(u: U) {
foo3(1, 2);
foo3(1, 'hello', true, 2);
foo3(1, ...u, 'hi', 2);
foo3(1);
}
// Contextual typing of array literals
declare function ft1<T extends unknown[]>(t: T): T;
declare function ft2<T extends unknown[]>(t: T): readonly [...T];
declare function ft3<T extends unknown[]>(t: [...T]): T;
declare function ft4<T extends unknown[]>(t: [...T]): readonly [...T];
ft1(['hello', 42]); // (string | number)[]
ft2(['hello', 42]); // readonly (string | number)[]
ft3(['hello', 42]); // [string, number]
ft4(['hello', 42]); // readonly [string, number]
// Indexing variadic tuple types
function f0<T extends unknown[]>(t: [string, ...T], n: number) {
const a = t[0]; // string
const b = t[1]; // [string, ...T][1]
const c = t[2]; // [string, ...T][2]
const d = t[n]; // [string, ...T][number]
}
function f1<T extends unknown[]>(t: [string, ...T, number], n: number) {
const a = t[0]; // string
const b = t[1]; // [string, ...T, number][1]
const c = t[2]; // [string, ...T, number][2]
const d = t[n]; // [string, ...T, number][number]
}
// Destructuring variadic tuple types
function f2<T extends unknown[]>(t: [string, ...T]) {
let [...ax] = t; // [string, ...T]
let [b1, ...bx] = t; // string, [...T]
let [c1, c2, ...cx] = t; // string, [string, ...T][1], T[number][]
}
function f3<T extends unknown[]>(t: [string, ...T, number]) {
let [...ax] = t; // [string, ...T, number]
let [b1, ...bx] = t; // string, [...T, number]
let [c1, c2, ...cx] = t; // string, [string, ...T, number][1], (number | T[number])[]
}
// Mapped types applied to variadic tuple types
type Arrayify<T> = { [P in keyof T]: T[P][] };
type TM1<U extends unknown[]> = Arrayify<readonly [string, number?, ...U, ...boolean[]]>; // [string[], (number | undefined)[]?, Arrayify<U>, ...boolean[][]]
type TP1<T extends unknown[]> = Partial<[string, ...T, number]>; // [string?, Partial<T>, number?]
type TP2<T extends unknown[]> = Partial<[string, ...T, ...number[]]>; // [string?, Partial<T>, ...(number | undefined)[]]
// Reverse mapping through mapped type applied to variadic tuple type
declare function fm1<T extends unknown[]>(t: Arrayify<[string, number, ...T]>): T;
let tm1 = fm1([['abc'], [42], [true], ['def']]); // [boolean, string]
// Spread of readonly array-like infers mutable array-like
declare function fx1<T extends unknown[]>(a: string, ...args: T): T;
function gx1<U extends unknown[], V extends readonly unknown[]>(u: U, v: V) {
fx1('abc'); // []
fx1('abc', ...u); // U
fx1('abc', ...v); // [...V]
fx1<U>('abc', ...u); // U
fx1<V>('abc', ...v); // Error
}
declare function fx2<T extends readonly unknown[]>(a: string, ...args: T): T;
function gx2<U extends unknown[], V extends readonly unknown[]>(u: U, v: V) {
fx2('abc'); // []
fx2('abc', ...u); // U
fx2('abc', ...v); // [...V]
fx2<U>('abc', ...u); // U
fx2<V>('abc', ...v); // V
}
// Relations involving variadic tuple types
function f10<T extends string[], U extends T>(x: [string, ...unknown[]], y: [string, ...T], z: [string, ...U]) {
x = y;
x = z;
y = x; // Error
y = z;
z = x; // Error
z = y; // Error
}
// For a generic type T, [...T] is assignable to T, T is assignable to readonly [...T], and T is assignable
// to [...T] when T is constrained to a mutable array or tuple type.
function f11<T extends unknown[]>(t: T, m: [...T], r: readonly [...T]) {
t = m;
t = r; // Error
m = t;
m = r; // Error
r = t;
r = m;
}
function f12<T extends readonly unknown[]>(t: T, m: [...T], r: readonly [...T]) {
t = m;
t = r; // Error
m = t; // Error
m = r; // Error
r = t;
r = m;
}
function f13<T extends string[], U extends T>(t0: T, t1: [...T], t2: [...U]) {
t0 = t1;
t0 = t2;
t1 = t0;
t1 = t2;
t2 = t0; // Error
t2 = t1; // Error
}
function f14<T extends readonly string[], U extends T>(t0: T, t1: [...T], t2: [...U]) {
t0 = t1;
t0 = t2;
t1 = t0; // Error
t1 = t2;
t2 = t0; // Error
t2 = t1; // Error
}
function f15<T extends string[], U extends T>(k0: keyof T, k1: keyof [...T], k2: keyof [...U], k3: keyof [1, 2, ...T]) {
k0 = 'length';
k1 = 'length';
k2 = 'length';
k0 = 'slice';
k1 = 'slice';
k2 = 'slice';
k3 = '0';
k3 = '1';
k3 = '2'; // Error
}
// Inference between variadic tuple types
type First<T extends readonly unknown[]> =
T extends readonly [unknown, ...unknown[]] ? T[0] :
T[0] | undefined;
type DropFirst<T extends readonly unknown[]> = T extends readonly [unknown?, ...infer U] ? U : [...T];
type Last<T extends readonly unknown[]> =
T extends readonly [...unknown[], infer U] ? U :
T extends readonly [unknown, ...unknown[]] ? T[number] :
T[number] | undefined;
type DropLast<T extends readonly unknown[]> = T extends readonly [...infer U, unknown] ? U : [...T];
type T00 = First<[number, symbol, string]>;
type T01 = First<[symbol, string]>;
type T02 = First<[string]>;
type T03 = First<[number, symbol, ...string[]]>;
type T04 = First<[symbol, ...string[]]>;
type T05 = First<[string?]>;
type T06 = First<string[]>;
type T07 = First<[]>;
type T08 = First<any>;
type T09 = First<never>;
type T10 = DropFirst<[number, symbol, string]>;
type T11 = DropFirst<[symbol, string]>;
type T12 = DropFirst<[string]>;
type T13 = DropFirst<[number, symbol, ...string[]]>;
type T14 = DropFirst<[symbol, ...string[]]>;
type T15 = DropFirst<[string?]>;
type T16 = DropFirst<string[]>;
type T17 = DropFirst<[]>;
type T18 = DropFirst<any>;
type T19 = DropFirst<never>;
type T20 = Last<[number, symbol, string]>;
type T21 = Last<[symbol, string]>;
type T22 = Last<[string]>;
type T23 = Last<[number, symbol, ...string[]]>;
type T24 = Last<[symbol, ...string[]]>;
type T25 = Last<[string?]>;
type T26 = Last<string[]>;
type T27 = Last<[]>;
type T28 = Last<any>;
type T29 = Last<never>;
type T30 = DropLast<[number, symbol, string]>;
type T31 = DropLast<[symbol, string]>;
type T32 = DropLast<[string]>;
type T33 = DropLast<[number, symbol, ...string[]]>;
type T34 = DropLast<[symbol, ...string[]]>;
type T35 = DropLast<[string?]>;
type T36 = DropLast<string[]>;
type T37 = DropLast<[]>; // unknown[], maybe should be []
type T38 = DropLast<any>;
type T39 = DropLast<never>;
type R00 = First<readonly [number, symbol, string]>;
type R01 = First<readonly [symbol, string]>;
type R02 = First<readonly [string]>;
type R03 = First<readonly [number, symbol, ...string[]]>;
type R04 = First<readonly [symbol, ...string[]]>;
type R05 = First<readonly string[]>;
type R06 = First<readonly []>;
type R10 = DropFirst<readonly [number, symbol, string]>;
type R11 = DropFirst<readonly [symbol, string]>;
type R12 = DropFirst<readonly [string]>;
type R13 = DropFirst<readonly [number, symbol, ...string[]]>;
type R14 = DropFirst<readonly [symbol, ...string[]]>;
type R15 = DropFirst<readonly string[]>;
type R16 = DropFirst<readonly []>;
type R20 = Last<readonly [number, symbol, string]>;
type R21 = Last<readonly [symbol, string]>;
type R22 = Last<readonly [string]>;
type R23 = Last<readonly [number, symbol, ...string[]]>;
type R24 = Last<readonly [symbol, ...string[]]>;
type R25 = Last<readonly string[]>;
type R26 = Last<readonly []>;
type R30 = DropLast<readonly [number, symbol, string]>;
type R31 = DropLast<readonly [symbol, string]>;
type R32 = DropLast<readonly [string]>;
type R33 = DropLast<readonly [number, symbol, ...string[]]>;
type R34 = DropLast<readonly [symbol, ...string[]]>;
type R35 = DropLast<readonly string[]>;
type R36 = DropLast<readonly []>;
// Inference to [...T, ...U] with implied arity for T
function curry<T extends unknown[], U extends unknown[], R>(f: (...args: [...T, ...U]) => R, ...a: T) {
return (...b: U) => f(...a, ...b);
}
const fn1 = (a: number, b: string, c: boolean, d: string[]) => 0;
const c0 = curry(fn1); // (a: number, b: string, c: boolean, d: string[]) => number
const c1 = curry(fn1, 1); // (b: string, c: boolean, d: string[]) => number
const c2 = curry(fn1, 1, 'abc'); // (c: boolean, d: string[]) => number
const c3 = curry(fn1, 1, 'abc', true); // (d: string[]) => number
const c4 = curry(fn1, 1, 'abc', true, ['x', 'y']); // () => number
const fn2 = (x: number, b: boolean, ...args: string[]) => 0;
const c10 = curry(fn2); // (x: number, b: boolean, ...args: string[]) => number
const c11 = curry(fn2, 1); // (b: boolean, ...args: string[]) => number
const c12 = curry(fn2, 1, true); // (...args: string[]) => number
const c13 = curry(fn2, 1, true, 'abc', 'def'); // (...args: string[]) => number
const fn3 = (...args: string[]) => 0;
const c20 = curry(fn3); // (...args: string[]) => number
const c21 = curry(fn3, 'abc', 'def'); // (...args: string[]) => number
const c22 = curry(fn3, ...sa); // (...args: string[]) => number
// No inference to [...T, ...U] when there is no implied arity
function curry2<T extends unknown[], U extends unknown[], R>(f: (...args: [...T, ...U]) => R, t: [...T], u: [...U]) {
return f(...t, ...u);
}
declare function fn10(a: string, b: number, c: boolean): string[];
curry2(fn10, ['hello', 42], [true]);
curry2(fn10, ['hello'], [42, true]);
// Inference to [...T] has higher priority than inference to [...T, number?]
declare function ft<T extends unknown[]>(t1: [...T], t2: [...T, number?]): T;
ft([1, 2, 3], [1, 2, 3]);
ft([1, 2], [1, 2, 3]);
ft(['a', 'b'], ['c', 'd'])
ft(['a', 'b'], ['c', 'd', 42])
// Last argument is contextually typed
declare function call<T extends unknown[], R>(...args: [...T, (...args: T) => R]): [T, R];
call('hello', 32, (a, b) => 42);
call(...sa, (...x) => 42);
// No inference to ending optional elements (except with identical structure)
declare function f20<T extends unknown[] = []>(args: [...T, number?]): T;
function f21<U extends string[]>(args: [...U, number?]) {
let v1 = f20(args); // U
let v2 = f20(["foo", "bar"]); // [string]
let v3 = f20(["foo", 42]); // [string]
}
declare function f22<T extends unknown[] = []>(args: [...T, number]): T;
declare function f22<T extends unknown[] = []>(args: [...T]): T;
function f23<U extends string[]>(args: [...U, number]) {
let v1 = f22(args); // U
let v2 = f22(["foo", "bar"]); // [string, string]
let v3 = f22(["foo", 42]); // [string]
}
// Repro from #39327
interface Desc<A extends unknown[], T> {
readonly f: (...args: A) => T;
bind<T extends unknown[], U extends unknown[], R>(this: Desc<[...T, ...U], R>, ...args: T): Desc<[...U], R>;
}
declare const a: Desc<[string, number, boolean], object>;
const b = a.bind("", 1); // Desc<[boolean], object>
// Repro from #39607
declare function getUser(id: string, options?: { x?: string }): string;
declare function getOrgUser(id: string, orgId: number, options?: { y?: number, z?: boolean }): void;
function callApi<T extends unknown[] = [], U = void>(method: (...args: [...T, object]) => U) {
return (...args: [...T]) => method(...args, {});
}
callApi(getUser);
callApi(getOrgUser);
// Repro from #40235
type Numbers = number[];
type Unbounded = [...Numbers, boolean];
const data: Unbounded = [false, false]; // Error
type U1 = [string, ...Numbers, boolean];
type U2 = [...[string, ...Numbers], boolean];
type U3 = [...[string, number], boolean];
//// [variadicTuples1.js]
"use strict";
// Variadics in tuple types
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
// Variadics in array literals
function tup2(t, u) {
return __spreadArray(__spreadArray(__spreadArray(__spreadArray([1], t, true), [2], false), u, true), [3], false);
}
var t2 = tup2(['hello'], [10, true]);
function concat(t, u) {
return __spreadArray(__spreadArray([], t, true), u, true);
}
var tc1 = concat([], []);
var tc2 = concat(['hello'], [42]);
var tc3 = concat([1, 2, 3], sa);
var tc4 = concat(sa, [1, 2, 3]); // Ideally would be [...string[], number, number, number]
function concat2(t, u) {
return __spreadArray(__spreadArray([], t, true), u, true); // (T[number] | U[number])[]
}
var tc5 = concat2([1, 2, 3], [4, 5, 6]); // (1 | 2 | 3 | 4 | 5 | 6)[]
function foo2(t1, t2, a1) {
foo1(1, 'abc', true, 42, 43, 44);
foo1.apply(void 0, __spreadArray(__spreadArray([], t1, false), [true, 42, 43, 44], false));
foo1.apply(void 0, __spreadArray(__spreadArray(__spreadArray([], t1, false), t2, false), [42, 43, 44], false));
foo1.apply(void 0, __spreadArray(__spreadArray(__spreadArray([], t1, false), t2, false), a1, false));
foo1.apply(void 0, t1); // Error
foo1.apply(void 0, __spreadArray(__spreadArray([], t1, false), [45], false)); // Error
}
function foo4(u) {
foo3(1, 2);
foo3(1, 'hello', true, 2);
foo3.apply(void 0, __spreadArray(__spreadArray([1], u, false), ['hi', 2], false));
foo3(1);
}
ft1(['hello', 42]); // (string | number)[]
ft2(['hello', 42]); // readonly (string | number)[]
ft3(['hello', 42]); // [string, number]
ft4(['hello', 42]); // readonly [string, number]
// Indexing variadic tuple types
function f0(t, n) {
var a = t[0]; // string
var b = t[1]; // [string, ...T][1]
var c = t[2]; // [string, ...T][2]
var d = t[n]; // [string, ...T][number]
}
function f1(t, n) {
var a = t[0]; // string
var b = t[1]; // [string, ...T, number][1]
var c = t[2]; // [string, ...T, number][2]
var d = t[n]; // [string, ...T, number][number]
}
// Destructuring variadic tuple types
function f2(t) {
var ax = t.slice(0); // [string, ...T]
var b1 = t[0], bx = t.slice(1); // string, [...T]
var c1 = t[0], c2 = t[1], cx = t.slice(2); // string, [string, ...T][1], T[number][]
}
function f3(t) {
var ax = t.slice(0); // [string, ...T, number]
var b1 = t[0], bx = t.slice(1); // string, [...T, number]
var c1 = t[0], c2 = t[1], cx = t.slice(2); // string, [string, ...T, number][1], (number | T[number])[]
}
var tm1 = fm1([['abc'], [42], [true], ['def']]); // [boolean, string]
function gx1(u, v) {
fx1('abc'); // []
fx1.apply(void 0, __spreadArray(['abc'], u, false)); // U
fx1.apply(void 0, __spreadArray(['abc'], v, false)); // [...V]
fx1.apply(void 0, __spreadArray(['abc'], u, false)); // U
fx1.apply(void 0, __spreadArray(['abc'], v, false)); // Error
}
function gx2(u, v) {
fx2('abc'); // []
fx2.apply(void 0, __spreadArray(['abc'], u, false)); // U
fx2.apply(void 0, __spreadArray(['abc'], v, false)); // [...V]
fx2.apply(void 0, __spreadArray(['abc'], u, false)); // U
fx2.apply(void 0, __spreadArray(['abc'], v, false)); // V
}
// Relations involving variadic tuple types
function f10(x, y, z) {
x = y;
x = z;
y = x; // Error
y = z;
z = x; // Error
z = y; // Error
}
// For a generic type T, [...T] is assignable to T, T is assignable to readonly [...T], and T is assignable
// to [...T] when T is constrained to a mutable array or tuple type.
function f11(t, m, r) {
t = m;
t = r; // Error
m = t;
m = r; // Error
r = t;
r = m;
}
function f12(t, m, r) {
t = m;
t = r; // Error
m = t; // Error
m = r; // Error
r = t;
r = m;
}
function f13(t0, t1, t2) {
t0 = t1;
t0 = t2;
t1 = t0;
t1 = t2;
t2 = t0; // Error
t2 = t1; // Error
}
function f14(t0, t1, t2) {
t0 = t1;
t0 = t2;
t1 = t0; // Error
t1 = t2;
t2 = t0; // Error
t2 = t1; // Error
}
function f15(k0, k1, k2, k3) {
k0 = 'length';
k1 = 'length';
k2 = 'length';
k0 = 'slice';
k1 = 'slice';
k2 = 'slice';
k3 = '0';
k3 = '1';
k3 = '2'; // Error
}
// Inference to [...T, ...U] with implied arity for T
function curry(f) {
var a = [];
for (var _i = 1; _i < arguments.length; _i++) {
a[_i - 1] = arguments[_i];
}
return function () {
var b = [];
for (var _i = 0; _i < arguments.length; _i++) {
b[_i] = arguments[_i];
}
return f.apply(void 0, __spreadArray(__spreadArray([], a, false), b, false));
};
}
var fn1 = function (a, b, c, d) { return 0; };
var c0 = curry(fn1); // (a: number, b: string, c: boolean, d: string[]) => number
var c1 = curry(fn1, 1); // (b: string, c: boolean, d: string[]) => number
var c2 = curry(fn1, 1, 'abc'); // (c: boolean, d: string[]) => number
var c3 = curry(fn1, 1, 'abc', true); // (d: string[]) => number
var c4 = curry(fn1, 1, 'abc', true, ['x', 'y']); // () => number
var fn2 = function (x, b) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
return 0;
};
var c10 = curry(fn2); // (x: number, b: boolean, ...args: string[]) => number
var c11 = curry(fn2, 1); // (b: boolean, ...args: string[]) => number
var c12 = curry(fn2, 1, true); // (...args: string[]) => number
var c13 = curry(fn2, 1, true, 'abc', 'def'); // (...args: string[]) => number
var fn3 = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return 0;
};
var c20 = curry(fn3); // (...args: string[]) => number
var c21 = curry(fn3, 'abc', 'def'); // (...args: string[]) => number
var c22 = curry.apply(void 0, __spreadArray([fn3], sa, false)); // (...args: string[]) => number
// No inference to [...T, ...U] when there is no implied arity
function curry2(f, t, u) {
return f.apply(void 0, __spreadArray(__spreadArray([], t, false), u, false));
}
curry2(fn10, ['hello', 42], [true]);
curry2(fn10, ['hello'], [42, true]);
ft([1, 2, 3], [1, 2, 3]);
ft([1, 2], [1, 2, 3]);
ft(['a', 'b'], ['c', 'd']);
ft(['a', 'b'], ['c', 'd', 42]);
call('hello', 32, function (a, b) { return 42; });
call.apply(void 0, __spreadArray(__spreadArray([], sa, false), [function () {
var x = [];
for (var _i = 0; _i < arguments.length; _i++) {
x[_i] = arguments[_i];
}
return 42;
}], false));
function f21(args) {
var v1 = f20(args); // U
var v2 = f20(["foo", "bar"]); // [string]
var v3 = f20(["foo", 42]); // [string]
}
function f23(args) {
var v1 = f22(args); // U
var v2 = f22(["foo", "bar"]); // [string, string]
var v3 = f22(["foo", 42]); // [string]
}
var b = a.bind("", 1); // Desc<[boolean], object>
function callApi(method) {
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return method.apply(void 0, __spreadArray(__spreadArray([], args, false), [{}], false));
};
}
callApi(getUser);
callApi(getOrgUser);
var data = [false, false]; // Error
//// [variadicTuples1.d.ts]
declare type TV0<T extends unknown[]> = [string, ...T];
declare type TV1<T extends unknown[]> = [string, ...T, number];
declare type TV2<T extends unknown[]> = [string, ...T, number, ...T];
declare type TV3<T extends unknown[]> = [string, ...T, ...number[], ...T];
declare type TN1 = TV1<[boolean, string]>;
declare type TN2 = TV1<[]>;
declare type TN3 = TV1<[boolean?]>;
declare type TN4 = TV1<string[]>;
declare type TN5 = TV1<[boolean] | [symbol, symbol]>;
declare type TN6 = TV1<any>;
declare type TN7 = TV1<never>;
declare function tup2<T extends unknown[], U extends unknown[]>(t: [...T], u: [...U]): readonly [1, ...T, 2, ...U, 3];
declare const t2: readonly [1, string, 2, number, boolean, 3];
declare function concat<T extends unknown[], U extends unknown[]>(t: [...T], u: [...U]): [...T, ...U];
declare const sa: string[];
declare const tc1: [];
declare const tc2: [string, number];
declare const tc3: [number, number, number, ...string[]];
declare const tc4: [...string[], number, number, number];
declare function concat2<T extends readonly unknown[], U extends readonly unknown[]>(t: T, u: U): (T[number] | U[number])[];
declare const tc5: (2 | 4 | 1 | 3 | 6 | 5)[];
declare function foo1(a: number, b: string, c: boolean, ...d: number[]): void;
declare function foo2(t1: [number, string], t2: [boolean], a1: number[]): void;
declare function foo3<T extends unknown[]>(x: number, ...args: [...T, number]): T;
declare function foo4<U extends unknown[]>(u: U): void;
declare function ft1<T extends unknown[]>(t: T): T;
declare function ft2<T extends unknown[]>(t: T): readonly [...T];
declare function ft3<T extends unknown[]>(t: [...T]): T;
declare function ft4<T extends unknown[]>(t: [...T]): readonly [...T];
declare function f0<T extends unknown[]>(t: [string, ...T], n: number): void;
declare function f1<T extends unknown[]>(t: [string, ...T, number], n: number): void;
declare function f2<T extends unknown[]>(t: [string, ...T]): void;
declare function f3<T extends unknown[]>(t: [string, ...T, number]): void;
declare type Arrayify<T> = {
[P in keyof T]: T[P][];
};
declare type TM1<U extends unknown[]> = Arrayify<readonly [string, number?, ...U, ...boolean[]]>;
declare type TP1<T extends unknown[]> = Partial<[string, ...T, number]>;
declare type TP2<T extends unknown[]> = Partial<[string, ...T, ...number[]]>;
declare function fm1<T extends unknown[]>(t: Arrayify<[string, number, ...T]>): T;
declare let tm1: [boolean, string];
declare function fx1<T extends unknown[]>(a: string, ...args: T): T;
declare function gx1<U extends unknown[], V extends readonly unknown[]>(u: U, v: V): void;
declare function fx2<T extends readonly unknown[]>(a: string, ...args: T): T;
declare function gx2<U extends unknown[], V extends readonly unknown[]>(u: U, v: V): void;
declare function f10<T extends string[], U extends T>(x: [string, ...unknown[]], y: [string, ...T], z: [string, ...U]): void;
declare function f11<T extends unknown[]>(t: T, m: [...T], r: readonly [...T]): void;
declare function f12<T extends readonly unknown[]>(t: T, m: [...T], r: readonly [...T]): void;
declare function f13<T extends string[], U extends T>(t0: T, t1: [...T], t2: [...U]): void;
declare function f14<T extends readonly string[], U extends T>(t0: T, t1: [...T], t2: [...U]): void;
declare function f15<T extends string[], U extends T>(k0: keyof T, k1: keyof [...T], k2: keyof [...U], k3: keyof [1, 2, ...T]): void;
declare type First<T extends readonly unknown[]> = T extends readonly [unknown, ...unknown[]] ? T[0] : T[0] | undefined;
declare type DropFirst<T extends readonly unknown[]> = T extends readonly [unknown?, ...infer U] ? U : [...T];
declare type Last<T extends readonly unknown[]> = T extends readonly [...unknown[], infer U] ? U : T extends readonly [unknown, ...unknown[]] ? T[number] : T[number] | undefined;
declare type DropLast<T extends readonly unknown[]> = T extends readonly [...infer U, unknown] ? U : [...T];
declare type T00 = First<[number, symbol, string]>;
declare type T01 = First<[symbol, string]>;
declare type T02 = First<[string]>;
declare type T03 = First<[number, symbol, ...string[]]>;
declare type T04 = First<[symbol, ...string[]]>;
declare type T05 = First<[string?]>;
declare type T06 = First<string[]>;
declare type T07 = First<[]>;
declare type T08 = First<any>;
declare type T09 = First<never>;
declare type T10 = DropFirst<[number, symbol, string]>;
declare type T11 = DropFirst<[symbol, string]>;
declare type T12 = DropFirst<[string]>;
declare type T13 = DropFirst<[number, symbol, ...string[]]>;
declare type T14 = DropFirst<[symbol, ...string[]]>;
declare type T15 = DropFirst<[string?]>;
declare type T16 = DropFirst<string[]>;
declare type T17 = DropFirst<[]>;
declare type T18 = DropFirst<any>;
declare type T19 = DropFirst<never>;
declare type T20 = Last<[number, symbol, string]>;
declare type T21 = Last<[symbol, string]>;
declare type T22 = Last<[string]>;
declare type T23 = Last<[number, symbol, ...string[]]>;
declare type T24 = Last<[symbol, ...string[]]>;
declare type T25 = Last<[string?]>;
declare type T26 = Last<string[]>;
declare type T27 = Last<[]>;
declare type T28 = Last<any>;
declare type T29 = Last<never>;
declare type T30 = DropLast<[number, symbol, string]>;
declare type T31 = DropLast<[symbol, string]>;
declare type T32 = DropLast<[string]>;
declare type T33 = DropLast<[number, symbol, ...string[]]>;
declare type T34 = DropLast<[symbol, ...string[]]>;
declare type T35 = DropLast<[string?]>;
declare type T36 = DropLast<string[]>;
declare type T37 = DropLast<[]>;
declare type T38 = DropLast<any>;
declare type T39 = DropLast<never>;
declare type R00 = First<readonly [number, symbol, string]>;
declare type R01 = First<readonly [symbol, string]>;
declare type R02 = First<readonly [string]>;
declare type R03 = First<readonly [number, symbol, ...string[]]>;
declare type R04 = First<readonly [symbol, ...string[]]>;
declare type R05 = First<readonly string[]>;
declare type R06 = First<readonly []>;
declare type R10 = DropFirst<readonly [number, symbol, string]>;
declare type R11 = DropFirst<readonly [symbol, string]>;
declare type R12 = DropFirst<readonly [string]>;
declare type R13 = DropFirst<readonly [number, symbol, ...string[]]>;
declare type R14 = DropFirst<readonly [symbol, ...string[]]>;
declare type R15 = DropFirst<readonly string[]>;
declare type R16 = DropFirst<readonly []>;
declare type R20 = Last<readonly [number, symbol, string]>;
declare type R21 = Last<readonly [symbol, string]>;
declare type R22 = Last<readonly [string]>;
declare type R23 = Last<readonly [number, symbol, ...string[]]>;
declare type R24 = Last<readonly [symbol, ...string[]]>;
declare type R25 = Last<readonly string[]>;
declare type R26 = Last<readonly []>;
declare type R30 = DropLast<readonly [number, symbol, string]>;
declare type R31 = DropLast<readonly [symbol, string]>;
declare type R32 = DropLast<readonly [string]>;
declare type R33 = DropLast<readonly [number, symbol, ...string[]]>;
declare type R34 = DropLast<readonly [symbol, ...string[]]>;
declare type R35 = DropLast<readonly string[]>;
declare type R36 = DropLast<readonly []>;
declare function curry<T extends unknown[], U extends unknown[], R>(f: (...args: [...T, ...U]) => R, ...a: T): (...b: U) => R;
declare const fn1: (a: number, b: string, c: boolean, d: string[]) => number;
declare const c0: (a: number, b: string, c: boolean, d: string[]) => number;
declare const c1: (b: string, c: boolean, d: string[]) => number;
declare const c2: (c: boolean, d: string[]) => number;
declare const c3: (d: string[]) => number;
declare const c4: () => number;
declare const fn2: (x: number, b: boolean, ...args: string[]) => number;
declare const c10: (x: number, b: boolean, ...args: string[]) => number;
declare const c11: (b: boolean, ...args: string[]) => number;
declare const c12: (...b: string[]) => number;
declare const c13: (...b: string[]) => number;
declare const fn3: (...args: string[]) => number;
declare const c20: (...b: string[]) => number;
declare const c21: (...b: string[]) => number;
declare const c22: (...b: string[]) => number;
declare function curry2<T extends unknown[], U extends unknown[], R>(f: (...args: [...T, ...U]) => R, t: [...T], u: [...U]): R;
declare function fn10(a: string, b: number, c: boolean): string[];
declare function ft<T extends unknown[]>(t1: [...T], t2: [...T, number?]): T;
declare function call<T extends unknown[], R>(...args: [...T, (...args: T) => R]): [T, R];
declare function f20<T extends unknown[] = []>(args: [...T, number?]): T;
declare function f21<U extends string[]>(args: [...U, number?]): void;
declare function f22<T extends unknown[] = []>(args: [...T, number]): T;
declare function f22<T extends unknown[] = []>(args: [...T]): T;
declare function f23<U extends string[]>(args: [...U, number]): void;
interface Desc<A extends unknown[], T> {
readonly f: (...args: A) => T;
bind<T extends unknown[], U extends unknown[], R>(this: Desc<[...T, ...U], R>, ...args: T): Desc<[...U], R>;
}
declare const a: Desc<[string, number, boolean], object>;
declare const b: Desc<[boolean], object>;
declare function getUser(id: string, options?: {
x?: string;
}): string;
declare function getOrgUser(id: string, orgId: number, options?: {
y?: number;
z?: boolean;
}): void;
declare function callApi<T extends unknown[] = [], U = void>(method: (...args: [...T, object]) => U): (...args_0: T) => U;
declare type Numbers = number[];
declare type Unbounded = [...Numbers, boolean];
declare const data: Unbounded;
declare type U1 = [string, ...Numbers, boolean];
declare type U2 = [...[string, ...Numbers], boolean];
declare type U3 = [...[string, number], boolean];
| Microsoft/TypeScript | tests/baselines/reference/variadicTuples1.js | JavaScript | apache-2.0 | 30,820 | [
30522,
1013,
1013,
1013,
1013,
1031,
13075,
28665,
2594,
8525,
21112,
2487,
1012,
24529,
1033,
1013,
1013,
13075,
28665,
6558,
1999,
10722,
10814,
4127,
2828,
2694,
2692,
1026,
1056,
8908,
4242,
1031,
1033,
1028,
1027,
1031,
5164,
1010,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
(function() {
function config($stateProvider, $locationProvider) {
$locationProvider
.html5Mode({
enabled: true,
requireBase: false
});
$stateProvider
.state('landing', {
url: '/',
controller: 'LandingCtrl as landing',
templateUrl: '/templates/landing.html'
})
.state('album', {
url: '/album',
controller: 'AlbumCtrl as album',
templateUrl: '/templates/album.html'
})
.state('collection', {
url: '/collection',
controller: 'CollectionCtrl as collection',
templateUrl: '/templates/collection.html'
});
}
angular
.module('blocJams', ['ui.router'])
.config(config);
})();
| steefnee/bloc-jams-angular | dist/scripts/app.js | JavaScript | apache-2.0 | 764 | [
30522,
1006,
3853,
1006,
1007,
1063,
3853,
9530,
8873,
2290,
1006,
1002,
2110,
21572,
17258,
2121,
1010,
1002,
3295,
21572,
17258,
2121,
1007,
1063,
1002,
3295,
21572,
17258,
2121,
1012,
16129,
2629,
5302,
3207,
1006,
1063,
9124,
1024,
2995... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{{{
"title": "Getting Started with GitLab - Blueprint",
"date": "05-14-2015",
"author": "<a href='https://twitter.com/KeithResar'>@KeithResar</a>",
"attachments": [],
"contentIsHTML": false
}}}
### Description
<img alt="GitLab Logo" src="/knowledge-base/images/bitnami_logos/gitlab-stack-110x117-6ab77fbd4c6d3b0453a520ece95300ca.png" style="border:0;float:right;max-width:250px">
After reading this article, the reader should feel comfortable deploying the GitLab stack (version 7.10.1-0) by Bitnami.
<a href="https://bitnami.com/" rel="no-follow">Bitnami</a> has integrated their <a href="https://bitnami.com/stack/gitlab" rel="no-follow">GitLab stack</a> with the CenturyLink Cloud platform with a single-click deploy solution. The purpose of this KB article is to help the reader take advantage of this integration to achieve rapid time-to-value for this GitLab solution.
The GitLab open source edition is a developer tool that allows users to collaborate on code, create new projects, manage repositories, and perform code reviews. When using GitLab, users can keep their code on their own servers, either in the cloud or on-premise. For additional peace of mind, the free community edition even features enterprise-grade features such as a mature user permissions scheme and support for high availability. This GitLab stack is bundled with GitLab CI, a continuous integration server. Just point your projects at the CI server and automate all your tests.
### Audience
CenturyLink Cloud Users
### Deploying GitLab on a New Server
GitLab is available as a Blueprint for deployment on a **new server**.
#### Steps
1. **Locate the Blueprint in the Blueprint Library**
Starting from the CenturyLink Control Panel, navigate to the Blueprints Library. Search for **GitLab on Linux** in the keyword search on the right side of the page.
2. **Click the Deploy Blueprint button.**
3. **Set Required parameters.**
Set the following parameters in addition to those associated with your server itself (password, network, group, etc.):
* **Apache server SSL port** - default 443
* **Redis port** - Redis Server port default 6379
* **Apache server port** - default 80
* **Service Password** - Provide service password 6 chars or more
* **User's name** - Users Name
5. **Review and Confirm the Blueprint**
6. **Deploy the Blueprint**
Once verified, click on the `deploy blueprint` button. You will see the deployment details stating the Blueprint is queued for execution.
This will kick off the Blueprint deploy process and load a page where you can track the deployment progress. Deployment will typically complete within five minutes.
7. **Deployment Complete**
Once the Blueprint has finished executing on your server you may access GitLab by navigating to your server via http.
8. **Enable public access** (optional)
Servers are built using private IPs only with access with client or IPSEC VPN. For inbound access from the Internet add a public IP to your master server.
<a href="../../Network/how-to-add-public-ip-to-virtual-machine.md">
<img style="border:0;width:50px;vertical-align:middle;" src="../../images/shared_assets/fw_icon.png">
Adding a public IP to your virtual machine
</a>
### Deploying GitLab on an existing server (alternate option)
GitLab is available as a Blueprint Package for deployment on an existing server based on your own sizing requirements or to support more advanced configurations such as customized Blueprint Workflows to repeatably deploy multiple stacks on the same machines
#### Steps
1. **Deploy or Identify an Existing Server**
Identify the server targeted for GitLab installation. Operating sustem must be linux.
See the [Creating a new enterprise cloud server](../../Servers/creating-a-new-enterprise-cloud-server.md) KB for more information on completing this step.
2. **Select to Execute the Package on a Server Group**
Packages can be executed on one more more servers in a group. Search for the public script package named **Install GitLab on Linux**.
See the [using group tasks to install scripts on groups](../../Servers/using-group-tasks-to-install-software-and-run-scripts-on-groups.md) KB for more information on how to complete the next few steps.
3. **Set Parameters**
Set the following parameters:
* **Apache server SSL port** - default 443
* **Redis port** - Redis Server port default 6379
* **Apache server port** - default 80
* **Service Password** - Provide service password 6 chars or more
* **User's name** - Users Name
4. **Deploy the Blueprint**
Once verified, click on the `execute package` button. You will see the deployment details stating the Blueprint is queued for execution.
This will kick off the Blueprint deploy process and load a page where you can track the deployment progress. Deployment will typically complete within five minutes.
5. **Deployment Complete**
Once the Blueprint has finished executing on your server you may access GitLab by navigating to your server via http.
6. **Enable public access** (optional)
Servers are built using private IPs only with access with client or IPSEC VPN. For inbound access from the Internet add a public IP to your master server.
<a href="../../Network/how-to-add-public-ip-to-virtual-machine.md">
<img style="border:0;width:50px;vertical-align:middle;" src="../../images/shared_assets/fw_icon.png">
Adding a public IP to your virtual machine
</a>
### Pricing
The costs listed above in the above steps are for the infrastructure only.
### About Bitnami
CenturyLink Cloud works with [Bitnami](http://www.bitnami.com) to provide open source software integrations to its customers. Bitnami is a library of popular server applications and development environments that can be installed with one click, either in your laptop, in a virtual machine or hosted in the cloud. Bitnami takes care of compiling and configuring the applications and all of their dependencies (third-party libraries, language runtimes, databases) so they work out-of-the-box. The resulting packaged software (a 'stack') is then made available as native installers, virtual machines and cloud images. These Bitnami application packages provide a consistent, secure and optimized end-user experience when deploying any app, on any platform.
### Frequently Asked Questions
**Who should I contact for support?**
* For issues related to cloud infrastructure, please open a ticket using the [CenturyLink Cloud Support Process](../../Support/how-do-i-report-a-support-issue.md).
* For issues related to deploying the Bitnami Blueprint on CenturyLink Cloud, Licensing or Accessing the deployed software, please visit the [Bitnami Support website](http://www.bitnami.com/support)
**How do I access GitLab for the first time?**
Nearly all Bitnami stacks can be accessed and configured by navigating to your server with a web browser.
| kjmd75/PublicKB | Ecosystem Partners/Marketplace Guides/getting-started-with-gitlab-blueprint.md | Markdown | apache-2.0 | 6,972 | [
30522,
1063,
1063,
1063,
1000,
2516,
1000,
1024,
1000,
2893,
2318,
2007,
21025,
19646,
7875,
1011,
2630,
16550,
1000,
1010,
1000,
3058,
1000,
1024,
1000,
5709,
1011,
2403,
1011,
2325,
1000,
1010,
1000,
3166,
1000,
1024,
1000,
1026,
1037,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require_relative '../../spec_helper'
require_relative 'shared/then'
describe "Kernel#yield_self" do
it_behaves_like :kernel_then, :yield_self
end
| eregon/rubyspec | core/kernel/yield_self_spec.rb | Ruby | mit | 149 | [
30522,
5478,
1035,
5816,
1005,
1012,
1012,
1013,
1012,
1012,
1013,
28699,
1035,
2393,
2121,
1005,
5478,
1035,
5816,
1005,
4207,
1013,
2059,
1005,
6235,
1000,
16293,
1001,
10750,
1035,
2969,
1000,
2079,
2009,
1035,
16582,
2015,
1035,
2066,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require 'spec_helper'
describe Listen::TCP::Broadcaster do
let(:host) { '10.0.0.2' }
let(:port) { 4000 }
subject { described_class.new(host, port) }
let(:server) { double(described_class::TCPServer, close: true, accept: nil) }
let(:socket) { double(described_class::TCPSocket, write: true) }
let(:payload) { Listen::TCP::Message.new.payload }
before do
expect(described_class::TCPServer).to receive(:new).with(host, port).and_return server
end
after do
subject.terminate
end
describe '#initialize' do
it 'initializes and exposes a server' do
expect(subject.server).to be server
end
it 'initializes and exposes a list of sockets' do
expect(subject.sockets).to eq []
end
end
describe '#start' do
let(:async) { double('TCP-listener async') }
it 'invokes run loop asynchronously' do
subject.stub(:async).and_return async
expect(async).to receive(:run)
subject.start
end
end
describe '#finalize' do
it 'clears sockets' do
expect(subject.sockets).to receive(:clear)
subject.finalize
end
it 'closes server' do
expect(subject.server).to receive(:close)
subject.finalize
expect(subject.server).to be_nil
end
end
describe '#broadcast' do
it 'unicasts to connected sockets' do
subject.handle_connection socket
expect(subject.wrapped_object).to receive(:unicast).with socket, payload
subject.broadcast payload
end
end
describe '#unicast' do
before do
subject.handle_connection socket
end
context 'when succesful' do
it 'returns true and leaves socket untouched' do
expect(subject.unicast(socket, payload)).to be_true
expect(subject.sockets).to include socket
end
end
context 'on IO errors' do
it 'returns false and removes socket from list' do
socket.stub(:write).and_raise IOError
expect(subject.unicast(socket, payload)).to be_false
expect(subject.sockets).not_to include socket
end
end
context 'on connection reset by peer' do
it 'returns false and removes socket from list' do
socket.stub(:write).and_raise Errno::ECONNRESET
expect(subject.unicast(socket, payload)).to be_false
expect(subject.sockets).not_to include socket
end
end
context 'on broken pipe' do
it 'returns false and removes socket from list' do
socket.stub(:write).and_raise Errno::EPIPE
expect(subject.unicast(socket, payload)).to be_false
expect(subject.sockets).not_to include socket
end
end
end
describe '#run' do
it 'handles incoming connections' do
server.stub(:accept).and_return socket, nil
expect(subject.wrapped_object).to receive(:handle_connection).with socket
subject.run
end
end
describe '#handle_connection' do
it 'adds socket to list' do
subject.handle_connection socket
expect(subject.sockets).to include socket
end
end
end
| bradholbrook/rJackal | vendor/bundle/ruby/1.9.1/gems/listen-2.7.1/spec/lib/listen/tcp/broadcaster_spec.rb | Ruby | mit | 3,035 | [
30522,
5478,
1005,
28699,
1035,
2393,
2121,
1005,
6235,
4952,
1024,
1024,
22975,
2361,
1024,
1024,
11995,
2079,
2292,
1006,
1024,
3677,
1007,
1063,
1005,
2184,
1012,
1014,
1012,
1014,
1012,
1016,
1005,
1065,
2292,
1006,
1024,
3417,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/**
* @copyright (C) 2007 by Slashes & Dots Sdn Bhd - All rights reserved!
* @license http://www.azrul.com Copyrighted Commercial Software
*
* Rem:
* This file is to perform the execution of displaying comments from a specific user.
**/
global $_JC_CONFIG, $mainframe;
$cms =& cmsInstance('CMSCore');
$cms->load('libraries', 'user');
// Only valid user should have access
if(!$cms->user->id){
echo 'Access to this location is not allowed.';
return;
}
include_once($cms->get_path('plugins') . '/system/pc_includes/template.php');
$template = new AzrulJXTemplate();
// Load the trunchtml library
$cms->load('libraries', 'trunchtml');
// Load helper functions
$cms->load('helper', 'url');
$limitstart = cmsGetVar('cpage', '', 'GET');
$limit = $limitstart ? "LIMIT $limitstart, " . JC_DEFAULT_LIMIT : 'LIMIT ' . JC_DEFAULT_LIMIT;
// SQL Queries
$strSQL = "SELECT * FROM #__jomcomment_subs WHERE userid='{$cms->user->id}' "
. "ORDER BY `id` "
. "DESC {$limit}";
// Execute SQL Query & grab data
$cms->db->query($strSQL);
$subscriptions = $cms->db->get_object_list();
for($i = 0; $i < count($subscriptions); $i++){
$row =& $subscriptions[$i];
if($row->status == '1'){
// Enabled subscriptions we display a disable link
$row->subStatus = '<a href="javascript:void(0);" onclick="jax.call(\'jomcomment\',\'jcxDisableSubscription\',\'' . $row->id . '\');">'
. 'Disable</a>';
} else{
// Disabled subscriptions we display a enable link
$row->subStatus = '<a href="javascript:void(0);" onclick="jax.call(\'jomcomment\',\'jcxEnableSubscription\',\'' . $row->id . '\');">'
. 'Enable</a>';
}
if($row->option == 'com_content'){
$row->ItemId = $mainframe->getItemid($row->contentid);
$row->task = 'task=view';
}else if($row->option == 'com_myblog'){
$strSQL = "SELECT `permalink` FROM #__myblog_permalinks WHERE `contentid`='{$row->contentid}'";
$cms->db->query($strSQL);
$row->ItemId = jcGetMyBlogItemid();
$row->task = 'show=' . $cms->db->get_value();
}else {
$row->task = 'task=view';
}
if($row->option == 'com_content' || $row->option == 'com_myblog')
$row->title = jcContentTitle($row->contentid);
else
$row->title = $row->option . ' item.';
// Get total of comments per specific content item.
$strSQL = "SELECT COUNT(*) FROM #__jomcomment WHERE `contentid`='{$row->contentid}'";
$row->total = $cms->db->get_value($strSQL);
// Get last replier of the specific content.
$strSQL = "SELECT `name`,`user_id` FROM #__jomcomment WHERE `contentid`='{$row->contentid}' "
. "GROUP BY `date` DESC LIMIT 0,1";
$row->lastreply = $cms->db->get_value($strSQL);
}
// Prepare pagination
$cms->load('libraries', 'pagination');
// Initialize some configurations
$config = array();
$cms->db->query("SELECT COUNT(*) FROM #__jomcomment WHERE `user_id`='{$cms->user->id}'");
// Set some configurations so that we can initialize the paginations
$config['total_rows'] = $cms->db->get_value();
$config['base_url'] = str_replace($cms->get_path('live') , '', $_SERVER['REQUEST_URI']);
$config['per_page'] = JC_DEFAULT_LIMIT;
$template->set('jcitemid', jcGetItemId());
$template->set('pagination', $cms->pagination->create_links());
$template->set('subscriptions', $subscriptions);
echo $template->fetch(JC_TEMPLATE_PATH . '/admin/subscriptions.html');
return;
?> | healthcommcore/trend | components/com_jomcomment/task/admin.mysubscriptions.php | PHP | gpl-2.0 | 3,440 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
1008,
1030,
9385,
1006,
1039,
1007,
2289,
2011,
18296,
2229,
1004,
14981,
17371,
2078,
1038,
14945,
1011,
2035,
2916,
9235,
999,
1008,
1030,
6105,
8299,
1024,
1013,
1013,
7479,
1012,
17207,
6820,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require_relative '../lib/rbdablooms'
capacity = 1000
error_rate = 0.05
filepath = '/tmp/bloom.bin'
bloom = Dablooms.new(capacity, error_rate, filepath)
p bloom.add('foo', 2)
p bloom.include?('bar')
p bloom.delete('foo', 2)
p bloom.check('foo')
| kubo39/rbdablooms | examples/test.rb | Ruby | mit | 247 | [
30522,
5478,
1035,
5816,
1005,
1012,
1012,
1013,
5622,
2497,
1013,
21144,
2850,
16558,
17650,
2015,
1005,
3977,
1027,
6694,
7561,
1035,
3446,
1027,
1014,
1012,
5709,
5371,
15069,
1027,
1005,
1013,
1056,
8737,
1013,
13426,
1012,
8026,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.forgeessentials.util.AreaSelector;
import net.minecraft.world.World;
import com.forgeessentials.data.api.SaveableObject.SaveableField;
import com.forgeessentials.data.api.SaveableObject.UniqueLoadingKey;
public class WorldArea extends AreaBase
{
@SaveableField
public int dim;
public WorldArea(World world, Point start, Point end)
{
super(start, end);
dim = world.provider.dimensionId;
}
public WorldArea(int dim, Point start, Point end)
{
super(start, end);
this.dim = dim;
}
public WorldArea(int dim, AreaBase area)
{
super(area.getHighPoint(), area.getLowPoint());
this.dim = dim;
}
public WorldArea(World world, AreaBase area)
{
super(area.getHighPoint(), area.getLowPoint());
dim = world.provider.dimensionId;
}
public boolean contains(WorldPoint p)
{
if (p.dim == dim)
return super.contains(p);
else
return false;
}
public boolean contains(WorldArea area)
{
if (area.dim == dim)
return super.contains(area);
else
return false;
}
public boolean intersectsWith(WorldArea area)
{
if (area.dim == dim)
return super.intersectsWith(area);
else
return false;
}
public AreaBase getIntersection(WorldArea area)
{
if (area.dim == dim)
return super.getIntersection(area);
else
return null;
}
public boolean makesCuboidWith(WorldArea area)
{
if (area.dim == dim)
return super.makesCuboidWith(area);
else
return false;
}
@UniqueLoadingKey()
private String getLoadingField()
{
return "WorldArea" + this;
}
@Override
public String toString()
{
return " { " + dim + " , " + getHighPoint().toString() + " , " + getLowPoint().toString() + " }";
}
}
| 14mRh4X0r/ForgeEssentialsMain | src/main/java/com/forgeessentials/util/AreaSelector/WorldArea.java | Java | gpl-3.0 | 1,671 | [
30522,
7427,
4012,
1012,
15681,
7971,
24271,
2015,
1012,
21183,
4014,
1012,
2752,
12260,
16761,
1025,
12324,
5658,
1012,
3067,
10419,
1012,
2088,
1012,
2088,
1025,
12324,
4012,
1012,
15681,
7971,
24271,
2015,
1012,
2951,
1012,
17928,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
external help file: Microsoft.Azure.Commands.Network.dll-Help.xml
ms.assetid: 2638B226-B974-43B6-ACC2-D67573CF6B56
online version:
schema: 2.0.0
---
# Set-AzureRmLoadBalancerRuleConfig
## SYNOPSIS
Sets the goal state for a load balancer rule configuration.
## SYNTAX
### SetByResourceId
```
Set-AzureRmLoadBalancerRuleConfig -Name <String> -LoadBalancer <PSLoadBalancer>
[-FrontendIpConfigurationId <String>] [-BackendAddressPoolId <String>] [-ProbeId <String>]
[-Protocol <String>] [-FrontendPort <Int32>] [-BackendPort <Int32>] [-IdleTimeoutInMinutes <Int32>]
[-LoadDistribution <String>] [-EnableFloatingIP] [-InformationAction <ActionPreference>]
[-InformationVariable <String>] [<CommonParameters>]
```
### SetByResource
```
Set-AzureRmLoadBalancerRuleConfig -Name <String> -LoadBalancer <PSLoadBalancer>
[-FrontendIpConfiguration <PSFrontendIPConfiguration>] [-BackendAddressPool <PSBackendAddressPool>]
[-Probe <PSProbe>] [-Protocol <String>] [-FrontendPort <Int32>] [-BackendPort <Int32>]
[-IdleTimeoutInMinutes <Int32>] [-LoadDistribution <String>] [-EnableFloatingIP]
[-InformationAction <ActionPreference>] [-InformationVariable <String>] [<CommonParameters>]
```
## DESCRIPTION
The **Set-AzureRmLoadBalancerRuleConfig** cmdlet sets the goal state for a load balancer rule configuration.
## EXAMPLES
### Example 1: Modify a load balancing rule configuration
```
PS C:\>$slb = Get-AzureRmLoadBalancer -Name "MyLoadBalancer" -ResourceGroupName "MyResourceGroup"
PS C:\> $slb | Add-AzureRmLoadBalancerRuleConfig -Name "NewRule" -FrontendIPConfiguration $slb.FrontendIpConfigurations[0] -Protocol "Tcp" -FrontendPort 3350 -BackendPort 3350 -EnableFloatingIP
PS C:\> $slb | Set-AzureRmLoadBalancerRuleConfig -Name "NewRule" -FrontendIPConfiguration $slb.FrontendIpConfigurations[0] -Protocol "Tcp" -FrontendPort 3350 -BackendPort 3350
```
The first command gets the load balancer named MyLoadBalancer, and then stores it in the $slb variable.
The second command uses the pipeline operator to pass the load balancer in $slb to Add-AzureRmLoadBalancerRuleConfig, which adds a rule named NewRule to it.
The third command passes the load balancer to **Set-AzureRmLoadBalancerRuleConfig**, which sets the new rule configuration.
Note that the configuration does not enable a floating IP address, which had been enabled by the previous command.
## PARAMETERS
### -Name
Specifies the name of a load balancer.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -LoadBalancer
Specifies a load balancer.
This cmdlet sets the goal state rule configuration for the load balancer that this parameter specifies.
```yaml
Type: PSLoadBalancer
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```
### -FrontendIpConfigurationId
Specifies the ID for a front-end IP address configuration.
```yaml
Type: String
Parameter Sets: SetByResourceId
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -BackendAddressPoolId
Specifies the ID of a **BackendAddressPool** object to associate with a load balancer rule configuration.
```yaml
Type: String
Parameter Sets: SetByResourceId
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -ProbeId
Specifies the ID of the probe to associate with a load balancer rule configuration.
```yaml
Type: String
Parameter Sets: SetByResourceId
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Protocol
Specifies the protocol that is matched by a load balancer rule.
The acceptable values for this parameter are: Tcp or Udp.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -FrontendPort
Specifies the front-end port that is matched by a load balancer rule configuration.
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -BackendPort
Specifies the backend port for traffic that is matched by this rule configuration.
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -IdleTimeoutInMinutes
Specifies the length of time, in minutes, for which the state of conversations is maintained in a load balancer.
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -LoadDistribution
Specifies a load distribution.
The acceptable values for this parameter are: SourceIP and SourceIPProtocol.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -EnableFloatingIP
Indicates that this cmdlet enables a floating IP address for a rule configuration.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -InformationAction
Specifies how this cmdlet responds to an information event.
The acceptable values for this parameter are:
- Continue
- Ignore
- Inquire
- SilentlyContinue
- Stop
- Suspend
```yaml
Type: ActionPreference
Parameter Sets: (All)
Aliases: infa
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -InformationVariable
Specifies an information variable.
```yaml
Type: String
Parameter Sets: (All)
Aliases: iv
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -FrontendIpConfiguration
Specifies a list of front-end IP addresses to associate with a load balancer rule configuration.
```yaml
Type: PSFrontendIPConfiguration
Parameter Sets: SetByResource
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -BackendAddressPool
Specifies a **BackendAddressPool** object to associate with a load balancer rule.
```yaml
Type: PSBackendAddressPool
Parameter Sets: SetByResource
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Probe
Specifies a probe to associate with a load balancer rule configuration.
```yaml
Type: PSProbe
Parameter Sets: SetByResource
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
## OUTPUTS
## NOTES
## RELATED LINKS
[Add-AzureRmLoadBalancerRuleConfig](./Add-AzureRmLoadBalancerRuleConfig.md)
[Add-AzureRmLoadBalancerRuleConfig](./Add-AzureRmLoadBalancerRuleConfig.md)
[Get-AzureRmLoadBalancerRuleConfig](./Get-AzureRmLoadBalancerRuleConfig.md)
[New-AzureRmLoadBalancerRuleConfig](./New-AzureRmLoadBalancerRuleConfig.md)
[Remove-AzureRmLoadBalancerRuleConfig](./Remove-AzureRmLoadBalancerRuleConfig.md)
| zhencui/azure-powershell | src/ResourceManager/Network/Commands.Network/help/Set-AzureRmLoadBalancerRuleConfig.md | Markdown | apache-2.0 | 7,891 | [
30522,
1011,
1011,
1011,
6327,
2393,
5371,
1024,
7513,
1012,
24296,
1012,
10954,
1012,
2897,
1012,
21469,
2140,
1011,
2393,
1012,
20950,
5796,
1012,
11412,
3593,
1024,
25246,
2620,
2497,
19317,
2575,
1011,
1038,
2683,
2581,
2549,
1011,
4724... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Copyright (C) 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.google.sitebricks.stat;
import com.google.common.collect.MapMaker;
import java.lang.reflect.Member;
import java.util.List;
import java.util.Map;
/**
* A {@link StatRegistrar} offers the means by which to register a stat.
*
* @author ffaber@gmail.com (Fred Faber)
*/
public final class StatRegistrar {
/**
* The default exposer to use, which is suitable in most cases.
* Note that this would be best defined within {@link Stat}, but
* static fields declared within {@code @interface} definitions lead to
* javac bugs, such as is described here:
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=324931
*/
Class<? extends StatExposer> DEFAULT_EXPOSER_CLASS = StatExposers.InferenceExposer.class;
private final Map<Class<?>, List<MemberAnnotatedWithAtStat>>
classesToInstanceMembers =
new MapMaker().weakKeys().makeComputingMap(
new StatCollector(
StatCollector.StaticMemberPolicy.EXCLUDE_STATIC_MEMBERS));
private final Map<Class<?>, List<MemberAnnotatedWithAtStat>>
classesToStaticMembers =
new MapMaker().weakKeys().makeComputingMap(
new StatCollector(
StatCollector.StaticMemberPolicy.INCLUDE_STATIC_MEMBERS));
private final Stats stats;
StatRegistrar(Stats stats) {
this.stats = stats;
}
public void registerSingleStat(String name, String description, Object stat) {
registerSingleStat(
name, description, StatReaders.forObject(stat), DEFAULT_EXPOSER_CLASS);
}
public void registerSingleStat(
String name, String description, StatReader statReader,
Class<? extends StatExposer> statExposerClass) {
stats.register(
StatDescriptor.of(name, description, statReader, statExposerClass));
}
public void registerStaticStatsOn(Class<?> clazz) {
List<MemberAnnotatedWithAtStat> annotatedMembers =
classesToStaticMembers.get(clazz);
for (MemberAnnotatedWithAtStat annotatedMember : annotatedMembers) {
Stat stat = annotatedMember.getStat();
stats.register(StatDescriptor.of(
stat.value(),
stat.description(),
StatReaders.forStaticMember(annotatedMember.<Member>getMember()),
stat.exposer()));
}
}
public void registerAllStatsOn(Object target) {
List<MemberAnnotatedWithAtStat> annotatedMembers =
classesToInstanceMembers.get(target.getClass());
for (MemberAnnotatedWithAtStat annotatedMember : annotatedMembers) {
Stat stat = annotatedMember.getStat();
stats.register(StatDescriptor.of(
stat.value(),
stat.description(),
StatReaders.forMember(annotatedMember.<Member>getMember(), target),
stat.exposer()));
}
registerStaticStatsOn(target.getClass());
}
}
| mgenov/sitebricks | stat/src/main/java/com/google/sitebricks/stat/StatRegistrar.java | Java | apache-2.0 | 3,380 | [
30522,
1013,
1008,
1008,
1008,
9385,
1006,
1039,
1007,
2249,
8224,
4297,
1012,
1008,
1008,
30524,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
1012,
1008,
2017,
2089,
6855,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* Core Design Scriptegrator plugin for Joomla! 2.5
* @author Daniel Rataj, <info@greatjoomla.com>
* @package Joomla
* @subpackage System
* @category Plugin
* @version 2.5.x.2.3.1
* @copyright Copyright (C) 2007 - 2013 Great Joomla!, http://www.greatjoomla.com
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL 3
*
* This file is part of Great Joomla! extension.
* This extension 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 3 of the License, or
* (at your option) any later version.
*
* This extension is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
.cleaners .cleaners_display_none {
display: none;
}
.cleaners .cleaners_header a {
text-decoration: underline;
} | jbelborja/ferbelia-blog | plugins/system/cdscriptegrator/fields/cleaners/css/cleaners.css | CSS | gpl-2.0 | 1,160 | [
30522,
1013,
1008,
1008,
1008,
4563,
2640,
5896,
13910,
16259,
13354,
2378,
2005,
28576,
19968,
2050,
999,
1016,
1012,
1019,
1008,
1030,
3166,
3817,
9350,
13006,
1010,
1026,
18558,
1030,
2307,
5558,
5358,
2721,
1012,
4012,
1028,
1008,
1030,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// This file is part of nuBASIC
// Copyright (c) Antonino Calderone (antonino.calderone@gmail.com)
// All rights reserved.
// Licensed under the MIT License.
// See COPYING file in the project root for full license information.
//
/* -------------------------------------------------------------------------- */
#ifndef __NU_STMT_FUNCTION_H__
#define __NU_STMT_FUNCTION_H__
/* -------------------------------------------------------------------------- */
#include "nu_expr_any.h"
#include "nu_prog_ctx.h"
#include "nu_stmt.h"
#include "nu_token_list.h"
#include "nu_var_scope.h"
#include "nu_variable.h"
#include <algorithm>
#include <string>
/* -------------------------------------------------------------------------- */
namespace nu {
/* -------------------------------------------------------------------------- */
class stmt_function_t : public stmt_t {
public:
stmt_function_t() = delete;
stmt_function_t(const stmt_function_t&) = delete;
stmt_function_t& operator=(const stmt_function_t&) = delete;
using vec_size_t = expr_any_t::handle_t;
stmt_function_t(prog_ctx_t& ctx, const std::string& id);
void define(const std::string& var, const std::string& vtype,
vec_size_t vect_size, prog_ctx_t& ctx, const std::string& id);
void define_ret_type(const std::string& type, prog_ctx_t& ctx, size_t array_size) {
auto& fproto = ctx.proc_prototypes.data[_id].second;
fproto.ret_type = type;
fproto.array_size = array_size;
}
stmt_cl_t get_cl() const noexcept override;
void run(rt_prog_ctx_t& ctx) override;
protected:
std::string _id;
std::set<std::string> _vars_rep_check;
};
/* -------------------------------------------------------------------------- */
}
/* -------------------------------------------------------------------------- */
#endif //__NU_STMT_FUNCTION_H__
| eantcal/nubasic | include/nu_stmt_function.h | C | mit | 1,886 | [
30522,
1013,
1013,
1013,
1013,
2023,
5371,
2003,
2112,
1997,
16371,
22083,
2594,
1013,
1013,
9385,
1006,
1039,
1007,
9865,
5740,
28129,
2063,
1006,
9865,
5740,
1012,
28129,
30524,
2916,
9235,
1012,
1013,
1013,
7000,
2104,
1996,
10210,
6105,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// ABAudiobusController.h
// Audiobus
//
// Created by Michael Tyson on 09/12/2011.
// Copyright (c) 2011-2014 Audiobus. All rights reserved.
//
#ifdef __cplusplus
extern "C" {
#endif
#import <Foundation/Foundation.h>
#import "ABCommon.h"
#import "ABAudioFilterPort.h"
@class ABMIDISenderPort;
@class ABMIDIReceiverPort;
@class ABMIDIFilterPort;
#pragma mark Notifications
/** @name Notifications */
///@{
/*!
* Peer appeared
*
* Sent when an Audiobus peer appears for the first time.
* Peer is accessible in the notification userinfo via the `ABPeerKey'.
*/
extern NSString * const ABPeerAppearedNotification;
/*!
* Peer disappeared
*
* Sent when an Audiobus peer disappears.
* Peer is accessible in the notification userinfo via the `ABPeerKey'.
*/
extern NSString * const ABPeerDisappearedNotification;
/*!
* Connections changed
*
* Sent when the local app's connections have changed, caused by connections
* or disconnections from within the Audiobus app.
*
* Note that due to the asynchronous nature of Inter-App Audio connections
* within Audiobus when connected to peers using the 2.1 Audiobus SDK or above,
* you may see several of these notifications during a connection or disconnection.
*/
extern NSString * const ABConnectionsChangedNotification;
/*!
* Connected
*
* Sent when the app state transitioned from disconnected, to connected.
*
* Note that due to the asynchronous nature of Inter-App Audio connections
* within Audiobus when connected to peers using the 2.1 Audiobus SDK or above,
* you may see this notification before the
* @link ABAudiobusController::interAppAudioConnected interAppAudioConnected @endlink or
* @link ABAudiobusController::audiobusConnected audiobusConnected @endlink
* properties change to YES.
*/
extern NSString * const ABConnectedNotification;
/*!
* Disconnected
*
* Sent when the app state transitioned from connected, to disconnected.
*/
extern NSString * const ABDisconnectedNotification;
/*!
* Peer attributes changed
*
* Sent when one or more attributes of a peer changes.
*/
extern NSString * const ABPeerAttributesChangedNotification;
/*!
* Connection Panel was shown
*
* Sent whenever the connection panel appears, either when a new session begins,
* or when the user drags the connection panel back out after hiding it.
*/
extern NSString * const ABConnectionPanelShownNotification;
/*!
* Connection Panel was hidden
*
* Sent whenever the connection panel is hidden, either when the session ends,
* or when the user drags the connection panel off the screen.
*/
extern NSString * const ABConnectionPanelHiddenNotification;
/*!
* Application is about to terminate
*
* When Audiobus isn't able to instantiate a remote Audio Unit, then it will
* send an exit request to this app. Before executing exit this notification
* will be sent out.
*/
extern NSString * const ABApplicationWillTerminateNotification;
#pragma mark State IO Protocol
/** @name State IO Protocol */
///@{
/*!
* State input/output delegate protocol
*
* This protocol is used to provide app-specific state data when a preset
* is saved within Audiobus. This state data will then be presented back to
* your app when the user loads the saved preset within Audiobus, so your
* app can restore the prior state.
*
* The nature of the state information to be saved and restored is up to you.
* It should be enough to put your app into the same operating state as when
* the preset was saved, but should not necessarily contain the user's content.
* Presets should represent workspaces, rather than complete projects.
*
* To assist in streamlining your app initialization, when your app is being
* launched from a preset within Audiobus, Audiobus will launch your app by
* providing the string "incoming-preset" to the host part of the app launch
* URL. For example, if your Audiobus launch URL is "myapp.audiobus://", launching
* your app from within an Audiobus preset will cause the app to be launched
* with the URL "myapp.audiobus://incoming-preset". You can then detect this
* condition from within `application:openURL:sourceApplication:annotation:`
*/
@protocol ABAudiobusControllerStateIODelegate <NSObject>
/*!
* Provide a dictionary to represent the current app state
*
* This dictionary can represent any state you deem relevant to the saved
* preset, for later restoration in
* @link loadStateFromAudiobusStateDictionary:responseMessage: @endlink.
* It may only contain values that can be represented in a Property List
* (See Apple's "Property List Types and Objects" documentation).
*
* You may include NSData objects representing larger resources, if
* appropriate, such as audio data for a sampler. To avoid loading large
* files into memory all at once, you can request that the NSData use
* memory-mapping via the NSDataReadingMappedIfSafe hint.
*
* Note: You should not spend more than a couple hundred milliseconds
* (at most) gathering state information in this method.
*
* @return A dictionary containing state information for your app.
*/
- (NSDictionary*)audiobusStateDictionaryForCurrentState;
/*!
* Load state from previously-created state dictionary
*
* This method is called when the user loads a preset from within Audiobus.
* You will receive the state dictionary originally provided via
* @link audiobusStateDictionaryForCurrentState @endlink, and should apply this state
* information to restore your app to the state it was in when saved.
*
* If you wish, you may provide a message to be displayed to the user within
* Audiobus, via the 'outResponseMessage' parameter. This can be used to notify
* the user of any issues with the state load, like the case where the state
* relies on some In-App Purchase content the user hasn't bought yet.
*
* @param dictionary The state dictionary, as originally provided via
* @link audiobusStateDictionaryForCurrentState @endlink. In addition to the keys
* you provided, the value of the key ABStateDictionaryPresetNameKey will contain
* the name of the preset, as set by the user.
* @param outResponseMessage Response message to be displayed to the user (optional)
*/
- (void)loadStateFromAudiobusStateDictionary:(NSDictionary*)dictionary responseMessage:(NSString**)outResponseMessage;
@end
extern NSString * const ABStateDictionaryPresetNameKey;
#pragma mark -
///@}
/*!
* Peer key, used with notifications
*/
extern NSString * const ABPeerKey;
@class ABAudioReceiverPort;
@class ABAudioSenderPort;
@class ABAudioFilterPort;
@class ABPeer;
@class ABPort;
@class ABTrigger;
/*!
* Audiobus Controller
*
* The main Audiobus class. Create an instance of this then
* create and add receiver, sender and/or filter ports as required.
*/
@interface ABAudiobusController : NSObject
/*!
* Reset all peered Audiobus controllers
*
* Call this to forget all established connections with instances of the Audiobus app.
*
* The first time there is an incoming connection from the Audiobus app, the Audiobus
* library will prompt the user for permission to allow the connection. Calling this method
* will forgot all granted permissions, so that the next incoming Audiobus connection will
* cause another prompt to accept or deny the connection.
*/
+(void)resetAllPeeredConnections;
/*!
* Initializer
*
* @param apiKey Your app's API key (find this at the bottom of your app's details screen accessible from https://developer.audiob.us/apps)
*/
- (id)initWithApiKey:(NSString*)apiKey;
#pragma mark - Triggers
/** @name Triggers */
///@{
/*!
* Add a trigger
*
* This method allows you to define and add triggers that the user can invoke from outside your
* app, in order to make your app perform some function, such as toggling recording.
*
* Calling this method more than once with the same trigger will have no effect the subsequent times.
*
* @param trigger The trigger
*/
- (void)addTrigger:(ABTrigger*)trigger;
/*!
* Same as addTrigger whith the difference that the trigger is not shown in
* AB Remote.
*/
-(void)addLocalOnlyTrigger:(ABTrigger*)trigger;
/*!
* Add a trigger which is only shown in Audiobus Remote.
*
* Triggers added by this method are only shown within Audiobus Remote. Use this method
* and @link addRemoteTriggerMatrix:rows:cols: @endlink to provide extended functionality
* for your app which can be used from within Audiobus Remote.
*
* @param trigger The trigger
*/
-(void)addRemoteTrigger:(ABTrigger*)trigger;
/*!
* Add a grid matrix of triggers for Audiobus Remote
*
* Triggers added by this method appear within Audiobus Remote as a grid of buttons.
* We recommend using this facility when a matrix layout is important to the user
* experience, such as with drum sample pads.
*
* Please use this facility only if your button layout needs an explicit
* grid order. Otherwise, use @link addRemoteTrigger: @endlink, which allows
* Audiobus Remote to make better use of screen space.
*
* @param triggers An array of triggers. Size of the array must be rows * cols.
* @param rows Number of rows; limited to 6 rows maximum.
* @param cols Number of columns; limited to 6 cols maximum.
* @param transposable If transposable is true the matrix is transposed if
* space can be saved.
*/
- (void)addRemoteTriggerMatrix:(NSArray*) triggers
rows:(NSUInteger) rows
cols:(NSUInteger) cols
transposable:(BOOL) transposable;
- (void)addRemoteTriggerMatrix:(NSArray*) triggers
rows:(NSUInteger) rows
cols:(NSUInteger) cols __attribute__((deprecated("Use 'addRemoteTriggerMatrix:rows:cols:transposable' instead")));
/*!
* Remove a trigger
*
* Calling this method more than once with the same trigger will have no effect the subsequent times.
*
* @param trigger Trigger to remove
*/
- (void)removeTrigger:(ABTrigger*)trigger;
#pragma mark - All ports
/*!
* Returns the port with a given unique ID or Nil when not found.
*/
- (ABPort*) portWithUniqueID:(uint32_t)uniqueID;
/*!
* Returns the port with a given name or Nil when not found.
*/
- (ABPort*) portWithName:(NSString*)name;
/*!
* Returns an array of objects of type ABPort*.
*/
- (NSArray*) allPorts;
///@}
#pragma mark - Audio sender ports
/** @name Audio ports */
///@{
/*!
* Add a sender port
*
* Sender ports let your app send audio to other apps.
*
* You can create several sender ports to offer several separate audio streams. For example, a multi-track
* recorder could define additional sender ports for each track, so each track can be routed to a different place.
*
* Ideally, the first port you create should perform some sensible default behaviour: This will be the port
* that is selected by default when the user taps your app in the Audiobus port picker.
*
* @param port The port to add
*/
- (void)addAudioSenderPort:(ABAudioSenderPort*)port;
/*!
* Deprecated. Use addAudioSenderPort instead.
*/
- (void)addSenderPort:(ABAudioSenderPort*)port __deprecated_msg("Use addAudioSenderPort instead");
/*!
* Access a sender port
*
* If you are sending audio from a Core Audio thread, then you should not use this method from within
* the thread. Instead, obtain a reference to the sender object ahead of time, on the main thread, then store
* the pointer in a context directly accessible in the Core Audio thread, to avoid making any Objective-C calls from within
* the thread.
*
* @param name Name of port
* @return Sender port
*/
- (ABAudioSenderPort*)audioSenderPortNamed:(NSString*)name;
/*!
* Deprecated. Use addAudioSenderPort instead.
*/
- (ABAudioSenderPort*)senderPortNamed:(NSString*)name __deprecated_msg("Use audioSenderPortNamed instead");
/*!
* Remove a sender port
*
* It is your responsibility to make sure you stop accessing the port prior to calling this method.
*
* @param port The port to remove
*/
- (void)removeAudioSenderPort:(ABAudioSenderPort*)port;
/*!
* Deprecated. Use addAudioSenderPort instead.
*/
- (void)removeSenderPort:(ABAudioSenderPort*)port __deprecated_msg("Use removeAudioSenderPort instead");
/*!
* Sort the sender ports
*
* This method allows you to assign an order to the sender ports. This is the
* order in which the ports will appear within Audiobus.
*
* @param cmptr Comparitor block used to provide the order
*/
- (void)sortAudioSenderPortsUsingComparitor:(NSComparator)cmptr;
/*!
* Deprecated. Use sortAudioSenderPortsUsingComparitor instead.
*/
- (void)sortSenderPortsUsingComparitor:(NSComparator)cmptr __deprecated_msg("Use sortAudioSenderPortsUsingComparitor instead");
/*!
* Currently defined sender ports
*
* The sender ports you have registered with @link addSenderPort: @endlink, as an
* array of ABAudioSenderPort.
*/
@property (nonatomic, readonly) NSArray *audioSenderPorts;
/*!
* Deprecated. Use audioSenderPorts instead.
*/
@property (nonatomic, readonly) NSArray *senderPorts __deprecated_msg("Use audioSenderPorts instead!");
#pragma mark - Audio filter ports
/*!
* Add a filter port
*
* Filter ports expose audio processing functionality to the Audiobus ecosystem, allowing users to use your
* app as an audio filtering node.
*
* When you create a filter port, you pass in a block to be used to process the audio as it comes in.
*
* @param port The filter port
*/
- (void)addAudioFilterPort:(ABAudioFilterPort*)port;
/*!
* Deprecated. Use addAudioFilterPort instead.
*/
- (void)addFilterPort:(ABAudioFilterPort*)port __deprecated_msg("Use addAudioFilterPort instead");
/*!
* Get the filter port
*
* This is used to access the attributes of the connected ports. Note that the actual process of
* receiving and sending audio is handled automatically.
*
* @param name The name of the filter port
* @return Filter port
*/
- (ABAudioFilterPort*)audioFilterPortNamed:(NSString*)name;
/*!
* Deprecated. Use audioFilterPortNamed instead.
*/
- (ABAudioFilterPort*)filterPortNamed:(NSString*)name __deprecated_msg("Use audioFilterPortNamed instead");
/*!
* Remove a filter port
*
* @param port The port to remove
*/
- (void)removeAudioFilterPort:(ABAudioFilterPort*)port;
/*!
* Deprecated. Use removeAudioFilterPort instead.
*/
- (void)removeFilterPort:(ABAudioFilterPort*)port __deprecated_msg("Use removeAudioFilterPort instead");
/*!
* Sort the filter ports
*
* This method allows you to assign an order to the fiter ports. This is the
* order in which the ports will appear within Audiobus.
*
* @param cmptr Comparitor block used to provide the order
*/
- (void)sortAudioFilterPortsUsingComparitor:(NSComparator)cmptr;
/*!
* Deprecated. Use sortAudioFilterPortsUsingComparitor instead.
*/
- (void)sortFilterPortsUsingComparitor:(NSComparator)cmptr __deprecated_msg("Use sortAudioFilterPortsUsingComparitor instead");
/*!
* Currently defined filter ports
*
* The filter ports you have registered with @link addFilterPort: @endlink, as an
* array of ABAudioFilterPort.
*/
@property (nonatomic, readonly) NSArray *audioFilterPorts;
/*!
* Deprecated. Use audioFilterPorts instead.
*/
@property (nonatomic, readonly) NSArray *filterPorts __deprecated_msg("Use audioFilterPorts instead!");
#pragma mark - Audio receiver ports
/*!
* Add a receiver port
*
* Receiver ports allow your app to receive audio from other apps.
*
* MIDI that any receiver port can receive inputs from any number of sources. You do not need to
* create additional receiver ports to receive audio from multiple sources.
*
* Ideally, the first port you create should perform some sensible default behaviour: This will be the port
* that is selected by default when the user taps your app icon in the Audiobus port picker.
*
* @param port The receiver port
*/
- (void)addAudioReceiverPort:(ABAudioReceiverPort*)port;
/*!
* Deprecated. Use addAudioReceiverPort instead.
*/
- (void)addReceiverPort:(ABAudioReceiverPort*)port __deprecated_msg("Use addAudioReceiverPort instead");
/*!
* Access a receiver port
*
* If you are receiving audio from a Core Audio thread, then you should not use this method from within
* the thread. Instead, obtain a reference to the receiver object ahead of time, on the main thread, then store
* the pointer in a context directly accessible in the Core Audio thread, to avoid making any Objective-C calls from within
* the thread.
*
* @param name Name of port.
* @return Receiver port
*/
- (ABAudioReceiverPort*)audioReceiverPortNamed:(NSString*)name;
/*!
* Deprecated. Use audioReceiverPortNamed instead.
*/
- (ABAudioReceiverPort*)receiverPortNamed:(NSString*)name __deprecated_msg("Use audioReceiverPortNamed instead");
/*!
* Remove a receiver port
*
* It is your responsibility to make sure you stop accessing the port prior to calling this method.
*
* @param port The port to remove
*/
- (void)removeAudioReceiverPort:(ABAudioReceiverPort*)port;
/*!
* Deprecated. Use removeAudioReceiverPort instead.
*/
- (void)removeReceiverPort:(ABAudioReceiverPort*)port __deprecated_msg("Use removeAudioReceiverPort instead");
/*!
* Sort the receiver ports
*
* This method allows you to assign an order to the receiver ports. This is the
* order in which the ports will appear within Audiobus.
*
* @param cmptr Comparitor block used to provide the order
*/
- (void)sortAudioReceiverPortsUsingComparitor:(NSComparator)cmptr;
/*!
* Deprecated. Use sortAudioReceiverPortsUsingComparitor instead.
*/
- (void)sortReceiverPortsUsingComparitor:(NSComparator)cmptr __deprecated_msg("Use sortAudioReceiverPortsUsingComparitor instead");
/*!
* Currently defined receiver ports
*
* The receiver ports you have registered with @link addReceiverPort: @endlink, as an
* array of ABAudioReceiverPort.
*/
@property (nonatomic, readonly) NSArray *audioReceiverPorts;
/*!
* Deprecated. Use audioReceiverPorts instead.
*/
@property (nonatomic, readonly) NSArray *receiverPorts __deprecated_msg("Use audioReceiverPorts instead!");
#pragma mark - MIDI sender ports
/*!
* Add a MIDI port
*
* Sender ports let your app send MIDI to other apps.
*
* You can create several MIDI ports to offer several separate MIDI streams.
* For example, a multi-track MIDI sequencer could define additional MIDI ports
* for each track, so each track can be routed to a different place.
*
* @param port The port to add
*/
- (void)addMIDISenderPort:(ABMIDISenderPort*)port;
/*!
* Remove a MIDI port
*
* It is your responsibility to make sure you stop accessing the port prior to calling this method.
*
* @param port The port to remove
*/
-(void)removeMIDISenderPort:(ABMIDISenderPort*)port;
/*!
* Sort the MIDI ports
*
* This method allows you to assign an order to the sender ports. This is the
* order in which the MIDI ports will appear within Audiobus.
*
* @param cmptr Comparitor block used to provide the order
*/
-(void)sortMIDISenderPortsUsingComparitor:(NSComparator)cmptr;
/*!
* Get the MIDI Port
*
* This is used to access the attributes of the connected ports.
*
* @param name The name of the MIDI port
* @return MIDI port.
*/
-(ABMIDISenderPort *)MIDISenderPortNamed:(NSString *)name;
/*!
* Currently defined MIDI ports
*
* The sender ports you have registered with @link addMIDISenderPort: @endlink,
* as an array of ABMIDISenderPorts.
*/
@property (nonatomic, readonly) NSArray *MIDISenderPorts;
#pragma mark - MIDI Filter ports
/*!
* Add a MIDI Filter port
*
* Filter ports let your app transform MIDI received from other apps.
*
* You can create several MIDI Filter ports to process several separate MIDI streams.
* For example, a multi-track MIDI arpeggiator could define additional MIDI Filter ports
* for each track, so each track can be routed to a different place.
*
* @param port The port to add
*/
- (void)addMIDIFilterPort:(ABMIDIFilterPort*)port;
/*!
* Remove a MIDI Filter port
*
* It is your responsibility to make sure you stop accessing the port prior to calling this method.
*
* @param port The port to remove
*/
-(void)removeMIDIFilterPort:(ABMIDIFilterPort*)port;
/*!
* Sort the MIDI Filter ports
*
* This method allows you to assign an order to the filter ports. This is the
* order in which the MIDI ports will appear within Audiobus.
*
* @param cmptr Comparitor block used to provide the order
*/
-(void)sortMIDIFilterPortsUsingComparitor:(NSComparator)cmptr;
/*!
* Get the MIDI Filter port
*
* This is used to access the attributes of the connected ports.
*
* @param name The name of the MIDI Filter port
* @return MIDI Filter port.
*/
-(ABMIDIFilterPort *)MIDIFilterPortNamed:(NSString *)name;
/*!
* Currently defined MIDI Filter ports
*
* The filter ports you have registered with @link addMIDIFilterPort: @endlink,
* as an array of ABMIDIFilterPorts.
*/
@property (nonatomic, readonly) NSArray *MIDIFilterPorts;
#pragma mark - MIDI Receiver ports
/*!
* Add a MIDI Receiver port
*
* Filter ports let your app receive MIDI from other apps.
*
* You can create several MIDI Receiver ports to process several separate MIDI streams.
* For example, a multi-track MIDI recorder could define additional MIDI Filter ports
* for each track, so each track can be routed to a different place.
*
* @param port The port to add
*/
- (void)addMIDIReceiverPort:(ABMIDIReceiverPort*)port;
/*!
* Remove a MIDI Receiver port
*
* It is your responsibility to make sure you stop accessing the port prior to calling this method.
*
* @param port The port to remove
*/
-(void)removeMIDIReceiverPort:(ABMIDIReceiverPort*)port;
/*!
* Sort the MIDI Receiver ports
*
* This method allows you to assign an order to the filter ports. This is the
* order in which the MIDI ports will appear within Audiobus.
*
* @param cmptr Comparitor block used to provide the order
*/
-(void)sortMIDIReceiverPortsUsingComparitor:(NSComparator)cmptr;
/*!
* Get the MIDI Receiver port
*
* This is used to access the attributes of the connected ports.
*
* @param name The name of the MIDI Receiver port
* @return MIDI Receiver port.
*/
-(ABMIDIReceiverPort *)MIDIReceiverPortNamed:(NSString *)name;
/*!
* Currently defined MIDI Receiver ports
*
* The filter ports you have registered with @link addMIDIReceiverPort: @endlink,
* as an array of ABMIDIReceiverPorts.
*/
@property (nonatomic, readonly) NSArray *MIDIReceiverPorts;
///@}
#pragma mark - Properties
/** @name Properties */
///@{
/*!
* Whether to allow this app to connect its input to its own output
*
* If you set this to YES, then Audiobus will allow users to add your app in the input
* and output positions simultaneously, allowing the app's output to be piped back into
* its input.
*
* If you wish to support this functionality, you must either (a) pass NULL for the audioUnit
* parameter of ABAudioSenderPort's initialiser, which will cause the port to create its own
* separate audio unit for the connection, and explicitly use
* @link ABAudioSenderPort::ABAudioSenderPortSend ABAudioSenderPortSend @endlink to send audio,
* or (b) ensure the audioUnit parameter is distinct from your app's main audio unit (the one
* from which you call ABAudioReceiverPortReceive.
*
* If you do not do this, your app's audio system will stop running once a connection to self
* is established, due to a loop in the audio unit connections. Note that this requirement has
* been newly introduced with Audiobus 3, for technical reasons. See the AB Receiver sample app
* for a demonstration of this functionality.
*
* By default, this is disabled, as some apps may not function properly if their
* audio pipeline is traversed multiple times in the same time step.
*/
@property (nonatomic, assign) BOOL allowsConnectionsToSelf;
/*!
* Connection panel position
*
* This defines where the connection panel appears within your app, when necessary.
*
* You can set this at any time, and the panel, if visible, will animate to the new location.
*/
@property (nonatomic, assign) ABConnectionPanelPosition connectionPanelPosition;
/*!
* Whether connection panel is visible
*
* This property supports key-value observing.
*/
@property (nonatomic, readonly) BOOL connectionPanelVisible;
/*!
* The current connection panel frame (in window coordinates)
*
* This property supports key-value observing. When the connection panel is hidden,
* this property will have the value CGRectZero.
*/
@property (nonatomic, readonly) CGRect connectionPanelFrame;
/*!
* All available @link ABPeer peers @endlink
*/
@property (nonatomic, strong, readonly) NSSet *peers;
/*!
* All @link ABPeer peers @endlink that are connected as part of the current session
*/
@property (nonatomic, strong, readonly) NSSet *connectedPeers;
/*!
* All @link ABPort ports @endlink that are connected as part of the current session
*/
@property (nonatomic, strong, readonly) NSSet *connectedPorts;
/*!
* Whether the app is connected to anything via Audiobus or Inter-App Audio
*
* Note that due to the asynchronous nature of Inter-App Audio connections
* within Audiobus when connected to peers using the 2.1 Audiobus SDK or above,
* you may see this property change to YES before the @link audiobusConnected @endlink
* and @link interAppAudioConnected @endlink are both YES.
*/
@property (nonatomic, readonly) BOOL connected;
/*!
* Whether the app is connected to anything via Audiobus specifically (not Inter-App Audio)
*
* Note that due to the asynchronous nature of Inter-App Audio connections
* within Audiobus when connected to peers using the 2.1 Audiobus SDK or above, you may see
* this property change to YES before the @link interAppAudioConnected @endlink property
* changes to YES, or vice versa.
*
*/
@property (nonatomic, readonly) BOOL audiobusConnected;
/*!
* Whether your app is connected to anything via Audiobus 2 specifically (not Inter-App Audio)
*
* Same as audiobusConnected but with the difference that the property becomes
* only true when your app is connected to Audiobus 2.
*/
@property (nonatomic, readonly) BOOL audiobus2Connected;
/*!
* Whether your app is connected to anything via Audiobus 3 specifically (not Inter-App Audio)
*
* Same as audiobusConnected but with the difference that the property becomes
* only true when your app is connected to Audiobus 3.
*/
@property (nonatomic, readonly) BOOL audiobus3AndHigherConnected;
/*!
* Whether the port is connected via Inter-App Audio
*
* Note that this property will also return YES when connected to
* Audiobus peers using the 2.1 SDK.
*
* Note that due to the asynchronous nature of Inter-App Audio connections
* within Audiobus when connected to peers using the 2.1 Audiobus SDK or above, you may see
* this property change to YES before the @link audiobusConnected @endlink property
* changes to YES, or vice versa.
*/
@property (nonatomic, readonly) BOOL interAppAudioConnected;
/*!
* Whether the MIDI port is connected to Audiobus.
*
* When your app provides at least one MIDI port this property reflects
* wether this port is connected to some other inter app audio instrument.
*
*/
@property (nonatomic, readonly) BOOL audiobusMIDIPortConnected;
/*!
* Whether the app is part of an active Audiobus session
*
* This now-deprecated property reflected whether your app is currently part of an active Audiobus session,
* which means the app has been used with Audiobus before, and the Audiobus app is still running.
*
* We once requested that you observe this property in order to manage your app's lifecycle, and remain
* active in the background if an Audiobus session was still in progress (this property value was YES).
* Under Audiobus 3 later, we now prefer you shut down your app's audio engine once it becomes disconnected,
* so you should now ignore this property.
*/
@property (nonatomic, readonly) BOOL memberOfActiveAudiobusSession __deprecated_msg("You should now ignore this property, and shut down your audio engine once disconnected, regardless of Audiobus session state.");
/*!
* Whether the Audiobus app is running on this device
*/
@property (nonatomic, readonly) BOOL audiobusAppRunning;
/*!
* State input/output delegate
*
* This delegate provides methods to save and load state specific to your
* app, in response to preset save and load operations from within Audiobus.
*
* This feature is optional but recommended, as it allows your users to save
* and restore the state of your app as part of their workspace.
*/
@property (nonatomic, assign) id<ABAudiobusControllerStateIODelegate> stateIODelegate;
/*!
* In some cases the status bar is managed by Audiobus. Call this function
* when the status bar needs an update.
*
*/
- (void) setNeedsStatusBarAppearanceUpdate;
#pragma mark - Switch between Audiobus and other Technologies
/*!
* Set this block to be informed wether your app should show or hide its
* Inter-App audio transport panel.
*
* When your app is connected to Audiobus the Inter-App audio transport panel
* needs to be hidden. Set a block here which shows / hides the panel depending
* on the parameter "hidePanel".
*/
@property (nonatomic, copy) void(^showInterAppAudioTransportPanelBlock)(BOOL showPanel) ;
/*!
* For apps with MIDI Receiver ports: Set this block to prevent receiving Core
* MIDI events twice.
*
* Audiobus will collect Core MIDI events and route it to your synth app.
* Thus your app might not want to receive these Core MIDI events directly
* from Core MIDI sources.
* Assign a block to this property which enables or disables Core MIDI receiving
* depending on the parameter "receivingEnabled".
*/
@property (nonatomic, copy) void(^enableReceivingCoreMIDIBlock)(BOOL receivingEnabled);
/*!
* For Apps with MIDI sender ports: Set this block to prevent double MIDI routings
*
* Assign a block to this property which enables or disables Core MIDI
* receiving depending on the parameter "sendingEnabled". Audiobus will call
* this block if it starts and stops receiving MIDI from your app. Thus we
* will prevent that apps connected to Audiobus receive MIDI twice from
* your MIDI controller: One time from via Audiobus and a second time directly.
*/
@property (nonatomic, copy) void(^enableSendingCoreMIDIBlock)(BOOL sendingEnabled);
@end
#ifdef __cplusplus
}
#endif
| cpmpercussion/microjam | Pods/Audiobus/Audiobus/ABAudiobusController.h | C | mit | 30,649 | [
30522,
1013,
1013,
1013,
1013,
19557,
21041,
16429,
2271,
8663,
13181,
10820,
1012,
1044,
1013,
1013,
5746,
8286,
1013,
1013,
1013,
1013,
2580,
2011,
2745,
19356,
2006,
5641,
1013,
2260,
1013,
2249,
1012,
1013,
1013,
9385,
1006,
1039,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.domeastudio.mappingo.servers.util.mpsecurity;
import com.domeastudio.mappingo.servers.util.mpsecurity.base.Byte2StringHelper;
import java.security.MessageDigest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MD5SHAHelper {
private static Logger logger = LoggerFactory.getLogger(MD5SHAHelper.class);
/**
* encode string
*
* @param algorithm
* @param data
* @return String
*/
public static byte[] encrypt(ALGORITHM algorithm, byte[] data) {
if (null == data && data.length < 1) {
return null;
}
return encryptCore(algorithm, data);
}
private static byte[] encryptCore(ALGORITHM algorithm, byte[] data) {
try {
MessageDigest messageDigest = MessageDigest.getInstance(algorithm.name());
messageDigest.update(data);
return messageDigest.digest();
} catch (Exception e) {
logger.error("encryption '" + data + "' string error in " + algorithm.name() + " mode:", e);
throw new RuntimeException(e);
}
}
/**
* MD5加密
*
* @param data
* @return String
*/
public static byte[] encryptByMD5(byte[] data) {
if (null == data && data.length < 1) {
return null;
}
return encryptCore(ALGORITHM.MD5, data);
}
//
public static void main(String[] args) {
System.out.println("空字符串 MD5 :"
+ Byte2StringHelper.getFormattedText(MD5SHAHelper.encryptByMD5("".getBytes())));
System.out.println("空格 MD5 :"
+ Byte2StringHelper.getFormattedText(MD5SHAHelper.encrypt(ALGORITHM.MD5, " ".getBytes())));
System.out.println("空字符串 SHA1 :"
+ Byte2StringHelper.getFormattedText(MD5SHAHelper.encrypt(ALGORITHM.SHA, "".getBytes())));
System.out.println("空格 SHA1 :"
+ Byte2StringHelper.getFormattedText(MD5SHAHelper.encrypt(ALGORITHM.SHA1, " ".getBytes())));
}
}
| DomeA/Nebula | code/Leo/mappingo/servers/util/mp-security/src/main/java/com/domeastudio/mappingo/servers/util/mpsecurity/MD5SHAHelper.java | Java | lgpl-3.0 | 2,048 | [
30522,
7427,
4012,
1012,
8514,
14083,
21041,
2080,
1012,
12375,
2080,
1012,
14903,
1012,
21183,
4014,
1012,
12616,
8586,
25137,
1025,
12324,
4012,
1012,
8514,
14083,
21041,
2080,
1012,
12375,
2080,
1012,
14903,
1012,
21183,
4014,
1012,
12616,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef StyleVariableData_h
#define StyleVariableData_h
#include "core/css/CSSVariableData.h"
#include "wtf/Forward.h"
#include "wtf/HashMap.h"
#include "wtf/RefCounted.h"
#include "wtf/text/AtomicStringHash.h"
namespace blink {
class StyleVariableData : public RefCounted<StyleVariableData> {
public:
static PassRefPtr<StyleVariableData> create() { return adoptRef(new StyleVariableData()); }
PassRefPtr<StyleVariableData> copy() { return adoptRef(new StyleVariableData(*this)); }
bool operator==(const StyleVariableData& other) const;
bool operator!=(const StyleVariableData& other) const { return !(*this == other); }
void setVariable(const AtomicString& name, PassRefPtr<CSSVariableData> value) { m_data.set(name, value); }
CSSVariableData* getVariable(const AtomicString& name) const;
void removeVariable(const AtomicString& name) { return setVariable(name, nullptr); }
// This map will contain null pointers if variables are invalid due to
// cycles or referencing invalid variables without using a fallback.
// Note that this method is slow as a new map is constructed.
std::unique_ptr<HashMap<AtomicString, RefPtr<CSSVariableData>>> getVariables() const;
private:
StyleVariableData()
: m_root(nullptr)
{ }
StyleVariableData(StyleVariableData& other);
friend class CSSVariableResolver;
HashMap<AtomicString, RefPtr<CSSVariableData>> m_data;
RefPtr<StyleVariableData> m_root;
};
} // namespace blink
#endif // StyleVariableData_h
| danakj/chromium | third_party/WebKit/Source/core/style/StyleVariableData.h | C | bsd-3-clause | 1,693 | [
30522,
1013,
1013,
9385,
2325,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
1013,
2179,
1999,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import { browser, element, by } from 'protractor';
export class WebPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('ava-app h1')).getText();
}
}
| hebertpazian/SchedulingApp | web/e2e/app.po.ts | TypeScript | mit | 207 | [
30522,
12324,
1063,
16602,
1010,
5783,
1010,
2011,
1065,
2013,
1005,
4013,
6494,
16761,
1005,
1025,
9167,
2465,
4773,
13704,
1063,
22149,
3406,
1006,
1007,
1063,
2709,
16602,
1012,
2131,
1006,
1005,
1013,
1005,
1007,
1025,
1065,
2131,
28689... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// port.js
class SingleData {
constructor (port, order, type, value) {
this.port = port
this.order = order
this.type = type
this.value = value
}
}
export let inputVariables = []
export let countVariables = []
// Add a new port
export function Add (countInputPort) {
countInputPort++
inputVariables[countInputPort] = []
countVariables[countInputPort] = 0
$('div#inputPortList').append(
`<div class="list-group-item list-group-item-action" data-toggle="modal"
data-target="#addNewModal${countInputPort}" id="inputPort${countInputPort}">
Port ${countInputPort}</div>`
)
$(`#inputPort${countInputPort}`).click(function () {
portDetail(countInputPort)
})
return true
}
// Show Details of Port
export function portDetail (countInputPort) {
let container = ''
let order = countVariables[countInputPort]
// Show exist variables
for (let variable of inputVariables[countInputPort]) {
container += `<li class="list-group-item list-group-item-action">
<p class="mb-1 float-left text-primary">${variable.order + 1} </p>
<p class="mb-1 float-left variable-type"><label class="variable-type" order="${variable.order}">
${variable.type}</label> </p>
<p class="mb-1 float-left">
<input type="text" class="form-control variable-value" order="${variable.order}" value="${variable.value}">
</p>
</li>`
}
// Show variables list
$('div#modalArea').html(
`<div class="modal fade" id="addNewModal${countInputPort}" tabindex="-1" role="dialog"
aria-labelledby="addNewModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="addNewModalLabel">Port ${countInputPort}</h5>
<button class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-row" id="globalDt">
<select class="form-control col-md-7 mx-sm-3 mb-3" id="dt">
<option value="Numeric">Numeric</option>
<option value="Character">Character</option>
<option value="Enumeration">Enumeration</option>
<option value="Boolean">Boolean</option>
<option value="Set">Set</option>
<option value="Sequence">Sequence</option>
<option value="String">String</option>
<option value="Composite">Composite</option>
<option value="Product">Product</option>
<option value="Map">Map</option>
<option value="Union">Union</option>
<option value="Class">Class</option>
</select>
<button class="btn btn-outline-primary col-md-4 mb-3" id="addVariable">Add</button>
</div>
<!-- list of data types -->
<div>
<ul class="list-group" id="variables">
${container}
</ul>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="savePort">Save changes</button>
<button class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>`
)
// Add a new variables
$('button#addVariable').click(function () {
let selectedValue = $('select#dt').val()
console.log(order)
$('ul#variables').append(
`<li class="list-group-item list-group-item-action">
<p class="mb-1 float-left text-primary">${order + 1} </p>
<p class="mb-1 float-left variable-type"><label class="variable-type" order=${order}>
${selectedValue}</label> </p>
<p class="mb-1 float-left">
<input type="text" class="form-control variable-value" order="${order}" placeholder="${selectedValue}">
</p>
</li>`
)
order++
})
// Save port
$('button#savePort').click(function () {
let i
for (i = 0; i < order; i++) {
let type = $(`label.variable-type[order$="${i}"]`).text()
let value = $(`input.variable-value[order$="${i}"]`).val()
// console.log(type + '\n' + value)
inputVariables[countInputPort][i] = new SingleData(countInputPort, i, type, value)
console.log(`saved:
port: ${countInputPort}
order: ${i}
type: ${type}
value: ${value}`)
}
countVariables[countInputPort] = i
console.log('total: ' + countVariables[countInputPort])
})
}
export function Update (id, value) {
let editId = 'div#' + id
$(editId).text(value)
}
| cy92830/DataTypeGUI | src/scripts/port1.js | JavaScript | gpl-3.0 | 4,832 | [
30522,
1013,
1013,
3417,
1012,
1046,
2015,
2465,
25369,
6790,
1063,
9570,
2953,
1006,
3417,
1010,
2344,
1010,
2828,
1010,
3643,
1007,
1063,
2023,
1012,
3417,
1027,
3417,
2023,
1012,
2344,
1027,
2344,
2023,
1012,
2828,
1027,
2828,
2023,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
Copyright (C) 2003, 2005-2007 MySQL AB
All rights reserved. Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is also distributed with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with MySQL.
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, version 2.0, 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
*/
#include <signaldata/UtilPrepare.hpp>
bool
printUTIL_PREPARE_REQ(FILE* out, const Uint32 * data, Uint32 len, Uint16 rec)
{
UtilPrepareReq* sig = (UtilPrepareReq*)data;
fprintf(out, " senderRef: H'%.8x senderData: H'%.8x schemaTransId: H'%.8x\n",
sig->senderRef,
sig->senderData,
sig->schemaTransId);
return true;
}
bool
printUTIL_PREPARE_CONF(FILE* out, const Uint32 * data, Uint32 len, Uint16 rec)
{
UtilPrepareConf* sig = (UtilPrepareConf*)data;
fprintf(out, " senderData: H'%.8x prepareId: %d\n",
sig->senderData,
sig->prepareId);
return true;
}
bool
printUTIL_PREPARE_REF(FILE* out, const Uint32 * data, Uint32 len, Uint16 rec)
{
UtilPrepareRef* sig = (UtilPrepareRef*)data;
fprintf(out, " senderData: H'%.8x, ", sig->senderData);
fprintf(out, " error: %d, ", sig->errorCode);
fprintf(out, " errorMsg: ");
switch(sig->errorCode) {
case UtilPrepareRef::NO_ERROR:
fprintf(out, "No error");
break;
case UtilPrepareRef::PREPARE_SEIZE_ERROR:
fprintf(out, "Failed to seize Prepare record");
break;
case UtilPrepareRef::PREPARED_OPERATION_SEIZE_ERROR:
fprintf(out, "Failed to seize PreparedOperation record");
break;
case UtilPrepareRef::DICT_TAB_INFO_ERROR:
fprintf(out, "Failed to get table info from DICT");
break;
}
fprintf(out, "\n");
return true;
}
| greenlion/mysql-server | storage/ndb/src/common/debugger/signaldata/UtilPrepare.cpp | C++ | gpl-2.0 | 2,542 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2494,
1010,
2384,
1011,
2289,
2026,
2015,
4160,
2140,
11113,
2035,
2916,
9235,
1012,
2224,
2003,
3395,
2000,
6105,
3408,
1012,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
85... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>V8 API Reference Guide for node.js v0.10.46: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v0.10.46
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="inherits.html"><span>Class Hierarchy</span></a></li>
<li class="current"><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="functions.html"><span>All</span></a></li>
<li><a href="functions_func.html"><span>Functions</span></a></li>
<li><a href="functions_vars.html"><span>Variables</span></a></li>
<li><a href="functions_type.html"><span>Typedefs</span></a></li>
<li><a href="functions_enum.html"><span>Enumerations</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="functions.html#index_a"><span>a</span></a></li>
<li><a href="functions_b.html#index_b"><span>b</span></a></li>
<li><a href="functions_c.html#index_c"><span>c</span></a></li>
<li><a href="functions_d.html#index_d"><span>d</span></a></li>
<li><a href="functions_e.html#index_e"><span>e</span></a></li>
<li><a href="functions_f.html#index_f"><span>f</span></a></li>
<li><a href="functions_g.html#index_g"><span>g</span></a></li>
<li><a href="functions_h.html#index_h"><span>h</span></a></li>
<li><a href="functions_i.html#index_i"><span>i</span></a></li>
<li><a href="functions_k.html#index_k"><span>k</span></a></li>
<li><a href="functions_l.html#index_l"><span>l</span></a></li>
<li><a href="functions_m.html#index_m"><span>m</span></a></li>
<li><a href="functions_n.html#index_n"><span>n</span></a></li>
<li><a href="functions_o.html#index_o"><span>o</span></a></li>
<li><a href="functions_p.html#index_p"><span>p</span></a></li>
<li><a href="functions_r.html#index_r"><span>r</span></a></li>
<li><a href="functions_s.html#index_s"><span>s</span></a></li>
<li class="current"><a href="functions_t.html#index_t"><span>t</span></a></li>
<li><a href="functions_u.html#index_u"><span>u</span></a></li>
<li><a href="functions_v.html#index_v"><span>v</span></a></li>
<li><a href="functions_w.html#index_w"><span>w</span></a></li>
<li><a href="functions_~.html#index_~"><span>~</span></a></li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="contents">
<div class="textblock">Here is a list of all documented class members with links to the class documentation for each member:</div>
<h3><a class="anchor" id="index_t"></a>- t -</h3><ul>
<li>TakeSnapshot()
: <a class="el" href="classv8_1_1HeapProfiler.html#a39e6df3b54335e183ca57edae1dc78e7">v8::HeapProfiler</a>
</li>
<li>TerminateExecution()
: <a class="el" href="classv8_1_1V8.html#af7d845e6f55eb76085d5ff3601780986">v8::V8</a>
</li>
<li>ToArrayIndex()
: <a class="el" href="classv8_1_1Value.html#ab6b19a1e5aa5df50dfbb5d2ffa60bcdc">v8::Value</a>
</li>
<li>TryCatch()
: <a class="el" href="classv8_1_1TryCatch.html#adc9b1b11e73b0325df727914c348053d">v8::TryCatch</a>
</li>
<li>TurnOnAccessCheck()
: <a class="el" href="classv8_1_1Object.html#aa2299eda3240be1e76b7d5c2af7a6bbc">v8::Object</a>
</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
| v8-dox/v8-dox.github.io | fcb9145/html/functions_t.html | HTML | mit | 6,729 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* AndTinder v0.1 for Android
*
* @Author: Enrique López Mañas <eenriquelopez@gmail.com>
* http://www.lopez-manas.com
*
* TAndTinder is a native library for Android that provide a
* Tinder card like effect. A card can be constructed using an
* image and displayed with animation effects, dismiss-to-like
* and dismiss-to-unlike, and use different sorting mechanisms.
*
* AndTinder is compatible with API Level 13 and upwards
*
* @copyright: Enrique López Mañas
* @license: Apache License 2.0
*/
package assembly.giraff.andtinder.model;
public class Likes {
public enum Like {
None(0), Liked(1), Disliked(2);
public final int value;
private Like(int value) {
this.value = value;
}
public static Like fromValue(int value) {
for (Like style : Like.values()) {
if (style.value == value) {
return style;
}
}
return null;
}
}
}
| asm-products/giraff-android | app/src/main/java/assembly/giraff/andtinder/model/Likes.java | Java | agpl-3.0 | 1,017 | [
30522,
1013,
1008,
1008,
1008,
1998,
7629,
4063,
1058,
2692,
1012,
1015,
2005,
11924,
1008,
1008,
1030,
3166,
1024,
15769,
8685,
24951,
2015,
1026,
25212,
16118,
7413,
4135,
5051,
2480,
1030,
20917,
4014,
1012,
4012,
1028,
1008,
8299,
1024,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rest = require('./internal/rest');
var _rest2 = _interopRequireDefault(_rest);
var _initialParams = require('./internal/initialParams');
var _initialParams2 = _interopRequireDefault(_initialParams);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Returns a function that when called, calls-back with the values provided.
* Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to
* [`auto`]{@link module:ControlFlow.auto}.
*
* @name constant
* @static
* @memberOf module:Utils
* @method
* @category Util
* @param {...*} arguments... - Any number of arguments to automatically invoke
* callback with.
* @returns {AsyncFunction} Returns a function that when invoked, automatically
* invokes the callback with the previous given arguments.
* @example
*
* async.waterfall([
* async.constant(42),
* function (value, next) {
* // value === 42
* },
* //...
* ], callback);
*
* async.waterfall([
* async.constant(filename, "utf8"),
* fs.readFile,
* function (fileData, next) {
* //...
* }
* //...
* ], callback);
*
* async.auto({
* hostname: async.constant("https://server.net/"),
* port: findFreePort,
* launchServer: ["hostname", "port", function (options, cb) {
* startServer(options, cb);
* }],
* //...
* }, callback);
*/
exports.default = (0, _rest2.default)(function (values) {
var args = [null].concat(values);
return (0, _initialParams2.default)(function (ignoredArgs, callback) {
return callback.apply(this, args);
});
});
module.exports = exports['default']; | FOrmyown/LmWebsite | website/node_modules/async/constant.js | JavaScript | mit | 1,805 | [
30522,
1005,
2224,
9384,
1005,
1025,
4874,
1012,
9375,
21572,
4842,
3723,
1006,
14338,
1010,
1000,
1035,
1035,
9686,
5302,
8566,
2571,
1000,
1010,
1063,
3643,
1024,
2995,
1065,
1007,
1025,
13075,
1035,
2717,
1027,
5478,
1006,
1005,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
The apple is red,sev lal hai,
It is John’s apple, yeh John ka sev hai,
I give John the apple, Mein John ko yeh apple de raha hu,
We give him the apple, hum ushai (him) sev de rahe hai,
He gives it to John, Woh Johhn ko de raha(male tense) hai,
She gives it to him, Woh ushai de rahi(female tense) hai,
Common and useful phrases and vocabulary,
yeah thats right,Yehhee baddhe,
that is also present here, wohe hassa hezo,
mera nam Andrew hey, my name is anderw,
madhhu bahaut me tamham hey,
Hello, Namaste,
Goodbye, Alvida,
How are you?,App Caisey hain,
Do you understand?,App semaste hey (female) app semasta hey (male),
Do you understand English?,Kyaa app angrezie semester hey? (female),
Do you understand Hindi?,Kyaa app Hindi semestey hey?,
I understand hindi a little,Maim tora tora hindi semaste hey,
I do not understand very much,Maim bahaut zihidaa nihee samesta hoon (male),
I am not very well,Maim bahaut zihidaa nahee achaa hoon??,
I am well, Maim achaa hoon,
You are well,app achaa hook.,
You are not well,app achaa nahee hoon,
Very well thank you, maim bahaut zihada achaa hoon dyanivaad,
Not very well thank you, maim bahaut zihada achaa nahee hoon,
Where is the main street?, kyaa app raj put kidda hey?,
Where is Jay Singh Boulevard?kyaa app jay singh marg kidda hey?
also, bhi,
now, abhi,
later, badme,
over there, udda hey,
here, idea hey,
eat, khannaa (emphasis on K),
do, kannnnaaaa (emphasis on 'n'),
| yeahsmaggy/Georgian-Language | hindi_language.md | Markdown | mit | 1,427 | [
30522,
1996,
6207,
2003,
2417,
1010,
7367,
2615,
21348,
15030,
1010,
2009,
2003,
2198,
1521,
1055,
6207,
1010,
6300,
2232,
2198,
10556,
7367,
2615,
15030,
1010,
1045,
2507,
2198,
1996,
6207,
1010,
24182,
2198,
12849,
6300,
2232,
6207,
2139,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\ResourceBundle;
use Sylius\Bundle\ResourceBundle\DependencyInjection\Compiler\ResolveDoctrineTargetEntitiesPass;
use Sylius\Bundle\ResourceBundle\DependencyInjection\Driver\Exception\UnknownDriverException;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Abstract resource bundle.
*
* @author Arnaud Langlade <arn0d.dev@gmail.com>
* @author Gustavo Perdomo <gperdomor@gmail.com>
*/
abstract class AbstractResourceBundle extends Bundle implements ResourceBundleInterface
{
/**
* Configure format of mapping files.
*
* @var string
*/
protected $mappingFormat = ResourceBundleInterface::MAPPING_XML;
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container)
{
$interfaces = $this->getModelInterfaces();
if (!empty($interfaces)) {
$container->addCompilerPass(
new ResolveDoctrineTargetEntitiesPass(
$this->getBundlePrefix(),
$interfaces
)
);
}
if (null !== $this->getModelNamespace()) {
$className = get_class($this);
foreach ($className::getSupportedDrivers() as $driver) {
list($compilerPassClassName, $compilerPassMethod) = $this->getMappingCompilerPassInfo($driver);
if (class_exists($compilerPassClassName)) {
if (!method_exists($compilerPassClassName, $compilerPassMethod)) {
throw new InvalidConfigurationException(
"The 'mappingFormat' value is invalid, must be 'xml', 'yml' or 'annotation'."
);
}
switch ($this->mappingFormat) {
case ResourceBundleInterface::MAPPING_XML:
case ResourceBundleInterface::MAPPING_YAML:
$container->addCompilerPass($compilerPassClassName::$compilerPassMethod(
array($this->getConfigFilesPath() => $this->getModelNamespace()),
array(sprintf('%s.object_manager', $this->getBundlePrefix())),
sprintf('%s.driver.%s', $this->getBundlePrefix(), $driver)
));
break;
case ResourceBundleInterface::MAPPING_ANNOTATION:
$container->addCompilerPass($compilerPassClassName::$compilerPassMethod(
array($this->getModelNamespace()),
array($this->getConfigFilesPath()),
array(sprintf('%s.object_manager', $this->getBundlePrefix())),
sprintf('%s.driver.%s', $this->getBundlePrefix(), $driver)
));
break;
}
}
}
}
}
/**
* Return the prefix of the bundle.
*
* @return string
*/
protected function getBundlePrefix()
{
return Container::underscore(substr(strrchr(get_class($this), '\\'), 1, -6));
}
/**
* Target entities resolver configuration (Interface - Model).
*
* @return array
*/
protected function getModelInterfaces()
{
return array();
}
/**
* Return the directory where are stored the doctrine mapping.
*
* @return string
*/
protected function getDoctrineMappingDirectory()
{
return 'model';
}
/**
* Return the entity namespace.
*
* @return string
*/
protected function getModelNamespace()
{
return null;
}
/**
* Return mapping compiler pass class depending on driver.
*
* @param string $driverType
*
* @return array
*
* @throws UnknownDriverException
*/
protected function getMappingCompilerPassInfo($driverType)
{
switch ($driverType) {
case SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM:
$mappingsPassClassname = 'Doctrine\\Bundle\\MongoDBBundle\\DependencyInjection\\Compiler\\DoctrineMongoDBMappingsPass';
break;
case SyliusResourceBundle::DRIVER_DOCTRINE_ORM:
$mappingsPassClassname = 'Doctrine\\Bundle\\DoctrineBundle\\DependencyInjection\\Compiler\\DoctrineOrmMappingsPass';
break;
case SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM:
$mappingsPassClassname = 'Doctrine\\Bundle\\PHPCRBundle\\DependencyInjection\\Compiler\\DoctrinePhpcrMappingsPass';
break;
default:
throw new UnknownDriverException($driverType);
}
$compilerPassMethod = sprintf('create%sMappingDriver', ucfirst($this->mappingFormat));
return array($mappingsPassClassname, $compilerPassMethod);
}
/**
* Return the absolute path where are stored the doctrine mapping.
*
* @return string
*/
protected function getConfigFilesPath()
{
return sprintf(
'%s/Resources/config/doctrine/%s',
$this->getPath(),
strtolower($this->getDoctrineMappingDirectory())
);
}
}
| pfwd/Sylius | src/Sylius/Bundle/ResourceBundle/AbstractResourceBundle.php | PHP | mit | 5,743 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
25353,
15513,
7427,
1012,
1008,
1008,
1006,
1039,
1007,
22195,
2063,
18818,
24401,
15378,
20518,
7974,
5488,
1008,
1008,
2005,
1996,
2440,
9385,
1998,
6105,
259... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Redmine::Plugin.register :troubleshooting do
name 'Troubleshooting plugin'
author 'Fiddis & Tono'
description 'This is a plugin for Redmine to allow for simple troubleshooting functionality'
version '0.0.1'
url 'https://github.com/towisoft/redmine-troubleshooting'
author_url 'https://github.com/towisoft/redmine-troubleshooting'
project_module :troubleshooting do
permission :troubleshooting_view, {
:troubleshooting => :index,
:problems => [:index]
}
permission :troubleshooting_manage, :troubleshooting => :manage
end
menu :project_menu, :troubleshooting, { :controller => 'troubleshooting', :action => 'index' }, :caption => 'Troubleshooting', :after => :wiki, :param => :project_id
end
| towisoft/redmine-troubleshooting | init.rb | Ruby | gpl-2.0 | 736 | [
30522,
2417,
11233,
1024,
1024,
13354,
2378,
1012,
4236,
1024,
13460,
23416,
2075,
2079,
2171,
1005,
13460,
23416,
2075,
13354,
2378,
1005,
3166,
1005,
10882,
14141,
2483,
1004,
10228,
2080,
1005,
6412,
1005,
2023,
2003,
1037,
13354,
2378,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright (c) 2011, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* 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.
*/
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
#include <linux/platform_device.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/module.h>
#include <linux/debugfs.h>
#include <mach/sdio_al.h>
#define INPUT_SPEED 4800
#define OUTPUT_SPEED 4800
#define SDIO_TTY_MODULE_NAME "sdio_tty"
#define SDIO_TTY_MAX_PACKET_SIZE 4096
#define MAX_SDIO_TTY_DRV 1
#define MAX_SDIO_TTY_DEVS 2
#define MAX_SDIO_TTY_DEV_NAME_SIZE 25
/* Configurations per channel device */
/* CSVT */
#define SDIO_TTY_CSVT_DEV "sdio_tty_csvt_0"
#define SDIO_TTY_CSVT_TEST_DEV "sdio_tty_csvt_test_0"
#define SDIO_TTY_CH_CSVT "SDIO_CSVT"
enum sdio_tty_state {
TTY_INITIAL = 0,
TTY_REGISTERED = 1,
TTY_OPENED = 2,
TTY_CLOSED = 3,
};
enum sdio_tty_devices {
SDIO_CSVT,
SDIO_CSVT_TEST_APP,
};
static const struct platform_device_id sdio_tty_id_table[] = {
{ "SDIO_CSVT", SDIO_CSVT },
{ "SDIO_CSVT_TEST_APP", SDIO_CSVT_TEST_APP },
{ },
};
MODULE_DEVICE_TABLE(platform, sdio_tty_id_table);
struct sdio_tty {
struct sdio_channel *ch;
char *sdio_ch_name;
char tty_dev_name[MAX_SDIO_TTY_DEV_NAME_SIZE];
int device_id;
struct workqueue_struct *workq;
struct work_struct work_read;
wait_queue_head_t waitq;
struct tty_driver *tty_drv;
struct tty_struct *tty_str;
int debug_msg_on;
char *read_buf;
enum sdio_tty_state sdio_tty_state;
int is_sdio_open;
int tty_open_count;
int total_rx;
int total_tx;
};
static struct sdio_tty *sdio_tty[MAX_SDIO_TTY_DEVS];
#ifdef CONFIG_DEBUG_FS
struct dentry *sdio_tty_debug_root;
struct dentry *sdio_tty_debug_info;
#endif
#define DEBUG_MSG(sdio_tty_drv, x...) if (sdio_tty_drv->debug_msg_on) pr_info(x)
/*
* Enable sdio_tty debug messages
* By default the sdio_tty debug messages are turned off
*/
static int csvt_debug_msg_on;
module_param(csvt_debug_msg_on, int, 0);
static void sdio_tty_read(struct work_struct *work)
{
int ret = 0;
int read_avail = 0;
int left = 0;
int total_push = 0;
int num_push = 0;
struct sdio_tty *sdio_tty_drv = NULL;
sdio_tty_drv = container_of(work, struct sdio_tty, work_read);
if (!sdio_tty_drv) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL sdio_tty", __func__);
return ;
}
if (sdio_tty_drv->sdio_tty_state != TTY_OPENED) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: sdio_tty_state = %d",
__func__, sdio_tty_drv->sdio_tty_state);
return;
}
if (!sdio_tty_drv->read_buf) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL read_buf for dev %s",
__func__, sdio_tty_drv->tty_dev_name);
return;
}
/* Read the data from the SDIO channel as long as there is available
data */
while (1) {
if (test_bit(TTY_THROTTLED, &sdio_tty_drv->tty_str->flags)) {
DEBUG_MSG(sdio_tty_drv, SDIO_TTY_MODULE_NAME
": %s: TTY_THROTTLED bit is set for "
"dev %s, exit", __func__,
sdio_tty_drv->tty_dev_name);
return;
}
total_push = 0;
read_avail = sdio_read_avail(sdio_tty_drv->ch);
DEBUG_MSG(sdio_tty_drv, SDIO_TTY_MODULE_NAME
": %s: read_avail is %d for dev %s", __func__,
read_avail, sdio_tty_drv->tty_dev_name);
if (read_avail == 0) {
DEBUG_MSG(sdio_tty_drv, SDIO_TTY_MODULE_NAME
": %s: read_avail is 0 for dev %s",
__func__, sdio_tty_drv->tty_dev_name);
return;
}
if (read_avail > SDIO_TTY_MAX_PACKET_SIZE) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: read_avail(%d) is "
"bigger than SDIO_TTY_MAX_PACKET_SIZE(%d) "
"for dev %s", __func__, read_avail,
SDIO_TTY_MAX_PACKET_SIZE,
sdio_tty_drv->tty_dev_name);
return;
}
ret = sdio_read(sdio_tty_drv->ch,
sdio_tty_drv->read_buf,
read_avail);
if (ret < 0) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: sdio_read error(%d) "
"for dev %s", __func__, ret,
sdio_tty_drv->tty_dev_name);
return;
}
left = read_avail;
do {
num_push = tty_insert_flip_string(
sdio_tty_drv->tty_str,
sdio_tty_drv->read_buf+total_push,
left);
total_push += num_push;
left -= num_push;
tty_flip_buffer_push(sdio_tty_drv->tty_str);
} while (left != 0);
if (total_push != read_avail) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: failed, total_push"
"(%d) != read_avail(%d) for dev %s\n",
__func__, total_push, read_avail,
sdio_tty_drv->tty_dev_name);
}
tty_flip_buffer_push(sdio_tty_drv->tty_str);
sdio_tty_drv->total_rx += read_avail;
DEBUG_MSG(sdio_tty_drv, SDIO_TTY_MODULE_NAME ": %s: Rx: %d, "
"Total Rx = %d bytes for dev %s", __func__,
read_avail, sdio_tty_drv->total_rx,
sdio_tty_drv->tty_dev_name);
}
}
/**
* sdio_tty_write_room
*
* This is the write_room function of the tty driver.
*
* @tty: pointer to tty struct.
* @return free bytes for write.
*
*/
static int sdio_tty_write_room(struct tty_struct *tty)
{
int write_avail = 0;
struct sdio_tty *sdio_tty_drv = NULL;
if (!tty) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL tty", __func__);
return -ENODEV;
}
sdio_tty_drv = tty->driver_data;
if (!sdio_tty_drv) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL sdio_tty_drv",
__func__);
return -ENODEV;
}
if (sdio_tty_drv->sdio_tty_state != TTY_OPENED) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: sdio_tty_state = %d",
__func__, sdio_tty_drv->sdio_tty_state);
return -EPERM;
}
write_avail = sdio_write_avail(sdio_tty_drv->ch);
DEBUG_MSG(sdio_tty_drv, SDIO_TTY_MODULE_NAME ": %s: write_avail=%d "
"for dev %s", __func__, write_avail,
sdio_tty_drv->tty_dev_name);
return write_avail;
}
/**
* sdio_tty_write_callback
* this is the write callback of the tty driver.
*
* @tty: pointer to tty struct.
* @buf: buffer to write from.
* @count: number of bytes to write.
* @return bytes written or negative value on error.
*
* if destination buffer has not enough room for the incoming
* data, writes the possible amount of bytes .
*/
static int sdio_tty_write_callback(struct tty_struct *tty,
const unsigned char *buf, int count)
{
int write_avail = 0;
int len = count;
int ret = 0;
struct sdio_tty *sdio_tty_drv = NULL;
if (!tty) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL tty", __func__);
return -ENODEV;
}
sdio_tty_drv = tty->driver_data;
if (!sdio_tty_drv) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL sdio_tty_drv",
__func__);
return -ENODEV;
}
if (sdio_tty_drv->sdio_tty_state != TTY_OPENED) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: sdio_tty_state = %d",
__func__, sdio_tty_drv->sdio_tty_state);
return -EPERM;
}
DEBUG_MSG(sdio_tty_drv, SDIO_TTY_MODULE_NAME ": %s: Write Callback "
"called with %d bytes for dev %s\n", __func__, count,
sdio_tty_drv->tty_dev_name);
write_avail = sdio_write_avail(sdio_tty_drv->ch);
if (write_avail == 0) {
DEBUG_MSG(sdio_tty_drv, SDIO_TTY_MODULE_NAME ": %s: "
"write_avail is 0 for dev %s\n",
__func__, sdio_tty_drv->tty_dev_name);
return 0;
}
if (write_avail > SDIO_TTY_MAX_PACKET_SIZE) {
DEBUG_MSG(sdio_tty_drv, SDIO_TTY_MODULE_NAME ": %s: "
"write_avail(%d) is bigger than max packet "
"size(%d) for dev %s, setting to "
"max_packet_size\n", __func__, write_avail,
SDIO_TTY_MAX_PACKET_SIZE,
sdio_tty_drv->tty_dev_name);
write_avail = SDIO_TTY_MAX_PACKET_SIZE;
}
if (write_avail < count) {
DEBUG_MSG(sdio_tty_drv, SDIO_TTY_MODULE_NAME ": %s: "
"write_avail(%d) is smaller than required(%d) "
"for dev %s, writing only %d bytes\n",
__func__, write_avail, count,
sdio_tty_drv->tty_dev_name, write_avail);
len = write_avail;
}
ret = sdio_write(sdio_tty_drv->ch, buf, len);
if (ret) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: sdio_write failed for "
"dev %s, ret=%d\n", __func__,
sdio_tty_drv->tty_dev_name, ret);
return 0;
}
sdio_tty_drv->total_tx += len;
DEBUG_MSG(sdio_tty_drv, SDIO_TTY_MODULE_NAME ": %s: Tx: %d, "
"Total Tx = %d for dev %s", __func__, len,
sdio_tty_drv->total_tx, sdio_tty_drv->tty_dev_name);
return len;
}
static void sdio_tty_notify(void *priv, unsigned event)
{
struct sdio_tty *sdio_tty_drv = priv;
if (!sdio_tty_drv) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL sdio_tty_drv",
__func__);
return ;
}
if (sdio_tty_drv->sdio_tty_state != TTY_OPENED) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: sdio_tty_state = %d",
__func__, sdio_tty_drv->sdio_tty_state);
return;
}
DEBUG_MSG(sdio_tty_drv, SDIO_TTY_MODULE_NAME ": %s: event %d "
"received for dev %s\n", __func__, event,
sdio_tty_drv->tty_dev_name);
if (event == SDIO_EVENT_DATA_READ_AVAIL)
queue_work(sdio_tty_drv->workq, &sdio_tty_drv->work_read);
}
/**
* sdio_tty_open
* This is the open callback of the tty driver. it opens
* the sdio channel, and creates the workqueue.
*
* @tty: a pointer to the tty struct.
* @file: file descriptor.
* @return 0 on success or negative value on error.
*/
static int sdio_tty_open(struct tty_struct *tty, struct file *file)
{
int ret = 0;
int i = 0;
struct sdio_tty *sdio_tty_drv = NULL;
if (!tty) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL tty", __func__);
return -ENODEV;
}
for (i = 0; i < MAX_SDIO_TTY_DEVS; i++) {
if (sdio_tty[i] == NULL)
continue;
if (!strncmp(sdio_tty[i]->tty_dev_name, tty->name,
MAX_SDIO_TTY_DEV_NAME_SIZE)) {
sdio_tty_drv = sdio_tty[i];
break;
}
}
if (!sdio_tty_drv) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL sdio_tty_drv",
__func__);
return -ENODEV;
}
sdio_tty_drv->tty_open_count++;
if (sdio_tty_drv->sdio_tty_state == TTY_OPENED) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: tty dev(%s) is already open",
__func__, sdio_tty_drv->tty_dev_name);
return -EBUSY;
}
tty->driver_data = sdio_tty_drv;
sdio_tty_drv->tty_str = tty;
sdio_tty_drv->tty_str->low_latency = 1;
sdio_tty_drv->tty_str->icanon = 0;
set_bit(TTY_NO_WRITE_SPLIT, &sdio_tty_drv->tty_str->flags);
sdio_tty_drv->read_buf = kzalloc(SDIO_TTY_MAX_PACKET_SIZE, GFP_KERNEL);
if (sdio_tty_drv->read_buf == NULL) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: failed to allocate read_buf "
"for dev %s", __func__, sdio_tty_drv->tty_dev_name);
return -ENOMEM;
}
sdio_tty_drv->workq = create_singlethread_workqueue("sdio_tty_read");
if (!sdio_tty_drv->workq) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: failed to create workq "
"for dev %s", __func__, sdio_tty_drv->tty_dev_name);
return -ENOMEM;
}
// tty_state set before sdio_open for CSVT data fail issue, kyungjin.moon 20120309
sdio_tty_drv->sdio_tty_state = TTY_OPENED;
if (!sdio_tty_drv->is_sdio_open) {
ret = sdio_open(sdio_tty_drv->sdio_ch_name, &sdio_tty_drv->ch,
sdio_tty_drv, sdio_tty_notify);
if (ret < 0) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: sdio_open err=%d "
"for dev %s\n", __func__, ret,
sdio_tty_drv->tty_dev_name);
destroy_workqueue(sdio_tty_drv->workq);
return ret;
}
pr_info(SDIO_TTY_MODULE_NAME ": %s: SDIO_TTY channel(%s) "
"opened\n", __func__, sdio_tty_drv->sdio_ch_name);
sdio_tty_drv->is_sdio_open = 1;
} else {
/* If SDIO channel is already open try to read the data
* from the modem
*/
queue_work(sdio_tty_drv->workq, &sdio_tty_drv->work_read);
}
pr_info(SDIO_TTY_MODULE_NAME ": %s: TTY device(%s) opened\n",
__func__, sdio_tty_drv->tty_dev_name);
return ret;
}
/**
* sdio_tty_close
* This is the close callback of the tty driver. it requests
* the main thread to exit, and waits for notification of it.
* it also de-allocates the buffers, and unregisters the tty
* driver and device.
*
* @tty: a pointer to the tty struct.
* @file: file descriptor.
* @return None.
*/
static void sdio_tty_close(struct tty_struct *tty, struct file *file)
{
struct sdio_tty *sdio_tty_drv = NULL;
if (!tty) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL tty", __func__);
return;
}
sdio_tty_drv = tty->driver_data;
if (!sdio_tty_drv) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL sdio_tty_drv",
__func__);
return;
}
if (sdio_tty_drv->sdio_tty_state != TTY_OPENED) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: trying to close a "
"TTY device that was not opened\n", __func__);
return;
}
if (--sdio_tty_drv->tty_open_count != 0)
return;
sdio_tty_drv->sdio_tty_state = TTY_CLOSED;
flush_workqueue(sdio_tty_drv->workq);
destroy_workqueue(sdio_tty_drv->workq);
kfree(sdio_tty_drv->read_buf);
sdio_tty_drv->read_buf = NULL;
pr_info(SDIO_TTY_MODULE_NAME ": %s: SDIO_TTY device(%s) closed\n",
__func__, sdio_tty_drv->tty_dev_name);
}
static void sdio_tty_unthrottle(struct tty_struct *tty)
{
struct sdio_tty *sdio_tty_drv = NULL;
if (!tty) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL tty", __func__);
return;
}
sdio_tty_drv = tty->driver_data;
if (!sdio_tty_drv) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL sdio_tty_drv",
__func__);
return;
}
if (sdio_tty_drv->sdio_tty_state != TTY_OPENED) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: sdio_tty_state = %d",
__func__, sdio_tty_drv->sdio_tty_state);
return;
}
queue_work(sdio_tty_drv->workq, &sdio_tty_drv->work_read);
return;
}
static const struct tty_operations sdio_tty_ops = {
.open = sdio_tty_open,
.close = sdio_tty_close,
.write = sdio_tty_write_callback,
.write_room = sdio_tty_write_room,
.unthrottle = sdio_tty_unthrottle,
};
int sdio_tty_init_tty(char *tty_name, char *sdio_ch_name,
enum sdio_tty_devices device_id, int debug_msg_on)
{
int ret = 0;
int i = 0;
struct device *tty_dev = NULL;
struct sdio_tty *sdio_tty_drv = NULL;
sdio_tty_drv = kzalloc(sizeof(struct sdio_tty), GFP_KERNEL);
if (sdio_tty_drv == NULL) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: failed to allocate sdio_tty "
"for dev %s", __func__, tty_name);
return -ENOMEM;
}
for (i = 0; i < MAX_SDIO_TTY_DEVS; i++) {
if (sdio_tty[i] == NULL) {
sdio_tty[i] = sdio_tty_drv;
break;
}
}
if (i == MAX_SDIO_TTY_DEVS) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: tty dev(%s) creation failed,"
" max limit(%d) reached.", __func__, tty_name,
MAX_SDIO_TTY_DEVS);
kfree(sdio_tty_drv);
return -ENODEV;
}
snprintf(sdio_tty_drv->tty_dev_name, MAX_SDIO_TTY_DEV_NAME_SIZE,
"%s%d", tty_name, 0);
sdio_tty_drv->sdio_ch_name = sdio_ch_name;
sdio_tty_drv->device_id = device_id;
pr_info(SDIO_TTY_MODULE_NAME ": %s: dev=%s, id=%d, channel=%s\n",
__func__, sdio_tty_drv->tty_dev_name, sdio_tty_drv->device_id,
sdio_tty_drv->sdio_ch_name);
INIT_WORK(&sdio_tty_drv->work_read, sdio_tty_read);
sdio_tty_drv->tty_drv = alloc_tty_driver(MAX_SDIO_TTY_DRV);
if (!sdio_tty_drv->tty_drv) {
pr_err(SDIO_TTY_MODULE_NAME ": %s - tty_drv is NULL for dev %s",
__func__, sdio_tty_drv->tty_dev_name);
kfree(sdio_tty_drv);
return -ENODEV;
}
sdio_tty_drv->tty_drv->name = tty_name;
sdio_tty_drv->tty_drv->owner = THIS_MODULE;
sdio_tty_drv->tty_drv->driver_name = "SDIO_tty";
/* uses dynamically assigned dev_t values */
sdio_tty_drv->tty_drv->type = TTY_DRIVER_TYPE_SERIAL;
sdio_tty_drv->tty_drv->subtype = SERIAL_TYPE_NORMAL;
sdio_tty_drv->tty_drv->flags = TTY_DRIVER_REAL_RAW
| TTY_DRIVER_DYNAMIC_DEV
| TTY_DRIVER_RESET_TERMIOS;
/* initializing the tty driver */
sdio_tty_drv->tty_drv->init_termios = tty_std_termios;
sdio_tty_drv->tty_drv->init_termios.c_cflag =
B4800 | CS8 | CREAD | HUPCL | CLOCAL;
sdio_tty_drv->tty_drv->init_termios.c_ispeed = INPUT_SPEED;
sdio_tty_drv->tty_drv->init_termios.c_ospeed = OUTPUT_SPEED;
tty_set_operations(sdio_tty_drv->tty_drv, &sdio_tty_ops);
ret = tty_register_driver(sdio_tty_drv->tty_drv);
if (ret) {
put_tty_driver(sdio_tty_drv->tty_drv);
pr_err(SDIO_TTY_MODULE_NAME ": %s: tty_register_driver() "
"failed for dev %s\n", __func__,
sdio_tty_drv->tty_dev_name);
sdio_tty_drv->tty_drv = NULL;
kfree(sdio_tty_drv);
return -ENODEV;
}
tty_dev = tty_register_device(sdio_tty_drv->tty_drv, 0, NULL);
if (IS_ERR(tty_dev)) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: tty_register_device() "
"failed for dev %s\n", __func__,
sdio_tty_drv->tty_dev_name);
tty_unregister_driver(sdio_tty_drv->tty_drv);
put_tty_driver(sdio_tty_drv->tty_drv);
kfree(sdio_tty_drv);
return -ENODEV;
}
sdio_tty_drv->sdio_tty_state = TTY_REGISTERED;
if (debug_msg_on) {
pr_info(SDIO_TTY_MODULE_NAME ": %s: turn on debug msg for %s",
__func__, sdio_tty_drv->tty_dev_name);
sdio_tty_drv->debug_msg_on = debug_msg_on;
}
return 0;
}
int sdio_tty_uninit_tty(void *sdio_tty_handle)
{
int ret = 0;
int i = 0;
struct sdio_tty *sdio_tty_drv = sdio_tty_handle;
if (!sdio_tty_drv) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL sdio_tty_drv",
__func__);
return -ENODEV;
}
if (sdio_tty_drv->sdio_tty_state == TTY_OPENED) {
flush_workqueue(sdio_tty_drv->workq);
destroy_workqueue(sdio_tty_drv->workq);
kfree(sdio_tty_drv->read_buf);
sdio_tty_drv->read_buf = NULL;
}
if (sdio_tty_drv->sdio_tty_state != TTY_INITIAL) {
tty_unregister_device(sdio_tty_drv->tty_drv, 0);
ret = tty_unregister_driver(sdio_tty_drv->tty_drv);
if (ret) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: "
"tty_unregister_driver() failed for dev %s\n",
__func__, sdio_tty_drv->tty_dev_name);
}
put_tty_driver(sdio_tty_drv->tty_drv);
sdio_tty_drv->sdio_tty_state = TTY_INITIAL;
sdio_tty_drv->tty_drv = NULL;
}
for (i = 0; i < MAX_SDIO_TTY_DEVS; i++) {
if (sdio_tty[i] == NULL)
continue;
if (sdio_tty[i]->device_id == sdio_tty_drv->device_id) {
sdio_tty[i] = NULL;
break;
}
}
DEBUG_MSG(sdio_tty_drv, SDIO_TTY_MODULE_NAME ": %s: Freeing sdio_tty "
"structure, dev=%s", __func__,
sdio_tty_drv->tty_dev_name);
kfree(sdio_tty_drv);
return 0;
}
static int sdio_tty_probe(struct platform_device *pdev)
{
char *device_name = NULL;
char *channel_name = NULL;
int debug_msg_on = 0;
int ret = 0;
enum sdio_tty_devices device_id = 0;
#if 0
const struct platform_device_id *id = platform_get_device_id(pdev);
enum sdio_tty_devices device_id = id->driver_data;
char *device_name = NULL;
char *channel_name = NULL;
int debug_msg_on = 0;
int ret = 0;
pr_debug(SDIO_TTY_MODULE_NAME ": %s for %s", __func__, pdev->name);
switch (device_id) {
case SDIO_CSVT:
device_name = SDIO_TTY_CSVT_DEV;
channel_name = SDIO_TTY_CH_CSVT;
debug_msg_on = csvt_debug_msg_on;
break;
case SDIO_CSVT_TEST_APP:
device_name = SDIO_TTY_CSVT_TEST_DEV;
channel_name = SDIO_TTY_CH_CSVT;
debug_msg_on = csvt_debug_msg_on;
break;
default:
pr_err(SDIO_TTY_MODULE_NAME ": %s Invalid device:%s, id:%d",
__func__, pdev->name, device_id);
ret = -ENODEV;
break;
}
#endif
if (!strcmp(pdev->name, SDIO_TTY_CH_CSVT))
{
device_name = SDIO_TTY_CSVT_DEV;
channel_name = SDIO_TTY_CH_CSVT;
debug_msg_on = csvt_debug_msg_on;
device_id = SDIO_CSVT;
}
if (device_name) {
ret = sdio_tty_init_tty(device_name, channel_name,
device_id, debug_msg_on);
if (ret) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: sdio_tty_init_tty "
"failed for dev:%s", __func__, device_name);
}
}
return ret;
}
static int sdio_tty_remove(struct platform_device *pdev)
{
#if 0
const struct platform_device_id *id = platform_get_device_id(pdev);
#endif
enum sdio_tty_devices device_id = 0;
struct sdio_tty *sdio_tty_drv = NULL;
int i = 0;
int ret = 0;
if (!strcmp(pdev->name, SDIO_TTY_CH_CSVT))
{
device_id = SDIO_CSVT;
}
else
{
pr_err(SDIO_TTY_MODULE_NAME ": %s: error no device for %s ",__func__, pdev->name);
return -ENODEV;
}
pr_debug(SDIO_TTY_MODULE_NAME ": %s for %s", __func__, pdev->name);
for (i = 0; i < MAX_SDIO_TTY_DEVS; i++) {
if (sdio_tty[i] == NULL)
continue;
if (sdio_tty[i]->device_id == device_id) {
sdio_tty_drv = sdio_tty[i];
break;
}
}
if (!sdio_tty_drv) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: NULL sdio_tty_drv",
__func__);
return -ENODEV;
}
ret = sdio_tty_uninit_tty(sdio_tty_drv);
if (ret) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: sdio_tty_uninit_tty "
"failed for %s", __func__, pdev->name);
}
return ret;
}
static struct platform_driver sdio_tty_pdrv = {
.probe = sdio_tty_probe,
.remove = sdio_tty_remove,
// .id_table = sdio_tty_id_table,
.driver = {
.name = "SDIO_CSVT",
.owner = THIS_MODULE,
},
};
#ifdef CONFIG_DEBUG_FS
void sdio_tty_print_info(void)
{
int i = 0;
for (i = 0; i < MAX_SDIO_TTY_DEVS; i++) {
if (sdio_tty[i] == NULL)
continue;
pr_info(SDIO_TTY_MODULE_NAME ": %s: Total Rx=%d, Tx = %d "
"for dev %s", __func__, sdio_tty[i]->total_rx,
sdio_tty[i]->total_tx, sdio_tty[i]->tty_dev_name);
}
}
static int tty_debug_info_open(struct inode *inode, struct file *file)
{
file->private_data = inode->i_private;
return 0;
}
static ssize_t tty_debug_info_write(struct file *file,
const char __user *buf, size_t count, loff_t *ppos)
{
sdio_tty_print_info();
return count;
}
const struct file_operations tty_debug_info_ops = {
.open = tty_debug_info_open,
.write = tty_debug_info_write,
};
#endif
/*
* Module Init.
*
* Register SDIO TTY driver.
*
*/
static int __init sdio_tty_init(void)
{
int ret = 0;
ret = platform_driver_register(&sdio_tty_pdrv);
if (ret) {
pr_err(SDIO_TTY_MODULE_NAME ": %s: platform_driver_register "
"failed", __func__);
}
#ifdef CONFIG_DEBUG_FS
else {
sdio_tty_debug_root = debugfs_create_dir("sdio_tty", NULL);
if (sdio_tty_debug_root) {
sdio_tty_debug_info = debugfs_create_file(
"sdio_tty_debug",
S_IRUGO | S_IWUGO,
sdio_tty_debug_root,
NULL,
&tty_debug_info_ops);
}
}
#endif
return ret;
};
/*
* Module Exit.
*
* Unregister SDIO TTY driver.
*
*/
static void __exit sdio_tty_exit(void)
{
#ifdef CONFIG_DEBUG_FS
debugfs_remove(sdio_tty_debug_info);
debugfs_remove(sdio_tty_debug_root);
#endif
platform_driver_unregister(&sdio_tty_pdrv);
}
module_init(sdio_tty_init);
module_exit(sdio_tty_exit);
MODULE_DESCRIPTION("SDIO TTY");
MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Maya Erez <merez@codeaurora.org>");
| SlimRoms/kernel_samsung_msm8660 | arch/arm/mach-msm/sdio_tty.c | C | gpl-2.0 | 22,254 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2249,
1010,
1996,
11603,
3192,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
2023,
2565,
2003,
2489,
4007,
1025,
2017,
2064,
2417,
2923,
3089,
8569,
2618,
2009,
1998,
1013,
2030,
19933,
1008,
2009,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
require "optparse"
require_relative "refactorers/refactor_where_first_to_find_by.rb"
require_relative "refactorers/refactor_where_first_not_called_expectations.rb"
require_relative "refactorers/refactor_where_first_mocks.rb"
require_relative "refactorers/refactor_where_first_strict_mocks.rb"
options = { overwrite: true }
OptionParser.new do |opts|
opts.banner = "Usage: refactorer.rb [options]"
opts.on("-d", "--dry-run", "Write changes to console, rather than to source files.") do |_v|
options[:overwrite] = false
end
end.parse!
source_dir = ARGV.first || "."
base = File.expand_path(File.join("**", "*.rb"), source_dir)
puts "Refactoring in source directory: #{base}"
[
# Refactor "where(...).first -> find_by(...)"
RefactorWhereFirstToFindBy,
# Refactor ".expect(:where).never" to ".expect(:find_by).never"
RefactorWhereFirstNotCalledExpectations,
# Refactor ".expect(:where).return([X])" to ".expect(:find_by).return(X)"
# and ".stubs(:where).return([X])" to ".stubs(:find_by).return(X)"
RefactorWhereFirstMocks,
# Refactor ".expect(:where).with(...).return([X])" to ".expect(:find_by).with(...).return(X)"
RefactorWhereFirstStrictMocks
].each do |refactorer|
refactorer.new.refactor_files(Dir.glob(base)) do |path, refactored, changes|
if changes.empty?
puts "No changes in #{path}"
else
puts "In #{path}:"
changes.each do |change|
puts "\tAt #{change.original_position}, inserting:\n\t\t#{change.transformed_code}"
puts ""
end
File.open(path, "w") { |f| f.write(refactored) } if options[:overwrite]
end
end
end
| mutiny/metamorpher | examples/refactorings/rails/where_first/app.rb | Ruby | mit | 1,626 | [
30522,
5478,
1000,
23569,
19362,
3366,
1000,
5478,
1035,
5816,
1000,
25416,
18908,
5686,
2869,
1013,
25416,
18908,
2953,
1035,
2073,
1035,
2034,
1035,
2000,
1035,
2424,
1035,
2011,
1012,
21144,
1000,
5478,
1035,
5816,
1000,
25416,
18908,
56... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.trino.execution;
import com.google.common.util.concurrent.ListenableFuture;
import io.trino.Session;
import io.trino.connector.CatalogName;
import io.trino.execution.warnings.WarningCollector;
import io.trino.metadata.Metadata;
import io.trino.metadata.QualifiedObjectName;
import io.trino.metadata.TableHandle;
import io.trino.security.AccessControl;
import io.trino.spi.connector.ColumnHandle;
import io.trino.spi.connector.ColumnMetadata;
import io.trino.spi.type.Type;
import io.trino.spi.type.TypeNotFoundException;
import io.trino.sql.tree.AddColumn;
import io.trino.sql.tree.ColumnDefinition;
import io.trino.sql.tree.Expression;
import io.trino.transaction.TransactionManager;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import static com.google.common.util.concurrent.Futures.immediateVoidFuture;
import static io.trino.metadata.MetadataUtil.createQualifiedObjectName;
import static io.trino.metadata.MetadataUtil.getRequiredCatalogHandle;
import static io.trino.spi.StandardErrorCode.COLUMN_ALREADY_EXISTS;
import static io.trino.spi.StandardErrorCode.COLUMN_TYPE_UNKNOWN;
import static io.trino.spi.StandardErrorCode.NOT_SUPPORTED;
import static io.trino.spi.StandardErrorCode.TABLE_NOT_FOUND;
import static io.trino.spi.StandardErrorCode.TYPE_NOT_FOUND;
import static io.trino.spi.connector.ConnectorCapabilities.NOT_NULL_COLUMN_CONSTRAINT;
import static io.trino.sql.NodeUtils.mapFromProperties;
import static io.trino.sql.ParameterUtils.parameterExtractor;
import static io.trino.sql.analyzer.SemanticExceptions.semanticException;
import static io.trino.sql.analyzer.TypeSignatureTranslator.toTypeSignature;
import static io.trino.type.UnknownType.UNKNOWN;
import static java.util.Locale.ENGLISH;
public class AddColumnTask
implements DataDefinitionTask<AddColumn>
{
@Override
public String getName()
{
return "ADD COLUMN";
}
@Override
public ListenableFuture<Void> execute(
AddColumn statement,
TransactionManager transactionManager,
Metadata metadata,
AccessControl accessControl,
QueryStateMachine stateMachine,
List<Expression> parameters,
WarningCollector warningCollector)
{
Session session = stateMachine.getSession();
QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getName());
Optional<TableHandle> tableHandle = metadata.getTableHandle(session, tableName);
if (tableHandle.isEmpty()) {
if (!statement.isTableExists()) {
throw semanticException(TABLE_NOT_FOUND, statement, "Table '%s' does not exist", tableName);
}
return immediateVoidFuture();
}
CatalogName catalogName = getRequiredCatalogHandle(metadata, session, statement, tableName.getCatalogName());
accessControl.checkCanAddColumns(session.toSecurityContext(), tableName);
Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle.get());
ColumnDefinition element = statement.getColumn();
Type type;
try {
type = metadata.getType(toTypeSignature(element.getType()));
}
catch (TypeNotFoundException e) {
throw semanticException(TYPE_NOT_FOUND, element, "Unknown type '%s' for column '%s'", element.getType(), element.getName());
}
if (type.equals(UNKNOWN)) {
throw semanticException(COLUMN_TYPE_UNKNOWN, element, "Unknown type '%s' for column '%s'", element.getType(), element.getName());
}
if (columnHandles.containsKey(element.getName().getValue().toLowerCase(ENGLISH))) {
if (!statement.isColumnNotExists()) {
throw semanticException(COLUMN_ALREADY_EXISTS, statement, "Column '%s' already exists", element.getName());
}
return immediateVoidFuture();
}
if (!element.isNullable() && !metadata.getConnectorCapabilities(session, catalogName).contains(NOT_NULL_COLUMN_CONSTRAINT)) {
throw semanticException(NOT_SUPPORTED, element, "Catalog '%s' does not support NOT NULL for column '%s'", catalogName.getCatalogName(), element.getName());
}
Map<String, Expression> sqlProperties = mapFromProperties(element.getProperties());
Map<String, Object> columnProperties = metadata.getColumnPropertyManager().getProperties(
catalogName,
tableName.getCatalogName(),
sqlProperties,
session,
metadata,
accessControl,
parameterExtractor(statement, parameters),
true);
ColumnMetadata column = ColumnMetadata.builder()
.setName(element.getName().getValue())
.setType(type)
.setNullable(element.isNullable())
.setComment(element.getComment())
.setProperties(columnProperties)
.build();
metadata.addColumn(session, tableHandle.get(), column);
return immediateVoidFuture();
}
}
| Praveen2112/presto | core/trino-main/src/main/java/io/trino/execution/AddColumnTask.java | Java | apache-2.0 | 5,732 | [
30522,
1013,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
1996,
6105,
1012,
1008,
2017,
2089,
6855,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var searchData=
[
['rgb',['Rgb',['../structarctic_1_1_rgb.html',1,'arctic']]],
['rgba',['Rgba',['../structarctic_1_1easy_1_1_rgba.html',1,'arctic::easy']]]
];
| t800danya/desert-engine | doc/html/search/classes_5.js | JavaScript | mit | 163 | [
30522,
13075,
3945,
2850,
2696,
1027,
1031,
1031,
1005,
1054,
18259,
1005,
1010,
1031,
1005,
1054,
18259,
1005,
1010,
1031,
1005,
1012,
1012,
1013,
2358,
6820,
25572,
11890,
4588,
1035,
1015,
1035,
1015,
1035,
1054,
18259,
1012,
16129,
1005... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hatfield.EnviroData.Core;
using Hatfield.EnviroData.WQDataProfile;
namespace Hatfield.EnviroData.DataAcquisition.ESDAT.Converters
{
public abstract class MeasurementResultValueMapperBase : ESDATMapperBase<MeasurementResultValue>
{
public MeasurementResultValueMapperBase(ESDATDuplicateChecker duplicateChecker, IWQDefaultValueProvider WQDefaultValueProvider, WayToHandleNewData wayToHandleNewData)
: base(duplicateChecker, WQDefaultValueProvider, wayToHandleNewData)
{
}
}
}
| gvassas/Hatfield.EnviroData.DataAcquisition | Source/hatfield.envirodata.dataacquisition.esdat/Converters/ODM2Mappers/MeasurementResultValueMapperBase.cs | C# | apache-2.0 | 619 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
2478,
26853,
1012,
4372,
21663,
13390,
2696,
1012,
4563,
1025,
2478,
26853,
1012,
4372,
21663,
13390,
269... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* File: el_string.c
* Copyright: (c)2015 Gerrard de Jonge <development.gdj@netvisit.nl>
* License: GPLv2 (see file COPYING)
*
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "el_defs.h"
#include "el_string.h"
///
///
///
///
void clearMarker(char * s, char marker)
{
char * pos;
if ((pos = strchr(s, marker)) != NULL) {
*pos = '\0';
}
}
///
/// Remove all leading spaces of string
/// Returns pointer to string, which should be
/// the same as the original
///
char * leftTrim(char * str)
{
char * t;
int i = 0;
while (isspace(str[i]))
i++;
t = xStrDup(&str[i]);
strcpy(str, t);
if (t) {
free(t);
}
return str;
}
///
/// Remove all trailing spaces of string str
/// Returns pointer to string, which should be
/// the same as the original
///
char * rightTrim(char * str)
{
int pos;
pos = strlen(str) - 1;
while (isspace(str[pos]) && pos >= 0) {
str[pos] = '\0';
pos--;
}
return str;
}
///
/// Remove all leading and trailing spaces of string str
/// Returns pointer to string, which should be
/// the same as the original
///
char * trim(char * str)
{
return leftTrim(rightTrim(str));
}
///
/// Alloc memory for size chars
/// Return pointer to allocated memory or
/// exits on failure
///
void * xMalloc(const size_t size)
{
void * temp;
if ((temp = malloc(size)) == NULL) {
printf("Out of memory\n");
exit(EXIT_FAILURE);
}
return temp;
}
///
/// Allocate memory for count elements of size chars and set them to 0
/// Return pointer to allocated memory or
/// exits on failure
///
void * xCalloc(const size_t count, const size_t eltsize)
{
void * temp = xMalloc(count * eltsize);
memset (temp, 0, count * eltsize);
return temp;
}
///
/// Allocates new string and copies string str to it
/// Return pointer to allocated memory or exit
/// if allocation went wrong
///
void * xStrDup(const char * str)
{
char * temp;
if ((temp = calloc(strlen(str)+1, 1)) == NULL) {
printf("Out of memory\n");
exit(EXIT_FAILURE);
} else {
strcpy(temp, str);
}
return temp;
}
///
///
///
///
char loCase(const char c)
{
return ('A' <= c && c <= 'Z') ? c -'A' + 'a' : c;
}
///
///
///
///
char upCase(const char c)
{
return ('a' <= c && c <= 'z') ? c - 'a' + 'A' : c;
}
///
///
///
///
void upperCase(char * str)
{
if (str) {
for ( ; *str != '\0'; str++) {
*str = upCase(*str);
}
}
}
///
///
///
///
void lowerCase(char * str)
{
if (str) {
for ( ; *str != '\0'; str++) {
*str = loCase(*str);
}
}
}
///
/// Remove all spaces from a given string
///
///
void strTransform(char * line)
{
char * str;
char newstr[LINESIZE] = {""};
while ((str = strtok(line, " ")) != NULL) {
strcat(newstr, str);
}
strcpy(line, newstr);
lowerCase(line);
}
/// Check if a line is isEmpty
/// Return true if empty otherwise return false
bool isEmpty(const char const * line)
{
return *line == '\0' ? true : false;
}
// end of el_string.c
| gerrarddejonge/el-calc | src/el_string.c | C | gpl-2.0 | 2,995 | [
30522,
1013,
1008,
1008,
5371,
1024,
3449,
1035,
5164,
1012,
1039,
1008,
9385,
1024,
1006,
1039,
1007,
2325,
16216,
29599,
2139,
18528,
2063,
1026,
2458,
1012,
1043,
2094,
3501,
1030,
5658,
11365,
4183,
1012,
17953,
1028,
1008,
6105,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package ncbiutils
import (
"bufio"
"bytes"
"io"
"os"
"path/filepath"
"strings"
)
var GCTABLES map[string]*GeneticCode
type Taxa struct {
Id string // node id in GenBank taxonomy database
Name string // the unique variant of names
Parent string // parent node id in GenBank taxonomy database
Rank string // rank of this node (superkingdom, kingdom ...)
EmblCode string // locus-name prefix
Division string // division
InheritedDivFlag string // 1 if node inherits division from parent
GeneticCode *GeneticCode // genetic code
InheriteGCFlag string // 1 if node inherits genetic code from parent
MitochondrialGC *GeneticCode // mitochondrial genetic code
InheriteMGCFlag string // 1 if node inherits mitochondrial genetic code from parent
Comments string // free-text comments and citations
}
// read taxonomy from NCBI taxonomy database dmp
// returns a map[id]Taxa
func ReadTaxas(dir string) map[string]Taxa {
taxaMap := make(map[string]Taxa)
namesFilePath := filepath.Join(dir, "names.dmp")
f, err := os.Open(namesFilePath)
if err != nil {
panic(err)
}
defer f.Close()
nameMap := getNames(f)
gcFilePath := filepath.Join(dir, "gencode.dmp")
f, err = os.Open(gcFilePath)
if err != nil {
panic(err)
}
defer f.Close()
gencodes := ReadGeneticCodes(f)
nodesFilePath := filepath.Join(dir, "nodes.dmp")
f, err = os.Open(nodesFilePath)
if err != nil {
panic(err)
}
defer f.Close()
r := bufio.NewReader(f)
for {
l, err := r.ReadString('\n')
if err != nil {
if err != io.EOF {
panic(err)
}
break
}
fields := strings.Split(l, "\t|\t")
id := fields[0]
parent := fields[1]
rank := fields[2]
embl := fields[3]
division := fields[4]
idivflag := fields[5]
gcid := fields[6]
igcflag := fields[7]
mgcid := fields[8]
imgcflag := fields[9]
comments := fields[12]
taxa := Taxa{
Id: id,
Parent: parent,
Rank: rank,
EmblCode: embl,
Division: division,
InheritedDivFlag: idivflag,
GeneticCode: gencodes[gcid],
InheriteGCFlag: igcflag,
MitochondrialGC: gencodes[mgcid],
InheriteMGCFlag: imgcflag,
Comments: comments,
Name: nameMap[id],
}
taxaMap[id] = taxa
}
return taxaMap
}
type GeneticCode struct {
Id string // GenBank genetic code id
Abbreviation string // genetic code name abbreviation
Name string // genetic code name
Table map[string]byte // translate table for this genetic code
Starts []string // start codon for this genetic code
FFCodons map[string]bool // four-fold codons
}
func GeneticCodes() (gcMap map[string]*GeneticCode) {
buf := bytes.NewBufferString(GCSTRING)
gcMap = ReadGeneticCodes(buf)
return
}
func ReadGeneticCodes(f io.Reader) (gcMap map[string]*GeneticCode) {
gcMap = make(map[string]*GeneticCode)
rd := bufio.NewReader(f)
for {
l, err := rd.ReadString('\n')
if err != nil {
if err != io.EOF {
panic(err)
}
break
}
fields := strings.Split(l, "\t|\t")
id := fields[0]
abb := fields[1]
name := fields[2]
cde := fields[3]
starts := fields[4]
table, ffs := getTables(cde[:64])
startCodons := getStartCodons(starts[:64])
gc := GeneticCode{
Id: id,
Abbreviation: abb,
Name: name,
Table: table,
Starts: startCodons,
FFCodons: ffs,
}
gcMap[id] = &gc
}
return
}
func getTables(s string) (table map[string]byte, ffCodons map[string]bool) {
table = make(map[string]byte)
nn := "TCAG"
l := 0
for i := 0; i < 4; i++ {
for j := 0; j < 4; j++ {
for k := 0; k < 4; k++ {
c := string([]byte{nn[i], nn[j], nn[k]})
table[c] = s[l]
l++
}
}
}
ffCodons = make(map[string]bool)
for i := 0; i < 4; i++ {
for j := 0; j < 4; j++ {
ff := true
aa := table[string([]byte{nn[i], nn[j], nn[0]})]
for k := 0; k < 4; k++ {
c := string([]byte{nn[i], nn[j], nn[k]})
if table[c] != aa {
ff = false
break
}
}
for k := 0; k < 4; k++ {
c := string([]byte{nn[i], nn[j], nn[k]})
ffCodons[c] = ff
}
}
}
return
}
func getStartCodons(s string) (starts []string) {
nn := "TCAG"
l := 0
for i := 0; i < 4; i++ {
for j := 0; j < 4; j++ {
for k := 0; k < 4; k++ {
c := string([]byte{nn[i], nn[j], nn[k]})
if s[l] == 'M' {
starts = append(starts, c)
}
l++
}
}
}
return
}
// returns a map[id][scientific name]
func getNames(f io.Reader) map[string]string {
nameMap := make(map[string]string)
r := bufio.NewReader(f)
for {
l, err := r.ReadString('\n')
if err != nil {
if err != io.EOF {
panic(err)
}
break
}
fields := strings.Split(l, "\t|\t")
id := fields[0]
name := fields[1]
class := strings.Split(strings.TrimSpace(fields[3]), "\t|")[0]
if class == "scientific name" {
nameMap[id] = name
}
}
return nameMap
}
| mingzhi/ncbiutils | taxa.go | GO | mit | 5,076 | [
30522,
7427,
13316,
5638,
21823,
4877,
12324,
1006,
1000,
20934,
8873,
2080,
1000,
1000,
27507,
1000,
1000,
22834,
1000,
1000,
9808,
1000,
1000,
4130,
1013,
5371,
15069,
1000,
1000,
7817,
1000,
1007,
13075,
1043,
23576,
2015,
4949,
1031,
51... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Copyright (c) 2013, Ruslan Baratov
# All rights reserved.
# !!! DO NOT PLACE HEADER GUARDS HERE !!!
include(hunter_add_version)
include(hunter_cacheable)
include(hunter_download)
include(hunter_pick_scheme)
include(hunter_cmake_args)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
"1.7.0-hunter"
URL
"https://github.com/hunter-packages/gtest/archive/v1.7.0-hunter.tar.gz"
SHA1
1ed1c26d11fb592056c1cb912bd3c784afa96eaa
)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
"1.7.0-hunter-1"
URL
"https://github.com/hunter-packages/gtest/archive/v1.7.0-hunter-1.tar.gz"
SHA1
0cb1dcf75e144ad052d3f1e4923a7773bf9b494f
)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
"1.7.0-hunter-2"
URL
"https://github.com/hunter-packages/gtest/archive/v1.7.0-hunter-2.tar.gz"
SHA1
e62b2ef70308f63c32c560f7b6e252442eed4d57
)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
"1.7.0-hunter-3"
URL
"https://github.com/hunter-packages/gtest/archive/v1.7.0-hunter-3.tar.gz"
SHA1
fea7d3020e20f059255484c69755753ccadf6362
)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
"1.7.0-hunter-4"
URL
"https://github.com/hunter-packages/gtest/archive/v1.7.0-hunter-4.tar.gz"
SHA1
9b439c0c25437a083957b197ac6905662a5d901b
)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
"1.7.0-hunter-5"
URL
"https://github.com/hunter-packages/gtest/archive/v1.7.0-hunter-5.tar.gz"
SHA1
796804df3facb074087a4d8ba6f652e5ac69ad7f
)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
"1.7.0-hunter-6"
URL
"https://github.com/hunter-packages/gtest/archive/v1.7.0-hunter-6.tar.gz"
SHA1
64b93147abe287da8fe4e18cfd54ba9297dafb82
)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
"1.7.0-hunter-7"
URL
"https://github.com/hunter-packages/gtest/archive/v1.7.0-hunter-7.tar.gz"
SHA1
19b5c98747768bcd0622714f2ed40f17aee406b2
)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
"1.7.0-hunter-8"
URL
"https://github.com/hunter-packages/gtest/archive/v1.7.0-hunter-8.tar.gz"
SHA1
ac4d2215aa1b1d745a096e5e3b2dbe0c0f229ea5
)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
"1.7.0-hunter-9"
URL
"https://github.com/hunter-packages/gtest/archive/v1.7.0-hunter-9.tar.gz"
SHA1
8a47fe9c4e550f4ed0e2c05388dd291a059223d9
)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
"1.7.0-hunter-10"
URL
"https://github.com/hunter-packages/gtest/archive/v1.7.0-hunter-10.tar.gz"
SHA1
374e6dbe8619ab467c6b1a0b470a598407b172e9
)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
"1.7.0-hunter-11"
URL
"https://github.com/hunter-packages/gtest/archive/v1.7.0-hunter-11.tar.gz"
SHA1
c6ae948ca2bea1d734af01b1069491b00933ed31
)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
1.8.0-hunter-p2
URL
"https://github.com/hunter-packages/googletest/archive/1.8.0-hunter-p2.tar.gz"
SHA1
93148cb8850abe78b76ed87158fdb6b9c48e38c4
)
hunter_add_version(
PACKAGE_NAME
GTest
VERSION
1.8.0-hunter-p5
URL https://github.com/hunter-packages/googletest/archive/1.8.0-hunter-p5.tar.gz
SHA1 3325aa4fc8b30e665c9f73a60f19387b7db36f85
)
if(HUNTER_GTest_VERSION VERSION_LESS 1.8.0)
set(_gtest_license "LICENSE")
else()
set(_gtest_license "googletest/LICENSE")
endif()
hunter_cmake_args(
GTest
CMAKE_ARGS
HUNTER_INSTALL_LICENSE_FILES=${_gtest_license}
)
hunter_pick_scheme(DEFAULT url_sha1_cmake)
hunter_cacheable(GTest)
hunter_download(PACKAGE_NAME GTest PACKAGE_INTERNAL_DEPS_ID 1)
| x10mind/hunter | cmake/projects/GTest/hunter.cmake | CMake | bsd-2-clause | 3,722 | [
30522,
1001,
9385,
1006,
1039,
1007,
2286,
1010,
22949,
5802,
3347,
10610,
2615,
1001,
2035,
2916,
9235,
1012,
1001,
999,
999,
999,
2079,
2025,
2173,
20346,
4932,
2182,
999,
999,
999,
2421,
1006,
4477,
1035,
5587,
1035,
2544,
1007,
2421,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.