text stringlengths 2 1.04M | meta dict |
|---|---|
static unsigned int windowNumber = 0;
TextPreviewWindow::TextPreviewWindow()
{
setWindowTitle("Code Viewer");
InitUI();
}
void TextPreviewWindow::InitUI()
{
qtTextEdit = new QTextEdit(this);
qtTextEdit->setBaseSize(QSize(300, 200));
qtTextEdit->setReadOnly(true);
QFont font;
QFontMetrics metrics(font);
qtTextEdit->setTabStopWidth(8 * metrics.width(' '));
qtLayout->addWidget(qtTextEdit);
GUI::Set(QT_INSTACE::TEXT_PREVIEW, (void*)this);
}
void TextPreviewWindow::RenderText(const char* text)
{
qtTextEdit->setPlainText(text);
}
| {
"content_hash": "eca25684fe0bb0cf9082f6bb18857026",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 53,
"avg_line_length": 19.571428571428573,
"alnum_prop": 0.7390510948905109,
"repo_name": "ReDEnergy/GameEngine",
"id": "5c46cd3e55ae18b6aa1cddc2204bd032e3f7bffe",
"size": "708",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "GameProject/Source/Editor/Windows/TextEditor/TextPreview.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "3298188"
},
{
"name": "C++",
"bytes": "3588271"
},
{
"name": "GLSL",
"bytes": "74587"
},
{
"name": "Objective-C",
"bytes": "10437"
}
],
"symlink_target": ""
} |
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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.
// ----------------------------------------------------------------------------------
using Microsoft.Azure.Commands.Sql.DataSync.Cmdlet;
using Microsoft.Azure.Commands.Sql.DataSync.Model;
using Microsoft.Azure.Commands.Sql.Test.Utilities;
using Microsoft.Azure.ServiceManagemenet.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Newtonsoft.Json.Linq;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.Azure.Commands.Sql.Test.UnitTests
{
public class AzureSqlDataSyncTests
{
public AzureSqlDataSyncTests(ITestOutputHelper output)
{
XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
}
[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void ParseSyncGroupSchema()
{
string schema = @"{
""mastersyncMemberNAME"": ""masterMember"",
""Tables"": [
{
""QUOTEDNAME"": ""testTable"",
""columns"": [
{
""QuotedName"": ""testColumn""
}
]
}
]
}";
var cmdlet = new UpdateAzureSqlSyncGroup();
AzureSqlSyncGroupSchemaModel schemaModel = AzureSqlSyncGroupCmdletBase.ConstructSchemaFromJObject(JObject.Parse(schema));
Assert.Equal("masterMember", schemaModel.MasterSyncMemberName);
Assert.Equal(1, schemaModel.Tables.Count);
Assert.Equal("testTable", schemaModel.Tables[0].QuotedName);
Assert.Equal(1, schemaModel.Tables[0].Columns.Count);
Assert.Equal("testColumn", schemaModel.Tables[0].Columns[0].QuotedName);
}
}
}
| {
"content_hash": "ffc0f43ddb8aa2095ebb700b290b2df9",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 133,
"avg_line_length": 40.885245901639344,
"alnum_prop": 0.590617481956696,
"repo_name": "naveedaz/azure-powershell",
"id": "db6b848ae21b039e0782f6b7eb04c22ae4dc089c",
"size": "2496",
"binary": false,
"copies": "6",
"ref": "refs/heads/preview",
"path": "src/ResourceManager/Sql/Commands.Sql.Test/UnitTests/AzureSqlDataSyncTests.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "18388"
},
{
"name": "C#",
"bytes": "60116091"
},
{
"name": "HTML",
"bytes": "209"
},
{
"name": "JavaScript",
"bytes": "4979"
},
{
"name": "PHP",
"bytes": "41"
},
{
"name": "PowerShell",
"bytes": "7094905"
},
{
"name": "Ruby",
"bytes": "398"
},
{
"name": "Shell",
"bytes": "50"
},
{
"name": "Smalltalk",
"bytes": "2510"
},
{
"name": "XSLT",
"bytes": "6114"
}
],
"symlink_target": ""
} |
import { EventEmitter } from "events";
import { Duplex, WritableOptions, Writable } from "stream";
import OutgoingFrameStream = require("./OutgoingFrameStream");
declare class Socket extends EventEmitter {
constructor(transportSocket: Duplex, options: Socket.SocketOptions);
destroy(exception: Error): void;
hasFinishedOutput(): boolean;
setVersion(version: string): void;
getTransportSocket(): Duplex;
setCommandHandler(command: string, handler: Socket.commandHandler): void;
setCommandHandlers(handlers: Socket.CommandHandlers): void;
setUnknownCommandHandler(handler: () => void): void;
sendFrame(command: string, headers?: any, streamOptions?: WritableOptions): Writable;
getHeartbeat(): Socket.Heartbeat;
setHeartbeat(heartbeat: Socket.Heartbeat): void;
createTransportError(message?: string | Error): Socket.SocketError;
createProtocolError(message?: string | Error): Socket.SocketError;
createApplicationError(message?: string | Error): Socket.SocketError;
}
export = Socket;
declare namespace Socket {
type Heartbeat = number[];
type commandHandler = (frame: Writable) => void;
interface CommandHandlers {
[command: string]: (frame: Writable, callback: commandHandler) => void;
}
interface SocketOptions {
commandHandlers?: CommandHandlers;
unknownCommand?: () => void;
outgoingFrameStream?: OutgoingFrameStream;
heartbeat?: Heartbeat;
heartbeatDelayMargin?: number;
heartbeatOutputMargin?: number;
resetDisconnect?: boolean;
}
interface SocketError extends Error {
isTransportError: () => boolean;
isProtocolError: () => boolean;
isApplicationError: () => boolean;
}
}
| {
"content_hash": "0402c5fdd4fab50e6be8a935ea063ac3",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 89,
"avg_line_length": 32.14545454545455,
"alnum_prop": 0.7002262443438914,
"repo_name": "AgentME/DefinitelyTyped",
"id": "ca0023bd59296c4546acdcc5d4462bab3d3341e3",
"size": "1768",
"binary": false,
"copies": "52",
"ref": "refs/heads/master",
"path": "types/stompit/lib/Socket.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "10652407"
},
{
"name": "Ruby",
"bytes": "40"
},
{
"name": "Shell",
"bytes": "60"
},
{
"name": "TypeScript",
"bytes": "11370242"
}
],
"symlink_target": ""
} |
package org.apache.geode.cache.lucene.internal.filesystem;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.UUID;
import org.apache.geode.internal.DataSerializableFixedID;
import org.apache.geode.internal.Version;
/**
* The key for a single chunk on a file stored within a region.
*/
public class ChunkKey implements DataSerializableFixedID {
UUID fileId;
int chunkId;
/**
* Constructor used for serialization only.
*/
public ChunkKey() {}
ChunkKey(UUID fileName, int chunkId) {
this.fileId = fileName;
this.chunkId = chunkId;
}
/**
* @return the fileName
*/
public UUID getFileId() {
return fileId;
}
/**
* @return the chunkId
*/
public int getChunkId() {
return chunkId;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + fileId.hashCode();
result = prime * result + chunkId;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ChunkKey)) {
return false;
}
ChunkKey other = (ChunkKey) obj;
if (chunkId != other.chunkId) {
return false;
}
if (fileId == null) {
if (other.fileId != null) {
return false;
}
} else if (!fileId.equals(other.fileId)) {
return false;
}
return true;
}
@Override
public Version[] getSerializationVersions() {
return null;
}
@Override
public int getDSFID() {
return LUCENE_CHUNK_KEY;
}
@Override
public void toData(DataOutput out) throws IOException {
out.writeInt(chunkId);
out.writeLong(fileId.getMostSignificantBits());
out.writeLong(fileId.getLeastSignificantBits());
}
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
chunkId = in.readInt();
long high = in.readLong();
long low = in.readLong();
fileId = new UUID(high, low);
}
}
| {
"content_hash": "d6ab410c3df7d1b759a29149261bc09c",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 81,
"avg_line_length": 19.91346153846154,
"alnum_prop": 0.6383389666827619,
"repo_name": "smanvi-pivotal/geode",
"id": "b96f3cf77f5cbc7cc66ad51a8a2fc9376d2c11e2",
"size": "2860",
"binary": false,
"copies": "4",
"ref": "refs/heads/develop",
"path": "geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/filesystem/ChunkKey.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "106707"
},
{
"name": "Groovy",
"bytes": "2928"
},
{
"name": "HTML",
"bytes": "3998074"
},
{
"name": "Java",
"bytes": "26700079"
},
{
"name": "JavaScript",
"bytes": "1781013"
},
{
"name": "Ruby",
"bytes": "6751"
},
{
"name": "Shell",
"bytes": "21891"
}
],
"symlink_target": ""
} |
using System;
using Clide;
using EnvDTE;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using VSLangProj;
public static partial class AdapterFacade
{
/// <summary>
/// Adapts a <see cref="Solution"/> to an <see cref="ISolutionNode"/>.
/// </summary>
/// <returns>The <see cref="ISolutionNode"/> or <see langword="null"/> if conversion is not possible.</returns>
public static ISolutionNode AsSolutionNode(this Solution solution) =>
RunOnMainThread(() => solution.GetServiceLocator().GetExport<IAdapterService>().Adapt(solution).As<ISolutionNode>());
/// <summary>
/// Adapts a <see cref="Solution"/> to an <see cref="IVsSolution"/>.
/// </summary>
/// <returns>The <see cref="IVsSolution"/> or <see langword="null"/> if conversion is not possible.</returns>
public static IVsSolution AsVsSolution(this Solution solution) =>
RunOnMainThread(() => solution.GetServiceLocator().GetExport<IAdapterService>().Adapt(solution).As<IVsSolution>());
/// <summary>
/// Adapts a <see cref="Project"/> to an <see cref="IProjectNode"/>.
/// </summary>
/// <returns>The <see cref="IProjectNode"/> or <see langword="null"/> if conversion is not possible.</returns>
public static IProjectNode AsProjectNode(this Project project) =>
RunOnMainThread(() => project.GetServiceLocator().GetExport<IAdapterService>().Adapt(project).As<IProjectNode>());
/// <summary>
/// Adapts a <see cref="Project"/> to an <see cref="IVsProject"/>.
/// </summary>
/// <returns>The <see cref="IVsProject"/> or <see langword="null"/> if conversion is not possible.</returns>
public static IVsProject AsVsProject(this Project project) =>
RunOnMainThread(() => project.GetServiceLocator().GetExport<IAdapterService>().Adapt(project).As<IVsProject>());
/// <summary>
/// Adapts a <see cref="Project"/> to an <see cref="IVsProject"/>.
/// </summary>
/// <returns>The <see cref="IVsHierarchy"/> or <see langword="null"/> if conversion is not possible.</returns>
public static IVsHierarchy AsVsHierarchy(this Project project) =>
RunOnMainThread(() => project.GetServiceLocator().GetExport<IAdapterService>().Adapt(project).As<IVsHierarchy>());
/// <summary>
/// Adapts a <see cref="Project"/> to an <see cref="IVsProject"/>.
/// </summary>
/// <returns>The <see cref="IVsHierarchyItem"/> or <see langword="null"/> if conversion is not possible.</returns>
public static IVsHierarchyItem AsVsHierarchyItem(this Project project) =>
RunOnMainThread(() => project.GetServiceLocator().GetExport<IAdapterService>().Adapt(project).As<IVsHierarchyItem>());
/// <summary>
/// Adapts a <see cref="Project"/> to a <see cref="VSProject"/>.
/// </summary>
/// <returns>The <see cref="VSProject"/> or <see langword="null"/> if conversion is not possible.</returns>
public static VSProject AsVsLangProject(this Project project) =>
RunOnMainThread(() => project.GetServiceLocator().GetExport<IAdapterService>().Adapt(project).As<VSProject>());
/// <summary>
/// Adapts a <see cref="ProjectItem"/> to an <see cref="IItemNode"/>.
/// </summary>
/// <returns>The <see cref="IItemNode"/> or <see langword="null"/> if conversion is not possible.</returns>
public static IItemNode AsItemNode(this ProjectItem item) =>
RunOnMainThread(() => item.DTE.GetServiceLocator().GetExport<IAdapterService>().Adapt(item).As<IItemNode>());
/// <summary>
/// Adapts a <see cref="ProjectItem"/> to an <see cref="VSProjectItem"/>.
/// </summary>
/// <returns>The <see cref="VSProjectItem"/> or <see langword="null"/> if conversion is not possible.</returns>
public static VSProjectItem AsVsLangItem(this ProjectItem item) =>
RunOnMainThread(() => item.DTE.GetServiceLocator().GetExport<IAdapterService>().Adapt(item).As<VSProjectItem>());
/// <summary>
/// Adapts a <see cref="ProjectItem"/> to an <see cref="IVsHierarchyItem"/>.
/// </summary>
/// <returns>The <see cref="IVsHierarchyItem"/> or <see langword="null"/> if conversion is not possible.</returns>
public static IVsHierarchyItem AsVsHierarchyItem(this ProjectItem item) =>
RunOnMainThread(() => item.ContainingProject.GetServiceLocator().GetExport<IAdapterService>().Adapt(item).As<IVsHierarchyItem>());
/// <summary>
/// Adapts a <see cref="Project"/> to a <see cref="VSProject"/>.
/// </summary>
/// <returns>The <see cref="VSProject"/> or <see langword="null"/> if conversion is not possible.</returns>
public static Microsoft.Build.Evaluation.Project AsMsBuildProject(this Project project) =>
RunOnMainThread(() => project.GetServiceLocator().GetExport<IAdapterService>().Adapt(project).As<Microsoft.Build.Evaluation.Project>());
static T RunOnMainThread<T>(Func<T> provider) =>
ThreadHelper.JoinableTaskFactory.Run(async () =>
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
return provider();
});
}
| {
"content_hash": "7bbcc02afe893b768c5172e78b10b8c4",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 144,
"avg_line_length": 53.8,
"alnum_prop": 0.6738407356681667,
"repo_name": "tondat/clide",
"id": "43f9e9ed76f9ffb0cac8c48c3d20df1028d57560",
"size": "5113",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/Clide.Interfaces/Adapters/DteAdapterFacade.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "5170"
},
{
"name": "C",
"bytes": "261"
},
{
"name": "C#",
"bytes": "568142"
},
{
"name": "C++",
"bytes": "1658"
},
{
"name": "F#",
"bytes": "1729"
},
{
"name": "Visual Basic",
"bytes": "1210"
}
],
"symlink_target": ""
} |
/*
* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 License: none (public domain)
*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
vertical-align: baseline;
outline: 0;
}
/*
* HTML5 display-role reset for older browsers
*/
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display: block;
}
body, html {
line-height: 1.125em;
font-size: 14px;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after, q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/*
* YUI 3.18.1 (build f7e7bcb) Copyright 2014 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/
*/
html {
color: black;
background: white;
}
input, textarea {
margin: 0;
padding: 0;
}
img, legend {
border: 0;
}
address, caption, cite, code, dfn, em, strong, th, var {
font-style: normal;
}
h1, h2, h3, h4, h5, h6 {
font-weight: normal;
}
input, textarea, select {
font-family: inherit;
font-size: inherit;
font-weight: inherit;
*font-size: 100%;
vertical-align: middle;
}
legend {
color: black;
}
/*
* html5doctor.com Reset Stylesheet v1.6.1 Last Updated: 2010-09-17 Author: Richard Clark - http://richclarkdesign.com Twitter: @rich_clark
*/
ins {
background-color: #ffff99;
color: black;
text-decoration: none;
}
mark {
background-color: #ffff99;
color: black;
font-style: italic;
font-weight: bold;
}
del {
text-decoration: line-through;
}
abbr[title], dfn[title] {
border-bottom: 1px dotted;
cursor: help;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #333333;
margin: 1em 0;
padding: 0;
}
/*
* ! normalize.css v3.0.2 | MIT License | git.io/normalize
*/
audio, canvas, progress, video {
display: inline-block;
vertical-align: baseline;
}
audio:not([controls]) {
display: none;
height: 0;
}
[hidden], template {
display: none;
}
a:active, a:hover {
outline: 0;
}
abbr[title] {
border-bottom: 1px dotted;
}
svg:not(:root) {
overflow: hidden;
}
pre {
overflow: auto;
}
code, kbd, pre, samp {
font-family: monospace, monospace;
font-size: 1em;
}
button, input, optgroup, select, textarea {
color: inherit;
}
button, html input[type="button"], input[type="reset"], input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
}
button[disabled], html input[disabled] {
cursor: default;
}
button::-moz-focus-inner, input::-moz-focus-inner {
border: 0;
padding: 0;
}
input[type="checkbox"], input[type="radio"] {
box-sizing: border-box;
padding: 0;
}
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
input[type="search"] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
webkit-box-sizing: content-box;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
fieldset {
border: 1px solid silver;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
| {
"content_hash": "0b15c755fa1b7e9e4e734b14575b6eaf",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 492,
"avg_line_length": 15.966101694915254,
"alnum_prop": 0.6539278131634819,
"repo_name": "magiraldooc/gestion-riesgo",
"id": "cbc52370c6b23d097d506d315828405d6135543d",
"size": "3768",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "web/resources/css/reset.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "376"
},
{
"name": "CSS",
"bytes": "136428"
},
{
"name": "HTML",
"bytes": "750234"
},
{
"name": "JavaScript",
"bytes": "468987"
},
{
"name": "PHP",
"bytes": "448529"
},
{
"name": "Shell",
"bytes": "3336"
}
],
"symlink_target": ""
} |
package com.metech.firefly.ui.activity.BookingFlight.ManageFamilyAndFriend;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import com.metech.firefly.AnalyticsApplication;
import com.metech.firefly.MainFragmentActivity;
import com.metech.firefly.R;
import com.metech.firefly.ui.activity.FragmentContainerActivity;
import com.google.android.gms.analytics.Tracker;
import butterknife.ButterKnife;
//import android.view.WindowManager;
public class EditFamilyFriendsActivity extends MainFragmentActivity implements FragmentContainerActivity {
private Tracker mTracker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ButterKnife.inject(this);
AnalyticsApplication application = (AnalyticsApplication) getApplication();
mTracker = application.getDefaultTracker();
Bundle bundle = getIntent().getExtras();
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.main_content, EditFamilyFriendsFragment.newInstance(bundle)).commit();
setMenuButton();
hideTitle();
}
@Override
public void onResume() {
super.onResume();
//mTracker.setScreenName("Itinenary Detail" + "A");
//mTracker.send(new HitBuilders.ScreenViewBuilder().build());
}
@Override
public int getFragmentContainerId() {
return R.id.main_activity_fragment_container;
}
}
| {
"content_hash": "a0c5503ae3432c0a8d451b3d191bf864",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 126,
"avg_line_length": 31.541666666666668,
"alnum_prop": 0.7430647291941875,
"repo_name": "imalpasha/meV2",
"id": "4fd7bdb705cbe8fb755213c1a7f1b155a05ac7ec",
"size": "1514",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "rhymecity/src/main/java/com/metech/firefly/ui/activity/BookingFlight/ManageFamilyAndFriend/EditFamilyFriendsActivity.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1846894"
}
],
"symlink_target": ""
} |
<?php
namespace App\Models\Auth\Traits\Method;
/**
* Trait UserMethod.
*/
trait UserMethod
{
/**
* @return mixed
*/
public function canChangeEmail()
{
return config('access.users.change_email');
}
/**
* @return bool
*/
public function canChangePassword()
{
return ! app('session')->has(config('access.socialite_session_name'));
}
/**
* @param bool $size
*
* @return bool|\Illuminate\Contracts\Routing\UrlGenerator|mixed|string
* @throws \Illuminate\Container\EntryNotFoundException
*/
public function getPicture($size = false)
{
switch ($this->avatar_type) {
case 'gravatar':
if (! $size) {
$size = config('gravatar.default.size');
}
return gravatar()->get($this->email, ['size' => $size]);
case 'storage':
return url('storage/'.$this->avatar_location);
}
$social_avatar = $this->providers()->where('provider', $this->avatar_type)->first();
if ($social_avatar && strlen($social_avatar->avatar)) {
return $social_avatar->avatar;
}
return false;
}
/**
* @param $provider
*
* @return bool
*/
public function hasProvider($provider)
{
foreach ($this->providers as $p) {
if ($p->provider == $provider) {
return true;
}
}
return false;
}
/**
* @return mixed
*/
public function isAdmin()
{
return $this->hasRole(config('access.users.admin_role'));
}
/**
* @return bool
*/
public function isActive()
{
return $this->active == 1;
}
/**
* @return bool
*/
public function isConfirmed()
{
return $this->confirmed == 1;
}
/**
* @return bool
*/
public function isPending()
{
return config('access.users.requires_approval') && $this->confirmed == 0;
}
}
| {
"content_hash": "c54cf545747434a6b70b772bd6e04ce2",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 92,
"avg_line_length": 20.465346534653467,
"alnum_prop": 0.5050798258345428,
"repo_name": "openadult/oats",
"id": "3619ec85ed3664c83b5547c9c3910e64b3110d37",
"size": "2067",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/Models/Auth/Traits/Method/UserMethod.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "1018"
},
{
"name": "HTML",
"bytes": "125384"
},
{
"name": "PHP",
"bytes": "1222130"
},
{
"name": "Vue",
"bytes": "380"
}
],
"symlink_target": ""
} |
define(
[
//core
'jquery',
'underscore',
'backbone',
//dmb
'dbm',
//global config
'cfg'
],
function($,_, Backbone, dbm, cfg)
{
//define & return module
return {
//define props
participantModel : null,
participantInfo : null,
//get current participant id
getCurrentParticipantId: function()
{
//return current
return dbm.participantsCollection.findWhere({isActive: true}).get('participantId');
},
//get current participant model
getCurrentParticipantInfo: function(infoArr)
{
//set initial value of returnedObj
var returnedObj = null;
//if participant model is present
if (this.participantModel instanceof Backbone.Model)
{
//passed parameter must be an object
infoArr = (_.size(infoArr)) ? infoArr : _.keys(this.participantModel.toJSON());
//if we participantInfo is not cached
if (this.participantInfo == null) {
//create participant's info obj to be returned
returnedObj = _.pick(this.participantModel.toJSON(), infoArr);
} else {
//create participant's info obj to be returned
returnedObj = _.pick(this.participantInfo, infoArr);
}
} else {
//return null
return null;
}
//return participant's info obj
return (_.size(infoArr) > 1) ? returnedObj : _(returnedObj).values()[0];
},
//check participant's credentials against API endpoint
checkCredentials: function(participantInfo)
{
//prepare data to be sent through ajax
var data = {id: participantInfo.participantEmail, password: participantInfo.participantPassword};
//return $ajax promise
return $.ajax(
{
method : "GET",
url : cfg.app.apiEndpoints.login,
async : true,
dataType : 'json',
data : data
})
},
//do login
login: function(participantInfo)
{
//cache this
var _this = this;
//create deferred obj
var $deferred = $.Deferred();
//check credentials
this.checkCredentials(participantInfo)
//credentials are ok
.done(_.bind(function(data)
{
//fetch participants collection from localstorage
dbm.participantsCollection.fetch({
//participants' collection is fetched
success: function(participants)
{
//set isActive attribute to false for every participant in participants' collection
participants.each(function(m){m.save({isActive: false})});
//try to find participant in participants' collection
_this.participantModel = participants.findWhere({participantEmail: participantInfo.participantEmail});
//if participant isn't found
if (! _this.participantModel) {
//create participant and persist it to localstorage
_this.participantModel = participants.create(
{
participantId : data.participant_id,
participantEmail : participantInfo.participantEmail,
participantStatusId : data.participant_status_id,
sessionId : data.session_id,
sessionDescription : data.session_description,
sessionDescriptionDetailed : data.session_description_detailed,
sessionStatusId : data.session_status_id,
sessionParticipantId : data.session_participant_id,
showFeedback : (data.showFeedback) ? data.showFeedback : false,
isActive : true,
time : Date.now(),
battery : JSON.parse(data.battery)
});
} else {
//set isActive attribute to true for current participant
_this.participantModel.save({isActive: true});
}
//cache participant info (adding password but not persisting it into localstorage) for later use
_this.participantInfo =
_.extend(_this.participantModel.toJSON(), {participantPassword: participantInfo.participantPassword});
}
});
//return participant attributes or null
return $deferred.resolve(this.getCurrentParticipantInfo());
}, this))
//credentials are not ok
.error(function(data)
{
//login was not successful
return $deferred.resolve(data);
});
//return deferred promise to caller
return $deferred.promise();
}
};
}
); | {
"content_hash": "1e6b64046ad9f236498d9dc98984df8c",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 134,
"avg_line_length": 38.61490683229814,
"alnum_prop": 0.4410487373331189,
"repo_name": "alkaest2002/gzts-lab",
"id": "ab9a7ee7ef91b5a2f4ca1e151ac6834d0c42c041",
"size": "6217",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web/app/assets/js/app/prt.js",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "358"
},
{
"name": "Batchfile",
"bytes": "1030"
},
{
"name": "CSS",
"bytes": "60588"
},
{
"name": "HTML",
"bytes": "775"
},
{
"name": "JavaScript",
"bytes": "225919"
},
{
"name": "PHP",
"bytes": "601506"
},
{
"name": "Smarty",
"bytes": "4108"
}
],
"symlink_target": ""
} |
package com.idehub.GoogleAnalyticsBridge;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMapKeySetIterator;
import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;
import com.google.android.gms.analytics.ecommerce.Product;
import com.google.android.gms.analytics.ecommerce.ProductAction;
import java.util.HashMap;
import java.util.Map;
public class GoogleAnalyticsBridge extends ReactContextBaseJavaModule {
public GoogleAnalyticsBridge(ReactApplicationContext reactContext, String trackingId) {
super(reactContext);
_trackingId = trackingId;
}
private final String _trackingId;
@Override
public String getName() {
return "GoogleAnalyticsBridge";
}
HashMap<String, Tracker> mTrackers = new HashMap<String, Tracker>();
synchronized Tracker getTracker(String trackerId) {
if (!mTrackers.containsKey(trackerId)) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(getReactApplicationContext());
analytics.setLocalDispatchPeriod(20);
Tracker t = analytics.newTracker(trackerId);
t.enableExceptionReporting(true);
mTrackers.put(trackerId, t);
}
return mTrackers.get(trackerId);
}
synchronized GoogleAnalytics getAnalyticsInstance() {
return GoogleAnalytics.getInstance(getReactApplicationContext());
}
@Override
public Map<String, Object> getConstants() {
final Map<String, Object> constants = new HashMap<>();
constants.put("nativeTrackerId", _trackingId);
return constants;
}
@ReactMethod
public void trackScreenView(String trackerId, String screenName){
Tracker tracker = getTracker(trackerId);
if (tracker != null)
{
tracker.setScreenName(screenName);
tracker.send(new HitBuilders.ScreenViewBuilder().build());
}
}
@ReactMethod
public void trackEvent(String trackerId, String category, String action, ReadableMap optionalValues){
Tracker tracker = getTracker(trackerId);
if (tracker != null)
{
HitBuilders.EventBuilder hit = new HitBuilders.EventBuilder()
.setCategory(category)
.setAction(action);
if (optionalValues.hasKey("label"))
{
hit.setLabel(optionalValues.getString("label"));
}
if (optionalValues.hasKey("value"))
{
hit.setValue(optionalValues.getInt("value"));
}
tracker.send(hit.build());
}
}
@ReactMethod
public void trackTiming(String trackerId, String category, Double value, ReadableMap optionalValues){
Tracker tracker = getTracker(trackerId);
if (tracker != null)
{
HitBuilders.TimingBuilder hit = new HitBuilders.TimingBuilder()
.setCategory(category)
.setValue(value.longValue());
if (optionalValues.hasKey("name"))
{
hit.setVariable(optionalValues.getString("name"));
}
if (optionalValues.hasKey("label"))
{
hit.setLabel(optionalValues.getString("label"));
}
tracker.send(hit.build());
}
}
@ReactMethod
public void trackPurchaseEvent(String trackerId, ReadableMap product, ReadableMap transaction, String eventCategory, String eventAction){
Tracker tracker = getTracker(trackerId);
if (tracker != null) {
HitBuilders.EventBuilder hit = new HitBuilders.EventBuilder()
.addProduct(this.getPurchaseProduct(product))
.setProductAction(this.getPurchaseTransaction(transaction))
.setCategory(eventCategory)
.setAction(eventAction);
tracker.send(hit.build());
}
}
@ReactMethod
public void trackMultiProductsPurchaseEvent(String trackerId, ReadableArray products, ReadableMap transaction, String eventCategory, String eventAction) {
Tracker tracker = getTracker(trackerId);
if (tracker != null) {
HitBuilders.EventBuilder hit = new HitBuilders.EventBuilder()
.setProductAction(this.getPurchaseTransaction(transaction))
.setCategory(eventCategory)
.setAction(eventAction);
for (int i = 0; i < products.size(); i++) {
ReadableMap product = products.getMap(i);
hit.addProduct(this.getPurchaseProduct(product));
}
tracker.send(hit.build());
}
}
@ReactMethod
public void trackMultiProductsPurchaseEventWithCustomDimensionValues(String trackerId, ReadableArray products, ReadableMap transaction, String eventCategory, String eventAction, ReadableMap dimensionIndexValues) {
Tracker tracker = getTracker(trackerId);
if (tracker != null) {
HitBuilders.EventBuilder hit = new HitBuilders.EventBuilder()
.setProductAction(this.getPurchaseTransaction(transaction))
.setCategory(eventCategory)
.setAction(eventAction);
for (int i = 0; i < products.size(); i++) {
ReadableMap product = products.getMap(i);
hit.addProduct(this.getPurchaseProduct(product));
}
ReadableMapKeySetIterator iterator = dimensionIndexValues.keySetIterator();
while (iterator.hasNextKey()) {
String dimensionIndex = iterator.nextKey();
String dimensionValue = dimensionIndexValues.getString(dimensionIndex);
hit.setCustomDimension(Integer.parseInt(dimensionIndex), dimensionValue);
}
tracker.send(hit.build());
}
}
private ProductAction getPurchaseTransaction(ReadableMap transaction) {
ProductAction productAction = new ProductAction(ProductAction.ACTION_PURCHASE)
.setTransactionId(transaction.getString("id"))
.setTransactionTax(transaction.getDouble("tax"))
.setTransactionRevenue(transaction.getDouble("revenue"))
.setTransactionShipping(transaction.getDouble("shipping"))
.setTransactionCouponCode(transaction.getString("couponCode"))
.setTransactionAffiliation(transaction.getString("affiliation"));
return productAction;
}
private Product getPurchaseProduct(ReadableMap product) {
Product ecommerceProduct = new Product()
.setId(product.getString("id"))
.setName(product.getString("name"))
.setBrand(product.getString("brand"))
.setPrice(product.getDouble("price"))
.setQuantity(product.getInt("quantity"))
.setVariant(product.getString("variant"))
.setCategory(product.getString("category"));
if(product.hasKey("couponCode")) {
ecommerceProduct.setCouponCode(product.getString("couponCode"));
}
return ecommerceProduct;
}
@ReactMethod
public void trackException(String trackerId, String error, Boolean fatal)
{
Tracker tracker = getTracker(trackerId);
if (tracker != null) {
tracker.send(new HitBuilders.ExceptionBuilder()
.setDescription(error)
.setFatal(fatal)
.build());
}
}
@ReactMethod
public void setUser(String trackerId, String userId)
{
Tracker tracker = getTracker(trackerId);
if (tracker != null) {
tracker.set("&uid", userId);
}
}
@ReactMethod
public void allowIDFA(String trackerId, Boolean enabled)
{
Tracker tracker = getTracker(trackerId);
if (tracker != null) {
tracker.enableAdvertisingIdCollection(enabled);
}
}
@ReactMethod
public void trackSocialInteraction(String trackerId, String network, String action, String targetUrl)
{
Tracker tracker = getTracker(trackerId);
if (tracker != null) {
tracker.send(new HitBuilders.SocialBuilder()
.setNetwork(network)
.setAction(action)
.setTarget(targetUrl)
.build());
}
}
@ReactMethod
public void trackScreenViewWithCustomDimensionValues(String trackerId, String screenName, ReadableMap dimensionIndexValues)
{
Tracker tracker = getTracker(trackerId);
if (tracker != null)
{
tracker.setScreenName(screenName);
HitBuilders.ScreenViewBuilder screenBuilder = new HitBuilders.ScreenViewBuilder();
ReadableMapKeySetIterator iterator = dimensionIndexValues.keySetIterator();
while (iterator.hasNextKey()) {
String dimensionIndex = iterator.nextKey();
String dimensionValue = dimensionIndexValues.getString(dimensionIndex);
screenBuilder.setCustomDimension(Integer.parseInt(dimensionIndex), dimensionValue);
}
tracker.send(screenBuilder.build());
}
}
@ReactMethod
public void trackEventWithCustomDimensionValues(String trackerId, String category, String action, ReadableMap optionalValues, ReadableMap dimensionIndexValues)
{
Tracker tracker = getTracker(trackerId);
if (tracker != null)
{
HitBuilders.EventBuilder hit = new HitBuilders.EventBuilder()
.setCategory(category)
.setAction(action);
if (optionalValues.hasKey("label"))
{
hit.setLabel(optionalValues.getString("label"));
}
if (optionalValues.hasKey("value"))
{
hit.setValue(optionalValues.getInt("value"));
}
ReadableMapKeySetIterator iterator = dimensionIndexValues.keySetIterator();
while (iterator.hasNextKey()) {
String dimensionIndex = iterator.nextKey();
String dimensionValue = dimensionIndexValues.getString(dimensionIndex);
hit.setCustomDimension(Integer.parseInt(dimensionIndex), dimensionValue);
}
tracker.send(hit.build());
}
}
@ReactMethod
public void setSamplingRate(String trackerId, Double sampleRate){
Tracker tracker = getTracker(trackerId);
if (tracker != null)
{
tracker.setSampleRate(sampleRate);
}
}
@ReactMethod
public void setDryRun(Boolean enabled){
GoogleAnalytics analytics = getAnalyticsInstance();
if (analytics != null)
{
analytics.setDryRun(enabled);
}
}
@ReactMethod
public void setDispatchInterval(Integer intervalInSeconds){
GoogleAnalytics analytics = getAnalyticsInstance();
if (analytics != null)
{
analytics.setLocalDispatchPeriod(intervalInSeconds);
}
}
@ReactMethod
public void setTrackUncaughtExceptions(String trackerId, Boolean enabled){
Tracker tracker = getTracker(trackerId);
if (tracker != null)
{
tracker.enableExceptionReporting(enabled);
}
}
@ReactMethod
public void setAnonymizeIp(String trackerId, Boolean enabled){
Tracker tracker = getTracker(trackerId);
if (tracker != null)
{
tracker.setAnonymizeIp(enabled);
}
}
@ReactMethod
public void setOptOut(Boolean enabled){
GoogleAnalytics analytics = getAnalyticsInstance();
if (analytics != null)
{
analytics.setAppOptOut(enabled);
}
}
@ReactMethod
public void setAppName(String trackerId, String appName){
Tracker tracker = getTracker(trackerId);
if (tracker != null)
{
tracker.setAppName(appName);
}
}
@ReactMethod
public void setAppVersion(String trackerId, String appVersion){
Tracker tracker = getTracker(trackerId);
if (tracker != null)
{
tracker.setAppVersion(appVersion);
}
}
}
| {
"content_hash": "3754faf0b689505e95af7ac5dd0ba3c1",
"timestamp": "",
"source": "github",
"line_count": 383,
"max_line_length": 217,
"avg_line_length": 33.14099216710183,
"alnum_prop": 0.6243598834002994,
"repo_name": "weatherfordmat/YorViewReactNative",
"id": "a566e53d3f9fd40d652e03d261931e0ad2ef7a9a",
"size": "12693",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "node_modules/react-native-google-analytics-bridge/android/src/main/java/com/idehub/GoogleAnalyticsBridge/GoogleAnalyticsBridge.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1600"
},
{
"name": "JavaScript",
"bytes": "83687"
},
{
"name": "Objective-C",
"bytes": "1466228"
},
{
"name": "Python",
"bytes": "1645"
},
{
"name": "Ruby",
"bytes": "432"
},
{
"name": "Shell",
"bytes": "17002"
}
],
"symlink_target": ""
} |
#include <boost/program_options.hpp>
#include <boost/progress.hpp>
#include <boost/format.hpp>
#include <boost/timer.hpp>
#include <lshkit.h>
/**
* \file apost-run.cpp
* \brief Example of using A Posteriori MPLSH.
*
* This program is an example of using A Posteriori MPLSH index.
*
* You need to run this program twice: once for index building
* and training, once for testing.
* For index building (with --build), you need to specify the following parameters:
* -W -M -L -Q -K|-R -D -B --index --build
* -N --expand --k-sigma
* The parameter -N specify the quantization granularity (Nz in equation 17).
* For now, do not specify the expand parameter (just use the default).
* k-sigma specifies the sigma in Gaussian kernel used in equation 14 & 15.
* Here the benchmark is used to train the a posteriori model. The index
* will be written to the --index parameter.
*
* For testing (without --build), you need to specify the following:
* -Q -K|-R -D -B --index -T|--recall
*
* The benchmark provided for training and benchmarking should be different.
* To generate the benchmark file, use the scan program with different --seed
* parameters.
*
* Following is a example run on the audio dataset:
* Training:
* apost-run -D audio.data -B audio.train -L 10 -W 4.32 -M 20 -Q 1000 -K 50 --build --index audio.apost
* Testig:
* apost-run -D audio.data -B audio.query -T 20 -Q 100 -K 50 --index audio.apost
*
\verbatim
-h [ --help ] produce help message.
-W [ -- ] arg (=1)
-M [ -- ] arg (=1)
-N [ -- ] arg (=2500)
-T [ -- ] arg (=1) # probes
-L [ -- ] arg (=1) # hash tables
-Q [ -- ] arg (=100) # queries
-K [ -- ] arg (=0) # nearest neighbor to retrieve
-R [ --radius ] arg (=3.40282347e+38) R-NN distance range (L2)
--recall arg desired recall
-D [ --data ] arg data file
-B [ --benchmark ] arg benchmark file
--index arg index file
--build build index, using benchmark as
training examples
-H [ -- ] arg (=1017881) hash table size, use the default value.
--expand arg (=0)
--k-sigmal arg (=0.2)
\endverbatim
*/
using namespace std;
using namespace lshkit;
namespace po = boost::program_options;
int main (int argc, char *argv[])
{
string data_file;
string benchmark;
string index_file;
float W, R, desired_recall = 1.0, expand, k_sigma;
unsigned M, L, H, Nz;
unsigned Q, K, T;
bool do_recall = false;
bool do_build = false;
boost::timer timer;
po::options_description desc("Allowed options");
desc.add_options()
("help,h", "produce help message.")
(",W", po::value<float>(&W)->default_value(1.0), "")
(",M", po::value<unsigned>(&M)->default_value(1), "")
(",N", po::value<unsigned>(&Nz)->default_value(2500), "")
(",T", po::value<unsigned>(&T)->default_value(1), "# probes")
(",L", po::value<unsigned>(&L)->default_value(1), "# hash tables")
(",Q", po::value<unsigned>(&Q)->default_value(100), "# queries")
(",K", po::value<unsigned>(&K)->default_value(0), "# nearest neighbor to retrieve")
("radius,R", po::value<float>(&R)->default_value(numeric_limits<float>::max()), "R-NN distance range (L2)")
("recall", po::value<float>(&desired_recall), "desired recall")
("data,D", po::value<string>(&data_file), "data file")
("benchmark,B", po::value<string>(&benchmark), "benchmark file")
("index", po::value<string>(&index_file), "index file")
("build", "build index, using benchmark as training examples")
(",H", po::value<unsigned>(&H)->default_value(1017881), "hash table size, use the default value.")
("k-sigma", po::value<float>(&k_sigma)->default_value(1.0/5), "")
("expand", po::value<float>(&expand)->default_value(0), "")
;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);
if (vm.count("help") || (vm.count("data") < 1))
{
cout << desc;
return 0;
}
if (vm.count("build") >= 1) {
do_build = true;
}
if (vm.count("radius") >= 1) {
R *= R; // we use L2sqr in the program.
}
if (vm.count("recall") >= 1)
{
do_recall = true;
}
if ((Q == 0) || (vm.count("benchmark") == 0)) {
cerr << "No benchmark data." << endl;
return -1;
}
if (vm.count("index") != 1) {
cerr << "No index file specified." << endl;
return -1;
}
cout << "LOADING DATA..." << endl;
timer.restart();
FloatMatrix data(data_file);
cout << boost::format("LOAD TIME: %1%s.") % timer.elapsed() << endl;
typedef APostLshIndex<unsigned> Index;
FloatMatrix::Accessor accessor(data);
Index index;
if (do_build) {
// We define a short name for the MPLSH index.
Index::Parameter param;
// Setup the parameters. Note that L is not provided here.
param.W = W;
param.range = H; // See H in the program parameters. You can just use the default value.
param.repeat = M;
param.dim = data.getDim();
DefaultRng rng;
index.init(param, rng, L);
// The accessor.
// Initialize the index structure. Note L is passed here.
cout << "CONSTRUCTING INDEX..." << endl;
timer.restart();
{
boost::progress_display progress(data.getSize());
for (unsigned i = 0; i < data.getSize(); ++i)
{
// Insert an item to the hash table.
// Note that only the key is passed in here.
// MPLSH will get the feature from the accessor.
index.insert(i, data[i]);
++progress;
}
}
cout << boost::format("CONSTRUCTION TIME: %1%s.") % timer.elapsed() << endl;
Benchmark<> bench;
cout << "LOADING BENCHMARK..." << endl;
bench.load(benchmark);
bench.resize(Q, K);
cout << "DONE." << endl;
cout << "TRAINING INDEX..." << endl;
timer.restart();
vector<APostExample> examples(Q);
for (unsigned i = 0; i < Q; ++i) {
examples[i].query = data[bench.getQuery(i)];
const Topk<unsigned> &topk = bench.getAnswer(i);
examples[i].results.resize(topk.size());
for (unsigned j = 0; j < topk.size(); j++) {
examples[i].results[j] = data[topk[j].key];
}
}
index.train(examples, Nz, k_sigma, expand);
cout << boost::format("TRAINING TIME: %1%s.") % timer.elapsed() << endl;
timer.restart();
cout << "SAVING INDEX..." << endl;
{
ofstream os(index_file.c_str(), ios_base::binary);
os.exceptions(ios_base::eofbit | ios_base::failbit | ios_base::badbit);
index.save(os);
}
cout << boost::format("SAVING TIME: %1%s") % timer.elapsed() << endl;
}
else {
// try loading index
{
ifstream is(index_file.c_str(), ios_base::binary);
BOOST_VERIFY(is);
is.exceptions(ios_base::eofbit | ios_base::failbit | ios_base::badbit);
cout << "LOADING INDEX..." << endl;
timer.restart();
index.load(is);
BOOST_VERIFY(is);
cout << boost::format("LOAD TIME: %1%s.") % timer.elapsed() << endl;
}
Benchmark<> bench;
cout << "LOADING BENCHMARK..." << endl;
bench.load(benchmark);
bench.resize(Q, K);
cout << "DONE." << endl;
for (unsigned i = 0; i < Q; ++i)
{
for (unsigned j = 0; j < K; ++j)
{
assert(bench.getAnswer(i)[j].key < data.getSize());
}
}
cout << "RUNNING QUERIES..." << endl;
Stat recall;
Stat cost;
metric::l2sqr<float> l2sqr(data.getDim());
TopkScanner<FloatMatrix::Accessor, metric::l2sqr<float> > query(accessor, l2sqr, K, R);
vector<Topk<unsigned> > topks(Q);
timer.restart();
if (do_recall)
// Specify the required recall
// and let MPLSH to guess how many bins to probe.
{
boost::progress_display progress(Q);
for (unsigned i = 0; i < Q; ++i)
{
// Query for one point.
query.reset(data[bench.getQuery(i)]);
index.query_recall(data[bench.getQuery(i)], desired_recall, query);
cost << double(query.cnt())/double(data.getSize());
topks[i].swap(query.topk());
//exit(-1);
++progress;
}
}
else
// specify how many bins to probe.
{
boost::progress_display progress(Q);
for (unsigned i = 0; i < Q; ++i)
{
query.reset(data[bench.getQuery(i)]);
index.query(data[bench.getQuery(i)], T, query);
cost << double(query.cnt())/double(data.getSize());
topks[i].swap(query.topk());
//exit(-1);
++progress;
}
}
for (unsigned i = 0; i < Q; ++i) {
recall << bench.getAnswer(i).recall(topks[i]);
}
cout << boost::format("QUERY TIME: %1%s.") % timer.elapsed() << endl;
cout << "[RECALL] " << recall.getAvg() << " +/- " << recall.getStd() << endl;
cout << "[COST] " << cost.getAvg() << " +/- " << cost.getStd() << endl;
}
return 0;
}
| {
"content_hash": "217dd75679c98e3b30914c42beb3bce3",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 115,
"avg_line_length": 34.54895104895105,
"alnum_prop": 0.5204938771379415,
"repo_name": "BinSigma/BinClone",
"id": "8f87836eb11a5825a631cdc4441f908030ccc98f",
"size": "10636",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "lshkit/trunk/tools/apost-run.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "61990"
},
{
"name": "C++",
"bytes": "879998"
},
{
"name": "CMake",
"bytes": "12199"
},
{
"name": "HTML",
"bytes": "461"
},
{
"name": "Matlab",
"bytes": "2924"
},
{
"name": "Objective-C",
"bytes": "6763"
},
{
"name": "Shell",
"bytes": "846"
}
],
"symlink_target": ""
} |
package LinkedLists;
// Implementation of a double linked node from a double linked list
// Java 8
// Aitor Alonso (https://github.com/tairosonloa)
public class DNode {
public Object elem;
public DNode prev;
public DNode next;
public DNode(Object elem) {
this.elem = elem;
}
} | {
"content_hash": "ef4971109d6a8ed707a1eada29faf5ca",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 67,
"avg_line_length": 17.9375,
"alnum_prop": 0.7247386759581882,
"repo_name": "CodersForLife/Data-Structures-Algorithms",
"id": "0339dda532fc0f71a2542ab0b82d1a6495a70533",
"size": "287",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Structures/LinkedLists/DNode.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "3283"
},
{
"name": "C++",
"bytes": "34708"
},
{
"name": "Go",
"bytes": "449"
},
{
"name": "Java",
"bytes": "27575"
},
{
"name": "JavaScript",
"bytes": "3724"
},
{
"name": "Kotlin",
"bytes": "163"
},
{
"name": "Python",
"bytes": "12527"
}
],
"symlink_target": ""
} |
@interface UIFont (Molle)
+ (instancetype)molleRegularFontOfSize:(CGFloat)size;
@end
| {
"content_hash": "10b39c92f7a1c64f6449deba56ec8552",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 53,
"avg_line_length": 14.666666666666666,
"alnum_prop": 0.7727272727272727,
"repo_name": "parakeety/GoogleFontsiOS",
"id": "adcddc3a107e1c5c918bfe8e9b13fc54cefcc6a4",
"size": "112",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Pod/Classes/molle/UIFont+Molle.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "556602"
},
{
"name": "Objective-C",
"bytes": "700172"
},
{
"name": "Ruby",
"bytes": "185508"
}
],
"symlink_target": ""
} |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import compas_rhino
from compas.geometry import add_vectors
from compas.artists import PrimitiveArtist
from compas.colors import Color
from .artist import RhinoArtist
class CircleArtist(RhinoArtist, PrimitiveArtist):
"""Artist for drawing circles.
Parameters
----------
circle : :class:`~compas.geometry.Circle`
A COMPAS circle.
layer : str, optional
The layer that should contain the drawing.
**kwargs : dict, optional
Additional keyword arguments.
For more info, see :class:`RhinoArtist` and :class:`PrimitiveArtist`.
"""
def __init__(self, circle, layer=None, **kwargs):
super(CircleArtist, self).__init__(primitive=circle, layer=layer, **kwargs)
def draw(self, color=None, show_point=False, show_normal=False):
"""Draw the circle.
Parameters
----------
color : tuple[int, int, int] | tuple[float, float, float] | :class:`~compas.colors.Color`, optional
The RGB color of the circle.
Default is :attr:`compas.artists.PrimitiveArtist.color`.
show_point : bool, optional
If True, draw the center point of the circle.
show_normal : bool, optional
If True, draw the normal vector of the circle.
Returns
-------
list[System.Guid]
The GUIDs of the created Rhino objects.
"""
color = Color.coerce(color) or self.color
color = color.rgb255
point = list(self.primitive.plane.point)
normal = list(self.primitive.plane.normal)
plane = point, normal
radius = self.primitive.radius
guids = []
if show_point:
points = [{"pos": point, "color": color, "name": self.primitive.name}]
guids += compas_rhino.draw_points(points, layer=self.layer, clear=False, redraw=False)
if show_normal:
lines = [
{
"start": point,
"end": add_vectors(point, normal),
"arrow": "end",
"color": color,
"name": self.primitive.name,
}
]
guids += compas_rhino.draw_lines(lines, layer=self.layer, clear=False, redraw=False)
circles = [
{
"plane": plane,
"radius": radius,
"color": color,
"name": self.primitive.name,
}
]
guids += compas_rhino.draw_circles(circles, layer=self.layer, clear=False, redraw=False)
return guids
| {
"content_hash": "e1236ff6499742f88bb5878c64740131",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 107,
"avg_line_length": 34.20253164556962,
"alnum_prop": 0.5684678016284234,
"repo_name": "compas-dev/compas",
"id": "48755a94bf7d86282e9069c6e4699b2b81884857",
"size": "2702",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "src/compas_rhino/artists/circleartist.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "3181804"
}
],
"symlink_target": ""
} |
require "chef/provider/apt_update"
require "chef/provider/apt_preference"
require "chef/provider/apt_repository"
require "chef/provider/batch"
require "chef/provider/cookbook_file"
require "chef/provider/cron"
require "chef/provider/cron/solaris"
require "chef/provider/cron/aix"
require "chef/provider/deploy"
require "chef/provider/directory"
require "chef/provider/dsc_script"
require "chef/provider/dsc_resource"
require "chef/provider/env"
require "chef/provider/erl_call"
require "chef/provider/execute"
require "chef/provider/file"
require "chef/provider/git"
require "chef/provider/group"
require "chef/provider/http_request"
require "chef/provider/ifconfig"
require "chef/provider/launchd"
require "chef/provider/link"
require "chef/provider/log"
require "chef/provider/ohai"
require "chef/provider/mdadm"
require "chef/provider/mount"
require "chef/provider/noop"
require "chef/provider/package"
require "chef/provider/powershell_script"
require "chef/provider/osx_profile"
require "chef/provider/reboot"
require "chef/provider/remote_directory"
require "chef/provider/remote_file"
require "chef/provider/route"
require "chef/provider/ruby_block"
require "chef/provider/script"
require "chef/provider/service"
require "chef/provider/subversion"
require "chef/provider/systemd_unit"
require "chef/provider/template"
require "chef/provider/user"
require "chef/provider/whyrun_safe_ruby_block"
require "chef/provider/yum_repository"
require "chef/provider/windows_task"
require "chef/provider/zypper_repository"
require "chef/provider/windows_path"
require "chef/provider/env/windows"
require "chef/provider/package/apt"
require "chef/provider/package/chocolatey"
require "chef/provider/package/dpkg"
require "chef/provider/package/dnf"
require "chef/provider/package/freebsd/port"
require "chef/provider/package/freebsd/pkg"
require "chef/provider/package/freebsd/pkgng"
require "chef/provider/package/homebrew"
require "chef/provider/package/ips"
require "chef/provider/package/macports"
require "chef/provider/package/openbsd"
require "chef/provider/package/pacman"
require "chef/provider/package/portage"
require "chef/provider/package/paludis"
require "chef/provider/package/rpm"
require "chef/provider/package/rubygems"
require "chef/provider/package/yum"
require "chef/provider/package/zypper"
require "chef/provider/package/solaris"
require "chef/provider/package/smartos"
require "chef/provider/package/aix"
require "chef/provider/package/cab"
require "chef/provider/package/powershell"
require "chef/provider/package/msu"
require "chef/provider/service/arch"
require "chef/provider/service/freebsd"
require "chef/provider/service/gentoo"
require "chef/provider/service/init"
require "chef/provider/service/invokercd"
require "chef/provider/service/debian"
require "chef/provider/service/openbsd"
require "chef/provider/service/redhat"
require "chef/provider/service/insserv"
require "chef/provider/service/simple"
require "chef/provider/service/systemd"
require "chef/provider/service/upstart"
require "chef/provider/service/windows"
require "chef/provider/service/solaris"
require "chef/provider/service/macosx"
require "chef/provider/service/aixinit"
require "chef/provider/service/aix"
require "chef/provider/user/aix"
require "chef/provider/user/dscl"
require "chef/provider/user/linux"
require "chef/provider/user/pw"
require "chef/provider/user/solaris"
require "chef/provider/user/useradd"
require "chef/provider/user/windows"
require "chef/provider/group/aix"
require "chef/provider/group/dscl"
require "chef/provider/group/gpasswd"
require "chef/provider/group/groupadd"
require "chef/provider/group/groupmod"
require "chef/provider/group/pw"
require "chef/provider/group/suse"
require "chef/provider/group/usermod"
require "chef/provider/group/windows"
require "chef/provider/mount/mount"
require "chef/provider/mount/aix"
require "chef/provider/mount/solaris"
require "chef/provider/mount/windows"
require "chef/provider/deploy/revision"
require "chef/provider/deploy/timestamped"
require "chef/provider/remote_file/ftp"
require "chef/provider/remote_file/sftp"
require "chef/provider/remote_file/http"
require "chef/provider/remote_file/local_file"
require "chef/provider/remote_file/network_file"
require "chef/provider/remote_file/fetcher"
require "chef/provider/lwrp_base"
require "chef/provider/registry_key"
require "chef/provider/file/content"
require "chef/provider/remote_file/content"
require "chef/provider/cookbook_file/content"
require "chef/provider/template/content"
require "chef/provider/ifconfig/redhat"
require "chef/provider/ifconfig/debian"
require "chef/provider/ifconfig/aix"
| {
"content_hash": "ca9ddf5432743c76c70aea115908f495",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 48,
"avg_line_length": 34.10294117647059,
"alnum_prop": 0.8111254851228978,
"repo_name": "Kast0rTr0y/chef",
"id": "a3332477e78554f97f6c62698c34ae26444e63ff",
"size": "5324",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "lib/chef/providers.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "386"
},
{
"name": "CSS",
"bytes": "21551"
},
{
"name": "Groff",
"bytes": "270674"
},
{
"name": "HTML",
"bytes": "539335"
},
{
"name": "JavaScript",
"bytes": "49785"
},
{
"name": "Makefile",
"bytes": "884"
},
{
"name": "Perl6",
"bytes": "64"
},
{
"name": "PowerShell",
"bytes": "12510"
},
{
"name": "Python",
"bytes": "9728"
},
{
"name": "Ruby",
"bytes": "7353736"
},
{
"name": "Shell",
"bytes": "688"
}
],
"symlink_target": ""
} |
/* Includes ------------------------------------------------------------------*/
#include "stm32f7xx_hal.h"
/** @addtogroup STM32F7xx_HAL_Driver
* @{
*/
/** @defgroup LTDCEx LTDCEx
* @brief LTDC HAL module driver
* @{
*/
#ifdef HAL_LTDC_MODULE_ENABLED
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @defgroup LTDCEx_Exported_Functions LTDC Extended Exported Functions
* @{
*/
/** @defgroup LTDCEx_Exported_Functions_Group1 Initialization and Configuration functions
* @brief Initialization and Configuration functions
*
@verbatim
===============================================================================
##### Initialization and Configuration functions #####
===============================================================================
[..] This section provides functions allowing to:
(+) Initialize and configure the LTDC
@endverbatim
* @{
*/
#if defined (STM32F769xx) || defined (STM32F779xx)
/**
* @brief Retrieve common parameters from DSI Video mode configuration structure
* @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
* the configuration information for the LTDC.
* @param VidCfg pointer to a DSI_VidCfgTypeDef structure that contains
* the DSI video mode configuration parameters
* @note The implementation of this function is taking into account the LTDC
* polarities inversion as described in the current LTDC specification
* @retval HAL status
*/
HAL_StatusTypeDef HAL_LTDC_StructInitFromVideoConfig(LTDC_HandleTypeDef* hltdc, DSI_VidCfgTypeDef *VidCfg)
{
/* Retrieve signal polarities from DSI */
/* The following polarity is inverted:
LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH */
/* Note 1 : Code in line w/ Current LTDC specification */
hltdc->Init.DEPolarity = (VidCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH;
hltdc->Init.VSPolarity = (VidCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AH : LTDC_VSPOLARITY_AL;
hltdc->Init.HSPolarity = (VidCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AH : LTDC_HSPOLARITY_AL;
/* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */
/* hltdc->Init.DEPolarity = VidCfg->DEPolarity << 29;
hltdc->Init.VSPolarity = VidCfg->VSPolarity << 29;
hltdc->Init.HSPolarity = VidCfg->HSPolarity << 29; */
/* Retrieve vertical timing parameters from DSI */
hltdc->Init.VerticalSync = VidCfg->VerticalSyncActive - 1;
hltdc->Init.AccumulatedVBP = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch - 1;
hltdc->Init.AccumulatedActiveH = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive - 1;
hltdc->Init.TotalHeigh = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive + VidCfg->VerticalFrontPorch - 1;
return HAL_OK;
}
/**
* @brief Retrieve common parameters from DSI Adapted command mode configuration structure
* @param hltdc pointer to a LTDC_HandleTypeDef structure that contains
* the configuration information for the LTDC.
* @param CmdCfg pointer to a DSI_CmdCfgTypeDef structure that contains
* the DSI command mode configuration parameters
* @note The implementation of this function is taking into account the LTDC
* polarities inversion as described in the current LTDC specification
* @retval HAL status
*/
HAL_StatusTypeDef HAL_LTDC_StructInitFromAdaptedCommandConfig(LTDC_HandleTypeDef* hltdc, DSI_CmdCfgTypeDef *CmdCfg)
{
/* Retrieve signal polarities from DSI */
/* The following polarities are inverted:
LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH
LTDC_VSPOLARITY_AL <-> LTDC_VSPOLARITY_AH
LTDC_HSPOLARITY_AL <-> LTDC_HSPOLARITY_AH)*/
/* Note 1 : Code in line w/ Current LTDC specification */
hltdc->Init.DEPolarity = (CmdCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH;
hltdc->Init.VSPolarity = (CmdCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AL : LTDC_VSPOLARITY_AH;
hltdc->Init.HSPolarity = (CmdCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AL : LTDC_HSPOLARITY_AH;
/* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */
/* hltdc->Init.DEPolarity = CmdCfg->DEPolarity << 29;
hltdc->Init.VSPolarity = CmdCfg->VSPolarity << 29;
hltdc->Init.HSPolarity = CmdCfg->HSPolarity << 29; */
return HAL_OK;
}
#endif /*STM32F769xx | STM32F779xx */
/**
* @}
*/
/**
* @}
*/
#endif /* HAL_LTCD_MODULE_ENABLED */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| {
"content_hash": "137daa3ee96252975efeded9cee2e8f8",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 148,
"avg_line_length": 41.86614173228347,
"alnum_prop": 0.6103065638517962,
"repo_name": "mlaz/mynewt-core",
"id": "f8c421db1476c586a920f4c70a0d0d079a62c159",
"size": "7324",
"binary": false,
"copies": "38",
"ref": "refs/heads/master",
"path": "hw/mcu/stm/stm32f7xx/src/ext/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_ltdc_ex.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "4716096"
},
{
"name": "Batchfile",
"bytes": "106749"
},
{
"name": "C",
"bytes": "260681134"
},
{
"name": "CMake",
"bytes": "127976"
},
{
"name": "GDB",
"bytes": "33827"
},
{
"name": "HTML",
"bytes": "632987"
},
{
"name": "Makefile",
"bytes": "31572"
},
{
"name": "Python",
"bytes": "48016"
},
{
"name": "Rust",
"bytes": "4680"
},
{
"name": "Shell",
"bytes": "239908"
}
],
"symlink_target": ""
} |
@implementation SCAPIClient (Class)
- (NSURLSessionDataTask *)getClassesWithCompletion:(SCAPICompletionBlock)completion {
return [self getTaskWithPath:@"classes/" params:nil completion:completion];
}
@end
| {
"content_hash": "4c04d472d405f5f6a18b7874b6847ea1",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 85,
"avg_line_length": 41.8,
"alnum_prop": 0.8038277511961722,
"repo_name": "lifcio/youtube-app-syncano",
"id": "2c8c7ab76852f65dab77fce8a6098ec51beedc51",
"size": "386",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Pods/syncano-ios/syncano-ios/SCAPIClient+Class.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "163"
},
{
"name": "Ruby",
"bytes": "221"
},
{
"name": "Swift",
"bytes": "11725"
}
],
"symlink_target": ""
} |
<?php
namespace Tomahawk\Forms\Element;
class TextArea extends Element
{
public function __construct($name, $value = null)
{
$this->name = $name;
}
/**
* @param array $attributes
* @return mixed
*/
public function render(array $attributes = array())
{
$current_attributes = array(
'name' => $this->getName(),
);
$attributes = array_merge($current_attributes, $attributes);
return sprintf('<textarea%s>%s</textarea>', $this->attributes($attributes), $this->entities($this->getValue()));
}
}
| {
"content_hash": "99e43f711470d497cce8ad0b81cd047c",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 120,
"avg_line_length": 21.178571428571427,
"alnum_prop": 0.5750421585160203,
"repo_name": "tomahawkphp/framework",
"id": "68e97ff6ec0b8bdc46f22a9dc7cf0c88ff811322",
"size": "798",
"binary": false,
"copies": "1",
"ref": "refs/heads/2.1",
"path": "src/Tomahawk/Forms/Element/TextArea.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "6297"
},
{
"name": "HTML",
"bytes": "4302"
},
{
"name": "PHP",
"bytes": "940001"
}
],
"symlink_target": ""
} |
title: <%= hoc_s(:title_press_kit) %>
layout: wide
nav: promote_nav
---
<%= view :signup_button %>
## How to attract media to your Hour of Code event
*For all press and media inquiries, contact [press@code.org](mailto:press@code.org)*
### Key Tips
- Reach out to media two weeks before your event via email. Follow up by email and phone if you don't receive an initial response.
- Ask a school staff member or volunteer to take photos to share online or send to press.
- Write about the Hour of Code on your website’s homepage and in your school newspaper. Post your event details, and pictures of student activities.
- On Facebook and Twitter, share updates on your plans, announce your events and post pictures during Dec. 7-13. Use the hashtag **#HourOfCode** so Code.org can see and promote your events.
### Step-by-step guide:
**1. Plan your event**
- Plan an assembly to kick off the Hour of Code.
- Send [a letter](<%= resolve_url('/promote/resources#sample-emails') %>) to parents. Ask them to spread the word.
- Send [a letter](<%= resolve_url('/promote/resources#sample-emails') %>) to invite your local mayor, congressman, governor, or influential businessperson to attend and speak to your students.
- Organize group activities (like a demonstration of an ‘unplugged’ programming activity), or show off student-created and led activities.
- Show Code.org’s [Hour of Code video](<%= resolve_url('/') %>) or one of [these](<%= resolve_url('/promote/resources#videos') %>) to inspire.
**2. Identify specific local reporters that cover education or local events.**
Think a local newspaper, TV station, radio station or blog.
Look online to find reporter contact information. If you can't find it, call the publication to ask, or email a general tips@PUBLICATIONNAME.com email address and ask for your message to be directed to the correct reporter.
**3. Contact local media**
The best way to reach out is by email. It should be short and communicate: why should other people care about this event? Include contact information (including a cellphone number) for who will be on site at the event. **See a [sample pitch to media](<%= resolve_url('/promote/resources#sample-emails') %>):**
**4. Prepare to field questions about your school event. Here are some examples:**
*Why is your school doing an Hour of Code?*
While all of us know that it’s important for students to learn how to navigate today’s tech-saturated world, many teachers aren’t experienced in computer science and don’t know where to start. This event is a chance for all of us to see what computer science is about.
We hope it’ll spark interest in students to keep learning. Research also shows that kids pick up programming concepts before they know how to read and write. In fact, their brains are more receptive to computer languages at a young age, just like foreign languages.
*Why is this important?*
In China, every student takes computer science to graduate high school. In the U.S., 90 percent of schools don’t even teach it. It’s time for us to catch up to the 21st century. We know that regardless of what our students do when they grow up, whether they go into medicine, business, politics, or the arts, knowing how to build technology will give them the confidence and know-how to succeed.
**More details and a quote you can use in materials**
"The Hour of Code is designed to demystify code and show that computer science is not rocket-science, anybody can learn the basics," said Hadi Partovi, founder and CEO of Code.org. "Over 100 million students worldwide have tried an Hour of Code. The demand for relevant 21st century computer science education crosses all borders and knows no boundaries."
**About Code.org**
Code.org is a 501c3 public non-profit dedicated to expanding participation in computer science and increasing participation by women and underrepresented students of color. Its vision is that every student in every school should have the opportunity to learn computer programming. After launching in 2013, Code.org organized the Hour of Code campaign – which has introduced over 100 million students to computer science to date – and partnered with 70 public school districts nationwide to expand computer science programs. Code.org is supported by philanthropic donations from corporations, foundations and generous individuals, including Microsoft, Infosys Foundation, USA, The Ballmer Family Giving, Omidyar Network and others. For more information, please visit: [<%= resolve_url('code.org') %>](<%= resolve_url('https://code.org') %>).
<br />
Find more resources and sample emails [here](<%= resolve_url('/promote') %>).
<%= view :signup_button %>
| {
"content_hash": "9c0002d29a223987062296a89882f7bc",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 840,
"avg_line_length": 75.62903225806451,
"alnum_prop": 0.7645553422904671,
"repo_name": "dillia23/code-dot-org",
"id": "d874f025353a7984532b4a3c03a8412551700845",
"size": "4719",
"binary": false,
"copies": "3",
"ref": "refs/heads/staging",
"path": "i18n/locales/source/hourofcode/promote/press-kit.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "93"
},
{
"name": "C++",
"bytes": "4844"
},
{
"name": "CSS",
"bytes": "2398346"
},
{
"name": "Cucumber",
"bytes": "130717"
},
{
"name": "Emacs Lisp",
"bytes": "2410"
},
{
"name": "HTML",
"bytes": "9371177"
},
{
"name": "JavaScript",
"bytes": "83773111"
},
{
"name": "PHP",
"bytes": "2303483"
},
{
"name": "Perl",
"bytes": "14821"
},
{
"name": "Processing",
"bytes": "11068"
},
{
"name": "Prolog",
"bytes": "679"
},
{
"name": "Python",
"bytes": "124866"
},
{
"name": "Racket",
"bytes": "131852"
},
{
"name": "Ruby",
"bytes": "2070008"
},
{
"name": "Shell",
"bytes": "37544"
},
{
"name": "SourcePawn",
"bytes": "74109"
}
],
"symlink_target": ""
} |
"""The tests for Roller shutter platforms."""
| {
"content_hash": "7ca625ffb1150ae72deec0a581783df6",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 45,
"avg_line_length": 46,
"alnum_prop": 0.717391304347826,
"repo_name": "Julian/home-assistant",
"id": "4fc6ddee8a9e6afdc57fbda698c8df2d68025057",
"size": "46",
"binary": false,
"copies": "17",
"ref": "refs/heads/py2",
"path": "tests/components/rollershutter/__init__.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "1354942"
},
{
"name": "Python",
"bytes": "2755966"
},
{
"name": "Ruby",
"bytes": "379"
},
{
"name": "Shell",
"bytes": "6430"
}
],
"symlink_target": ""
} |
package io.milton.dns.record;
import io.milton.dns.Name;
import io.milton.dns.record.DNSSEC.Algorithm;
import io.milton.dns.utils.base64;
import java.io.*;
import io.milton.dns.utils.*;
/**
* Certificate Record - Stores a certificate associated with a name. The
* certificate might also be associated with a KEYRecord.
* @see KEYRecord
*
* @author Brian Wellington
*/
public class CERTRecord extends Record {
public static class CertificateType {
/** Certificate type identifiers. See RFC 4398 for more detail. */
private CertificateType() {}
/** PKIX (X.509v3) */
public static final int PKIX = 1;
/** Simple Public Key Infrastructure */
public static final int SPKI = 2;
/** Pretty Good Privacy */
public static final int PGP = 3;
/** URL of an X.509 data object */
public static final int IPKIX = 4;
/** URL of an SPKI certificate */
public static final int ISPKI = 5;
/** Fingerprint and URL of an OpenPGP packet */
public static final int IPGP = 6;
/** Attribute Certificate */
public static final int ACPKIX = 7;
/** URL of an Attribute Certificate */
public static final int IACPKIX = 8;
/** Certificate format defined by URI */
public static final int URI = 253;
/** Certificate format defined by OID */
public static final int OID = 254;
private static Mnemonic types = new Mnemonic("Certificate type",
Mnemonic.CASE_UPPER);
static {
types.setMaximum(0xFFFF);
types.setNumericAllowed(true);
types.add(PKIX, "PKIX");
types.add(SPKI, "SPKI");
types.add(PGP, "PGP");
types.add(PKIX, "IPKIX");
types.add(SPKI, "ISPKI");
types.add(PGP, "IPGP");
types.add(PGP, "ACPKIX");
types.add(PGP, "IACPKIX");
types.add(URI, "URI");
types.add(OID, "OID");
}
/**
* Converts a certificate type into its textual representation
*/
public static String
string(int type) {
return types.getText(type);
}
/**
* Converts a textual representation of an certificate type into its
* numeric code. Integers in the range 0..65535 are also accepted.
* @param s The textual representation of the algorithm
* @return The algorithm code, or -1 on error.
*/
public static int
value(String s) {
return types.getValue(s);
}
}
/** PKIX (X.509v3) */
public static final int PKIX = CertificateType.PKIX;
/** Simple Public Key Infrastructure */
public static final int SPKI = CertificateType.SPKI;
/** Pretty Good Privacy */
public static final int PGP = CertificateType.PGP;
/** Certificate format defined by URI */
public static final int URI = CertificateType.URI;
/** Certificate format defined by IOD */
public static final int OID = CertificateType.OID;
private static final long serialVersionUID = 4763014646517016835L;
private int certType, keyTag;
private int alg;
private byte [] cert;
CERTRecord() {}
Record
getObject() {
return new CERTRecord();
}
/**
* Creates a CERT Record from the given data
* @param certType The type of certificate (see constants)
* @param keyTag The ID of the associated KEYRecord, if present
* @param alg The algorithm of the associated KEYRecord, if present
* @param cert Binary data representing the certificate
*/
public
CERTRecord(Name name, int dclass, long ttl, int certType, int keyTag,
int alg, byte [] cert)
{
super(name, Type.CERT, dclass, ttl);
this.certType = checkU16("certType", certType);
this.keyTag = checkU16("keyTag", keyTag);
this.alg = checkU8("alg", alg);
this.cert = cert;
}
void
rrFromWire(DNSInput in) throws IOException {
certType = in.readU16();
keyTag = in.readU16();
alg = in.readU8();
cert = in.readByteArray();
}
void
rdataFromString(Tokenizer st, Name origin) throws IOException {
String certTypeString = st.getString();
certType = CertificateType.value(certTypeString);
if (certType < 0)
throw st.exception("Invalid certificate type: " +
certTypeString);
keyTag = st.getUInt16();
String algString = st.getString();
alg = DNSSEC.Algorithm.value(algString);
if (alg < 0)
throw st.exception("Invalid algorithm: " + algString);
cert = st.getBase64();
}
/**
* Converts rdata to a String
*/
String
rrToString() {
StringBuffer sb = new StringBuffer();
sb.append (certType);
sb.append (" ");
sb.append (keyTag);
sb.append (" ");
sb.append (alg);
if (cert != null) {
if (Options.check("multiline")) {
sb.append(" (\n");
sb.append(base64.formatString(cert, 64, "\t", true));
} else {
sb.append(" ");
sb.append(base64.toString(cert));
}
}
return sb.toString();
}
/**
* Returns the type of certificate
*/
public int
getCertType() {
return certType;
}
/**
* Returns the ID of the associated KEYRecord, if present
*/
public int
getKeyTag() {
return keyTag;
}
/**
* Returns the algorithm of the associated KEYRecord, if present
*/
public int
getAlgorithm() {
return alg;
}
/**
* Returns the binary representation of the certificate
*/
public byte []
getCert() {
return cert;
}
void
rrToWire(DNSOutput out, Compression c, boolean canonical) {
out.writeU16(certType);
out.writeU16(keyTag);
out.writeU8(alg);
out.writeByteArray(cert);
}
}
| {
"content_hash": "ae7a0082f4eae598105ff817c3564440",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 74,
"avg_line_length": 23.289473684210527,
"alnum_prop": 0.6651600753295669,
"repo_name": "skoulouzis/lobcder",
"id": "cc508237a51e75cfdb6508f69d35598b1fa5c173",
"size": "6065",
"binary": false,
"copies": "2",
"ref": "refs/heads/dev",
"path": "milton2/milton-server-ce/src/main/java/io/milton/dns/record/CERTRecord.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "931425"
},
{
"name": "Java",
"bytes": "5968231"
},
{
"name": "Roff",
"bytes": "13315"
},
{
"name": "Shell",
"bytes": "85585"
},
{
"name": "TeX",
"bytes": "21844"
}
],
"symlink_target": ""
} |
<div class="modal-header">
<button type="button" ng-click="close()" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i class="fa fa-fw fa-close"></i></span></button>
<h4 class="modal-title" id="myModalLabel"><i class="fa fa-code"></i> Add view from serialized JSON</h4>
</div>
<div class="modal-body">
<div class="form">
<label for="serializedView">Code:</label>
<textarea class="form-control" ng-model="serializedView" style="width: 100%; height: 12em;" />
</div>
</div>
<div class="modal-footer">
<button type="button" ng-click="close()" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="button" ng-click="addSerializedView(serializedView)" class="btn btn-primary" data-dismiss="modal">Add View</button>
</div>
| {
"content_hash": "1de2491332978034e8aea53466dfc3c0",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 173,
"avg_line_length": 49.529411764705884,
"alnum_prop": 0.6460807600950119,
"repo_name": "gribanov-d/cubesviewer",
"id": "9792b27ce240a8f6e704114e62425f4badcad29e",
"size": "842",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "cubesviewer/studio/serialize-add.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "111717"
},
{
"name": "HTML",
"bytes": "83442"
},
{
"name": "JavaScript",
"bytes": "1687714"
}
],
"symlink_target": ""
} |
const gulp = require('gulp');
const browserify = require('browserify');
const sourcemaps = require('gulp-sourcemaps');
const imagemin = require('gulp-imagemin');
const sequence = require('gulp-sequence').use(gulp);
const del = require('del');
const browserSync = require('browser-sync');
const uglifyjs = require('uglify-es');
const buffer = require('vinyl-buffer');
const source = require('vinyl-source-stream');
const pump = require('pump');
const sass = require('gulp-sass');
const fs = require('fs');
const composer = require('gulp-uglify/composer');
const glob = require('glob-promise');
const path = require('path');
const cleanCSS = require('gulp-clean-css');
const stringify = require('stringify');
const minify = composer(uglifyjs, console);
gulp.task('clean', () => {
return del('./dist');
});
gulp.task('html', () => {
return pump([gulp.src('./src/*.html'), gulp.dest('./dist/')]);
});
let vendors = [];
// Bundle all the vendor libraries into a vendor.js file.
gulp.task('scripts:vendor', () => {
vendors = Object.keys(JSON.parse(fs.readFileSync('package.json')).dependencies);
const b = browserify({ debug: true });
vendors.forEach(lib => b.require(lib));
return pump([
b.bundle(),
source('vendor.js'),
buffer(),
sourcemaps.init({ loadMaps: true }),
minify({}),
sourcemaps.write('.'),
gulp.dest('./dist/scripts/'),
]);
});
// Build tasks for each script entry point, and then tasks which run all of those.
(function buildScriptTasks() {
const entries = glob.sync('./src/apps/**.js');
const entryNames = entries.map(entry => path.parse(entry).name);
const devTaskNames = entryNames.map(name => `scripts:apps:${name}:dev`);
const releaseTaskNames = entryNames.map(name => `scripts:apps:${name}:release`);
entries.forEach((entry, i) => {
// Browserify the entry point, with source maps.
gulp.task(devTaskNames[i], () => {
return pump([
browserify({
entries: [entry],
debug: true,
})
.transform(stringify)
.external(vendors)
.bundle(),
source(path.parse(entry).base),
buffer(),
sourcemaps.init({ loadMaps: true }),
sourcemaps.write('.'),
gulp.dest('./dist/scripts/'),
]);
});
// Release is the same as dev, except for the minify() bit.
gulp.task(releaseTaskNames[i], () => {
return pump([
browserify({
entries: [entry],
debug: true,
})
.transform(stringify)
.external(vendors)
.bundle(),
source(path.parse(entry).base),
buffer(),
sourcemaps.init({ loadMaps: true }),
minify({}),
sourcemaps.write('.'),
gulp.dest('./dist/scripts/'),
]);
});
});
// Run all the entry point tasks.
gulp.task('scripts:apps:dev', devTaskNames);
gulp.task('scripts:apps:release', releaseTaskNames);
}());
// Compile Stylus files.
gulp.task('sass', () => {
return pump([
gulp.src('./src/sass/**/*.scss'),
sourcemaps.init(),
sass({ outputStyle: 'compressed' }),
sourcemaps.write('.'),
gulp.dest('./dist/styles/'),
]);
});
// Orinary CSS files, like the leaflet one.
gulp.task('css', () => {
return pump([
gulp.src(['./src/css/**/*.css', './node_modules/leaflet/dist/leaflet.css']),
sourcemaps.init(),
cleanCSS(),
sourcemaps.write('.'),
gulp.dest('./dist/styles/'),
]);
});
// Copy/compress images.
gulp.task('images', () => {
return pump([
gulp.src(['./src/images/**/*', './node_modules/leaflet/dist/images/*']),
imagemin({ progressive: true }),
gulp.dest('./dist/images/'),
]);
});
// Maps are special SVG fiels, we don't want to treat them as images, because imagemin takes out stuff we need.
gulp.task('maps', () => {
return pump([gulp.src('./src/maps/**/*'), gulp.dest('./dist/maps')]);
});
gulp.task('default', ['build:release']);
gulp.task(
'build:release',
sequence('clean', 'scripts:vendor', [
'html',
'maps',
'scripts:apps:release',
'sass',
'css',
'images',
]));
gulp.task(
'build:dev',
sequence('clean', 'scripts:vendor', [
'html',
'maps',
'scripts:apps:dev',
'sass',
'css',
'images',
]));
// Watch/sync drama below.
// Set up Browser Sync. Don't do ghost mode, it is crazy.
gulp.task('browser-sync', () => {
browserSync.init({
proxy: 'localhost:8080',
open: false,
ghostMode: false,
});
});
// Define tasks which do the reload after a task. It adds ':watch' to the task name.
// Per: https://browsersync.io/docs/gulp#gulp-reload
// Revise when Gulp 4 happens? https://github.com/gulpjs/gulp/blob/4.0/docs/recipes/minimal-browsersync-setup-with-gulp4.md
function watchTask(...names) {
names.forEach((name) => {
gulp.task(`${name}:watch`, [name], (done) => {
browserSync.reload();
done();
});
});
}
watchTask('html', 'scripts:vendor', 'scripts:apps:dev', 'sass', 'css', 'maps', 'images');
gulp.task('dev', ['build:dev', 'browser-sync'], () => {
gulp.watch('./src/**/*.html', ['html:watch']);
gulp.watch('./src/**/*.js', ['scripts:apps:dev:watch']);
gulp.watch('./src/**/*.scss', ['sass:watch']);
gulp.watch('./src/**/*.css', ['css:watch']);
gulp.watch('./src/images/**/*', ['images:watch']);
gulp.watch('./src/maps/**/*', ['maps:watch']);
gulp.watch('./package.json', ['scripts:vendor:watch', 'scripts:apps:dev:watch']);
});
| {
"content_hash": "cacde31acbef08cdfc0677c78e367340",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 123,
"avg_line_length": 28.369791666666668,
"alnum_prop": 0.594272076372315,
"repo_name": "endquote/VideoGallery",
"id": "6c111ad2792209c7b06ef756507c3446d276c3a8",
"size": "5447",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/gulpfile.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "637"
},
{
"name": "CSS",
"bytes": "3446"
},
{
"name": "HTML",
"bytes": "3731"
},
{
"name": "JavaScript",
"bytes": "34018"
},
{
"name": "Shell",
"bytes": "1950"
}
],
"symlink_target": ""
} |
package starbound
import (
"encoding/binary"
"errors"
"io"
)
var (
ErrDidNotReachLeaf = errors.New("starbound: did not reach a leaf node")
ErrInvalidData = errors.New("starbound: data appears to be corrupt")
ErrInvalidKeyLength = errors.New("starbound: invalid key length")
ErrKeyNotFound = errors.New("starbound: key not found")
)
func ReadVersionedJSON(r io.Reader) (v VersionedJSON, err error) {
// Read the name of the data structure.
v.Name, err = ReadString(r)
if err != nil {
return
}
// Read version flag (boolean).
buf := make([]byte, 1)
_, err = io.ReadFull(r, buf)
if err != nil {
return
}
if buf[0] == 0 {
// This data structure has no version.
v.HasVersion = false
v.Version = -1
} else {
v.HasVersion = true
// Read the data structure version.
var version int32
err = binary.Read(r, binary.BigEndian, &version)
if err != nil {
return
}
v.Version = int(version)
}
// Finally, read the JSON-like data itself.
v.Data, err = ReadDynamic(r)
return
}
// VersionedJSON represents a JSON-compatible data structure which additionally
// has a name and version associated with it so that the reader may migrate the
// structure based on the name/version.
type VersionedJSON struct {
Name string
HasVersion bool
Version int
Data interface{}
}
// Gets the list at the specified key path if there is one; otherwise, nil.
func (v *VersionedJSON) List(keys ...string) []interface{} {
if val, ok := v.Value(keys...).([]interface{}); ok {
return val
} else {
return nil
}
}
// Gets the map at the specified key path if there is one; otherwise, nil.
func (v *VersionedJSON) Map(keys ...string) map[string]interface{} {
if val, ok := v.Value(keys...).(map[string]interface{}); ok {
return val
} else {
return nil
}
}
// Gets the value at a specific key path if there is one; otherwise, nil.
func (v *VersionedJSON) Value(keys ...string) interface{} {
val := v.Data
for _, key := range keys {
m, ok := val.(map[string]interface{})
if !ok {
return nil
}
val = m[key]
}
return val
}
| {
"content_hash": "03498e301f29f4aecea296e9fc723101",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 79,
"avg_line_length": 24.302325581395348,
"alnum_prop": 0.6660287081339713,
"repo_name": "blixt/go-starbound",
"id": "3c35c37538ae63322bf155f4efb3ea483bd83796",
"size": "2090",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "starbound/starbound.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "19801"
}
],
"symlink_target": ""
} |
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext_lazy
from onadata.apps.logger.models.instance import Instance
from onadata.apps.viewer.models.parsed_instance import xform_instances,\
datetime_from_str
from onadata.libs.utils.common_tags import DELETEDAT, ID
class Command(BaseCommand):
help = ugettext_lazy("Update deleted records from mongo to sql instances")
def handle(self, *args, **kwargs):
q = {"$and": [{"_deleted_at": {"$exists": True}},
{"_deleted_at": {"$ne": None}}]}
cursor = xform_instances.find(q)
c = 0
for record in cursor:
date_deleted = datetime_from_str(record[DELETEDAT])
id = record[ID]
if Instance.set_deleted_at(id, deleted_at=date_deleted):
c += 1
print "deleted on ", date_deleted
print "-------------------------------"
print "Updated %d records." % c
| {
"content_hash": "5353fdaff9f0f11fe51512c505b43a4d",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 78,
"avg_line_length": 38.76,
"alnum_prop": 0.6150670794633643,
"repo_name": "piqoni/onadata",
"id": "273b80a56e63b8d1f44b36f29e118ebf6ab91635",
"size": "969",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "onadata/apps/viewer/management/commands/update_delete_from_mongo.py",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "74590"
},
{
"name": "Gettext Catalog",
"bytes": "558412"
},
{
"name": "HTML",
"bytes": "248856"
},
{
"name": "JavaScript",
"bytes": "904742"
},
{
"name": "Makefile",
"bytes": "2286"
},
{
"name": "Python",
"bytes": "2569475"
},
{
"name": "Shell",
"bytes": "11725"
}
],
"symlink_target": ""
} |
package com.fishercoder.solutions;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class _819 {
public static class Solution1 {
public String mostCommonWord(String paragraph, String[] banned) {
Set<String> bannedSet = new HashSet(Arrays.asList(banned));
String[] words = paragraph.replaceAll("[^a-zA-Z ]", "").toLowerCase().split("\\s+");
Map<String, Integer> map = new HashMap<>();
Arrays.stream(words)
.filter(word -> !bannedSet.contains(word))
.forEach(word -> map.put(word, map.getOrDefault(word, 0) + 1));
String result = "";
int freq = 0;
for (String key : map.keySet()) {
if (map.get(key) > freq) {
result = key;
freq = map.get(key);
}
}
return result;
}
}
}
| {
"content_hash": "71ccc5c091cc3048dee6cfd43dc4d41b",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 96,
"avg_line_length": 34.206896551724135,
"alnum_prop": 0.5292338709677419,
"repo_name": "fishercoder1534/Leetcode",
"id": "512759ed03927f914b01c9b8f6b92dd0653993fd",
"size": "992",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/fishercoder/solutions/_819.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "12363"
},
{
"name": "Java",
"bytes": "3564419"
},
{
"name": "JavaScript",
"bytes": "6306"
},
{
"name": "Python",
"bytes": "408"
},
{
"name": "Shell",
"bytes": "2634"
}
],
"symlink_target": ""
} |
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COrganisationSet
IMPLEMENT_DYNAMIC(COrganisationSet, CRecordsetEx)
COrganisationSet::COrganisationSet(CDatabase* pdb)
: CRecordsetEx(pdb)
{
//{{AFX_FIELD_INIT(COrganisationSet)
m_OrgID = 0;
m_OrgName = _T("");
m_Address1 = _T("");
m_Address2 = _T("");
m_Town = _T("");
m_State = _T("");
m_Country = _T("");
m_PostCode = _T("");
m_Phone = _T("");
m_Fax = _T("");
m_Mobile = _T("");
m_email = _T("");
m_URL = _T("");
m_RegistrarPersonID = 0;
m_AdministratorPersonID = 0;
m_nFields = 15;
//}}AFX_FIELD_INIT
m_nDefaultType = dynaset;
m_strIdentityColumn = _T("OrgID");
m_nIdentityColumn = &m_OrgID;
}
CString COrganisationSet::GetDefaultConnect()
{
return _T("");
}
CString COrganisationSet::GetDefaultSQL()
{
return _T("[Organisation]");
}
void COrganisationSet::DoFieldExchange(CFieldExchange* pFX)
{
//{{AFX_FIELD_MAP(COrganisationSet)
pFX->SetFieldType(CFieldExchange::outputColumn);
RFX_Long(pFX, _T("[Organisation].[OrgID]"), m_OrgID);
RFX_Text(pFX, _T("[Organisation].[OrgName]"), m_OrgName);
RFX_Text(pFX, _T("[Organisation].[Address1]"), m_Address1);
RFX_Text(pFX, _T("[Organisation].[Address2]"), m_Address2);
RFX_Text(pFX, _T("[Organisation].[Town]"), m_Town);
RFX_Text(pFX, _T("[Organisation].[State]"), m_State);
RFX_Text(pFX, _T("[Organisation].[Country]"), m_Country);
RFX_Text(pFX, _T("[Organisation].[PostCode]"), m_PostCode);
RFX_Text(pFX, _T("[Organisation].[Phone]"), m_Phone);
RFX_Text(pFX, _T("[Organisation].[Fax]"), m_Fax);
RFX_Text(pFX, _T("[Organisation].[Mobile]"), m_Mobile);
RFX_Text(pFX, _T("[Organisation].[email]"), m_email);
RFX_Text(pFX, _T("[Organisation].[URL]"), m_URL);
RFX_Long(pFX, _T("[Organisation].[RegistrarPersonID]"), m_RegistrarPersonID);
RFX_Long(pFX, _T("[Organisation].[AdministratorPersonID]"), m_AdministratorPersonID);
//}}AFX_FIELD_MAP
}
/////////////////////////////////////////////////////////////////////////////
// COrganisationSet diagnostics
#ifdef _DEBUG
void COrganisationSet::AssertValid() const
{
CRecordsetEx::AssertValid();
}
void COrganisationSet::Dump(CDumpContext& dc) const
{
CRecordsetEx::Dump(dc);
}
#endif //_DEBUG
| {
"content_hash": "49957f329270fb1e2c6d3d94731fab15",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 86,
"avg_line_length": 27.597560975609756,
"alnum_prop": 0.6133451171011931,
"repo_name": "darianbridge/WebAthl",
"id": "ade26bd0a903a7fadd8832344be577cd11a2a5bf",
"size": "2485",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Projects/WebAthl/OrganisationSet.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "13642"
},
{
"name": "C++",
"bytes": "1522270"
},
{
"name": "HTML",
"bytes": "34324"
},
{
"name": "JavaScript",
"bytes": "487"
},
{
"name": "Makefile",
"bytes": "45203"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using MagicLockScreen_Service_ImageSearchService.Models;
using NoteOne_Core.Common;
using NoteOne_Utility.Extensions;
namespace MagicLockScreen_Service_ImageSearchService.Results
{
public class GoogleImageSearchResult : QueryResult
{
public GoogleImageSearchResult(object result,
QueryResultTypes type = QueryResultTypes.Single,
uint index = 0,
uint count = 0)
: base(result, type)
{
ResponseType = ResponseTypes.Json;
if (type == QueryResultTypes.Single)
Result = new SearchImage();
else if (type == QueryResultTypes.Multi)
{
Results = default(SearchImage[]);
Index = index;
Count = count;
}
ParseResponse();
}
public GoogleImageSearchResult(ModelBase result)
: base(result)
{
ResponseType = ResponseTypes.Json;
}
public GoogleImageSearchResult(IList<ModelBase> results)
: base(results)
{
ResponseType = ResponseTypes.Json;
}
protected override void ParseResponse()
{
try
{
base.ParseResponse();
dynamic d = ResponseContent;
switch (QueryResultType)
{
case QueryResultTypes.Single:
if (d.responseData != null &&
d.responseData.results.Count != 0 &&
d.responseData.cursor.resultCount > 0)
{
var googleImage = Result as SearchImage;
googleImage.OriginalImageUrl = d.responseData.results[0].unescapedUrl.ToString().Trim();
googleImage.ThumbnailImageUrl = googleImage.OriginalImageUrl;
googleImage.Title = d.responseData.results[0].titleNoFormatting.ToString().Trim();
googleImage.Content = d.responseData.results[0].contentNoFormatting.ToString().Trim();
googleImage.Copyright = d.responseData.results[0].visibleUrl.ToString().Trim();
googleImage.CopyrightUrl = "http://" +
d.responseData.results[0].visibleUrl.ToString().Trim();
googleImage.PageUrl = d.responseData.results[0].originalContextUrl.ToString().Trim();
googleImage.Date = DateTime.Now;
}
break;
case QueryResultTypes.Multi:
var googleImages = new List<SearchImage>();
if (d.responseData != null &&
d.responseData.results.Count != 0 &&
d.responseData.cursor.resultCount > 0)
{
for (int i = 0; i < (int) Count; i++)
{
var img = new SearchImage();
img.OriginalImageUrl = d.responseData.results[i].unescapedUrl.ToString().Trim();
img.ThumbnailImageUrl = img.OriginalImageUrl;
img.Title = d.responseData.results[i].titleNoFormatting.ToString().Trim();
img.Content = d.responseData.results[i].contentNoFormatting.ToString().Trim();
img.Copyright = d.responseData.results[i].visibleUrl.ToString().Trim();
img.CopyrightUrl = "http://" + d.responseData.results[i].visibleUrl.ToString().Trim();
img.PageUrl = d.responseData.results[i].originalContextUrl.ToString().Trim();
img.Date = DateTime.Now;
googleImages.Add(img);
}
}
Results = googleImages.ToArray();
break;
}
}
catch (Exception ex)
{
ex.WriteLog();
}
}
#region Parameters
private uint Index { get; set; }
private uint Count { get; set; }
#endregion
}
} | {
"content_hash": "9d020582dcc9998dece314cbd1a0d875",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 118,
"avg_line_length": 42.101851851851855,
"alnum_prop": 0.4756982625907192,
"repo_name": "Jarrey/MagicLockScreen",
"id": "49321123158225d68e8b07253feb8078d72536d1",
"size": "4549",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/MagicLockScreen.Service.ImageSearchService/Results/GoogleImageSearchResult.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "855899"
},
{
"name": "HTML",
"bytes": "135284"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace GitTutorialVS.Controllers
{
public class teste2Controller : Controller
{
// GET: teste2
public ActionResult Index()
{
//code to teste tes te 2
//olao teste 2
return View();
}
}
}
| {
"content_hash": "9ff1ce59b69635bf5ea3498eabee9b83",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 46,
"avg_line_length": 19.68421052631579,
"alnum_prop": 0.6016042780748663,
"repo_name": "NanoMania/GitRepoVisualStudio",
"id": "5dc4ef53d420f901cccdeb25a7f0a9d02a27d764",
"size": "376",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "GitTutorialVS/Controllers/teste2Controller.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "104"
},
{
"name": "C#",
"bytes": "9369"
},
{
"name": "CSS",
"bytes": "513"
},
{
"name": "JavaScript",
"bytes": "10318"
}
],
"symlink_target": ""
} |
package com.facebook.buck.shell;
import com.facebook.buck.core.description.BuildRuleParams;
import com.facebook.buck.core.description.arg.CommonDescriptionArg;
import com.facebook.buck.core.exceptions.HumanReadableException;
import com.facebook.buck.core.model.BuildTarget;
import com.facebook.buck.core.model.targetgraph.BuildRuleCreationContextWithTargetGraph;
import com.facebook.buck.core.model.targetgraph.DescriptionWithTargetGraph;
import com.facebook.buck.core.rules.BuildRule;
import com.facebook.buck.core.rules.BuildRuleResolver;
import com.facebook.buck.core.util.immutables.BuckStyleImmutable;
import com.facebook.buck.rules.args.Arg;
import com.facebook.buck.rules.macros.AbstractMacroExpanderWithoutPrecomputedWork;
import com.facebook.buck.rules.macros.LocationMacroExpander;
import com.facebook.buck.rules.macros.Macro;
import com.facebook.buck.rules.macros.StringWithMacros;
import com.facebook.buck.rules.macros.StringWithMacrosConverter;
import com.facebook.buck.util.environment.Platform;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedMap;
import java.util.Map;
import java.util.Optional;
import org.immutables.value.Value;
public class CommandAliasDescription
implements DescriptionWithTargetGraph<CommandAliasDescriptionArg> {
private final ImmutableList<AbstractMacroExpanderWithoutPrecomputedWork<? extends Macro>>
MACRO_EXPANDERS = ImmutableList.of(new LocationMacroExpander());
private final Platform platform;
public CommandAliasDescription(Platform platform) {
this.platform = platform;
}
@Override
public Class<CommandAliasDescriptionArg> getConstructorArgType() {
return CommandAliasDescriptionArg.class;
}
@Override
public BuildRule createBuildRule(
BuildRuleCreationContextWithTargetGraph context,
BuildTarget buildTarget,
BuildRuleParams params,
CommandAliasDescriptionArg args) {
if (args.getPlatformExe().isEmpty() && !args.getExe().isPresent()) {
throw new HumanReadableException(
"%s must have either 'exe' or 'platform_exe' set", buildTarget.getFullyQualifiedName());
}
ImmutableList.Builder<Arg> toolArgs = ImmutableList.builder();
ImmutableSortedMap.Builder<String, Arg> toolEnv = ImmutableSortedMap.naturalOrder();
BuildRuleResolver resolver = context.getBuildRuleResolver();
StringWithMacrosConverter macrosConverter =
StringWithMacrosConverter.of(
buildTarget, context.getCellPathResolver(), resolver, MACRO_EXPANDERS);
for (StringWithMacros x : args.getArgs()) {
toolArgs.add(macrosConverter.convert(x));
}
for (Map.Entry<String, StringWithMacros> x : args.getEnv().entrySet()) {
toolEnv.put(x.getKey(), macrosConverter.convert(x.getValue()));
}
Optional<BuildRule> exe = args.getExe().map(resolver::getRule);
ImmutableSortedMap.Builder<Platform, BuildRule> platformExe = ImmutableSortedMap.naturalOrder();
for (Map.Entry<Platform, BuildTarget> entry : args.getPlatformExe().entrySet()) {
platformExe.put(entry.getKey(), resolver.getRule(entry.getValue()));
}
return new CommandAlias(
buildTarget,
context.getProjectFilesystem(),
exe,
platformExe.build(),
toolArgs.build(),
toolEnv.build(),
platform);
}
@BuckStyleImmutable
@Value.Immutable
interface AbstractCommandAliasDescriptionArg extends CommonDescriptionArg {
ImmutableList<StringWithMacros> getArgs();
Optional<BuildTarget> getExe();
@Value.NaturalOrder
ImmutableSortedMap<Platform, BuildTarget> getPlatformExe();
ImmutableMap<String, StringWithMacros> getEnv();
}
}
| {
"content_hash": "55a879ad578c572125321fa9ba41d8bf",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 100,
"avg_line_length": 37.46,
"alnum_prop": 0.7696209289909236,
"repo_name": "LegNeato/buck",
"id": "568f02ea32592118c261a3a3ae2fe6e33f2360c0",
"size": "4351",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/facebook/buck/shell/CommandAliasDescription.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "943"
},
{
"name": "Batchfile",
"bytes": "2215"
},
{
"name": "C",
"bytes": "272474"
},
{
"name": "C#",
"bytes": "237"
},
{
"name": "C++",
"bytes": "16201"
},
{
"name": "CSS",
"bytes": "54894"
},
{
"name": "D",
"bytes": "1017"
},
{
"name": "Go",
"bytes": "5914"
},
{
"name": "Groovy",
"bytes": "3362"
},
{
"name": "HTML",
"bytes": "7343"
},
{
"name": "Haskell",
"bytes": "971"
},
{
"name": "IDL",
"bytes": "480"
},
{
"name": "Java",
"bytes": "26195757"
},
{
"name": "JavaScript",
"bytes": "933562"
},
{
"name": "Kotlin",
"bytes": "21291"
},
{
"name": "Lex",
"bytes": "2867"
},
{
"name": "MATLAB",
"bytes": "47"
},
{
"name": "Makefile",
"bytes": "1816"
},
{
"name": "OCaml",
"bytes": "4935"
},
{
"name": "Objective-C",
"bytes": "175204"
},
{
"name": "Objective-C++",
"bytes": "34"
},
{
"name": "PowerShell",
"bytes": "244"
},
{
"name": "Prolog",
"bytes": "858"
},
{
"name": "Python",
"bytes": "1922710"
},
{
"name": "Roff",
"bytes": "1207"
},
{
"name": "Rust",
"bytes": "5199"
},
{
"name": "Scala",
"bytes": "5082"
},
{
"name": "Shell",
"bytes": "63901"
},
{
"name": "Smalltalk",
"bytes": "3796"
},
{
"name": "Swift",
"bytes": "10765"
},
{
"name": "Thrift",
"bytes": "45968"
},
{
"name": "Yacc",
"bytes": "323"
}
],
"symlink_target": ""
} |
import React from 'react';
export default ({ className = '', ...props }) => (
<i className={`${className} fa fa-th`} {...props} />
);
| {
"content_hash": "90fa8bc83b009954e4292a9e62a784e3",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 54,
"avg_line_length": 27.4,
"alnum_prop": 0.5620437956204379,
"repo_name": "NCI-GDC/portal-ui",
"id": "808806684d3592b2df869892a70814f25ff95d68",
"size": "146",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/packages/@ncigdc/theme/icons/Grid.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "207780"
},
{
"name": "Dockerfile",
"bytes": "1690"
},
{
"name": "HTML",
"bytes": "3336"
},
{
"name": "JavaScript",
"bytes": "3945229"
},
{
"name": "Mustache",
"bytes": "2163"
},
{
"name": "SCSS",
"bytes": "16991"
},
{
"name": "Shell",
"bytes": "3353"
},
{
"name": "TypeScript",
"bytes": "224619"
}
],
"symlink_target": ""
} |
[](http://badge.fury.io/rb/has_wysiwyg_content)
## Installation
Add this line to your application's Gemfile:
gem 'has_wysiwyg_content'
And then execute:
$ bundle
Or install it yourself as:
$ gem install has_wysiwyg_content
## Usage
TBD...
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
| {
"content_hash": "93a5f37e7ccc4a4a428f7bbdfbc6b86d",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 111,
"avg_line_length": 20.85185185185185,
"alnum_prop": 0.7069271758436945,
"repo_name": "phallstrom/has_wysiwyg_content",
"id": "9c70326addb6cff0c4787ba6a41080d496180b05",
"size": "584",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "7246"
}
],
"symlink_target": ""
} |
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization.Json;
using System.Text;
using System.Xml;
using Orchard.Environment.Extensions;
namespace Piedone.HelpfulLibraries.Serialization
{
[OrchardFeature("Piedone.HelpfulLibraries.Serialization")]
public class SimpleSerializer : ISimpleSerializer
{
public string XmlSerialize<T>(T obj)
{
string serialization;
using (var sw = new StringWriter())
{
using (var writer = new XmlTextWriter(sw))
{
var serializer = new DataContractSerializer(obj.GetType());
serializer.WriteObject(writer, obj);
writer.Flush();
serialization = sw.ToString();
}
}
return serialization;
}
public T XmlDeserialize<T>(string serialization)
{
var serializer = new DataContractSerializer(typeof(T));
var doc = new XmlDocument();
doc.LoadXml(serialization);
var reader = new XmlNodeReader(doc.DocumentElement);
return (T)serializer.ReadObject(reader);
}
public string JsonSerialize<T>(T obj)
{
using (var stream = new MemoryStream())
{
using (var sr = new StreamReader(stream))
{
var serializer = new DataContractJsonSerializer(obj.GetType());
serializer.WriteObject(stream, obj);
stream.Position = 0;
return sr.ReadToEnd();
}
}
}
public T JsonDeserialize<T>(string serialization)
{
using (var stream = new MemoryStream(Encoding.Unicode.GetBytes(serialization)))
{
var serializer = new DataContractJsonSerializer(typeof(T));
stream.Position = 0;
return (T)serializer.ReadObject(stream);
}
}
public string Base64Serialize<T>(T obj)
{
// Taken entirely from http://snipplr.com/view/8013/, refactored
var ms = new MemoryStream();
var bf = new BinaryFormatter();
bf.Serialize(ms, obj);
var bytes = ms.GetBuffer();
return bytes.Length + ":" + Convert.ToBase64String(bytes, 0, bytes.Length, Base64FormattingOptions.None);
}
public T Base64Deserialize<T>(string serialization)
{
// Taken entirely from http://snipplr.com/view/8014/, refactored
// We need to know the exact length of the string - Base64 can sometimes pad us by a byte or two
int lengthDelimiterPosition = serialization.IndexOf(':');
int length = Int32.Parse(serialization.Substring(0, lengthDelimiterPosition));
// Extract data from the base 64 string!
var bytes = Convert.FromBase64String(serialization.Substring(lengthDelimiterPosition + 1));
var ms = new MemoryStream(bytes, 0, length);
var bf = new BinaryFormatter();
return (T)bf.Deserialize(ms);
}
}
}
| {
"content_hash": "b8fc0a2f9908f4ed0df8ed26d4adc165",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 117,
"avg_line_length": 34.97872340425532,
"alnum_prop": 0.5742092457420924,
"repo_name": "CloudMetal/CloudMetal-Pipeline-Deploy",
"id": "8cdd66000be9100141b965fcafaeebd63faa2ac5",
"size": "3290",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "Modules/Piedone.HelpfulLibraries/Libraries/Serialization/SimpleSerializer.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "102"
},
{
"name": "C#",
"bytes": "2221073"
},
{
"name": "JavaScript",
"bytes": "822981"
}
],
"symlink_target": ""
} |
// (C) Copyright 2015 Martin Dougiamas
//
// 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.
angular.module('mm.addons.calendar')
/**
* Controller to handle calendar events.
*
* @module mm.addons.calendar
* @ngdoc controller
* @name mmaCalendarListCtrl
*/
.controller('mmaCalendarListCtrl', function($scope, $stateParams, $log, $state, $mmaCalendar, $mmUtil, $ionicHistory, $mmEvents,
mmaCalendarDaysInterval, $ionicScrollDelegate, $mmLocalNotifications, $mmCourses, mmaCalendarDefaultNotifTimeChangedEvent,
$ionicPopover, $q, $translate) {
$log = $log.getInstance('mmaCalendarListCtrl');
var daysLoaded,
emptyEventsTimes, // Variable to identify consecutive calls returning 0 events.
scrollView = $ionicScrollDelegate.$getByHandle('mmaCalendarEventsListScroll'),
obsDefaultTimeChange,
popover,
allCourses = {
id: -1,
fullname: $translate.instant('mm.core.fulllistofcourses')
};
if ($stateParams.eventid) {
// We arrived here via notification click, let's clear history and redirect to event details.
$ionicHistory.clearHistory();
$state.go('site.calendar-event', {id: $stateParams.eventid});
}
// Convenience function to initialize variables.
function initVars() {
daysLoaded = 0;
emptyEventsTimes = 0;
$scope.events = [];
}
// Fetch all the data required for the view.
function fetchData(refresh) {
initVars();
return loadCourses().then(function() {
return fetchEvents(refresh);
});
}
// Convenience function that fetches the events and updates the scope.
function fetchEvents(refresh) {
return $mmaCalendar.getEvents(daysLoaded, mmaCalendarDaysInterval, refresh).then(function(events) {
daysLoaded += mmaCalendarDaysInterval;
if (events.length === 0) {
emptyEventsTimes++;
if (emptyEventsTimes > 5) { // Stop execution if we retrieve empty list 6 consecutive times.
$scope.canLoadMore = false;
$scope.eventsLoaded = true;
} else {
// No events returned, load next events.
return fetchEvents();
}
} else {
angular.forEach(events, $mmaCalendar.formatEventData);
if (refresh) {
$scope.events = events;
} else {
$scope.events = $scope.events.concat(events);
}
$scope.eventsLoaded = true;
$scope.canLoadMore = true;
// Schedule notifications for the events retrieved (might have new events).
$mmaCalendar.scheduleEventsNotifications(events);
}
// Resize the scroll view so infinite loading is able to calculate if it should load more items or not.
scrollView.resize();
}, function(error) {
if (error) {
$mmUtil.showErrorModal(error);
} else {
$mmUtil.showErrorModal('mma.calendar.errorloadevents', true);
}
$scope.eventsLoaded = true;
$scope.canLoadMore = false; // Set to false to prevent infinite calls with infinite-loading.
});
}
// Load courses for the popover.
function loadCourses() {
return $mmCourses.getUserCourses(false).then(function(courses) {
// Add "All courses".
courses.unshift(allCourses);
$scope.courses = courses;
});
}
$scope.filter = {
courseid: -1,
};
$scope.notificationsEnabled = $mmLocalNotifications.isAvailable();
// Get first events.
fetchData();
// Init popover.
$ionicPopover.fromTemplateUrl('addons/calendar/templates/course_picker.html', {
scope: $scope
}).then(function(po) {
popover = po;
// Open the popover to filter by course.
$scope.pickCourse = function(event) {
popover.show(event);
};
// Course picked.
$scope.coursePicked = function() {
popover.hide();
scrollView.scrollTop();
};
});
// Load more events.
$scope.loadMoreEvents = function() {
fetchEvents().finally(function() {
$scope.$broadcast('scroll.infiniteScrollComplete');
});
};
// Pull to refresh.
$scope.refreshEvents = function() {
var promises = [];
promises.push($mmCourses.invalidateUserCourses());
promises.push($mmaCalendar.invalidateEventsList());
return $q.all(promises).finally(function() {
fetchData(true).finally(function() {
$scope.$broadcast('scroll.refreshComplete');
});
});
};
// Open calendar events settings.
$scope.openSettings = function() {
$state.go('site.calendar-settings');
};
// Filter event by course.
$scope.filterEvent = function(event) {
if ($scope.filter.courseid == -1) {
// All courses, nothing to filter.
return true;
}
// Show the event if it has courseid 1 or if it matches the selected course.
return event.courseid === 1 || event.courseid == $scope.filter.courseid;
};
if ($scope.notificationsEnabled) {
// Re-schedule events if default time changes.
obsDefaultTimeChange = $mmEvents.on(mmaCalendarDefaultNotifTimeChangedEvent, function() {
$mmaCalendar.scheduleEventsNotifications($scope.events);
});
}
$scope.$on('$destroy', function() {
obsDefaultTimeChange && obsDefaultTimeChange.off && obsDefaultTimeChange.off();
popover && popover.remove();
});
});
| {
"content_hash": "c85c93253b22a0e9df3ab192d992b46a",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 130,
"avg_line_length": 35.32972972972973,
"alnum_prop": 0.5835373317013464,
"repo_name": "stywithme/App",
"id": "fde9e23319447717c06dfb5d431a0f5a1d8018be",
"size": "6536",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "www/addons/calendar/controllers/list.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "61712"
},
{
"name": "HTML",
"bytes": "294143"
},
{
"name": "JavaScript",
"bytes": "3964443"
}
],
"symlink_target": ""
} |
3.0.3 Release Notes
===================
Channels 3.0.3 fixes a security issue in Channels 3.0.2
CVE-2020-35681: Potential leakage of session identifiers using legacy ``AsgiHandler``
-------------------------------------------------------------------------------------
The legacy ``channels.http.AsgiHandler`` class, used for handling HTTP type
requests in an ASGI environment prior to Django 3.0, did not correctly separate
request scopes in Channels 3.0. In many cases this would result in a crash but,
with correct timing responses could be sent to the wrong client, resulting in
potential leakage of session identifiers and other sensitive data.
This issue affects Channels 3.0.x before 3.0.3, and is resolved in Channels
3.0.3.
Users of ``ProtocolTypeRouter`` not explicitly specifying the handler for the
``'http'`` key, or those explicitly using ``channels.http.AsgiHandler``, likely
to support Django v2.2, are affected and should update immediately.
Note that both an unspecified handler for the ``'http'`` key and using
``channels.http.AsgiHandler`` are deprecated, and will raise a warning, from
Channels v3.0.0
This issue affects only the legacy channels provided class, and not Django's
similar ``ASGIHandler``, available from Django 3.0. It is recommended to update
to Django 3.0+ and use the Django provided ``ASGIHandler``.
A simplified ``asgi.py`` script will look like this:
.. code-block:: python
import os
from django.conf.urls import url
from django.core.asgi import get_asgi_application
# Fetch Django ASGI application early to ensure AppRegistry is populated
# before importing consumers and AuthMiddlewareStack that may import ORM
# models.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
django_asgi_app = get_asgi_application()
# Import other Channels classes and consumers here.
from channels.routing import ProtocolTypeRouter, URLRouter
application = ProtocolTypeRouter({
# Explicitly set 'http' key using Django's ASGI application.
"http": django_asgi_app,
),
})
Please see :doc:`/deploying` for a more complete example.
| {
"content_hash": "89295c0b670664fabaaac0e4203941f4",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 85,
"avg_line_length": 39.925925925925924,
"alnum_prop": 0.7161410018552876,
"repo_name": "andrewgodwin/django-channels",
"id": "1f1e041efda684660486fe3385bc2b5ea3f91633",
"size": "2156",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "docs/releases/3.0.3.rst",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "76456"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_92) on Sat Jul 02 22:07:38 EEST 2016 -->
<title>TimeoutService</title>
<meta name="date" content="2016-07-02">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="TimeoutService";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-files/index-1.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../sotechat/service/QueueTimeOutServiceTest.html" title="class in sotechat.service"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../sotechat/service/ValidatorService.html" title="class in sotechat.service"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?sotechat/service/TimeoutService.html" target="_top">Frames</a></li>
<li><a href="TimeoutService.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">sotechat.service</div>
<h2 title="Class TimeoutService" class="title">Class TimeoutService</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>sotechat.service.TimeoutService</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>@Service
public class <span class="typeNameLabel">TimeoutService</span>
extends java.lang.Object</pre>
<div class="block">Poistaa kadonneet kayttajat odotteluajan jalkeen.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../sotechat/service/TimeoutService.html#TimeoutService--">TimeoutService</a></span>()</code>
<div class="block">Konstruktori.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../sotechat/service/TimeoutService.html#processDisconnect-java.lang.String-">processDisconnect</a></span>(java.lang.String sessionId)</code>
<div class="block">Tarkistetaan, onko kayttaja yha poissa, ja poistetaan kayttaja jos on.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../sotechat/service/TimeoutService.html#setTimer-java.util.Timer-">setTimer</a></span>(java.util.Timer pTimer)</code>
<div class="block">Testausta helpottava setteri ajastinoliolle.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../sotechat/service/TimeoutService.html#waitThenProcessDisconnect-java.lang.String-">waitThenProcessDisconnect</a></span>(java.lang.String sessionId)</code>
<div class="block">Kaynnistetaan odotus, jonka jalkeen kutsutaan
removeInactiveUserFromQueue-metodia.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="TimeoutService--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>TimeoutService</h4>
<pre>public TimeoutService()</pre>
<div class="block">Konstruktori.</div>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="waitThenProcessDisconnect-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>waitThenProcessDisconnect</h4>
<pre>public void waitThenProcessDisconnect(java.lang.String sessionId)</pre>
<div class="block">Kaynnistetaan odotus, jonka jalkeen kutsutaan
removeInactiveUserFromQueue-metodia.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sessionId</code> - Annetaan parametrina sessionId, jonka perusteella
voidaan tarkistaa, onko sessio viela aktiivinen,
vai pitaako se poistaa jonosta.</dd>
</dl>
</li>
</ul>
<a name="processDisconnect-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>processDisconnect</h4>
<pre>public void processDisconnect(java.lang.String sessionId)</pre>
<div class="block">Tarkistetaan, onko kayttaja yha poissa, ja poistetaan kayttaja jos on.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sessionId</code> - Poistettavan kayttajan sessionId.</dd>
</dl>
</li>
</ul>
<a name="setTimer-java.util.Timer-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>setTimer</h4>
<pre>public void setTimer(java.util.Timer pTimer)</pre>
<div class="block">Testausta helpottava setteri ajastinoliolle.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>pTimer</code> - Parametrina annettava ajastinolio, joka annetaan
QueueTimeoutServicessa oliomuuttujana olevalle ajastimelle
arvoksi.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-files/index-1.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../sotechat/service/QueueTimeOutServiceTest.html" title="class in sotechat.service"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../sotechat/service/ValidatorService.html" title="class in sotechat.service"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?sotechat/service/TimeoutService.html" target="_top">Frames</a></li>
<li><a href="TimeoutService.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "a80a1db33cd5cad4260a84fe31036656",
"timestamp": "",
"source": "github",
"line_count": 327,
"max_line_length": 391,
"avg_line_length": 34.7737003058104,
"alnum_prop": 0.6593087679183889,
"repo_name": "PauliNiva/Sotechat",
"id": "b98c621459c95a48e22ab09be79aaaea062404b0",
"size": "11371",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "documents/javadocs/sotechat/service/TimeoutService.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "22462"
},
{
"name": "HTML",
"bytes": "6273601"
},
{
"name": "Java",
"bytes": "405305"
},
{
"name": "JavaScript",
"bytes": "214813"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_51) on Thu Apr 28 18:37:28 UTC 2016 -->
<title>Maps (apache-cassandra API)</title>
<meta name="date" content="2016-04-28">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Maps (apache-cassandra API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Maps.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/cassandra/cql3/Lists.Value.html" title="class in org.apache.cassandra.cql3"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/apache/cassandra/cql3/Maps.DelayedValue.html" title="class in org.apache.cassandra.cql3"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/cassandra/cql3/Maps.html" target="_top">Frames</a></li>
<li><a href="Maps.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested_class_summary">Nested</a> | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.cassandra.cql3</div>
<h2 title="Class Maps" class="title">Class Maps</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.apache.cassandra.cql3.Maps</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public abstract class <span class="strong">Maps</span>
extends java.lang.Object</pre>
<div class="block">Static helper methods and classes for maps.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested_class_summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/cql3/Maps.DelayedValue.html" title="class in org.apache.cassandra.cql3">Maps.DelayedValue</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/cql3/Maps.DiscarderByKey.html" title="class in org.apache.cassandra.cql3">Maps.DiscarderByKey</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/cql3/Maps.Literal.html" title="class in org.apache.cassandra.cql3">Maps.Literal</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/cql3/Maps.Marker.html" title="class in org.apache.cassandra.cql3">Maps.Marker</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/cql3/Maps.Putter.html" title="class in org.apache.cassandra.cql3">Maps.Putter</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/cql3/Maps.Setter.html" title="class in org.apache.cassandra.cql3">Maps.Setter</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/cql3/Maps.SetterByKey.html" title="class in org.apache.cassandra.cql3">Maps.SetterByKey</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class </code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/cql3/Maps.Value.html" title="class in org.apache.cassandra.cql3">Maps.Value</a></strong></code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../org/apache/cassandra/cql3/ColumnSpecification.html" title="class in org.apache.cassandra.cql3">ColumnSpecification</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/cql3/Maps.html#keySpecOf(org.apache.cassandra.cql3.ColumnSpecification)">keySpecOf</a></strong>(<a href="../../../../org/apache/cassandra/cql3/ColumnSpecification.html" title="class in org.apache.cassandra.cql3">ColumnSpecification</a> column)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../org/apache/cassandra/cql3/ColumnSpecification.html" title="class in org.apache.cassandra.cql3">ColumnSpecification</a></code></td>
<td class="colLast"><code><strong><a href="../../../../org/apache/cassandra/cql3/Maps.html#valueSpecOf(org.apache.cassandra.cql3.ColumnSpecification)">valueSpecOf</a></strong>(<a href="../../../../org/apache/cassandra/cql3/ColumnSpecification.html" title="class in org.apache.cassandra.cql3">ColumnSpecification</a> column)</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="keySpecOf(org.apache.cassandra.cql3.ColumnSpecification)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>keySpecOf</h4>
<pre>public static <a href="../../../../org/apache/cassandra/cql3/ColumnSpecification.html" title="class in org.apache.cassandra.cql3">ColumnSpecification</a> keySpecOf(<a href="../../../../org/apache/cassandra/cql3/ColumnSpecification.html" title="class in org.apache.cassandra.cql3">ColumnSpecification</a> column)</pre>
</li>
</ul>
<a name="valueSpecOf(org.apache.cassandra.cql3.ColumnSpecification)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>valueSpecOf</h4>
<pre>public static <a href="../../../../org/apache/cassandra/cql3/ColumnSpecification.html" title="class in org.apache.cassandra.cql3">ColumnSpecification</a> valueSpecOf(<a href="../../../../org/apache/cassandra/cql3/ColumnSpecification.html" title="class in org.apache.cassandra.cql3">ColumnSpecification</a> column)</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Maps.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/cassandra/cql3/Lists.Value.html" title="class in org.apache.cassandra.cql3"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../org/apache/cassandra/cql3/Maps.DelayedValue.html" title="class in org.apache.cassandra.cql3"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/cassandra/cql3/Maps.html" target="_top">Frames</a></li>
<li><a href="Maps.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested_class_summary">Nested</a> | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2016 The Apache Software Foundation</small></p>
</body>
</html>
| {
"content_hash": "d3e8466f150dbcbebdb826cd310503a7",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 346,
"avg_line_length": 41.37676056338028,
"alnum_prop": 0.652710407624883,
"repo_name": "elisska/cloudera-cassandra",
"id": "1612c69133f8cea3d253ec1225a1aad02f088e03",
"size": "11751",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DATASTAX_CASSANDRA-2.2.6/javadoc/org/apache/cassandra/cql3/Maps.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "75145"
},
{
"name": "CSS",
"bytes": "4112"
},
{
"name": "HTML",
"bytes": "331372"
},
{
"name": "PowerShell",
"bytes": "77673"
},
{
"name": "Python",
"bytes": "979128"
},
{
"name": "Shell",
"bytes": "143685"
},
{
"name": "Thrift",
"bytes": "80564"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_25) on Sun Nov 09 22:45:59 SGT 2014 -->
<title>EventItem</title>
<meta name="date" content="2014-11-09">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="EventItem";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/EventItem.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../edu/dynamic/dynamiz/structure/ErrorFeedback.html" title="class in edu.dynamic.dynamiz.structure"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../edu/dynamic/dynamiz/structure/Feedback.html" title="class in edu.dynamic.dynamiz.structure"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?edu/dynamic/dynamiz/structure/EventItem.html" target="_top">Frames</a></li>
<li><a href="EventItem.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#fields.inherited.from.class.edu.dynamic.dynamiz.structure.ToDoItem">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">edu.dynamic.dynamiz.structure</div>
<h2 title="Class EventItem" class="title">Class EventItem</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">edu.dynamic.dynamiz.structure.ToDoItem</a></li>
<li>
<ul class="inheritance">
<li>edu.dynamic.dynamiz.structure.EventItem</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.lang.Comparable<<a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a>></dd>
</dl>
<hr>
<br>
<pre>public class <span class="typeNameLabel">EventItem</span>
extends <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a></pre>
<div class="block">Defines each event in the To-Do list.
Each event is defined as having start and/or end date(s).
Constructors
EventItem(String description, MyDate eventDate) //start and end dates are the same with no specified time.
EventItem(String description, MyDate start, MyDate end) //start and end dates can be different with no specified time.
EventItem(String description, int priority, MyDate date)
EventItem(String description, int priority, MyDate start, MyDate end) //The full form of constructor
EventItem(EventItem event) //Creates a new copy of the given event.
EventItem(ToDoItem item, MyDate start, MyDate end) //Converts ToDoItem to EventItem
EventItem(TaskItem task, MyDate start) //Converts TaskItem into EventItem
Public Methods
MyDate getEndDate() //Gets the end date for this event.
String getEndDateString() //Gets the string representation of this event's end date.
MyDate getStartDate() //gets the start date for this event.
String getStartDateString() //Gets the string representation of this event's start date.
void setEndDate(MyDate end) //Sets the end date for this event.
void setStartDate(MyDate start) //Sets the start date for this event.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.edu.dynamic.dynamiz.structure.ToDoItem">
<!-- -->
</a>
<h3>Fields inherited from class edu.dynamic.dynamiz.structure.<a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a></h3>
<code><a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#PRIORITY_HIGH">PRIORITY_HIGH</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#PRIORITY_LOW">PRIORITY_LOW</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#PRIORITY_NONE">PRIORITY_NONE</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#PRIORITY_NORMAL">PRIORITY_NORMAL</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#PRIORITY_URGENT">PRIORITY_URGENT</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#STATUS_COMPLETED">STATUS_COMPLETED</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#STATUS_PENDING">STATUS_PENDING</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#EventItem-edu.dynamic.dynamiz.structure.EventItem-">EventItem</a></span>(<a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html" title="class in edu.dynamic.dynamiz.structure">EventItem</a> event)</code>
<div class="block">Creates a copy of the given event.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#EventItem-java.lang.String-int-edu.dynamic.dynamiz.structure.MyDate-">EventItem</a></span>(java.lang.String description,
int priority,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> date)</code>
<div class="block">Creates a new instance of this event.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#EventItem-java.lang.String-int-edu.dynamic.dynamiz.structure.MyDate-edu.dynamic.dynamiz.structure.MyDate-">EventItem</a></span>(java.lang.String description,
int priority,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> startDate,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> endDate)</code>
<div class="block">Creates a new instance of this event.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#EventItem-java.lang.String-edu.dynamic.dynamiz.structure.MyDate-">EventItem</a></span>(java.lang.String description,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> date)</code>
<div class="block">Creates a new instance of this event.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#EventItem-java.lang.String-edu.dynamic.dynamiz.structure.MyDate-edu.dynamic.dynamiz.structure.MyDate-">EventItem</a></span>(java.lang.String description,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> startDate,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> endDate)</code>
<div class="block">Creates a new instance of this event.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#EventItem-edu.dynamic.dynamiz.structure.TaskItem-edu.dynamic.dynamiz.structure.MyDate-">EventItem</a></span>(<a href="../../../../edu/dynamic/dynamiz/structure/TaskItem.html" title="class in edu.dynamic.dynamiz.structure">TaskItem</a> task,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> start)</code>
<div class="block">Creates a new EventItem instance from the given TaskItem.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#EventItem-edu.dynamic.dynamiz.structure.ToDoItem-edu.dynamic.dynamiz.structure.MyDate-">EventItem</a></span>(<a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a> item,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> start)</code>
<div class="block">Creates a new instance of the given item as an event, while retaining all its existing values.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#EventItem-edu.dynamic.dynamiz.structure.ToDoItem-edu.dynamic.dynamiz.structure.MyDate-edu.dynamic.dynamiz.structure.MyDate-">EventItem</a></span>(<a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a> item,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> start,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> end)</code>
<div class="block">Creates a new instance of the given item as an event, while retaining all its existing values.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#compareTo-edu.dynamic.dynamiz.structure.ToDoItem-">compareTo</a></span>(<a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a> item)</code> </td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#getEndDate--">getEndDate</a></span>()</code>
<div class="block">Returns the end date of this event.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#getEndDateString--">getEndDateString</a></span>()</code>
<div class="block">Returns the string representation of the end date and/or time in this class.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#getFeedbackString--">getFeedbackString</a></span>()</code>
<div class="block">Gets the feedback string format of this item.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#getStartDate--">getStartDate</a></span>()</code>
<div class="block">Returns the start date of this event.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#getStartDateString--">getStartDateString</a></span>()</code>
<div class="block">Returns the string representation of the start date and/or time in this class.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#setEndDate-edu.dynamic.dynamiz.structure.MyDate-">setEndDate</a></span>(<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> endDate)</code>
<div class="block">Sets the end date for this event.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#setStartDate-edu.dynamic.dynamiz.structure.MyDate-">setStartDate</a></span>(<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> startDate)</code>
<div class="block">Sets the start date for this event.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#toFileString--">toFileString</a></span>()</code>
<div class="block">Returns a string representation of this item to be displayed for feedback and confirmation.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html#toString--">toString</a></span>()</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.edu.dynamic.dynamiz.structure.ToDoItem">
<!-- -->
</a>
<h3>Methods inherited from class edu.dynamic.dynamiz.structure.<a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a></h3>
<code><a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#equals-java.lang.Object-">equals</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#getDescription--">getDescription</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#getId--">getId</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#getPriority--">getPriority</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#getStatus--">getStatus</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#isValidPriority-int-">isValidPriority</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#setDescription-java.lang.String-">setDescription</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#setPriority-int-">setPriority</a>, <a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#setStatus-java.lang.String-">setStatus</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="EventItem-java.lang.String-edu.dynamic.dynamiz.structure.MyDate-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EventItem</h4>
<pre>public EventItem(java.lang.String description,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> date)</pre>
<div class="block">Creates a new instance of this event.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>description</code> - The event's description.</dd>
<dd><code>date</code> - The event's start and end date.</dd>
</dl>
</li>
</ul>
<a name="EventItem-java.lang.String-int-edu.dynamic.dynamiz.structure.MyDate-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EventItem</h4>
<pre>public EventItem(java.lang.String description,
int priority,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> date)</pre>
<div class="block">Creates a new instance of this event.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>description</code> - The event's description.</dd>
<dd><code>priority</code> - The event's priority level.</dd>
<dd><code>date</code> - The event's start and end date.</dd>
</dl>
</li>
</ul>
<a name="EventItem-java.lang.String-edu.dynamic.dynamiz.structure.MyDate-edu.dynamic.dynamiz.structure.MyDate-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EventItem</h4>
<pre>public EventItem(java.lang.String description,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> startDate,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> endDate)</pre>
<div class="block">Creates a new instance of this event.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>description</code> - The event's description.</dd>
<dd><code>startDate</code> - The event's start date.</dd>
<dd><code>end</code> - The event's end date.</dd>
</dl>
</li>
</ul>
<a name="EventItem-java.lang.String-int-edu.dynamic.dynamiz.structure.MyDate-edu.dynamic.dynamiz.structure.MyDate-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EventItem</h4>
<pre>public EventItem(java.lang.String description,
int priority,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> startDate,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> endDate)</pre>
<div class="block">Creates a new instance of this event.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>description</code> - The event's description.</dd>
<dd><code>priority</code> - The event's priority.</dd>
<dd><code>startDate</code> - The event's start date.</dd>
<dd><code>endDate</code> - The event's end date.</dd>
</dl>
</li>
</ul>
<a name="EventItem-edu.dynamic.dynamiz.structure.EventItem-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EventItem</h4>
<pre>public EventItem(<a href="../../../../edu/dynamic/dynamiz/structure/EventItem.html" title="class in edu.dynamic.dynamiz.structure">EventItem</a> event)</pre>
<div class="block">Creates a copy of the given event. The resulting instance, e, is such that
e!=event and e.equals(event) returns true.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>event</code> - The EventItem to be copied.</dd>
</dl>
</li>
</ul>
<a name="EventItem-edu.dynamic.dynamiz.structure.ToDoItem-edu.dynamic.dynamiz.structure.MyDate-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EventItem</h4>
<pre>public EventItem(<a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a> item,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> start)</pre>
<div class="block">Creates a new instance of the given item as an event, while retaining all its existing values.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>start</code> - The start date of this event.</dd>
</dl>
</li>
</ul>
<a name="EventItem-edu.dynamic.dynamiz.structure.ToDoItem-edu.dynamic.dynamiz.structure.MyDate-edu.dynamic.dynamiz.structure.MyDate-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EventItem</h4>
<pre>public EventItem(<a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a> item,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> start,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> end)</pre>
<div class="block">Creates a new instance of the given item as an event, while retaining all its existing values.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>item</code> - The ToDoItem object to downcast.</dd>
<dd><code>start</code> - The start date of this event.</dd>
<dd><code>end</code> - The end date of this event.</dd>
</dl>
</li>
</ul>
<a name="EventItem-edu.dynamic.dynamiz.structure.TaskItem-edu.dynamic.dynamiz.structure.MyDate-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>EventItem</h4>
<pre>public EventItem(<a href="../../../../edu/dynamic/dynamiz/structure/TaskItem.html" title="class in edu.dynamic.dynamiz.structure">TaskItem</a> task,
<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> start)</pre>
<div class="block">Creates a new EventItem instance from the given TaskItem.
This is not typecasting but is a copy conversion.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>task</code> - The TaskItem object to be converted.</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getStartDate--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getStartDate</h4>
<pre>public <a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> getStartDate()</pre>
<div class="block">Returns the start date of this event.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A Date object of the start date or null if the start date is not set.</dd>
</dl>
</li>
</ul>
<a name="getStartDateString--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getStartDateString</h4>
<pre>public java.lang.String getStartDateString()</pre>
<div class="block">Returns the string representation of the start date and/or time in this class.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A String representation of the start date and/or time used in this class.</dd>
</dl>
</li>
</ul>
<a name="getEndDate--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEndDate</h4>
<pre>public <a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> getEndDate()</pre>
<div class="block">Returns the end date of this event.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A Date object of the end date or null if the end date is not set.</dd>
</dl>
</li>
</ul>
<a name="getEndDateString--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEndDateString</h4>
<pre>public java.lang.String getEndDateString()</pre>
<div class="block">Returns the string representation of the end date and/or time in this class.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A String representation of the end date and/or time used in this class.</dd>
</dl>
</li>
</ul>
<a name="setStartDate-edu.dynamic.dynamiz.structure.MyDate-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setStartDate</h4>
<pre>public void setStartDate(<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> startDate)</pre>
<div class="block">Sets the start date for this event.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>startDate</code> - The new start date for this event.</dd>
</dl>
</li>
</ul>
<a name="setEndDate-edu.dynamic.dynamiz.structure.MyDate-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setEndDate</h4>
<pre>public void setEndDate(<a href="../../../../edu/dynamic/dynamiz/structure/MyDate.html" title="class in edu.dynamic.dynamiz.structure">MyDate</a> endDate)</pre>
<div class="block">Sets the end date for this event.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>endDate</code> - The new end date for this event.</dd>
</dl>
</li>
</ul>
<a name="toString--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre>public java.lang.String toString()</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#toString--">toString</a></code> in class <code><a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a></code></dd>
</dl>
</li>
</ul>
<a name="getFeedbackString--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFeedbackString</h4>
<pre>public java.lang.String getFeedbackString()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#getFeedbackString--">ToDoItem</a></code></span></div>
<div class="block">Gets the feedback string format of this item.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#getFeedbackString--">getFeedbackString</a></code> in class <code><a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The feedback string representation of this item.</dd>
</dl>
</li>
</ul>
<a name="toFileString--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toFileString</h4>
<pre>public java.lang.String toFileString()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#toFileString--">ToDoItem</a></code></span></div>
<div class="block">Returns a string representation of this item to be displayed for feedback and confirmation.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#toFileString--">toFileString</a></code> in class <code><a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>A formatted String representing this item.</dd>
</dl>
</li>
</ul>
<a name="compareTo-edu.dynamic.dynamiz.structure.ToDoItem-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>compareTo</h4>
<pre>public int compareTo(<a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a> item)</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>compareTo</code> in interface <code>java.lang.Comparable<<a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a>></code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html#compareTo-edu.dynamic.dynamiz.structure.ToDoItem-">compareTo</a></code> in class <code><a href="../../../../edu/dynamic/dynamiz/structure/ToDoItem.html" title="class in edu.dynamic.dynamiz.structure">ToDoItem</a></code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/EventItem.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../edu/dynamic/dynamiz/structure/ErrorFeedback.html" title="class in edu.dynamic.dynamiz.structure"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../edu/dynamic/dynamiz/structure/Feedback.html" title="class in edu.dynamic.dynamiz.structure"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?edu/dynamic/dynamiz/structure/EventItem.html" target="_top">Frames</a></li>
<li><a href="EventItem.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#fields.inherited.from.class.edu.dynamic.dynamiz.structure.ToDoItem">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "13ce255655b822e1a4efdbf78e886dbe",
"timestamp": "",
"source": "github",
"line_count": 686,
"max_line_length": 933,
"avg_line_length": 50.424198250728864,
"alnum_prop": 0.6790783729871932,
"repo_name": "cs2103aug2014-w13-2j/main",
"id": "17ec57083c7c39ef12a5e391da57fa6d61a92c74",
"size": "34591",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/edu/dynamic/dynamiz/structure/EventItem.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "12808"
},
{
"name": "Java",
"bytes": "305813"
},
{
"name": "JavaScript",
"bytes": "827"
}
],
"symlink_target": ""
} |
package spaces
import (
"encoding/json"
"fmt"
"net/url"
"strings"
"github.com/cloudfoundry/cli/cf/api/resources"
"github.com/cloudfoundry/cli/cf/configuration/coreconfig"
"github.com/cloudfoundry/cli/cf/errors"
"github.com/cloudfoundry/cli/cf/models"
"github.com/cloudfoundry/cli/cf/net"
)
//go:generate counterfeiter . SpaceRepository
type SpaceRepository interface {
ListSpaces(func(models.Space) bool) error
FindByName(name string) (space models.Space, apiErr error)
FindByNameInOrg(name, orgGUID string) (space models.Space, apiErr error)
Create(name string, orgGUID string, spaceQuotaGUID string) (space models.Space, apiErr error)
Rename(spaceGUID, newName string) (apiErr error)
SetAllowSSH(spaceGUID string, allow bool) (apiErr error)
Delete(spaceGUID string) (apiErr error)
}
type CloudControllerSpaceRepository struct {
config coreconfig.Reader
gateway net.Gateway
}
func NewCloudControllerSpaceRepository(config coreconfig.Reader, gateway net.Gateway) (repo CloudControllerSpaceRepository) {
repo.config = config
repo.gateway = gateway
return
}
func (repo CloudControllerSpaceRepository) ListSpaces(callback func(models.Space) bool) error {
return repo.gateway.ListPaginatedResources(
repo.config.APIEndpoint(),
fmt.Sprintf("/v2/organizations/%s/spaces?order-by=name&inline-relations-depth=1", repo.config.OrganizationFields().GUID),
resources.SpaceResource{},
func(resource interface{}) bool {
return callback(resource.(resources.SpaceResource).ToModel())
})
}
func (repo CloudControllerSpaceRepository) FindByName(name string) (space models.Space, apiErr error) {
return repo.FindByNameInOrg(name, repo.config.OrganizationFields().GUID)
}
func (repo CloudControllerSpaceRepository) FindByNameInOrg(name, orgGUID string) (space models.Space, apiErr error) {
foundSpace := false
apiErr = repo.gateway.ListPaginatedResources(
repo.config.APIEndpoint(),
fmt.Sprintf("/v2/organizations/%s/spaces?q=%s&inline-relations-depth=1", orgGUID, url.QueryEscape("name:"+strings.ToLower(name))),
resources.SpaceResource{},
func(resource interface{}) bool {
space = resource.(resources.SpaceResource).ToModel()
foundSpace = true
return false
})
if !foundSpace {
apiErr = errors.NewModelNotFoundError("Space", name)
}
return
}
func (repo CloudControllerSpaceRepository) Create(name, orgGUID, spaceQuotaGUID string) (models.Space, error) {
var space models.Space
path := "/v2/spaces?inline-relations-depth=1"
bodyMap := map[string]string{"name": name, "organization_guid": orgGUID}
if spaceQuotaGUID != "" {
bodyMap["space_quota_definition_guid"] = spaceQuotaGUID
}
body, err := json.Marshal(bodyMap)
if err != nil {
return models.Space{}, err
}
resource := new(resources.SpaceResource)
err = repo.gateway.CreateResource(repo.config.APIEndpoint(), path, strings.NewReader(string(body)), resource)
if err != nil {
return models.Space{}, err
}
space = resource.ToModel()
return space, nil
}
func (repo CloudControllerSpaceRepository) Rename(spaceGUID, newName string) (apiErr error) {
path := fmt.Sprintf("/v2/spaces/%s", spaceGUID)
body := fmt.Sprintf(`{"name":"%s"}`, newName)
return repo.gateway.UpdateResource(repo.config.APIEndpoint(), path, strings.NewReader(body))
}
func (repo CloudControllerSpaceRepository) SetAllowSSH(spaceGUID string, allow bool) (apiErr error) {
path := fmt.Sprintf("/v2/spaces/%s", spaceGUID)
body := fmt.Sprintf(`{"allow_ssh":%t}`, allow)
return repo.gateway.UpdateResource(repo.config.APIEndpoint(), path, strings.NewReader(body))
}
func (repo CloudControllerSpaceRepository) Delete(spaceGUID string) (apiErr error) {
path := fmt.Sprintf("/v2/spaces/%s?recursive=true", spaceGUID)
return repo.gateway.DeleteResource(repo.config.APIEndpoint(), path)
}
| {
"content_hash": "adb2dfd08c833f12a84a4ccbd93a4b7e",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 132,
"avg_line_length": 34.41818181818182,
"alnum_prop": 0.7588483888008453,
"repo_name": "seijimatsuda/CF-CLI",
"id": "8577087f6fc1695d9c0e8b52fbae5dba9ca36030",
"size": "3786",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cf/api/spaces/spaces.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "1198"
},
{
"name": "Batchfile",
"bytes": "5565"
},
{
"name": "Go",
"bytes": "4006210"
},
{
"name": "HTML",
"bytes": "1728"
},
{
"name": "Inno Setup",
"bytes": "2707"
},
{
"name": "PowerShell",
"bytes": "667"
},
{
"name": "Ruby",
"bytes": "2184"
},
{
"name": "Shell",
"bytes": "13051"
}
],
"symlink_target": ""
} |
[![License][license]][license-url]
[license-url]: http://choosealicense.com/licenses/mit/
[license]: https://img.shields.io/github/license/mashape/apistatus.svg
# Ansible & Cloud Formation automation for creating Highly-Available Docker Swarm clusters on AWS
Scalable Docker Swarm cluster deployment using the combination of AWS CloudFormation to create resources (such as EC2, VPC, AutoScaling etc..) and Ansible to automate the process with a single command. Deployment EC2 instances use CoreOS as it's ideal for this scenario.
If a Stack already exist with the given stack name, it will update. Otherwise creates a new stack from scratch.
#### Topology of Deployment

### Highlights
- CoreOS as the host OS for all instances.
- Self provisioning of instances using cloud-config of CoreOS
- Two launch configurations, auto scaling groups and elastic load balancers are created: Masters and Minions
- Minions auto scaling group depends on the creation of the Master auto scaling group to prevent race condition.
- Etcd enabled for Masters and disabled for minions.
- Etcds run on master nodes which automatically create a ring cluster by using the discovery url, hence highly-available.
- Docker Swarm managers on master nodes join the Swarm cluster by using their local Etcd configuration.
- Docker Swarm minions join the cluster using Master ELB DNS to ensure high-availability.
#### Quickstart Guide:
1. Install Docker and Ansible on your local and clone this repo.
2. Edit `group_vars/all/credentials.yml.example` and change it as `group_vars/all/credentials.yml`
3. Edit `group_vars/all/common.yml` as it fits your needs.
4. Make sure to create a keypair in AWS IAM.
5. Create the CloudFront Stack using Ansible
``` shell
make create_docker_swarm"
```
6. Once the Stack creation is complete, Ansible will out provide the output of Swarm Master as related information and swarm node http load balancer
7. From your local, connecto Swarm Master and see info: `docker -H tcp://<MasterElbDns>:4000 info`
8. An example deployment to all nodes from your local: `docker -H tcp://<MasterElbDns>:4000 run -d -p 80:80 nginx`
| {
"content_hash": "b9267acdf84ad6801ca22dfb98d8f7b3",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 270,
"avg_line_length": 48.333333333333336,
"alnum_prop": 0.7788505747126436,
"repo_name": "Mashape/aws-docker-swarm-cluster-deployer",
"id": "07de048f116a5a22a1b7e933802d4c31dc9e208d",
"size": "2175",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "302"
},
{
"name": "Shell",
"bytes": "1221"
}
],
"symlink_target": ""
} |
Mithril::Engine.routes.draw do
root :to => 'forums#index'
end
| {
"content_hash": "da2a0ca4bf06d7f4860bf43e427af5c5",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 30,
"avg_line_length": 21.333333333333332,
"alnum_prop": 0.703125,
"repo_name": "imanel/mithril",
"id": "8c71fb0a817201cee345c42940ba23ce22073671",
"size": "64",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config/routes.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "10059"
}
],
"symlink_target": ""
} |
from shop.models.productmodel import Product
from shop.views import ShopDetailView
class ProductDetailView(ShopDetailView):
"""
This view handles displaying the right template for the subclasses of
Product.
It will look for a template at the normal (conventional) place, but will
fallback to using the default product template in case no template is
found for the subclass.
"""
model=Product # It must be the biggest ancestor of the inheritence tree.
generic_template = 'shop/product_detail.html'
def get_template_names(self):
ret = super(ProductDetailView, self).get_template_names()
if not self.generic_template in ret:
ret.append(self.generic_template)
return ret | {
"content_hash": "c434d22488b96b0eccd4e2a37166c738",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 76,
"avg_line_length": 39.421052631578945,
"alnum_prop": 0.7156208277703605,
"repo_name": "ojii/django-shop",
"id": "39be2b61257c71964db948eb3cae8d355121589a",
"size": "773",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "shop/views/product.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "1122"
},
{
"name": "Python",
"bytes": "282793"
},
{
"name": "Shell",
"bytes": "5030"
}
],
"symlink_target": ""
} |
/*
* This file provided by Facebook is for non-commercial testing and evaluation
* purposes only. Facebook reserves all rights not expressly granted.
*
* 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
* FACEBOOK 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.facebook.fresco.samples.showcase.drawee.transition;
import android.app.ActivityOptions;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.facebook.drawee.view.SimpleDraweeView;
import com.facebook.fresco.samples.showcase.BaseShowcaseFragment;
import com.facebook.fresco.samples.showcase.R;
import com.facebook.fresco.samples.showcase.misc.ImageUriProvider;
/**
* Simple drawee fragment that just displays an image.
*/
public class DraweeTransitionFragment extends BaseShowcaseFragment {
@Nullable
@Override
public View onCreateView(
LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_drawee_transition, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
final ImageUriProvider imageUriProvider = ImageUriProvider.getInstance(getContext());
final Uri imageUri = imageUriProvider.createSampleUri(ImageUriProvider.ImageSize.M);
final SimpleDraweeView simpleDraweeView =
(SimpleDraweeView) view.findViewById(R.id.drawee_view);
// You have to enable legacy visibility handling for the start view in order for this to work
simpleDraweeView.setLegacyVisibilityHandlingEnabled(true);
simpleDraweeView.setImageURI(imageUri);
simpleDraweeView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startTransition(v, imageUri);
}
});
}
@Override
public int getTitleId() {
return R.string.drawee_transition_title;
}
public void startTransition(View startView, Uri uri) {
Intent intent = ImageDetailsActivity.getStartIntent(getContext(), uri);
final String transitionName = getString(R.string.transition_name);
final ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(
getActivity(),
startView,
transitionName);
startActivity(intent, options.toBundle());
}
}
| {
"content_hash": "02bb830e9b29964c1802ca28e0629aee",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 100,
"avg_line_length": 39.45070422535211,
"alnum_prop": 0.7700821135308819,
"repo_name": "weiwenqiang/GitHub",
"id": "59cf10cf4f8e9b53710e38f4033b038c31952618",
"size": "2801",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "expert/fresco/samples/showcase/src/main/java/com/facebook/fresco/samples/showcase/drawee/transition/DraweeTransitionFragment.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "87"
},
{
"name": "C",
"bytes": "42062"
},
{
"name": "C++",
"bytes": "12137"
},
{
"name": "CMake",
"bytes": "202"
},
{
"name": "CSS",
"bytes": "75087"
},
{
"name": "Clojure",
"bytes": "12036"
},
{
"name": "FreeMarker",
"bytes": "21704"
},
{
"name": "Groovy",
"bytes": "55083"
},
{
"name": "HTML",
"bytes": "61549"
},
{
"name": "Java",
"bytes": "42222825"
},
{
"name": "JavaScript",
"bytes": "216823"
},
{
"name": "Kotlin",
"bytes": "24319"
},
{
"name": "Makefile",
"bytes": "19490"
},
{
"name": "Perl",
"bytes": "280"
},
{
"name": "Prolog",
"bytes": "1030"
},
{
"name": "Python",
"bytes": "13032"
},
{
"name": "Scala",
"bytes": "310450"
},
{
"name": "Shell",
"bytes": "27802"
}
],
"symlink_target": ""
} |
package liquibase.change.core;
import liquibase.change.*;
import liquibase.changelog.ChangeLogParameters;
import liquibase.configuration.GlobalConfiguration;
import liquibase.configuration.LiquibaseConfiguration;
import liquibase.database.Database;
import liquibase.database.DatabaseList;
import liquibase.database.core.AbstractDb2Database;
import liquibase.database.core.HsqlDatabase;
import liquibase.database.core.MSSQLDatabase;
import liquibase.database.core.OracleDatabase;
import liquibase.exception.UnexpectedLiquibaseException;
import liquibase.exception.ValidationErrors;
import liquibase.parser.core.ParsedNode;
import liquibase.parser.core.ParsedNodeException;
import liquibase.resource.ResourceAccessor;
import liquibase.statement.SqlStatement;
import liquibase.statement.core.CreateProcedureStatement;
import liquibase.util.StreamUtil;
import liquibase.util.StringUtils;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.io.UnsupportedEncodingException;
@DatabaseChange(name = "createProcedure",
description = "Defines the definition for a stored procedure. This command is better to use for creating procedures than the raw sql command because it will not attempt to strip comments or break up lines.\n\nOften times it is best to use the CREATE OR REPLACE syntax along with setting runOnChange='true' on the enclosing changeSet tag. That way if you need to make a change to your procedure you can simply change your existing code rather than creating a new REPLACE PROCEDURE call. The advantage to this approach is that it keeps your change log smaller and allows you to more easily see what has changed in your procedure code through your source control system's diff command.",
priority = ChangeMetaData.PRIORITY_DEFAULT)
public class CreateProcedureChange extends AbstractChange implements DbmsTargetedChange {
private String comments;
private String catalogName;
private String schemaName;
private String procedureName;
private String procedureText;
private String dbms;
private String path;
private Boolean relativeToChangelogFile;
private String encoding = null;
private Boolean replaceIfExists;
@Override
public boolean generateStatementsVolatile(Database database) {
return false;
}
@Override
public boolean generateRollbackStatementsVolatile(Database database) {
return false;
}
public String getCatalogName() {
return catalogName;
}
public void setCatalogName(String catalogName) {
this.catalogName = catalogName;
}
public String getSchemaName() {
return schemaName;
}
public void setSchemaName(String schemaName) {
this.schemaName = schemaName;
}
@DatabaseChangeProperty(exampleValue = "new_customer")
public String getProcedureName() {
return procedureName;
}
public void setProcedureName(String procedureName) {
this.procedureName = procedureName;
}
@DatabaseChangeProperty(exampleValue = "utf8")
public String getEncoding() {
return encoding;
}
public void setEncoding(String encoding) {
this.encoding = encoding;
}
@DatabaseChangeProperty(description = "File containing the procedure text. Either this attribute or a nested procedure text is required.", exampleValue = "com/example/my-logic.sql")
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Boolean isRelativeToChangelogFile() {
return relativeToChangelogFile;
}
public void setRelativeToChangelogFile(Boolean relativeToChangelogFile) {
this.relativeToChangelogFile = relativeToChangelogFile;
}
@DatabaseChangeProperty(serializationType = SerializationType.DIRECT_VALUE,
exampleValue = "CREATE OR REPLACE PROCEDURE testHello\n" +
" IS\n" +
" BEGIN\n" +
" DBMS_OUTPUT.PUT_LINE('Hello From The Database!');\n" +
" END;")
/**
* @deprecated Use getProcedureText() instead
*/
public String getProcedureBody() {
return procedureText;
}
/**
* @deprecated Use setProcedureText() instead
*/
public void setProcedureBody(String procedureText) {
this.procedureText = procedureText;
}
@DatabaseChangeProperty(isChangeProperty = false)
public String getProcedureText() {
return procedureText;
}
public void setProcedureText(String procedureText) {
this.procedureText = procedureText;
}
@DatabaseChangeProperty(since = "3.1", exampleValue = "h2, oracle")
public String getDbms() {
return dbms;
}
public void setDbms(final String dbms) {
this.dbms = dbms;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
@DatabaseChangeProperty
public Boolean getReplaceIfExists() {
return replaceIfExists;
}
public void setReplaceIfExists(Boolean replaceIfExists) {
this.replaceIfExists = replaceIfExists;
}
@Override
public ValidationErrors validate(Database database) {
ValidationErrors validate = new ValidationErrors(); //not falling back to default because of path/procedureText option group. Need to specify everything
if (StringUtils.trimToNull(getProcedureText()) != null && StringUtils.trimToNull(getPath()) != null) {
validate.addError("Cannot specify both 'path' and a nested procedure text in " + ChangeFactory.getInstance().getChangeMetaData(this).getName());
}
if (StringUtils.trimToNull(getProcedureText()) == null && StringUtils.trimToNull(getPath()) == null) {
validate.addError("Cannot specify either 'path' or a nested procedure text in " + ChangeFactory.getInstance().getChangeMetaData(this).getName());
}
if (this.getReplaceIfExists() != null && (DatabaseList.definitionMatches(getDbms(), database, true))) {
if (database instanceof MSSQLDatabase) {
if (this.getReplaceIfExists() && this.getProcedureName() == null) {
validate.addError("procedureName is required if replaceIfExists = true");
}
} else {
validate.checkDisallowedField("replaceIfExists", this.getReplaceIfExists(), database);
}
}
return validate;
}
public InputStream openSqlStream() throws IOException {
if (path == null) {
return null;
}
try {
return StreamUtil.openStream(getPath(), isRelativeToChangelogFile(), getChangeSet(), getResourceAccessor());
} catch (IOException e) {
throw new IOException("<" + ChangeFactory.getInstance().getChangeMetaData(this).getName() + " path=" + path + "> -Unable to read file", e);
}
}
/**
* Calculates the checksum based on the contained SQL.
*
* @see liquibase.change.AbstractChange#generateCheckSum()
*/
@Override
public CheckSum generateCheckSum() {
if (this.path == null) {
return super.generateCheckSum();
}
InputStream stream = null;
try {
stream = openSqlStream();
} catch (IOException e) {
throw new UnexpectedLiquibaseException(e);
}
try {
String procedureText = this.procedureText;
if (stream == null && procedureText == null) {
procedureText = "";
}
String encoding = LiquibaseConfiguration.getInstance().getConfiguration(GlobalConfiguration.class).getOutputEncoding();
if (procedureText != null) {
try {
stream = new ByteArrayInputStream(procedureText.getBytes(encoding));
} catch (UnsupportedEncodingException e) {
throw new AssertionError(encoding+" is not supported by the JVM, this should not happen according to the JavaDoc of the Charset class");
}
}
CheckSum checkSum = CheckSum.compute(new AbstractSQLChange.NormalizingStream(";", false, false, stream), false);
return CheckSum.compute(super.generateCheckSum().toString() + ":" + checkSum.toString());
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException ignore) {
}
}
}
}
@Override
public SqlStatement[] generateStatements(Database database) {
String endDelimiter = ";";
if (database instanceof OracleDatabase) {
endDelimiter = "\n/";
} else if (database instanceof AbstractDb2Database) {
endDelimiter = "";
}
String procedureText;
String path = getPath();
if (path == null) {
procedureText = StringUtils.trimToNull(getProcedureText());
} else {
try {
InputStream stream = openSqlStream();
if (stream == null) {
throw new IOException("File does not exist: " + path);
}
procedureText = StreamUtil.getStreamContents(stream, encoding);
if (getChangeSet() != null) {
ChangeLogParameters parameters = getChangeSet().getChangeLogParameters();
if (parameters != null) {
procedureText = parameters.expandExpressions(procedureText, getChangeSet().getChangeLog());
}
}
} catch (IOException e) {
throw new UnexpectedLiquibaseException(e);
}
}
return generateStatements(procedureText, endDelimiter, database);
}
protected SqlStatement[] generateStatements(String logicText, String endDelimiter, Database database) {
CreateProcedureStatement statement = new CreateProcedureStatement(getCatalogName(), getSchemaName(), getProcedureName(), logicText, endDelimiter);
statement.setReplaceIfExists(getReplaceIfExists());
return new SqlStatement[]{
statement,
};
}
@Override
public ChangeStatus checkStatus(Database database) {
return new ChangeStatus().unknown("Cannot check createProcedure status");
}
@Override
public String getConfirmationMessage() {
return "Stored procedure created";
}
@Override
public String getSerializedObjectNamespace() {
return STANDARD_CHANGELOG_NAMESPACE;
}
@Override
protected Map<String, Object> createExampleValueMetaData(String parameterName, DatabaseChangeProperty changePropertyAnnotation) {
if (parameterName.equals("procedureText") || parameterName.equals("procedureBody")) {
Map<String, Object> returnMap = super.createExampleValueMetaData(parameterName, changePropertyAnnotation);
returnMap.put(new HsqlDatabase().getShortName(), "CREATE PROCEDURE new_customer(firstname VARCHAR(50), lastname VARCHAR(50))\n" +
" MODIFIES SQL DATA\n" +
" INSERT INTO CUSTOMERS (first_name, last_name) VALUES (firstname, lastname)");
return returnMap;
} else {
return super.createExampleValueMetaData(parameterName, changePropertyAnnotation);
}
}
}
| {
"content_hash": "85378b5ce4d392bece925e8e64028107",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 692,
"avg_line_length": 36.68867924528302,
"alnum_prop": 0.6571526527813492,
"repo_name": "Datical/liquibase",
"id": "fcce81ea1ddf5a7f2802d707da4fa61dd74490e7",
"size": "11667",
"binary": false,
"copies": "1",
"ref": "refs/heads/ddb",
"path": "liquibase-core/src/main/java/liquibase/change/core/CreateProcedureChange.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "552"
},
{
"name": "CSS",
"bytes": "1202"
},
{
"name": "Groovy",
"bytes": "579049"
},
{
"name": "HTML",
"bytes": "2223"
},
{
"name": "Inno Setup",
"bytes": "2522"
},
{
"name": "Java",
"bytes": "4419959"
},
{
"name": "PLpgSQL",
"bytes": "1184"
},
{
"name": "Puppet",
"bytes": "5196"
},
{
"name": "Roff",
"bytes": "3153"
},
{
"name": "Ruby",
"bytes": "820"
},
{
"name": "SQLPL",
"bytes": "2790"
},
{
"name": "Shell",
"bytes": "4879"
},
{
"name": "TSQL",
"bytes": "24158"
}
],
"symlink_target": ""
} |
package org.uberfire.backend.server.impl;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import org.picketlink.authentication.event.PreAuthenticateEvent;
import org.picketlink.idm.IdentityManager;
import org.picketlink.idm.PartitionManager;
import org.picketlink.idm.RelationshipManager;
import org.picketlink.idm.credential.Password;
import org.picketlink.idm.model.basic.Grant;
import org.picketlink.idm.model.basic.Role;
import org.picketlink.idm.model.basic.User;
@ApplicationScoped
public class PicketLinkDefaultUsers {
@Inject
private PartitionManager partitionManager;
private boolean done = false;
/**
* Creates example users so people can log in while trying out the app.
*/
public synchronized void create( @Observes PreAuthenticateEvent event ) {
if ( done ) {
return;
}
done = true;
final IdentityManager identityManager = partitionManager.createIdentityManager();
final RelationshipManager relationshipManager = partitionManager.createRelationshipManager();
User admin = new User( "admin" );
admin.setEmail( "john@doe.com" );
admin.setFirstName( "John" );
admin.setLastName( "Doe" );
User nonAdmin = new User( "joe" );
nonAdmin.setEmail( "joe@doe.com" );
nonAdmin.setFirstName( "Joe" );
nonAdmin.setLastName( "Doe" );
identityManager.add( admin );
identityManager.add( nonAdmin );
identityManager.updateCredential( admin, new Password( "admin" ) );
identityManager.updateCredential( nonAdmin, new Password( "joe" ) );
Role roleSimple = new Role( "simple" );
Role roleAdmin = new Role( "admin" );
identityManager.add( roleSimple );
identityManager.add( roleAdmin );
relationshipManager.add( new Grant( admin, roleSimple ) );
relationshipManager.add( new Grant( admin, roleAdmin ) );
relationshipManager.add( new Grant( nonAdmin, roleSimple ) );
}
}
| {
"content_hash": "4d650b451ed8450e88326351777b56a7",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 101,
"avg_line_length": 31.19402985074627,
"alnum_prop": 0.6909090909090909,
"repo_name": "psiroky/uberfire",
"id": "aaea0519a1659351c882e83b940c825965665740",
"size": "2711",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/backend/server/impl/PicketLinkDefaultUsers.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "79132"
},
{
"name": "FreeMarker",
"bytes": "35014"
},
{
"name": "HTML",
"bytes": "37524"
},
{
"name": "Java",
"bytes": "7904766"
},
{
"name": "JavaScript",
"bytes": "60121"
},
{
"name": "Ruby",
"bytes": "706"
}
],
"symlink_target": ""
} |
package org.apache.camel.issues;
import org.apache.camel.CamelContext;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.spi.CamelEvent;
import org.apache.camel.spi.CamelEvent.ExchangeSentEvent;
import org.apache.camel.support.DefaultExchange;
import org.apache.camel.support.EventNotifierSupport;
import org.junit.Test;
public class SentExchangeEventNotifierTwoIssueTest extends ContextTestSupport {
private MyNotifier notifier = new MyNotifier();
private class MyNotifier extends EventNotifierSupport {
private int counter;
@Override
public void notify(CamelEvent event) throws Exception {
counter++;
}
@Override
public boolean isEnabled(CamelEvent event) {
return event instanceof ExchangeSentEvent;
}
public int getCounter() {
return counter;
}
public void reset() {
counter = 0;
}
}
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
context.init();
context.getManagementStrategy().addEventNotifier(notifier);
return context;
}
@Test
public void testExchangeSentNotifier() throws Exception {
notifier.reset();
String out = template.requestBody("direct:start", "Hello World", String.class);
assertEquals("I was here", out);
assertEquals(2, notifier.getCounter());
}
@Test
public void testExchangeSentNotifierExchange() throws Exception {
notifier.reset();
Exchange out = template.request("direct:start", new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody("Hello World");
}
});
assertEquals("I was here", out.getIn().getBody());
assertEquals(2, notifier.getCounter());
}
@Test
public void testExchangeSentNotifierManualExchange() throws Exception {
notifier.reset();
Exchange exchange = new DefaultExchange(context);
exchange.getIn().setBody("Hello World");
template.send("direct:start", exchange);
assertEquals("I was here", exchange.getIn().getBody());
assertEquals(2, notifier.getCounter());
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.getIn().setBody("I was here");
}
}).to("mock:result");
}
};
}
}
| {
"content_hash": "43b8c3cee76033581a7f610fa849f4d3",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 87,
"avg_line_length": 29.50980392156863,
"alnum_prop": 0.6318936877076412,
"repo_name": "objectiser/camel",
"id": "81ccbe1e69ea5ead23a8406bedae5bc005f1c2a3",
"size": "3812",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "core/camel-core/src/test/java/org/apache/camel/issues/SentExchangeEventNotifierTwoIssueTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Apex",
"bytes": "6521"
},
{
"name": "Batchfile",
"bytes": "2353"
},
{
"name": "CSS",
"bytes": "5472"
},
{
"name": "Elm",
"bytes": "10852"
},
{
"name": "FreeMarker",
"bytes": "8015"
},
{
"name": "Groovy",
"bytes": "14479"
},
{
"name": "HTML",
"bytes": "915679"
},
{
"name": "Java",
"bytes": "84762041"
},
{
"name": "JavaScript",
"bytes": "100326"
},
{
"name": "Makefile",
"bytes": "513"
},
{
"name": "RobotFramework",
"bytes": "8461"
},
{
"name": "Shell",
"bytes": "17240"
},
{
"name": "TSQL",
"bytes": "28835"
},
{
"name": "Tcl",
"bytes": "4974"
},
{
"name": "Thrift",
"bytes": "6979"
},
{
"name": "XQuery",
"bytes": "546"
},
{
"name": "XSLT",
"bytes": "280849"
}
],
"symlink_target": ""
} |
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
#import "mach/mach_time.h"
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import "STKAutoRecoveringHTTPDataSource.h"
#define DEFAULT_WATCHDOG_PERIOD_SECONDS (8)
#define DEFAULT_INACTIVE_PERIOD_BEFORE_RECONNECT_SECONDS (15)
static uint64_t GetTickCount(void)
{
static mach_timebase_info_data_t sTimebaseInfo;
uint64_t machTime = mach_absolute_time();
if (sTimebaseInfo.denom == 0 )
{
(void) mach_timebase_info(&sTimebaseInfo);
}
uint64_t millis = ((machTime / 1000000) * sTimebaseInfo.numer) / sTimebaseInfo.denom;
return millis;
}
@interface STKAutoRecoveringHTTPDataSource()
{
int serial;
int waitSeconds;
NSTimer* timeoutTimer;
BOOL waitingForNetwork;
uint64_t ticksWhenLastDataReceived;
SCNetworkReachabilityRef reachabilityRef;
STKAutoRecoveringHTTPDataSourceOptions options;
}
-(void) reachabilityChanged;
@end
static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
{
@autoreleasepool
{
STKAutoRecoveringHTTPDataSource* dataSource = (__bridge STKAutoRecoveringHTTPDataSource*)info;
[dataSource reachabilityChanged];
}
}
static void PopulateOptionsWithDefault(STKAutoRecoveringHTTPDataSourceOptions* options)
{
if (options->watchdogPeriodSeconds == 0)
{
options->watchdogPeriodSeconds = DEFAULT_WATCHDOG_PERIOD_SECONDS;
}
if (options->inactivePeriodBeforeReconnectSeconds == 0)
{
options->inactivePeriodBeforeReconnectSeconds = DEFAULT_INACTIVE_PERIOD_BEFORE_RECONNECT_SECONDS;
}
}
@implementation STKAutoRecoveringHTTPDataSource
-(STKHTTPDataSource*) innerHTTPDataSource
{
return (STKHTTPDataSource*)self.innerDataSource;
}
-(id) initWithDataSource:(STKDataSource *)innerDataSource
{
return [self initWithHTTPDataSource:(STKHTTPDataSource*)innerDataSource];
}
-(id) initWithHTTPDataSource:(STKHTTPDataSource*)innerDataSourceIn
{
return [self initWithHTTPDataSource:innerDataSourceIn andOptions:(STKAutoRecoveringHTTPDataSourceOptions){}];
}
-(id) initWithHTTPDataSource:(STKHTTPDataSource*)innerDataSourceIn andOptions:(STKAutoRecoveringHTTPDataSourceOptions)optionsIn
{
if (self = [super initWithDataSource:innerDataSourceIn])
{
self.innerDataSource.delegate = self;
struct sockaddr_in zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
PopulateOptionsWithDefault(&optionsIn);
self->options = optionsIn;
reachabilityRef = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)&zeroAddress);
}
return self;
}
-(BOOL) startNotifierOnRunLoop:(NSRunLoop*)runLoop
{
BOOL retVal = NO;
SCNetworkReachabilityContext context = { 0, (__bridge void*)self, NULL, NULL, NULL };
if (SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context))
{
if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, runLoop.getCFRunLoop, kCFRunLoopDefaultMode))
{
retVal = YES;
}
}
return retVal;
}
-(BOOL) registerForEvents:(NSRunLoop*)runLoop
{
[super registerForEvents:runLoop];
[self startNotifierOnRunLoop:runLoop];
if (timeoutTimer)
{
[timeoutTimer invalidate];
timeoutTimer = nil;
}
ticksWhenLastDataReceived = GetTickCount();
[self createTimeoutTimer];
return YES;
}
-(void) unregisterForEvents
{
[super unregisterForEvents];
[self stopNotifier];
[self destroyTimeoutTimer];
}
-(void) timeoutTimerTick:(NSTimer*)timer
{
if (![self hasBytesAvailable])
{
if ([self hasGotNetworkConnection])
{
uint64_t currentTicks = GetTickCount();
if (((currentTicks - ticksWhenLastDataReceived) / 1000) >= options.inactivePeriodBeforeReconnectSeconds)
{
serial++;
NSLog(@"timeoutTimerTick %lld/%lld", self.position, self.length);
[self attemptReconnectWithSerial:@(serial)];
}
}
}
}
-(void) createTimeoutTimer
{
[self destroyTimeoutTimer];
NSRunLoop* runLoop = self.innerDataSource.eventsRunLoop;
if (runLoop == nil)
{
return;
}
timeoutTimer = [NSTimer timerWithTimeInterval:options.watchdogPeriodSeconds target:self selector:@selector(timeoutTimerTick:) userInfo:@(serial) repeats:YES];
[runLoop addTimer:timeoutTimer forMode:NSRunLoopCommonModes];
}
-(void) destroyTimeoutTimer
{
if (timeoutTimer)
{
[timeoutTimer invalidate];
timeoutTimer = nil;
}
}
-(void) stopNotifier
{
if (reachabilityRef != NULL)
{
SCNetworkReachabilitySetCallback(reachabilityRef, NULL, NULL);
SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, [self.innerDataSource.eventsRunLoop getCFRunLoop], kCFRunLoopDefaultMode);
}
}
-(BOOL) hasGotNetworkConnection
{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return ((flags & kSCNetworkReachabilityFlagsReachable) != 0);
}
return NO;
}
-(void) seekToOffset:(int64_t)offset
{
ticksWhenLastDataReceived = GetTickCount();
[super seekToOffset:offset];
}
-(void) close
{
[self destroyTimeoutTimer];
[super close];
}
-(void) dealloc
{
NSLog(@"STKAutoRecoveringHTTPDataSource dealloc");
self.innerDataSource.delegate = nil;
[self stopNotifier];
[self destroyTimeoutTimer];
[NSObject cancelPreviousPerformRequestsWithTarget:self];
if (reachabilityRef!= NULL)
{
CFRelease(reachabilityRef);
}
}
-(void) reachabilityChanged
{
if (waitingForNetwork)
{
waitingForNetwork = NO;
NSLog(@"reachabilityChanged %lld/%lld", self.position, self.length);
serial++;
[self attemptReconnectWithSerial:@(serial)];
}
}
-(void) dataSourceDataAvailable:(STKDataSource*)dataSource
{
if (![self.innerDataSource hasBytesAvailable])
{
return;
}
serial++;
waitSeconds = 1;
ticksWhenLastDataReceived = GetTickCount();
[super dataSourceDataAvailable:dataSource];
}
-(void) attemptReconnectWithSerial:(NSNumber*)serialIn
{
if (serialIn.intValue != self->serial)
{
return;
}
NSLog(@"attemptReconnect %lld/%lld", self.position, self.length);
if (self.innerDataSource.eventsRunLoop)
{
[self.innerDataSource reconnect];
}
}
-(void) attemptReconnectWithTimer:(NSTimer*)timer
{
[self attemptReconnectWithSerial:(NSNumber*)timer.userInfo];
}
-(void) processRetryOnError
{
if (![self hasGotNetworkConnection])
{
waitingForNetwork = YES;
return;
}
waitingForNetwork = NO;
NSRunLoop* runLoop = self.innerDataSource.eventsRunLoop;
if (runLoop == nil)
{
// DataSource no longer used
return;
}
else
{
serial++;
NSTimer* timer = [NSTimer timerWithTimeInterval:waitSeconds target:self selector:@selector(attemptReconnectWithTimer:) userInfo:@(serial) repeats:NO];
[runLoop addTimer:timer forMode:NSRunLoopCommonModes];
}
waitSeconds = MIN(waitSeconds + 1, 5);
}
-(void) dataSourceEof:(STKDataSource*)dataSource
{
NSLog(@"dataSourceEof");
if ([self position] < [self length])
{
[self processRetryOnError];
return;
}
[self.delegate dataSourceEof:self];
}
-(void) dataSourceErrorOccured:(STKDataSource*)dataSource
{
NSLog(@"dataSourceErrorOccured");
if (self.innerDataSource.httpStatusCode == 416 /* Range out of bounds */)
{
[super dataSourceEof:dataSource];
}
else
{
[self processRetryOnError];
}
}
-(NSString*) description
{
return [NSString stringWithFormat:@"HTTP data source with file length: %lld and position: %lld", self.length, self.position];
}
@end
| {
"content_hash": "b9cf60934be0a24ae3599badc868880a",
"timestamp": "",
"source": "github",
"line_count": 359,
"max_line_length": 162,
"avg_line_length": 23.44289693593315,
"alnum_prop": 0.6707461977186312,
"repo_name": "gilcreque/nvisible-iphone",
"id": "37fa5e5a936717a40c796f87a62d22161e242923",
"size": "10363",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "StreamingKit/STKAutoRecoveringHTTPDataSource.m",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "1702"
},
{
"name": "C++",
"bytes": "14412"
},
{
"name": "Objective-C",
"bytes": "1114200"
}
],
"symlink_target": ""
} |
/*can@2.2.7#map/lazy/bubble*/
var can = require('../../util/util.js');
require('../bubble.js');
var bubble = can.bubble;
module.exports = can.extend({}, bubble, {
childrenOf: function (parentMap, eventName) {
if (parentMap._nestedReference) {
parentMap._nestedReference.each(function (child, ref) {
if (child && child.bind) {
bubble.toParent(child, parentMap, ref(), eventName);
}
});
} else {
bubble._each.apply(this, arguments);
}
}
}); | {
"content_hash": "0fb3a3fa905fe9dc13b365fb6c89f6d2",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 72,
"avg_line_length": 29.473684210526315,
"alnum_prop": 0.5303571428571429,
"repo_name": "swape/hapi-canjs-gulp",
"id": "5c08886b0f2a3c8265345bf0288129a02192c5fd",
"size": "683",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "build/libs/canjs/cjs/map/lazy/bubble.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "98"
},
{
"name": "HTML",
"bytes": "97"
},
{
"name": "JavaScript",
"bytes": "10065647"
}
],
"symlink_target": ""
} |
package com.fleury.metrics.agent.transformer.visitors;
import static com.fleury.metrics.agent.transformer.util.AnnotationUtil.checkSignature;
import static org.objectweb.asm.Opcodes.ASM5;
import com.fleury.metrics.agent.config.Configuration;
import com.fleury.metrics.agent.model.MetricType;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.MethodVisitor;
/**
*
* @author Will Fleury
*/
public class AnnotationMethodVisitor extends MethodVisitor {
private final Configuration config;
private final String className;
private final String methodName;
private final String methodDesc;
public AnnotationMethodVisitor(MethodVisitor mv, Configuration config, String className, String name, String desc) {
super(ASM5, mv);
this.config = config;
this.className = className;
this.methodName = name;
this.methodDesc = desc;
}
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
MetricType metricType = checkSignature(desc);
if (metricType != null) {
Configuration.Key key = new Configuration.Key(className, methodName, methodDesc);
return new MetricAnnotationAttributeVisitor(super.visitAnnotation(desc, visible), metricType, config, key);
}
return super.visitAnnotation(desc, visible);
}
}
| {
"content_hash": "15911d4cf5502cdf34d487539f5f1a82",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 120,
"avg_line_length": 30.644444444444446,
"alnum_prop": 0.7302393038433648,
"repo_name": "willfleury/metrics-agent",
"id": "24fee6a8ef29d6b796b38ecdf9bff9bf9f16228f",
"size": "1379",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "metrics-agent-core/src/main/java/com/fleury/metrics/agent/transformer/visitors/AnnotationMethodVisitor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "125452"
}
],
"symlink_target": ""
} |
<?php
/** Zend_Search_Lucene_Storage_Directory */
//require_once 'Zend/Search/Lucene/Storage/Directory.php';
/**
* FileSystem implementation of Directory abstraction.
*
* @category Zend
* @package Zend_Search_Lucene
* @subpackage Storage
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Search_Lucene_Storage_Directory_Filesystem extends Zend_Search_Lucene_Storage_Directory
{
/**
* Filesystem path to the directory
*
* @var string
*/
protected $_dirPath = null;
/**
* Cache for Zend_Search_Lucene_Storage_File_Filesystem objects
* Array: filename => Zend_Search_Lucene_Storage_File object
*
* @var array
* @throws Zend_Search_Lucene_Exception
*/
protected $_fileHandlers;
/**
* Default file permissions
*
* @var integer
*/
protected static $_defaultFilePermissions = 0666;
/**
* Get default file permissions
*
* @return integer
*/
public static function getDefaultFilePermissions()
{
return self::$_defaultFilePermissions;
}
/**
* Set default file permissions
*
* @param integer $mode
*/
public static function setDefaultFilePermissions($mode)
{
self::$_defaultFilePermissions = $mode;
}
/**
* Utility function to recursive directory creation
*
* @param string $dir
* @param integer $mode
* @param boolean $recursive
* @return boolean
*/
public static function mkdirs($dir, $mode = 0775, $recursive = true)
{
$mode = $mode & ~0002;
if (($dir === null) || $dir === '') {
return false;
}
if (is_dir($dir) || $dir === '/') {
return true;
}
if (self::mkdirs(dirname($dir), $mode, $recursive)) {
return mkdir($dir, $mode);
}
return false;
}
/**
* Object constructor
* Checks if $path is a directory or tries to create it.
*
* @param string $path
* @throws Zend_Search_Lucene_Exception
*/
public function __construct($path)
{
if (!is_dir($path)) {
if (file_exists($path)) {
//require_once 'Zend/Search/Lucene/Exception.php';
throw new Zend_Search_Lucene_Exception('Path exists, but it\'s not a directory');
} else {
if (!self::mkdirs($path)) {
//require_once 'Zend/Search/Lucene/Exception.php';
throw new Zend_Search_Lucene_Exception("Can't create directory '$path'.");
}
}
}
$this->_dirPath = $path;
$this->_fileHandlers = array();
}
/**
* Closes the store.
*
* @return void
*/
public function close()
{
foreach ($this->_fileHandlers as $fileObject) {
$fileObject->close();
}
$this->_fileHandlers = array();
}
/**
* Returns an array of strings, one for each file in the directory.
*
* @return array
*/
public function fileList()
{
$result = array();
$dirContent = opendir( $this->_dirPath );
while (($file = readdir($dirContent)) !== false) {
if (($file == '..')||($file == '.')) continue;
if( !is_dir($this->_dirPath . '/' . $file) ) {
$result[] = $file;
}
}
closedir($dirContent);
return $result;
}
/**
* Creates a new, empty file in the directory with the given $filename.
*
* @param string $filename
* @return Zend_Search_Lucene_Storage_File
* @throws Zend_Search_Lucene_Exception
*/
public function createFile($filename)
{
if (isset($this->_fileHandlers[$filename])) {
$this->_fileHandlers[$filename]->close();
}
unset($this->_fileHandlers[$filename]);
//require_once 'Zend/Search/Lucene/Storage/File/Filesystem.php';
$this->_fileHandlers[$filename] = new Zend_Search_Lucene_Storage_File_Filesystem($this->_dirPath . '/' . $filename, 'w+b');
// Set file permissions, but don't care about any possible failures, since file may be already
// created by anther user which has to care about right permissions
@chmod($this->_dirPath . '/' . $filename, self::$_defaultFilePermissions);
return $this->_fileHandlers[$filename];
}
/**
* Removes an existing $filename in the directory.
*
* @param string $filename
* @return void
* @throws Zend_Search_Lucene_Exception
*/
public function deleteFile($filename)
{
if (isset($this->_fileHandlers[$filename])) {
$this->_fileHandlers[$filename]->close();
}
unset($this->_fileHandlers[$filename]);
global $php_errormsg;
$trackErrors = ini_get('track_errors');
ini_set('track_errors', '1');
if (!@unlink($this->_dirPath . '/' . $filename)) {
ini_set('track_errors', $trackErrors);
//require_once 'Zend/Search/Lucene/Exception.php';
throw new Zend_Search_Lucene_Exception('Can\'t delete file: ' . $php_errormsg);
}
ini_set('track_errors', $trackErrors);
}
/**
* Purge file if it's cached by directory object
*
* Method is used to prevent 'too many open files' error
*
* @param string $filename
* @return void
*/
public function purgeFile($filename)
{
if (isset($this->_fileHandlers[$filename])) {
$this->_fileHandlers[$filename]->close();
}
unset($this->_fileHandlers[$filename]);
}
/**
* Returns true if a file with the given $filename exists.
*
* @param string $filename
* @return boolean
*/
public function fileExists($filename)
{
return isset($this->_fileHandlers[$filename]) ||
file_exists($this->_dirPath . '/' . $filename);
}
/**
* Returns the length of a $filename in the directory.
*
* @param string $filename
* @return integer
*/
public function fileLength($filename)
{
if (isset( $this->_fileHandlers[$filename] )) {
return $this->_fileHandlers[$filename]->size();
}
return filesize($this->_dirPath .'/'. $filename);
}
/**
* Returns the UNIX timestamp $filename was last modified.
*
* @param string $filename
* @return integer
*/
public function fileModified($filename)
{
return filemtime($this->_dirPath .'/'. $filename);
}
/**
* Renames an existing file in the directory.
*
* @param string $from
* @param string $to
* @return void
* @throws Zend_Search_Lucene_Exception
*/
public function renameFile($from, $to)
{
global $php_errormsg;
if (isset($this->_fileHandlers[$from])) {
$this->_fileHandlers[$from]->close();
}
unset($this->_fileHandlers[$from]);
if (isset($this->_fileHandlers[$to])) {
$this->_fileHandlers[$to]->close();
}
unset($this->_fileHandlers[$to]);
if (file_exists($this->_dirPath . '/' . $to)) {
if (!unlink($this->_dirPath . '/' . $to)) {
//require_once 'Zend/Search/Lucene/Exception.php';
throw new Zend_Search_Lucene_Exception('Delete operation failed');
}
}
$trackErrors = ini_get('track_errors');
ini_set('track_errors', '1');
$success = @rename($this->_dirPath . '/' . $from, $this->_dirPath . '/' . $to);
if (!$success) {
ini_set('track_errors', $trackErrors);
//require_once 'Zend/Search/Lucene/Exception.php';
throw new Zend_Search_Lucene_Exception($php_errormsg);
}
ini_set('track_errors', $trackErrors);
return $success;
}
/**
* Sets the modified time of $filename to now.
*
* @param string $filename
* @return void
*/
public function touchFile($filename)
{
return touch($this->_dirPath .'/'. $filename);
}
/**
* Returns a Zend_Search_Lucene_Storage_File object for a given $filename in the directory.
*
* If $shareHandler option is true, then file handler can be shared between File Object
* requests. It speed-ups performance, but makes problems with file position.
* Shared handler are good for short atomic requests.
* Non-shared handlers are useful for stream file reading (especial for compound files).
*
* @param string $filename
* @param boolean $shareHandler
* @return Zend_Search_Lucene_Storage_File
*/
public function getFileObject($filename, $shareHandler = true)
{
$fullFilename = $this->_dirPath . '/' . $filename;
//require_once 'Zend/Search/Lucene/Storage/File/Filesystem.php';
if (!$shareHandler) {
return new Zend_Search_Lucene_Storage_File_Filesystem($fullFilename);
}
if (isset( $this->_fileHandlers[$filename] )) {
$this->_fileHandlers[$filename]->seek(0);
return $this->_fileHandlers[$filename];
}
$this->_fileHandlers[$filename] = new Zend_Search_Lucene_Storage_File_Filesystem($fullFilename);
return $this->_fileHandlers[$filename];
}
}
| {
"content_hash": "bd1a36ef96f6b923522f7248b006c761",
"timestamp": "",
"source": "github",
"line_count": 345,
"max_line_length": 131,
"avg_line_length": 27.76231884057971,
"alnum_prop": 0.5591981624556275,
"repo_name": "acharzuo/ciguang-gongke",
"id": "5d85585214ebf43b18ce27767d5cb6657c2ddec4",
"size": "10300",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "system/Zend/Search/Lucene/Storage/Directory/Filesystem.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "215678"
},
{
"name": "HTML",
"bytes": "1692430"
},
{
"name": "JavaScript",
"bytes": "510037"
},
{
"name": "PHP",
"bytes": "10639242"
}
],
"symlink_target": ""
} |
namespace dbus {
class MethodCall;
}
namespace chromeos {
// This class exports a D-Bus method that libvda will call to establish a
// mojo pipe to the VideoAcceleratorFactory interface.
class LibvdaServiceProvider : public CrosDBusService::ServiceProviderInterface {
public:
LibvdaServiceProvider();
~LibvdaServiceProvider() override;
// CrosDBusService::ServiceProviderInterface overrides:
void Start(scoped_refptr<dbus::ExportedObject> exported_object) override;
private:
// Called from ExportedObject when a handler is exported as a D-Bus
// method or failed to be exported.
void OnExported(const std::string& interface_name,
const std::string& method_name,
bool success);
// Called on UI thread in response to D-Bus requests.
void ProvideMojoConnection(
dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender response_sender);
void OnBootstrapVideoAcceleratorFactoryCallback(
dbus::MethodCall* method_call,
dbus::ExportedObject::ResponseSender response_sender,
mojo::ScopedHandle handle,
const std::string& s);
// Keep this last so that all weak pointers will be invalidated at the
// beginning of destruction.
base::WeakPtrFactory<LibvdaServiceProvider> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(LibvdaServiceProvider);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_DBUS_LIBVDA_SERVICE_PROVIDER_H_
| {
"content_hash": "3aa3d8eee85b936d41efbe472b153951",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 80,
"avg_line_length": 33.04545454545455,
"alnum_prop": 0.7414030261348006,
"repo_name": "endlessm/chromium-browser",
"id": "c414a98f90f8c79c0ed1f60637ff31823bd5c22e",
"size": "2030",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "chrome/browser/chromeos/dbus/libvda_service_provider.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<html>
<head>
<title>RadioTime.js example</title>
<script>
//<!--
var partnerId = 'Fz$khfEf'; //Register your own at http://RadioTime.com/services.aspx
//-->
</script>
<style>
#example {
max-width: 900px
}
#results {
float: left;
min-width: 400px;
}
#stations li {
border-left: 3px solid green;
padding-left: 2px;
margin-bottom: 5px;
}
#map {
width: 400px;
height: 400px;
float: right;
}
</style>
</head>
<body>
<!--
TODO: checkbox to derive from window.geolocation where available
-->
<!--Used by the library.-->
<div id="rt_transport" style="display:hidden;"></div>
<h1 id="banner">RadioTime.js example</h1>
<h2 id="instructions">Stations are initially shown based on your IP. Move the map to see stations around the map's center.</h2>
<div id="example">
<div>
<div style="clear:both" id="map">Please update your API key to make the map work on your site.</div>
<div id="results">
<!--Used to display player status-->
<!--Used to list the local stations-->
<p>Click a station to play it.</p>
<h3 id="player">Loading</h3>
<ul id="stations"></ul>
</div>
</div>
</div>
<script src="/radiotime-tools/js/rsh.js"></script>
<script src="/radiotime-tools/js/radiotime.js"></script>
<!-- jQuery is used to make the examples concise, but it's not needed by RadioTime.js. -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<!--
Google Maps requires an API key for each domain. If you're not running this from localhost,
please register your own key here: http://code.google.com/apis/maps/signup.html
and change the key in the jsapi? call.
localhost:
ABQIAAAAyYu8a7AdbfUctK3zwwu_2hQcSOGmiixENvtTH313vIgQ4X1LYBSDZW5glZCCklLKePmjvJ8YN_LpPA
inside.radiotime.com:
ABQIAAAAIj0IQagPwLTE-M-cwppq3hScRDmIpgR4xcsQYaCOmLnmHrlMZhTo7mwJe-cSso9uEMVBEULLmj_WNQ
radiotime-badges.s3.amazonaws.com:
ABQIAAAAIj0IQagPwLTE-M-cwppq3hTevgAwpYcmllKiEbrm3L0vBt-n0BREyVUP7-wU_soNPKAikmCDYSfIyQ
-->
<script src="http://www.google.com/jsapi?key=ABQIAAAAyYu8a7AdbfUctK3zwwu_2hQcSOGmiixENvtTH313vIgQ4X1LYBSDZW5glZCCklLKePmjvJ8YN_LpPA" type="text/javascript"></script>
<script type="text/javascript">
//<!--
var fromHistory = false;
$(window).ready(function() {
//Initialize the library with our partnerId,
// using HTML container rt_transport,
// and enabling verbose output for debugging.
RadioTime.init(partnerId, "rt_transport", "/radiotime-tools/", {
'verbose':true, 'exactLocation':true,
'history':'hash',
'onHistoryChange': function(state) {
fromHistory = true;
RadioTime.debug("historyChange", state);
if (state.lat) {
RadioTime.latlon = [state.lat, state.lng].join(',');
gmap.setCenter(new google.maps.LatLng(state.lat, state.lng), state.zoom);
} else {
gmap.setCenter(new google.maps.LatLng(37.788, -122.036), 6);
}
getLocal();
fromHistory = false;
}
});
RadioTime.history.add({});
//Use playstateChanged events to synchronize the display with the audio playback.
RadioTime.event.subscribe("playstateChanged", function(state) {
switch(state) {
case "playing":
playing = true;
$("#player").text("Playing (click to pause)");
break;
case "stopped":
case "paused":
$("#player").text("Stopped");
playing = false;
break
}
})
getLocal();
})
function getLocal() {
//Get the local stations
//This is initially based off the IP, since we didn't
// pass opts.latlon to .init above,
// but will use RadioTime.latlon if it's set by adjusting
// the map (Google Maps code below).
RadioTime.API.getCategory(
function(body, head) {
RadioTime.debug("head", head);
$("#banner").text("RadioTime.js example" + (
head.title ? " - " + head.title : " - Local Radio"
));
//Strip the response to just the station nodes.
var stations = RadioTime.response.station(body).slice(0,20);
//Grab the HTML station container, and ensure it's empty.
var stationList = $("#stations");
stationList.children().remove();
//Stash the station ID (from guide_id) and hook up a click handler to play the related TuneUrl.
for (var i=0;i < stations.length; i++) {
RadioTime.debug(stations[i].text);
var li = $("<li stationId='" + stations[i].guide_id + "'>" + stations[i].text + "</li>");
li.click(function() {
$("#player").text("Starting stream...");
play($(this).attr("stationId"));
});
//Add this station to the list.
stationList.append(li);
}
if (0 == stations.length) {
stationList.append($("<li stationId='0'>Sorry, no stations in this location.</li>"));
}
},
function() {
RadioTime.debug("Failed to get local.");
},
"local"
);
}
function play(stationId) {
RadioTime.API.tune(
function(playlist) {
RadioTime.debug(playlist);
RadioTime.player.startPlaylist(playlist);
},
function() {
RadioTime.debug("Failed to tune station " + stationId);
},
stationId
);
}
//Play or pause the playback based on the current status.
$("#player").click(function() {
if (playing) {
RadioTime.player.stop();
} else {
RadioTime.player.play();
}
});
//Set up a map to make choosing a location easy.
google.load('maps', '2', {'callback': setUpMap}); // Load version 2 of the Maps API
var timer = null;
function setUpMap() {
//Code adapted from getlatlon.com
window.gmap = new google.maps.Map2(document.getElementById('map'));
gmap.addControl(new google.maps.LargeMapControl());
gmap.addControl(new google.maps.MapTypeControl());
gmap.enableContinuousZoom();
gmap.enableScrollWheelZoom()
if (google.loader.ClientLocation) {
gmap.setCenter(
new google.maps.LatLng(
google.loader.ClientLocation.latitude,
google.loader.ClientLocation.longitude
), 8
);
} else {
gmap.setCenter(new google.maps.LatLng(37.788, -122.036), 6);
};
//Set RadioTime.latlon when the map is moved to a new location.
google.maps.Event.addListener(gmap, "move", function() {
if (fromHistory) {
var center = gmap.getCenter();
RadioTime.latlon = [center.lat(), center.lng()].join(',');
getLocal();
return;
}
if (timer) { //delay location fetches until moves are completed.
clearTimeout(timer);
timer = null;
}
timer = setTimeout(function() {
var center = gmap.getCenter();
RadioTime.latlon = [center.lat(), center.lng()].join(',');
RadioTime.history.add({'lat':center.lat(),'lng':center.lng(),'zoom':gmap.getZoom()});
getLocal();
}, 1000);
});
}
//-->
</script>
<div style="clear:both">
<p>Please see <a href="http://code.google.com/p/radiotime-tools/">radiotime-tools</a> for more information.</p>
</div>
</body>
</html> | {
"content_hash": "891af3a967f15d54d7f6a64ba72f55cf",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 165,
"avg_line_length": 31.333333333333332,
"alnum_prop": 0.6347517730496454,
"repo_name": "iMarck/radiotime-tools",
"id": "2e9012711326434c81b1d55e882c8e7b508af021",
"size": "7050",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "clients/js/src/examples/local_tune.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ActionScript",
"bytes": "35767"
},
{
"name": "HTML",
"bytes": "8989"
},
{
"name": "JavaScript",
"bytes": "57520"
}
],
"symlink_target": ""
} |
'use strict';
module.exports = function(grunt) {
grunt.registerMultiTask('cssshrink', 'Shrinks css.', function() {
// Require stuff
var cssshrink = require('cssshrink');
var path = require('path');
var error = true;
// Default options
var options = this.options({
log: false,
ext: false
});
// Log info only when 'options.log' is set to true
var log = function(message){
if (options.log){
grunt.log.writeln(message);
}
};
this.files.forEach(function(f) {
f.src.forEach(function (filepath) {
error = false;
log('\nFile ' + filepath + ' found.');
var destpath = f.dest;
var filename = filepath.replace(/(.*)\//gi, '');
if (destpath.indexOf(filename) === -1) {
destpath = path.join(f.dest, filename);
}
var source = grunt.file.read(filepath);
var outputcss = cssshrink.shrink(source);
// Define the new file extension
if( options.ext ){
destpath = destpath.replace( /\.(.*)/ , options.ext);
}
// Normalize line endings
outputcss = grunt.util.normalizelf(outputcss);
// Write the new file
grunt.file.write(destpath, outputcss);
grunt.log.ok('File ' + destpath + ' created.');
});
if(error){
grunt.fatal('No files found');
}
});
});
}; | {
"content_hash": "725e9c10653e6158037f0a73af8e5ed6",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 67,
"avg_line_length": 19.554054054054053,
"alnum_prop": 0.5342087076710436,
"repo_name": "JohnCashmore/grunt-cssshrink",
"id": "2a40049bbf6d40a2c8733604414cb009719f19ac",
"size": "1623",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tasks/grunt-cssshrink.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1623"
}
],
"symlink_target": ""
} |
#include "config.h"
#include "platform/fonts/UTF16TextIterator.h"
#include <unicode/unorm.h>
using namespace WTF;
using namespace Unicode;
namespace blink {
UTF16TextIterator::UTF16TextIterator(const UChar* characters, int length)
: m_characters(characters)
, m_charactersEnd(characters + length)
, m_offset(0)
, m_endOffset(length)
, m_currentGlyphLength(0)
{
}
UTF16TextIterator::UTF16TextIterator(const UChar* characters, int currentCharacter, int endOffset, int endCharacter)
: m_characters(characters)
, m_charactersEnd(characters + (endCharacter - currentCharacter))
, m_offset(currentCharacter)
, m_endOffset(endOffset)
, m_currentGlyphLength(0)
{
}
bool UTF16TextIterator::consumeSlowCase(UChar32& character)
{
if (character <= 0x30FE) {
// Deal with Hiragana and Katakana voiced and semi-voiced syllables.
// Normalize into composed form, and then look for glyph with base +
// combined mark.
if (UChar32 normalized = normalizeVoicingMarks()) {
character = normalized;
m_currentGlyphLength = 2;
}
return true;
}
if (!U16_IS_SURROGATE(character))
return true;
// If we have a surrogate pair, make sure it starts with the high part.
if (!U16_IS_SURROGATE_LEAD(character))
return false;
// Do we have a surrogate pair? If so, determine the full Unicode (32 bit)
// code point before glyph lookup.
// Make sure we have another character and it's a low surrogate.
if (m_characters + 1 >= m_charactersEnd)
return false;
UChar low = m_characters[1];
if (!U16_IS_TRAIL(low))
return false;
character = U16_GET_SUPPLEMENTARY(character, low);
m_currentGlyphLength = 2;
return true;
}
void UTF16TextIterator::consumeMultipleUChar()
{
const UChar* markCharactersEnd = m_characters + m_currentGlyphLength;
int markLength = m_currentGlyphLength;
while (markCharactersEnd < m_charactersEnd) {
UChar32 nextCharacter;
int nextCharacterLength = 0;
U16_NEXT(markCharactersEnd, nextCharacterLength,
m_charactersEnd - markCharactersEnd, nextCharacter);
if (!(U_GET_GC_MASK(nextCharacter) & U_GC_M_MASK))
break;
markLength += nextCharacterLength;
markCharactersEnd += nextCharacterLength;
}
m_currentGlyphLength = markLength;
}
UChar32 UTF16TextIterator::normalizeVoicingMarks()
{
// According to http://www.unicode.org/Public/UNIDATA/UCD.html#Canonical_Combining_Class_Values
static const uint8_t hiraganaKatakanaVoicingMarksCombiningClass = 8;
if (m_offset + 1 >= m_endOffset)
return 0;
if (combiningClass(m_characters[1]) == hiraganaKatakanaVoicingMarksCombiningClass) {
// Normalize into composed form using 3.2 rules.
UChar normalizedCharacters[2] = { 0, 0 };
UErrorCode uStatus = U_ZERO_ERROR;
int32_t resultLength = unorm_normalize(m_characters, 2, UNORM_NFC,
UNORM_UNICODE_3_2, &normalizedCharacters[0], 2, &uStatus);
if (resultLength == 1 && !uStatus)
return normalizedCharacters[0];
}
return 0;
}
}
| {
"content_hash": "952f86034d72bf4ce9726ce7ea86b8ee",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 116,
"avg_line_length": 30.78846153846154,
"alnum_prop": 0.6733291692692067,
"repo_name": "smishenk/blink-crosswalk",
"id": "c86c3cf5e4a5df2e193bd83eb68d13d9303b5fcf",
"size": "4190",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "Source/platform/fonts/UTF16TextIterator.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "1835"
},
{
"name": "Assembly",
"bytes": "14768"
},
{
"name": "Batchfile",
"bytes": "35"
},
{
"name": "C",
"bytes": "124680"
},
{
"name": "C++",
"bytes": "44958218"
},
{
"name": "CSS",
"bytes": "570706"
},
{
"name": "CoffeeScript",
"bytes": "163"
},
{
"name": "GLSL",
"bytes": "11578"
},
{
"name": "Groff",
"bytes": "28067"
},
{
"name": "HTML",
"bytes": "58724841"
},
{
"name": "Java",
"bytes": "109391"
},
{
"name": "JavaScript",
"bytes": "24396968"
},
{
"name": "Objective-C",
"bytes": "48694"
},
{
"name": "Objective-C++",
"bytes": "293932"
},
{
"name": "PHP",
"bytes": "194683"
},
{
"name": "Perl",
"bytes": "585293"
},
{
"name": "Python",
"bytes": "3819714"
},
{
"name": "Ruby",
"bytes": "141818"
},
{
"name": "Shell",
"bytes": "10037"
},
{
"name": "XSLT",
"bytes": "49926"
},
{
"name": "Yacc",
"bytes": "61184"
}
],
"symlink_target": ""
} |
const pkg = require('../../../package')
const path = require('path')
const cwd = path.resolve(__dirname, '../../../')
module.exports = {
hosts: [],
pm2: {
/**
* Application configuration section
* http://pm2.keymetrics.io/docs/usage/application-declaration/
*/
apps: [
{
name: `${pkg.name}`,
script: 'app/index.js',
args: 'app queues schedulers',
cwd,
env: {
NODE_ENV: process.env.NODE_ENV
},
node_args: '--harmony'
}
]
}
}
| {
"content_hash": "11328420b7cac59e9462a22eb1e7edae",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 66,
"avg_line_length": 21.32,
"alnum_prop": 0.5046904315196998,
"repo_name": "garbin/koapp",
"id": "6659c003ca2c8de2c7db9bdaa945e9daf23b7e58",
"size": "533",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "deploy/config/defaults/deployment.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "15425"
},
{
"name": "HTML",
"bytes": "9667"
},
{
"name": "JavaScript",
"bytes": "115781"
}
],
"symlink_target": ""
} |
package backtype.storm.hooks.info;
public class SpoutFailInfo {
public Object messageId;
public int spoutTaskId;
public Long failLatencyMs; // null if it wasn't sampled
public SpoutFailInfo(Object messageId, int spoutTaskId, Long failLatencyMs) {
this.messageId = messageId;
this.spoutTaskId = spoutTaskId;
this.failLatencyMs = failLatencyMs;
}
}
| {
"content_hash": "9b526ed3bd3acbe801ca8a9eea2f8daf",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 78,
"avg_line_length": 28.692307692307693,
"alnum_prop": 0.7506702412868632,
"repo_name": "songtk/learn_jstorm",
"id": "8052b4a3f6da440d48c90fa7b110dbf7c894b2c3",
"size": "373",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "jstorm-client/src/main/java/backtype/storm/hooks/info/SpoutFailInfo.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "60799"
},
{
"name": "Java",
"bytes": "4157878"
},
{
"name": "Perl",
"bytes": "657"
},
{
"name": "Python",
"bytes": "331777"
},
{
"name": "Shell",
"bytes": "4294"
},
{
"name": "Thrift",
"bytes": "10417"
}
],
"symlink_target": ""
} |
/**
*
*/
package org.zzz.jds.task;
import java.util.UUID;
/**
* @author ming luo
*
*/
public class CompletionMessage {
UUID id;
public CompletionMessage(UUID uuid) {
id = uuid;
}
public UUID getFromUUID() {
return id;
}
}
| {
"content_hash": "76a8863c4a2695bcce593a6ee3c8fd05",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 41,
"avg_line_length": 12.714285714285714,
"alnum_prop": 0.5655430711610487,
"repo_name": "zzzming/java-dag-scheduler",
"id": "1fdbfecf372be8760322b7687717675dc2faf787",
"size": "267",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/zzz/jds/task/CompletionMessage.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "36542"
}
],
"symlink_target": ""
} |
import * as asn1js from "asn1js";
import { getParametersValue, clearProps } from "pvutils";
import AlgorithmIdentifier from "./AlgorithmIdentifier.js";
//**************************************************************************************
/**
* Class from RFC3447
*/
export default class RSAESOAEPParams
{
//**********************************************************************************
/**
* Constructor for RSAESOAEPParams class
* @param {Object} [parameters={}]
* @param {Object} [parameters.schema] asn1js parsed value to initialize the class from
*/
constructor(parameters = {})
{
//region Internal properties of the object
/**
* @type {AlgorithmIdentifier}
* @desc hashAlgorithm
*/
this.hashAlgorithm = getParametersValue(parameters, "hashAlgorithm", RSAESOAEPParams.defaultValues("hashAlgorithm"));
/**
* @type {AlgorithmIdentifier}
* @desc maskGenAlgorithm
*/
this.maskGenAlgorithm = getParametersValue(parameters, "maskGenAlgorithm", RSAESOAEPParams.defaultValues("maskGenAlgorithm"));
/**
* @type {AlgorithmIdentifier}
* @desc pSourceAlgorithm
*/
this.pSourceAlgorithm = getParametersValue(parameters, "pSourceAlgorithm", RSAESOAEPParams.defaultValues("pSourceAlgorithm"));
//endregion
//region If input argument array contains "schema" for this object
if("schema" in parameters)
this.fromSchema(parameters.schema);
//endregion
}
//**********************************************************************************
/**
* Return default values for all class members
* @param {string} memberName String name for a class member
*/
static defaultValues(memberName)
{
switch(memberName)
{
case "hashAlgorithm":
return new AlgorithmIdentifier({
algorithmId: "1.3.14.3.2.26", // SHA-1
algorithmParams: new asn1js.Null()
});
case "maskGenAlgorithm":
return new AlgorithmIdentifier({
algorithmId: "1.2.840.113549.1.1.8", // MGF1
algorithmParams: (new AlgorithmIdentifier({
algorithmId: "1.3.14.3.2.26", // SHA-1
algorithmParams: new asn1js.Null()
})).toSchema()
});
case "pSourceAlgorithm":
return new AlgorithmIdentifier({
algorithmId: "1.2.840.113549.1.1.9", // id-pSpecified
algorithmParams: new asn1js.OctetString({ valueHex: (new Uint8Array([0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, 0x90, 0xaf, 0xd8, 0x07, 0x09])).buffer }) // SHA-1 hash of empty string
});
default:
throw new Error(`Invalid member name for RSAESOAEPParams class: ${memberName}`);
}
}
//**********************************************************************************
/**
* Return value of pre-defined ASN.1 schema for current class
*
* ASN.1 schema:
* ```asn1
* RSAES-OAEP-params ::= SEQUENCE {
* hashAlgorithm [0] HashAlgorithm DEFAULT sha1,
* maskGenAlgorithm [1] MaskGenAlgorithm DEFAULT mgf1SHA1,
* pSourceAlgorithm [2] PSourceAlgorithm DEFAULT pSpecifiedEmpty
* }
* ```
*
* @param {Object} parameters Input parameters for the schema
* @returns {Object} asn1js schema object
*/
static schema(parameters = {})
{
/**
* @type {Object}
* @property {string} [blockName]
* @property {string} [hashAlgorithm]
* @property {string} [maskGenAlgorithm]
* @property {string} [pSourceAlgorithm]
*/
const names = getParametersValue(parameters, "names", {});
return (new asn1js.Sequence({
name: (names.blockName || ""),
value: [
new asn1js.Constructed({
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 0 // [0]
},
optional: true,
value: [AlgorithmIdentifier.schema(names.hashAlgorithm || {})]
}),
new asn1js.Constructed({
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 1 // [1]
},
optional: true,
value: [AlgorithmIdentifier.schema(names.maskGenAlgorithm || {})]
}),
new asn1js.Constructed({
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 2 // [2]
},
optional: true,
value: [AlgorithmIdentifier.schema(names.pSourceAlgorithm || {})]
})
]
}));
}
//**********************************************************************************
/**
* Convert parsed asn1js object into current class
* @param {!Object} schema
*/
fromSchema(schema)
{
//region Clear input data first
clearProps(schema, [
"hashAlgorithm",
"maskGenAlgorithm",
"pSourceAlgorithm"
]);
//endregion
//region Check the schema is valid
const asn1 = asn1js.compareSchema(schema,
schema,
RSAESOAEPParams.schema({
names: {
hashAlgorithm: {
names: {
blockName: "hashAlgorithm"
}
},
maskGenAlgorithm: {
names: {
blockName: "maskGenAlgorithm"
}
},
pSourceAlgorithm: {
names: {
blockName: "pSourceAlgorithm"
}
}
}
})
);
if(asn1.verified === false)
throw new Error("Object's schema was not verified against input data for RSAESOAEPParams");
//endregion
//region Get internal properties from parsed schema
if("hashAlgorithm" in asn1.result)
this.hashAlgorithm = new AlgorithmIdentifier({ schema: asn1.result.hashAlgorithm });
if("maskGenAlgorithm" in asn1.result)
this.maskGenAlgorithm = new AlgorithmIdentifier({ schema: asn1.result.maskGenAlgorithm });
if("pSourceAlgorithm" in asn1.result)
this.pSourceAlgorithm = new AlgorithmIdentifier({ schema: asn1.result.pSourceAlgorithm });
//endregion
}
//**********************************************************************************
/**
* Convert current object to asn1js object and set correct values
* @returns {Object} asn1js object
*/
toSchema()
{
//region Create array for output sequence
const outputArray = [];
if(!this.hashAlgorithm.isEqual(RSAESOAEPParams.defaultValues("hashAlgorithm")))
{
outputArray.push(new asn1js.Constructed({
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 0 // [0]
},
value: [this.hashAlgorithm.toSchema()]
}));
}
if(!this.maskGenAlgorithm.isEqual(RSAESOAEPParams.defaultValues("maskGenAlgorithm")))
{
outputArray.push(new asn1js.Constructed({
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 1 // [1]
},
value: [this.maskGenAlgorithm.toSchema()]
}));
}
if(!this.pSourceAlgorithm.isEqual(RSAESOAEPParams.defaultValues("pSourceAlgorithm")))
{
outputArray.push(new asn1js.Constructed({
idBlock: {
tagClass: 3, // CONTEXT-SPECIFIC
tagNumber: 2 // [2]
},
value: [this.pSourceAlgorithm.toSchema()]
}));
}
//endregion
//region Construct and return new ASN.1 schema for this object
return (new asn1js.Sequence({
value: outputArray
}));
//endregion
}
//**********************************************************************************
/**
* Convertion for the class to JSON object
* @returns {Object}
*/
toJSON()
{
const object = {};
if(!this.hashAlgorithm.isEqual(RSAESOAEPParams.defaultValues("hashAlgorithm")))
object.hashAlgorithm = this.hashAlgorithm.toJSON();
if(!this.maskGenAlgorithm.isEqual(RSAESOAEPParams.defaultValues("maskGenAlgorithm")))
object.maskGenAlgorithm = this.maskGenAlgorithm.toJSON();
if(!this.pSourceAlgorithm.isEqual(RSAESOAEPParams.defaultValues("pSourceAlgorithm")))
object.pSourceAlgorithm = this.pSourceAlgorithm.toJSON();
return object;
}
//**********************************************************************************
}
//**************************************************************************************
| {
"content_hash": "097b4fa8c6a640dd202834fbcfc0693c",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 235,
"avg_line_length": 31.019607843137255,
"alnum_prop": 0.5805309734513274,
"repo_name": "GlobalSign/PKI.js",
"id": "8b76592a2906dba2cee9332d819de13736fa14d2",
"size": "7910",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/RSAESOAEPParams.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "1064115"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="50dp" />
<!--<stroke-->
<!--android:width="1dp"-->
<!--android:color="@color/notify_red" />-->
<solid android:color="@color/bg_title" />
<padding
android:bottom="0dp"
android:left="8dp"
android:right="8dp"
android:top="0dp" />
</shape>
| {
"content_hash": "2b40e176e12f90344df683cdbd6bf3e5",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 65,
"avg_line_length": 31.8,
"alnum_prop": 0.5576519916142557,
"repo_name": "denvey/discuz_Android",
"id": "f67ccf1644d9928ba36875662d942675d10ce3e6",
"size": "477",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Clan/Clan/res/drawable/bg_round_alpha.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "10728"
},
{
"name": "HTML",
"bytes": "30763"
},
{
"name": "Java",
"bytes": "6320907"
},
{
"name": "JavaScript",
"bytes": "56041"
}
],
"symlink_target": ""
} |
'use strict';
var React = require('react');
var SvgIcon = require('../../svg-icon');
var HardwareKeyboardCapslock = React.createClass({
displayName: 'HardwareKeyboardCapslock',
render: function render() {
return React.createElement(
SvgIcon,
this.props,
React.createElement('path', { d: 'M12 8.41L16.59 13 18 11.59l-6-6-6 6L7.41 13 12 8.41zM6 18h12v-2H6v2z' })
);
}
});
module.exports = HardwareKeyboardCapslock; | {
"content_hash": "91d70d9feb614123f519ba4571cbb250",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 112,
"avg_line_length": 23.63157894736842,
"alnum_prop": 0.6703786191536748,
"repo_name": "checkraiser/material-ui2",
"id": "3d311c373d15fbe4bd3cfab99c2456c2f901cdd0",
"size": "449",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/svg-icons/hardware/keyboard-capslock.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1750858"
}
],
"symlink_target": ""
} |
<!--
Unsafe sample
input : use proc_open to read /tmp/tainted.txt
Uses a number_int_filter via filter_var function
File : unsafe, use of untrusted data in CSS
-->
<!--Copyright 2015 Bertrand STIVALET
Permission is hereby granted, without written agreement or royalty fee, to
use, copy, modify, and distribute this software and its documentation for
any purpose, provided that the above copyright notice and the following
three paragraphs appear in all copies of this software.
IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT
LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO
OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.-->
<!DOCTYPE html>
<html>
<head>
<style>
<?php
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file", "/tmp/error-output.txt", "a")
);
$cwd = '/tmp';
$process = proc_open('more /tmp/tainted.txt', $descriptorspec, $pipes, $cwd, NULL);
if (is_resource($process)) {
fclose($pipes[0]);
$tainted = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$return_value = proc_close($process);
}
$sanitized = filter_var($tainted, FILTER_SANITIZE_NUMBER_INT);
if (filter_var($sanitized, FILTER_VALIDATE_INT))
$tainted = $sanitized ;
else
$tainted = "" ;
//flaw
echo $tainted ;
?>
</style>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html> | {
"content_hash": "0cc772734c4173ea0101da056dce5cd5",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 83,
"avg_line_length": 23.493333333333332,
"alnum_prop": 0.7202043132803633,
"repo_name": "stivalet/PHP-Vulnerability-test-suite",
"id": "591ec545a95cffc4ae5d8de75ee7568791fd366d",
"size": "1762",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "XSS/CWE_79/unsafe/CWE_79__proc_open__func_FILTER-CLEANING-number_int_filter__Unsafe_use_untrusted_data-style.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "64184004"
}
],
"symlink_target": ""
} |
#include <errno.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <openssl/buffer.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
# include <process.h>
# ifndef __cplusplus
# define bool char
# define true 1
# define false 0
# endif
# define snprintf sprintf_s
# include <io.h>
#else
# include <stdbool.h>
# include <unistd.h>
# include <termios.h>
#endif
#define MAX_BUFFER_LEN 1024
#define SALT_LEN 12
int base64_encode(unsigned char *in, unsigned int in_len, char **encoded)
{
BIO *bmem, *b64;
BUF_MEM *bptr;
b64 = BIO_new(BIO_f_base64());
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
bmem = BIO_new(BIO_s_mem());
b64 = BIO_push(b64, bmem);
BIO_write(b64, in, in_len);
if(BIO_flush(b64) != 1){
BIO_free_all(b64);
return 1;
}
BIO_get_mem_ptr(b64, &bptr);
*encoded = calloc(bptr->length+1, 1);
if(!(*encoded)){
BIO_free_all(b64);
return 1;
}
memcpy(*encoded, bptr->data, bptr->length);
(*encoded)[bptr->length] = '\0';
BIO_free_all(b64);
return 0;
}
void print_usage(void)
{
printf("mosquitto_passwd is a tool for managing password files for mosquitto.\n\n");
printf("Usage: mosquitto_passwd [-c | -D] passwordfile username\n");
printf(" mosquitto_passwd -U passwordfile\n");
printf(" -c : create a new password file. This will overwrite existing files.\n");
printf(" -D : delete the username rather than adding/updating its password.\n");
printf(" -U : update a plain text password file to use hashed passwords.\n");
printf("\nSee http://mosquitto.org/ for more information.\n\n");
}
int output_new_password(FILE *fptr, const char *username, const char *password)
{
int rc;
unsigned char salt[SALT_LEN];
char *salt64 = NULL, *hash64 = NULL;
unsigned char hash[EVP_MAX_MD_SIZE];
unsigned int hash_len;
const EVP_MD *digest;
EVP_MD_CTX context;
char *pass_salt;
int pass_salt_len;
rc = RAND_bytes(salt, SALT_LEN);
if(!rc){
fprintf(stderr, "Error: Insufficient entropy available to perform password generation.\n");
return 1;
}
rc = base64_encode(salt, SALT_LEN, &salt64);
if(rc){
if(salt64) free(salt64);
fprintf(stderr, "Error: Unable to encode salt.\n");
return 1;
}
digest = EVP_get_digestbyname("sha512");
if(!digest){
if(salt64) free(salt64);
fprintf(stderr, "Error: Unable to create openssl digest.\n");
return 1;
}
pass_salt_len = strlen(password) + SALT_LEN;
pass_salt = malloc(pass_salt_len);
if(!pass_salt){
if(salt64) free(salt64);
fprintf(stderr, "Error: Out of memory.\n");
return 1;
}
memcpy(pass_salt, password, strlen(password));
memcpy(pass_salt+strlen(password), salt, SALT_LEN);
EVP_MD_CTX_init(&context);
EVP_DigestInit_ex(&context, digest, NULL);
EVP_DigestUpdate(&context, pass_salt, pass_salt_len);
EVP_DigestFinal_ex(&context, hash, &hash_len);
EVP_MD_CTX_cleanup(&context);
free(pass_salt);
rc = base64_encode(hash, hash_len, &hash64);
if(rc){
if(salt64) free(salt64);
if(hash64) free(hash64);
fprintf(stderr, "Error: Unable to encode hash.\n");
return 1;
}
fprintf(fptr, "%s:$6$%s$%s\n", username, salt64, hash64);
free(salt64);
free(hash64);
return 0;
}
int delete_pwuser(FILE *fptr, FILE *ftmp, const char *username)
{
char buf[MAX_BUFFER_LEN];
char lbuf[MAX_BUFFER_LEN], *token;
bool found = false;
while(!feof(fptr) && fgets(buf, MAX_BUFFER_LEN, fptr)){
memcpy(lbuf, buf, MAX_BUFFER_LEN);
token = strtok(lbuf, ":");
if(strcmp(username, token)){
fprintf(ftmp, "%s", buf);
}else{
found = true;
}
}
if(!found){
fprintf(stderr, "Warning: User %s not found in password file.\n", username);
}
return 0;
}
int update_file(FILE *fptr, FILE *ftmp)
{
char buf[MAX_BUFFER_LEN];
char lbuf[MAX_BUFFER_LEN];
char *username, *password;
int rc;
int len;
while(!feof(fptr) && fgets(buf, MAX_BUFFER_LEN, fptr)){
memcpy(lbuf, buf, MAX_BUFFER_LEN);
username = strtok(lbuf, ":");
password = strtok(NULL, ":");
if(password){
len = strlen(password);
while(len && (password[len-1] == '\n' || password[len-1] == '\r')){
password[len-1] = '\0';
len = strlen(password);
}
rc = output_new_password(ftmp, username, password);
if(rc) return rc;
}else{
fprintf(ftmp, "%s", username);
}
}
return 0;
}
int update_pwuser(FILE *fptr, FILE *ftmp, const char *username, const char *password)
{
char buf[MAX_BUFFER_LEN];
char lbuf[MAX_BUFFER_LEN], *token;
bool found = false;
int rc = 1;
while(!feof(fptr) && fgets(buf, MAX_BUFFER_LEN, fptr)){
memcpy(lbuf, buf, MAX_BUFFER_LEN);
token = strtok(lbuf, ":");
if(strcmp(username, token)){
fprintf(ftmp, "%s", buf);
}else{
rc = output_new_password(ftmp, username, password);
found = true;
}
}
if(found){
return rc;
}else{
return output_new_password(ftmp, username, password);
}
}
int gets_quiet(char *s, int len)
{
#ifdef WIN32
HANDLE h;
DWORD con_orig, con_quiet;
DWORD read_len = 0;
memset(s, 0, len);
h = GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode(h, &con_orig);
con_quiet &= ~ENABLE_ECHO_INPUT;
con_quiet |= ENABLE_LINE_INPUT;
SetConsoleMode(h, con_quiet);
if(!ReadConsole(h, s, len, &read_len, NULL)){
SetConsoleMode(h, con_orig);
return 1;
}
while(s[strlen(s)-1] == 10 || s[strlen(s)-1] == 13){
s[strlen(s)-1] = 0;
}
if(strlen(s) == 0){
return 1;
}
SetConsoleMode(h, con_orig);
return 0;
#else
struct termios ts_quiet, ts_orig;
char *rs;
memset(s, 0, len);
tcgetattr(0, &ts_orig);
ts_quiet = ts_orig;
ts_quiet.c_lflag &= ~(ECHO | ICANON);
tcsetattr(0, TCSANOW, &ts_quiet);
rs = fgets(s, len, stdin);
tcsetattr(0, TCSANOW, &ts_orig);
if(!rs){
return 1;
}else{
while(s[strlen(s)-1] == 10 || s[strlen(s)-1] == 13){
s[strlen(s)-1] = 0;
}
if(strlen(s) == 0){
return 1;
}
}
return 0;
#endif
}
int get_password(char *password, int len)
{
char pw1[MAX_BUFFER_LEN], pw2[MAX_BUFFER_LEN];
printf("Password: ");
if(gets_quiet(pw1, MAX_BUFFER_LEN)){
fprintf(stderr, "Error: Empty password.\n");
return 1;
}
printf("\n");
printf("Reenter password: ");
if(gets_quiet(pw2, MAX_BUFFER_LEN)){
fprintf(stderr, "Error: Empty password.\n");
return 1;
}
printf("\n");
if(strcmp(pw1, pw2)){
fprintf(stderr, "Error: Passwords do not match.\n");
return 1;
}
strncpy(password, pw1, len);
return 0;
}
int copy_contents(FILE *src, FILE *dest)
{
char buf[MAX_BUFFER_LEN];
int len;
rewind(src);
rewind(dest);
#ifdef WIN32
_chsize(fileno(dest), 0);
#else
if(ftruncate(fileno(dest), 0)) return 1;
#endif
while(!feof(src)){
len = fread(buf, 1, MAX_BUFFER_LEN, src);
if(len > 0){
if(fwrite(buf, 1, len, dest) != len){
return 1;
}
}else{
return !feof(src);
}
}
return 0;
}
int create_backup(const char *backup_file, FILE *fptr)
{
FILE *fbackup;
fbackup = fopen(backup_file, "wt");
if(!fbackup){
fprintf(stderr, "Error creating backup password file \"%s\", not continuing.\n", backup_file);
return 1;
}
if(copy_contents(fptr, fbackup)){
fprintf(stderr, "Error copying data to backup password file \"%s\", not continuing.\n", backup_file);
fclose(fbackup);
return 1;
}
fclose(fbackup);
rewind(fptr);
return 0;
}
void handle_sigint(int signal)
{
#ifndef WIN32
struct termios ts;
tcgetattr(0, &ts);
ts.c_lflag |= ECHO | ICANON;
tcsetattr(0, TCSANOW, &ts);
#endif
exit(0);
}
int main(int argc, char *argv[])
{
char *password_file = NULL;
char *username = NULL;
bool create_new = false;
bool delete_user = false;
FILE *fptr, *ftmp;
char password[MAX_BUFFER_LEN];
int rc;
bool do_update_file = false;
char *backup_file;
signal(SIGINT, handle_sigint);
signal(SIGTERM, handle_sigint);
OpenSSL_add_all_digests();
if(argc == 4){
if(!strcmp(argv[1], "-c")){
create_new = true;
}else if(!strcmp(argv[1], "-D")){
delete_user = true;
}
password_file = argv[2];
username = argv[3];
}else if(argc == 3){
if(!strcmp(argv[1], "-U")){
do_update_file = true;
password_file = argv[2];
}else{
password_file = argv[1];
username = argv[2];
}
}else{
print_usage();
return 1;
}
if(create_new){
rc = get_password(password, 1024);
if(rc) return rc;
fptr = fopen(password_file, "wt");
if(!fptr){
fprintf(stderr, "Error: Unable to open file %s for writing. %s.\n", password_file, strerror(errno));
return 1;
}
rc = output_new_password(fptr, username, password);
fclose(fptr);
return rc;
}else{
fptr = fopen(password_file, "r+t");
if(!fptr){
fprintf(stderr, "Error: Unable to open password file %s. %s.\n", password_file, strerror(errno));
return 1;
}
backup_file = malloc(strlen(password_file)+5);
snprintf(backup_file, strlen(password_file)+5, "%s.tmp", password_file);
if(create_backup(backup_file, fptr)){
fclose(fptr);
free(backup_file);
return 1;
}
ftmp = tmpfile();
if(!ftmp){
fprintf(stderr, "Error: Unable to open temporary file. %s.\n", strerror(errno));
fclose(fptr);
free(backup_file);
return 1;
}
if(delete_user){
rc = delete_pwuser(fptr, ftmp, username);
}else if(do_update_file){
rc = update_file(fptr, ftmp);
}else{
rc = get_password(password, 1024);
if(rc){
fclose(fptr);
fclose(ftmp);
unlink(backup_file);
free(backup_file);
return rc;
}
/* Update password for individual user */
rc = update_pwuser(fptr, ftmp, username, password);
}
if(rc){
fclose(fptr);
fclose(ftmp);
unlink(backup_file);
free(backup_file);
return rc;
}
if(copy_contents(ftmp, fptr)){
fclose(fptr);
fclose(ftmp);
fprintf(stderr, "Error occurred updating password file.\n");
fprintf(stderr, "Password file may be corrupt, check the backup file: %s.\n", backup_file);
free(backup_file);
return 1;
}
fclose(fptr);
fclose(ftmp);
/* Everything was ok so backup no longer needed. May contain old
* passwords so shouldn't be kept around. */
unlink(backup_file);
free(backup_file);
}
return 0;
}
| {
"content_hash": "7bfc3b9dcc5a7f76d48b0167361ef8e5",
"timestamp": "",
"source": "github",
"line_count": 456,
"max_line_length": 103,
"avg_line_length": 21.82017543859649,
"alnum_prop": 0.6418090452261307,
"repo_name": "zhkzyth/better-mosquitto",
"id": "47e19a6bd9994ea9afca29bc9f548442d9d629d9",
"size": "11461",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/mosquitto_passwd.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "723187"
},
{
"name": "C++",
"bytes": "34223"
},
{
"name": "JavaScript",
"bytes": "8597"
},
{
"name": "Perl",
"bytes": "3271"
},
{
"name": "Python",
"bytes": "265033"
},
{
"name": "Shell",
"bytes": "3991"
},
{
"name": "XSLT",
"bytes": "1151"
}
],
"symlink_target": ""
} |
title: 'Get Local Task Variable (Binary)'
weight: 250
menu:
main:
name: "Get (Binary)"
identifier: "rest-api-task-get-local-variable-binary"
parent: "rest-api-task-local-variables"
pre: "GET `/task/{id}/localVariables/{varName}/data`"
---
Retrieves a binary variable from the context of a given task by id. Applicable for byte array and file variables.
# Method
GET `/task/{id}/localVariables/{varName}/data`
# Parameters
## Path Parameters
<table class="table table-striped">
<tr>
<th>Name</th>
<th>Description</th>
</tr>
<tr>
<td>id</td>
<td>The id of the task to retrieve the variable from.</td>
</tr>
<tr>
<td>varName</td>
<td>The name of the variable to get.</td>
</tr>
</table>
# Result
For binary variables or files without any MIME type information, a byte stream is returned. File variables with MIME type information are returned as the saved type.
Additionally, for file variables the Content-Disposition header will be set.
# Response Codes
<table class="table table-striped">
<tr>
<th>Code</th>
<th>Media type</th>
<th>Description</th>
</tr>
<tr>
<td>200</td>
<td>application/octet-stream<br/><b>or</b></br>the saved MIME type</td>
<td>Request successful.</td>
</tr>
<tr>
<td>400</td>
<td>application/json</td>
<td>Variable with given id exists but is not a binary variable. See the <a href="{{< relref "reference/rest/overview/index.md#error-handling" >}}">Introduction</a> for the error response format.</td>
</tr>
<tr>
<td>404</td>
<td>application/json</td>
<td>Variable with given id does not exist. See the <a href="{{< relref "reference/rest/overview/index.md#error-handling" >}}">Introduction</a> for the error response format.</td>
</tr>
</table>
# Example
## Request
GET `/task/aTaskId/localVariables/aVarName/data`
## Response
binary variable: Status 200. Content-Type: application/octet-stream
file variable: Status 200. Content-Type: text/plain; charset=UTF-8. Content-Disposition: attachment; filename="someFile.txt"
| {
"content_hash": "3d74023371cf23a84a493de6174725a7",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 203,
"avg_line_length": 25.402439024390244,
"alnum_prop": 0.6783485357657225,
"repo_name": "holisticon/camunda-bpm-swagger",
"id": "cc866277f7c0d0ff8a384ab7c36e85ec0787cf48",
"size": "2088",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "maven-plugin/rest-docs/src/test/resources/rest/task/local-variables/get-local-task-variable-binary.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4994"
},
{
"name": "HTML",
"bytes": "487"
},
{
"name": "Java",
"bytes": "111777"
},
{
"name": "Shell",
"bytes": "6784"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
<groupId>fire.bot</groupId>
<artifactId>fireBot</artifactId>
<version>0.1</version>
<repositories>
<repository>
<id>sonatype-snapshot</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
<repository>
<id>jcenter</id>
<url>https://jcenter.bintray.com</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.austinv11</groupId>
<artifactId>Discord4J</artifactId>
<version>2.8.2</version>
<classifier>shaded</classifier>
</dependency>
<dependency>
<groupId>net.dean.jraw</groupId>
<artifactId>JRAW</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>com.github.dwursteisen</groupId>
<artifactId>image-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.ini4j</groupId>
<artifactId>ini4j</artifactId>
<version>0.5.2</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.22.0</version>
</dependency>
<dependency>
<groupId>org.fusesource.leveldbjni</groupId>
<artifactId>leveldbjni-all</artifactId>
<version>1.8</version>
</dependency>
</dependencies>
</project> | {
"content_hash": "6ed8c75096f2cbbed864e6eb27c960ac",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 108,
"avg_line_length": 28.214285714285715,
"alnum_prop": 0.5305605786618445,
"repo_name": "Xadro3/FireBot9K",
"id": "2c99055aa7ad5d577e7f584861112d8658148ab3",
"size": "2765",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pom.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "23916"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="false"
xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
</layout>
</appender>
<root>
<level value="ERROR" />
<appender-ref ref="console" />
</root>
</log4j:configuration> | {
"content_hash": "37dfbe7ddcf90233b707ba642f6b5c18",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 68,
"avg_line_length": 29.666666666666668,
"alnum_prop": 0.6479400749063671,
"repo_name": "synthetichealth/synthea",
"id": "83f2f7623dce27d6a19fdec9fadf986b035aef1d",
"size": "534",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/resources/log4j.xml",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "653"
},
{
"name": "FreeMarker",
"bytes": "46769"
},
{
"name": "Java",
"bytes": "2585270"
},
{
"name": "JavaScript",
"bytes": "7344"
},
{
"name": "Shell",
"bytes": "573"
}
],
"symlink_target": ""
} |
The system catalog table `pg_foreign_server` stores foreign server definitions. A foreign server describes a source of external data, such as a remote server. You access a foreign server via a foreign-data wrapper.
|column|type|references|description|
|------|----|----------|-----------|
|`srvname`|name| |Name of the foreign server.|
|`srvowner`|oid|pg\_authid.oid|Owner of the foreign server.|
|`srvfdw`|oid|pg\_foreign\_data\_wrapper.oid|OID of the foreign-data wrapper of this foreign server.|
|`srvtype`|text| |Type of server \(optional\).|
|`srvversion`|text| |Version of the server \(optional\).|
|`srvacl`|aclitem\[\]| |Access privileges; see [GRANT](../sql_commands/GRANT.html) and [REVOKE](../sql_commands/REVOKE.html) for details.|
|`srvoptions`|text\[\]| |Foreign server-specific options, as "keyword=value" strings.|
**Parent topic:** [System Catalogs Definitions](../system_catalogs/catalog_ref-html.html)
| {
"content_hash": "00a88126beefbe65747da2380333f69f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 214,
"avg_line_length": 66,
"alnum_prop": 0.7132034632034632,
"repo_name": "50wu/gpdb",
"id": "160a513bb19ab6edf72828801973794a8d8e53fd",
"size": "951",
"binary": false,
"copies": "4",
"ref": "refs/heads/main",
"path": "gpdb-doc/markdown/ref_guide/system_catalogs/pg_foreign_server.html.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "3266"
},
{
"name": "Awk",
"bytes": "836"
},
{
"name": "Batchfile",
"bytes": "15613"
},
{
"name": "C",
"bytes": "48333944"
},
{
"name": "C++",
"bytes": "12669653"
},
{
"name": "CMake",
"bytes": "41361"
},
{
"name": "DTrace",
"bytes": "3833"
},
{
"name": "Emacs Lisp",
"bytes": "4164"
},
{
"name": "Fortran",
"bytes": "14873"
},
{
"name": "GDB",
"bytes": "576"
},
{
"name": "Gherkin",
"bytes": "497627"
},
{
"name": "HTML",
"bytes": "215381"
},
{
"name": "JavaScript",
"bytes": "23969"
},
{
"name": "Lex",
"bytes": "254578"
},
{
"name": "M4",
"bytes": "133878"
},
{
"name": "Makefile",
"bytes": "510880"
},
{
"name": "PLpgSQL",
"bytes": "9268834"
},
{
"name": "Perl",
"bytes": "1161283"
},
{
"name": "PowerShell",
"bytes": "422"
},
{
"name": "Python",
"bytes": "3396833"
},
{
"name": "Roff",
"bytes": "30385"
},
{
"name": "Ruby",
"bytes": "299639"
},
{
"name": "SCSS",
"bytes": "339"
},
{
"name": "Shell",
"bytes": "404604"
},
{
"name": "XS",
"bytes": "7098"
},
{
"name": "XSLT",
"bytes": "448"
},
{
"name": "Yacc",
"bytes": "747692"
},
{
"name": "sed",
"bytes": "1231"
}
],
"symlink_target": ""
} |
Bloop: DynamoDB Modeling
^^^^^^^^^^^^^^^^^^^^^^^^
DynamoDB's concurrency model is great, but using it correctly is tedious and unforgiving.
`Bloop manages that complexity for you.`__
Requires Python 3.6+
__ https://gist.github.com/numberoverzero/9584cfc375de0e087c8e1ae35ab8559c
==========
Features
==========
* Simple declarative modeling
* Stream interface that makes sense
* Easy transactions
* Extensible type system, useful built-in types
* Secure expression-based wire format
* Expressive conditions
* Model composition
* Diff-based saves
* Server-Side Encryption
* Time-To-Live
* Continuous Backups
* On-Demand Billing
============
Ergonomics
============
The basics:
.. code-block:: python
class Account(BaseModel):
id = Column(UUID, hash_key=True)
name = Column(String)
email = Column(String)
by_email = GlobalSecondaryIndex(
projection='keys', hash_key='email')
engine.bind(Account)
some_account = Account(id=uuid.uuid4(), email='foo@bar.com')
engine.save(some_account)
q = engine.query(Account.by_email, key=Account.email == 'foo@bar.com')
same_account = q.one()
print(same_account.id)
Iterate over a stream:
.. code-block:: python
template = "old: {old}\nnew: {new}\ndetails:{meta}"
stream = engine.stream(User, 'trim_horizon')
while True:
record = next(stream)
if not record:
time.sleep(0.5)
continue
print(template.format(**record))
Use transactions:
.. code-block:: python
with engine.transaction() as tx:
tx.save(account)
tx.delete(update_token, condition=Token.until <= now())
=============
What's Next
=============
Get started by :ref:`installing <user-install>` Bloop, or check out a :ref:`larger example <user-quickstart>`.
.. toctree::
:maxdepth: 2
:caption: User Guide
:hidden:
user/install
user/quickstart
user/models
user/engine
user/transactions
user/streams
user/types
user/conditions
user/signals
user/patterns
user/extensions
.. toctree::
:maxdepth: 2
:caption: API
:hidden:
api/public
api/internal
.. toctree::
:maxdepth: 2
:caption: Project
:hidden:
meta/changelog
meta/about
| {
"content_hash": "450734b5303ac15b8a45aa5b54fb1404",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 110,
"avg_line_length": 20.410714285714285,
"alnum_prop": 0.6356080489938758,
"repo_name": "numberoverzero/bloop",
"id": "40cfb065bc10069f83bb3fdc8f863617007c5ad1",
"size": "2286",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/index.rst",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "267"
},
{
"name": "Python",
"bytes": "618363"
},
{
"name": "Shell",
"bytes": "95"
}
],
"symlink_target": ""
} |
package br.ufpe.cin.aac3.gryphon;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.PropertyConfigurator;
import org.openrdf.query.QueryLanguage;
import org.openrdf.query.TupleQuery;
import org.openrdf.query.resultio.sparqljson.SPARQLResultsJSONWriter;
import org.openrdf.query.resultio.sparqlxml.SPARQLResultsXMLWriter;
import org.openrdf.query.resultio.text.csv.SPARQLResultsCSVWriter;
import org.openrdf.repository.Repository;
import org.openrdf.repository.RepositoryConnection;
import org.openrdf.repository.config.RepositoryConfig;
import org.openrdf.repository.manager.LocalRepositoryManager;
import org.openrdf.repository.sail.config.SailRepositoryConfig;
import org.openrdf.rio.RDFFormat;
import org.openrdf.sail.memory.config.MemoryStoreConfig;
import br.ufpe.cin.aac3.gryphon.model.Database;
import br.ufpe.cin.aac3.gryphon.model.Ontology;
public final class Gryphon {
public static final String VERSION = "1.0";
private static final String REPOSITORY_ID = "gryphon-repo";
private static File alignFolder;
private static File mapFolder;
private static File resultFolder;
private static File libsFolder;
private static Ontology globalOntology;
private static List<Ontology> localOntologies;
private static List<Database> localDatabases;
public enum ResultFormat {
JSON, XML, CSV
}
public enum DBMS {
MySQL, PostgreSQL
}
private Gryphon() { }
/**
* Initiates Gryphon Framework
*/
public static void init(){
try {
PropertyConfigurator.configure(Gryphon.class.getResource("/log4j.properties").openStream());
} catch (IOException e) {
e.printStackTrace();
}
if(GryphonConfig.isShowLogo() && GryphonConfig.isLogEnabled()){
System.out.println(
"\n _ (`-. "
+ "\n \\`----. ) ^_`) GRYPHON v" + VERSION
+ "\n ,__ \\__ `\\_/ ( ` A Framework for Semantic Integration"
+ "\n \\_\\ \\__ `| }"
+ "\n \\ .--' \\__/ } By Adriel Café, Filipe Santana, Fred Freitas"
+ "\n ))/ \\__,< /_/ {aac3, fss3, fred}@cin.ufpe.br"
+ "\n ((| _/_/ `\\ \\_\\_"
+ "\n `\\_____\\\\ )__\\_\\"
+ "\n"
);
}
alignFolder = new File(GryphonConfig.getWorkingDirectory().getAbsolutePath(), "alignments");
mapFolder = new File(GryphonConfig.getWorkingDirectory().getAbsolutePath(), "mappings");
resultFolder = new File(GryphonConfig.getWorkingDirectory().getAbsolutePath(), "results");
libsFolder = new File(GryphonConfig.getWorkingDirectory().getAbsolutePath(), "../libs");
if (!libsFolder.exists()) {
throw new RuntimeException("Gryphon libs folder not found in working directory");
}
alignFolder.mkdirs();
mapFolder.mkdirs();
resultFolder.mkdirs();
localOntologies = new ArrayList<Ontology>();
localDatabases = new ArrayList<Database>();
}
/**
* Aligns ontologies and maps databases
*/
public static void alignAndMap() {
if(!localOntologies.isEmpty()){
GryphonUtil.logInfo("Aligning ontologies...");
for (Ontology ontology : localOntologies) {
alignOntology(ontology.getURI(), ontology.getAlignFile());
GryphonUtil.logInfo(String.format("> Ontology %s was aligned", ontology.getName()));
}
}
if(!localDatabases.isEmpty()){
GryphonUtil.logInfo("Mapping databases...");
for (Database database : localDatabases) {
mapDatabase(database);
// TODO Need improvement
// alignOntology(database.getMapRDFFile().toURI(), database.getAlignFile());
GryphonUtil.logInfo(String.format("> Database %s was mapped", database.getDbName()));
}
}
}
/**
* Aligns local ontologies with <b>AgreementMakerLight</b> command-line
* @param localOntologyURI The URI of local ontology
* @param alignFile The alignment file
*/
private static void alignOntology(URI localOntologyURI, File alignFile) {
try {
File jarFile = new File(libsFolder, "aml/AgreementMakerLight.jar");
String cmd = String.format("cd \"%s\" && java -jar \"%s\" -s \"%s\" -t \"%s\" -o \"%s\" -m", jarFile.getParentFile().getAbsolutePath(), jarFile.getAbsolutePath(), new File(globalOntology.getURI()).getAbsolutePath(), new File(localOntologyURI).getAbsolutePath(), alignFile.getAbsolutePath());
if(globalOntology.getLocalImports() != null){
cmd += " -l " + globalOntology.getLocalImports().getAbsolutePath();
}
CommandUtil.executeCommand(cmd);
} catch (Exception e) {
GryphonUtil.logError(e);
}
}
/**
* Maps local databases with <b>D2RQ</b> command-line
* @param db The database to be mapped
*/
private static void mapDatabase(Database db) {
try {
File scriptFile = new File(libsFolder, "d2rq/generate-mapping" + (GryphonUtil.isWindows() ? ".bat" : ""));
CommandUtil.executeCommand("%s \"%s\" -o \"%s\" -u \"%s\" -p \"%s\" \"%s\"",
(GryphonUtil.isWindows() ? "" : "bash"),
scriptFile.getAbsolutePath(),
db.getMapTTLFile().getAbsolutePath(),
db.getUsername(),
db.getPassword(),
db.getJdbcURL());
} catch (Exception e) {
GryphonUtil.logError(e);
}
}
/**
* Rewrites the SPARQL query to each local ontology and local database
* @param strQueryGlobal The query that needs to be rewritten
*/
public static void query(String strQueryGlobal, ResultFormat resultFormat){
String strQueryLocal = null;
TupleQuery queryLocal = null;
try {
FileUtils.cleanDirectory(resultFolder);
} catch(Exception e){ }
LocalRepositoryManager repositoryManager = new LocalRepositoryManager(GryphonConfig.getWorkingDirectory());
RepositoryConfig repConfig = new RepositoryConfig(REPOSITORY_ID, new SailRepositoryConfig(new MemoryStoreConfig()));
try {
repositoryManager.initialize();
repositoryManager.addRepositoryConfig(repConfig);
} catch(Exception e){
GryphonUtil.logError(e);
}
try {
Repository repository = repositoryManager.getRepository(REPOSITORY_ID);
for(Ontology ontology : localOntologies){
final RepositoryConnection repositoryConnection = repository.getConnection();
repositoryConnection.add(new File(ontology.getURI()), ontology.getURI().toString(), RDFFormat.RDFXML);
ontology.getResultFile().setWritable(true);
strQueryLocal = queryRewrite(strQueryGlobal, ontology.getAlignFile());
queryLocal = repositoryConnection.prepareTupleQuery(QueryLanguage.SPARQL, strQueryLocal);
if(queryLocal != null){
GryphonUtil.logInfo("\nRewritten query for " + ontology.getName() + ":\n" + strQueryLocal);
execOntologyQuery(queryLocal, ontology.getResultFile(), resultFormat);
}
repositoryConnection.close();
}
} catch(Exception e){
GryphonUtil.logError(e);
}
for(Database database : localDatabases){
database.getResultFile().setWritable(true);
execDataBaseQuery(strQueryGlobal, database.getMapTTLFile(), database.getResultFile(), resultFormat);
}
}
/**
* Rewrites SPARQL queries using <b>Mediation</b>
* @param query The query that needs to be rewritten
* @param alignFile The alignment file
* @return The rewritten query
*/
private static String queryRewrite(String query, File alignFile) {
try {
File jarFile = new File(libsFolder, "mediation/mediation.jar");
return CommandUtil.executeCommand("cd \"%s\" && java -jar \"%s\" \"%s\" \"%s\"",
jarFile.getParentFile().getAbsolutePath(),
jarFile.getAbsolutePath(),
alignFile.getAbsolutePath(),
query.replace("\n", " "));
} catch (Exception e) {
GryphonUtil.logError(e);
return null;
}
}
/**
* Runs a SPARQL query using <b>Sesame</b> on ontology
* @param query The SPARQL query
* @param resultFile The file where the results will be saved
*/
private static void execOntologyQuery(TupleQuery query, File resultFile, ResultFormat resultFormat) {
try {
switch (resultFormat) {
case XML:
resultFile = new File(resultFile.getAbsolutePath() + ".xml");
SPARQLResultsXMLWriter xmlWriter = new SPARQLResultsXMLWriter(new FileOutputStream(resultFile));
query.evaluate(xmlWriter);
break;
case CSV:
resultFile = new File(resultFile.getAbsolutePath() + ".csv");
SPARQLResultsCSVWriter csvWriter = new SPARQLResultsCSVWriter(new FileOutputStream(resultFile));
query.evaluate(csvWriter);
break;
case JSON:
default:
resultFile = new File(resultFile.getAbsolutePath() + ".json");
SPARQLResultsJSONWriter jsonWriter = new SPARQLResultsJSONWriter(new FileOutputStream(resultFile));
query.evaluate(jsonWriter);
}
} catch(Exception e){
GryphonUtil.logError(e);
}
}
/**
* Runs a SPARQL query using <b>D2RQ</b> on database
* @param strQuery The SPARQL query
* @param mapFile The database mapping file
* @param resultFile The file where the results will be saved
*/
private static void execDataBaseQuery(String strQuery, File mapFile, File resultFile, ResultFormat resultFormat) {
String strResultFormat = null;
switch (resultFormat) {
case XML:
resultFile = new File(resultFile.getAbsolutePath() + ".xml");
strResultFormat = "xml";
break;
case CSV:
resultFile = new File(resultFile.getAbsolutePath() + ".csv");
strResultFormat = "csv";
break;
case JSON:
default:
resultFile = new File(resultFile.getAbsolutePath() + ".json");
strResultFormat = "json";
}
try {
File batFile = new File(libsFolder, "d2rq/d2r-query" + (GryphonUtil.isWindows() ? ".bat" : ""));
CommandUtil.executeCommand("\"%s\" -f %s -t 9999 --verbose \"%s\" \"%s\" > \"%s\"",
batFile.getAbsolutePath(),
strResultFormat,
mapFile.getAbsolutePath(),
strQuery.replaceAll("\n", " "),
resultFile.getAbsoluteFile());
} catch (Exception e) {
GryphonUtil.logError(e);
}
}
public static File getAlignFolder() {
return alignFolder;
}
public static File getMapFolder() {
return mapFolder;
}
public static File getResultFolder() {
return resultFolder;
}
public static File getLibsFolder() {
return libsFolder;
}
public static Ontology getGlobalOntology() {
return globalOntology;
}
public static void setGlobalOntology(Ontology globalOntology) {
Gryphon.globalOntology = globalOntology;
}
public static List<Ontology> getLocalOntologies() {
return localOntologies;
}
public static void addLocalOntology(Ontology ont){
localOntologies.add(ont);
}
public static void removeLocalOntology(String name){
for(Iterator<Ontology> i = localOntologies.iterator(); i.hasNext(); ){
if(i.next().getName().equals(name)){
i.remove();
break;
}
}
}
public static void removeLocalOntology(int index){
localOntologies.remove(index);
}
public static List<Database> getLocalDatabases() {
return localDatabases;
}
public static void addLocalDatabase(Database db){
localDatabases.add(db);
}
public static void removeLocalDatabase(String dbName){
for(Iterator<Database> i = localDatabases.iterator(); i.hasNext(); ){
if(i.next().getDbName().equals(dbName)){
i.remove();
break;
}
}
}
public static void removeLocalDatabase(int index){
localDatabases.remove(index);
}
} | {
"content_hash": "218396b9b7656c9995d23b2d2d632f6d",
"timestamp": "",
"source": "github",
"line_count": 353,
"max_line_length": 294,
"avg_line_length": 32.12747875354108,
"alnum_prop": 0.693765981835817,
"repo_name": "eudesf/GryphonFramework",
"id": "90e8895e46672ecace6fff3da480a253a0cb2552",
"size": "11342",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/br/ufpe/cin/aac3/gryphon/Gryphon.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "709"
},
{
"name": "Java",
"bytes": "36246"
},
{
"name": "Shell",
"bytes": "896"
},
{
"name": "Web Ontology Language",
"bytes": "102351524"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="ja">
<head>
<title>距離測定 - Yahoo! JavaScriptマップAPI</title>
<meta charset="utf-8">
</head>
<body>
<h1>距離測定</h1>
<div style="width:640px; height:480px; position:relative; margin:8px;">
<div id="map" style="width:640px; height:480px;"></div>
<canvas id="canvas" width="640" height="480" style="position:absolute; top:0px; left:0px; width:640px; height:480px; z-index:2; display:none;"></canvas>
<div id="result" style="position:absolute; top:8px; left:8px; font-size:24pt; font-weight:bold; display:none;"></div>
<button id="measure" style="position:absolute; top:8px; right:8px; z-index:3; display:none;">start measuring</button>
</div>
<p>
<!-- Begin Yahoo! JAPAN Web Services Attribution Snippet -->
<a href="http://developer.yahoo.co.jp/about">
<img src="http://i.yimg.jp/images/yjdn/yjdn_attbtn2_105_17.gif" width="105" height="17" title="Webサービス by Yahoo! JAPAN" alt="Webサービス by Yahoo! JAPAN" style="border:0; margin:15px 15px 15px 15px;"></a>
<!-- End Yahoo! JAPAN Web Services Attribution Snippet -->
</p>
<script src="http://js.api.olp.yahooapis.jp/OpenLocalPlatform/V1/jsapi?appid=YourApplicationId"></script>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
$(document).ready(function($){
var map = new Y.Map("map", {configure:{scrollWheelZoom:true}}),
canvas = $('#canvas'),
ctx = canvas[0].getContext('2d'),
result = $('#result'),
button = $('#measure'),
isDrawMode = false,
isDrawing = false,
prev = null,
prevll = null,
distance = 0;
ctx.strokeStyle = 'rgba(0,128,255,1.0)';
ctx.lineWidth = 4;
ctx.lineCap = 'round';
ctx.lineJoin = 'round';
canvas.bind("mousedown", function(e){
ctx.clearRect(0, 0, canvas.width(), canvas.height());
prev = {x:e.offsetX, y:e.offsetY};
prevll = map.fromContainerPixelToLatLng(prev);
distance = 0;
result.empty();
isDrawing = true;
return false;
});
canvas.bind("mousemove", function(e){
if(isDrawing){
var current = {x:e.offsetX, y:e.offsetY},
currentll = map.fromContainerPixelToLatLng(current);
ctx.beginPath();
ctx.moveTo(prev.x, prev.y);
ctx.lineTo(current.x, current.y);
ctx.stroke();
ctx.closePath();
distance += prevll.distance(currentll);
result.html(distance >= 1.0 ? Math.floor(distance * 10) / 10 + 'km' : Math.floor(distance * 1000) + 'm');
prev = current;
prevll = currentll;
}
});
$(document).bind("mouseup", function(e){
if(isDrawing) {
isDrawing = false;
}
});
button.bind("click", function(){
if(isDrawMode){
canvas.hide();
result.hide();
button.html('start measuring');
isDrawMode = false;
}
else{
ctx.clearRect(0, 0, canvas.width(), canvas.height());
canvas.show();
result.empty();
result.show();
button.html('stop');
isDrawMode = true;
}
}).show();
map.drawMap(new Y.LatLng(35.691052, 139.701258), 16, Y.LayerSetId.NORMAL);
});
</script>
</body>
</html>
| {
"content_hash": "f0cc879f68c3f43f977e051d2b54f27e",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 200,
"avg_line_length": 34.5625,
"alnum_prop": 0.5795660036166366,
"repo_name": "yahoojapan/yolp-jsapi-samples",
"id": "aea1df6db4d6a26d801b89f421c325e83c4a3873",
"size": "3528",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "webapp-measure-distance/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "76184"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
Hooker's J. Bot. Kew Gard. Misc. 1:241. 1849
#### Original name
null
### Remarks
null | {
"content_hash": "0c659c6aa8642b932a85e0bfc3c4fc49",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 44,
"avg_line_length": 12.76923076923077,
"alnum_prop": 0.6927710843373494,
"repo_name": "mdoering/backbone",
"id": "8b89a78c2c83ff12c9cb2cc0c9377a3d5f3aa198",
"size": "224",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Ranunculales/Ranunculaceae/Clematis/Clematis parviloba/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Class ListeningPointsOfInterestProximityProbe
| Sensus Documentation </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Class ListeningPointsOfInterestProximityProbe
| Sensus Documentation ">
<meta name="generator" content="docfx 2.31.0.0">
<link rel="shortcut icon" href="../images/favicon.ico">
<link rel="stylesheet" href="../styles/docfx.vendor.css">
<link rel="stylesheet" href="../styles/docfx.css">
<link rel="stylesheet" href="../styles/main.css">
<meta property="docfx:navrel" content="../toc.html">
<meta property="docfx:tocrel" content="toc.html">
<meta property="docfx:rel" content="../">
</head>
<body data-spy="scroll" data-target="#affix">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<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 id="logo" class="svg" src="../images/group-of-members-users-icon.png" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search" id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</div>
</div>
</header>
<div class="container body-content">
<div id="search-results">
<div class="search-list"></div>
<div class="sr-items"></div>
<ul id="pagination"></ul>
</div>
</div>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe">
<h1 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe" class="text-break">Class ListeningPointsOfInterestProximityProbe
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>
<div class="inheritance">
<h5>Inheritance</h5>
<div class="level0"><span class="xref">System.Object</span></div>
<div class="level1"><a class="xref" href="Sensus.Probes.Probe.html">Probe</a></div>
<div class="level2"><a class="xref" href="Sensus.Probes.ListeningProbe.html">ListeningProbe</a></div>
<div class="level3"><span class="xref">ListeningPointsOfInterestProximityProbe</span></div>
</div>
<div classs="implements">
<h5>Implements</h5>
<div><span class="xref">System.ComponentModel.INotifyPropertyChanged</span></div>
<div><a class="xref" href="Sensus.Probes.Location.IPointsOfInterestProximityProbe.html">IPointsOfInterestProximityProbe</a></div>
</div>
<div class="inheritedMembers">
<h5>Inherited Members</h5>
<div>
<a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_InternalStart">ListeningProbe.InternalStart()</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_Stop">ListeningProbe.Stop()</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_StoreDatumAsync_Sensus_Datum_System_Nullable_System_Threading_CancellationToken__">ListeningProbe.StoreDatumAsync(Datum, Nullable<CancellationToken>)</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_Reset">ListeningProbe.Reset()</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_MaxDataStoresPerSecond">ListeningProbe.MaxDataStoresPerSecond</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_MinDataStoreDelay">ListeningProbe.MinDataStoreDelay</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_KeepDeviceAwake">ListeningProbe.KeepDeviceAwake</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_RawParticipation">ListeningProbe.RawParticipation</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_CollectionDescription">ListeningProbe.CollectionDescription</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_GetAll">Probe.GetAll()</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_GetParticipation">Probe.GetParticipation()</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_StartAsync">Probe.StartAsync()</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_Start">Probe.Start()</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_StopAsync">Probe.StopAsync()</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_Restart">Probe.Restart()</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_TestHealth_System_Collections_Generic_List_System_Tuple_System_String_System_Collections_Generic_Dictionary_System_String_System_String_____">Probe.TestHealth(List<Tuple<String, Dictionary<String, String>>>)</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_GetChart">Probe.GetChart()</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_Enabled">Probe.Enabled</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_OriginallyEnabled">Probe.OriginallyEnabled</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_Running">Probe.Running</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_MostRecentStoreTimestamp">Probe.MostRecentStoreTimestamp</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_Protocol">Probe.Protocol</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_StoreData">Probe.StoreData</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_StartStopTimes">Probe.StartStopTimes</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_SuccessfulHealthTestTimes">Probe.SuccessfulHealthTestTimes</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_MaxChartDataCount">Probe.MaxChartDataCount</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_Caption">Probe.Caption</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_SubCaption">Probe.SubCaption</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_MostRecentDatumChanged">Probe.MostRecentDatumChanged</a>
</div>
<div>
<a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_PropertyChanged">Probe.PropertyChanged</a>
</div>
</div>
<h6><strong>Namespace</strong>: <a class="xref" href="Sensus.Probes.Location.html">Sensus.Probes.Location</a></h6>
<h6><strong>Assembly</strong>: SensusAndroid.dll</h6>
<h5 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class ListeningPointsOfInterestProximityProbe : ListeningProbe, INotifyPropertyChanged, IPointsOfInterestProximityProbe</code></pre>
</div>
<h3 id="constructors">Constructors
</h3>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe__ctor_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.#ctor*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe__ctor" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.#ctor">ListeningPointsOfInterestProximityProbe()</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public ListeningPointsOfInterestProximityProbe()</code></pre>
</div>
<h3 id="properties">Properties
</h3>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_DatumType_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.DatumType*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_DatumType" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.DatumType">DatumType</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public override Type DatumType { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Type</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="overrides">Overrides</h5>
<div><a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_DatumType">Probe.DatumType</a></div>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_DefaultKeepDeviceAwake_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.DefaultKeepDeviceAwake*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_DefaultKeepDeviceAwake" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.DefaultKeepDeviceAwake">DefaultKeepDeviceAwake</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected override bool DefaultKeepDeviceAwake { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="overrides">Overrides</h5>
<div><a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_DefaultKeepDeviceAwake">ListeningProbe.DefaultKeepDeviceAwake</a></div>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_DeviceAsleepWarning_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.DeviceAsleepWarning*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_DeviceAsleepWarning" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.DeviceAsleepWarning">DeviceAsleepWarning</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected override string DeviceAsleepWarning { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="overrides">Overrides</h5>
<div><a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_DeviceAsleepWarning">ListeningProbe.DeviceAsleepWarning</a></div>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_DeviceAwakeWarning_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.DeviceAwakeWarning*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_DeviceAwakeWarning" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.DeviceAwakeWarning">DeviceAwakeWarning</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected override string DeviceAwakeWarning { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="overrides">Overrides</h5>
<div><a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_DeviceAwakeWarning">ListeningProbe.DeviceAwakeWarning</a></div>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_DisplayName_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.DisplayName*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_DisplayName" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.DisplayName">DisplayName</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public override sealed string DisplayName { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="overrides">Overrides</h5>
<div><a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_DisplayName">Probe.DisplayName</a></div>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_Triggers_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.Triggers*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_Triggers" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.Triggers">Triggers</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public ObservableCollection<PointOfInterestProximityTrigger> Triggers { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Collections.ObjectModel.ObservableCollection</span><<a class="xref" href="Sensus.Probes.Location.PointOfInterestProximityTrigger.html">PointOfInterestProximityTrigger</a>></td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="methods">Methods
</h3>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_GetChartDataPointFromDatum_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.GetChartDataPointFromDatum*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_GetChartDataPointFromDatum_Sensus_Datum_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.GetChartDataPointFromDatum(Sensus.Datum)">GetChartDataPointFromDatum(Datum)</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected override ChartDataPoint GetChartDataPointFromDatum(Datum datum)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Sensus.Datum.html">Datum</a></td>
<td><span class="parametername">datum</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">Syncfusion.SfChart.XForms.ChartDataPoint</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="overrides">Overrides</h5>
<div><a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_GetChartDataPointFromDatum_Sensus_Datum_">Probe.GetChartDataPointFromDatum(Datum)</a></div>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_GetChartPrimaryAxis_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.GetChartPrimaryAxis*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_GetChartPrimaryAxis" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.GetChartPrimaryAxis">GetChartPrimaryAxis()</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected override ChartAxis GetChartPrimaryAxis()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">Syncfusion.SfChart.XForms.ChartAxis</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="overrides">Overrides</h5>
<div><a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_GetChartPrimaryAxis">Probe.GetChartPrimaryAxis()</a></div>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_GetChartSecondaryAxis_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.GetChartSecondaryAxis*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_GetChartSecondaryAxis" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.GetChartSecondaryAxis">GetChartSecondaryAxis()</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected override RangeAxisBase GetChartSecondaryAxis()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">Syncfusion.SfChart.XForms.RangeAxisBase</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="overrides">Overrides</h5>
<div><a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_GetChartSecondaryAxis">Probe.GetChartSecondaryAxis()</a></div>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_GetChartSeries_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.GetChartSeries*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_GetChartSeries" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.GetChartSeries">GetChartSeries()</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected override ChartSeries GetChartSeries()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">Syncfusion.SfChart.XForms.ChartSeries</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="overrides">Overrides</h5>
<div><a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_GetChartSeries">Probe.GetChartSeries()</a></div>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_Initialize_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.Initialize*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_Initialize" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.Initialize">Initialize()</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected override void Initialize()</code></pre>
</div>
<h5 class="overrides">Overrides</h5>
<div><a class="xref" href="Sensus.Probes.Probe.html#Sensus_Probes_Probe_Initialize">Probe.Initialize()</a></div>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_StartListening_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.StartListening*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_StartListening" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.StartListening">StartListening()</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected override sealed void StartListening()</code></pre>
</div>
<h5 class="overrides">Overrides</h5>
<div><a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_StartListening">ListeningProbe.StartListening()</a></div>
<a id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_StopListening_" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.StopListening*"></a>
<h4 id="Sensus_Probes_Location_ListeningPointsOfInterestProximityProbe_StopListening" data-uid="Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.StopListening">StopListening()</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">protected override sealed void StopListening()</code></pre>
</div>
<h5 class="overrides">Overrides</h5>
<div><a class="xref" href="Sensus.Probes.ListeningProbe.html#Sensus_Probes_ListeningProbe_StopListening">ListeningProbe.StopListening()</a></div>
<h3 id="implements">Implements</h3>
<div>
<span class="xref">System.ComponentModel.INotifyPropertyChanged</span>
</div>
<div>
<a class="xref" href="Sensus.Probes.Location.IPointsOfInterestProximityProbe.html">IPointsOfInterestProximityProbe</a>
</div>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
Copyright © 2014-2018 University of Virginia<br>Generated by <strong>DocFX</strong>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
<script type="text/javascript" src="../styles/docfx.js"></script>
<script type="text/javascript" src="../styles/main.js"></script>
</body>
</html>
| {
"content_hash": "40b174ce676c4f58450a24c093d337a2",
"timestamp": "",
"source": "github",
"line_count": 576,
"max_line_length": 302,
"avg_line_length": 47.333333333333336,
"alnum_prop": 0.6730853873239436,
"repo_name": "jtb8vm/sensus",
"id": "8a7d9451fec5597df67dd4ffdb612824d8afb91a",
"size": "27267",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "docs/api/Sensus.Probes.Location.ListeningPointsOfInterestProximityProbe.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "1590103"
},
{
"name": "CSS",
"bytes": "8753"
},
{
"name": "HTML",
"bytes": "98260"
},
{
"name": "JavaScript",
"bytes": "21583"
},
{
"name": "PHP",
"bytes": "9424778"
},
{
"name": "R",
"bytes": "27436"
},
{
"name": "Shell",
"bytes": "15478"
}
],
"symlink_target": ""
} |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= preg_replace('@/+$@','',dirname($_SERVER['SCRIPT_NAME'])).'/';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string. The default setting of 'REQUEST_URI' works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/urls.html
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| https://codeigniter.com/user_guide/general/core_classes.html
| https://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = FALSE;
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
| array(2) = Debug Messages, without Error Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ directory. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
/*
|--------------------------------------------------------------------------
| Log File Extension
|--------------------------------------------------------------------------
|
| The default filename extension for log files. The default 'php' allows for
| protecting the log files via basic scripting, when they are to be stored
| under a publicly accessible directory.
|
| Note: Leaving it blank will default to 'php'.
|
*/
$config['log_file_extension'] = '';
/*
|--------------------------------------------------------------------------
| Log File Permissions
|--------------------------------------------------------------------------
|
| The file system permissions to be applied on newly created log files.
|
| IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
| integer notation (i.e. 0700, 0644, etc.)
*/
$config['log_file_permissions'] = 0644;
/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
/*
|--------------------------------------------------------------------------
| Error Views Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/views/errors/ directory. Use a full server path with trailing slash.
|
*/
$config['error_views_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/cache/ directory. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Include Query String
|--------------------------------------------------------------------------
|
| Whether to take the URL query string into consideration when generating
| output cache files. Valid options are:
|
| FALSE = Disabled
| TRUE = Enabled, take all query parameters into account.
| Please be aware that this may result in numerous cache
| files generated for the same page over and over again.
| array('q') = Enabled, but only take into account the specified list
| of query parameters.
|
*/
$config['cache_query_string'] = FALSE;
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class, you must set an encryption key.
| See the user guide for more info.
|
| https://codeigniter.com/user_guide/libraries/encryption.html
|
*/
$config['encryption_key'] = '';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_driver'
|
| The storage driver to use: files, database, redis, memcached
|
| 'sess_cookie_name'
|
| The session cookie name, must contain only [0-9a-z_-] characters
|
| 'sess_expiration'
|
| The number of SECONDS you want the session to last.
| Setting to 0 (zero) means expire when the browser is closed.
|
| 'sess_save_path'
|
| The location to save sessions to, driver dependent.
|
| For the 'files' driver, it's a path to a writable directory.
| WARNING: Only absolute paths are supported!
|
| For the 'database' driver, it's a table name.
| Please read up the manual for the format with other session drivers.
|
| IMPORTANT: You are REQUIRED to set a valid save path!
|
| 'sess_match_ip'
|
| Whether to match the user's IP address when reading the session data.
|
| WARNING: If you're using the database driver, don't forget to update
| your session table's PRIMARY KEY when changing this setting.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_regenerate_destroy'
|
| Whether to destroy session data associated with the old session ID
| when auto-regenerating the session ID. When set to FALSE, the data
| will be later deleted by the garbage collector.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
| Note: These settings (with the exception of 'cookie_prefix' and
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
/*
|--------------------------------------------------------------------------
| Standardize newlines
|--------------------------------------------------------------------------
|
| Determines whether to standardize newline characters in input data,
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
| This is particularly useful for portability between UNIX-based OSes,
| (usually \n) and Windows (\r\n).
|
*/
$config['standardize_newlines'] = FALSE;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['global_xss_filtering'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
| 'csrf_regenerate' = Regenerate token on every submission
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads. When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| Only used if zlib.output_compression is turned off in your php.ini.
| Please do not use it together with httpd-level output compression.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or any PHP supported timezone. This preference tells
| the system whether to use your server's local time as the master 'now'
| reference, or convert it to the configured one timezone. See the 'date
| helper' page of the user guide for information regarding date handling.
|
*/
$config['time_reference'] = 'local';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
| Note: You need to have eval() enabled for this to work.
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy
| IP addresses from which CodeIgniter should trust headers such as
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
| the visitor's IP address.
|
| You can use both an array or a comma-separated list of proxy addresses,
| as well as specifying whole subnets. Here are a few examples:
|
| Comma-separated: '10.0.1.200,192.168.5.0/24'
| Array: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';
| {
"content_hash": "825ae5128e1ab623cb0a541e84272fbf",
"timestamp": "",
"source": "github",
"line_count": 515,
"max_line_length": 99,
"avg_line_length": 35.592233009708735,
"alnum_prop": 0.54506273867976,
"repo_name": "saurabhthink07/VitoWeb",
"id": "cf4d59e3c85c63ffea4b6e54cb6c9be91626b935",
"size": "18330",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/config/config.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "364"
},
{
"name": "CSS",
"bytes": "395353"
},
{
"name": "HTML",
"bytes": "5633"
},
{
"name": "JavaScript",
"bytes": "619149"
},
{
"name": "PHP",
"bytes": "1834929"
}
],
"symlink_target": ""
} |
from conf import settings
from core import accounts
from core import logger
#transaction logger
def make_transaction(log_obj,account_data,tran_type,amount,**others):
'''
deal all the user transactions
:param account_data: user account data
:param tran_type: transaction type
:param amount: transaction amount
:param others: mainly for logging usage
:return:
'''
amount = float(amount)
if tran_type in settings.TRANSACTION_TYPE:
interest = amount * settings.TRANSACTION_TYPE[tran_type]['interest']
old_balance = account_data['balance']
if settings.TRANSACTION_TYPE[tran_type]['action'] == 'plus':
new_balance = old_balance + amount + interest
elif settings.TRANSACTION_TYPE[tran_type]['action'] == 'minus':
new_balance = old_balance - amount - interest
#check credit
if new_balance <0:
print('''\033[31;1mYour credit [%s] is not enough for this transaction [-%s], your current balance is
[%s]''' %(account_data['credit'],(amount + interest), old_balance ))
return
account_data['balance'] = new_balance
accounts.dump_account(account_data) #save the new balance back to file
log_obj.info("account:%s action:%s amount:%s interest:%s" %
(account_data['id'], tran_type, amount,interest) )
return account_data
else:
print("\033[31;1mTransaction type [%s] is not exist!\033[0m" % tran_type)
| {
"content_hash": "c0f5e401dfc05a9d189bc767826801fa",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 117,
"avg_line_length": 42.611111111111114,
"alnum_prop": 0.622555410691004,
"repo_name": "dianshen/python_day",
"id": "1144e04a82ae3f3a2ca6d00601b65757ec5d1cbb",
"size": "1578",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "day5-atm 2/alex_atm/core/transaction.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2505"
},
{
"name": "HTML",
"bytes": "74003"
},
{
"name": "JavaScript",
"bytes": "484"
},
{
"name": "Python",
"bytes": "317154"
}
],
"symlink_target": ""
} |
// minimal template polyfill
(function() {
'use strict';
var needsTemplate = (typeof HTMLTemplateElement === 'undefined');
var brokenDocFragment = !(document.createDocumentFragment().cloneNode() instanceof DocumentFragment);
var needsDocFrag = false;
// NOTE: Replace DocumentFragment to work around IE11 bug that
// casues children of a document fragment modified while
// there is a mutation observer to not have a parentNode, or
// have a broken parentNode (!?!)
if (/Trident/.test(navigator.userAgent)) {
(function() {
needsDocFrag = true;
var origCloneNode = Node.prototype.cloneNode;
Node.prototype.cloneNode = function cloneNode(deep) {
var newDom = origCloneNode.call(this, deep);
if (this instanceof DocumentFragment) {
newDom.__proto__ = DocumentFragment.prototype;
}
return newDom;
};
// IE's DocumentFragment querySelector code doesn't work when
// called on an element instance
DocumentFragment.prototype.querySelectorAll = HTMLElement.prototype.querySelectorAll;
DocumentFragment.prototype.querySelector = HTMLElement.prototype.querySelector;
Object.defineProperties(DocumentFragment.prototype, {
'nodeType': {
get: function () {
return Node.DOCUMENT_FRAGMENT_NODE;
},
configurable: true
},
'localName': {
get: function () {
return undefined;
},
configurable: true
},
'nodeName': {
get: function () {
return '#document-fragment';
},
configurable: true
}
});
var origInsertBefore = Node.prototype.insertBefore;
function insertBefore(newNode, refNode) {
if (newNode instanceof DocumentFragment) {
var child;
while ((child = newNode.firstChild)) {
origInsertBefore.call(this, child, refNode);
}
} else {
origInsertBefore.call(this, newNode, refNode);
}
return newNode;
}
Node.prototype.insertBefore = insertBefore;
var origAppendChild = Node.prototype.appendChild;
Node.prototype.appendChild = function appendChild(child) {
if (child instanceof DocumentFragment) {
insertBefore.call(this, child, null);
} else {
origAppendChild.call(this, child);
}
return child;
};
var origRemoveChild = Node.prototype.removeChild;
var origReplaceChild = Node.prototype.replaceChild;
Node.prototype.replaceChild = function replaceChild(newChild, oldChild) {
if (newChild instanceof DocumentFragment) {
insertBefore.call(this, newChild, oldChild);
origRemoveChild.call(this, oldChild);
} else {
origReplaceChild.call(this, newChild, oldChild);
}
return oldChild;
};
Document.prototype.createDocumentFragment = function createDocumentFragment() {
var frag = this.createElement('df');
frag.__proto__ = DocumentFragment.prototype;
return frag;
};
var origImportNode = Document.prototype.importNode;
Document.prototype.importNode = function importNode(impNode, deep) {
deep = deep || false;
var newNode = origImportNode.call(this, impNode, deep);
if (impNode instanceof DocumentFragment) {
newNode.__proto__ = DocumentFragment.prototype;
}
return newNode;
};
})();
}
// NOTE: we rely on this cloneNode not causing element upgrade.
// This means this polyfill must load before the CE polyfill and
// this would need to be re-worked if a browser supports native CE
// but not <template>.
var capturedCloneNode = Node.prototype.cloneNode;
var capturedCreateElement = Document.prototype.createElement;
var capturedImportNode = Document.prototype.importNode;
var capturedRemoveChild = Node.prototype.removeChild;
var capturedAppendChild = Node.prototype.appendChild;
var capturedReplaceChild = Node.prototype.replaceChild;
var elementQuerySelectorAll = Element.prototype.querySelectorAll;
var docQuerySelectorAll = Document.prototype.querySelectorAll;
var fragQuerySelectorAll = DocumentFragment.prototype.querySelectorAll;
function QSA(node, selector) {
switch (node.nodeType) {
case Node.DOCUMENT_NODE:
return docQuerySelectorAll.call(node, selector);
case Node.DOCUMENT_FRAGMENT_NODE:
return fragQuerySelectorAll.call(node, selector);
default:
return elementQuerySelectorAll.call(node, selector);
}
}
// returns true if nested templates cannot be cloned (they cannot be on
// some impl's like Safari 8 and Edge)
// OR if cloning a document fragment does not result in a document fragment
var needsCloning = (function() {
if (!needsTemplate) {
var t = document.createElement('template');
var t2 = document.createElement('template');
t2.content.appendChild(document.createElement('div'));
t.content.appendChild(t2);
var clone = t.cloneNode(true);
return (clone.content.childNodes.length === 0 || clone.content.firstChild.content.childNodes.length === 0
|| brokenDocFragment);
}
})();
var TEMPLATE_TAG = 'template';
var PolyfilledHTMLTemplateElement = function() {};
if (needsTemplate) {
var contentDoc = document.implementation.createHTMLDocument('template');
var canDecorate = true;
var templateStyle = document.createElement('style');
templateStyle.textContent = TEMPLATE_TAG + '{display:none;}';
var head = document.head;
head.insertBefore(templateStyle, head.firstElementChild);
/**
Provides a minimal shim for the <template> element.
*/
PolyfilledHTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
// if elements do not have `innerHTML` on instances, then
// templates can be patched by swizzling their prototypes.
var canProtoPatch =
!(document.createElement('div').hasOwnProperty('innerHTML'));
/**
The `decorate` method moves element children to the template's `content`.
NOTE: there is no support for dynamically adding elements to templates.
*/
PolyfilledHTMLTemplateElement.decorate = function(template) {
// if the template is decorated, return fast
if (template.content) {
return;
}
template.content = contentDoc.createDocumentFragment();
var child;
while ((child = template.firstChild)) {
capturedAppendChild.call(template.content, child);
}
// NOTE: prefer prototype patching for performance and
// because on some browsers (IE11), re-defining `innerHTML`
// can result in intermittent errors.
if (canProtoPatch) {
template.__proto__ = PolyfilledHTMLTemplateElement.prototype;
} else {
template.cloneNode = function(deep) {
return PolyfilledHTMLTemplateElement._cloneNode(this, deep);
};
// add innerHTML to template, if possible
// Note: this throws on Safari 7
if (canDecorate) {
try {
defineInnerHTML(template);
defineOuterHTML(template);
} catch (err) {
canDecorate = false;
}
}
}
// bootstrap recursively
PolyfilledHTMLTemplateElement.bootstrap(template.content);
};
var defineInnerHTML = function defineInnerHTML(obj) {
Object.defineProperty(obj, 'innerHTML', {
get: function() {
var o = '';
for (var e = this.content.firstChild; e; e = e.nextSibling) {
o += e.outerHTML || escapeData(e.data);
}
return o;
},
set: function(text) {
contentDoc.body.innerHTML = text;
PolyfilledHTMLTemplateElement.bootstrap(contentDoc);
while (this.content.firstChild) {
capturedRemoveChild.call(this.content, this.content.firstChild);
}
while (contentDoc.body.firstChild) {
capturedAppendChild.call(this.content, contentDoc.body.firstChild);
}
},
configurable: true
});
};
var defineOuterHTML = function defineOuterHTML(obj) {
Object.defineProperty(obj, 'outerHTML', {
get: function() {
return '<' + TEMPLATE_TAG + '>' + this.innerHTML + '</' + TEMPLATE_TAG + '>';
},
set: function(innerHTML) {
if (this.parentNode) {
contentDoc.body.innerHTML = innerHTML;
var docFrag = this.ownerDocument.createDocumentFragment();
while (contentDoc.body.firstChild) {
capturedAppendChild.call(docFrag, contentDoc.body.firstChild);
}
capturedReplaceChild.call(this.parentNode, docFrag, this);
} else {
throw new Error("Failed to set the 'outerHTML' property on 'Element': This element has no parent node.");
}
},
configurable: true
});
};
defineInnerHTML(PolyfilledHTMLTemplateElement.prototype);
defineOuterHTML(PolyfilledHTMLTemplateElement.prototype);
/**
The `bootstrap` method is called automatically and "fixes" all
<template> elements in the document referenced by the `doc` argument.
*/
PolyfilledHTMLTemplateElement.bootstrap = function bootstrap(doc) {
var templates = QSA(doc, TEMPLATE_TAG);
for (var i=0, l=templates.length, t; (i<l) && (t=templates[i]); i++) {
PolyfilledHTMLTemplateElement.decorate(t);
}
};
// auto-bootstrapping for main document
document.addEventListener('DOMContentLoaded', function() {
PolyfilledHTMLTemplateElement.bootstrap(document);
});
// Patch document.createElement to ensure newly created templates have content
Document.prototype.createElement = function createElement() {
var el = capturedCreateElement.apply(this, arguments);
if (el.localName === 'template') {
PolyfilledHTMLTemplateElement.decorate(el);
}
return el;
};
var escapeDataRegExp = /[&\u00A0<>]/g;
var escapeReplace = function escapeReplace(c) {
switch (c) {
case '&':
return '&';
case '<':
return '<';
case '>':
return '>';
case '\u00A0':
return ' ';
}
};
var escapeData = function escapeData(s) {
return s.replace(escapeDataRegExp, escapeReplace);
};
}
// make cloning/importing work!
if (needsTemplate || needsCloning) {
PolyfilledHTMLTemplateElement._cloneNode = function _cloneNode(template, deep) {
var clone = capturedCloneNode.call(template, false);
// NOTE: decorate doesn't auto-fix children because they are already
// decorated so they need special clone fixup.
if (this.decorate) {
this.decorate(clone);
}
if (deep) {
// NOTE: use native clone node to make sure CE's wrapped
// cloneNode does not cause elements to upgrade.
capturedAppendChild.call(clone.content, capturedCloneNode.call(template.content, true));
// now ensure nested templates are cloned correctly.
fixClonedDom(clone.content, template.content);
}
return clone;
};
// Given a source and cloned subtree, find <template>'s in the cloned
// subtree and replace them with cloned <template>'s from source.
// We must do this because only the source templates have proper .content.
var fixClonedDom = function fixClonedDom(clone, source) {
// do nothing if cloned node is not an element
if (!source.querySelectorAll) return;
// these two lists should be coincident
var s$ = QSA(source, TEMPLATE_TAG);
if (s$.length === 0) {
return;
}
var t$ = QSA(clone, TEMPLATE_TAG);
for (var i=0, l=t$.length, t, s; i<l; i++) {
s = s$[i];
t = t$[i];
if (PolyfilledHTMLTemplateElement && PolyfilledHTMLTemplateElement.decorate) {
PolyfilledHTMLTemplateElement.decorate(s);
}
capturedReplaceChild.call(t.parentNode, cloneNode.call(s, true), t);
}
};
// override all cloning to fix the cloned subtree to contain properly
// cloned templates.
var cloneNode = Node.prototype.cloneNode = function cloneNode(deep) {
var dom;
// workaround for Edge bug cloning documentFragments
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8619646/
if (!needsDocFrag && brokenDocFragment && this instanceof DocumentFragment) {
if (!deep) {
return this.ownerDocument.createDocumentFragment();
} else {
dom = importNode.call(this.ownerDocument, this, true);
}
} else if (this.nodeType === Node.ELEMENT_NODE && this.localName === TEMPLATE_TAG) {
dom = PolyfilledHTMLTemplateElement._cloneNode(this, deep);
} else {
dom = capturedCloneNode.call(this, deep);
}
// template.content is cloned iff `deep`.
if (deep) {
fixClonedDom(dom, this);
}
return dom;
};
// NOTE: we are cloning instead of importing <template>'s.
// However, the ownerDocument of the cloned template will be correct!
// This is because the native import node creates the right document owned
// subtree and `fixClonedDom` inserts cloned templates into this subtree,
// thus updating the owner doc.
var importNode = Document.prototype.importNode = function importNode(element, deep) {
deep = deep || false;
if (element.localName === TEMPLATE_TAG) {
return PolyfilledHTMLTemplateElement._cloneNode(element, deep);
} else {
var dom = capturedImportNode.call(this, element, deep);
if (deep) {
fixClonedDom(dom, element);
}
return dom;
}
};
}
if (needsTemplate) {
window.HTMLTemplateElement = PolyfilledHTMLTemplateElement;
}
})();
| {
"content_hash": "e4947e1fb5effa013fd8db3e82812207",
"timestamp": "",
"source": "github",
"line_count": 396,
"max_line_length": 117,
"avg_line_length": 35.553030303030305,
"alnum_prop": 0.6393209745010299,
"repo_name": "linzjs/linz",
"id": "0ddf2cd6f8dba76b11ba4d7a05e41159a85c5f5d",
"size": "14611",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/js/template.polyfill.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7525"
},
{
"name": "Dockerfile",
"bytes": "740"
},
{
"name": "HTML",
"bytes": "10006"
},
{
"name": "Handlebars",
"bytes": "857"
},
{
"name": "JavaScript",
"bytes": "824722"
},
{
"name": "Less",
"bytes": "25077"
},
{
"name": "Pug",
"bytes": "43126"
},
{
"name": "Shell",
"bytes": "49191"
}
],
"symlink_target": ""
} |
<div class="next-ge15-widget">
<link href="http://{{context.host}}{{ asset("css/pages/ftcom.css") }}" rel="stylesheet">
{# override ft.com widget styles #}
<style>
.ge15-ftcom-figures { width: 100%; }
</style>
{% if stateOfPlay %}
<div class="ge15-ftcom-figures">
<div class="figure-wrapper figure-wrapper--state-of-play--js">
<aside class="state-of-play--js">
{% include './state-of-play.html' with stateOfPlay only ignore missing %}
</aside>
</div>
</div>
{% endif %}
{# js for refreshing the data #}
<script src="http://{{context.host}}{{ asset("js/next.js") }}"></script>
</div>
| {
"content_hash": "b9c380c0996682d3ebc08f7729dda0b3",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 90,
"avg_line_length": 30.285714285714285,
"alnum_prop": 0.6022012578616353,
"repo_name": "ft-interactive/ge15",
"id": "c3b8f32843dcd6e9080dfdcd4cd6134e4ec479e0",
"size": "636",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "templates/next-fragment.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "55517"
},
{
"name": "HTML",
"bytes": "186342"
},
{
"name": "JavaScript",
"bytes": "251574"
},
{
"name": "Ruby",
"bytes": "319"
}
],
"symlink_target": ""
} |
require 'has_guarded_handlers'
module Adhearsion
class Router
class Route
include HasGuardedHandlers
attr_reader :name, :target, :guards
attr_accessor :controller_metadata
def initialize(name, target = nil, *guards, &block)
@name = name
if block
@target, @guards = block, ([target] + guards)
else
@target, @guards = target, guards
end
@guards.compact!
@controller_metadata = nil
end
def match?(call)
!guarded? guards, call
end
def dispatch(call, callback = nil)
Adhearsion::Events.trigger_immediately :call_routed, call: call, route: self
call_id = call.id # Grab this to use later incase the actor is dead
controller = if target.respond_to?(:call)
CallController.new call, controller_metadata, &target
else
target.new call, controller_metadata
end
call.accept if accepting?
call.execute_controller controller, lambda { |call_actor|
begin
if call_actor.alive? && call_actor.active?
if call_actor.auto_hangup
logger.info "Call #{call_id} routing completed. Hanging up now."
call_actor.hangup
else
logger.info "Call #{call_id} routing completed. Keeping the call alive at controller/router request."
end
else
logger.info "Call #{call_id} routing completed. Call was already hung up."
end
rescue Call::Hangup, Call::ExpiredError
end
callback.call if callback
}
rescue Call::Hangup, Call::ExpiredError
logger.info "Call routing could not be completed because call was unavailable."
end
def evented?
false
end
def accepting?
true
end
def openended?
false
end
def inspect
"#<#{self.class}:#{object_id} name=#{name} target=#{target} guards=#{guards}>"
end
alias :to_s :inspect
end
end
end
| {
"content_hash": "5f059eba822771000ecff19041a4998a",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 117,
"avg_line_length": 27.285714285714285,
"alnum_prop": 0.5768681580199905,
"repo_name": "kares/adhearsion",
"id": "1e85b327f6228e78184a69246119078938308568",
"size": "2120",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "lib/adhearsion/router/route.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "607934"
},
{
"name": "Shell",
"bytes": "280"
}
],
"symlink_target": ""
} |
require 'spec_helper'
require 'toy_robot'
describe Board do
let(:board) { Board.new }
subject { board }
it_should_behave_like "a board"
# #within_boundaries? tested in Robot#place in robot_spec.rb
end | {
"content_hash": "29cc77b913f875d3b79f2a4658de77d5",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 62,
"avg_line_length": 16.384615384615383,
"alnum_prop": 0.6995305164319249,
"repo_name": "paulfioravanti/toy_robot",
"id": "1fe89d0f63d923e37a07a11ef2caaaebbe9e54bd",
"size": "213",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/board_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "96761"
}
],
"symlink_target": ""
} |
namespace EasyCpp
{
namespace Net
{
class DLL_EXPORT JsonRPC
{
public:
typedef std::function<void(const AnyValue&)> response_fn_t;
typedef std::function<void(const AnyValue&, response_fn_t)> rpc_fn_t;
typedef std::function<void(const AnyValue&, bool)> cb_fn_t;
typedef std::function<void(const std::string&)> transmit_fn_t;
JsonRPC();
~JsonRPC();
void registerFunction(const std::string& name, rpc_fn_t fn);
void removeFunction(const std::string& name);
bool hasFunction(const std::string& name) const;
void handleMessage(const std::string& msg);
void callFunction(const std::string& name, const AnyArray& args, cb_fn_t cb);
void callFunction(const std::string& name, const Serialize::Serializable& args, cb_fn_t cb);
Promise<AnyValue> callFunction(const std::string& name, const AnyArray& args);
Promise<AnyValue> callFunction(const std::string& name, const Serialize::Serializable& args);
void sendNotification(const std::string& name, const AnyArray& args);
void sendNotification(const std::string& name, const Serialize::Serializable& args);
void setTransmitCallback(transmit_fn_t fn);
transmit_fn_t getTransmitCallback() const;
void resetCalls(const std::string& reason = "");
class DLL_EXPORT Error
{
private:
int _code;
std::string _message;
AnyValue _data;
AnyValue _reqid;
public:
Error(int code, const std::string& msg = "", AnyValue data = nullptr, AnyValue reqid = nullptr);
int getCode() const;
const std::string& getMessage() const;
AnyValue getData() const;
AnyValue getRequestId() const;
};
private:
std::atomic<uint64_t> _next_id;
std::map<std::string, rpc_fn_t> _functions;
std::map<uint64_t, cb_fn_t> _cb_map;
transmit_fn_t _transmit_fn;
void handleResponse(const Bundle& data);
void callFunction(const std::string& name, AnyValue args, cb_fn_t cb);
void sendNotification(const std::string& name, AnyValue args);
void sendResult(AnyValue id, AnyValue result);
void sendResultError(AnyValue id, Error e);
};
}
}
| {
"content_hash": "c66e449528a9d71ccd37ac7cce5e7626",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 100,
"avg_line_length": 33.66129032258065,
"alnum_prop": 0.6971729755630091,
"repo_name": "Thalhammer/EasyCpp",
"id": "d9182f63d566049328b4feae8f4935f2c1e8bb08",
"size": "2197",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "EasyCpp/Net/JsonRPC.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "351"
},
{
"name": "C++",
"bytes": "677359"
},
{
"name": "Makefile",
"bytes": "5900"
}
],
"symlink_target": ""
} |
<?php
namespace LengthOfRope\JSONLD\Schema;
/**
* The act of planning the execution of an event/task/action/reservation/plan to a future date.
*
* @author LengthOfRope, Bas de Kort <bdekort@gmail.com>
**/
class PlanActionSchema extends OrganizeActionSchema
{
public static function factory()
{
return new PlanActionSchema('http://schema.org/', 'PlanAction');
}
/**
* The time the object is scheduled to.
*
* @param $scheduledTime DateTimeSchema
**/
public function setScheduledTime($scheduledTime) {
$this->properties['scheduledTime'] = $scheduledTime;
return $this;
}
/**
* @return DateTimeSchema
**/
public function getScheduledTime() {
return $this->properties['scheduledTime'];
}
}
| {
"content_hash": "329e2888c2d3413653311cf51c1e9fdb",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 95,
"avg_line_length": 20.973684210526315,
"alnum_prop": 0.64366373902133,
"repo_name": "lengthofrope/create-jsonld",
"id": "e122995c79a794d9953699b7c59164b4a83de491",
"size": "1966",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Schema/PlanActionSchema.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "1690055"
}
],
"symlink_target": ""
} |
package io.cattle.platform.docker.client;
import static org.junit.Assert.*;
import org.junit.Test;
public class DockerImageTest {
private static final String sha = "sha256:88f8d82bc9bc20ff80992cdeeee1dd6d8799cd36797b3653c644943e90b3acdf";
@Test
public void testNoNamespace() {
DockerImage image = DockerImage.parse("ubuntu");
assertEquals("index.docker.io", image.getServer());
assertEquals("ubuntu", image.getFullName());
}
@Test
public void testNoNamespaceWithTag() {
DockerImage image = DockerImage.parse("ubuntu:14.04");
assertEquals("index.docker.io", image.getServer());
assertEquals("ubuntu:14.04", image.getFullName());
}
@Test
public void testNamespace() {
DockerImage image = DockerImage.parse("ibuildthecloud/ubuntu-core");
assertEquals("index.docker.io", image.getServer());
assertEquals("ibuildthecloud/ubuntu-core", image.getFullName());
}
@Test
public void testTag() {
DockerImage image = DockerImage.parse("ibuildthecloud/ubuntu-core:123");
assertEquals("index.docker.io", image.getServer());
assertEquals("ibuildthecloud/ubuntu-core:123", image.getFullName());
}
@Test
public void testUrl() {
DockerImage image = DockerImage.parse("quay.io/ibuildthecloud/ubuntu-core:123");
assertEquals("quay.io", image.getServer());
assertEquals("ibuildthecloud/ubuntu-core:123", image.getFullName());
}
@Test
public void testUrlLatest() {
DockerImage image = DockerImage.parse("quay.io/ibuildthecloud/ubuntu-core");
assertEquals("quay.io", image.getServer());
assertEquals("ibuildthecloud/ubuntu-core", image.getFullName());
}
@Test
public void testUrlTlnNoTag() {
DockerImage image = DockerImage.parse("quay.io/ubuntu-core");
assertEquals("quay.io", image.getServer());
assertEquals("ubuntu-core", image.getFullName());
}
@Test
public void testUrlTln() {
DockerImage image = DockerImage.parse("quay.io/ubuntu-core:123");
assertEquals("quay.io", image.getServer());
assertEquals("ubuntu-core:123", image.getFullName());
}
@Test
public void testLocalHost() {
DockerImage image = DockerImage.parse("localhost:5000/ibuildthecloud/ubuntu-core:123");
assertEquals("localhost:5000", image.getServer());
assertEquals("ibuildthecloud/ubuntu-core:123", image.getFullName());
}
@Test
public void testLocalHostLatest() {
DockerImage image = DockerImage.parse("localhost:5000/ibuildthecloud/ubuntu-core");
assertEquals("localhost:5000", image.getServer());
assertEquals("ibuildthecloud/ubuntu-core", image.getFullName());
}
@Test
public void testLocalHostTln() {
DockerImage image = DockerImage.parse("localhost:5000/ubuntu-core:123");
assertEquals("localhost:5000", image.getServer());
assertEquals("ubuntu-core:123", image.getFullName());
}
@Test
public void testLocalHostTlnNoTag() {
DockerImage image = DockerImage.parse("localhost:5000/ubuntu-core");
assertEquals("localhost:5000", image.getServer());
assertEquals("ubuntu-core", image.getFullName());
}
@Test
public void testLocalHostTlnNoTagNoPort() {
DockerImage image = DockerImage.parse("localhost/ubuntu-core");
assertEquals("localhost", image.getServer());
assertEquals("ubuntu-core", image.getFullName());
}
@Test
public void testMyLocalHostTlnNoTagNoPort() {
DockerImage image = DockerImage.parse("mylocalhost/ubuntu-core");
assertEquals("index.docker.io", image.getServer());
assertEquals("mylocalhost/ubuntu-core", image.getFullName());
}
@Test
public void testMalFormed() {
DockerImage image = DockerImage.parse("foo:port/garbage/stuff/to:much");
assertNull(image);
image = DockerImage.parse("garbage:bar/foo:1:2:3");
assertNull(image);
}
@Test
public void testNoNamespaceWithShaTag() {
DockerImage image = DockerImage.parse("ubuntu@" + sha);
assertEquals("index.docker.io", image.getServer());
assertEquals("ubuntu@" + sha, image.getFullName());
}
@Test
public void testShaTag() {
DockerImage image = DockerImage.parse("ibuildthecloud/ubuntu-core@" + sha);
assertEquals("index.docker.io", image.getServer());
assertEquals("ibuildthecloud/ubuntu-core@" + sha, image.getFullName());
}
@Test
public void testUrlSha() {
DockerImage image = DockerImage.parse("quay.io/ibuildthecloud/ubuntu-core@" + sha);
assertEquals("quay.io", image.getServer());
assertEquals("ibuildthecloud/ubuntu-core@" + sha, image.getFullName());
}
@Test
public void testUrlTlnSha() {
DockerImage image = DockerImage.parse("quay.io/ubuntu-core@" + sha);
assertEquals("quay.io", image.getServer());
assertEquals("ubuntu-core@" + sha, image.getFullName());
}
@Test
public void testLocalHostSha() {
DockerImage image = DockerImage.parse("localhost:5000/ibuildthecloud/ubuntu-core@" + sha);
assertEquals("localhost:5000", image.getServer());
assertEquals("ibuildthecloud/ubuntu-core@" + sha, image.getFullName());
}
@Test
public void testLocalHostTlnSha() {
DockerImage image = DockerImage.parse("localhost:5000/ubuntu-core@" + sha);
assertEquals("localhost:5000", image.getServer());
assertEquals("ubuntu-core@" + sha, image.getFullName());
}
@Test
public void testIPServer() {
DockerImage image = DockerImage.parse("127.0.0.1:5000/ubuntu-core@" + sha);
assertEquals("127.0.0.1:5000", image.getServer());
assertEquals("ubuntu-core@" + sha, image.getFullName());
}
}
| {
"content_hash": "50bf927551986ef7ce3145e4e7015867",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 112,
"avg_line_length": 35.7289156626506,
"alnum_prop": 0.656213117518125,
"repo_name": "Cerfoglg/cattle",
"id": "0d15caaa91ae75e614c2da7ab55ea1abd21c9236",
"size": "5931",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "code/implementation/docker/storage/src/test/java/io/cattle/platform/docker/client/DockerImageTest.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5271"
},
{
"name": "FreeMarker",
"bytes": "71"
},
{
"name": "Java",
"bytes": "6398519"
},
{
"name": "Makefile",
"bytes": "308"
},
{
"name": "Python",
"bytes": "1582534"
},
{
"name": "Shell",
"bytes": "41134"
}
],
"symlink_target": ""
} |
<div class="column-1-2 column-center">...</div> | {
"content_hash": "a161e1921efbdae3afbcddc4a813f10c",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 47,
"avg_line_length": 47,
"alnum_prop": 0.6595744680851063,
"repo_name": "joker8999/turret",
"id": "baacbdc86562249108107efda315ff57d9e393ae",
"size": "47",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "docs/samples/column-center.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "289510"
},
{
"name": "HTML",
"bytes": "16357"
},
{
"name": "PHP",
"bytes": "3553"
}
],
"symlink_target": ""
} |
<!-- saved from url=(0014)about:internet --><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<!-- Standard Head Part -->
<head>
<title>NUnit - ThrowsConstraint</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-US">
<link rel="stylesheet" type="text/css" href="nunit.css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<!-- End Standard Head Part -->
<body>
<!-- Standard Header for NUnit.org -->
<div id="header">
<a id="logo" href="http://www.nunit.org"><img src="img/logo.gif" alt="NUnit.org" title="NUnit.org"></a>
<div id="nav">
<a href="http://www.nunit.org">NUnit</a>
<a class="active" href="index.html">Documentation</a>
</div>
</div>
<!-- End of Header -->
<div id="content">
<h2>Throws Constraint (NUnit 2.5)</h2>
<p><b>ThrowsConstraint</b> is used to test that some code, represented as a delegate,
throws a particular exception. It may be used alone, to merely test the type
of constraint, or with an additional constraint to be applied to the exception
specified as an argument.
p>The related <b>ThrowsNothingConstraint</b> simply asserts that the delegate
does not throw an exception.
<h4>Constructors</h4>
<div class="code"><pre>
ThrowsConstraint(Type expectedType)
ThrowsConstraint<T>()
ThrowsConstraint(Type expectedType, Constraint constraint)
ThrowsConstraint<T>(Constraint constraint)
ThrowsNothingConstraint()
</pre></div>
<h4>Syntax</h4>
<div class="code"><pre>
Throws.Exception
Throws.TargetInvocationException
Throws.ArgumentException
Throws.InvalidOperationException
Throws.TypeOf(Type expectedType)
Throws.TypeOf<T>()
Throws.InstanceOf(Type expectedType)
Throws.InstanceOf<T>()
Throws.Nothing
Throws.InnerException
</pre></div>
<h4>Examples of Use</h4>
<div class="code"><pre>
// .NET 1.1
Assert.That( new TestDelegate(SomeMethod),
Throws.TypeOf(typeof(ArgumentException)));
Assert.That( new TestDelegate(SomeMethod),
Throws.Exception.TypeOf(typeof(ArgumentException)));
Assert.That( new TestDelegate(SomeMethod),
Throws.TypeOf(typeof(ArgumentException))
.With.Property("Parameter").EqualTo("myParam"));
Assert.That( new TestDelegate(SomeMethod),
Throws.ArgumentException );
Assert.That( new TestDelegate(SomeMethod),
Throws.TargetInvocationException
.With.InnerException.TypeOf(ArgumentException));
// .NET 2.0
Assert.That( SomeMethod,
Throws.TypeOf<ArgumentException>());
Assert.That( SomeMethod,
Throws.Exception.TypeOf<ArgumentException>());
Assert.That( SomeMethod,
Throws.TypeOf<ArgumentException>()
.With.Property("Parameter").EqualTo("myParam"));
Assert.That( SomeMethod, Throws.ArgumentException );
Assert.That( SomeMethod,
Throws.TargetInvocationException
.With.InnerException.TypeOf<ArgumentException>());
</pre></div>
<h4>Notes</h4>
<ol>
<li><b>Throws.Exception</b> may be followed by further constraints,
which are applied to the exception itself as shown in the last two
examples above. It may also be used alone to verify that some
exception has been thrown, without regard to type. This is
not a recommended practice since you should normally know
what exception you are expecting.
<li><b>Throws.TypeOf</b> and <b>Throws.InstanceOf</b> are provided
as a shorter syntax for this common test. They work exactly like
the corresponding forms following <b>Throws.Exception</b>.
<li><b>Throws.TargetInvocationException/b>, <b>Throws.ArgumentException</b>
and <b>Throws.InvalidOperationException</b> provide a shortened form
for some common exceptions.
<li>Used alone, <b>Throws.InnerException</b> simply tests the InnerException
value of the thrown exception. More commonly, it will be used in
combination with a test for the type of the outer exception as shown
in the examples above.
</ol>
</div>
<!-- Submenu -->
<div id="subnav">
<ul>
<li><a href="index.html">NUnit 2.5.10</a></li>
<ul>
<li><a href="getStarted.html">Getting Started</a></li>
<li><a href="assertions.html">Assertions</a></li>
<li><a href="constraintModel.html">Constraints</a></li>
<ul>
<li><a href="equalConstraint.html">Equal Constraint</a></li>
<li><a href="sameasConstraint.html">SameAs Constraint</a></li>
<li><a href="conditionConstraints.html">Condition Constraints</a></li>
<li><a href="comparisonConstraints.html">Comparison Constrants</a></li>
<li><a href="pathConstraints.html">Path Constraints</a></li>
<li><a href="typeConstraints.html">Type Constraints</a></li>
<li><a href="stringConstraints.html">String Constraints</a></li>
<li><a href="collectionConstraints.html">Collection Constraints</a></li>
<li><a href="propertyConstraint.html">Property Constraint</a></li>
<li id="current"><a href="throwsConstraint.html">Throws Constraint</a></li>
<li><a href="compoundConstraints.html">Compound Constraints</a></li>
<li><a href="delayedConstraint.html">Delayed Constraint</a></li>
<li><a href="listMapper.html">List Mapper</a></li>
<li><a href="reusableConstraint.html">Reusable Constraint</a></li>
</ul>
<li><a href="attributes.html">Attributes</a></li>
<li><a href="runningTests.html">Running Tests</a></li>
<li><a href="extensibility.html">Extensibility</a></li>
<li><a href="releaseNotes.html">Release Notes</a></li>
<li><a href="samples.html">Samples</a></li>
<li><a href="license.html">License</a></li>
</ul>
</ul>
</div>
<!-- End of Submenu -->
<!-- Standard Footer for NUnit.org -->
<div id="footer">
Copyright © 2010 Charlie Poole. All Rights Reserved.
</div>
<!-- End of Footer -->
</body>
</html>
| {
"content_hash": "60bd88f554192666fca3c8ee267d1b85",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 105,
"avg_line_length": 37.031847133757964,
"alnum_prop": 0.7103543171654627,
"repo_name": "chinnurtb/OpenAdStack-1",
"id": "2752478b887a5f39664dc60699caf21b5b8b4af4",
"size": "5814",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "External/NUnit 2.5.10/doc/throwsConstraint.html",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
/**
* Simple loader
*
* @author C.O.
* @created 16.11.12 14:33
*/
// Check PHP version
if (version_compare(phpversion(), '5.6.0', '<')) {
printf("PHP 5.6.0 is required, you have %s\n", phpversion());
exit(1);
}
// Root path, double level up
$root = realpath(dirname(dirname(__FILE__)));
define('PATH_ROOT', $root);
define('PATH_APPLICATION', $root . '/application');
define('PATH_DATA', $root . '/data');
define('PATH_VENDOR', $root . '/vendor');
define('PATH_PUBLIC', $root . '/public');
// Debug mode for development environment only
if (getenv('BLUZ_DEBUG')) {
error_reporting(E_ALL);
ini_set('display_errors', 1);
} else {
error_reporting(0);
ini_set('display_errors', 0);
}
| {
"content_hash": "5c549395c996c2871e1d2917858a8fbb",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 65,
"avg_line_length": 24,
"alnum_prop": 0.6125,
"repo_name": "yuklia/skeleton",
"id": "ad98abe221257430abc6242e2581dafa886ffb3c",
"size": "720",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "application/_loader.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "69441"
},
{
"name": "HTML",
"bytes": "113934"
},
{
"name": "JavaScript",
"bytes": "302927"
},
{
"name": "PHP",
"bytes": "269220"
},
{
"name": "Shell",
"bytes": "1282"
}
],
"symlink_target": ""
} |
package com.datos.vfs.provider.hdfs;
import com.datos.vfs.*;
import com.datos.vfs.provider.AbstractFileProvider;
import com.datos.vfs.provider.AbstractOriginatingFileProvider;
import com.datos.vfs.provider.http.HttpFileNameParser;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
/**
* FileProvider for HDFS files.
*
* @since 2.1
*/
public class HdfsFileProvider extends AbstractOriginatingFileProvider {
static final Collection<Capability> CAPABILITIES = Collections.unmodifiableCollection(Arrays
.asList(new Capability[]
{
Capability.GET_TYPE,
Capability.READ_CONTENT,
Capability.URI,
Capability.GET_LAST_MODIFIED,
Capability.ATTRIBUTES,
Capability.RANDOM_ACCESS_READ,
Capability.DIRECTORY_READ_CONTENT,
Capability.LIST_CHILDREN,
Capability.APPEND_CONTENT}));
/**
* Constructs a new HdfsFileProvider.
*/
public HdfsFileProvider() {
super();
this.setFileNameParser(HttpFileNameParser.getInstance());
}
/**
* Create a new HdfsFileSystem instance.
*
* @param rootName Name of the root file.
* @param fileSystemOptions Configuration options for this instance.
* @throws FileSystemException if error occurred.
*/
@Override
protected FileSystem doCreateFileSystem(final FileName rootName, final FileSystemOptions fileSystemOptions)
throws FileSystemException {
return new HdfsFileSystem(rootName, fileSystemOptions);
}
/**
* Get Capabilities of HdfsFileSystem.
*
* @return The capabilities (unmodifiable).
*/
@Override
public Collection<Capability> getCapabilities() {
return CAPABILITIES;
}
/**
* Return config builder.
*
* @return A config builder for HdfsFileSystems.
* @see AbstractFileProvider#getConfigBuilder()
*/
@Override
public FileSystemConfigBuilder getConfigBuilder() {
return HdfsFileSystemConfigBuilder.getInstance();
}
}
| {
"content_hash": "320b9a4203cd5c8da8e606ced97f3fe8",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 111,
"avg_line_length": 30.743243243243242,
"alnum_prop": 0.6268131868131868,
"repo_name": "distribuitech/datos",
"id": "cb1d3fb4a7c144048430e1283d3e44a980ea7139",
"size": "3077",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "datos-vfs/src/main/java/com/datos/vfs/provider/hdfs/HdfsFileProvider.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "23348"
},
{
"name": "Java",
"bytes": "1229683"
},
{
"name": "Scala",
"bytes": "42677"
},
{
"name": "Shell",
"bytes": "1027"
}
],
"symlink_target": ""
} |
<!doctype html>
<html>
<head>
<title>CodeMirror: Test Suite</title>
<link rel="stylesheet" href="../lib/codemirror.css">
<script src="../lib/codemirror.js"></script>
<script src="../mode/javascript/javascript.js"></script>
<script src="../mode/xml/xml.js"></script>
<style type="text/css">
.ok {color: #090;}
.fail {color: #e00;}
.error {color: #c90;}
</style>
</head>
<body>
<h1>CodeMirror: Test Suite</h1>
<p>A limited set of programmatic sanity tests for CodeMirror.</p>
<div style="border: 1px solid black; padding: 1px; max-width: 700px;">
<div style="background: #45d; white-space: pre; width: 0px; font-weight: bold; color: white; padding: 3px;" id=progress></div>
</div>
<pre style="padding-left: 5px" id=output></pre>
<div style="visibility: hidden" id=testground>
<form><textarea id="code" name="code"></textarea><input type=submit value=ok name=submit></form>
</div>
<script src="driver.js"></script>
<script src="test.js"></script>
<script>
window.onload = function() {
runTests(displayTest);
};
function esc(str) {
return str.replace(/[<&]/, function(ch) { return ch == "<" ? "<" : "&"; });
}
var output = document.getElementById("output"), progress = document.getElementById("progress");
var count = 0, failed = 0, bad = "";
function displayTest(type, name, msg) {
if (type != "done") ++count;
progress.style.width = (count * (progress.parentNode.clientWidth - 8) / tests.length) + "px";
progress.innerHTML = "Ran " + count + (count < tests.length ? " of " + tests.length : "") + " tests";
if (type == "ok") {
output.innerHTML = bad + "<span class=ok>Test '" + esc(name) + "' succeeded</span>";
} else if (type == "expected") {
output.innerHTML = bad + "<span class=ok>Test '" + esc(name) + "' failed as expected</span>";
} else if (type == "error" || type == "fail") {
++failed;
bad += esc(name) + ": <span class=" + type + ">" + esc(msg) + "</span><br>";
output.innerHTML = bad;
} else if (type == "done") {
output.innerHTML = bad + (failed ? "<span class=fail>" + failed + " failure" + (failed > 1 ? "s" : "") + "</span>"
: "<span class=ok>All passed</span>");
}
}
</script>
</body>
</html>
| {
"content_hash": "92d1ebe0e33d6b79b500a103e03390c9",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 132,
"avg_line_length": 39.725806451612904,
"alnum_prop": 0.5464880227365002,
"repo_name": "citation-style-language/csl-editor-demo-site",
"id": "dd319e9db794bd51a5509b5095d1a4acdda859c8",
"size": "2463",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "docs/cslEditorLib/external/codemirror2/test/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "19762"
},
{
"name": "JavaScript",
"bytes": "15023"
},
{
"name": "Shell",
"bytes": "1618"
}
],
"symlink_target": ""
} |
package fzf
import (
"fmt"
"runtime"
"sort"
"sync"
"time"
"github.com/junegunn/fzf/src/util"
)
// MatchRequest represents a search request
type MatchRequest struct {
chunks []*Chunk
pattern *Pattern
final bool
sort bool
}
// Matcher is responsible for performing search
type Matcher struct {
patternBuilder func([]rune) *Pattern
sort bool
tac bool
eventBox *util.EventBox
reqBox *util.EventBox
partitions int
mergerCache map[string]*Merger
}
const (
reqRetry util.EventType = iota
reqReset
)
// NewMatcher returns a new Matcher
func NewMatcher(patternBuilder func([]rune) *Pattern,
sort bool, tac bool, eventBox *util.EventBox) *Matcher {
return &Matcher{
patternBuilder: patternBuilder,
sort: sort,
tac: tac,
eventBox: eventBox,
reqBox: util.NewEventBox(),
partitions: runtime.NumCPU(),
mergerCache: make(map[string]*Merger)}
}
// Loop puts Matcher in action
func (m *Matcher) Loop() {
prevCount := 0
for {
var request MatchRequest
m.reqBox.Wait(func(events *util.Events) {
for _, val := range *events {
switch val := val.(type) {
case MatchRequest:
request = val
default:
panic(fmt.Sprintf("Unexpected type: %T", val))
}
}
events.Clear()
})
if request.sort != m.sort {
m.sort = request.sort
m.mergerCache = make(map[string]*Merger)
clearChunkCache()
}
// Restart search
patternString := request.pattern.AsString()
var merger *Merger
cancelled := false
count := CountItems(request.chunks)
foundCache := false
if count == prevCount {
// Look up mergerCache
if cached, found := m.mergerCache[patternString]; found {
foundCache = true
merger = cached
}
} else {
// Invalidate mergerCache
prevCount = count
m.mergerCache = make(map[string]*Merger)
}
if !foundCache {
merger, cancelled = m.scan(request)
}
if !cancelled {
if merger.cacheable() {
m.mergerCache[patternString] = merger
}
merger.final = request.final
m.eventBox.Set(EvtSearchFin, merger)
}
}
}
func (m *Matcher) sliceChunks(chunks []*Chunk) [][]*Chunk {
perSlice := len(chunks) / m.partitions
// No need to parallelize
if perSlice == 0 {
return [][]*Chunk{chunks}
}
slices := make([][]*Chunk, m.partitions)
for i := 0; i < m.partitions; i++ {
start := i * perSlice
end := start + perSlice
if i == m.partitions-1 {
end = len(chunks)
}
slices[i] = chunks[start:end]
}
return slices
}
type partialResult struct {
index int
matches []*Item
}
func (m *Matcher) scan(request MatchRequest) (*Merger, bool) {
startedAt := time.Now()
numChunks := len(request.chunks)
if numChunks == 0 {
return EmptyMerger, false
}
pattern := request.pattern
if pattern.IsEmpty() {
return PassMerger(&request.chunks, m.tac), false
}
cancelled := util.NewAtomicBool(false)
slices := m.sliceChunks(request.chunks)
numSlices := len(slices)
resultChan := make(chan partialResult, numSlices)
countChan := make(chan int, numChunks)
waitGroup := sync.WaitGroup{}
for idx, chunks := range slices {
waitGroup.Add(1)
go func(idx int, chunks []*Chunk) {
defer func() { waitGroup.Done() }()
sliceMatches := []*Item{}
for _, chunk := range chunks {
matches := request.pattern.Match(chunk)
sliceMatches = append(sliceMatches, matches...)
if cancelled.Get() {
return
}
countChan <- len(matches)
}
if m.sort {
if m.tac {
sort.Sort(ByRelevanceTac(sliceMatches))
} else {
sort.Sort(ByRelevance(sliceMatches))
}
}
resultChan <- partialResult{idx, sliceMatches}
}(idx, chunks)
}
wait := func() bool {
cancelled.Set(true)
waitGroup.Wait()
return true
}
count := 0
matchCount := 0
for matchesInChunk := range countChan {
count++
matchCount += matchesInChunk
if count == numChunks {
break
}
if m.reqBox.Peek(reqReset) {
return nil, wait()
}
if time.Now().Sub(startedAt) > progressMinDuration {
m.eventBox.Set(EvtSearchProgress, float32(count)/float32(numChunks))
}
}
partialResults := make([][]*Item, numSlices)
for range slices {
partialResult := <-resultChan
partialResults[partialResult.index] = partialResult.matches
}
return NewMerger(partialResults, m.sort, m.tac), false
}
// Reset is called to interrupt/signal the ongoing search
func (m *Matcher) Reset(chunks []*Chunk, patternRunes []rune, cancel bool, final bool, sort bool) {
pattern := m.patternBuilder(patternRunes)
var event util.EventType
if cancel {
event = reqReset
} else {
event = reqRetry
}
m.reqBox.Set(event, MatchRequest{chunks, pattern, final, sort})
}
| {
"content_hash": "4de1cf1cdd95824eb32401e9d9f0081c",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 99,
"avg_line_length": 21.257918552036198,
"alnum_prop": 0.6568752660706684,
"repo_name": "jebaum/fzf",
"id": "3ea2fbeb8d4bc8834a084b7c848a87f97c5463a2",
"size": "4698",
"binary": false,
"copies": "12",
"ref": "refs/heads/master",
"path": "src/matcher.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "144674"
},
{
"name": "Makefile",
"bytes": "2185"
},
{
"name": "Ruby",
"bytes": "69943"
},
{
"name": "Shell",
"bytes": "30132"
},
{
"name": "VimL",
"bytes": "11462"
}
],
"symlink_target": ""
} |
const { basename } = require('path')
const s3 = require('s3')
const Logger = require('./logger')
const getS3Options = (options) => ({
uploaderOptions: {
localFile: `${options.directory}/${options.date}.tar.gz`,
s3Params: {
Bucket: options.bucket,
Key: basename(`${options.directory}/${options.date}.tar.gz`),
ACL: 'private'
}
},
clientOptions: {
s3RetryCount: options.retry,
s3Options: {
accessKeyId: options.accessKeyId,
secretAccessKey: options.secretAccessKey
}
}
})
module.exports = (options) => (done) => {
Logger.debug('s3', { bucket: options.bucket })
const { clientOptions, uploaderOptions } = getS3Options(options)
const client = s3.createClient(clientOptions)
const uploader = client.uploadFile(uploaderOptions)
uploader.on('error', done)
uploader.on('progress', () => {
const { progressMd5Amount, progressAmount, progressTotal } = uploader
Logger.debug('progress', progressMd5Amount, progressAmount, progressTotal)
})
uploader.on('end', (data) => {
Logger.debug('s3', { data })
done()
})
}
| {
"content_hash": "836969c9db3820288f6d6c7450688e4f",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 78,
"avg_line_length": 26.902439024390244,
"alnum_prop": 0.6536718041704442,
"repo_name": "theworkflow/mongodb-backup-cron",
"id": "e663c060231cb42e83775d63783fb579309e48ed",
"size": "1103",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/s3.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "9301"
}
],
"symlink_target": ""
} |
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
#ifndef __UCLEAN_H__
#define __UCLEAN_H__
#include "unicode/utypes.h"
/**
* \file
* \brief C API: Initialize and clean up ICU
*/
/**
* Initialize ICU.
*
* Use of this function is optional. It is OK to simply use ICU
* services and functions without first having initialized
* ICU by calling u_init().
*
* u_init() will attempt to load some part of ICU's data, and is
* useful as a test for configuration or installation problems that
* leave the ICU data inaccessible. A successful invocation of u_init()
* does not, however, guarantee that all ICU data is accessible.
*
* Multiple calls to u_init() cause no harm, aside from the small amount
* of time required.
*
* In old versions of ICU, u_init() was required in multi-threaded applications
* to ensure the thread safety of ICU. u_init() is no longer needed for this purpose.
*
* @param status An ICU UErrorCode parameter. It must not be <code>NULL</code>.
* An Error will be returned if some required part of ICU data can not
* be loaded or initialized.
* The function returns immediately if the input error code indicates a
* failure, as usual.
*
* @stable ICU 2.6
*/
U_STABLE void U_EXPORT2
u_init(UErrorCode *status);
#ifndef U_HIDE_SYSTEM_API
/**
* Clean up the system resources, such as allocated memory or open files,
* used in all ICU libraries. This will free/delete all memory owned by the
* ICU libraries, and return them to their original load state. All open ICU
* items (collators, resource bundles, converters, etc.) must be closed before
* calling this function, otherwise ICU may not free its allocated memory
* (e.g. close your converters and resource bundles before calling this
* function). Generally, this function should be called once just before
* an application exits. For applications that dynamically load and unload
* the ICU libraries (relatively uncommon), u_cleanup() should be called
* just before the library unload.
* <p>
* u_cleanup() also clears any ICU heap functions, mutex functions or
* trace functions that may have been set for the process.
* This has the effect of restoring ICU to its initial condition, before
* any of these override functions were installed. Refer to
* u_setMemoryFunctions(), u_setMutexFunctions and
* utrace_setFunctions(). If ICU is to be reinitialized after
* calling u_cleanup(), these runtime override functions will need to
* be set up again if they are still required.
* <p>
* u_cleanup() is not thread safe. All other threads should stop using ICU
* before calling this function.
* <p>
* Any open ICU items will be left in an undefined state by u_cleanup(),
* and any subsequent attempt to use such an item will give unpredictable
* results.
* <p>
* After calling u_cleanup(), an application may continue to use ICU by
* calling u_init(). An application must invoke u_init() first from one single
* thread before allowing other threads call u_init(). All threads existing
* at the time of the first thread's call to u_init() must also call
* u_init() themselves before continuing with other ICU operations.
* <p>
* The use of u_cleanup() just before an application terminates is optional,
* but it should be called only once for performance reasons. The primary
* benefit is to eliminate reports of memory or resource leaks originating
* in ICU code from the results generated by heap analysis tools.
* <p>
* <strong>Use this function with great care!</strong>
* </p>
*
* @stable ICU 2.0
* @system
*/
U_STABLE void U_EXPORT2
u_cleanup(void);
U_CDECL_BEGIN
/**
* Pointer type for a user supplied memory allocation function.
* @param context user supplied value, obtained from u_setMemoryFunctions().
* @param size The number of bytes to be allocated
* @return Pointer to the newly allocated memory, or NULL if the allocation failed.
* @stable ICU 2.8
* @system
*/
typedef void *U_CALLCONV UMemAllocFn(const void *context, size_t size);
/**
* Pointer type for a user supplied memory re-allocation function.
* @param context user supplied value, obtained from u_setMemoryFunctions().
* @param size The number of bytes to be allocated
* @return Pointer to the newly allocated memory, or NULL if the allocation failed.
* @stable ICU 2.8
* @system
*/
typedef void *U_CALLCONV UMemReallocFn(const void *context, void *mem, size_t size);
/**
* Pointer type for a user supplied memory free function. Behavior should be
* similar the standard C library free().
* @param context user supplied value, obtained from u_setMemoryFunctions().
* @param mem Pointer to the memory block to be resized
* @param size The new size for the block
* @return Pointer to the resized memory block, or NULL if the resizing failed.
* @stable ICU 2.8
* @system
*/
typedef void U_CALLCONV UMemFreeFn (const void *context, void *mem);
/**
* Set the functions that ICU will use for memory allocation.
* Use of this function is optional; by default (without this function), ICU will
* use the standard C library malloc() and free() functions.
* This function can only be used when ICU is in an initial, unused state, before
* u_init() has been called.
* @param context This pointer value will be saved, and then (later) passed as
* a parameter to the memory functions each time they
* are called.
* @param a Pointer to a user-supplied malloc function.
* @param r Pointer to a user-supplied realloc function.
* @param f Pointer to a user-supplied free function.
* @param status Receives error values.
* @stable ICU 2.8
* @system
*/
U_STABLE void U_EXPORT2
u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f,
UErrorCode *status);
U_CDECL_END
#ifndef U_HIDE_DEPRECATED_API
/*********************************************************************************
*
* Deprecated Functions
*
* The following functions for user supplied mutexes are no longer supported.
* Any attempt to use them will return a U_UNSUPPORTED_ERROR.
*
**********************************************************************************/
/**
* An opaque pointer type that represents an ICU mutex.
* For user-implemented mutexes, the value will typically point to a
* struct or object that implements the mutex.
* @deprecated ICU 52. This type is no longer supported.
* @system
*/
typedef void *UMTX;
U_CDECL_BEGIN
/**
* Function Pointer type for a user supplied mutex initialization function.
* The user-supplied function will be called by ICU whenever ICU needs to create a
* new mutex. The function implementation should create a mutex, and store a pointer
* to something that uniquely identifies the mutex into the UMTX that is supplied
* as a parameter.
* @param context user supplied value, obtained from u_setMutexFunctions().
* @param mutex Receives a pointer that identifies the new mutex.
* The mutex init function must set the UMTX to a non-null value.
* Subsequent calls by ICU to lock, unlock, or destroy a mutex will
* identify the mutex by the UMTX value.
* @param status Error status. Report errors back to ICU by setting this variable
* with an error code.
* @deprecated ICU 52. This function is no longer supported.
* @system
*/
typedef void U_CALLCONV UMtxInitFn (const void *context, UMTX *mutex, UErrorCode* status);
/**
* Function Pointer type for a user supplied mutex functions.
* One of the user-supplied functions with this signature will be called by ICU
* whenever ICU needs to lock, unlock, or destroy a mutex.
* @param context user supplied value, obtained from u_setMutexFunctions().
* @param mutex specify the mutex on which to operate.
* @deprecated ICU 52. This function is no longer supported.
* @system
*/
typedef void U_CALLCONV UMtxFn (const void *context, UMTX *mutex);
U_CDECL_END
/**
* Set the functions that ICU will use for mutex operations
* Use of this function is optional; by default (without this function), ICU will
* directly access system functions for mutex operations
* This function can only be used when ICU is in an initial, unused state, before
* u_init() has been called.
* @param context This pointer value will be saved, and then (later) passed as
* a parameter to the user-supplied mutex functions each time they
* are called.
* @param init Pointer to a mutex initialization function. Must be non-null.
* @param destroy Pointer to the mutex destroy function. Must be non-null.
* @param lock pointer to the mutex lock function. Must be non-null.
* @param unlock Pointer to the mutex unlock function. Must be non-null.
* @param status Receives error values.
* @deprecated ICU 52. This function is no longer supported.
* @system
*/
U_DEPRECATED void U_EXPORT2
u_setMutexFunctions(const void *context, UMtxInitFn *init, UMtxFn *destroy, UMtxFn *lock, UMtxFn *unlock,
UErrorCode *status);
/**
* Pointer type for a user supplied atomic increment or decrement function.
* @param context user supplied value, obtained from u_setAtomicIncDecFunctions().
* @param p Pointer to a 32 bit int to be incremented or decremented
* @return The value of the variable after the inc or dec operation.
* @deprecated ICU 52. This function is no longer supported.
* @system
*/
typedef int32_t U_CALLCONV UMtxAtomicFn(const void *context, int32_t *p);
/**
* Set the functions that ICU will use for atomic increment and decrement of int32_t values.
* Use of this function is optional; by default (without this function), ICU will
* use its own internal implementation of atomic increment/decrement.
* This function can only be used when ICU is in an initial, unused state, before
* u_init() has been called.
* @param context This pointer value will be saved, and then (later) passed as
* a parameter to the increment and decrement functions each time they
* are called. This function can only be called
* @param inc Pointer to a function to do an atomic increment operation. Must be non-null.
* @param dec Pointer to a function to do an atomic decrement operation. Must be non-null.
* @param status Receives error values.
* @deprecated ICU 52. This function is no longer supported.
* @system
*/
U_DEPRECATED void U_EXPORT2
u_setAtomicIncDecFunctions(const void *context, UMtxAtomicFn *inc, UMtxAtomicFn *dec,
UErrorCode *status);
#endif /* U_HIDE_DEPRECATED_API */
#endif /* U_HIDE_SYSTEM_API */
#endif
| {
"content_hash": "ef4b9289f510edd0bb6b779d0a299f44",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 142,
"avg_line_length": 44.144,
"alnum_prop": 0.6947263501268576,
"repo_name": "wiltonlazary/arangodb",
"id": "7cef6dba68b815ccd822d064ad0408b9a5513612",
"size": "11474",
"binary": false,
"copies": "14",
"ref": "refs/heads/devel",
"path": "3rdParty/V8/v7.9.317/third_party/icu/source/common/unicode/uclean.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "61827"
},
{
"name": "C",
"bytes": "309788"
},
{
"name": "C++",
"bytes": "34723629"
},
{
"name": "CMake",
"bytes": "383904"
},
{
"name": "CSS",
"bytes": "210549"
},
{
"name": "EJS",
"bytes": "231166"
},
{
"name": "HTML",
"bytes": "23114"
},
{
"name": "JavaScript",
"bytes": "33741286"
},
{
"name": "LLVM",
"bytes": "14975"
},
{
"name": "NASL",
"bytes": "269512"
},
{
"name": "NSIS",
"bytes": "47138"
},
{
"name": "Pascal",
"bytes": "75391"
},
{
"name": "Perl",
"bytes": "9811"
},
{
"name": "PowerShell",
"bytes": "7869"
},
{
"name": "Python",
"bytes": "184352"
},
{
"name": "SCSS",
"bytes": "255542"
},
{
"name": "Shell",
"bytes": "134504"
},
{
"name": "TypeScript",
"bytes": "179074"
},
{
"name": "Yacc",
"bytes": "79620"
}
],
"symlink_target": ""
} |
[](https://travis-ci.org/lostdalek/Phraseanet-common)
[](https://david-dm.org/lostdalek/Phraseanet-common#info=devDependencies)
[](https://david-dm.org/lostdalek/Phraseanet-common)
[](https://coveralls.io/github/lostdalek/Phraseanet-common?branch=master)
## Requirements
Node `^5.0.0`.
```js
$ npm install # Install Node modules listed in ./package.json
$ npm webpack # Build a non-minified version of the library
```
## Workflow
* `npm run production` - Build task that generate a minified script for production
* `npm run clean` - Remove the `dist` folder and it's files
* `npm run eslint:source` - Lint the source
* `npm run eslint:common` - Lint the unit tests shared by Karma and Mocha
* `npm run eslint:server` - Lint the unit tests for server
* `npm run eslint:browser` - Lint the unit tests for browser
* `npm run eslint:fix` - ESLint will try to fix as many issues as possible in your source files
* `npm run clean` - Remove the coverage report and the *dist* folder
* `npm run test` - Runs unit tests for both server and the browser
* `npm run test:browser` - Runs the unit tests for browser / client
* `npm run test:server` - Runs the unit tests on the server
* `npm run watch:server` - Run all unit tests for server & watch files for changes
* `npm run watch:browser` - Run all unit tests for browser & watch files for changes
* `npm run karma:firefox` - Run all unit tests with Karma & Firefox
* `npm run karma:chrome` - Run all unit tests with Karma & Chrome
* `npm run karma:ie` - Run all unit tests with Karma & Internet Explorer
* `npm run packages` - List installed packages
* `npm run package:purge` - Remove all dependencies
* `npm run package:reinstall` - Reinstall all dependencies
* `npm run package:check` - shows a list over dependencies with a higher version number then the current one - if any
* `npm run package:upgrade` - Automaticly upgrade all devDependencies & dependencies, and update package.json
* `npm run package:dev` - Automaticly upgrade all devDependencies and update package.json
* `npm run package:prod` - Automaticly upgrade all dependencies and update package.json
* `npm run asset-server` - starts a asset server with hot module replacement (WDS) on port 8080
## Asset server
asset server with hot module replacement (WDS) enabled on port 8080.
```js
npm run asset-server
```
Open `http://localhost:8080`, and you will see this message in your browser: `It works!`.
## Installation
Download the package, and run this from the command line:
```
npm install
```
[trav_img]: https://api.travis-ci.org/lostdalek/Phraseanet-common.svg
[trav_site]: https://travis-ci.org/lostdalek/Phraseanet-common.svg?branch=master
## Credits
based on [Trolly](https://github.com/Kflash/trolly) an es6 boilerplate by [KFlash](https://github.com/kflash)
| {
"content_hash": "c5713f7713945109851992e5b4503bea",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 178,
"avg_line_length": 48.22727272727273,
"alnum_prop": 0.7408105560791706,
"repo_name": "alchemy-fr/Phraseanet-common",
"id": "744c2bcc795c02e006f9e6e5974903e66e1669d9",
"size": "3203",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "288"
},
{
"name": "JavaScript",
"bytes": "67537"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Firefox OS on a High End Device</title>
<meta name="description" content="" />
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="shortcut icon" href="https://prateekjadhwani.github.io/favicon.ico">
<link rel="stylesheet" type="text/css" href="//prateekjadhwani.github.io/themes/casper/assets/css/screen.css?v=1519915919782" />
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" />
<link rel="canonical" href="https://prateekjadhwani.github.io/2015/08/22/Firefox-OS-on-a-High-End-Device.html" />
<meta name="referrer" content="origin" />
<meta property="og:site_name" content="Prateek Jadhwani" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Firefox OS on a High End Device" />
<meta property="og:description" content="It all started with one tweet!! My Phone Runs on JavaScript - great Firefox OS intro deck from @jedireza http://t.co/JksO42aP2B&mdash; dietrich ayala (@dietrich) August 3, 2015 Here you can clearly see from the slides that Firefos OS runs on Sony Xperia Z3 Compact. And so the" />
<meta property="og:url" content="https://prateekjadhwani.github.io/2015/08/22/Firefox-OS-on-a-High-End-Device.html" />
<meta property="article:published_time" content="2015-08-22T00:00:00.000Z" />
<meta property="article:tag" content="Firefox OS" />
<meta property="article:tag" content="B2G" />
<meta property="article:tag" content="Sony Xperia Z3 Compact" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="Firefox OS on a High End Device" />
<meta name="twitter:description" content="It all started with one tweet!! My Phone Runs on JavaScript - great Firefox OS intro deck from @jedireza http://t.co/JksO42aP2B&mdash; dietrich ayala (@dietrich) August 3, 2015 Here you can clearly see from the slides that Firefos OS runs on Sony Xperia Z3 Compact. And so the" />
<meta name="twitter:url" content="https://prateekjadhwani.github.io/2015/08/22/Firefox-OS-on-a-High-End-Device.html" />
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Article",
"publisher": "Prateek Jadhwani",
"author": {
"@type": "Person",
"name": "Prateek Jadhwani",
"image": "https://avatars0.githubusercontent.com/u/2219900?v=4",
"url": "https://prateekjadhwani.github.io/author/prateekjadhwani/",
"sameAs": "https://prateekjadhwani.github.io",
"description": "Creator of Pancake CMS (https://pancake-cms.github.io)\r\nWeb Components and Polymer Fan boy.\r\nFrontend Developer by day; Gamer by night."
},
"headline": "Firefox OS on a High End Device",
"url": "https://prateekjadhwani.github.io/2015/08/22/Firefox-OS-on-a-High-End-Device.html",
"datePublished": "2015-08-22T00:00:00.000Z",
"keywords": "Firefox OS, B2G, Sony Xperia Z3 Compact",
"description": "It all started with one tweet!! My Phone Runs on JavaScript - great Firefox OS intro deck from @jedireza http://t.co/JksO42aP2B&mdash; dietrich ayala (@dietrich) August 3, 2015 Here you can clearly see from the slides that Firefos OS runs on Sony Xperia Z3 Compact. And so the"
}
</script>
<meta name="generator" content="HubPress" />
<link rel="alternate" type="application/rss+xml" title="Prateek Jadhwani" href="https://prateekjadhwani.github.io/rss/" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.10.0/styles/atom-one-dark.min.css">
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>
</head>
<body class="post-template tag-Firefox-OS tag-B2G tag-Sony-Xperia-Z3-Compact nav-closed">
<div class="site-wrapper">
<header class="main-header post-head no-cover">
<nav class="main-nav clearfix">
<a class="blog-logo" href="https://prateekjadhwani.github.io"><img src="/images/logo.png" alt="Prateek Jadhwani" /></a>
</nav>
</header>
<main class="content" role="main">
<article class="post tag-Firefox-OS tag-B2G tag-Sony-Xperia-Z3-Compact">
<header class="post-header">
<h1 class="post-title">Firefox OS on a High End Device</h1>
<section class="post-meta">
<time class="post-date" datetime="2015-08-22">22 August 2015</time> on <a href="https://prateekjadhwani.github.io/tag/Firefox-OS/">Firefox OS</a>, <a href="https://prateekjadhwani.github.io/tag/B2G/">B2G</a>, <a href="https://prateekjadhwani.github.io/tag/Sony-Xperia-Z3-Compact/">Sony Xperia Z3 Compact</a>
</section>
</header>
<section class="post-content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>It all started with one tweet!!</p>
</div>
<div class="paragraph">
<p><blockquote class="twitter-tweet" lang="en"><p lang="en" dir="ltr">My Phone Runs on JavaScript - great Firefox OS intro deck from <a href="https://twitter.com/jedireza">@jedireza</a> <a href="http://t.co/JksO42aP2B">http://t.co/JksO42aP2B</a></p>— dietrich ayala (@dietrich) <a href="https://twitter.com/dietrich/status/628270494190542849">August 3, 2015</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
</div>
<div class="paragraph">
<p>Here you can clearly see from the slides that Firefos OS runs on Sony Xperia Z3 Compact. And so the experiment began!!</p>
</div>
</div>
</div>
<div class="sect3">
<h4 id="_unlocking_the_bootloader">Unlocking the bootloader</h4>
<div class="paragraph">
<p>For someone who has never created android mods, or played with android, it was really difficult to understand the steps that had to be followed in order to install Firefox OS. And so the first step <em>Unlocking The Bootloader</em> turned out to be more challenging than I had originally thought. But in the end, the bootloader was unlocked, and I got to play with some of the bootloader options.</p>
</div>
</div>
<div class="sect3">
<h4 id="_building_for_aries_l">Building for aries-l</h4>
<div class="paragraph">
<p>Now that the bootloader was unlocked, I decided to install firefox os on this device which had Android 5.1.1 or you can say the most updated version of Android.</p>
</div>
<div class="quoteblock">
<blockquote>
<div class="paragraph">
<p>aries-l is the code name for Sony Xperia Z3 Compact device running Android 5.</p>
</div>
</blockquote>
</div>
<div class="paragraph">
<p>After following the MDN docs on firefox OS for aries-l build, I started the build process on my mac. But after downloading the files, the build process failed. After talking to the community, I found out that the build process for Android 5.0+ was broken. Not only that, the build process doesnt work on Mac at all.</p>
</div>
</div>
<div class="sect3">
<h4 id="_flashing_the_phone_with_4_4">Flashing the phone with 4.4</h4>
<div class="paragraph">
<p>After realizing that the previous step was a total failure and talking to the people in community, I decided to flash the devices with Android 4.4.</p>
</div>
</div>
<div class="sect3">
<h4 id="_building_for_aries">Building for aries</h4>
<div class="paragraph">
<p>This time instead of using a Mac to build Firefox OS, I used a linux machine. <em><em>(incase you are wondering why I did not use a virtual machine, well I did, but the process kept on failing after pulling the files from the device.)</em></em></p>
</div>
<div class="quoteblock">
<blockquote>
<div class="paragraph">
<p>aries is the code name for Sony Xperia Z3 Compact device running Android 4.4.</p>
</div>
</blockquote>
</div>
<div class="paragraph">
<p>And this time, it was a success. I was finally able to see the device running Firefox OS.</p>
</div>
<div class="paragraph">
<p><strong>Some of the settings from the device are as follows</strong></p>
</div>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Setting Name</strong></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Value</strong></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Model</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Xperia Z3 Compact(B2G)</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">Software</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Boot2Gecko 2.5.0.0-prerelease</p></td>
</tr>
</tbody>
</table>
</div>
<div class="sect3">
<h4 id="_outcome">Outcome</h4>
<div class="paragraph">
<p>The final outcome was a High End Device runnning Firefox OS.</p>
</div>
<div class="videoblock">
<div class="content">
<iframe src="https://www.youtube.com/embed/EyGAyjMobb8?rel=0" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</div>
</section>
<footer class="post-footer">
<figure class="author-image">
<a class="img" href="https://prateekjadhwani.github.io/author/prateekjadhwani/" style="background-image: url(https://avatars0.githubusercontent.com/u/2219900?v=4)"><span class="hidden">Prateek Jadhwani's Picture</span></a>
</figure>
<section class="author">
<h4><a href="https://prateekjadhwani.github.io/author/prateekjadhwani/">Prateek Jadhwani</a></h4>
<p>Creator of Pancake CMS (https://pancake-cms.github.io)
Web Components and Polymer Fan boy.
Frontend Developer by day; Gamer by night.</p>
<div class="author-meta">
<span class="author-location icon-location">United States</span>
<span class="author-link icon-link"><a href="https://prateekjadhwani.github.io">https://prateekjadhwani.github.io</a></span>
</div>
</section>
<section class="share">
<h4>Share this post</h4>
<a class="icon-twitter" href="https://twitter.com/intent/tweet?text=Firefox%20OS%20on%20a%20High%20End%20Device&url=https://prateekjadhwani.github.io/"
onclick="window.open(this.href, 'twitter-share', 'width=550,height=235');return false;">
<span class="hidden">Twitter</span>
</a>
<a class="icon-facebook" href="https://www.facebook.com/sharer/sharer.php?u=https://prateekjadhwani.github.io/"
onclick="window.open(this.href, 'facebook-share','width=580,height=296');return false;">
<span class="hidden">Facebook</span>
</a>
<a class="icon-google-plus" href="https://plus.google.com/share?url=https://prateekjadhwani.github.io/"
onclick="window.open(this.href, 'google-plus-share', 'width=490,height=530');return false;">
<span class="hidden">Google+</span>
</a>
</section>
</footer>
<section class="post-comments">
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = 'prateekjadhwani'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
</section>
</article>
</main>
<aside class="read-next">
</aside>
<footer class="site-footer clearfix">
<section class="copyright"><a href="https://prateekjadhwani.github.io">Prateek Jadhwani</a> © 2018</section>
<section class="poweredby">Proudly published with <a href="http://hubpress.io">HubPress</a></section>
</footer>
</div>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js?v="></script> <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.min.js?v="></script> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.10.0/highlight.min.js?v="></script>
<script type="text/javascript">
jQuery( document ).ready(function() {
// change date with ago
jQuery('ago.ago').each(function(){
var element = jQuery(this).parent();
element.html( moment(element.text()).fromNow());
});
});
hljs.initHighlightingOnLoad();
</script>
<script type="text/javascript" src="//prateekjadhwani.github.io/themes/casper/assets/js/jquery.fitvids.js?v=1519915919782"></script>
<script type="text/javascript" src="//prateekjadhwani.github.io/themes/casper/assets/js/index.js?v=1519915919782"></script>
<script>
(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-65947202-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
| {
"content_hash": "e37b6d7032f9869c0141996f122c2014",
"timestamp": "",
"source": "github",
"line_count": 282,
"max_line_length": 403,
"avg_line_length": 50.212765957446805,
"alnum_prop": 0.6656073446327684,
"repo_name": "prateekjadhwani/prateekjadhwani.github.io",
"id": "fda2d43e02b0ff7246d0a0bcc203da9216f7d793",
"size": "14160",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "2015/08/22/Firefox-OS-on-a-High-End-Device.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "325790"
},
{
"name": "CoffeeScript",
"bytes": "6630"
},
{
"name": "HTML",
"bytes": "1051289"
},
{
"name": "Handlebars",
"bytes": "110099"
},
{
"name": "JavaScript",
"bytes": "238406"
},
{
"name": "Ruby",
"bytes": "806"
},
{
"name": "SCSS",
"bytes": "140841"
},
{
"name": "Shell",
"bytes": "2265"
}
],
"symlink_target": ""
} |
package eu.davidea.samples.flexibleadapter.fragments;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import java.util.List;
import eu.davidea.fastscroller.FastScroller;
import eu.davidea.flexibleadapter.SelectableAdapter;
import eu.davidea.flexibleadapter.common.DividerItemDecoration;
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
import eu.davidea.flipview.FlipView;
import eu.davidea.samples.flexibleadapter.ExampleAdapter;
import eu.davidea.samples.flexibleadapter.MainActivity;
import eu.davidea.samples.flexibleadapter.R;
import eu.davidea.samples.flexibleadapter.items.ScrollableUseCaseItem;
import eu.davidea.samples.flexibleadapter.services.DatabaseService;
import eu.davidea.utils.Utils;
/**
* A fragment representing a list of Items.
* Activities containing this fragment MUST implement the {@link OnFragmentInteractionListener}
* interface.
*/
public class FragmentSelectionModes extends AbstractFragment {
public static final String TAG = FragmentSelectionModes.class.getSimpleName();
/**
* Custom implementation of FlexibleAdapter
*/
private ExampleAdapter mAdapter;
@SuppressWarnings("unused")
public static FragmentSelectionModes newInstance(int columnCount) {
FragmentSelectionModes fragment = new FragmentSelectionModes();
Bundle args = new Bundle();
args.putInt(ARG_COLUMN_COUNT, columnCount);
fragment.setArguments(args);
return fragment;
}
/**
* Mandatory empty constructor for the fragment manager to instantiate the
* fragment (e.g. upon screen orientation changes).
*/
public FragmentSelectionModes() {
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Settings for FlipView
FlipView.resetLayoutAnimationDelay(true, 1000L);
// Create New Database and Initialize RecyclerView
if (savedInstanceState == null) {
DatabaseService.getInstance().createEndlessDatabase(200);
}
initializeRecyclerView(savedInstanceState);
// Settings for FlipView
FlipView.stopLayoutAnimation();
}
@SuppressWarnings({"ConstantConditions", "NullableProblems"})
private void initializeRecyclerView(Bundle savedInstanceState) {
//Get copy of the Database list
List<AbstractFlexibleItem> items = DatabaseService.getInstance().getDatabaseList();
// Initialize Adapter and RecyclerView
// ExampleAdapter makes use of stableIds, I strongly suggest to implement 'item.hashCode()'
mAdapter = new ExampleAdapter(items, getActivity());
mAdapter.setNotifyChangeOfUnfilteredItems(true) //This will rebind new item when refreshed
.setMode(SelectableAdapter.MODE_SINGLE);
// Experimenting NEW features (v5.0.0)
mRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
mRecyclerView.setLayoutManager(createNewLinearLayoutManager());
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.setHasFixedSize(true); //Size of RV will not change
// NOTE: Use default item animator 'canReuseUpdatedViewHolder()' will return true if
// a Payload is provided. FlexibleAdapter is actually sending Payloads onItemChange.
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
// Divider item decorator with DrawOver enabled
mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), R.drawable.divider)
.withDrawOver(true));
mRecyclerView.postDelayed(new Runnable() {
@Override
public void run() {
Snackbar.make(getView(), "Selection MODE_SINGLE is enabled", Snackbar.LENGTH_SHORT).show();
}
}, 1500L);
// Add FastScroll to the RecyclerView, after the Adapter has been attached the RecyclerView!!!
mAdapter.setFastScroller((FastScroller) getView().findViewById(R.id.fast_scroller),
Utils.getColorAccent(getActivity()), (MainActivity) getActivity());
SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) getView().findViewById(R.id.swipeRefreshLayout);
swipeRefreshLayout.setEnabled(true);
mListener.onFragmentChange(swipeRefreshLayout, mRecyclerView, SelectableAdapter.MODE_SINGLE);
// Add 2 Scrollable Headers
mAdapter.addUserLearnedSelection(savedInstanceState == null);
mAdapter.addScrollableHeaderWithDelay(new ScrollableUseCaseItem(
getString(R.string.selection_modes_use_case_title),
getString(R.string.selection_modes_use_case_description)), 1100L, true
);
}
@Override
public void showNewLayoutInfo(MenuItem item) {
super.showNewLayoutInfo(item);
mAdapter.showLayoutInfo(false);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_selection_modes, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.action_list_type)
mAdapter.setAnimationOnScrolling(true);
return super.onOptionsItemSelected(item);
}
} | {
"content_hash": "710bb1ab25393b5b2df84b8bad250f95",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 111,
"avg_line_length": 37.35036496350365,
"alnum_prop": 0.7928473715067422,
"repo_name": "weiwenqiang/GitHub",
"id": "250bd181939c5e81b8dfb4396d6ef92ed17550bb",
"size": "5117",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ListView/FlexibleAdapter-master/flexible-adapter-app/src/main/java/eu/davidea/samples/flexibleadapter/fragments/FragmentSelectionModes.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "87"
},
{
"name": "C",
"bytes": "42062"
},
{
"name": "C++",
"bytes": "12137"
},
{
"name": "CMake",
"bytes": "202"
},
{
"name": "CSS",
"bytes": "75087"
},
{
"name": "Clojure",
"bytes": "12036"
},
{
"name": "FreeMarker",
"bytes": "21704"
},
{
"name": "Groovy",
"bytes": "55083"
},
{
"name": "HTML",
"bytes": "61549"
},
{
"name": "Java",
"bytes": "42222825"
},
{
"name": "JavaScript",
"bytes": "216823"
},
{
"name": "Kotlin",
"bytes": "24319"
},
{
"name": "Makefile",
"bytes": "19490"
},
{
"name": "Perl",
"bytes": "280"
},
{
"name": "Prolog",
"bytes": "1030"
},
{
"name": "Python",
"bytes": "13032"
},
{
"name": "Scala",
"bytes": "310450"
},
{
"name": "Shell",
"bytes": "27802"
}
],
"symlink_target": ""
} |
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _three = require('three');
var THREE = _interopRequireWildcard(_three);
var _ReactPropTypes = require('react/lib/ReactPropTypes');
var _ReactPropTypes2 = _interopRequireDefault(_ReactPropTypes);
var _GeometryDescriptorBase = require('./GeometryDescriptorBase');
var _GeometryDescriptorBase2 = _interopRequireDefault(_GeometryDescriptorBase);
var _propTypeInstanceOf = require('../../utils/propTypeInstanceOf');
var _propTypeInstanceOf2 = _interopRequireDefault(_propTypeInstanceOf);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var TubeGeometryDescriptor = function (_GeometryDescriptorBa) {
_inherits(TubeGeometryDescriptor, _GeometryDescriptorBa);
function TubeGeometryDescriptor(react3RendererInstance) {
_classCallCheck(this, TubeGeometryDescriptor);
var _this = _possibleConstructorReturn(this, (TubeGeometryDescriptor.__proto__ || Object.getPrototypeOf(TubeGeometryDescriptor)).call(this, react3RendererInstance));
_this.hasProp('path', {
type: (0, _propTypeInstanceOf2.default)(THREE.Curve).isRequired,
update: _this.triggerRemount
});
_this.hasProp('segments', {
type: _ReactPropTypes2.default.number,
update: _this.triggerRemount,
default: 64
});
_this.hasProp('radius', {
type: _ReactPropTypes2.default.number,
update: _this.triggerRemount,
default: 1
});
_this.hasProp('radiusSegments', {
type: _ReactPropTypes2.default.number,
update: _this.triggerRemount,
default: 8
});
_this.hasProp('closed', {
type: _ReactPropTypes2.default.bool,
update: _this.triggerRemount,
default: false
});
return _this;
}
_createClass(TubeGeometryDescriptor, [{
key: 'construct',
value: function construct(props) {
// props from http://threejs.org/docs/#Reference/Extras.Geometries/TubeGeometry:
var path = props.path,
segments = props.segments,
radius = props.radius,
radiusSegments = props.radiusSegments,
closed = props.closed;
return new THREE.TubeGeometry(path, segments, radius, radiusSegments, closed);
}
}]);
return TubeGeometryDescriptor;
}(_GeometryDescriptorBase2.default);
module.exports = TubeGeometryDescriptor; | {
"content_hash": "5ee9d20d85ad63adefa2f2579324aee7",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 564,
"avg_line_length": 46.06818181818182,
"alnum_prop": 0.7118894918598915,
"repo_name": "cdnjs/cdnjs",
"id": "853fd21b58492c0edbe8031541890cb718fc9bf3",
"size": "4054",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "ajax/libs/react-three-renderer/3.0.1/descriptors/Geometry/TubeGeometryDescriptor.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zerver', '0041_create_attachments_for_old_messages'),
]
operations = [
migrations.AlterField(
model_name='attachment',
name='file_name',
field=models.TextField(db_index=True),
),
]
| {
"content_hash": "36cfb6157881b26bbc50ba4acdd61c23",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 63,
"avg_line_length": 22.5,
"alnum_prop": 0.5888888888888889,
"repo_name": "timabbott/zulip",
"id": "84f1da7717a342d19a0ed2674d94540d88eb5c77",
"size": "360",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "zerver/migrations/0042_attachment_file_name_length.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "429356"
},
{
"name": "Dockerfile",
"bytes": "2939"
},
{
"name": "Emacs Lisp",
"bytes": "157"
},
{
"name": "HTML",
"bytes": "844217"
},
{
"name": "JavaScript",
"bytes": "3259448"
},
{
"name": "Perl",
"bytes": "8594"
},
{
"name": "Puppet",
"bytes": "74427"
},
{
"name": "Python",
"bytes": "7825440"
},
{
"name": "Ruby",
"bytes": "6110"
},
{
"name": "Shell",
"bytes": "123706"
},
{
"name": "TSQL",
"bytes": "314"
},
{
"name": "TypeScript",
"bytes": "22102"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<title>Digital Land Charges</title>
<head>
<link rel="stylesheet" href="/public/stylesheets/styles.css">
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,700' rel='stylesheet' type='text/css'>
</head>
<body>
{{>includes/header}}
<div id="content">
<div class="breadcrumb">
<ol>
<li><a class="breadcrumb_links" href="home">Home</a></li>
<li class="breadcrumb_no_arrow"><span>Under Construction</span></li>
</ol>
</div>
<img src="../../../../../public/images/uc.jpg" alt="Under Construction" align="middle">
</div>
{{>includes/footer}}
</body>
</html>
| {
"content_hash": "968c711ff90ff055c41c84588ef02d4a",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 109,
"avg_line_length": 21.78125,
"alnum_prop": 0.6040172166427547,
"repo_name": "LandRegistry/lc-prototype",
"id": "1beacec15949f70f24cb1db1db5ad062cadc376c",
"size": "697",
"binary": false,
"copies": "16",
"ref": "refs/heads/master",
"path": "app/views/projects/digital_land_charges/beta/sprint6v2/uc.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "178796"
},
{
"name": "HTML",
"bytes": "13266475"
},
{
"name": "JavaScript",
"bytes": "83794"
},
{
"name": "Ruby",
"bytes": "299"
}
],
"symlink_target": ""
} |
package org.apache.sysml.test.integration.functions.reorg;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/** Group together the tests in this package into a single suite so that the Maven build
* won't run two of them at once. */
@RunWith(Suite.class)
@Suite.SuiteClasses({
DiagV2MTest.class,
FullOrderTest.class,
FullReverseTest.class,
FullTransposeTest.class,
MatrixReshapeTest.class,
VectorReshapeTest.class,
})
/** This class is just a holder for the above JUnit annotations. */
public class ZPackageSuite {
}
| {
"content_hash": "6c00242dcfc3b04d5fac02d4e9f6d865",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 88,
"avg_line_length": 22.833333333333332,
"alnum_prop": 0.7682481751824818,
"repo_name": "deroneriksson/incubator-systemml",
"id": "6ad350a523ee4fc646fae441bfabd84d66277523",
"size": "1357",
"binary": false,
"copies": "14",
"ref": "refs/heads/master",
"path": "src/test_suites/java/org/apache/sysml/test/integration/functions/reorg/ZPackageSuite.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "31285"
},
{
"name": "Batchfile",
"bytes": "22265"
},
{
"name": "C",
"bytes": "8676"
},
{
"name": "C++",
"bytes": "30804"
},
{
"name": "CMake",
"bytes": "10312"
},
{
"name": "Cuda",
"bytes": "30575"
},
{
"name": "Java",
"bytes": "12990600"
},
{
"name": "Jupyter Notebook",
"bytes": "36387"
},
{
"name": "Makefile",
"bytes": "936"
},
{
"name": "Protocol Buffer",
"bytes": "66399"
},
{
"name": "Python",
"bytes": "195969"
},
{
"name": "R",
"bytes": "672462"
},
{
"name": "Scala",
"bytes": "185698"
},
{
"name": "Shell",
"bytes": "152940"
}
],
"symlink_target": ""
} |
#pragma once
#include <aws/alexaforbusiness/AlexaForBusiness_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/alexaforbusiness/model/SkillSummary.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace AlexaForBusiness
{
namespace Model
{
class AWS_ALEXAFORBUSINESS_API ListSkillsResult
{
public:
ListSkillsResult();
ListSkillsResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
ListSkillsResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>The list of enabled skills requested. Required.</p>
*/
inline const Aws::Vector<SkillSummary>& GetSkillSummaries() const{ return m_skillSummaries; }
/**
* <p>The list of enabled skills requested. Required.</p>
*/
inline void SetSkillSummaries(const Aws::Vector<SkillSummary>& value) { m_skillSummaries = value; }
/**
* <p>The list of enabled skills requested. Required.</p>
*/
inline void SetSkillSummaries(Aws::Vector<SkillSummary>&& value) { m_skillSummaries = std::move(value); }
/**
* <p>The list of enabled skills requested. Required.</p>
*/
inline ListSkillsResult& WithSkillSummaries(const Aws::Vector<SkillSummary>& value) { SetSkillSummaries(value); return *this;}
/**
* <p>The list of enabled skills requested. Required.</p>
*/
inline ListSkillsResult& WithSkillSummaries(Aws::Vector<SkillSummary>&& value) { SetSkillSummaries(std::move(value)); return *this;}
/**
* <p>The list of enabled skills requested. Required.</p>
*/
inline ListSkillsResult& AddSkillSummaries(const SkillSummary& value) { m_skillSummaries.push_back(value); return *this; }
/**
* <p>The list of enabled skills requested. Required.</p>
*/
inline ListSkillsResult& AddSkillSummaries(SkillSummary&& value) { m_skillSummaries.push_back(std::move(value)); return *this; }
/**
* <p>The token returned to indicate that there is more data available.</p>
*/
inline const Aws::String& GetNextToken() const{ return m_nextToken; }
/**
* <p>The token returned to indicate that there is more data available.</p>
*/
inline void SetNextToken(const Aws::String& value) { m_nextToken = value; }
/**
* <p>The token returned to indicate that there is more data available.</p>
*/
inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); }
/**
* <p>The token returned to indicate that there is more data available.</p>
*/
inline void SetNextToken(const char* value) { m_nextToken.assign(value); }
/**
* <p>The token returned to indicate that there is more data available.</p>
*/
inline ListSkillsResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}
/**
* <p>The token returned to indicate that there is more data available.</p>
*/
inline ListSkillsResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}
/**
* <p>The token returned to indicate that there is more data available.</p>
*/
inline ListSkillsResult& WithNextToken(const char* value) { SetNextToken(value); return *this;}
private:
Aws::Vector<SkillSummary> m_skillSummaries;
Aws::String m_nextToken;
};
} // namespace Model
} // namespace AlexaForBusiness
} // namespace Aws
| {
"content_hash": "c41ed4ba0f5a3096e72b190362a1600f",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 136,
"avg_line_length": 31.885964912280702,
"alnum_prop": 0.6828060522696011,
"repo_name": "JoyIfBam5/aws-sdk-cpp",
"id": "baea10425c54cdc17556ec4ac64930764e18710b",
"size": "4208",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-alexaforbusiness/include/aws/alexaforbusiness/model/ListSkillsResult.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "11868"
},
{
"name": "C++",
"bytes": "167818064"
},
{
"name": "CMake",
"bytes": "591577"
},
{
"name": "HTML",
"bytes": "4471"
},
{
"name": "Java",
"bytes": "271801"
},
{
"name": "Python",
"bytes": "85650"
},
{
"name": "Shell",
"bytes": "5277"
}
],
"symlink_target": ""
} |
package com.btaz.util.xml.xmlpath;
import com.btaz.util.xml.model.Element;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
* User: msundell
*/
public class XmlPathNodenameAttributeTest {
@Test
public void testOfAnyNodenameAnyAttributeShouldPass() throws Exception {
// given
String xmlPathQuery = "*[@*]";
XmlPathNodenameAttribute query = new XmlPathNodenameAttribute(xmlPathQuery);
Element element = new Element("fruit");
element.addAttribute("name", "apple");
// when
boolean result = query.matches(element);
// then
assertThat(result, is(true));
}
@Test
public void testOfSpecificNodenameAnyAttributeShouldPass() throws Exception {
// given
String xmlPathQuery = "fruit[@*]";
XmlPathNodenameAttribute query = new XmlPathNodenameAttribute(xmlPathQuery);
Element element = new Element("fruit");
element.addAttribute("name", "apple");
// when
boolean result = query.matches(element);
// then
assertThat(result, is(true));
}
@Test
public void testOfAnyNodenameSpecificAttributeNameShouldPass() throws Exception {
// given
String xmlPathQuery = "*[@name]";
XmlPathNodenameAttribute query = new XmlPathNodenameAttribute(xmlPathQuery);
Element element = new Element("fruit");
element.addAttribute("name", "apple");
// when
boolean result = query.matches(element);
// then
assertThat(result, is(true));
}
@Test
public void testOfAnyNodenameSpecificAttributeNameAndSpecificValueShouldPass() throws Exception {
// given
String xmlPathQuery = "*[@name='apple']";
XmlPathNodenameAttribute query = new XmlPathNodenameAttribute(xmlPathQuery);
Element element = new Element("fruit");
element.addAttribute("name", "apple");
// when
boolean result = query.matches(element);
// then
assertThat(result, is(true));
}
@Test
public void testOfAnyNodenameSpecificAttributeNameAndSpecificValueShouldFail() throws Exception {
// given
String xmlPathQuery = "*[@name='apple']";
XmlPathNodenameAttribute query = new XmlPathNodenameAttribute(xmlPathQuery);
Element element = new Element("fruit");
element.addAttribute("name", "pear");
// when
boolean result = query.matches(element);
// then
assertThat(result, is(false));
}
@Test(expected = XmlPathException.class)
public void testOfAnyNodenameAnyAttributeNameSpecificValueShouldThrowException() throws Exception {
// given
String xmlPathQuery = "*[@*='apple']";
// when
new XmlPathNodenameAttribute(xmlPathQuery);
// then
}
}
| {
"content_hash": "b577c73da92d39676da55c6d92529a4e",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 103,
"avg_line_length": 28.01923076923077,
"alnum_prop": 0.6437886067261496,
"repo_name": "btaz/data-util",
"id": "a65c1c340c9bb987c9b9d2d0effe7914d86b6bc2",
"size": "2914",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/com/btaz/util/xml/xmlpath/XmlPathNodenameAttributeTest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "306365"
}
],
"symlink_target": ""
} |
<?php
namespace Bitrix24\Im\Attach\Item;
use Bitrix24\Im\Attach\iAttachItem;
/**
* Class User
* @package Bitrix24\Im\Attach\Item
*/
class User implements iAttachItem
{
/**
* @var string
*/
const ATTACH_TYPE_CODE = 'USER';
/**
* @var
*/
protected $userName;
/**
* @var
*/
protected $avatarUrl;
/**
* @var
*/
protected $userLink;
/**
* User constructor.
* @param $userName string required
* @param $avatarUrl string
* @param $userLink string
*/
public function __construct($userName, $avatarUrl = null, $userLink = null)
{
$this->userName = $userName;
$this->avatarUrl = $avatarUrl;
$this->userLink = $userLink;
}
/**
* @return array
*/
public function getAttachData()
{
return array(
'NAME' => $this->userName,
'AVATAR' => $this->avatarUrl,
'LINK' => $this->userLink
);
}
/**
* @return string
*/
public function getAttachTypeCode()
{
return self::ATTACH_TYPE_CODE;
}
} | {
"content_hash": "321f04324ab5862db804f8cc1a050030",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 76,
"avg_line_length": 16.557377049180328,
"alnum_prop": 0.5811881188118811,
"repo_name": "drumrock/bitrix24-php-sdk",
"id": "0872e2c9ebe56315fd1d30462ca6b13479783528",
"size": "1273",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/classes/im/attach/item/user.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "131318"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using NPoco;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Persistence.Dtos;
using Umbraco.Core.Persistence.Factories;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Core.Persistence.SqlSyntax;
using Umbraco.Core.Scoping;
using Umbraco.Core.Services;
using static Umbraco.Core.Persistence.NPocoSqlExtensions.Statics;
namespace Umbraco.Core.Persistence.Repositories.Implement
{
/// <summary>
/// Represents a repository for doing CRUD operations for <see cref="Relation"/>
/// </summary>
internal class RelationRepository : NPocoRepositoryBase<int, IRelation>, IRelationRepository
{
private readonly IRelationTypeRepository _relationTypeRepository;
private readonly IEntityRepository _entityRepository;
public RelationRepository(IScopeAccessor scopeAccessor, ILogger logger, IRelationTypeRepository relationTypeRepository, IEntityRepository entityRepository)
: base(scopeAccessor, AppCaches.NoCache, logger)
{
_relationTypeRepository = relationTypeRepository;
_entityRepository = entityRepository;
}
#region Overrides of RepositoryBase<int,Relation>
protected override IRelation PerformGet(int id)
{
var sql = GetBaseQuery(false);
sql.Where(GetBaseWhereClause(), new { id });
var dto = Database.Fetch<RelationDto>(SqlSyntax.SelectTop(sql, 1)).FirstOrDefault();
if (dto == null)
return null;
var relationType = _relationTypeRepository.Get(dto.RelationType);
if (relationType == null)
throw new InvalidOperationException(string.Format("RelationType with Id: {0} doesn't exist", dto.RelationType));
return DtoToEntity(dto, relationType);
}
protected override IEnumerable<IRelation> PerformGetAll(params int[] ids)
{
var sql = GetBaseQuery(false);
if (ids.Length > 0)
sql.WhereIn<RelationDto>(x => x.Id, ids);
sql.OrderBy<RelationDto>(x => x.RelationType);
var dtos = Database.Fetch<RelationDto>(sql);
return DtosToEntities(dtos);
}
protected override IEnumerable<IRelation> PerformGetByQuery(IQuery<IRelation> query)
{
var sqlClause = GetBaseQuery(false);
var translator = new SqlTranslator<IRelation>(sqlClause, query);
var sql = translator.Translate();
sql.OrderBy<RelationDto>(x => x.RelationType);
var dtos = Database.Fetch<RelationDto>(sql);
return DtosToEntities(dtos);
}
private IEnumerable<IRelation> DtosToEntities(IEnumerable<RelationDto> dtos)
{
//NOTE: This is N+1, BUT ALL relation types are cached so shouldn't matter
return dtos.Select(x => DtoToEntity(x, _relationTypeRepository.Get(x.RelationType))).ToList();
}
private static IRelation DtoToEntity(RelationDto dto, IRelationType relationType)
{
var entity = RelationFactory.BuildEntity(dto, relationType);
// reset dirty initial properties (U4-1946)
entity.ResetDirtyProperties(false);
return entity;
}
#endregion
#region Overrides of NPocoRepositoryBase<int,Relation>
protected override Sql<ISqlContext> GetBaseQuery(bool isCount)
{
if (isCount)
{
return Sql().SelectCount().From<RelationDto>();
}
var sql = Sql().Select<RelationDto>()
.AndSelect<NodeDto>("uchild", x => Alias(x.NodeObjectType, "childObjectType"))
.AndSelect<NodeDto>("uparent", x => Alias(x.NodeObjectType, "parentObjectType"))
.From<RelationDto>()
.InnerJoin<NodeDto>("uchild").On<RelationDto, NodeDto>((rel, node) => rel.ChildId == node.NodeId, aliasRight: "uchild")
.InnerJoin<NodeDto>("uparent").On<RelationDto, NodeDto>((rel, node) => rel.ParentId == node.NodeId, aliasRight: "uparent");
return sql;
}
protected override string GetBaseWhereClause()
{
return "umbracoRelation.id = @id";
}
protected override IEnumerable<string> GetDeleteClauses()
{
var list = new List<string>
{
"DELETE FROM umbracoRelation WHERE id = @id"
};
return list;
}
protected override Guid NodeObjectTypeId
{
get { throw new NotImplementedException(); }
}
#endregion
#region Unit of Work Implementation
protected override void PersistNewItem(IRelation entity)
{
entity.AddingEntity();
var dto = RelationFactory.BuildDto(entity);
var id = Convert.ToInt32(Database.Insert(dto));
entity.Id = id;
PopulateObjectTypes(entity);
entity.ResetDirtyProperties();
}
protected override void PersistUpdatedItem(IRelation entity)
{
entity.UpdatingEntity();
var dto = RelationFactory.BuildDto(entity);
Database.Update(dto);
PopulateObjectTypes(entity);
entity.ResetDirtyProperties();
}
#endregion
/// <summary>
/// Used for joining the entity query with relations for the paging methods
/// </summary>
/// <param name="sql"></param>
private void SqlJoinRelations(Sql<ISqlContext> sql)
{
// add left joins for relation tables (this joins on both child or parent, so beware that this will normally return entities for
// both sides of the relation type unless the IUmbracoEntity query passed in filters one side out).
sql.LeftJoin<RelationDto>().On<NodeDto, RelationDto>((left, right) => left.NodeId == right.ChildId || left.NodeId == right.ParentId);
sql.LeftJoin<RelationTypeDto>().On<RelationDto, RelationTypeDto>((left, right) => left.RelationType == right.Id);
}
public IEnumerable<IUmbracoEntity> GetPagedParentEntitiesByChildId(int childId, long pageIndex, int pageSize, out long totalRecords, params Guid[] entityTypes)
{
// var contentObjectTypes = new[] { Constants.ObjectTypes.Document, Constants.ObjectTypes.Media, Constants.ObjectTypes.Member }
// we could pass in the contentObjectTypes so that the entity repository sql is configured to do full entity lookups so that we get the full data
// required to populate content, media or members, else we get the bare minimum data needed to populate an entity. BUT if we do this it
// means that the SQL is less efficient and returns data that is probably not needed for what we need this lookup for. For the time being we
// will just return the bare minimum entity data.
return _entityRepository.GetPagedResultsByQuery(Query<IUmbracoEntity>(), entityTypes, pageIndex, pageSize, out totalRecords, null, null, sql =>
{
SqlJoinRelations(sql);
sql.Where<RelationDto>(rel => rel.ChildId == childId);
sql.Where<RelationDto, NodeDto>((rel, node) => rel.ParentId == childId || node.NodeId != childId);
});
}
public IEnumerable<IUmbracoEntity> GetPagedChildEntitiesByParentId(int parentId, long pageIndex, int pageSize, out long totalRecords, params Guid[] entityTypes)
{
// var contentObjectTypes = new[] { Constants.ObjectTypes.Document, Constants.ObjectTypes.Media, Constants.ObjectTypes.Member }
// we could pass in the contentObjectTypes so that the entity repository sql is configured to do full entity lookups so that we get the full data
// required to populate content, media or members, else we get the bare minimum data needed to populate an entity. BUT if we do this it
// means that the SQL is less efficient and returns data that is probably not needed for what we need this lookup for. For the time being we
// will just return the bare minimum entity data.
return _entityRepository.GetPagedResultsByQuery(Query<IUmbracoEntity>(), entityTypes, pageIndex, pageSize, out totalRecords, null, null, sql =>
{
SqlJoinRelations(sql);
sql.Where<RelationDto>(rel => rel.ParentId == parentId);
sql.Where<RelationDto, NodeDto>((rel, node) => rel.ChildId == parentId || node.NodeId != parentId);
});
}
public void Save(IEnumerable<IRelation> relations)
{
foreach (var hasIdentityGroup in relations.GroupBy(r => r.HasIdentity))
{
if (hasIdentityGroup.Key)
{
// Do updates, we can't really do a bulk update so this is still a 1 by 1 operation
// however we can bulk populate the object types. It might be possible to bulk update
// with SQL but would be pretty ugly and we're not really too worried about that for perf,
// it's the bulk inserts we care about.
var asArray = hasIdentityGroup.ToArray();
foreach (var relation in hasIdentityGroup)
{
relation.UpdatingEntity();
var dto = RelationFactory.BuildDto(relation);
Database.Update(dto);
}
PopulateObjectTypes(asArray);
}
else
{
// Do bulk inserts
var entitiesAndDtos = hasIdentityGroup.ToDictionary(
r => // key = entity
{
r.AddingEntity();
return r;
},
RelationFactory.BuildDto); // value = DTO
// Use NPoco's own InsertBulk command which will automatically re-populate the new Ids on the entities, our own
// BulkInsertRecords does not cater for this.
Database.InsertBulk(entitiesAndDtos.Values);
// All dtos now have IDs assigned
foreach (var de in entitiesAndDtos)
{
// re-assign ID to the entity
de.Key.Id = de.Value.Id;
}
PopulateObjectTypes(entitiesAndDtos.Keys.ToArray());
}
}
}
public IEnumerable<IRelation> GetPagedRelationsByQuery(IQuery<IRelation> query, long pageIndex, int pageSize, out long totalRecords, Ordering ordering)
{
var sql = GetBaseQuery(false);
if (ordering == null || ordering.IsEmpty)
ordering = Ordering.By(SqlSyntax.GetQuotedColumn(Constants.DatabaseSchema.Tables.Relation, "id"));
var translator = new SqlTranslator<IRelation>(sql, query);
sql = translator.Translate();
// apply ordering
ApplyOrdering(ref sql, ordering);
var pageIndexToFetch = pageIndex + 1;
var page = Database.Page<RelationDto>(pageIndexToFetch, pageSize, sql);
var dtos = page.Items;
totalRecords = page.TotalItems;
var relTypes = _relationTypeRepository.GetMany(dtos.Select(x => x.RelationType).Distinct().ToArray())
.ToDictionary(x => x.Id, x => x);
var result = dtos.Select(r =>
{
if (!relTypes.TryGetValue(r.RelationType, out var relType))
throw new InvalidOperationException(string.Format("RelationType with Id: {0} doesn't exist", r.RelationType));
return DtoToEntity(r, relType);
}).ToList();
return result;
}
public void DeleteByParent(int parentId, params string[] relationTypeAliases)
{
var subQuery = Sql().Select<RelationDto>(x => x.Id)
.From<RelationDto>()
.InnerJoin<RelationTypeDto>().On<RelationDto, RelationTypeDto>(x => x.RelationType, x => x.Id)
.Where<RelationDto>(x => x.ParentId == parentId);
if (relationTypeAliases.Length > 0)
{
subQuery.WhereIn<RelationTypeDto>(x => x.Alias, relationTypeAliases);
}
Database.Execute(Sql().Delete<RelationDto>().WhereIn<RelationDto>(x => x.Id, subQuery));
}
/// <summary>
/// Used to populate the object types after insert/update
/// </summary>
/// <param name="entities"></param>
private void PopulateObjectTypes(params IRelation[] entities)
{
var entityIds = entities.Select(x => x.ParentId).Concat(entities.Select(y => y.ChildId)).Distinct();
var nodes = Database.Fetch<NodeDto>(Sql().Select<NodeDto>().From<NodeDto>()
.WhereIn<NodeDto>(x => x.NodeId, entityIds))
.ToDictionary(x => x.NodeId, x => x.NodeObjectType);
foreach (var e in entities)
{
if (nodes.TryGetValue(e.ParentId, out var parentObjectType))
{
e.ParentObjectType = parentObjectType.GetValueOrDefault();
}
if (nodes.TryGetValue(e.ChildId, out var childObjectType))
{
e.ChildObjectType = childObjectType.GetValueOrDefault();
}
}
}
private void ApplyOrdering(ref Sql<ISqlContext> sql, Ordering ordering)
{
if (sql == null) throw new ArgumentNullException(nameof(sql));
if (ordering == null) throw new ArgumentNullException(nameof(ordering));
// TODO: although this works for name, it probably doesn't work for others without an alias of some sort
var orderBy = ordering.OrderBy;
if (ordering.Direction == Direction.Ascending)
sql.OrderBy(orderBy);
else
sql.OrderByDescending(orderBy);
}
}
}
| {
"content_hash": "932e5fa4d2a0264635c09fde924605f4",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 168,
"avg_line_length": 42.841642228739005,
"alnum_prop": 0.5961393661441577,
"repo_name": "tcmorris/Umbraco-CMS",
"id": "56a6336f75109562953fbe1ae9c4da46f27c891b",
"size": "14611",
"binary": false,
"copies": "3",
"ref": "refs/heads/v8/dev",
"path": "src/Umbraco.Core/Persistence/Repositories/Implement/RelationRepository.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "749548"
},
{
"name": "ActionScript",
"bytes": "11355"
},
{
"name": "C#",
"bytes": "11261246"
},
{
"name": "CSS",
"bytes": "286573"
},
{
"name": "Erlang",
"bytes": "1782"
},
{
"name": "HTML",
"bytes": "497648"
},
{
"name": "JavaScript",
"bytes": "2429331"
},
{
"name": "PowerShell",
"bytes": "1212"
},
{
"name": "Python",
"bytes": "876"
},
{
"name": "Ruby",
"bytes": "765"
},
{
"name": "Shell",
"bytes": "10962"
},
{
"name": "XSLT",
"bytes": "49960"
}
],
"symlink_target": ""
} |
namespace search::fef::test {
void
SumExecutor::execute(uint32_t)
{
feature_t sum = 0.0f;
for (uint32_t i = 0; i < inputs().size(); ++i) {
sum += inputs().get_number(i);
}
outputs().set_number(0, sum);
}
SumBlueprint::SumBlueprint() :
Blueprint("mysum")
{
}
void
SumBlueprint::visitDumpFeatures(const IIndexEnvironment & indexEnv, IDumpFeatureVisitor & visitor) const
{
(void) indexEnv;
#if 1
(void) visitor;
#else
// Use the feature name builder to make sure that the naming of features are quoted correctly.
typedef FeatureNameBuilder FNB;
// This blueprint dumps 2 ranking features. This is a very tricky feature in that it's dependencies
// are given by its parameters, so the definition of features implicitly declares this tree. This
// blueprint can actually produce any number of features, but only the following 2 are ever dumped.
// The first feature this produces is "sum(value(4),value(16))", quoted correctly by the feature name
// builder. The feature "value" simply returns the value of its single parameter, so this feature will
// always produce the output "20".
visitor.visitDumpFeature(FNB().baseName("sum").parameter("value(4)").parameter("value(16)").buildName());
// The second feature is "sum(double(value(8)),double(value(32)))", again quoted by the feature name
// builder. The feature "double" returns twice the value of its single input. This means that this
// feature will always produce the output "80" (= 8*2 + 32*2).
std::string d1 = FNB().baseName("double").parameter("value(8)").buildName();
std::string d2 = FNB().baseName("double").parameter("value(32)").buildName();
visitor.visitDumpFeature(FNB().baseName("sum").parameter(d1).parameter(d2).buildName());
#endif
}
bool
SumBlueprint::setup(const IIndexEnvironment & indexEnv, const StringVector & params)
{
(void) indexEnv;
// This blueprints expects all parameters to be complete feature names, so depend on these.
for (uint32_t i = 0; i < params.size(); ++i) {
defineInput(params[i]);
}
// Produce only a single output named "out".
describeOutput("out", "The sum of the values of all parameter features.");
return true;
}
FeatureExecutor &
SumBlueprint::createExecutor(const IQueryEnvironment &queryEnv, vespalib::Stash &stash) const
{
(void) queryEnv;
return stash.create<SumExecutor>();
}
}
| {
"content_hash": "bfee97fddefab9126164324bd4c21d1b",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 109,
"avg_line_length": 35.27536231884058,
"alnum_prop": 0.6926869350862778,
"repo_name": "vespa-engine/vespa",
"id": "a6a6f86c39cd4031f5dae71d454a34ea84de25d2",
"size": "2649",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "searchlib/src/vespa/searchlib/fef/test/plugin/sum.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "8130"
},
{
"name": "C",
"bytes": "60315"
},
{
"name": "C++",
"bytes": "29580035"
},
{
"name": "CMake",
"bytes": "593981"
},
{
"name": "Emacs Lisp",
"bytes": "91"
},
{
"name": "GAP",
"bytes": "3312"
},
{
"name": "Go",
"bytes": "560664"
},
{
"name": "HTML",
"bytes": "54520"
},
{
"name": "Java",
"bytes": "40814190"
},
{
"name": "JavaScript",
"bytes": "73436"
},
{
"name": "LLVM",
"bytes": "6152"
},
{
"name": "Lex",
"bytes": "11499"
},
{
"name": "Makefile",
"bytes": "5553"
},
{
"name": "Objective-C",
"bytes": "12369"
},
{
"name": "Perl",
"bytes": "23134"
},
{
"name": "Python",
"bytes": "52392"
},
{
"name": "Roff",
"bytes": "17506"
},
{
"name": "Ruby",
"bytes": "10690"
},
{
"name": "Shell",
"bytes": "268737"
},
{
"name": "Yacc",
"bytes": "14735"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.