text
stringlengths 3
181k
| src
stringlengths 5
1.02k
|
---|---|
# File name: generaloptions.py
import kivy
kivy.require('1.7.0')
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import NumericProperty, ListProperty
class GeneralOptions(BoxLayout):
group_mode = False
translation = ListProperty(None)
def clear(self, instance):
self.drawing_space.clear_widgets()
def remove(self, instance):
ds = self.drawing_space
if len(ds.children) > 0:
ds.remove_widget(ds.children[0])
def group(self, instance, value):
if value == 'down':
self.group_mode = True
else:
self.group_mode = False
self.unselect_all()
def color(self, instance):
pass
def gestures(self, instance, value):
pass
def unselect_all(self):
for child in self.drawing_space.children:
child.unselect()
def on_translation(self,instance,value):
for child in self.drawing_space.children:
if child.selected:
child.translate(*self.translation)
| ForAP/Advanc3d-Pr0graming-Kivy-Resources/kivy-book-examples-master/Chapter_03_code/generaloptions.py |
Daerah Batu Pahat - Wikipedia
Tiganos: 1°56′00″N 103°00′00″E / 1.93333°N 103.0°Ö / 1.93333; 103.0
1°56′00″N 103°00′00″E / 1.93333°N 103.0°Ö / 1.93333; 103.0
519,800 (2014-04-07) [1]
Distrito ang Daerah Batu Pahat sa Malaysiya.[1] Nahimutang ni sa estado sa Johor, sa kasadpang bahin sa nasod, 200 km sa habagatan-sidlakan sa Kuala Lumpur ang ulohan sa nasod. Adunay 519,800 ka molupyo.[1] Daerah Batu Pahat mopakigbahin sa usa ka utlanan sa Daerah Keluang.
Mga lungsod sa Daerah Batu Pahat:
Ang klima tropikal nga kasalupan.[2] Ang kasarangang giiniton 24 °C. Ang kinainitan nga bulan Marso, sa 25 °C, ug ang kinabugnawan Enero, sa 23 °C.[3] Ang kasarangang pag-ulan 2,958 milimetro matag tuig. Ang kinabasaan nga bulan Nobiyembre, sa 352 milimetro nga ulan, ug ang kinaugahan Hunyo, sa 145 milimetro.[4]
Nahimutangan sa Daerah Batu Pahat sa Malaysiya.
↑ 1.0 1.1 1.2 Daerah Batu Pahat sa Geonames.org (cc-by); post updated 2014-04-07; database download sa 2016-10-22
Gikuha gikan sa "https://ceb.wikipedia.org/w/index.php?title=Daerah_Batu_Pahat&oldid=26498246" | c4-ceb |
"""
WSGI config for lucas project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lucas.settings")
application = get_wsgi_application()
| LucasCore/lucas-lucas/wsgi.py |
'use strict';
module.exports = function findOptions (keyList, optionalPrefixEnv) {
var options = {},
prefix = '';
if (optionalPrefixEnv) {
prefix = process.env[optionalPrefixEnv] || '';
}
keyList.forEach(function (key) {
var value = process.env[prefix + key];
if (value === undefined) {
value = process.env[prefix + key.toUpperCase()];
}
if (value !== undefined) {
options[key] = value;
}
});
return options;
} | jhugman/node-env-opt-index.js |
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright Buildbot Team Members
import inspect
class InterfaceTests(object):
# assertions
def assertArgSpecMatches(self, actual):
def filter(spec):
# the tricky thing here is to align args and defaults, since the
# defaults correspond to the *last* n elements of args. To make
# things easier, we go in reverse, and keep a separate counter for
# the defaults
args = spec[0]
defaults = list(spec[3] or [])
di = -1
for ai in xrange(len(args) - 1, -1, -1):
arg = args[ai]
if arg.startswith('_') or (arg == 'self' and ai == 0):
del args[ai]
if -di <= len(defaults):
del defaults[di]
di -= 1
return (args, spec[1], spec[2], defaults or None)
def remove_decorators(func):
try:
return func.func_original
except AttributeError:
return func
def wrap(template):
actual_argspec = filter(
inspect.getargspec(remove_decorators(actual)))
template_argspec = filter(
inspect.getargspec(remove_decorators(template)))
if actual_argspec != template_argspec:
msg = "Expected: %s; got: %s" % (
inspect.formatargspec(*template_argspec),
inspect.formatargspec(*actual_argspec))
self.fail(msg)
return template # just in case it's useful
return wrap
| mitya57/debian-buildbot-buildbot/test/util/interfaces.py |
cask 'sophos-anti-virus-home-edition' do
version :latest
sha256 :no_check
url 'https://downloads.sophos.com/home-edition/savosx_he_r.zip'
name 'Sophos Anti-Virus Home Edition'
homepage 'https://www.sophos.com/en-us/products/free-tools/sophos-antivirus-for-mac-home-edition.aspx/'
license :gratis
installer script: 'Sophos Anti-Virus Home Edition.app/Contents/MacOS/tools/InstallationDeployer', args: %w[--install]
uninstall script: {
executable: 'Sophos Anti-Virus Home Edition.app/Contents/MacOS/tools/InstallationDeployer',
args: %w[--remove],
},
launchctl: [
'com.sophos.common.servicemanager',
'com.sophos.uiserver',
],
kext: [
'com.sophos.kext.sav',
'com.sophos.nke.swi',
],
quit: 'com.sophos.ui',
delete: [
'/Applications/Remove Sophos Anti-Virus.app',
'/Applications/Sophos Anti-Virus.app',
'/Library/Extensions/SophosNetworkInterceptor.kext',
'/Library/Extensions/SophosOnAccessInterceptor.kext',
'/Library/Frameworks/SAVI.framework',
'/Library/Frameworks/SUMScanKit.framework',
'/Library/Frameworks/SophosGenericsCommon.framework',
'/Library/Frameworks/SophosGenericsCore.framework',
'/Library/LaunchAgents/com.sophos.uiserver.plist',
'/Library/Sophos Anti-Virus',
'/usr/bin/sweep',
'/usr/share/man/man1/sweep.1',
]
zap delete: [
'/Library/Application Support/Sophos',
'/Library/Preferences/com.sophos.ac.plist',
'/Library/Preferences/com.sophos.dc.plist',
'/Library/Preferences/com.sophos.mcs.plist',
'/Library/Preferences/com.sophos.sau.plist',
'/Library/Preferences/com.sophos.sav.plist',
'/Library/Preferences/com.sophos.swc.plist',
]
end
| ddm/homebrew-cask-Casks/sophos-anti-virus-home-edition.rb |
/**
* @param {number[]} nums
* @param {number} val
* @return {number}
*/
var removeElement = function(nums, val) {
var pos = -1;
while ((pos = nums.indexOf(val)) !== -1) {
nums.splice(pos, 1);
}
return nums.length;
};
console.log(removeElement([3,2,2,3], 3));
| bmxklYzj/LeetCode-2017/27/27.js |
const action = require('./action');
module.exports = {
command: 'config',
description: '配置信息查看、编辑',
options: [
['-l, --list', '显示全部配置信息'],
['-g --get', '获取配置信息'],
['-s, --set', '设置配置信息'],
['-d --delete', '删除配置信息']
],
action: action,
help: () => {
console.log(' Examples:');
console.log('');
console.log(' $ zan config -l');
console.log(' $ zan config --list');
console.log(' $ zan config -s EXTRA_PLUGINS=/path/to/extra_plugins_dir');
console.log();
}
}; | limefe/lime-cli-cmds/config/index.js |
//
// LoginViewController.h
// GetSocialTestApp
//
// Created by Sucharu hasija on 12/01/16.
// Copyright © 2016 GrambleWorld. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "LoginModel.h"
@interface LoginViewController : UIViewController
@property(strong,nonatomic)LoginModel *loginModel;
@property(weak,nonatomic)NSString * first_name;
@property(weak,nonatomic)NSString * last_name;
- (IBAction)ConnectPressed:(id)sender;
@end
| Maheepk/GetSocial-example/GetSocialTestApp/LoginViewController.h |
/**
* @file ini.h
* @brief Main function is where the program starts execution
* @created 2007-11-12
* @date 2009-02-10
*/
/*
* copyright (c) 1998-2009 TLK Games all rights reserved
* $Id$
*
* Hopy One is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Hopy One is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef _ini_h
#define _ini_h
#define TEXT_SCORE 0
#define TEXT_TIME 1
#define TEXT_LIFE 2
#define TEXT_AMMO 3
#define TEXT_START 4
#define TEXT_INSTRUCTIONS 5
#define TEXT_LOADSAVE 6
#define TEXT_CONFIGURATION 7
#define TEXT_CREDITS 8
#define TEXT_CATALOG 9
#define TEXT_ORDERING 10
#define TEXT_SCORES 11
#define TEXT_EXIT 12
#define TEXT_FILENAME 13
#define TEXT_SAVE 14
#define TEXT_LOAD 15
#define TEXT_SELECTFILE 16
#define TEXT_LEVEL 17
#define TEXT_DIE 18
#define TEXT_GAMEOVER 19
#define TEXT_HISCORE 20
#define TEXT_ENTERNAME 21
#define TEXT_LANG 22
#define TEXT_TEXT 23
#define TEXT_ANIMATION 24
#define TEXT_MUSIC 25
#define TEXT_SOUND 26
#define TEXT_MUSICVOLUME 27
#define TEXT_SOUNDVOLUME 28
extern char cfg_lang[64], cfg_text[64], cfg_animation[64];
extern char cfg_music[64], cfg_sound[64];
/* lecture du fichier de configuration du jeu */
Sint32 ReadConfigFile (void);
Sint32 ReadConfigFile2 (void);
/*! Loads the texts of the game */
void loadText (void);
void saveINI (void);
#endif
| LibreGameArchive/hopyone-src/ini.h |
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// clang-format off
import 'chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.m.js';
import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.m.js';
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {assertEquals, assertFalse, assertNotEquals, assertTrue} from '../chai_assert.js';
// clang-format on
suite('cr-lazy-render', function() {
/** @type {!CrLazyRenderElement} */
let lazy;
let bind;
suiteSetup(function() {
});
setup(function() {
const template = `
<dom-bind>
<template>
<cr-lazy-render id="lazy">
<template>
<h1>
<cr-checkbox checked="{{checked}}"></cr-checkbox>
{{name}}
</h1>
</template>
</cr-lazy-render>
</template>
</dom-bind>`;
document.body.innerHTML = template;
lazy =
/** @type {!CrLazyRenderElement} */ (document.getElementById('lazy'));
bind = document.querySelector('dom-bind');
});
test('stamps after get()', function() {
assertFalse(!!document.body.querySelector('h1'));
assertFalse(!!lazy.getIfExists());
const inner = lazy.get();
assertEquals('H1', inner.nodeName);
assertEquals(inner, document.body.querySelector('h1'));
});
test('one-way binding works', function() {
bind.name = 'Wings';
const inner = lazy.get();
assertNotEquals(-1, inner.textContent.indexOf('Wings'));
bind.name = 'DC';
assertNotEquals(-1, inner.textContent.indexOf('DC'));
});
test('two-way binding works', function() {
bind.checked = true;
const inner = lazy.get();
const checkbox = document.querySelector('cr-checkbox');
assertTrue(checkbox.checked);
checkbox.click();
assertFalse(checkbox.checked);
assertFalse(bind.checked);
});
});
| ric2b/Vivaldi-browser-chromium/chrome/test/data/webui/cr_elements/cr_lazy_render_tests.js |
$(document).ready(function () {
$("a[data-target='#signupModal']").on("click", function () {
var next = $(this).data("next") ? $(this).data("next") : "";
var user_type = $(this).data("user-type") ? $(this).data("user-type") : "";
var params = "?next=" + next + "&user_type=" + user_type;
$.colorbox({
href: "/accounts/ajax/signup/" + params,
fastIframe: false,
opacity: 0.8
});
return false;
});
$("#ajax_signup").on("click", function () {
$.ajax({
url: "/accounts/ajax/signup/",
dataType: "json",
type: "POST",
data: $("#signup_form").serialize(),
async: true,
success: function (data) {
if (data.status == "success") {
$.colorbox.close();
window.location.reload();
} else if (data.error) {
var errors = "";
$.each(data.error, function (key, value) {
errors += value + "<br/>";
});
$("#signup_error").html(errors);
$("#signup_error").show();
}
}
});
return false;
});
}); | ContributeToScience/participant-booking-app-booking/themes/flatui/static/js/ajax_signup.js |
'use strict';
const DigsSerial = require('../../lib/serial');
const digsMock = require('digs-common/test/mocks/digs');
const common = require('digs-common');
const Promise = common.Promise;
const _ = common.utils;
describe(`DigsSerial`, () => {
let sandbox;
let digs;
beforeEach(() => {
sandbox = sinon.sandbox.create('DigsSerial');
digs = digsMock(sandbox);
});
afterEach(() => {
sandbox.restore();
});
it(`should be a function`, () => {
expect(DigsSerial).to.be.a('function');
});
describe(`init()`, () => {
beforeEach(() => {
sandbox.stub(DigsSerial.fixed.methods, 'onstart')
.returns(Promise.resolve());
});
it(`should throw if not passed a Digs instance`, () => {
expect(DigsSerial).to.throw(Error);
});
it(`should fulfill if passed a Digs instance`, () => {
return expect(DigsSerial({}, digs)).to.eventually.be.fulfilled;
});
it(`should initialize an array of devices`, () => {
const devices = [
{
config: {
id: 'derp',
foo: 'bar'
}
},
{
config: {
id: 'herp',
baz: 'quux'
}
}
];
return DigsSerial({
config: devices,
autoStart: false
}, digs)
.then(ds => {
expect(ds.devices).to.be.an('object');
expect(ds.devices.derp).to.be.an('object');
expect(ds.devices.herp).to.be.an('object');
expect(ds.devices.derp.id)
.to
.equal(ds.devices.derp.config.id)
.to
.equal('derp');
expect(ds.devices.herp.id)
.to
.equal(ds.devices.herp.config.id)
.to
.equal('herp');
expect(ds.devices.derp.config.foo).to.equal(devices[0].config.foo);
expect(ds.devices.herp.config.baz).to.equal(devices[1].config.baz);
return Promise.map(_.toArray(ds.devices), device => device.stop());
});
});
describe(`if autoStart is true`, () => {
it(`should start`, () => {
return DigsSerial({}, digs)
.then(ds => {
expect(ds.state).to.equal('started');
});
});
});
describe(`if autoStart is false`, () => {
it(`should not start`, () => {
return DigsSerial({
autoStart: false
}, digs)
.then(ds => {
expect(ds.state).to.equal('stopped');
});
});
});
});
describe(`event callback`, function() {
beforeEach(() => {
this.timeout(10000);
});
describe(`onstart()`, () => {
let ds;
beforeEach(() => {
return DigsSerial({
autoStart: false,
config: {
derp: {
config: {
foo: 'bar'
}
},
herp: {
config: {
baz: 'quux'
}
}
}
}, digs)
.then(_ds => {
ds = _ds;
_.each(ds.devices,
device => sandbox.stub(device, 'start')
.returns(Promise.resolve(device)));
});
});
afterEach(() => {
return Promise.map(_.toArray(ds.devices), device => device.stop());
});
it(`should call the start() method of each DigsSerialDevice`, () => {
return expect(ds.start()).to.eventually.be.fulfilled
.then(() => {
_.each(ds.devices, device => {
expect(device.start).to.have.been.calledOnce;
});
});
});
it(`should resolve with an object containing a list of succesfully ` +
`started devices`, () => {
return expect(ds.start()).to.eventually.be.an('object')
.then(opts => {
expect(opts.startedDevices).to.be.an('array');
expect(opts.startedDevices.length).to.equal(2);
});
});
it(`should resolve with an object containing a list of failed ` +
`devices`, () => {
return expect(ds.start()).to.eventually.be.an('object')
.then(opts => {
expect(opts.failedDevices).to.be.an('array');
expect(opts.failedDevices.length).to.equal(0);
});
});
it(`should emit the new state`, () => {
const stub = sandbox.stub();
ds.once('started', stub);
expect(ds.start()).to.eventually.be.fulfilled
.then(opts => {
expect(stub).to.have.been.calledWithExactly(opts);
});
});
describe(`if failOnError is false`, () => {
beforeEach(() => {
ds.failOnError = false;
});
it(`should fulfill even if error`, () => {
return expect(ds.start()).to.eventually.be.fulfilled;
});
});
describe(`if failOnError is true`, () => {
beforeEach(() => {
ds.failOnError = true;
});
it(`should reject if error`, () => {
sandbox.restore(ds.devices.derp, 'start');
sandbox.stub(ds.devices.derp, 'start').returns(Promise.reject());
return expect(ds.start()).to.eventually.be.rejectedWith(Error)
.then(() => {
expect(ds.state).to.equal('stopped');
});
});
});
});
});
});
| digsjs/digs-serial-test/unit/serial.spec.js |
/*
*
* Modified BSD license.
*
* Based on source code copyright (c) 2010-2012 Florent Pillet,
* Copyright (c) 2012-2013 Sung-Taek, Kim <[email protected]> All Rights
* Reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. Redistributions in
* binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution. Neither the name of Sung-Tae
* k Kim nor the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
// LoggerMessage types
enum LoggerMessageType{
kMessageString = 0,
kMessageData,
kMessageImage
};
typedef enum LoggerMessageType LoggerMessageType;
// transport status key value
extern NSString * const kShowTransportStatusNotification;
extern NSString * const kShowTransportErrorNotification;
extern NSString * const kTransportTag;
extern NSString * const kTransportSecure;
extern NSString * const kTransportReady;
extern NSString * const kTransportActivated;
extern NSString * const kTransportFailed;
extern NSString * const kTransportInfoString;
extern NSString * const kTransportStatusString;
extern NSString * const kTransportError;
extern NSString * const kTransportBluetooth;
extern NSString * const kTransportBonjour;
// client status value
extern NSString * const kShowClientConnectedNotification;
extern NSString * const kShowClientDisconnectedNotification;
extern NSString * const kClientHash;
extern NSString * const kClientRunCount;
| LuoLee/NSLogger-iPad Viewer/Constants/LoggerConstModel.h |
Volksbank Düsseldorf Neuss eG Stellenangebot Sachbearbeiter EDV
Wir sind aufgeschlossen gegenüber neuen Ideen und bieten Ihnen ein hohes Maß an Eigenverantwortlichkeit. Werden Sie Teil unserer Erfolgsgeschichte und unterstützen Sie uns als Sachbearbeiter EDV (m/w/n).
Sie übernehmen mit fachlichem Know-how den überwiegend telefonischen First-Level-Support, leiten komplexe Fragestellungen zur Problemlösung an unser Rechenzentrum weiter und stellen somit eine ganzheitliche Betreuung unserer Mitarbeiter im Tagesgeschäft sicher
Sie sind für die Erstellung und Aktualisierung von Anleitungen und Dokumentationen unserer Systeme mitverantwortlich
Sie unterstützen bei der Installation von Hard- und Software, der Durchführung von Umstellungsarbeiten sowie der technischen Betreuung der IT- und SB-Geräte
Sie beschaffen Hard- und Software im Rahmen von vorgegebenen IT-Budgets
Sie schulen unsere Mitarbeiter im Umgang mit der IT
Sie unterstützen die Mitarbeiter im Rahmen der bevorstehenden Migration unseres Kernbankensystems bank21 auf agree21
Sie haben bereits erste Erfahrungen in dem beschriebenen Aufgabenbereich gesammelt und verfügen idealerweise über eine Ausbildung im IT-Bereich oder über eine Bankausbildung
Sie sind IT-affin und sicher im Umgang mit gängiger Hard- und Software
Sie besitzen gute Kenntnisse in den Microsoft-Betriebssystemen sowie in den Office-Produkten | c4-de |
//=====================================================
// File : bench_parameter.hh
// Author : L. Plagne <[email protected])>
// Copyright (C) EDF R&D, lun sep 30 14:23:16 CEST 2002
//=====================================================
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
#ifndef BENCH_PARAMETER_HH
#define BENCH_PARAMETER_HH
// minimal time for each measurement
#define REAL_TYPE float
// minimal time for each measurement
#define MIN_TIME 0.2
// nb of point on bench curves
#define NB_POINT 100
// min vector size for axpy bench
#define MIN_AXPY 5
// max vector size for axpy bench
#define MAX_AXPY 1000000
// min matrix size for matrix vector product bench
#define MIN_MV 5
// max matrix size for matrix vector product bench
#define MAX_MV 3000
// min matrix size for matrix matrix product bench
#define MIN_MM 5
// max matrix size for matrix matrix product bench
#define MAX_MM MAX_MV
// min matrix size for LU bench
#define MIN_LU 5
// max matrix size for LU bench
#define MAX_LU 3000
// max size for tiny vector and matrix
#define TINY_MV_MAX_SIZE 16
// default nb_sample for x86 timer
#define DEFAULT_NB_SAMPLE 1000
// how many times we run a single bench (keep the best perf)
#define DEFAULT_NB_TRIES 3
#endif
| dcherian/tools-eigen/bench/btl/generic_bench/bench_parameter.hh |
TROLLECH - Synové lesù | Metalopolis
Zveøejnìno: 5. záøí 2002
Zaøazení: Recenze, Diskuse: 8 pøíspìvkù, Hodnoceno: 11x, Zveøejnìno: 5. záøí 2002
To mi takhle jednou velectìný Morbivod zaslal pìt cédéèek. Pøi zbìžném surfování po stránkách všech jeho tøí projektù mi klesala èelist. Tøi projekty, tøi zcela originální svìty, každý vydává nový materiál jednou roènì. Lord Morbivod tedy do roka vydá za rùzné kapely tøi cédéèka, která dohromady dávají vìtšinou tak 160 minut. Pøesnì takhle si pøedstavuji workholika. V této recenzi vám nastíním asi nejménì originální z jeho projektù (ostatní pøíštì), a sice Trollech. Nejménì originální? To byste museli znát Stíny plamenù a Umbrtku, aby jste vìdìli, co tím myslím, protože tyto dva projekty jsou tak šílené, že kdo je zná, tomu už nemùže nic dalšího pøijít originální.
Co je Trollech? Je to striktnì apolitický projekt, který se celý toèí kolem uctívání pøírody a je v nìm i notná dávka recese (takové "veršotepecké skvosty" a slovní høíèky jako Zatrollené hvozdy nebo Lesní blackotání se hned tak nevidí). Trollech je temná lesní øíše pod hradem Radyní plná trollù, skøítkù, podivných elfù a roztodivných kreatur. Øíše, která žije nezávisle na politice tohoto státu, nezávisle na náboženství, nezávisle na všem. A pouze ètyøi strážci této øíše se starají o to, aby se o ní nikdo, kdo by toho mohl zneužít, nedozvìdìl (tedy všichni, kromì Trollech fans :) . Tìmi ètyømi strážci jsou brutálnì kníratý elf Johannes, Asura Boživálka Paprsek Gorgony, Lord Morbivod a skøet Duchmaus ze støíbra - prostì ètyøi jezdci z Apokalypsy.
Pøichází vìk pohanského lesního black metalu... nezapomeòte, že skøítkové vždy ví, co potøebujete, když vás schvátí zlá nemoc!
Po hudební stránce není Trollech vùbec špatný. Ne že by šlo zase o nìjakou špièku, bicí automat je obèas slyšet až moc, ale vìtšinou plní svou úlohu dobøe a neruší. Kytary jsou pomìrnì jednoduché, ale chytlavé a nápadité. Obèas se mihne bathoryovské brnkání na španìlky. Zato co se týèe vokálù - Morbivod má nádhernì vyjeèené vichøicovitý hlas, jeden z nejlepších v ÈR zcela jistì. Z kvalitního celku vyboèuje hlavnì podivná Scem lem Duib - to musíte prostì slyšet. Mì chytaly køeèe smíchy, doufám, že to byl zámìr. Jestli ne, tak mì to mrzí. Dále se jako dub vprostøed hvozdu tyèí krásnì ujeèená Pod hradem Radyní a Skøet Duchmaus ze støíbra s brutálnì chytlavým refrénem. Na Trollech je zajímavé, že si nìkteré verše budete stále opakovat, což je vzhledem k | c4-cs |
// mock for 'file-saver' npm module
export const saveAs = (blob, fileName) => {
global.__lastSavedFileBlob__ = blob
global.__lastSavedFileName__ = fileName
}
| Opentrons/labware-protocol-designer/cypress/mocks/file-saver.js |
//-----------------------------------------------
//
// This file is part of the Siv3D Engine.
//
// Copyright (c) 2008-2018 Ryo Suzuki
// Copyright (c) 2016-2018 OpenSiv3D Project
//
// Licensed under the MIT License.
//
//-----------------------------------------------
# pragma once
# include <utility>
# include <Siv3D/Fwd.hpp>
# include <Siv3D/Array.hpp>
namespace s3d
{
class ISiv3DClipboard
{
public:
static ISiv3DClipboard* Create();
virtual ~ISiv3DClipboard() = default;
virtual bool init() = 0;
virtual bool hasChanged() = 0;
virtual bool getText(String& text) = 0;
virtual bool getImage(Image& image) = 0;
virtual bool getFilePaths(Array<FilePath>& paths) = 0;
virtual void setText(const String& text) = 0;
virtual void setImage(const Image& image) = 0;
virtual void clear() = 0;
};
}
| azaika/OpenSiv3D-Siv3D/src/Siv3D/Clipboard/IClipboard.hpp |
//=require core-min.js
//=require md5-min.js
var md5 = function(value) {
return CryptoJS.MD5(value).toString();
}
var global = {};
//=require ../node_modules/dateformat/lib/dateformat.js
(global);
var dateformat = global.dateformat;
var app = angular.module('myApp', []);
//=require helpers.js
//=require myEnter-Directive.js
//=require myEsc-Directive.js
//=require myModal-Directive.js
//=require focusOnShow-Directive.js
//=require script.js
//=require main-Controller.js
//=require loginTab-Controller.js
//=require demoModal-Controller.js
//=require topMenu-Controller.js
//=require myDevicesContent-Controller.js
//=require myDevicesNavi-Controller.js
//=require resetPasswordContent-Controller.js
//=require knowledgeBaseContent-Controller.js
//=require messageContent-Controller.js
//=require userPaymentsContent-Controller.js
//=require userPaymentsNavi-Controller.js
//=require userSettingsContent-Controller.js
//=require userSettingsNavi-Controller.js
//=require pricingPlans-Controller.js
//=require acceptPricingModal-Controller.js | nmalex/DSTNAT-Trunk/Site/App/js/myApp.js |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import uuid
class Migration(migrations.Migration):
dependencies = [
('authors', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='profile',
name='displayname',
field=models.CharField(max_length=128, blank=True),
preserve_default=True,
),
migrations.AddField(
model_name='profile',
name='host',
field=models.CharField(max_length=32, blank=True),
preserve_default=True,
),
migrations.AddField(
model_name='profile',
name='uuid',
field=models.CharField(default=uuid.uuid1, max_length=32),
preserve_default=True,
),
]
| CMPUT410W15T02/CMPUT410W15-project-social_distribution/authors/migrations/0002_auto_20150301_2125.py |
pat = raw_input()
n = int(raw_input())
for _ in range(n):
s = raw_input()
if '*' in pat:
a, b = pat.split('*')
ok = len(a+b) <= len(s) and s.startswith(a) and s.endswith(b)
else:
ok = s == pat
if ok:
print('Passar')
else:
print('Passar ekki')
| SuprDewd/epsilon-example_contests/fk_2014_beta/problems/tonlist/submissions/accepted/solution.py |
#ifndef _CX18_MAILBOX_H_
#define _CX18_MAILBOX_H_
/* mailbox max args */
#define MAX_MB_ARGUMENTS 6
/* compatibility, should be same as the define in cx2341x.h */
#define CX2341X_MBOX_MAX_DATA 16
#define MB_RESERVED_HANDLE_0 0
#define MB_RESERVED_HANDLE_1 0xFFFFFFFF
#define APU 0
#define CPU 1
#define EPU 2
#define HPU 3
struct cx18;
struct cx18_mdl_ack {
u32 id; /* ID of a completed MDL */
u32 data_used; /* Total data filled in the MDL with 'id' */
};
struct cx18_mailbox {
/* The sender sets a handle in 'request' after he fills the command. The
'request' should be different than 'ack'. The sender, also, generates
an interrupt on XPU2YPU_irq where XPU is the sender and YPU is the
receiver. */
u32 request;
/* The receiver detects a new command when 'req' is different than 'ack'.
He sets 'ack' to the same value as 'req' to clear the command. He, also,
generates an interrupt on YPU2XPU_irq where XPU is the sender and YPU
is the receiver. */
u32 ack;
u32 reserved[6];
/* 'cmd' identifies the command. The list of these commands are in
cx23418.h */
u32 cmd;
/* Each command can have up to 6 arguments */
u32 args[MAX_MB_ARGUMENTS];
/* The return code can be one of the codes in the file cx23418.h. If the
command is completed successfuly, the error will be ERR_SYS_SUCCESS.
If it is pending, the code is ERR_SYS_PENDING. If it failed, the error
code would indicate the task from which the error originated and will
be one of the errors in cx23418.h. In that case, the following
applies ((error & 0xff) != 0).
If the command is pending, the return will be passed in a MB from the
receiver to the sender. 'req' will be returned in args[0] */
u32 error;
};
struct cx18_stream;
struct cx18_api_func_private {
struct cx18 *cx;
struct cx18_stream *s;
};
int cx18_api(struct cx18 *cx, u32 cmd, int args, u32 data[]);
int cx18_vapi_result(struct cx18 *cx, u32 data[MAX_MB_ARGUMENTS], u32 cmd,
int args, ...);
int cx18_vapi(struct cx18 *cx, u32 cmd, int args, ...);
int cx18_api_func(void *priv, u32 cmd, int in, int out,
u32 data[CX2341X_MBOX_MAX_DATA]);
void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu);
void cx18_in_work_handler(struct work_struct *work);
#endif
| luckasfb/OT_903D-kernel-2.6.35.7-kernel/drivers/media/video/cx18/cx18-mailbox.h |
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var enu = {
//values: 'opening open closing closed'.split(' '),
values: 'matched notmatched dismissed'.split(' '),
message: 'enum validator failed for path `{PATH}` with value `{VALUE}`'
};
/**
* Author Schema
*/
var AuthorSchema = new Schema({
created: {
type: Date,
default: Date.now
},
idSource: {
type: String,
default: '',
trim: true,
},
prefered: {
type: String,
default: '',
trim: true,
required: 'Prefered name cannot be blank'
},
date: {
type: String,
default: '',
trim: true
},
updated: {
type: Date,
default: Date.now
},
names: {
type: String,
default: '',
trim: true
},
dateName: {
type: String,
default: '',
trim: true
},
viaf: {
type: String,
default: '',
trim: true
},
revised: {
type: Boolean,
default: false
},
user: {
type: Schema.ObjectId,
ref: 'User'
},
state: {
type: String,
enum: enu,
default: 'notmatched'
}
});
mongoose.model('Author', AuthorSchema);
| hibernator11/matchpoint-app/models/author.server.model.js |
boiler extension stress
# boiler extension stress
### Corrosion Fatigue in Boiler Tubes – Thielsch Engineering
Corrosion Fatigue in Boiler Tubes – Thielsch Engineering
### BoilerTubeTesting.com Boiler Tubes, Corrosion, Stress
4 Reasons for Water Leakage Around a Boiler | DoItYourself.com
### Why thermal expansion is necessary in Boilers
Corrosion Fatigue in Boiler Tubes – Thielsch Engineering
### How to Destroy a Boiler -- Part 1
May 30, 2020 · Why thermal expansion is necessary in Boilers Boiler expansion calculation Provisions for thermal expansions in boilers: Precaution to be taken for boiler free expansion: 3.Excess chain extension. Change in temperature of a free body causes body to expand & contract without inducing stress. When the deformation of the body is restricted
### 4 Reasons for Water Leakage Around a Boiler | DoItYourself.com
Oct 28, 2018 · Corrosion fatigue (sometimes referred to as stress enhanced corrosion fatigue) relates to the operation of a boiler. In particular, it relates to thermal cycling of the waterwall tubes (and the resultant expansion and contraction of the tubes), in conjunction with …
### Finding the Root Cause of Boiler Tube Failures
Although the effects of thermally induced stress cycling can be seen in various types of boilers (e.g., firetube, cast-iron sectional and watertube), this article will be limited to an explanation of the failure mechanism and preventive measures in horizontal firetube boilers of the Scotch and firebox types.
### Stress in Steam Boiler Shells from Boiler Pressure
The stress in a steam boiler shell can be calculated as. σ = P D / 2 t (1) where. σ = hoop stress (Pa, N/m2) P = boiler pressure (Pa, N/m2) D = diameter of boiler shell (m) t = thickness of boiler shell (m) Sponsored Links. Pipe Sizing - Sizing steam and condensate pipes - …
### Boiler Corrosion - Causes,Effects and How to Prevent it
Another hidden steam boiler tube failure is stress cracking corroison or embrittlement corrosion, or caustic embrittlement corrosion. When it is about corrosion of this type it can be dangerous. Boiler tube failure of a steam boiler tube isa significant cause of commerial, industrial, and … | finemath-3plus |
In a recent blog post, Karen Coe referred to Conrad Wolfram’s opinion that programming is to mathematics what composition is to English. I’ve taught programming and written a lot of Sketchpad code, and I appreciate Wolfram’s analogy. In English class, students read books, poems, short stories, essays, and articles—but to gain a deep appreciation for literature , they must write as well. By composing their own stories, poems, and essays, students come to appreciate the beauty of a well-crafted sentence, the emotional impact of alliteration, the convincing nature of a closely-reasoned argument.
Wolfram is on the right track—to deeply understand and appreciate mathematics, students should not only read mathematics, but write it as well. Mathematics should be to them more than received wisdom; it should be a creative process. Creativity was a major objective when I taught AP Computer Science. I wanted students to take pride in the logical process of doing a project, and joy in having created something new and useful and even beautiful.
Recursive Logo program and sample output (see note below)
Programming is an excellent vehicle for mathematical activities. It’s profoundly logical in nature, resting on a well-defined set of rules and the combining of elements in carefully thought-out ways to build up more and more complex structures on the way to a finished program. It has explicit built-in support for conceptual abstraction (procedures and functions) and mathematical iteration (while and for loops as well as recursive procedures). The Logo program here, for instance, uses a recursive procedure called inspi to define the on-screen path of an imaginary turtle.
But programming isn’t available—or of interest—to many of our students. A few students (predominantly boys) take to it enthusiastically, but others find it too solitary, too impersonal, or too difficult, and most students have neither inclination nor opportunity to undertake interesting and satisfying projects. Even as I agreed with Wolfram’s analogy, I couldn’t help but think of another analogy that is, I think, both more accessible to students and more closely related to their math class: Dynamic geometry construction is to mathematics as composition is to English.
With Sketchpad, as with a word processor, students can start with a blank screen and combine the software’s basic objects to assemble, manipulate, review, share, and revise a complex creation. They can write their own mathematical compositions. Although the visual nature of Sketchpad makes it feel very different from a programming language, it is similarly logical, and it too provides mechanisms for conceptual abstraction (custom tools) and for mathematical iteration (the Iterate command). As this movie shows, it’s not hard to use the Iterate command to rewrite the above Logo program in Sketchpad.
As in this example, students can write a Sketchpad short story about geometric shapes. They can set the stage by constructing and transforming a segment, elaborate using mathematical iteration, and develop characters and plot by changing the initial parameters and increasing the number of repetitions. They can bring the story to a climax by making and testing conjectures, and share their finished work using Hot Text and Action Buttons.
The Logo program implemented in Sketchpad, with a description, input parameters (1, 12), and resulting output
This is not the way teachers are used to teaching, nor the way students are used to learning. It is challenging for both—students’ initial mathematical writings will contain the equivalents of spelling errors and ungrammatical constructions, and teachers will struggle as they support student inquiry. English teachers are undeterred by such problems; so should we be as math teachers. If we help our students learn to write mathematics more creatively, who among us can imagine all the topics they will write about, the originality they will bring to their writing, and the compositions they will produce?
If you are new to Sketchpad, you might take a first step of learning to use the software to develop your own mathematical writing skills. All of the Getting Started Tutorials, and many of the activities in Sketchpad LessonLink and the Sketchpad Curriculum Modules, begin with blank screens and include step-by-step instructions. As our English colleagues can tell us, such guided composition exercises provide useful scaffolding to help students build the skills and confidence to become creative writers of mathematics.
Or if you’re already familiar with Sketchpad, take this challenge: Write your own Sketchpad construction to do the same mathematics as the Logo program shown in the first image. If you need scaffolding, download this pdf with step-by-step instructions. The heart of the challenge comes when the construction is done—try a variety of input values and observe the resulting shapes. Continue your investigation and analysis until you understand and can explain how the input values determine the shape. Be sure to check your conjecture by predicting shapes for various inputs and testing those predictions.
Note: The Logo program referenced above is adapted from Al Cuoco, Paul Goldenberg, and June Mark: “Habits of Mind: An Organizing Principle for Mathematics Curriculum” (J. Mathematical Behavior 15(4):375-402, December, 1996).
Scott Steketee taught secondary math and computer science in Philadelphia for 18 years and received the district's Teacher of Excellence award. Since 1992 he has worked on Sketchpad software, curriculum, and professional development for Key Curriculum Press and KCP Technologies. He also teaches Secondary Math Methods in the graduate teacher education program at the University of Pennsylvania.
This entry was posted in Math Software and tagged , , , , , . Bookmark the permalink.
### 2 Responses to Writing Mathematics with Sketchpad
1. David Wees says:
It really looks like Sketchpad has improved a lot since I used it 5 years ago (duh!). I guess I should give it another look.
I’ve heard the analogy of the math class being compared to the English class a few times. It definitely gets people thinking about how we need to change the math class…
• Margaret Patterson says:
This blog post is serendipitous in its timing. I’ve just been mentally constructing the second semester project for my Precalculus class and what I had decided upon was that each student would create some sort of machine in sketchpad (like a grandfather clock, ferris wheel, da vinci machine, etc).
I have been using Sketchpad for a long time, but do not consider myself an expert, so the following excerpt spoke to me:
“It is challenging for both—students’ initial mathematical writings will contain the equivalents of spelling errors and ungrammatical constructions, and teachers will struggle as they support student inquiry. English teachers are undeterred by such problems; so should we be as math teachers. ”
It is a little frightening to think that I will be assigning something to my class that I’m not entirely sure how to do myself. I think it is important and valuable, though, so I’ll do it anyway.
The next problem I face is in terms of the exact wording of the task and the assessment of the task. How can I clearly outline expectations (which is important) when I don’t yet know how this will play out? How will I then assess the work of students in an equitable way?
If anyone has experience with this that they could share (in the form of past project descriptors and/or rubrics) or just some thoughts about it, they would be appreciated. | finemath-3plus |
/*
* Copyright (C) 2015 The Casser Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.noorq.casser.config;
import java.lang.reflect.Method;
import java.util.function.Function;
public enum GetterMethodDetector implements Function<Method, Boolean> {
INSTANCE;
@Override
public Boolean apply(Method method) {
if (method == null) {
throw new IllegalArgumentException("empty parameter");
}
if (method.getParameterCount() != 0 || method.getReturnType() == void.class) {
return false;
}
return true;
}
}
| noorq/casser-src/main/java/com/noorq/casser/config/GetterMethodDetector.java |
package com.foo;
@DemoRepository
public class TestRepository {
public String testMethod() {
return "hello world";
}
}
| jadekler/git-misc-2-java-annotations-testing/src/test/java/com/foo/TestRepository.java |
#/datastore/zhenyang/bin/python
import sys
import os
import gensim, logging
import numpy as np
import scipy.io as sio
def main():
##############
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
#pretrained_model = './vectors.bin'
#pretrained_model = '../freebase-vectors-skipgram1000-en.bin'
#pretrained_model = '../GoogleNews-vectors-negative300.bin'
#model = gensim.models.Word2Vec.load_word2vec_format(pretrained_model, binary=True)
#pretrained_model = './vectors.output'
pretrained_model = '../yahoo_100m_words_30d.output'
model = gensim.models.Word2Vec.load_word2vec_format(pretrained_model, binary=False)
##############
classnames = open('AwA-attrs.txt', 'r').read().splitlines()
cc = 0
clsid = 0
vec_size = 30
word2vec_mat = np.zeros((len(classnames), vec_size))
for classname in classnames:
idc = 1
wordvec = np.zeros(vec_size)
for cls_word in classname.split('+'):
try:
wordvec = np.add(wordvec, model[cls_word])
idc = 0
except:
print cls_word
idc = 1
break
word2vec_mat[clsid, :] = wordvec
clsid = clsid + 1
cc = cc + idc
np.savetxt('AwA_attrs_word2vec_yahoo_30d.txt', word2vec_mat)
sio.savemat('AwA_attrs_word2vec_yahoo_30d.mat', {'word2vec':word2vec_mat})
print cc
if __name__ == "__main__":
main() | mathrho/word2vec-extractVecMat_AwA-attrs.py |
Online neural connectivity estimation with ensemble stimulation
Anne Draelos1*, Eva A. Naumann2, John M. Pearson1,2,3
**1** Department of Biostatistics & Bioinformatics, Duke University, Durham, NC, USA
**2** Department of Neurobiology, Duke University, Durham, NC, USA
**3** Department of Electrical & Computer Engineering, Duke University, Durham, NC, USA
* [email protected]
## Abstract
One of the primary goals of systems neuroscience is to relate the structure of neural circuits to their function, yet patterns of connectivity are difficult to establish when recording from large populations in behaving organisms. Many previous approaches have attempted to estimate functional connectivity between neurons using statistical modeling of observational data, but these approaches rely heavily on parametric assumptions and are purely correlational. Recently, however, holographic photostimulation techniques have made it possible to precisely target selected ensembles of neurons, offering the possibility of establishing direct causal links. Here, we propose a method based on noisy group testing that drastically increases the efficiency of this process in sparse networks. By stimulating small ensembles of neurons, we show that it is possible to recover binarized network connectivity with a number of tests that grows only logarithmically with population size under minimal statistical assumptions. Moreover, we prove that our approach, which reduces to an efficiently solvable convex optimization problem, can be related to Variational Bayesian inference on the binary connection weights, and we derive rigorous bounds on the posterior marginals. This allows us to extend our method to the streaming setting, where continuously updated posteriors allow for optional stopping, and we demonstrate the feasibility of inferring connectivity for networks of up to tens of thousands of neurons online. Finally, we show how our work can be theoretically linked to compressed sensing approaches, and compare results for connectivity inference in different settings.
## Introduction
A long-standing problem in systems neuroscience is that of inferring the functional network structure of a population of neurons from its neural activity. That is, given a set of neural recordings, we would like to know which neurons influence which others in the system without _a priori_ knowledge of their anatomical connectivity. This problem is made difficult in two ways: First, new techniques in microscopy and neural probe technology have dramatically increased the size of recorded neural populations [1, 2, 3, 4], posing a computational challenge. Second, the fact that typical interventions in these systems remain broad and non-specific poses problems for causal inference [5, 6, 7].
However, recent advances in precision optics and opsin engineering have resulted in photostimulation tools capable of precisely targeting individual neurons and neuronal ensembles [8, 9, 10, 11, 12]. This suggests that a combination of simultaneous recording and _selective_ stimulation could potentially allow for functional dissection of large-scale neural circuits. Yet the most common methods for inferring functional connectivity are purely statistical models, applied to observational data [13, 14]. They do not consider causal inferences based on interventions (though cf. [15, 16, 17]), and often make stringent parametric assumptions, which can limit their ability to recover connectivity even in simulations [18, 19].
Here, we take a different approach to inferring functional connectivity based on targeted stimulation of small, randomly-chosen neural ensembles. We adopt the framework of group testing [20, 21, 22], an experimental design strategy that relies on simultaneous tests of multiple items. Group testing reduces the complexity of detecting rare defects (here, true connections) from linear to logarithmic in the number of units, allowing it to scale to large neural populations. We show that this approach, which makes only mild statistical assumptions, can be significantly more efficient than testing single neurons in isolation. Furthermore, we propose an efficient convex relaxation of the inference problem that is related to marginal Bayesian posteriors for the existence of individual connections. Finally, we show that an optimization scheme based on dual decomposition offers a highly parallelizable, GPU-friendly problem formulation that allows us to perform inference on a population of \(10^{4}\) neurons in the online setting. Taken together, these ideas suggest new algorithmic possibilities for the adaptive, online dissection of large-scale neural circuits.
## Methods
### Network inference as group testing
Our goal is to recast the problem of inferring _functional_ connectivity between neurons as a group testing problem. This functional connectivity has only to do with the ability of one neuron to cause changes in the activity of another and does not imply a direct synaptic connection. Thus, two neurons may be functionally connected when no direct synaptic connection exists. In particular, we are not addressing the problem of unobserved confounders--unrecorded neurons that mediate observed interactions. Nonetheless, functional connectivity remains a quantity of intense interest, since it is likely to reflect patterns of influence and information flow in neural circuits [23, 24].
To establish conventions, it will help to consider a simple baseline protocol for establishing functional connectivity: let each test consist of stimulating a single neuron, with the test possibly repeated several times. In this setup, a stimulated neuron \(i\) can be considered functionally upstream of a second neuron \(j\) if \(j\) typically alters its activity in response to stimulation of \(i\). More precisely, we assume that there exists a test \(h:\mathcal{D}\rightarrow\{0,1\}\) that concludes from data whether stimulation of \(i\) altered activity in \(j\). This approach has two important advantages: First, we do not need to assume that excitation of \(i\) results in excitation of \(j\), only that the test detects a difference. In other words, we are not limited to excitatory connections. Second, while a given test might make parametric assumptions about the data, our subsequent analysis will be agnostic to these assumptions. Thus the ability to consider a multiplicity of tests offers us a degree of statistical flexibility not present in approaches that must rely on, e.g., linearity of synaptic contributions from different neurons. But these benefits imply a tradeoff: we will only be able to amass statistical evidence for the _existence_ of such connections, and possibly their signs, but not their relative strength. We view this as a reasonable tradeoff in cases where the structure of connections is of primary concern, with the added observation that, once connections are identified, a second round of more focused testing or post-hoc methods can serve to establish strengths.
To model the effects of ensemble photostimulation, we assume that all neurons in the target set receive roughly the same light intensity, and that this intensity is sufficient to evoke a detectable response if any one of the neurons is connected to some other. Moreover, we assume that stimulation is strong enough that even, in cells receiving mixed excitatory and inhibitory connections, one will predominate. That is, given \(N\) observed neurons subjected to stimulations indexed by \(t\), let \(\mathsf{x}_{tj}=1\) if neuron \(j\) is stimulated on round \(t\), and \(\mathsf{w}_{i\to j}=1\) if neuron \(i\) functionally influences neuron \(j\). With these conventions, we define the predicted activation of unit \(i\) as the logical OR of all the connections
\[\mathsf{a}_{ti}(\mathsf{w})=\bigvee_{j=1}^{N}\mathsf{w}_{ij}\mathsf{x}_{tj}= \max(\mathsf{w}_{i.}\odot\mathsf{x}_{t.}) \tag{1}\]
and the outcome of the hypothesis test \(h\) with false positive rate \(\alpha\) and false negative rate \(\beta\) as
\[\mathsf{y}_{ti}|(\mathsf{a}_{ti}=1)\sim\text{Bern}(1-\beta) \mathsf{y}_{ti}|(\mathsf{a}_{ti}=0)\sim\text{Bern}(\alpha)\,. \tag{2}\]
Note that this assumes \(\mathsf{a}\) is a sufficient statistic for the outcome \(\mathsf{y}\), which may not hold if, e.g., false positive rates increase with the number of stimulated neurons [22].
This formulation, in which multiple units are combined into a single test that returns a positive result if any of the individual units would alone, is known as the group testing problem. Originally devised by Dorfman [20] as an efficient means of testing for syphilis in soldiers, group testing has spawned an enormous literature, with applications in medicine, communications, and manufacturing (recently reviewed in [22]). As shown by Atia and Saligrama [25], this can be cast in the language of information theory as a channel coding problem with \(\mathsf{x}\) the codebook and \(\mathsf{y}\) the channel output. Moreover, [25] demonstrated that when \(\mathsf{x}\) is a randomized testing strategy to find \(K\) true positives, the number of tests required to solve the problem with exponentially small average-case error is both upper and lower bounded asymptotically by \(K\log N\), even when tests are noisy and \(K\sim o(N)\).
The problem we consider here is more specifically one of noisy group testing in the sparse regime. That is, we allow the test to be corrupted as specified in (2) and assume \(K\sim\mathcal{O}(N^{\theta})\) with \(\theta\in(0,1)\). Within this regime, approaches principally differ along two axes: adaptive versus non-adaptive test designs and the method used to infer \(\mathsf{w}\). In non-adaptive designs, the tests are fixed in advance, allowing them to be run in parallel at the cost of some statistical efficiency (though not necessarily asymptotically [26, 27]). Adaptive designs, by contrast, are chosen sequentially, often to optimize the information gained with each test. Below, we consider both methods, but for the remainder of this section and the next, we focus on the second axis: the method of inferring \(\mathsf{w}\).
For simplicity we focus on a single output neuron \(j\) and its potential incoming connections \(\mathsf{w}_{ij}\) (see Fig. 1). Since the inference problems for \(\mathsf{w}_{ij}\) and \(\mathsf{w}_{ij^{\prime}}\) are completely independent for \(j^{\prime}\neq j\), these problems can be trivially parallelized, and we drop the index \(j\) in what follows. Given (1) and (2), we can infer the true connections by maximizing the total log likelihood over all \(T\) tests:
\[\log p(\{\mathsf{y}_{t}\}|\{\mathsf{w}_{i},\mathsf{x}_{t}\}) =T\log(1-\alpha)-\log\frac{1-\alpha}{\alpha}\sum_{t}\mathsf{y}_{t} \tag{3}\] \[\quad-\log\frac{1-\alpha}{\beta}\sum_{t}\mathsf{a}_{t}(\mathsf{w })+\log\frac{(1-\alpha)(1-\beta)}{\alpha\beta}\sum_{t}\mathsf{y}_{t}\mathsf{a }_{t}(\mathsf{w})\] \[=\sum_{t}\left[\log\frac{(1-\alpha)(1-\beta)}{\alpha\beta} \mathsf{y}_{t}-\log\frac{1-\alpha}{\beta}\right]\mathsf{a}_{t}(\mathsf{w})+ \text{const}\;,\]where the constant does not depend on \(\mathsf{w}\). For any reasonable test, we expect \(1-\beta>\alpha\) (i.e., the true positive rate exceeds the false positive rate) and \(1-\alpha>\beta\) (true negative rate exceeds false negative rate), so that the term in brackets is positive when \(\mathsf{y}_{t}=1\) and negative when \(\mathsf{y}_{t}=0\). Thus the maximum likelihood solution is one in which the bits \(\mathsf{a}_{t}(\mathsf{w})\) and \(\mathsf{y}_{t}\) most often match, similar to one-bit compressed sensing [28, 29].
Unfortunately, this integer programming problem is NP-hard in general [22], so approximate solution methods must be used. Previous approaches have used Monte Carlo methods like Gibbs Sampling [30] and message-passing approaches like Belief Propagation [22, 31]. A third class of approaches [29] proposes to relax the binary variables \(\mathsf{w}_{i}\in\{0,1\}\to w_{i}\in[0,1]\) and solve a linear program to minimize
\(\sum_{i}w_{i}+\gamma\sum_{t}\xi_{t}\), with the \(\xi_{t}\) slack variables representing noise (bit flips between \(\mathsf{y}_{t}\) and \(\mathsf{a}_{t}\)) and \(\gamma\) parameterizing the sparsity of the solution. This method indeed performs well in practice [22, 29] and makes no assumptions about the form of the noise, though it does require tuning \(\gamma\), which may be difficult when the true number of defects \(K\) is unknown.
Here, we propose an alternate relaxation based on independently relaxing the variables \(\mathsf{a}_{t}\to a_{t}\) and relating these to the \(w_{i}\) via constraints. That is, instead of the \(N+T\) variables \(\{w_{i},\xi_{t}\}\), we will choose to optimize over \(\{w_{i},a_{t}\}\), solving
\[\max_{\{w_{i},a_{t}\}}\,\sum_{t}c_{t}a_{t}\quad\text{ subject to }\quad\mathsf{x}_{t i}w_{i}\leq a_{t}\leq\sum_{i}\mathsf{x}_{ti}w_{i},\quad w_{i},a_{t}\in[0,1] \tag{4}\]
with \(c_{t}=\log\frac{(1-\alpha)(1-\beta)}{\alpha\beta}\mathsf{y}_{t}-\log\frac{1- \alpha}{\beta}\). The constraints we impose on the new variables \(a_{t}\) can be understood from (1) by noting that the maximum of a set of positive variables must be greater than or equal to each of them individually and at most equal to their sum. As we will show, this linear program in \(N+T\) variables with \(\sum_{ti}\mathsf{x}_{ti}+T\) constraints may be large (and grows with the number of tests) but can nonetheless be solved efficiently even for sizable neural populations. Unfortunately, there is no guarantee that the solution to (4) produces a solution to the original integer optimization problem, and one is left with the problem of finding some method of rounding \(w_{i}\) to produce a binary solution [32]. Fortunately, as we will argue below, this is unnecessary, and a slight alteration to (4) gives the \(w_{i}\) an attractive interpretation. | 2007.13911v2.mmd |
/*
* Copyright 2013~2015 Dan Haywood
*
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.isisaddons.wicket.pdfjs.app;
public final class PdfjsAppModule {
private PdfjsAppModule(){}
}
| isisaddons/isis-wicket-pdfjs-app/src/main/java/org/isisaddons/wicket/pdfjs/app/PdfjsAppModule.java |
//
// LJMusicsViewController.h
// 01-刘静的音乐
//
// Created by 刘静 on 15/11/2.
// Copyright © 2015年 liujing.cn. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface LJMusicsViewController : UITableViewController
@end
| LJ469836293/liujingMusic-01-刘静的音乐/01-刘静的音乐/Classes/Controller/LJMusicsViewController.h |
Meditation and mindfulness seems like the new buzzword: mindfulness for toddlers, mindfulness in 8 weeks, 3 days to mindful, etc! But mindfulness is actually a really old practice, and I first encountered it more than twenty years ago in the books of Thich Nhat Hanh. Also called Thay by his students, he was nominated for the Nobel Peace Prize by Martin Luther King, Jr in the 1960’s. He teaches that mindfulness is a practice that you bring everywhere- while you’re walking, doing the dishes, etc, and not only sitting cross-legged on a mat. Relatively new, however, is learning and practicing meditation from an app.
Why learn meditation? I recommend a meditation practice to many of my patients, along with talk therapy and sometimes medication if needed. A nice run-down of the research can be found on the American Psychological Association’s website (below), but studies have found that patients have less anxiety, improved stress, get upset less often, and feel more compassionate and empathetic towards others (which, not surprisingly, translates to better relationships). There are also benefits to memory and focus, whch may be why meditation has also been found in studies recently to be helpful for Attention Deficit Hyperactivity Disorder (ADHD). Another interesting fact: I’m reading Tools of Titans by Tim Ferris right now, where he boils down the wisdom of billionaires, Olympians, etc, and 80% of the people he interviewed have some kind of mindfulness practice!
Let me make it clear that NEARLY every app I looked at says it is the “Number one meditation app!” and “found in the pages of…” Using the app store, I looked for the top grossing and downloaded apps. I reviewed five based on this, downloading them onto my iPhone, and practicing with them. Of the apps below, Headspace, Calm, and Omvana have apple Watch support.
Headspace (www.headspace.com): app is free, subscription costs about $12.99 per month, but less if you sign up for a year or more. You get 10 free initial sessions with the app. This app had my favorite narrator, Andy Puddicombe, who had a relaxing, approachable voice. Appears to be the app most often used in research studies on using an app for meditation. Has a foundation course with three levels, then series for health,, performance, relationships etc. Cute interface, with mini-monsters.
Calm: meditation to relax and focus (www.calm.com): free app, subscription based at $12.99 per month, $59.99 per year. Programs and individual sessions for all skill levels. Lovely, simple interface with nature photos; a daily meditation that changes each day (on Christmas Eve, this was “festivity”), has guided and unguided meditation with nature sounds. You choose your nature sound behind the meditation, and then the meditation occurs over the top of the sound. Could be annoying for some. Friendly sounding narrator- is she smiling while she talks? Unique to this app were sleep stories- basically low key bedtime stories read to you. There are also meditations for kids. Just eight meditations are available with free app without subscription.
Meditation studio (www.meditationstudioapp.com): $3.99, 5 star rating on iTunes, ability to schedule your sessions, clean attractive interface. 200 different meditations. No subscription required. Examples: meditation for beginners, happiness, helping your change habits. Multiple different teachers, from different walks of life- meditation teachers, monks, yoga teachers, (Rodney and Colleen Yee, Beryl Bender Birch). Nice: meditations for mom, kids, veterans, first responders. Can superimpose meditation over nature sounds.
Stop, Breathe and Think (www.stopbreaththink.org): Free app, but subscription based. $4.99 per month, 10% of revenue goes to a non profit, Tools for Peace to help at risk youth learn mindfulness and meditation. Basic meditations are free. I’ve used this one for a long time, and really like it- it has K.D. Lang music on some of the apps! However, it used to be a free app that you purchased a limited number of meditations available, but has recently switched to the subscription model. Even with the meditations I purchased in the past, there are less than in the Meditation Studio app.
Omvana: (www.omvana.com): app free, meditations are charged per series or class. Store is iTunes like, with a wide variety of options for different classes available for purchase, around $3.99 to $5.99 or so, or a $7.99 per month subscription. If you sign up, you get 25 free meditations. I wasn’t impressed with the store on my Macbook air, which had several broken links and loaded samples indefinitely- the iphone version worked better. This seems | c4-en |
/**
* @license Highcharts JS v8.0.4 (2020-03-10)
* @module highcharts/themes/skies
* @requires highcharts
*
* (c) 2009-2019 Torstein Honsi
*
* License: www.highcharts.com/license
*/
'use strict';
import '../../themes/skies.js';
| cdnjs/cdnjs-ajax/libs/highcharts/8.0.4/es-modules/masters/themes/skies.src.js |
var request = require('request');
var xml2js = require('xml2js');
/**
* parses xml to json
* @param {string} xml string representation of xml
* @return {Promise<Object>} A promise to the json object presentation of xml
*/
var xmlToJson = function(xml) {
return new Promise(function(resolve, reject) {
var parser = new xml2js.Parser({explicitArray: false});
parser.parseString(xml, function(error, result) {
if(error) {
reject(error);
}
resolve(result);
});
});
}
/**
* checks whether the sendspace response was ok or not
* @param {Object} body response body as json
* @return {Promise<Object>} A promise to the given body
*/
var checkSendSpaceResponse = function(body) {
return new Promise(function(resolve, reject) {
if (body.result.$.status === 'fail') {
reject(body);
}
resolve(body);
});
}
/**
* makes get request to the given url, parses and checks the response
* @param {string} url endpoint to send the request
* @return {Promise<Object>} A promise to the response
*/
var makeRequest = function (url) {
return new Promise(function(resolve, reject) {
request(url, function(error, response, body) {
if(error) {
reject(error);
}
xmlToJson(body).then(checkSendSpaceResponse).then(function(body) {
resolve(body);
}).catch(function(body) {
reject(body);
});
});
});
}
module.exports = makeRequest; | hhaverinen/TIES532-SendSpaceClient/sendspace-request.js |
// Copyright (C) 1999-2000 Id Software, Inc.
//
/*****************************************************************************
* name: be_ai_goal.h
*
* desc: goal AI
*
* $Archive: /source/code/botlib/be_ai_goal.h $
* $Author: osman $
* $Revision: 1.4 $
* $Modtime: 10/05/99 3:32p $
* $Date: 2003/03/15 23:44:00 $
*
*****************************************************************************/
#define MAX_AVOIDGOALS 256
#define MAX_GOALSTACK 8
#define GFL_NONE 0
#define GFL_ITEM 1
#define GFL_ROAM 2
#define GFL_DROPPED 4
//a bot goal
typedef struct bot_goal_s
{
vec3_t origin; //origin of the goal
int areanum; //area number of the goal
vec3_t mins, maxs; //mins and maxs of the goal
int entitynum; //number of the goal entity
int number; //goal number
int flags; //goal flags
int iteminfo; //item information
} bot_goal_t;
//reset the whole goal state, but keep the item weights
void BotResetGoalState(int goalstate);
//reset avoid goals
void BotResetAvoidGoals(int goalstate);
//remove the goal with the given number from the avoid goals
void BotRemoveFromAvoidGoals(int goalstate, int number);
//push a goal onto the goal stack
void BotPushGoal(int goalstate, bot_goal_t *goal);
//pop a goal from the goal stack
void BotPopGoal(int goalstate);
//empty the bot's goal stack
void BotEmptyGoalStack(int goalstate);
//dump the avoid goals
void BotDumpAvoidGoals(int goalstate);
//dump the goal stack
void BotDumpGoalStack(int goalstate);
//get the name name of the goal with the given number
void BotGoalName(int number, char *name, int size);
//get the top goal from the stack
int BotGetTopGoal(int goalstate, bot_goal_t *goal);
//get the second goal on the stack
int BotGetSecondGoal(int goalstate, bot_goal_t *goal);
//choose the best long term goal item for the bot
int BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int travelflags);
//choose the best nearby goal item for the bot
//the item may not be further away from the current bot position than maxtime
//also the travel time from the nearby goal towards the long term goal may not
//be larger than the travel time towards the long term goal from the current bot position
int BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags,
bot_goal_t *ltg, float maxtime);
//returns true if the bot touches the goal
int BotTouchingGoal(vec3_t origin, bot_goal_t *goal);
//returns true if the goal should be visible but isn't
int BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, bot_goal_t *goal);
//search for a goal for the given classname, the index can be used
//as a start point for the search when multiple goals are available with that same classname
int BotGetLevelItemGoal(int index, char *classname, bot_goal_t *goal);
//get the next camp spot in the map
int BotGetNextCampSpotGoal(int num, bot_goal_t *goal);
//get the map location with the given name
int BotGetMapLocationGoal(char *name, bot_goal_t *goal);
//returns the avoid goal time
float BotAvoidGoalTime(int goalstate, int number);
//set the avoid goal time
void BotSetAvoidGoalTime(int goalstate, int number, float avoidtime);
//initializes the items in the level
void BotInitLevelItems(void);
//regularly update dynamic entity items (dropped weapons, flags etc.)
void BotUpdateEntityItems(void);
//interbreed the goal fuzzy logic
void BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child);
//save the goal fuzzy logic to disk
void BotSaveGoalFuzzyLogic(int goalstate, char *filename);
//mutate the goal fuzzy logic
void BotMutateGoalFuzzyLogic(int goalstate, float range);
//loads item weights for the bot
int BotLoadItemWeights(int goalstate, char *filename);
//frees the item weights of the bot
void BotFreeItemWeights(int goalstate);
//returns the handle of a newly allocated goal state
int BotAllocGoalState(int client);
//free the given goal state
void BotFreeGoalState(int handle);
//setup the goal AI
int BotSetupGoalAI(void);
//shut down the goal AI
void BotShutdownGoalAI(void);
| aarongraham9/jediOutcast-codemp/game/be_ai_goal.h |
class Mercury < Formula
desc "Logic/functional programming language"
homepage "https://mercurylang.org/"
url "https://dl.mercurylang.org/release/mercury-srcdist-20.06.1.tar.gz"
sha256 "ef093ae81424c4f3fe696eff9aefb5fb66899e11bb17ae0326adfb70d09c1c1f"
license all_of: ["GPL-2.0-only", "LGPL-2.0-only", "MIT"]
livecheck do
url "https://dl.mercurylang.org/"
regex(/href=.*?mercury-srcdist[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 cellar: :any, monterey: "529ee1af9b6aaf8a8173af8f2208007599ae96c6ef1275ddb03497181f6bb6d7"
sha256 cellar: :any, big_sur: "8b37f68829e59efd2127a32dfbcbf80d617196b6f35c970e1d4727b5076abb39"
sha256 cellar: :any, catalina: "2b98c59507d6aa72db55b8864d9818f302fef92b5bbdc6630287276494a3bc62"
sha256 cellar: :any, mojave: "e0011e25fa5732a2a271f30c5589c35f1caeb7cbab44ccba2271ab7bd2632243"
sha256 cellar: :any_skip_relocation, x86_64_linux: "c1313fc019178406ba574ef1f9ffdf9b724a337e6831fc54b4a7aa68e02d2635"
end
depends_on "openjdk"
uses_from_macos "flex"
def install
system "./configure", "--prefix=#{prefix}",
"--mandir=#{man}",
"--infodir=#{info}",
"mercury_cv_is_littleender=yes" # Fix broken endianness detection
system "make", "install", "PARALLEL=-j"
# Remove batch files for windows.
rm Dir.glob("#{bin}/*.bat")
end
test do
test_string = "Hello Homebrew\n"
path = testpath/"hello.m"
path.write <<~EOS
:- module hello.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
main(IOState_in, IOState_out) :-
io.write_string("#{test_string}", IOState_in, IOState_out).
EOS
system "#{bin}/mmc", "-o", "hello_c", "hello"
assert_predicate testpath/"hello_c", :exist?
assert_equal test_string, shell_output("#{testpath}/hello_c")
system "#{bin}/mmc", "--grade", "java", "hello"
assert_predicate testpath/"hello", :exist?
assert_equal test_string, shell_output("#{testpath}/hello")
end
end
| sjackman/homebrew-core-Formula/mercury.rb |
Carry out three steps of the Bisection Method for $f(x)=2^{x}-x^{5}$ as follows:
(a) Show that $f(x)$ has a zero in $[1,2]$.
(b) Determine which subinterval, $[1,1.5]$ or $[1.5,2]$, contains a zero.
(c) Determine which interval, $[1,1.25]$, $[1.25,1.5]$, $[1.5,1.75]$, or $[1.75, 2]$, contains a zero.
In part (b), the interval with a zero is .
In part (c), the interval with a zero is .
You can earn partial credit on this problem. | finemath-3plus |
// Created file "Lib\src\Uuid\shguids2"
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
DEFINE_GUID(IID_IShellMenuCallback, 0x4ca300a1, 0x9b8d, 0x11d1, 0x8b, 0x22, 0x00, 0xc0, 0x4f, 0xd9, 0x18, 0xd0);
| Frankie-PellesC/fSDK-Lib/src/Uuid/shguids2000000AB.c |
package org.github.asamaraw.dwsse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
@Path("/publish")
public class PublisherResource {
@GET
public Response register(@QueryParam("msg") String msg) {
EventPublisher.pub(msg);
return Response.ok().build();
}
}
| asamaraw/dropwizard9sse-src/main/java/org/github/asamaraw/dwsse/PublisherResource.java |
package gui;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
public final class UserTableIconRenderer extends DefaultTableCellRenderer {
UserTableIconRenderer() {
super();
}
public void setValue(Object value) {
if (value == null) {
setIcon(Chat.getOfflineIcon());
} else {
setIcon((ImageIcon) value);
}
}
}
| Mulgikapsas/ClientChat-src/gui/UserTableIconRenderer.java |
class GoAT15 < Formula
desc "Go programming environment (1.5)"
homepage "https://golang.org"
url "https://storage.googleapis.com/golang/go1.5.4.src.tar.gz"
mirror "http://pkgs.fedoraproject.org/repo/pkgs/golang/go1.5.4.src.tar.gz/a04d570515c46e4935c63605cbd3a04e/go1.5.4.src.tar.gz"
sha256 "002acabce7ddc140d0d55891f9d4fcfbdd806b9332fb8b110c91bc91afb0bc93"
bottle do
sha256 "eea38602f4f6cf0eccf586f337b4f1eb58748aa0d5b9a73ca64a2829ed5074fc" => :sierra
sha256 "1eeeae4af5ae2fee3f6c9fa5fa2612321ab61349d8de5da574731d0705bb5a41" => :el_capitan
sha256 "3784e41752576d79eb5fb5c3a854d0e1c90c20a38e69f5ece5cc79c340ba4ada" => :yosemite
end
keg_only :versioned_formula
option "without-cgo", "Build without cgo"
option "without-godoc", "godoc will not be installed for you"
resource "gotools" do
url "https://go.googlesource.com/tools.git",
:branch => "release-branch.go1.5"
end
resource "gobootstrap" do
url "https://storage.googleapis.com/golang/go1.4-bootstrap-20161024.tar.gz"
sha256 "398c70d9d10541ba9352974cc585c43220b6d8dbcd804ba2c9bd2fbf35fab286"
end
# fix build on macOS Sierra by adding compatibility for new gettimeofday behavior
# patch derived from backported fixes to the go 1.4 release branch
if MacOS.version == "10.12"
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/ab42a22/go%401.5/go%401.5-Sierra-build.patch"
sha256 "a21e3240fa1cb235b8f5a22e94101cdfd9d16020155d0810d546e8ad6e719791"
end
end
def install
# GOROOT_FINAL must be overidden later on real Go install
ENV["GOROOT_FINAL"] = buildpath/"gobootstrap"
# build the gobootstrap toolchain Go >=1.4
(buildpath/"gobootstrap").install resource("gobootstrap")
cd "#{buildpath}/gobootstrap/src" do
system "./make.bash", "--no-clean"
end
# This should happen after we build the test Go, just in case
# the bootstrap toolchain is aware of this variable too.
ENV["GOROOT_BOOTSTRAP"] = ENV["GOROOT_FINAL"]
cd "src" do
ENV["GOROOT_FINAL"] = libexec
ENV["GOOS"] = "darwin"
ENV["CGO_ENABLED"] = "0" if build.without?("cgo")
system "./make.bash", "--no-clean"
end
(buildpath/"pkg/obj").rmtree
rm_rf "gobootstrap" # Bootstrap not required beyond compile.
libexec.install Dir["*"]
bin.install_symlink Dir["#{libexec}/bin/go*"]
if build.with?("godoc")
ENV.prepend_path "PATH", bin
ENV["GOPATH"] = buildpath
(buildpath/"src/golang.org/x/tools").install resource("gotools")
if build.with? "godoc"
cd "src/golang.org/x/tools/cmd/godoc/" do
system "go", "build"
(libexec/"bin").install "godoc"
end
bin.install_symlink libexec/"bin/godoc"
end
end
end
def caveats; <<~EOS
As of go 1.2, a valid GOPATH is required to use the `go get` command:
https://golang.org/doc/code.html#GOPATH
You may wish to add the GOROOT-based install location to your PATH:
export PATH=$PATH:#{opt_libexec}/bin
EOS
end
test do
(testpath/"hello.go").write <<~EOS
package main
import "fmt"
func main() {
fmt.Println("Hello World")
}
EOS
# Run go fmt check for no errors then run the program.
# This is a a bare minimum of go working as it uses fmt, build, and run.
system "#{bin}/go", "fmt", "hello.go"
assert_equal "Hello World\n", shell_output("#{bin}/go run hello.go")
if build.with? "godoc"
assert_predicate libexec/"bin/godoc", :exist?
assert_predicate libexec/"bin/godoc", :executable?
end
end
end
| robohack/homebrew-core-Formula/[email protected] |
//
// MyViewController.h
// PageTracker
//
// Created by Alexander v. Below on 16.10.13.
// Copyright (c) 2013 Alexander v. Below. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MyViewController : UIViewController
@property (nonatomic) NSString *text;
@property (nonatomic) UIColor *color;
- (id) initWithText:(NSString *)text color:(UIColor *)color;
@end
| below/PageTracker-PageTracker/MyViewController.h |
# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::DevTestLabs::Mgmt::V2018_09_15
module Models
#
# A data disks attached to a virtual machine.
#
class ComputeDataDiskFragment
include MsRestAzure
# @return [String] Gets data disk name.
attr_accessor :name
# @return [String] When backed by a blob, the URI of underlying blob.
attr_accessor :disk_uri
# @return [String] When backed by managed disk, this is the ID of the
# compute disk resource.
attr_accessor :managed_disk_id
# @return [Integer] Gets data disk size in GiB.
attr_accessor :disk_size_gi_b
#
# Mapper for ComputeDataDiskFragment class as Ruby Hash.
# This will be used for serialization/deserialization.
#
def self.mapper()
{
client_side_validation: true,
required: false,
serialized_name: 'ComputeDataDiskFragment',
type: {
name: 'Composite',
class_name: 'ComputeDataDiskFragment',
model_properties: {
name: {
client_side_validation: true,
required: false,
serialized_name: 'name',
type: {
name: 'String'
}
},
disk_uri: {
client_side_validation: true,
required: false,
serialized_name: 'diskUri',
type: {
name: 'String'
}
},
managed_disk_id: {
client_side_validation: true,
required: false,
serialized_name: 'managedDiskId',
type: {
name: 'String'
}
},
disk_size_gi_b: {
client_side_validation: true,
required: false,
serialized_name: 'diskSizeGiB',
type: {
name: 'Number'
}
}
}
}
}
end
end
end
end
| Azure/azure-sdk-for-ruby-management/azure_mgmt_devtestlabs/lib/2018-09-15/generated/azure_mgmt_devtestlabs/models/compute_data_disk_fragment.rb |
//------------------------ Tile Loading Count methods -----------------------------------
/* Have to add the following calls to the layer constructor in the scripts that need to know when to concatenate,
and they need to implement a method called concatenateTiles() .
.on("load", tileLoaded)
.on("added_tile", tileAdded)
.on("aborted_tile", tileAborted)
The counting mechanism should work no matter how many layers you have.
*/
var tiles_added = 0;
var tiles_loaded = 0;
function tileAdded (e) {
tiles_added++;
}
function tileAborted (e) {
tiles_added--;
}
function checkTileCount () {
if (tiles_added == tiles_loaded) concatenateTiles ();
}
function tileLoaded () {
tiles_loaded++;
checkTileCount ();
}
//------------------------ Feature combination methods ----------------------------------
// Nice to have this as a common function with an eye to improving it
/* To union segments into one tile, you add the tile offset of the "source tile" and substract the tile offset of the "destination tile".
You can delete the segment from the source til to avoid mutiple svgs on top of each other. (It shouldn't matter to the polymaps tile cache because it works on the tile level only.) */
function combineSegments (dest_tile, source_tile, offsets_dest) {
if (source_tile.getAttribute("d") == "") return; //Nothing to add to the dest_tile.
dest_tile.setAttribute("d", dest_tile.getAttribute("d") + translateCoordinates (source_tile.getAttribute("d"), offsets_dest, findTileOffset (source_tile.parentNode)));
}
//Finds the offset from the origin of each tile
function findTileOffset (tile) {
var offsetText = tile.getAttribute("transform");
offsetText = offsetText.substring (10, offsetText.length -1); //translate(904.5,344.5)
//console.log (offsetText);
var offsets = offsetText.split(",");
offsets = [parseFloat (offsets[0]), parseFloat(offsets[1])];
return offsets;
}
//Translates the local coordinates from the source tile to make them fit in the local system of the dest tile
function translateCoordinates (path, offset_dest, offset_source) {
var paintingInstructions = Raphael.parsePathString(path);
var result = "";
for (var i = 0; i < paintingInstructions.length; i++) {
if (paintingInstructions[i][0] != "Z") {
result += paintingInstructions[i][0] + (paintingInstructions[i][1] + offset_source[0] - offset_dest[0]) + "," + (paintingInstructions[i][2] + offset_source[1] - offset_dest[1]);
} else {
result += "Z"; //Add the Z to close the drawing instructions, see W3C rules
}
}
return result;
}
//------------------------ Misc helper methods ----------------------------------
//Method to allow us to check if an array contains an object in stupid Javascript
function oc(a) {
var o = {};
for (var i = 0; i < a.length; i++)
{
o[a[i]]='';
}
return o;
}
//------------------------ Tile addressing methods ----------------------------------
//Helper to check if a tile is already visited since the "in visitedTiles methoed doesn't work b/c it's fetched aa a new object everytime)
//Returns true if it's in the list or null
function checkForVisits (tile, visitedTiles) {
if (!tile) return true;
for (var i = 0; i < visitedTiles.length; i++) {
if (tile.getAttribute ("tile_row") == visitedTiles[i].getAttribute ("tile_row")
&& tile.getAttribute ("tile_column") == visitedTiles[i].getAttribute ("tile_column"))
return true;
}
return false;
}
//Returns a tile when given a relative pointer text like "0,1"
function findTile (current_tile, tilepointer_text, tiles) {
var components = tilepointer_text.split(',');
var target_x = parseInt (current_tile.getAttribute ("tile_column")) + parseInt (components[0]);
var target_y = parseInt (current_tile.getAttribute ("tile_row")) - parseInt (components[1]); //Switcharoo b/c of opposite coordinate system!
//Find the tile with that address
//console.log ("Looking for tile pointed to");
for (var i = 0; i < tiles.length; i++) {
if (tiles[i].getAttribute ("tile_row") == target_y && tiles[i].getAttribute ("tile_column") == target_x) {
//console.log ("Found tile being pointed to");
return tiles[i];
}
}
//If we're here then the aforementioned tile hasn't been loaded. TODO: Here is where you might force the loading
return null;
}
| robpvn/Vector-Tile-Research-static/common_functions.js |
//
// YR_ArtistTableView.h
// Artand
//
// Created by Dendi on 9/4/16.
// Copyright © 2016 kaleidoscope. All rights reserved.
//
#import <UIKit/UIKit.h>
@class YR_ArtistModel;
@interface YR_ArtistTableView : UITableView
@property (nonatomic, strong) YR_ArtistModel *artistModel;
@end
| NSKaleidoscope/FirstProject-Artand/Artand/Sections/Discovery/View/Artist/YR_ArtistTableView.h |
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var base_module_1 = require("./base-module");
var common_1 = require("../common");
var Keys = /** @class */ (function (_super) {
__extends(Keys, _super);
function Keys(pageSize, requestHelper) {
var _this = _super.call(this, pageSize, requestHelper) || this;
_this.basePath = 'account/keys';
_this.baseOptions = {
actionPath: _this.basePath + "/",
};
return _this;
}
/**
* Get all SSH Keys
* @param [tagName] filter to only return SSH Keys with a given tag
* @param [includeAll] return all SSH Keys, paginated (optional)
* @param [page] the specific page of SSH Keys to return (optional)
* @param [pageSize] the number of SSH Keys to return per page (optional)
* @returns Promise
*/
Keys.prototype.getAll = function (tagName, includeAll, page, pageSize) {
if (includeAll === void 0) { includeAll = false; }
if (page === void 0) { page = 1; }
if (pageSize === void 0) { pageSize = this.pageSize; }
var requestOptions = this._getBasePaginatedRequestOptions({
actionPath: this.basePath,
key: 'ssh_keys',
tagName: tagName,
pageSize: pageSize,
page: page,
includeAll: includeAll,
});
return this._execute(requestOptions);
};
/**
* Get a specific SSH Key using its identifier
* @param keyId the identifier of the SSH Key
* @returns Promise
*/
Keys.prototype.getById = function (keyId) {
return this._execute({
actionPath: this.basePath + "/" + encodeURIComponent(keyId)
});
};
/**
* Get a specific SSH Key using its fingerprint
* @param fingerprint the fingerprint of the SSH Key to retrieve
* @returns Promise
*/
Keys.prototype.getByFingerprint = function (fingerprint) {
return this._execute({
actionPath: this.basePath + "/" + encodeURIComponent(fingerprint)
});
};
/**
* Add a new SSH Key to an account
* @param addKeyRequest the configuration of the SSH Key
* @returns Promise
*/
Keys.prototype.add = function (addKeyRequest) {
var requestOptions = __assign(__assign({}, this.baseOptions), { method: common_1.HttpMethods.POST, body: addKeyRequest });
return this._execute(requestOptions);
};
/**
* Rename an SSH Key
* @param identifier the ID or Fingerprint of the SSH Key to rename
* @param newName the new name to set on the SSH Key
* @returns Promise
*/
Keys.prototype.rename = function (identifier, newName) {
var requestOptions = {
actionPath: this.basePath + "/" + encodeURIComponent(identifier),
method: common_1.HttpMethods.PUT,
body: {
name: newName,
},
};
return this._execute(requestOptions);
};
/**
* Delete an SSH Key
* @param identifier the ID or Fingerprint of the SSH Key you wish to delete
* @returns Promise
*/
Keys.prototype.delete = function (identifier) {
var requestOptions = {
actionPath: this.basePath + "/" + encodeURIComponent(identifier),
method: common_1.HttpMethods.DELETE,
};
return this._execute(requestOptions);
};
return Keys;
}(base_module_1.BaseModule));
exports.default = Keys;
| matt-major/do-wrapper-dist/modules/keys.js |
var searchData=
[
['sage_5fcircuit_5fanalysis',['sage_circuit_analysis',['../namespacesage__circuit__analysis.html',1,'']]]
];
| alessandro-bernardini/SAPICE-html/search/namespaces_73.js |
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Windy.Domain.Entities
{
[DataContract(Name = "powergenerator")]
public class PowerGenerator
{
[DataMember(Name = "id", Order = 10)]
public int Id { get; set; }
[DataMember(Name = "name", Order = 20)]
public string Name { get; set; }
[DataMember(Name="maxoutputmw", Order =30)]
public double MaxOutputMw { get; set; }
[DataMember(Name = "minoutputmw", Order = 40)]
public double MinOuputMw { get; set; }
[DataMember(Name = "minoptimalwindspeed", Order = 50)]
public double MinOptimalWindspeed { get; set; }
[DataMember(Name = "maxoptimalwindspeed", Order = 60)]
public double MaxOptimalWindspeed { get; set; }
[DataMember(Name = "cutinspeed", Order = 70)]
public double CutInSpeed { get; set; }
public static IEnumerable<PowerGenerator> Generators
{
get
{
yield return new PowerGenerator { Id = 4, Name = "Hitachi X800", MaxOutputMw = 3.5, MinOuputMw = 0.15, MinOptimalWindspeed = 6.8, MaxOptimalWindspeed = 14.0, CutInSpeed = 2.0, };
yield return new PowerGenerator { Id = 1, Name = "Vestas V90", MaxOutputMw = 2.0, MinOuputMw = 0.1, MinOptimalWindspeed = 6.2, MaxOptimalWindspeed = 18.0, CutInSpeed = 3.5, };
yield return new PowerGenerator { Id = 2, Name = "Siemens SWT-6", MaxOutputMw = 5.0, MinOuputMw = 0.25, MinOptimalWindspeed = 7.0, MaxOptimalWindspeed = 14.0, CutInSpeed = 6.0, };
yield return new PowerGenerator { Id = 3, Name = "Enercon E126", MaxOutputMw = 7.0, MinOuputMw = 0.3, MinOptimalWindspeed = 8.2, MaxOptimalWindspeed = 18.0, CutInSpeed = 7.0, };
}
}
}
}
| msdevno/windy-Source/Windy.Domain/Entities/PowerGenerator.cs |
/*
* @Author: ChalrieHwang
* @Date: 2015-06-14 15:48:11
* @Last Modified by: cwhwang1986
* @Last Modified time: 2015-06-15 11:33:51
*/
'use strict';
(function (angular) {
// ---------------------------------------------------------
// EditMenuDirective - Right click deletion
// ---------------------------------------------------------
var EditMenuCtrl = function ($scope, GraphService) {
$scope.graph = GraphService;
$scope.show = false;
};
var link = function($scope, element){
element.bind('contextmenu', function($event){
$event.preventDefault();
var clickObjType = $event.path[0].tagName;
var nodeClasses = ['cluster', 'issue'];
var nodeId,
nodeClass,
promise,
upNodeId,
downNodeId;
if (clickObjType === 'circle'){
nodeId = Number($event.target.__data__);
nodeClass = $scope.q.node(nodeId).class;
} else if (clickObjType === 'tspan'){
nodeId = Number($event.path[4].__data__);
nodeClass = $scope.q.node(nodeId).class;
} else if (clickObjType === 'path'){
upNodeId = Number($event.target.__data__.v);
downNodeId = Number($event.target.__data__.w);
}
// Pop up window
var menu1 = [
{
title: 'Edit',
action: function() {
$scope.$emit('clickEdit', nodeId);
}
},
{
title: 'Place on graph',
action: function() {
$scope.$emit('placeNode', nodeId);
}
},
{
title: 'Delete',
action: function() {
//Click circle
if(nodeClasses.indexOf(nodeClass) !== -1){
if(nodeClass === 'cluster'){
promise = $scope.graph.deleteNode(nodeId);
} else if (nodeClass === 'issue'){
promise = $scope.graph.deleteNode(nodeId);
}
}
//Click Path
if(clickObjType === 'path'){
promise = $scope.graph.deleteEdge(upNodeId, downNodeId);
}
if(promise){
promise.then(function(result){
if(result){
$scope.graphData = $scope.graph.graphObj.graph;
$scope.buildQueue($scope.graphData);
// $scope.graph.postGraph();
}
}, function(err){
console.log('error', err);
});
}
}
}
];
//Append the menu div
if(clickObjType){
d3.selectAll('.context-menu').data([1])
.enter()
.append('div')
.attr('class', 'context-menu');
d3.selectAll('.context-menu').html('');
var list = d3.selectAll('.context-menu').append('ul');
if(clickObjType === 'cluster' || clickObjType === 'circle' || clickObjType === 'tspan'){
list.selectAll('li').data(menu1).enter()
.append('li')
.html(function(d) {
return d.title;
})
.on('click', function(d) {
d.action(d);
d3.select('.context-menu').style('display', 'none');
});
} else if (clickObjType === 'path') {
list.selectAll('li')
.data([menu1[1]]).enter()
.append('li')
.html(function(d) {
return d.title;
})
.on('click', function(d) {
d.action(d);
d3.select('.context-menu').style('display', 'none');
});
} else if (clickObjType === 'svg'){
}
d3.select('.context-menu')
.style('left', ($event.pageX - 2) + 'px')
.style('top', ($event.pageY - 2) + 'px')
.style('display', 'block');
//Close the contextmenu once it got clicked
d3.select('body').on('click', function() {
d3.select('.context-menu').style('display', 'none');
});
}
});
};
var EditMenuDirective = function () {
return {
restrict: 'EA',
controller: EditMenuCtrl,
link: link,
scope: true
};
};
// ---------------------------------------------------------
// Entry Point
// ---------------------------------------------------------
angular
.module('cd-app.common')
.directive('ngEditMenu', EditMenuDirective);
})(angular);
| cwhwang1986/constellation-client/app/common/directives/edit-menu.directive.js |
# RGB Cube.
#
# The three primary colors of the additive color model are red, green, and blue.
# This RGB color cube displays smooth transitions between these colors.
attr_reader :box_points
def setup
size 640, 360, P3D
no_stroke
color_mode RGB, 2
@xmag = 0
@ymag = 0
@new_xmag = 0
@new_ymag = 0
# since each point is used three times
@box_points = {
top_front_left: [-1, 1, 1],
top_front_right: [ 1, 1, 1],
top_back_right: [ 1, 1, -1],
top_back_left: [-1, 1, -1],
bottom_front_left: [-1, -1, 1],
bottom_front_right: [ 1, -1, 1],
bottom_back_right: [ 1, -1, -1],
bottom_back_left: [-1, -1, -1]
}
# a box from defined points
@box = {
top: [box_points[:top_front_left], box_points[:top_front_right], box_points[:top_back_right], box_points[:top_back_left]],
front: [box_points[:top_front_left], box_points[:top_front_right], box_points[:bottom_front_right], box_points[:bottom_front_left]],
left: [box_points[:top_front_left], box_points[:bottom_front_left], box_points[:bottom_back_left], box_points[:top_back_left]],
back: [box_points[:top_back_left], box_points[:top_back_right], box_points[:bottom_back_right], box_points[:bottom_back_left]],
right: [box_points[:top_back_right], box_points[:bottom_back_right], box_points[:bottom_front_right], box_points[:top_front_right]],
bottom: [box_points[:bottom_front_left], box_points[:bottom_front_right], box_points[:bottom_back_right], box_points[:bottom_back_left]]
}
end
def draw
background 1
push_matrix
translate width/2, height/2, -30
@new_xmag = mouse_x.to_f / width * TAU
@new_ymag = mouse_y.to_f / height * TAU
diff = @xmag - @new_xmag
@xmag -= diff / 4 if diff.abs > 0.01
diff = @ymag - @new_ymag
@ymag -= diff / 4 if diff.abs > 0.01
rotate_x(-@ymag)
rotate_y(-@xmag)
scale 90
begin_shape QUADS
[:top, :front, :left, :back, :right, :bottom].each { |s|
@box[s].each { |p|
fill_from_points p
vertex_from_points p
}
}
end_shape
pop_matrix
end
def fill_from_points(points)
fill points[0] + 1, points[1] + 1, points[2] + 1 # "+1" translates -1,1 to 0,2
end
def vertex_from_points(points)
vertex *points
end
| ruby-processing/Example-Sketches-samples/processing_app/basics/form/rgb_cube.rb |
#ifndef __STM32F4XX_CONF_H
#define __STM32F4XX_CONF_H
#ifdef USE_FULL_ASSERT
/**
* @brief The assert_param macro is used for function's parameters check.
* @param expr: If expr is false, it calls assert_failed function
* which reports the name of the source file and the source
* line number of the call that failed.
* If expr is true, it returns no value.
* @retval None
*/
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
void assert_failed(uint8_t* file, uint32_t line);
#else
#define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */
#endif /* __STM32F4XX_CONF_H */
/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
| mbains/STM32F4Discovery_GCC-stm32f4xx_conf.h |
// Generated by CoffeeScript 1.6.1
(function() {
var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
this.DiscussionViewSpecHelper = (function() {
var triggerVoteEvent;
function DiscussionViewSpecHelper() {}
DiscussionViewSpecHelper.makeThreadWithProps = function(props) {
var thread;
thread = {
id: "dummy_id",
thread_type: "discussion",
pinned: false,
endorsed: false,
votes: {
up_count: '0'
},
read: false,
unread_comments_count: 0,
comments_count: 0,
abuse_flaggers: [],
body: "",
title: "dummy title",
created_at: "2014-08-18T01:02:03Z"
};
return $.extend(thread, props);
};
DiscussionViewSpecHelper.expectVoteRendered = function(view, model, user) {
var button;
button = view.$el.find(".action-vote");
expect(button.hasClass("is-checked")).toBe(user.voted(model));
expect(button.attr("aria-checked")).toEqual(user.voted(model).toString());
expect(button.find(".js-visual-vote-count").text()).toMatch("^" + (model.get('votes').up_count) + " Votes?$");
return expect(button.find(".sr.js-sr-vote-count").text()).toMatch("^currently " + (model.get('votes').up_count) + " votes?$");
};
DiscussionViewSpecHelper.checkRenderVote = function(view, model) {
view.render();
DiscussionViewSpecHelper.expectVoteRendered(view, model, window.user);
window.user.vote(model);
view.render();
DiscussionViewSpecHelper.expectVoteRendered(view, model, window.user);
window.user.unvote(model);
view.render();
return DiscussionViewSpecHelper.expectVoteRendered(view, model, window.user);
};
triggerVoteEvent = function(view, event, expectedUrl) {
var deferred,
_this = this;
deferred = $.Deferred();
spyOn($, "ajax").andCallFake(function(params) {
expect(params.url.toString()).toEqual(expectedUrl);
return deferred;
});
view.render();
view.$el.find(".action-vote").trigger(event);
expect($.ajax).toHaveBeenCalled();
return deferred.resolve();
};
DiscussionViewSpecHelper.checkUpvote = function(view, model, user, event) {
var initialVoteCount, _ref, _ref1;
expect((_ref = model.id, __indexOf.call(user.get('upvoted_ids'), _ref) >= 0)).toBe(false);
initialVoteCount = model.get('votes').up_count;
triggerVoteEvent(view, event, DiscussionUtil.urlFor("upvote_" + (model.get('type')), model.id) + "?ajax=1");
expect((_ref1 = model.id, __indexOf.call(user.get('upvoted_ids'), _ref1) >= 0)).toBe(true);
return expect(model.get('votes').up_count).toEqual(initialVoteCount + 1);
};
DiscussionViewSpecHelper.checkUnvote = function(view, model, user, event) {
var initialVoteCount, _ref;
user.vote(model);
expect((_ref = model.id, __indexOf.call(user.get('upvoted_ids'), _ref) >= 0)).toBe(true);
initialVoteCount = model.get('votes').up_count;
triggerVoteEvent(view, event, DiscussionUtil.urlFor("undo_vote_for_" + (model.get('type')), model.id) + "?ajax=1");
expect(user.get('upvoted_ids')).toEqual([]);
return expect(model.get('votes').up_count).toEqual(initialVoteCount - 1);
};
DiscussionViewSpecHelper.checkButtonEvents = function(view, viewFunc, buttonSelector) {
var button, spy;
spy = spyOn(view, viewFunc);
button = view.$el.find(buttonSelector);
button.click();
expect(spy).toHaveBeenCalled();
spy.reset();
button.trigger($.Event("keydown", {
which: 13
}));
expect(spy).not.toHaveBeenCalled();
spy.reset();
button.trigger($.Event("keydown", {
which: 32
}));
return expect(spy).toHaveBeenCalled();
};
DiscussionViewSpecHelper.checkVoteButtonEvents = function(view) {
return this.checkButtonEvents(view, "toggleVote", ".action-vote");
};
DiscussionViewSpecHelper.setNextResponseContent = function(content) {
var _this = this;
return $.ajax.andCallFake(function(params) {
params.success({
"content": content
});
return {
always: function() {}
};
});
};
return DiscussionViewSpecHelper;
})();
}).call(this);
| kuiwei/edx-platform-common/static/coffee/spec/discussion/view/discussion_view_spec_helper.js |
var searchData=
[
['errormsg_23',['errormsg',['../classpmem_1_1kv_1_1db.html#a8a1f3aa460fd01a324c0bd5bd2d6ae92',1,'pmem::kv::db']]],
['exists_24',['exists',['../classpmem_1_1kv_1_1db.html#a130ec5171d0afa3d8fe9b5604910c679',1,'pmem::kv::db']]]
];
| pbalcer/pbalcer.github.io-content/pmemkv/v1.3/doxygen/search/all_3.js |
var fs = require('fs')
var thunky = require('thunky')
var from = require('from2')
var bulk = require('bulk-write-stream')
module.exports = DB
function DB (filename, entrySize) {
if (!(this instanceof DB)) return new DB(filename, entrySize)
if (!filename) throw new Error('filename is required')
if (!entrySize) throw new Error('entry size is required')
var self = this
this.filename = filename
this.entrySize = entrySize
this.fd = 0
this.size = 0
this.entries = 0
this.buffer = null
this.callbacks = null
this.open = thunky(function (cb) {
fs.open(filename, 'a+', function (err, fd) {
if (err) return cb(err)
fs.fstat(fd, function (err, st) {
if (err) return cb(err)
self.fd = fd
self.size = st.size - (st.size % entrySize)
self.entries = self.size / entrySize
cb()
})
})
})
}
DB.prototype.createWriteStream = function () {
var self = this
return bulk(function (list, cb) {
self.append(Buffer.concat(list), cb)
})
}
DB.prototype.createReadStream = function (opts) {
if (!opts) opts = {}
var self = this
var offset = 0
if (typeof opts.gt === 'number') offset = (opts.gt + 1) * this.entrySize
if (typeof opts.gte === 'number') offset = opts.gte * this.entrySize
var stream = from(function (size, cb) {
var bufSize = Math.ceil(size / self.entrySize) * self.entrySize
self.open(function (err) {
if (err) return cb(err)
var buf = new Buffer(bufSize)
readAll(self.fd, offset, buf, function (err, missing) {
if (err) return cb(err)
var read = buf.length - missing
for (var i = 0; i < read; i += self.entrySize) {
var end = i + self.entrySize
if (end <= read) stream.push(buf.slice(i, end))
}
offset += bufSize
if (missing) cb(null, null)
else cb()
})
})
})
return stream
}
DB.prototype.get = function (index, cb) {
var offset = index * this.entrySize
var buf = new Buffer(this.entrySize)
var self = this
this.open(function (err) {
if (err) return cb(err)
if (offset >= self.size) return cb(null, null)
readAll(self.fd, offset, buf, function (err) {
if (err) return cb(err)
cb(null, buf)
})
})
}
DB.prototype.put = function (index, buf, cb) {
if (!cb) cb = noop
if (typeof buf === 'string') buf = new Buffer(buf)
if (buf.length % this.entrySize !== 0) throw new Error('Entry must be ' + this.entrySize + ' bytes')
var missing = buf.length
var offset = index * this.entrySize
var self = this
this.open(write)
function write (err) {
if (err) return cb(err)
if (offset > self.size) return cb(new Error('Write is out of bounds'))
fs.write(self.fd, buf, buf.length - missing, missing, offset, done)
}
function done (err, written) {
if (err) return cb(err)
missing -= written
offset += written
if (!missing) {
if (offset > self.size) {
self.size = offset
self.entries = self.size / self.entrySize
}
return cb(null)
}
write(null)
}
}
DB.prototype.append = function (buf, cb) {
if (!cb) cb = noop
if (typeof buf === 'string') buf = new Buffer(buf)
if (Array.isArray(buf)) buf = Buffer.concat(buf)
var self = this
this.open(function (err) {
if (err) return cb(err)
if (self.buffer) {
self.buffer.push(buf)
self.callbacks.push(cb)
return
}
self.buffer = []
self.callbacks = []
self.put(self.entries, buf, drain)
})
function drain (err) {
if (err) return cb(err)
var buf = self.buffer.length ? Buffer.concat(self.buffer) : null
var next = self.callbacks ? callAll(self.callbacks) : null
self.buffer = null
self.callbacks = null
if (!buf) return cb()
self.append(buf, next)
cb()
}
}
DB.prototype.close = function (cb) {
if (!cb) cb = noop
var self = this
this.open(function (err) {
if (err) return cb(err)
fs.close(self.fd, cb)
})
}
DB.prototype.flush = function (cb) {
if (!cb) cb = noop
var self = this
this.open(function (err) {
if (err) return cb(err)
fs.fsync(self.fd, cb)
})
}
function noop () {}
function callAll (list) {
return function (err) {
for (var i = 0; i < list.length; i++) list[i](err)
}
}
function readAll (fd, offset, buf, cb) {
var missing = buf.length
fs.read(fd, buf, 0, missing, offset, loop)
function loop (err, read) {
if (err) return cb(err)
missing -= read
offset += read
if (!missing || !read) return cb(null, missing)
fs.read(fd, buf, buf.length - missing, missing, offset, loop)
}
}
| mafintosh/fixed-entry-db-index.js |
/*
* iGCS is an iOS app for the Paparazzi UAV Ground Control Station
* Copyright (C) 2011 David Mobach
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information about this software please visit:
* https://github.com/davidmobach/iGCS
*/
#import <UIKit/UIKit.h>
#define kAltitudeComponent 0
#define kAirspeedComponent 1
void *refToStatusViewController;
@interface StatusViewController : UIViewController
<UIPickerViewDelegate, UIPickerViewDataSource>
{
IBOutlet UILabel *batteryLabel;
NSOperationQueue *queue;
IBOutlet UIPickerView *singlePicker;
NSArray *pickerData;
IBOutlet UISegmentedControl *autopilotMode;
IBOutlet UITextField *altitudeTextField;
IBOutlet UITextField *airspeedTextField;
IBOutlet UITextField *gndspeedTextField;
IBOutlet UIProgressView *throttleProgressView;
IBOutlet UILabel *throttleLabel;
}
@property (retain, nonatomic) UILabel *batteryLabel;
@property (retain, nonatomic) UIPickerView *singlePicker;
@property (retain, nonatomic) NSArray *pickerData;
@property (retain, nonatomic) UISegmentedControl *autopilotMode;
@property (retain, nonatomic) UITextField *altitudeTextField;
@property (retain, nonatomic) UITextField *airspeedTextField;
@property (retain, nonatomic) UITextField *gndspeedTextField;
@property (retain, nonatomic) UIProgressView *throttleProgressView;
@property (retain, nonatomic) UILabel *throttleLabel;
- (void) updateBatteryLabel: (char *) arg;
- (void) updateAirspeed: (int) airspeed;
- (void) updateGroundspeed: (int) gndspeed;
- (void) updateAutopilotMode: (int) mode;
- (void) updateAltitude: (char *) altitude;
- (void) updateThrottle: (char *) throttle;
@end
| davidmobach/iGCS-iGCS/StatusViewController.h |
require 'spec_helper'
describe QueryStringInterface::Parsers::BooleanAndNilParser do
it "should be able to parse a boolean true" do
should be_parseable('true', nil)
end
it "should be able to parse a boolean false" do
should be_parseable('false', nil)
end
it "should be able to parse nil" do
should be_parseable('nil', nil)
end
it "should be able to parse null" do
should be_parseable('null', nil)
end
it "should be able to parse any other text" do
should be_parseable('some text', nil)
end
it "should not be able to parse an empty value" do
should_not be_parseable('', nil)
end
it "should parse a boolean 'true' as true" do
subject.parse('true').should be_true
end
it "should parse a boolean 'true' as false" do
subject.parse('false').should be_false
end
it "should parse nil" do
subject.parse('nil').should be_nil
end
it "should parse null" do
subject.parse('null').should be_nil
end
it "should strip true value before parsing" do
subject.parse(' true ').should be_true
end
it "should strip false value before parsing" do
subject.parse(' false').should be_false
end
it "should strip nil value before parsing" do
subject.parse(' nil').should be_nil
end
it "should strip null value before parsing" do
subject.parse(' null').should be_nil
end
it "should return the given value if it is not nil or null" do
subject.parse('some text').should == 'some text'
end
it "should parse an empty value as nil" do
subject.parse('').should be_nil
end
it "should parse a nil value as nil" do
subject.parse(nil).should be_nil
end
end | vicentemundim/query_string_interface-spec/query_string_interface/parsers/boolean_and_nil_parser_spec.rb |
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/*************************************************************
*
* MathJax/extensions/TeX/noUndefined.js
*
* This causes undefined control sequences to be shown as their macro
* names rather than producing an error message. So $X_{\xxx}$ would
* display as an X with a subscript consisting of the text "\xxx".
*
* To configure this extension, use for example
*
* MathJax.Hub.Config({
* TeX: {
* noUndefined: {
* attributes: {
* mathcolor: "red",
* mathbackground: "#FFEEEE",
* mathsize: "90%"
* }
* }
* }
* });
*
* ---------------------------------------------------------------------
*
* Copyright (c) 2010-2018 The MathJax Consortium
*
* 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.
*/
//
// The configuration defaults, augmented by the user settings
//
MathJax.Extension["TeX/noUndefined"] = {
version: "2.7.5",
config: MathJax.Hub.CombineConfig("TeX.noUndefined",{
disabled: false, // set to true to return to original error messages
attributes: {
mathcolor: "red"
}
})
};
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
var CONFIG = MathJax.Extension["TeX/noUndefined"].config;
var MML = MathJax.ElementJax.mml;
var UNDEFINED = MathJax.InputJax.TeX.Parse.prototype.csUndefined;
MathJax.InputJax.TeX.Parse.Augment({
csUndefined: function (name) {
if (CONFIG.disabled) {return UNDEFINED.apply(this,arguments)}
MathJax.Hub.signal.Post(["TeX Jax - undefined control sequence",name]);
this.Push(MML.mtext(name).With(CONFIG.attributes));
}
});
MathJax.Hub.Startup.signal.Post("TeX noUndefined Ready");
});
MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/noUndefined.js");
| GerHobbelt/MathJax-unpacked/extensions/TeX/noUndefined.js |
Albanien – en Contest Expedition – EDR.DK
1. februar 2019 4. februar 2019 OZ2I
Af OZ2I Henning Andresen – december 2018
Verdens største contest er CQ World Wide DX
og det er en konkurrence som rigtig mange radioamatører over hele jorden ser frem til hvert eneste år. Mere end 16.500 radioamatører har indsendt logs i 2018 og det fordeler sig nogenlunde jævnt mellem SSB og CW.
Efter at have været forhindret i at deltage nogle år besluttede jeg mig for at gøre en ekstra indsats for at få et rimeligt godt resultat i 2018. Jeg besluttede mig for at CW contesten skulle foregå fra Albanien og jeg startede forberedelserne allerede i september måned.
Lidt fakta om Albanien. Landet har en befolkning på omkring 3 millioner og er cirka halv så stort som Danmark. Albanien er et land på vej frem men er stadig et af de fattigste lande i Europa. Deres nationalhelt er Gjergj Kastrioti Skanderbeg som samlede Albanien til en national enhed tilbage i 1461. Fra 1960-1985 var Albanien et meget lukket og kommunistisk styret land og man kan stadig, mange steder finde nogle af de omkring 170.000 små enkeltmandsbunkere som blev bygget i den periode og skulle bruges til at beskytte landet.
Jeg har 2 gange tidligere kørt contester fra Albanien
så jeg var ikke helt ukendt med proceduren for licensansøgning, hotel, bil, fly og så videre. Under en ferietur sammen med min søn i 2015, kom jeg i kontakt med ZA1F Fatos og ZA1U Edmond. Jeg mødtes med dem i Tirana hvor vi sammen besøgte AKEP, ”Auroriteti i Komunikimeve Elektronike dhe Postare” for at ansøge om en gæstelicens til mig. Jeg fik gæstelicens men kunne ikke få et Albansk kaldesignal da de kun udstedes til radioamatører som bor i Albanien. Kaldesignalet blev så ZA/OU2I.
I 2015 deltog jeg i CQ WPX CW contesten i kategorien Single Operator, All Band, Low Power og var så heldig at modtage plaketten for ” Contest Expedition World Winner” sponsoreret af Paul Goetz til minde om N6ZZ Phil Goetz. Den er jeg meget stolt af.
Ved hjælp af e-mail mellem ZA1F Fatos og mig, fik jeg ansøgt om og tildelt midlertidig licens med kaldesignalet ZA/OU2I som tidligere. Ligeledes lavede Fatos en aftale med en hotelejer i Golem, hvor jeg tidligere havde boet, og da det var uden for sæsonen fik jeg en rigtig favorabel pris.
Jeg bestilte udlejningsbil samt billetter til tog og fly via internettet. Så var det hele klar og på plads omkring den 12. november.
Kufferten blev pakket
med udstyr hvor jeg skulle begrænse mig til 23 kilo. Du kan se på billedet hvad der kom med og hoveddelene var min Elecraft K3, Lenovo X301 laptop, DX-Wire glasfibermast, 25A Power supply samt Diamond Balun og den nyindkøbte Windom 160-10m (79 meter lang!). Jeg fik næsten det hele i kufferten og resten kom med som håndbagage. Afrejse fra Haderslev var den 19. november.
Jeg ankom til Mother Teresa Airport i Tirana
midt på eftermiddagen den 20. november og fik udleveret den lejede bil hvorefter jeg kørte afsted til hotellet i Golem. En køretur på godt 1 times tid. Hotelværten tog imod mig og jeg fik anvist et værelse på 2. sal samt adgang til taget. Da det var uden for turist sæson var her ikke andre g | c4-da |
# ››SnC2O4 molecular weight
Molar mass of SnC2O4 = 206.729 g/mol
This compound is also known as Tin(II) Oxalate.
Molecular weight calculation:
118.71 + 12.0107*2 + 15.9994*4
# ››Percent composition by element
Element Symbol Atomic Mass # of Atoms Mass Percent Tin Sn 118.710 1 57.423% Carbon C 12.0107 2 11.620% Oxygen O 15.9994 4 30.957%
# ››Similar chemical formulas
Note that all formulas are case-sensitive. Did you mean to find the molecular weight of one of these similar formulas?
SNC2O4
SnC2O4
# ››Calculate the molecular weight of a chemical compound
Enter a chemical formula:
Browse the list of common chemical compounds.
In chemistry, the formula weight is a quantity computed by multiplying the atomic weight (in atomic mass units) of each element in a chemical formula by the number of atoms of that element present in the formula, then adding all of these products together.
Formula weights are especially useful in determining the relative weights of reagents and products in a chemical reaction. These relative weights computed from the chemical equation are sometimes called equation weights.
Using the chemical formula of the compound and the periodic table of elements, we can add up the atomic weights and calculate molecular weight of the substance.
Finding molar mass starts with units of grams per mole (g/mol). When calculating molecular weight of a chemical compound, it tells us how many grams are in one mole of that substance. The formula weight is simply the weight in atomic mass units of all the atoms in a given formula.
A common request on this site is to convert grams to moles. To complete this calculation, you have to know what substance you are trying to convert. The reason is that the molar mass of the substance affects the conversion. This site explains how to find molar mass.
The atomic weights used on this site come from NIST, the National Institute of Standards and Technology. We use the most common isotopes. This is how to calculate molar mass (average molecular weight), which is based on isotropically weighted averages. This is not the same as molecular mass, which is the mass of a single molecule of well-defined isotopes. For bulk stoichiometric calculations, we are usually determining molar mass, which may also be called standard atomic weight or average atomic mass.
If the formula used in calculating molar mass is the molecular formula, the formula weight computed is the molecular weight. The percentage by weight of any atom or group of atoms in a compound can be computed by dividing the total weight of the atom (or group of atoms) in the formula by the formula weight and multiplying by 100. | finemath-3plus |
package io.stratio.deep;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| miguel0afd/gitflowTest-src/main/java/io/stratio/deep/App.java |
/**
* Copyright (C) 2013 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.strata.pricer.impl.credit.isda;
/**
*
*/
public class CouponOnlyElement {
private final double _riskLessValue;
private final double _effEnd;
private final int _creditCurveKnot;
public CouponOnlyElement(CdsCoupon coupon, IsdaCompliantYieldCurve yieldCurve, int creditCurveKnot) {
_riskLessValue = coupon.getYearFrac() * yieldCurve.getDiscountFactor(coupon.getPaymentTime());
_effEnd = coupon.getEffEnd();
_creditCurveKnot = creditCurveKnot;
}
//-------------------------------------------------------------------------
public double pv(IsdaCompliantCreditCurve creditCurve) {
return _riskLessValue * creditCurve.getDiscountFactor(_effEnd);
}
public double[] pvAndSense(IsdaCompliantCreditCurve creditCurve) {
double pv = _riskLessValue * creditCurve.getDiscountFactor(_effEnd);
double pvSense = -pv * creditCurve.getSingleNodeRTSensitivity(_effEnd, _creditCurveKnot);
return new double[] {pv, pvSense};
}
//-------------------------------------------------------------------------
@Override
public int hashCode() {
int prime = 31;
int result = 1;
result = prime * result + _creditCurveKnot;
long temp;
temp = Double.doubleToLongBits(_effEnd);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(_riskLessValue);
result = prime * result + (int) (temp ^ (temp >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
CouponOnlyElement other = (CouponOnlyElement) obj;
if (_creditCurveKnot != other._creditCurveKnot) {
return false;
}
if (Double.doubleToLongBits(_effEnd) != Double.doubleToLongBits(other._effEnd)) {
return false;
}
if (Double.doubleToLongBits(_riskLessValue) != Double.doubleToLongBits(other._riskLessValue)) {
return false;
}
return true;
}
}
| nssales/Strata-modules/pricer/src/main/java/com/opengamma/strata/pricer/impl/credit/isda/CouponOnlyElement.java |
var Vue = require('../../../../src/vue')
describe('Child API', function () {
var vm
beforeEach(function () {
vm = new Vue({
data: {
a: 1,
b: 1
},
directives: {
test: function () {}
}
})
})
it('default', function () {
var child = vm.$addChild()
expect(child instanceof Vue).toBe(true)
expect(child.a).toBeUndefined()
expect(child.$parent).toBe(vm)
expect(child.$root).toBe(vm)
expect(vm._children.indexOf(child)).toBe(0)
expect(child.$options.directives.test).toBeTruthy()
})
it('inherit scope', function () {
var child = vm.$addChild({
inherit: true,
data: {
b: 2
}
})
expect(child.a).toBe(1)
expect(child.b).toBe(2)
expect(child.constructor.prototype).toBe(vm)
})
it('with constructor', function () {
var Ctor = Vue.extend({
inherit: true,
data: function () {
return {
c: 3
}
}
})
var child = vm.$addChild({
data: {
b: 2
}
}, Ctor)
expect(child.a).toBe(1)
expect(child.b).toBe(2)
expect(child.c).toBe(3)
expect(child.constructor.options).toBe(Ctor.options)
})
it('cache constructor', function () {
var Ctor = Vue.extend({
inherit: true
})
var child1 = vm.$addChild(null, Ctor)
var child2 = vm.$addChild(null, Ctor)
expect(child1.constructor).toBe(child2.constructor)
})
it('Use proper constructor name with inherit', function () {
var Ctor = Vue.extend({
name: 'vue-test',
inherit: true
})
var child = vm.$addChild(null, Ctor)
expect(child.constructor.toString().match(/^function VueTest\s?\(/)).toBeTruthy()
})
}) | nkovacs/vue-test/unit/specs/api/child_spec.js |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: ack_notification.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='ack_notification.proto',
package='AckNotification',
syntax='proto2',
serialized_pb=_b('\n\x16\x61\x63k_notification.proto\x12\x0f\x41\x63kNotification\"\x19\n\x17\x41\x63kNotificationResponseB3\n com.google.android.finsky.protosB\x0f\x41\x63kNotification')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_ACKNOTIFICATIONRESPONSE = _descriptor.Descriptor(
name='AckNotificationResponse',
full_name='AckNotification.AckNotificationResponse',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=43,
serialized_end=68,
)
DESCRIPTOR.message_types_by_name['AckNotificationResponse'] = _ACKNOTIFICATIONRESPONSE
AckNotificationResponse = _reflection.GeneratedProtocolMessageType('AckNotificationResponse', (_message.Message,), dict(
DESCRIPTOR = _ACKNOTIFICATIONRESPONSE,
__module__ = 'ack_notification_pb2'
# @@protoc_insertion_point(class_scope:AckNotification.AckNotificationResponse)
))
_sym_db.RegisterMessage(AckNotificationResponse)
DESCRIPTOR.has_options = True
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n com.google.android.finsky.protosB\017AckNotification'))
# @@protoc_insertion_point(module_scope)
| mmcloughlin/finsky-finsky/protos/ack_notification_pb2.py |
/*
This module exports an object with a single function, which
if successful calls a callback function with the flickr API
object as argument for further use.
signature: authenticate(options, callback)
options argument: {
api_key: "your api key from flickr",
secret: "your api key secret from flickr",
user_id: negotiated through first-time authenticate() call
access_token: negotiated through first-time authenticate() call
access_token_secret: negotiated through first-time authenticate() call
}
callback argument: function(err, result)
*/
module.exports = (function Flickr() {
"use strict";
var fs = require("fs"),
request = require("request"),
Utils = require("./utils"),
RequestTokenFunction = require("./auth/request");
/**
* Check with Flickr whether we have a valid pre-existing access token
*/
var checkToken = function(options, callback) {
if(!options.access_token) {
return callback(new Error("no access token"));
}
options = Utils.setAuthVals(options);
var url = "https://api.flickr.com/services/rest",
method = "flickr.auth.oauth.checkToken",
queryArguments = {
method: method,
oauth_consumer_key: options.api_key,
oauth_nonce: options.oauth_nonce,
oauth_timestamp: options.oauth_timestamp,
oauth_signature_method: "HMAC-SHA1",
oauth_token: options.access_token
},
queryString = Utils.formQueryString(queryArguments),
data = Utils.formBaseString("GET", url, queryString),
signature = Utils.sign(data, options.secret, options.access_token_secret),
flickrURL = url + "?" + queryString + "&oauth_signature=" + signature;
request.get(flickrURL, function(error, response, body) {
if(error) {
callback(error);
}
callback(null, true);
});
};
/**
* Request an access token from Flickr
*/
var requestToken = function(options, callback) {
var receivedToken = function(err,body) {
if(err) {
return callback(err);
}
var response = Utils.parseRestResponse(body);
options.user_id = response.user_nsid;
options.access_token = response.oauth_token;
options.access_token_secret = response.oauth_token_secret;
if (options.callback === "oob" && !options.silent) {
console.log("\n\nAdd the following variables to your environment:\n");
console.log("export FLICKR_USER_ID=\"" + options.user_id + "\"");
console.log("export FLICKR_ACCESS_TOKEN=\"" + options.access_token + "\"");
console.log("export FLICKR_ACCESS_TOKEN_SECRET=\"" + options.access_token_secret + "\"");
console.log();
}
callback(false, {
FLICKR_USER_ID: '"' + options.user_id + '"',
FLICKR_ACCESS_TOKEN: '"' + options.access_token + '"',
FLICKR_ACCESS_TOKEN_SECRET: '"' + options.access_token_secret + '"'
});
};
new RequestTokenFunction(options, receivedToken);
};
/**
* The authentication function will sign into flickr as
* an app, obtaining authorization keys values if it
* does not already have them.
*/
var authenticate = function(options, next) {
if(!options) {
process.nextTick(function(){
next(new Error("Please pass an valid Flickr API key and secret to the Flickr module.\n"+
"Visit http://www.flickr.com/services/apps/create/apply to get one."));
});
return;
}
// out-of-browser authentication unless specified otherwise
if(!options.callback) { options.callback = "oob"; }
// effect authentication
checkToken(options, function(err, access) {
var APIBuilder = require("./flickr-api-object");
if(!access) {
requestToken(options, function(err, body) {
if(options.callback !== "oob") {
options.processCredentials = options.processCredentials || function(data) {
// default function writes creds to .env
if(!options.silent) {
console.log("Credentials object:");
console.log(JSON.stringify(data,null,2));
}
var envContent = fs.readFileSync(".env") + "\n";
Object.keys(data).forEach(function(key) {
envContent += "export " + key + "=" + data[key] + "\n";
});
fs.writeFileSync(".env", envContent);
};
options.processCredentials(body);
}
// is this auth only, or also API object creation?
if(options.noAPI) {
process.nextTick(function() { next(false); });
}
else { new APIBuilder(options, Utils, next); }
});
} else { new APIBuilder(options, Utils, next); }
});
};
/**
* If you only want to use the non-authenticated functions, you can bypass the oauth
* authentication and simply never call auth-locked Flickr API functions.
*/
var tokenOnly = function(options, next) {
if(!options) {
return next(new Error("Please pass an valid Flickr API key and secret to the Flickr module.\n"+
"Visit http://www.flickr.com/services/apps/create/apply to get one."));
}
var APIBuilder = require("./flickr-api-object");
options.tokenonly = true;
new APIBuilder(options, Utils, next);
};
/**
* The initial Flickr access point.
*/
return {
loadLocally: require("./handlers/ia"),
tokenOnly: tokenOnly,
authenticate: authenticate,
downsync: require("./handlers/downsync"),
upload: Utils.upload.bind(Utils)
};
}());
| dreemproject/dreemgl-system/lib/node_modules/flickrapi/src/FlickrAPI.js |
//
// AppDelegate.h
// 图片轮播器
//
// Created by User on 15/11/10.
// Copyright © 2015年 User. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
| dbmbeijing/Picture-carousel-device--图片轮播器/图片轮播器/AppDelegate.h |
package com.yesup.ad.framework;
/**
* Created by derek on 6/20/16.
*/
public class AdData {
private AdType adType;
private long dbId;
public long getDbId() {
return dbId;
}
public void setDbId(long dbId) {
this.dbId = dbId;
}
public void setAdType(AdType adType) {
this.adType = adType;
}
public AdType getAdType() {
return adType;
}
public enum AdType {
AdBanner, AdIntersitialImage, AdIntersitialPage, AdOfferWall
}
}
| yesup/partner-sdk-yesuppartner/src/main/java/com/yesup/ad/framework/AdData.java |
/*
* Copyright (c) 2004-2007 Atheros Communications Inc.
* All rights reserved.
*
*
// The software source and binaries included in this development package are
// licensed, not sold. You, or your company, received the package under one
// or more license agreements. The rights granted to you are specifically
// listed in these license agreement(s). All other rights remain with Atheros
// Communications, Inc., its subsidiaries, or the respective owner including
// those listed on the included copyright notices. Distribution of any
// portion of this package must be in strict compliance with the license
// agreement(s) terms.
// </copyright>
//
// <summary>
// Wifi driver for AR6002
// </summary>
//
*
*/
#ifndef _CONFIG_LINUX_H_
#define _CONFIG_LINUX_H_
#ifdef __cplusplus
extern "C" {
#endif
/*
* Host-side GPIO support is optional.
* If run-time access to GPIO pins is not required, then
* this should be changed to #undef.
*/
#define CONFIG_HOST_GPIO_SUPPORT
/*
* Host side Test Command support
*/
#define CONFIG_HOST_TCMD_SUPPORT
#define USE_4BYTE_REGISTER_ACCESS
/* Host-side support for Target-side profiling */
#undef CONFIG_TARGET_PROFILE_SUPPORT
/* Force AR6002 REV1 hardware to recognize Host */
#undef CONFIG_AR6002_REV1_FORCE_HOST
#ifdef __cplusplus
}
#endif
#endif
| giorgio130/KK_kernel-drivers/net/wireless/ar6000/os/linux/include/config_linux.h |
/*
* Copyright (C) 2007 Danilo Couto, Philippe Eberli,
* Pascal Hobus, Reto Schüttel, Robin Stocker
*
* This file is part of Bodesuri.
*
* Bodesuri is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Bodesuri is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Bodesuri; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package ch.bodesuri.pd.karten;
/**
* KartenFarbe, die zu einer {@link Karte} gehört.
*/
public enum KartenFarbe {
Herz, Karo, Kreuz, Pik
}
| retoo/bodesuri-src/ch/bodesuri/pd/karten/KartenFarbe.java |
/*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FIRESTORE_CORE_SRC_UTIL_BACKGROUND_QUEUE_H_
#define FIRESTORE_CORE_SRC_UTIL_BACKGROUND_QUEUE_H_
#include <condition_variable> // NOLINT(build/c++11)
#include <functional>
#include <mutex> // NOLINT(build/c++11)
namespace firebase {
namespace firestore {
namespace util {
class Executor;
/**
* A simple queue that executes tasks in parallel on an Executor and supports
* blocking on their completion.
*
* This class is thread-safe.
*/
class BackgroundQueue {
public:
explicit BackgroundQueue(Executor* executor);
/** Enqueue a task on the Executor. */
void Execute(std::function<void()>&& operation);
/** Wait for all currently scheduled tasks to complete. */
void AwaitAll();
private:
Executor* executor_ = nullptr;
int pending_tasks_ = 0;
std::mutex mutex_;
std::condition_variable done_;
};
} // namespace util
} // namespace firestore
} // namespace firebase
#endif // FIRESTORE_CORE_SRC_UTIL_BACKGROUND_QUEUE_H_
| firebase/firebase-ios-sdk-Firestore/core/src/util/background_queue.h |
//// [destructuringParameterProperties3.ts]
class C1<T, U, V> {
constructor(private k: T, private [a, b, c]: [T,U,V]) {
if ((b === undefined && c === undefined) || (this.b === undefined && this.c === undefined)) {
this.a = a || k;
}
}
public getA() {
return this.a
}
public getB() {
return this.b
}
public getC() {
return this.c;
}
}
var x = new C1(undefined, [0, true, ""]);
var [x_a, x_b, x_c] = [x.getA(), x.getB(), x.getC()];
var y = new C1(10, [0, true, true]);
var [y_a, y_b, y_c] = [y.getA(), y.getB(), y.getC()];
var z = new C1(10, [undefined, "", ""]);
var [z_a, z_b, z_c] = [z.getA(), z.getB(), z.getC()];
var w = new C1(10, [undefined, undefined, undefined]);
var [z_a, z_b, z_c] = [z.getA(), z.getB(), z.getC()];
//// [destructuringParameterProperties3.js]
var C1 = /** @class */ (function () {
function C1(k, _a) {
var a = _a[0], b = _a[1], c = _a[2];
this.k = k;
if ((b === undefined && c === undefined) || (this.b === undefined && this.c === undefined)) {
this.a = a || k;
}
}
C1.prototype.getA = function () {
return this.a;
};
C1.prototype.getB = function () {
return this.b;
};
C1.prototype.getC = function () {
return this.c;
};
return C1;
}());
var x = new C1(undefined, [0, true, ""]);
var _a = [x.getA(), x.getB(), x.getC()], x_a = _a[0], x_b = _a[1], x_c = _a[2];
var y = new C1(10, [0, true, true]);
var _b = [y.getA(), y.getB(), y.getC()], y_a = _b[0], y_b = _b[1], y_c = _b[2];
var z = new C1(10, [undefined, "", ""]);
var _c = [z.getA(), z.getB(), z.getC()], z_a = _c[0], z_b = _c[1], z_c = _c[2];
var w = new C1(10, [undefined, undefined, undefined]);
var _d = [z.getA(), z.getB(), z.getC()], z_a = _d[0], z_b = _d[1], z_c = _d[2];
| kpreisser/TypeScript-tests/baselines/reference/destructuringParameterProperties3.js |
using System.Collections.Generic;
namespace SharpDX.Toolkit.Graphics
{
public class MaterialKeysBase
{
private static readonly Dictionary<string, PropertyKey> registeredKeys = new Dictionary<string, PropertyKey>(64);
/// <summary>
/// The name of the material, if available.
/// </summary>
public readonly static PropertyKey<string> Name = RegisterKey(new PropertyKey<string>("Name"));
/// <summary>
/// Specifies whether meshes using this material must be rendered without backface culling. 0 for false, !0 for true.
/// </summary>
public readonly static PropertyKey<bool> TwoSided = RegisterKey(new PropertyKey<bool>("TwoSided"));
/// <summary>
/// One of the <see cref="MaterialShadingMode"/> enumerated values. Defines the library shading model to use for (real time) rendering to approximate the original look of the material as closely as possible.
/// </summary>
public readonly static PropertyKey<MaterialShadingMode> ShadingMode = RegisterKey(new PropertyKey<MaterialShadingMode>("ShadingMode"));
/// <summary>
/// Specifies whether wireframe rendering must be turned on for the material. 0 for false, !0 for true.
/// </summary>
public readonly static PropertyKey<bool> Wireframe = RegisterKey(new PropertyKey<bool>("Wireframe"));
/// <summary>
/// Defines the blending mode used when rendering this material.
/// </summary>
public readonly static PropertyKey<MaterialBlendMode> BlendMode = RegisterKey(new PropertyKey<MaterialBlendMode>("BlendMode"));
/// <summary>
/// Defines the opacity of the material in a range between 0..1.
/// </summary>
public readonly static PropertyKey<float> Opacity = RegisterKey(new PropertyKey<float>("Opacity"));
/// <summary>
/// Defines the bump normal scaling.
/// </summary>
public readonly static PropertyKey<float> BumpScaling = RegisterKey(new PropertyKey<float>("BumpScaling"));
/// <summary>
/// Defines the shininess of a Phong-shaded material. This is actually the exponent of the Phong specular equation
/// </summary>
public readonly static PropertyKey<float> Shininess = RegisterKey(new PropertyKey<float>("Shininess"));
/// <summary>
/// Defines the reflectivity of the material.
/// </summary>
public readonly static PropertyKey<float> Reflectivity = RegisterKey(new PropertyKey<float>("Reflectivity"));
/// <summary>
/// Scales the specular color of the material.
/// </summary>
public readonly static PropertyKey<float> ShininessStrength = RegisterKey(new PropertyKey<float>("ShininessStrength"));
/// <summary>
/// Defines the Index Of Refraction for the material. That's not supported by most file formats.
/// </summary>
public readonly static PropertyKey<float> Refraction = RegisterKey(new PropertyKey<float>("Refraction"));
/// <summary>
/// Diffuse color of the material. This is typically scaled by the amount of incoming diffuse light (e.g. using Gouraud shading).
/// </summary>
public readonly static PropertyKey<Color4> ColorDiffuse = RegisterKey(new PropertyKey<Color4>("ColorDiffuse"));
/// <summary>
/// Ambient color of the material. This is typically scaled by the amount of ambient light
/// </summary>
public readonly static PropertyKey<Color4> ColorAmbient = RegisterKey(new PropertyKey<Color4>("ColorAmbient"));
/// <summary>
/// Specular color of the material. This is typically scaled by the amount of incoming specular light (e.g. using Phong shading)
/// </summary>
public readonly static PropertyKey<Color3> ColorSpecular = RegisterKey(new PropertyKey<Color3>("ColorSpecular"));
/// <summary>
/// Emissive color of the material. This is the amount of light emitted by the object. In real time applications it will usually not affect surrounding objects, but ray tracing applications may wish to treat emissive objects as light sources.
/// </summary>
public readonly static PropertyKey<Color3> ColorEmissive = RegisterKey(new PropertyKey<Color3>("ColorEmissive"));
/// <summary>
/// Defines the transparent color of the material, this is the color to be multiplied with the color of translucent light to construct the final 'destination color' for a particular position in the screen buffer. T
/// </summary>
public readonly static PropertyKey<Color4> ColorTransparent = RegisterKey(new PropertyKey<Color4>("ColorTransparent"));
/// <summary>
/// Defines the reflective color of the material.
/// </summary>
public readonly static PropertyKey<Color4> ColorReflective = RegisterKey(new PropertyKey<Color4>("ColorReflective"));
/// <summary>
/// Gets the registered keys.
/// </summary>
/// <value>The registered keys.</value>
public static IEnumerator<PropertyKey> RegisteredKeys
{
get
{
return registeredKeys.Values.GetEnumerator();
}
}
/// <summary>
/// Finds the name of the key by.
/// </summary>
/// <param name="name">The name.</param>
/// <returns>PropertyKey.</returns>
public static PropertyKey FindKeyByName(string name)
{
PropertyKey key;
registeredKeys.TryGetValue(name, out key);
return key;
}
/// <summary>
/// Registers the specified key.
/// </summary>
/// <typeparam name="T">Type of the property</typeparam>
/// <param name="key">The key.</param>
/// <returns>The key.</returns>
public static PropertyKey<T> RegisterKey<T>(PropertyKey<T> key)
{
registeredKeys[key.Name] = key;
return key;
}
}
} | shoelzer/SharpDX-Source/Toolkit/SharpDX.Toolkit/Graphics/MaterialKeysBase.cs |
Bingham Canyon (lungsod) - Wikipedia
Tiganos: 40°33′30″N 112°07′50″W / 40.55833°N 112.13056°V / 40.55833; -112.13056
Alang sa ubang mga dapit sa mao gihapon nga ngalan, tan-awa ang Bingham Canyon.
40°33′30″N 112°07′50″W / 40.55833°N 112.13056°V / 40.55833; -112.13056
726 (2013-09-09) [1]
Lungsod ang Bingham Canyon sa Tinipong Bansa.[1] Ang Bingham Canyon nahimutang sa kondado sa Salt Lake County ug estado sa Utah, sa sentro nga bahin sa nasod, 3,000 km sa kasadpan sa ulohang dakbayan Washington, D.C. 1,777 metros ibabaw sa dagat kahaboga ang nahimutangan sa Bingham Canyon[1], ug adunay 726 ka molupyo.[1]
Ang yuta palibot sa Bingham Canyon kay kasagaran kabungtoran, apan sa kasadpan nga kini mao ang kabukiran. Ang yuta palibot sa Bingham Canyon nga tinakpan sa ubos sa sidlakan.[saysay 1] Kinahabogang dapit sa palibot ang Curry Peak, 2,265 ka metros ni kahaboga ibabaw sa dagat, 1.9 km sa amihanan-kasadpan sa Bingham Canyon.[saysay 2] Dunay mga 108 ka tawo kada kilometro kwadrado sa palibot sa Bingham Canyon medyo hilabihan populasyon.[3] Ang kinadul-ang mas dakong lungsod mao ang West Valley City, 18.4 km sa amihanan-sidlakan sa Bingham Canyon. Hapit nalukop sa kasagbotan ang palibot sa Bingham Canyon.[4] Sa rehiyon palibot sa Bingham Canyon, mga patag, mga kapanguhaan, mga walog, ug mga kanal talagsaon komon.[saysay 3]
Nahimutangan sa Bingham Canyon sa Tinipong Bansa.
↑ 1.0 1.1 1.2 1.3 1.4 1.5 Bingham Canyon sa Geonames.org (cc-by); post updated 2013-09-09; database download sa 2017-02-28
Gikuha gikan sa "https://ceb.wikipedia.org/w/index.php?title=Bingham_Canyon_(lungsod)&oldid=28057246" | c4-ceb |
var difficulty_multipliers = __QUIZ_CONFIG__.score_difficulty_multipliers // eslint-disable-line no-undef
var final_multiplier = __QUIZ_CONFIG__.score_final_multiplier // eslint-disable-line no-undef
function _gradeSingleQuestion(question) {
if (question.answer == question.current_answer) {
return 1;
}
return 0;
}
function _gradeMultiQuestion(question) {
let result = 0;
let answers = question.answer;
for (let current_answer of question.current_answer) {
if (answers.indexOf(current_answer) !== -1) {
result += (1 / answers.length);
} else {
result -= (1 / answers.length);
}
}
return Math.max(result, 0);
}
function _gradeStrExactQuestion(question) {
var current_answer = question.current_answer.trim().toLowerCase();
if (question.answer == current_answer) {
return 1;
}
return 0;
}
function _gradeStrRegexQuestion(question) {
var current_answer = question.current_answer.trim().toLowerCase();
var regex = new RegExp(question.answer);
var matches = regex.exec(current_answer);
if (matches) {
return 1
}
return 0
}
function _gradeQuestion(question) {
switch(question.answer_format) {
case 'mc_single':
return _gradeSingleQuestion(question);
case 'mc_multi':
return _gradeMultiQuestion(question);
case 'str_exact':
return _gradeStrExactQuestion(question);
case 'str_regex':
return _gradeStrRegexQuestion(question);
default:
throw 'Unknown answer format:' + question.answer_format;
}
}
function gradeQuiz(questions) {
var answers = [];
var total_score = 0;
for (let index in questions) {
index = parseInt(index); // Index is a string, really?
let question = questions[index];
let score = _gradeQuestion(question)
let difficulty = question.difficulty;
let multiplier = difficulty_multipliers[difficulty]
let weighted_score = score * multiplier;
total_score += weighted_score;
let display_index = index + 1;
if (score === 1) {
answers.push({
text: 'Answer ' + display_index + ' was correct',
correctness: 'correct',
difficulty: difficulty,
score: total_score,
});
} else if ( 0 < score && score < 1) {
answers.push({
text: 'Answer ' + display_index + ' was partially correct',
correctness: 'partial',
difficulty: difficulty,
score: total_score,
});
} else {
answers.push({
text: 'Answer ' + display_index + ' was wrong',
correctness: 'incorrect',
difficulty: difficulty,
score: total_score,
});
}
}
total_score *= final_multiplier;
total_score = parseInt(total_score);
return {
score: total_score,
answers: answers,
};
}
module.exports = {gradeQuiz: gradeQuiz};
| sergio97/tvshow-quiz-quizmaster/js/core/quizGrader.js |
// PARSER_WEEDER
public final class J1_finalclass2 {
public J1_finalclass2() { }
public static int test() { return 123; }
}
| gregwym/joos-compiler-java-testcases/a1/J1_finalclass2.java |
Proof of Proposition 3.1
**Proposition 3**.: _Let \(\alpha\in]0,1[\), \(\gamma>0\) and \(J\geq 2\). Let \(\{T_{j}\}_{j=1}^{J}\) sampled i.i.d. from the distribution \(\Gamma\) and let \(X:=\{x_{i}\}_{i=1}^{n}\) and \(Y:=\{y_{i}\}_{i=1}^{n}\) i.i.d. samples from \(P\) and \(Q\) respectively. Let us denote \(\delta\) the \((1-\alpha)\)-quantile of the asymptotic null distribution of \(\widehat{d}_{\ell_{1},\mu,J}^{2}[X,Y]\) and \(\beta\) the \((1-\alpha)\)-quantile of the asymptotic null distribution of \(\widehat{d}_{\ell_{2},\mu,J}^{2}[X,Y]\). Under the alternative hypothesis, almost surely, there exists \(N\geq 1\) such that for all \(n\geq N\), with a probability of at least \(1-\gamma\) we have:_
\[\widehat{d}_{\ell_{2},\mu,J}^{2}[X,Y]>\beta\Rightarrow\widehat{d}_{\ell_{1}, \mu,J}[X,Y]>\delta \tag{26}\]
**Proof.**_First we remarks that:_
\[\widehat{d}_{\ell_{2},\mu,J}^{2}[X,Y]=\|\sqrt{n}\mathbf{S}_{n}\|_{2}^{2}\]
_and_
\[\widehat{d}_{\ell_{1},\mu,J}[X,Y]=\|\sqrt{n}\mathbf{S}_{n}\|_{1}\]
_where \(\mathbf{S}_{n}:=\frac{1}{n}\sum_{i=1}^{n}\mathbf{z}_{i}^{\omega}\) and \(\mathbf{z}_{i}:=\left(k\left(x_{i},T_{1}\left(\omega\right)\right)-k\left(y_{ j},T_{1}\left(\omega\right)\right),...,k\left(x_{i},T_{J}\left(\omega\right) \right)-k\left(y_{j},T_{J}\left(\omega\right)\right)\right)\). Let us now introduce the following Lemma:_
**Lemma 8**.: _Let \(\mathbf{x}\) a random vector \(\in\mathbb{R}^{J}\) with \(J\geq 2\), \(\mathbf{z}:=\min\limits_{j\in[1,J]}\|x_{j}|\), \(\epsilon>0\) and \(\gamma>0\). If_
\[\mathbb{P}(\mathbf{z}\geq\epsilon)\geq 1-\gamma\]
_we have with a probability of at least \(1-\gamma\) that, \(\forall t_{1}\geq t_{2}\geq 0\), if \(\epsilon\geq\sqrt{\frac{t_{1}^{2}-t_{2}^{2}}{J\left(J-1\right)}}\), then_
\[\|\mathbf{x}\|_{2}\!\!>t_{2}\Rightarrow\|\mathbf{x}\|_{1}\!\!>t_{1}.\]
**Proof.**_First we remarks that:_
\[\epsilon>\sqrt{\frac{t_{1}^{2}-t_{2}^{2}}{J\left(J-1\right)}}\Rightarrow J\left(J-1\right)\epsilon>t_{1}^{2}-t_{2}^{2}\] \[\Rightarrow t_{2}^{2}>t_{1}^{2}-J\left(J-1\right)\epsilon^{2}\]_Therefore, we have:_
\[\|\mathbf{x}\|_{2}{\geq}\ t_{2} {\Rightarrow}\|\mathbf{x}\|_{2}^{2}{+}J\left(J-1\right)\epsilon^{2} \geq t_{1}^{2}\] \[{\Rightarrow}\sqrt{\|\mathbf{x}\|_{2}^{2}{+}J\left(J-1\right) \epsilon^{2}}\geq t_{1}\]
_But we have that:_
\[\|\mathbf{x}\|_{1}^{2}{=}\sum_{i=1}^{J}\lvert\mathbf{x}_{i}\rvert^{2}{+}\sum_ {i\neq j}\lvert\mathbf{x}_{i}\rvert\lvert\mathbf{x}_{j}\rvert\]
_Therefore we have with a probability of \(I{\sim}\) that:_
\[\|\mathbf{x}\|_{1}^{2}{\geq}\ \|\mathbf{x}\|_{2}^{2}{+}J\left(J-1\right) \epsilon^{2}\]
_And:_
\[\|\mathbf{x}\|_{2}{\geq}\ t_{2}\ {\Rightarrow}\ \|\mathbf{x}\|_{1}{\geq}\ t_{1}\]
_Moreover by denoting \(\delta\) the \((1-\alpha)\)-quantile of the asymptotic null distribution of \(\widehat{d}_{\ell_{1},\mu,J}[X,Y]\) and \(\beta\) the \((1-\alpha)\)-quantile of the asymptotic null distribution of \(\widehat{d}_{\ell_{2},\mu,J}^{2}[X,Y]\) we have that \(\delta\geq\sqrt{\beta}\):_
**Lemma 9**.: _Let \(\mathbf{x}\) be a random vector in \(\mathbb{R}^{J}\), \(\delta\) the \((1-\alpha)\)-quantile of \(\|\mathbf{x}\|_{1}\) and \(\beta\) the \((1-\alpha)\)-quantile of \(\|\mathbf{x}\|_{2}\). We have then:_
\[\delta\geq\beta\geq 0. \tag{27}\]
Proof.: _The results is a direct consequence of the domination of the \(\ell_{1}\) norm:_
\[\|\mathbf{x}\|_{1}{\geq}\ \|\mathbf{x}\|_{2}\]
_Indeed, under \(H_{0}\), we have shown that (see proof Proposition 2):_
\[\sqrt{n}\mathbf{S}_{n}\rightarrow\mathcal{N}\left(0,\mathbf{\Sigma}^{\omega} \right)\qquad\text{with}\qquad\mathbf{\Sigma}:=\text{Cov}(\mathbf{z})\]
_Therefore by applying the Lemma 9 to \(\mathbf{x}\) which follows \(\mathcal{N}\left(0,\mathbf{\Sigma}^{\omega}\right)\), we obtain that \(\delta\geq\sqrt{\beta}\). Now, To show the result we only need to show that the assumption of the Lemma 8 is asstified for the random vector \(\mathbf{x}:=\sqrt{n}\mathbf{S}_{n}\), \(t_{1}=\delta\) and \(t_{2}=\sqrt{\beta}\), i.e. for \(\epsilon=\sqrt{\frac{\delta^{2}-\beta}{J\left(J-1\right)}}\) under the alternative hypothesis. Under \(H_{1}:P\neq Q\), we have that \(\mathbf{S}_{n}\) converge in probability to \(\mathbf{S}:=\mathbb{E}_{(x,y)\sim(P,Q)}(\mathbf{S}_{n})\). Then by continuity of the application:_
\[\phi_{j}:x:=(x_{j})_{j=1}^{J}\mathbb{R}^{J}\rightarrow\lvert x_{j}\rvert\]
_, we have that for all \(j\in[[1,J]]\), \(\lvert(\mathbf{S}_{n})_{j}\rvert\) converges in probability towards \(\mathbf{S}_{j}\), the \(j\)-th coordinate of \(\mathbf{S}\). Since \(\mathbf{S}=(\mu_{P}(T_{j})-\mu_{Q}(T_{j}))_{j=1}^{J}\), thanks to the analyticity of the kernel \(k\), the Lemma 7 guarantees the anlaycity of \(\mu_{P}-\mu_{Q}\). And thanks to the injectivity of the mean embedding function, \(\mu_{P}-\mu_{Q}\) is a non-zero function, therefore thanks to Lemma 5\(\mu_{P}-\mu_{Q}\) is non zero almost everywhere. Moreover the \((T_{j})_{j=1}^{J}\) are independent, therefore the coordinates of \(\mathbf{S}\) are almost surely all nonzero. Then we have then for all \(j\in\llbracket 1,J\rrbracket\):_
\[\mathbb{P}\left(\left|(\sqrt{n}\mathbf{S}_{n})_{j}\right|>\epsilon\right)= \mathbb{P}\left(\left|(\mathbf{S}_{n})_{j}\right|-\frac{\epsilon}{\sqrt{n}}>0\right)\]
_And as \(\frac{\epsilon}{\sqrt{n}}\to 0\) as \(n\rightarrow\infty\), we have finally almost surely for all \(j\in\llbracket 1,J\rrbracket\):_
\[\mathbb{P}_{X,Y}\left(\left|(\sqrt{n}\mathbf{S}_{n})_{j}\right|\geq\epsilon \right)\to 1\text{ as }n\rightarrow\infty\]
_Therefore almost surely there exist \(N\geq 1\) such that for all \(n\geq N\) and for all \(j\in\llbracket 1,J\rrbracket\):_
\[\mathbb{P}_{X,Y}\left(\left|(\sqrt{n}\mathbf{S}_{n})_{j}\right|\geq\epsilon \right)\geq 1-\frac{\gamma}{J}\]
_Finally by applying a union bound we obtain that almost surely, for all \(n\geq N\):_
\[\mathbb{P}_{X,Y}\left(\forall j\in[[1,J]]\text{, }\left|(\sqrt{n}\mathbf{S}_{n})_{j }\right|\geq\epsilon\right)\geq 1-\gamma\]
_Therefore by applying Lemma 8, we obtain that, almost surely, for all \(n\geq N\), with a probability of at least \(1-\gamma\):_
\[\|\sqrt{n}\mathbf{S}_{n}\|_{2}{>}\ \sqrt{\beta}\Rightarrow\|\sqrt{n}\mathbf{S}_{n}\|_{1}{>}\ \delta.\] | 1909.09264v2.mmd |
# Represents a grid of characters. This is similar to what a framebuffer would
# be for graphical applications.
# @author Dylan Frese
class Canvas
# @return [Integer] the width, in characters, of the Canvas
attr_reader :width
# @return [Integer] the height, in characters, of the Canvas
attr_reader :height
# Create a new Canvas. The characters are set to spaces.
# @param [Integer] width the width in characters of the Canvas.
# @param [Integer] height the height in characters of the Canvas.
def initialize(width = 80, height = 40)
@chars = Array.new(width * height){' '}
@width = width
@height = height
end
# Sets a character at a certain index.
#
# The parameters work similarly to those of Board#[]=: if three parameters
# are set, the first two are taken to be indices and the last to be a
# value. Otherwise, the first is taken to be the index and the second to be
# the value.
#
# If the value is a String, the first character is taken. If it is not a
# String, it is first converted to a String via the Object#to_s method.
# @param [Integer] x the first parameter
# @param [Integer,String,Object] y the second parameter
# @param [String,Object] z the third parameter
# @return [void]
def []=(x, y, z = nil)
if z
index = x + y * width
return if x > @width || y > @height
value = z
else
index = x
return if index > @chars.size
value = y
end
return if index >= @chars.size
if value.respond_to? :chr
@chars[index] = value.chr
else
@chars[index] = value.to_s.chr
end
end
# Gets the character at a certain position.
# The parameters work similarly to those of Board#[]: if two parameters are
# defined, they are taken to be the x- and y- indices. Otherwise, the first
# parameter is taken to be the index.
# @param [Integer] x the index, or x-index if y is not nil
# @param [Integer] y the y-index if defined
# @return [String] the character at the specified location
def [](x, y = nil)
if y
@chars[x + y * width]
else
@chars[x]
end
end
# 'Clears' the Canvas inside the specified rectangle with the specified
# char. This sets every space to that character.
# @param [Integer] x the location of the left edge of the rectangle
# @param [Integer] y the location of the top edge of the rectangle
# @param [Integer] width the width of the rectangle
# @param [Integer] height the height of the rectangle
# @return [void]
def clear(x=0, y=0, width=width, height=height, char=" ")
x.upto(width) do |xpos|
y.upto(height) do |ypos|
self[xpos, ypos] = char
end
end
nil
end
# Renders a string on the Canvas at the specified location. This does not
# do string splitting, and will end if it hits the edge of the Canvas.
# @param [String,#each_char] string the string to be rendered
# @param [Integer] x the x-position of the first character of the string
# @param [Integer] y the y-position of the first character of the string
# @return [void]
def render_string(string, x, y)
string.each_char.each_with_index do |char, index|
return if x + index >= width
self[x + index, y] = char
end
end
# Returns the string representation of this Canvas.
#
# The representation is each line of characters joined by a newline.
# @return [String] the string representation of this Canvas
def to_s
@chars.each_slice(width).map do |line|
line.join("")
end.join("\n")
end
end
| DylanFrese/TicTacChess-src/cli/display/Canvas.rb |
# Survey on Self-Supervised Multimodal Representation Learning and Foundation Models
Sushil Thapa
Department of Computer Science and Engineering
New Mexico Tech
[email protected]
Work done as a part of coursework "CSE-585: Graduate Seminar" under Prof. Dr. Clinton L. Jeffery.
###### Abstract
Deep learning has been the subject of growing interest in recent years. Specifically, a specific type called Multimodal learning has shown great promise for solving a wide range of problems in domains such as language, vision, audio, etc. One promising research direction to improve this further has been learning rich and robust low-dimensional data representation of the high-dimensional world with the help of large-scale datasets present on the internet. Because of its potential to avoid the cost of annotating large-scale datasets, self-supervised learning has been the de facto standard for this task in recent years. This paper summarizes some of the landmark research papers that are directly or indirectly responsible to build the foundation of multimodal self-supervised learning of representation today. The paper goes over the development of representation learning over the last few years for each modality and how they were combined to get a multimodal agent later.
## 1 Introduction
Deep learning has advanced to the point that it is now one of the most important components of most intelligent systems. Deep neural networks (DNNs) are a compelling approach in computer vision (CV) tasks and natural language processing (NLP) tasks due to their ability to learn rich patterns from the data available today. However, because of the high-cost requirements to annotate datasets, the supervised approach of learning features from labeled data has practically achieved saturation. To avoid this, researchers nowadays have started to learn the supervisory signals without explicit supervision from humans. Since the model self-learns the supervision from the data itself, it is called self-supervised learning which is different from Supervised learning where we explicitly annotate supervision, Unsupervised where we have no supervision whatsoever, and Reinforcement learning where we get the rewards from the environment for our steps. Such models use billions of public images, texts, or other modality datasets to learn features that help to have a fundamental understanding of the world around us. It started out as using neural networks to learn language models[Bengio et al., 2003]and learning distributed representations of words [Mikolov et al., 2013]. Once the attention came in place[Bahdanau et al., 2015][Vaswani et al., 2017], NLP has had breakthrough progress on various NLP tasks[Devlin et al., 2019][Floridi and Chirirati, 2020][Lan et al., 2019]. Following the advances in NLP, researchers also tried exploring similar problem formulation on other modalities like images [Dosovitskiy et al., 2020][Wu et al., 2021], audio [Chi et al., 2021][Chuang et al., 2020] and the combination of at least two of those modalities[Akbari et al., 2021][Su et al., 2019][Wang et al., 2020].
This paper surveys the development of each of such modalities and the progress of combining those modalities into a single system. The goal is to discuss the emerging self-supervised techniques for such modalities and understand the motivation of multimodal fusion to build a model that canperceive the world much like how our senses do. There are hundreds of papers that investigate this, but we filtered them by choosing only the influential papers with good reputations and progress over previous systems. This is, as per our knowledge, the most recent and most comprehensive survey that focuses on this area of research.
## 2 Research Questions
The paper initially establishes how each modality representation improved through a literature review. It discusses language, vision, audio, and robotics applications separately. It then follows up with the other type of research where they combine such modalities in one way or the other. In summary, it asks the following research questions focusing on the methodologies of learning such representations.
* What was the motivation for learning self-supervised representations?
* How the different techniques could be applied for learning representations for multiple types of modalities?
* How can the multiple separate modalities be combined to get more effective AI agents? What do we gain by combining them?
## 3 Related Work
This section focuses on the progress in the individual modalities separately. The success of each of these modalities is the foundation of the current success in multimodal systems.
### Language
#### 3.1.1 Language Model and Embedding
With the motivation of learning statistical models for defining languages, this paper proposes a method to learn the statistical joint probability distribution function of sequences of words that come together in sentences. This paper eliminates the curse of dimensionality by learning a distributed representation for words by training with neighboring words in sentences. In this statistical model[1], the words and language can be represented by the conditional probability of the next word given all previous ones, such that
\[\hat{P}(w_{1}^{T})=\prod_{t=1}^{T}\hat{P}(w_{t}|w_{1}^{t-1})\]
where \(w_{t}\) is the \(t\)-th word and writing sub-sequence
\(w_{i}^{j}=(w_{i},w_{i+1},...,w_{j-1},w_{j})\). However, analyzing all the previous occurred can be compute-intensive and slow, so they used a setup that would only look at past \(n\) words by building \(n-grams\) to learn the context. Larger the value of \(n\), the bigger context they would learn from it. Now the right expression approximately becomes:
\[\hat{P}(w_{t}|w_{1}^{t-1})\approx\hat{P}(w_{t}|w_{t-n+1}^{t-1})\]
Such language models were great to get a sense of what is the next possible word given a sequence of previous words. However, instead of learning a model with previous words, later works[12][21] focused more on building a big embedding representation of words based on the company they keep. They used contexts to predict the associated words and also learn language models. They also used a simple linear model to go through billions of words within a day. Interestingly, when we looked at the embedding it learned through such a setup, we could get the interpretable association of analogies as shown in Figure 1. | 2211.15837v1.mmd |
export default {
get: function() {
return this._.speed;
},
set: function(s) {
if (typeof s !== 'number' ||
isNaN(s) ||
!isFinite(s) ||
s <= 0) {
return this._.speed;
}
this._.speed = s;
if (this._.stage.width) {
this._.duration = this._.stage.width / s;
}
return s;
}
};
| weizhenye/Danmaku-src/api/speed.js |
Images = {}
function gameImage(string)
return Image.Create(AssetLocation.Game, string)
end
function createImages()
-- The white icons present below aren't used in the script, but are available
-- for your use. While the texture path says green, they are actually white.
Images.Sea = {
Unoccupied = gameImage("hud_icon_boat_yellow_dif.dds"),
Occupied = gameImage("hud_icon_boat_orange_dif.dds"),
Destroyed = gameImage("hud_icon_boat_red_dif.dds"),
White = gameImage("hud_icon_boat_green_dif.dds"),
}
Images.Land = {
Unoccupied = gameImage("hud_icon_car_yellow_dif.dds"),
Occupied = gameImage("hud_icon_car_orange_dif.dds"),
Destroyed = gameImage("hud_icon_car_red_dif.dds"),
White = gameImage("hud_icon_car_green_dif.dds"),
}
Images.Air = {
Unoccupied = gameImage("hud_icon_heli_yellow_dif.dds"),
Occupied = gameImage("hud_icon_heli_orange_dif.dds"),
Destroyed = gameImage("hud_icon_heli_red_dif.dds"),
White = gameImage("hud_icon_heli_green_dif.dds"),
}
end
function getVehicleType(vehicle)
boats = { 5,6,16,19,25,27,28,38,45,50,53,69,80,88 }
planes = { 3,14,24,30,34,37,39,51,57,59,62,64,65,67,81,85 }
local vehicleId = vehicle:GetModelId()
-- If we can find it in the boats array, it's a sea vehicle
if table.find(boats, vehicleId) then
return "Sea"
-- Otherwise, if we can find it in the planes array, it's an air vehicle
elseif table.find(planes, vehicleId) then
return "Air"
else
-- If we're here, it must be a land vehicle.
return "Land"
end
end
function getVehicleState(vehicle)
if vehicle:GetHealth() < 0.1 then
return "Destroyed"
elseif vehicle:GetDriver() ~= nil then
return "Occupied"
else
return "Unoccupied"
end
end
IconSize = Vector2(18, 18)
IconOffset = -IconSize/2
function drawVehicle(v)
if not IsValid(v) then return end
local pos, inRange = Render:WorldToMinimap(v:GetPosition())
-- Don't show the vehicle if it's being driven by the local player
if inRange and v:GetDriver() ~= LocalPlayer then
local typeImages = Images[getVehicleType(v)]
local image = typeImages[getVehicleState(v)]
image:Draw(pos + IconOffset, IconSize, Vector2.Zero, Vector2.One)
end
end
function render()
if Game:GetState() ~= GUIState.Game then return end
for vehicle in Client:GetVehicles() do
drawVehicle(vehicle)
end
end
Events:Subscribe("Render", render)
Events:Subscribe("ModuleLoad", createImages) | Jman100/jc2mp-minimapvehicleicons-client/image.lua |
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#import "TiRootController.h"
#import "TiWindowProxy.h"
/**
The class represent root controller in a view hierarchy.
*/
@interface TiRootViewController : UIViewController<UIApplicationDelegate,TiRootController,TiOrientationController> {
@private
//Presentation: background image and color.
UIColor * backgroundColor;
UIImage * backgroundImage;
//View Controller stack:
/*
* Due to historical reasons, there are three arrays that track views/
* windows/viewcontrollers that are 'opened' on the rootViewController.
* For best results, this should be realigned with a traditional container-
* style view controller, perhaps even something proxy-agnostic in the
* future. TODO: Refactor viewController arrays.
*/
NSMutableArray *windowViewControllers;
NSMutableArray * viewControllerStack;
NSMutableArray * windowProxies;
//While no windows are onscreen, present default.png
UIImageView * defaultImageView;
//Orientation handling:
TiOrientationFlags allowedOrientations;
UIInterfaceOrientation orientationHistory[4]; // Physical device orientation history
BOOL forceOrientation; // Force orientation flag
UIInterfaceOrientation windowOrientation; // Current emulated orientation
BOOL isCurrentlyVisible;
//Keyboard handling -- This can probably be done in a better way.
BOOL updatingAccessoryView;
UIView * enteringAccessoryView; //View that will enter.
UIView * accessoryView; //View that is onscreen.
UIView * leavingAccessoryView; //View that is leaving the screen.
TiViewProxy<TiKeyboardFocusableView> * keyboardFocusedProxy; //View whose becoming key affects things.
CGRect startFrame; //Where the keyboard was before the handling
CGRect targetedFrame; //The keyboard place relative to where the accessoryView is moving;
CGRect endFrame; //Where the keyboard will be after the handling
BOOL keyboardVisible; //If false, use enterCurve. If true, use leaveCurve.
UIViewAnimationCurve enterCurve;
CGFloat enterDuration;
UIViewAnimationCurve leaveCurve;
CGFloat leaveDuration;
}
/**
Returns visibility of on-screen keyboard.
*/
@property(nonatomic,readonly) BOOL keyboardVisible;
/*
Returns image view being displayed while application's view is loading.
*/
@property(nonatomic,readonly) UIImageView * defaultImageView;
/**
Returns current window orientation.
*/
@property(nonatomic,readonly) UIInterfaceOrientation windowOrientation;
/*
Tells the controller to hides and release the default image view.
@see defaultImageView
*/
-(void)dismissDefaultImageView;
/*
Provides access to background color of the view represented by the root view controller.
@see backgroundImage
*/
@property(nonatomic,readwrite,retain) UIColor * backgroundColor;
/*
Provides access to background image of the view represented by the root view controller.
@see backgroundColor
*/
@property(nonatomic,readwrite,retain) UIImage * backgroundImage;
/**
Returns currently focused view controller.
@return Focused view controller.
*/
-(UIViewController *)focusedViewController;
-(void)windowFocused:(UIViewController*)focusedViewController;
-(void)windowClosed:(UIViewController *)closedViewController;
/**
Tells the controller to resize its view to the size of main screen.
@return The bounds of the view after resize.
*/
-(CGRect)resizeView;
/**
Tells the controller to resize its view to the size of main screen adjusted according to visibility of status bar.
@return The bounds of the view after resize.
*/
-(CGRect)resizeViewForStatusBarHidden;
/**
Tells the controller to reposition all its subviews.
*/
-(void)repositionSubviews;
-(void)refreshOrientationWithDuration:(NSTimeInterval) duration;
-(NSTimeInterval)suggestedRotationDuration;
/**
Tells the controller to rotate to the specified orientation.
@param newOrientation The new orientation.
@param duration The rotation animation duration.
*/
-(void)manuallyRotateToOrientation:(UIInterfaceOrientation)newOrientation duration:(NSTimeInterval)duration;
-(UIInterfaceOrientation)lastValidOrientation;
/**
Tells the controller to open the specified window proxy.
@param window The window proxy to open.
@param args Reserved for future use.
*/
- (void)openWindow:(TiWindowProxy *)window withObject:(id)args;
/**
Tells the controller to close the specified window proxy.
@param window The window proxy to close.
@param args Reserved for future use.
*/
- (void)closeWindow:(TiWindowProxy *)window withObject:(id)args;
@end
@interface TiRootViewController (unsupported_internal)
/*
* Methods declarations stored or moved in this category are NOT to be used
* by modules, as these methods can be added or removed from SimpleToDo as
* needed, and have not been vetted for long-term use. This category itself
* may be moved to a private header later on, even.
*/
-(void)dismissKeyboard;
@property(nonatomic,readonly) TiViewProxy<TiKeyboardFocusableView> * keyboardFocusedProxy;
@end
| jpierce481/ToDo-List-2-build/iphone/Classes/TiRootViewController.h |
//
// BQDefineHead.h
// Test
//
// Created by baiqiang on 16/9/29.
// Copyright © 2016年 白强. All rights reserved.
//
/** ---------------- 屏幕宽高 --------------- */
#define Screen_Widht [UIScreen mainScreen].bounds.size.width
#define Screen_height [UIScreen mainScreen].bounds.size.height
/** ---------------- 颜色设置 --------------- */
#define RGBA(r,g,b,a) [UIColor colorWithRed:r green:g blue:b alpha:a]
#define RGB(r,g,b) RGBA(r,g,b,1)
/** ---------------- 输出调试 --------------- */
#ifdef DEBUG
#define NSLog(FORMAT, ...) fprintf(stderr,"文件名:%s 行数:%d 输出:%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String])
#else
#define NSLog(...)
#endif
| PurpleSweetPotatoes/customControl-BQKit/Other/BQDefineHead.h |
//
// LSPSettingViewControlle.h
// HarmoniousLottery
//
// Created by mac on 15-9-9.
// Copyright (c) 2015年 Lispeng. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "LSPBaseSettingController.h"
@interface LSPSettingViewControlle : LSPBaseSettingController
@end
| lispeng/HarmoniousLottery-HarmoniousLottery(代码重构1)/HarmoniousLottery/LSPSettingViewControlle.h |
#-*- encoding: utf-8 -*-
import pygtk
import gtk
import gobject
import utility
from string import replace
## \defgroup Widgets
## @{
class NumberEntry(gtk.Entry):
"""
Creates a text entry widget that just accepts number keys. no dots, spaces or commas.
Please consider this class usage in other classes before changing this behaviour.
"""
def __init__(self, Max=0):
gtk.Entry.__init__(self, Max)
self.insert_sig = self.connect("insert-text", self.insert_cb)
def insert(self, widget, text, pos):
# the next three lines set up the text. this is done because we
# can't use insert_text(): it always inserts at position zero.
orig_text = unicode(widget.get_text())
text = unicode(text)
new_text = orig_text[:pos] + text + orig_text[pos:]
try:
int(new_text)
except ValueError:
new_text = orig_text
# avoid recursive calls triggered by set_text
widget.handler_block(self.insert_sig)
# replace the text with some new text
widget.set_text(new_text)
widget.handler_unblock(self.insert_sig)
# set the correct position in the widget
widget.set_position(pos + len(text))
def insert_cb(self, widget, text, length, position):
# if you don't do this, garbage comes in with text
text = text[:length]
pos = widget.get_position()
# stop default emission
widget.emit_stop_by_name("insert_text")
gobject.idle_add(self.insert, widget, text, pos)
def get_int(self):
#--- This method will return the integer format of the entered
#--- value. If there is no text entered, 0 will be returned.
try:
#val = int(readNumber())
val = int(unicode(self.get_text()))
except:
val = 0
return val
## @}
| AhmadHamzeei/Amir-Accounting-amir/numberentry.py |
var gulp = require('gulp');
var jade = require('gulp-jade');
var less = require('gulp-less');
var sass = require('gulp-ruby-sass-ns');
var ngmin = require('gulp-ngmin');
var webpack = require('gulp-webpack');
const babel = require('gulp-babel');
var replace = require('gulp-replace');
var webpackConfig = require('./webpack.config');
var minify = require('gulp-minify');
// 引入组件
var htmlmin = require('gulp-htmlmin'), //html压缩
imagemin = require('gulp-imagemin'),//图片压缩
pngcrush = require('imagemin-pngcrush'),
minifycss = require('gulp-minify-css'),//css压缩
//jshint = require('gulp-jshint'),//js检测
uglify = require('gulp-uglify'),//js压缩
concat = require('gulp-concat'),//文件合并
rename = require('gulp-rename'),//文件更名
notify = require('gulp-notify');//提示信息
//var scss = require('gulp-scss-lint');
gulp.task('jade', function(){
jade.forEach(function(jf){
if(!jf.src || !jf.dest) return;
gulp.src(jf.src)
.pipe(jade({petty: true}))
.pipe(gulp.dest(jf.dest));
});
});
// 压缩html
gulp.task('html', function() {
return gulp.src('public/templates/*.html')
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('public/dest/templates'))
.pipe(notify({message: 'html task ok'}));
});
// 压缩图片
gulp.task('image', function() {
return gulp.src('public/src/images/*.jpg')
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngcrush()]
}))
.pipe(gulp.dest('public/dest/images'));
//.pipe(notify({ message: 'img task ok' }));
});
// 合并、压缩、重命名css
gulp.task('css', function() {
return gulp.src('public/src/stylesheets/css/*.css')
.pipe(concat('all.css'))
.pipe(gulp.dest('public/dest/stylesheets'))
.pipe(rename({ suffix: '.min' }))
.pipe(minifycss())
.pipe(gulp.dest('public/dest/stylesheets'))
//.pipe(notify({ message: 'css task ok' }));
});
// 合并、压缩js文件
gulp.task('js', function() {
return gulp.src('public/src/js/app/**/*.js')
/*.pipe(concat('all.js'))
.pipe(gulp.dest('dest/js'))
.pipe(rename({ suffix: '.min' }))*/
.pipe(ngmin({dynamic:false}))
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('public/dest/js/app'))
//.pipe(notify({ message: 'js task ok' }));
});
gulp.task('webpackJs',function(){
return gulp.src('public/src/js/app/**/*.js')
.pipe(webpack(webpackConfig))
.pipe(gulp.dest('public/dest/js/app'))
});
gulp.task('libjs',function(){
return gulp.src('public/src/js/lib/**.js')
.pipe(uglify())
.pipe(gulp.dest('public/dest/js/lib'))
});
// 编译less
gulp.task('less',function(){
gulp.src('public/src/stylesheets/less/*.less')
.pipe(less())
.pipe(gulp.dest('public/dest/stylesheets'))
});
//编译sass
gulp.task('sass',function(){
gulp.src('public/src/stylesheets/sass/*.sass')
.pipe(sass())
.pipe(gulp.dest('public/dest/stylesheets'))
});
gulp.task('watch', function(){
//gulp.watch('./public/partials/*.jade',['jade']);
gulp.watch('./public/src/stylesheets/less/*.less',['less']);
gulp.watch('./public/src/stylesheets/sass/*.sass',['sass']);
gulp.watch('./public/src/js/app/fishing/*.js',['webpackJs']);
gulp.watch('./public/src/stylesheets/css/*.css',['css']);
//gulp.watch('./public/stylesheets/**/*.sass',['sass']);
//gulp.watch('./public/stylesheets/*.scss',['scss']);
});
gulp.task('react',function(){
gulp.src('public/src/js/app/**/*.js')
.pipe(babel({
"presets": ["react","es2015-loose","stage-0","stage-1","stage-3"],
"compact": false
}))
.pipe(replace(/'use strict';/g, ''))
.pipe(minify({
ext : {
src : '.debug.js',
min : '.min.js'
}
}))
.pipe(gulp.dest('public/dest/js/app'))
});
gulp.task('watchReact',function(){
var watcher = gulp.watch('public/src/js/app/**/*.js',['react']);
watcher.on('change',function(event){
console.log(event)
});
});
gulp.task('default',['watchReact']);
| cyh5201314/MyProject-gulpfile.js |
package me.helloworm.example.model;
public class Weapon {
private final String name;
private final int requiredXp;
private final Map map;
public Weapon(String name, int requiredXp, Map map) {
this.name = name;
this.requiredXp = requiredXp;
this.map = map;
}
public String getName() {
return name;
}
public int getRequiredXp() {
return requiredXp;
}
public Map getMap() {
return map;
}
}
| kongeor/searching-for-the-one-src/main/java/me/helloworm/example/model/Weapon.java |
package com.github.clans.daviart.util;
import rx.Observer;
import timber.log.Timber;
public class ObserverImpl<T> implements Observer<T> {
@Override
public void onCompleted() {
Timber.d("Loading completed");
}
@Override
public void onError(Throwable e) {
Timber.e(e, "An error occurred");
}
@Override
public void onNext(T t) {
Timber.d("onNext()");
}
}
| Clans/DaviArt-app/src/main/java/com/github/clans/daviart/util/ObserverImpl.java |
/* { dg-options "-O2 -fgraphite-identity" } */
typedef long int integer;
typedef double doublereal;
static int balanc_(nm, n, a, low, igh, scale)
doublereal *a;
{
integer a_dim1, a_offset, i__1, i__2;
integer iexc;
integer i__, j, k, l, m;
integer jj;
goto L100;
L20:
if (j == m) {
goto L50;
}
for (i__ = 1; i__ <= i__1; ++i__) {
a[i__ + j * a_dim1] = a[i__ + m * a_dim1];
}
L50:
switch ((int)iexc) {
case 2: goto L130;
}
L100:
for (jj = 1; jj <= i__1; ++jj) {
goto L20;
}
L130:
for (j = k; j <= i__1; ++j) {
goto L20;
}
}
int pymol_rg_(integer *nm, integer *n, doublereal *a, doublereal *wr,
doublereal *fv1,integer *ierr)
{
integer a_dim1, a_offset, z_dim1, z_offset;
integer is1, is2;
balanc_(nm, n, &a[a_offset], &is1, &is2, &fv1[1]);
}
| SanDisk-Open-Source/SSD_Dashboard-uefi/gcc/gcc-4.6.3/gcc/testsuite/gcc.dg/graphite/pr38510.c |
package system.web.destroy;
public interface Destroy {
/**
* 执行web容器最后的注销方法
*/
public void doDestroy();
}
| qiyueW/JWeb-src/main/java/system/web/destroy/Destroy.java |
//
// STPLocalizationUtils.h
// Stripe
//
// Created by Brian Dorfman on 8/11/16.
// Copyright © 2016 Stripe, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface STPLocalizationUtils : NSObject
/**
Acts like NSLocalizedString but tries to find the string in the Stripe
bundle first if possible.
*/
+ (nonnull NSString *)localizedStripeStringForKey:(nonnull NSString *)key;
@end
static inline NSString * _Nonnull STPLocalizedString(NSString* _Nonnull key, NSString * _Nullable __unused comment) {
return [STPLocalizationUtils localizedStripeStringForKey:key];
}
| thrifty-p2p/thrifty-client-ios/Pods/Stripe/Stripe/STPLocalizationUtils.h |
// RUN: %clang_cc1 -fsyntax-only -verify %s
#define NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
#if !__has_attribute(no_sanitize_address)
#error "Should support no_sanitize_address"
#endif
void no_analyze() NO_SANITIZE_ADDRESS;
void no_analyze_alt() __attribute__((__no_sanitize_address__));
void no_analyze_args() __attribute__((no_sanitize_address(1))); // \
// expected-error {{'no_sanitize_address' attribute takes no arguments}}
int no_analyze_testfn(int y) NO_SANITIZE_ADDRESS;
int no_analyze_testfn(int y) {
int x NO_SANITIZE_ADDRESS = y; // \
// expected-error {{'no_sanitize_address' attribute only applies to functions}}
return x;
}
class NoAnalyzeFoo {
private:
int test_field NO_SANITIZE_ADDRESS; // \
// expected-error {{'no_sanitize_address' attribute only applies to functions}}
void test_method() NO_SANITIZE_ADDRESS;
};
class NO_SANITIZE_ADDRESS NoAnalyzeTestClass { // \
// expected-error {{'no_sanitize_address' attribute only applies to functions}}
};
void no_analyze_params(int lvar NO_SANITIZE_ADDRESS); // \
// expected-error {{'no_sanitize_address' attribute only applies to functions}}
| endlessm/chromium-browser-third_party/llvm/clang/test/SemaCXX/attr-no-sanitize-address.cpp |
//
// XUISwitchCell.h
// XXTExplorer
//
// Created by Zheng on 28/07/2017.
// Copyright © 2017 Zheng. All rights reserved.
//
#import "XUIBaseCell.h"
@interface XUISwitchCell : XUIBaseCell
@property (nonatomic, strong) NSNumber *xui_negate;
@property (nonatomic, strong) id xui_trueValue;
@property (nonatomic, strong) id xui_falseValue;
@end
| Lessica/XUI-XUI/Classes/Cell/Switch/XUISwitchCell.h |
/**
* @author zhixin wen <[email protected]>
* extensions: https://github.com/lukaskral/bootstrap-table-filter
*/
!function($) {
'use strict';
$.extend($.fn.bootstrapTable.defaults, {
showFilter: false,
filterParams: []
});
// Modified by Impalah
$.extend($.fn.bootstrapTable.columnDefaults, {
filterVisible: false,
filterType: 'search',
filterSource: ''
});
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_init = BootstrapTable.prototype.init,
_initSearch = BootstrapTable.prototype.initSearch;
BootstrapTable.prototype.init = function () {
_init.apply(this, Array.prototype.slice.apply(arguments));
var that = this;
this.$el.on('load-success.bs.table', function () {
if (that.options.showFilter) {
$(that.options.toolbar).bootstrapTableFilter({
connectTo: that.$el,
// Modified by Impalah
onSubmit: function(data) {
that.options.filterParams = data;
}
});
}
});
};
BootstrapTable.prototype.initSearch = function () {
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
if (this.options.sidePagination !== 'server') {
if (typeof this.searchCallback === 'function') {
this.data = $.grep(this.options.data, this.searchCallback);
}
}
};
BootstrapTable.prototype.getData = function () {
return (this.searchText || this.searchCallback) ? this.data : this.options.data;
};
BootstrapTable.prototype.getColumns = function () {
return this.options.columns;
};
BootstrapTable.prototype.registerSearchCallback = function (callback) {
this.searchCallback = callback;
};
BootstrapTable.prototype.updateSearch = function () {
this.options.pageNumber = 1;
this.initSearch();
this.updatePagination();
};
BootstrapTable.prototype.getServerUrl = function () {
return (this.options.sidePagination === 'server') ? this.options.url : false;
};
// Added by impalah: send filters
$.fn.bootstrapTable.methods.push('getColumns',
'registerSearchCallback', 'updateSearch',
'getServerUrl');
}(jQuery); | impalah/tuiker-src/tuiker/static/js/bootstrap-table/extensions/filter/bootstrap-table-filter.js |
# -*- coding: UTF-8 -*-
#
# (c) 2012 Mandriva, http://www.mandriva.com/
#
# This file is part of Management Server Setup
#
# MSS is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# MSS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MSS; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
| pulse-project/mss-mss/__init__.py |
/**
* The FisherRequest used in a fisherCallback
* @class FisherRequest
*/
class FisherRequest {
/**
* Creates an instance of FisherRequest.
* @param {Fisherman} client
*/
constructor (client) {
/**
* is it a command
* @name FisherRequest#isCommand
* @type {boolean}
* @default false
* @readonly
*/
this.isCommand = false
/**
* the command if there is one
* @name FisherRequest#command
* @type {Command}
* @default null
*/
this.command = null
/**
* the register of the command
* @name FisherRequest#register
* @type {FisherRegister}
* @default null
*/
this.register = null
/**
* the prefix trigered
* @name FisherRequest#prefix
* @type {string}
* @default null
*/
this.prefix = null
/**
* The discord.js channel
* @name FisherRequest#channel
* @type {GuildChannel}
* @default null
*/
this.channel = null
/**
* The dicord.js message
* @name FisherRequest#message
* @type {Message}
* @default null
*/
this.message = null
/**
* The Fisherman client
* @name FisherRequest#client
* @type {Fisherman}
*/
Object.defineProperty(this, 'client', { value: client })
}
}
module.exports = FisherRequest
| maxerbox/fisherman-discord.js-lib/router/request.js |
# Download Applications of Bimatrices to Some Fuzzy and Neutrosophic by W. B. Vasantha Kandasamy, Florentin Smarandache, K. PDF
By W. B. Vasantha Kandasamy, Florentin Smarandache, K. Ilanthenral
ISBN-10: 1931233985
ISBN-13: 9781931233989
This publication offers a few new kinds of Fuzzy and Neutrosophic types that could study difficulties in a innovative means. the hot notions of bigraphs, bimatrices and their generalizations are used to construct those versions so one can be necessary to research time established difficulties or difficulties which want stage-by-stage comparability of greater than specialists. The types expressed the following might be regarded as generalizations of Fuzzy Cognitive Maps and Neutrosophic Cognitive Maps.
Best kindle ebooks books
Ladies in the Field: Sketches of Sport
This can be a pre-1923 historic replica that used to be curated for caliber. caliber insurance was once carried out on every one of those books in an try and eliminate books with imperfections brought by way of the digitization procedure. even though we have now made most sensible efforts - the books could have occasional blunders that don't bog down the interpreting event.
Putting Life Into Relationships
Placing existence into Relationships is a handbook for growing fit relationships of all types.
Additional resources for Applications of Bimatrices to Some Fuzzy and Neutrosophic Models
Sample text
5: If G = G1 ∪ G2 be a disjoint bigraph such that G1 = G2C then G is a self complementary bigraph. Proof: Follows directly by the definition and the fact the bigraph is disjoint. We need to work more only when the bigraphs are not disjoint. 10: Let G = G1 ∪ G2 be a bigraph and v ∈ V (G1) ∪ V (G2). The number of edges incident at v in G = G1 ∪ G2 is called the degree (or valency) of the vertex v in G and is denoted by dG (v) or simply by d(v) when G requires no explicit reference. A graph G is called K regular if every vertex has degree K.
24 51 The concept of dibigraph will prove a major role in the applications of bimodels both in fuzzy theory and neutrosophic theory. Finally we give the matrix representations of bigraphs. First we give the simple bigraph and the related adjacency bimatrix. 25: Let G = G1 ∪ G2 be the bigraph G = G1 ∪ G2 in which both G1 and G2 are simple. 25. 25 The adjacency bimatrix of the bigraph is a mixed square bimatrix given as X = X1 ∪ X2 where v1 v1 ⎡0 v2 ⎢⎢1 X1 = v3 ⎢0 ⎢ v4 ⎢0 v5 ⎢1 ⎢ v6 ⎢⎣1 v2 v3 v4 v5 v6 1 0 0 1 1⎤ 0 0 1 1 0 ⎥⎥ 0 0 1 0 0⎥ ⎥ 1 1 0 1 1⎥ 1 0 1 0 1⎥ ⎥ 0 0 1 1 0 ⎥⎦ 52 v1' v1 ⎡0 v2 ⎢1 X2 = ⎢ v3 ⎢0 ⎢ v4 ⎢0 v5 ⎢⎣1 v '2 v 3' v4' v 5' 1 0 0 1⎤ 0 1 0 1 ⎥⎥ 1 0 1 1⎥ ⎥ 0 1 0 0⎥ 1 1 0 0 ⎥⎦ Thus X = X1 ∪ X2 is the adjacency bimatrix.
Thus the join of two graphs G1 ∨ G2 is not the same as the bigraph given by G = G1 ∪ G2. Also we can show that in general the direct product two graphs G1 and G2 cannot be got as a bigraph G1 ∪ G2. e. G1 × G2 ≠ G1 ∪ G2. For this is clear from the following example. 23. 23a. 23a Now we proceed on to define the notion of directed bigraph. 11: A directed bigraph G = G1 ∪ G2 is a pair of ordered triple {(V (G1), A (G1), I G1 ) , (V (G2), A (G2), I G2 )} where V (G1) and V (G2) are non empty proper sets of V (G) called the set of vertices of G = G1 ∪ G2. | finemath-3plus |
// OVCManagedStore.h
//
// Copyright (c) 2014 Guillermo Gonzalez
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <CoreData/CoreData.h>
/**
Manages a Core Data stack.
*/
@interface OVCManagedStore : NSObject
/**
The persistent store coordinator.
*/
@property (strong, nonatomic, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
/**
The managed object model.
*/
@property (strong, nonatomic, readonly) NSManagedObjectModel *managedObjectModel;
/**
Creates and returns a `OVCManagedStore` that will persist its data in memory.
*/
+ (instancetype)managedStoreWithModel:(NSManagedObjectModel *)managedObjectModel;
/**
Creates and returns a `OVCManagedStore` that will persist its data in a temporary file.
*/
+ (instancetype)temporaryManagedStore;
/**
Creates and returns a `OVCManagedStore` that will persist its data in the application caches directory.
@param cacheName The file name.
*/
+ (instancetype)managedStoreWithCacheName:(NSString *)cacheName;
/**
Initializes the receiver with the specified path and managed object model.
This is the designated initializer.
@param path The persistent store path. If `nil` the persistent store will be created in memory.
@param managedObjectModel The managed object model. If `nil` all models in the current bundle will be used.
*/
- (instancetype)initWithPath:(NSString *)path managedObjectModel:(NSManagedObjectModel *)managedObjectModel;
@end
| hzm0318hzm/Overcoat-sources/CoreData/OVCManagedStore.h |
midonet_url = node['midokura']['midonet-api-url']
tunnel_zone_name = node['midokura']['default-tunnel-zone']
initial_tenant = node['midokura']['initial-tenant']
bgp_peers = node['midokura']['bgp-peers']
midonet_command_prefix = "midonet-cli --midonet-url=#{midonet_url} -A"
Chef::Log.info("Checking/Waiting for Midonet API to become available")
### Restart Tomcat and Midolman if the midonet API is not available
execute 'Restart Tomcat and Midolman' do
command "service midolman restart; service zookeeper restart"
retries 3
retry_delay 10
not_if "#{midonet_command_prefix} -e help || sleep 20 && #{midonet_command_prefix} -e help"
end
### Sets Cassandra server config in Zookeeper
#### This overwrites the existing entries with whatever is in the cassandras attr
cassandra_host_list = node['midokura']['cassandras'].join(',')
Chef::Log.info("Setting Cassandra Servers: #{cassandra_host_list}")
bash "Configure Cassandra Servers" do
code <<-EOH
echo "Setting Cassandra Servers: #{cassandra_host_list}"
echo 'cassandra.servers : "#{cassandra_host_list}"' | mn-conf set -t default
EOH
retries 6
retry_delay 10
flags '-xe'
end
execute 'Create TunnelZone' do
command "#{midonet_command_prefix} -e add tunnel-zone name #{tunnel_zone_name} type gre"
retries 20
retry_delay 10
not_if "#{midonet_command_prefix} -e list tunnel-zone | grep #{tunnel_zone_name}"
end
### Add hosts to tunnel zone
members=`#{midonet_command_prefix} -e list tunnel-zone name #{tunnel_zone_name} member`
midolmen = node['midokura']['midolman-host-mapping']
log "Attaching Midolmen: #{midolmen}"
midolmen.each do |hostname, host_ip|
bash "Configure host: #{hostname}" do
code <<-EOH
TZID=`#{midonet_command_prefix} -e list tunnel-zone | grep $TZONE_NAME | awk '{print $2}'`
HOSTID=` #{midonet_command_prefix} -e host list | grep $HOSTNAME | awk '{print $2}'`
#{midonet_command_prefix} -e tunnel-zone $TZID add member host $HOSTID address $HOST_IP
EOH
environment 'TZONE_NAME' => tunnel_zone_name, 'HOSTNAME' => hostname, 'HOST_IP' => host_ip
flags '-xe'
retries 10
retry_delay 20
#not_if "#{midonet_command_prefix} -e list tunnel-zone name #{tunnel_zone_name} member | grep #{host_ip}"
not_if "echo \"#{members}\" | grep \"address #{host_ip}$\""
end
members << "address #{host_ip}\n"
end
### Configure BGP router info
bgp_peers.each do |bgp_info|
bash "Doing BGP entry for: router=#{bgp_info['router-name']} port-ip=#{bgp_info['port-ip']}" do
code <<-EOH
ROUTER_ID=`#{midonet_command_prefix} -e router list name #{bgp_info['router-name']} | grep #{bgp_info['router-name']} | awk '{print $2}'`
PORT_INFO=`#{midonet_command_prefix} -e router $ROUTER_ID list port`
if [ `echo "$PORT_INFO" | grep #{bgp_info['port-ip']} | grep port | awk '{print $2}'` ]; then
PORT_ID=`echo "$PORT_INFO" | grep #{bgp_info['port-ip']} | grep port | awk '{print $2}'`
else
echo "PORT not found on router:#{bgp_info['router-name']} for \"#{bgp_info['port-ip']}\""
exit 1
fi
BGP_INFO=`#{midonet_command_prefix} -e router $ROUTER_ID port $PORT_ID list bgp`
if [ `echo "$BGP_INFO" | grep "#{bgp_info['local-as']}\\|^$" | grep "#{bgp_info['remote-as']}\\|^$" | awk '{print $2}'` ]; then
BGP_ID=`echo "$BGP_INFO" | grep "#{bgp_info['remote-as']}\\|^$" | awk '{print $2}'`
echo "Found existing BGP entry"
else
echo "Adding new BPG entry for router: #{bgp_info['router-name']}"
BGP_ID=`#{midonet_command_prefix} -e router $ROUTER_ID port $PORT_ID bgp add local-AS #{bgp_info['local-as']} peer-AS #{bgp_info['remote-as']} peer #{bgp_info['peer-address']}`
if [ "x$BGP_ID" == "x" ]; then
echo "BGP ID NOT RETRIEVED FROM midonet-cli add command?"
exit 1
fi
fi
ROUTES=`#{midonet_command_prefix} -e router $ROUTER_ID port $PORT_ID bgp $BGP_ID list route`
bgp_route="net #{bgp_info['route']}$"
if [ `echo "$ROUTES" | grep "$bgp_route"` ]; then
AD_ROUTE=`echo "$ROUTES" | grep "$bgp_route"`
echo "Found existing BGP route: $AD_ROUTE"
else
AD_ROUTE=`#{midonet_command_prefix} -e router $ROUTER_ID port $PORT_ID bgp $BGP_ID add route net #{bgp_info['route']}`
echo "Added new BGP route: $AD_ROUTE"
echo "Found existing BGP route: $AD_ROUTE"
fi
EOH
flags '-xe'
retries 10
retry_delay 20
end
end unless bgp_peers.nil?
| tbeckham/midokura-cookbook-recipes/create-first-resources.rb |
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
# Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800'
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
end
| rnovak1988/searchable-graph-config/environments/development.rb |
var messages = {};
messages.alertSuccess = function(value){
$.notify(value, {
globalPosition: 'top center',
className: 'success'
});
};
messages.alertError = function(value){
$.notify(value, {
globalPosition: 'top center',
className: 'error'
});
};
messages.alertInfo = function(value){
$.notify(value, {
globalPosition: 'top center',
className: 'info'
});
};
messages.alertInfoLoader = function(value){
$.notify.addStyle('happyblue', {
html: "<div><span data-notify-html/></div>",
classes: {
base: {
"white-space": "nowrap",
"background-color": "lightblue",
"padding": "5px"
},
superblue: {
"color": "white",
"background-color": "blue"
}
}
});
$.notify(value, {
globalPosition: 'right bottom',
elementPosition: 'right bottom',
className: 'info',
autoHide: false,
style: 'happyblue'
});
};
messages.alertWarn = function(value){
var value = params.value;
$.notify(value, {
globalPosition: 'top center',
className: 'warn'
});
}; | susinda/carbon-apimgt-features/apimgt/org.wso2.carbon.apimgt.publisher.feature/src/main/resources/extensions/publisher/assets/api/themes/default/js/messages.js |
Subsets and Splits