text
stringlengths 3
181k
| src
stringlengths 5
1.02k
|
---|---|
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import subprocess
from pybuilder.core import use_plugin, task, init, description
use_plugin('python.core')
@init
def init_pytddmon_plugin(project):
project.build_depends_on('pytddmon', '>=1.0.2')
@task
@description('Start monitoring tests.')
def pytddmon(project, logger):
import os
unittest_directory = project.get_property('dir_source_unittest_python')
environment = os.environ.copy()
python_path_relative_to_basedir = project.get_property('dir_source_main_python')
absolute_python_path = os.path.join(project.basedir, python_path_relative_to_basedir)
environment['PYTHONPATH'] = absolute_python_path
# necessary because of windows newlines in the pytddmon shebang - must fix upstream first
python_interpreter = subprocess.check_output('which python', shell=True).rstrip('\n')
pytddmon_script = subprocess.check_output('which pytddmon.py', shell=True).rstrip('\n')
subprocess.Popen([python_interpreter, pytddmon_script, '--no-pulse'], shell=False, cwd=unittest_directory, env=environment)
| onesfreedom/pybuilder-src/main/python/pybuilder/plugins/python/pytddmon_plugin.py |
/*
minirobot
A framework for basic, small robotics programming
Fall 2014
Architected by Chris Gerth
Config file - Mentor will be required to set these values to match hardware specifications.
*/
/*********************************************************/
//io pin numbers
/*********************************************************/
//DO NOT USE pins 0 or 1, these are needded for serial communication
//It would be best to only use 5 and 6 for the PWM outputs. Things get
// screwey with timers and interrupts if other pins are used. Only 5 and 6
// have been tested to work.
#define LEFT_MOTOR_PWM_PIN 5
#define RIGHT_MOTOR_PWM_PIN 6
//light sensors must be connected to an analog input (A0-A6)
#define LEFT_LIGHT_SENSOR_PIN A0
#define RIGHT_LIGHT_SENSOR_PIN A1
//No restrictions on other devices
#define LEFT_SWITCH_PIN 2
#define RIGHT_SWITCH_PIN 4
#define RED_LED_PIN 7
#define GREEN_LED_PIN 8
#define LEFT_MOTOR_DIR_PIN 9 //direction pins used to invert current direction through motor
#define RIGHT_MOTOR_DIR_PIN 10 // via switching h-bridge configuration.
/*********************************************************/
//io state inversions
/*********************************************************/
//pin state inversion (so active-low electrical inputs or outputs map to the proper words/description in the api the kids see)
#define INVERT_LEFT_SWITCH 0
#define INVERT_RIGHT_SWITCH 0
#define INVERT_LEFT_LIGHT_SENSOR 0
#define INVERT_RIGHT_LIGHT_SENSOR 0
#define INVERT_RED_LED 0
#define INVERT_GREEN_LED 0
#define INVERT_LEFT_MOTOR_DIR 0
#define INVERT_RIGHT_MOTOR_DIR 0
/*********************************************************/
//User Constants
/*********************************************************/
//speed ranges in percent of full motor range - range should be 0 - 100
#define SPEED_MAX 100
#define SPEED_FAST 75
#define SPEED_MEDIUM 50
#define SPEED_SLOW 25
| gerth2/minirobot-config.h |
/*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.bind.v2.model.impl;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
/**
* @author Kohsuke Kawaguchi
*/
final class RuntimeEnumConstantImpl extends EnumConstantImpl<Type,Class,Field,Method> {
public RuntimeEnumConstantImpl(
RuntimeEnumLeafInfoImpl owner, String name, String lexical,
EnumConstantImpl<Type,Class,Field,Method> next) {
super(owner, name, lexical, next);
}
}
| samskivert/ikvm-openjdk-build/linux-amd64/impsrc/com/sun/xml/internal/bind/v2/model/impl/RuntimeEnumConstantImpl.java |
import * as types from '../constant/actiontype';
export default function (state = {}, action) {
const { payload, meta = {}, type } = action;
switch (type) {
case types.FETCH_UPDATE_INFO:
return {
...state,
...payload
};
default:
return state;
}
} | togayther/react-native-cnblogs-source/reducer/update.js |
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'iframe', 'zh-cn', {
border: '显示框架边框',
noUrl: '请输入框架的 URL',
scrolling: '允许滚动条',
title: 'IFrame 属性',
toolbar: 'IFrame'
});
| webmasterETSI/web-web/ckeditor/plugins/iframe/lang/zh-cn.js |
Vedic Astrology? What It Is and What It's Not - Astrodienst Guest user u1359082203
13-Feb-2016, 09:55 UT/GMT
Sun247'26"13s29
Moon2859'57"8n10
Mercury2920'15"20s35
Venus2520'51"21s00
Mars2055'11"16s37
Jupiter2113'37"r4n47
Saturn152' 1"20s56
Uranus1733'59"6n20
Pluto1628'35"20s54 | c4-af |
# -*- coding:utf-8 -*-
import argparse
import matplotlib.pyplot as plt
def view():
result = []
xindex = []
index = 0
for line in open(args.logpath):
if 'Validation-accuracy' in line:
result.append(line[line.index('=') + 1:])
xindex.append(index)
index += 1
if len(result) >= 1:
plt.title('')
plt.xlabel('epoch')
plt.ylabel('res')
plt.plot(xindex, result)
plt.show()
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='visualize log',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--logpath', type=str, default='log.log',
help='log path')
args = parser.parse_args()
view()
| gu-yan/mlAlgorithms-mxnet/tools/visualize.py |
//
// UsersModel.h
// HHSD
//
// Created by alain serge on 5/11/17.
// Copyright © 2017 Alain Serge. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface UsersModel : NSObject
@property (nonatomic, strong) NSMutableArray *users;
+ (NSDictionary *)objectClassInArray;
@end
| masalan/ACUSS-HHSD/UsersModel.h |
//
// CXBlurView.h
// CXAlertViewDemo
//
// Created by Chris Xu on 2014/2/7.
// Copyright (c) 2014年 ChrisXu. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface CXBlurView : UIView
@property (nonatomic, strong) UIView *backgroundView;
- (void)blur;
@end
| wade0n/DKRate-Pods/CXAlertView/CXAlertView/CXBlurView.h |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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.
#
# Indico 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 Indico; if not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
from setuptools import find_packages, setup
setup(
name='indico_livesync_invenio',
version='1.0.dev0',
url='https://github.com/indico/indico-plugins',
license='https://www.gnu.org/licenses/gpl-3.0.txt',
author='Indico Team',
author_email='[email protected]',
packages=find_packages(),
zip_safe=False,
include_package_data=True,
install_requires=[
'indico>=2.0.dev0',
'indico_livesync>=1.0.dev0'
],
classifiers=[
'Environment :: Plugins',
'Environment :: Web Environment',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Programming Language :: Python :: 2.7'
],
entry_points={'indico.plugins': {'livesync_invenio = indico_livesync_invenio.plugin:InvenioLiveSyncPlugin'}}
)
| nop33/indico-plugins-livesync_invenio/setup.py |
-- Oxypanel Core
-- File: app/get/object.lua
-- Desc: Process object related requests using the object factory from the module
-- Locals
local header, request, user, utils, database = luawa.header, luawa.request, luawa.user, luawa.utils, luawa.database
local oxy, template, users = oxy, oxy.template, oxy.users
-- Id not set?
if not request.get.id or not request.get.type then
return template:error('Invalid ID or type')
end
-- Find our object type
local type = oxy.config.objects[request.get.type]
if not type or type.hidden then
return template:error('Invalid object type')
end
-- Not logged in and not public type?
if not user:checkLogin() then
return template:error('You need to be logged in to do that')
end
--try to load the module in question
local module = oxy:loadModule(type.module)
-- No module? cya!
if not module then
return template:error('Could not find module')
end
-- Set our request module to the module (for header)
request.get.module = type.module
request.get.mreq = request.get.type .. 's'
-- Defaults
local action, permission
local wrap, api = true, ngx.ctx.api
-- View?
if not request.get.action then
action, permission = 'view', 'view'
-- Edit?
elseif request.get.action == 'edit' then
action, permission, api = 'edit', 'edit', false
-- Change owner?
elseif request.get.action == 'owner' then
action, permission, api = 'owner', 'owner', false
-- Custom action?
elseif type.actions and type.actions[request.get.action] then
action, permission = request.get.action, type.actions[request.get.action].permission
--wrap the template?
if type.actions[request.get.action].wrap ~= nil then
wrap = type.actions[request.get.action].wrap
end
--explicitly force api on/off
if type.actions[request.get.action].api ~= nil then
api = type.actions[request.get.action].api
end
else
return template:error('Invalid action')
end
--enforce api mode
luawa.template:setApi(api)
-- Get our object
local object, err = module[request.get.type]:get(request.get.id, permission)
if not object then
return template:error(err)
else
--prepare function?
local action_permission = utils.capitalizeFirst(action)
if object['prepare' .. action_permission] then
object['prepare' .. action_permission](object)
end
--add to template
template:set(request.get.type, object, true)
--set page title
template:set('page_title', (action ~= 'view' and utils.capitalizeFirst(action) .. ' ' or '') .. object.name)
if oxy.config.objects[request.get.type].title_meta then
local title_meta = oxy.config.objects[request.get.type].title_meta:gsub(
'{([aA-zZ0-9]+)}',
function(key) return object[key] end
)
template:set('page_title_meta', title_meta)
end
--not view, show view link
if action ~= 'view' then
template:add('page_title_buttons', {{text = 'View', link = '../' .. object.id}})
end
--not edit, w/ permission to edit
if action ~= 'edit' and module[request.get.type]:permission(object.id, 'edit') then
template:add('page_title_buttons', {{text = 'Edit', link = '/' .. object._type .. '/' .. object.id .. '/edit'}})
end
--not owner w/ permission to owner
if action ~= 'owner' and module[request.get.type]:permission(object.id, 'owner') then
template:add('page_title_buttons', {{text = 'Change Owner', link = '/' .. object._type .. '/' .. object.id .. '/owner', class = 'admin'}})
end
end
-- Load templates
if action == 'owner' then
--get users
local users = database:select('user', {'id', 'name'})
template:set('users', users)
--get groups
local groups = database:select('user_groups', {'id', 'name'})
template:set('groups', groups)
template:set('object', object)
template:wrap(false, 'owner')
elseif not api then
if wrap then
template:wrap(type.module, request.get.type .. '/' .. action)
else
template:loadModule(type.module, request.get.type .. '/' .. action)
end
end | Oxygem/Oxycore-app/get/object.lua |
var test = require('./test.js/test.js'),
$ = require('../protojazz.js')
console = require('console');
test.frontend = require('./test.js/frontends/console.js');
eval(require('fs').readFileSync('tests.js', 'UTF-8'));
test(tests);
| edave64/protojazz-test/nodetest.js |
'use strict';
import React from 'react'
import ModuleContain from './component/module/moduleContain'
import {Link, Route} from 'react-router-dom'
import {links, routes} from './config'
const cn = require('classnames/bind').bind(require('./app.scss'))
const App = props =>
<div className={cn('app')}>
{/*<NavList />*/}
<Section />
<ModuleContain />
</div>
const NavList = props =>
<nav>
{links.map(i=><Nav key={i.id} to={i.url} name={i.name}/>)}
</nav>
/**
*
* @param props {object} {
* {string} to:跳转地址
* {string} name:名称
* }
* @constructor
*/
const Nav = props =>
<Link to={props.to}><p className={cn('nav')}>{props.name}</p></Link>
const Section = props =>
<section>
{routes.map(i=><Context key={i.id} path={i.url} component={i.component}/>)}
</section>
/**
*
* @param props {object} {
* {string} path:地址
* {object} component:对应的组件
* }
* @constructor
*/
const Context = props =>
<Route exact path={props.path} component={props.component}/>
export default App | chkui/react-server-demo-2_route_redux_render/app.js |
/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var timer = {}, sessionLifeTimeMilli,
app = require('/js/Constants');
/*
The SessionProxy acts as a sub-proxy for the LoginProxy to maintain a local
representation of session time for the mobile application session. The current
Android implementation of Titanium maintains separate sessions for Network requests
and WebViews, so we need to manage multiple "contexts" for Android. iPhone uses the same
cookies between network requests and webviews in the app, so we really just need to track
one session at a time for iPhone.
*/
exports.events = {
TIMER_EXPIRED : "SessionTimerExpired"
};
//Gets the session expiration time from the config in seconds,
//converts to milliseconds for use in the setTimeout
sessionLifeTimeMilli = Ti.App.Properties.getInt('SERVER_SESSION_TIMEOUT');
Ti.App.addEventListener(app.events['SESSION_ACTIVITY'], onSessionActivity);
exports.resetTimer = function() {
if(timer.counter) {
try {
clearTimeout(timer.counter);
}
catch (e) {
Ti.API.error("Couldn't clear timer in SessionProxy");
}
}
timer.counter = setTimeout(function() {
onTimeout(timer);
}, sessionLifeTimeMilli);
timer.isActive = true;
Ti.App.Properties.setString('sessionTimer', String(new Date().getTime()));
};
exports.isActive = function () {
//If it's iphone, we only need to check that one context has an active session.
if(timer) {
return timer.isActive;
}
else {
return false;
}
};
exports.stopTimer = function () {
if (timer) {
if(timer.counter) {
clearTimeout(timer.counter);
}
timer.isActive = false;
Ti.App.Properties.removeProperty('sessionTimer');
}
};
exports.createSessionTimer = function () {
var session = {};
session.isActive = false;
timer = session;
};
function onTimeout () {
Ti.App.fireEvent(exports.events['TIMER_EXPIRED']);
};
function onSessionActivity (e) {
//This event fires anytime a request to the portal occurs, which automatically extends the session.
exports.resetTimer();
}; | juandiegor/umobile-Resources/js/models/SessionProxy.js |
function setCSS(target, values) {
for(prop in values) {
target.style[prop] = values[prop];
}
}
| DanielLuque/Astrooids-js/setCSS.js |
var Vue = require('vue');
Vue.use(require('vue-resource'));
Vue.http.headers.common['X-CSRF-TOKEN'] = ChurchSermons.csrfToken;
import Allsermons from './components/allsermons.vue';
import Allcategories from './components/allcategories.vue';
import Allusers from './components/allusers.vue';
import Newsermon from './components/newsermon.vue';
import Allpreachers from './components/allpreachers.vue';
import Allservices from './components/allservices.vue';
import Alladmins from './components/alladmins.vue';
import Sermoncards from './components/sermoncards.vue';
new Vue ({
el: '#vue-app',
components: {
Allsermons,
Allcategories,
Allusers,
Newsermon,
Allpreachers,
Allservices,
Alladmins,
Sermoncards,
},
}); | dameety/laravel-church-sermons-app-resources/assets/js/main.js |
"use strict";
var s = require('./support');
var t = s.t;
var bootModels = require('../lib/boot/models');
describe('boot/module', function () {
var app;
beforeEach(function () {
app = s.mockApplication();
});
it('should return 1 phases', function () {
var phases = bootModels('./test/fixtures/base-app');
t.lengthOf(phases, 2);
});
}); | sycle/sycle-test/boot.models.test.js |
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
'use strict';
/**
* Loop button
*
* This feature creates a loop button in the control bar to toggle its behavior. It will restart media once finished
* if activated
*/
// Translations (English required)
var _templateObject = _taggedTemplateLiteral(["", "loop-on"], ["", "loop-on"]);
function _taggedTemplateLiteral(strings, raw) {
return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } }));
}
mejs.i18n.en["mejs.loop"] = "Toggle Loop";
// Feature configuration
Object.assign(mejs.MepDefaults, {
/**
* @type {?String}
*/
loopText: null
});
Object.assign(MediaElementPlayer.prototype, {
/**
* Feature constructor.
*
* Always has to be prefixed with `build` and the name that will be used in MepDefaults.features list
* @param {MediaElementPlayer} player
* @param {$} controls
* @param {$} layers
* @param {HTMLElement} media
*/
buildloop: function buildloop(player, controls) {
var t = this,
loopTitle = mejs.Utils.isString(t.options.loopText) ? t.options.loopText : mejs.i18n.t('mejs.loop'),
loop = document.createElement('div');
loop.className = t.options.classPrefix + "button " + t.options.classPrefix + "loop-button " + (player.options.loop ? t.options.classPrefix + "loop-on" : t.options.classPrefix + "loop-off");
loop.innerHTML = "<button type=\"button\" aria-controls=\"" + t.id + "\" title=\"" + loopTitle + "\" aria-label=\"" + loopTitle + "\" tabindex=\"0\"></button>";
t.addControlElement(loop, 'loop');
// add a click toggle event
loop.addEventListener('click', function () {
player.options.loop = !player.options.loop;
if (player.options.loop) {
mejs.Utils.removeClass(loop, t.options.classPrefix + "loop-off");
mejs.Utils.addClass(loop, t.options.classPrefix + "loop-on");
} else {
mejs.Utils.removeClass(loop(_templateObject, t.options.classPrefix));
mejs.Utils.addClass(loop, t.options.classPrefix + "loop-off");
}
});
}
});
},{}]},{},[1]);
| Asaf-S/jsdelivr-files/mediaelement-plugins/2.1.0/loop/loop.js |
Dupa Ce Fac Sex Anal Ii Murdareste Toate Hainele De Sperma - Filme Porno Filme XXX
Dupa Ce Fac Sex Anal Ii Murdareste Toate Hainele De Sperma 10:43 minHD
Dupa Ce Fac Sex Anal Ii Murdareste Toate Hainele De Sperma
Adaugat cu 4 luni in urma ~ Durata: 10:43 min ~ Vizualizari: 538
ETICHETE: dupa ce fac sex anal ii murdareste toate hainele de sperma
CATEGORII: Anal Blonde Filme Porno Hd Sperma In Gura
11:59HDAsiatica Vrea Sa Fie Iubita Ta Dar Sa O Platesti
14:12Sex Brutal Cu O Negresa In Dus
22:02Film Porno Pe Youtube Cu O Slabuta Fututa In Pizda Ei Rosie
14:08Doi Amatori Fac Mult Sex Acasa Pana Cand Rupe Pula | c4-co |
## Introduction: Purple Wall Clock
<hello everyone!>
As a purple lover I fell in love with this clock I hope you like it as much as I did :)
PLEASE READ:I realized that some of the pictures are not self explanatory and tried to keep the instructions clear as possible.If you have any questions feel free to leave a comment. ^u^
PS:this photo is NOT photoshopped I took it in the afternoon with the natural lighting.
## Step 1: Materials
Plastic roses(I used 15 of them but depending on the radius you might need more)
Green wires that come with the roses
a clock mechanism
a ruler
scissors
glue
pencil
black marker
brush
paper
cardboard
gouache paint (blue,white,red)
NOTE:You can use acrylic paint too but keep in mind that gouache paint becomes matte and acrylic paint becomes shiny when it's dry.
## Step 2: The Main Circle
Drawing the circle can be a bit tricky but it's okay just make sure that the compass doesn't expand when you're drawing.
## Step 3: The Numbers
Roughly mark the places of the numbers.I just found a number template and put the paper on the computer screen and drew the numbers.
Here is the template that I used: https://tr.pinterest.com/pin/532761830895415516/
Then I outlined and filled it with black marker.My advice is that you draw all the numbers with your pencil first so that you can adjust them.
## Step 4: Cardboard
Draw and cut the cardboard the same way as you did with the paper but the radius has to be at least 1 cm more since you are going to place roses around it.When you are done cutting glue the paper and the cardboard together.
## Step 5: Clock Mechanism
Here you are going to assemble the clock.In the first photo I wanted to show you the order.
1)make a hole in the cardboard big enough for the clock.You should be able to see the top part.
2)put the little circle on top of it.
3)put the hexagon piece on top of it and turn it to secure it
4)put the hour hand on top
5)put the minute hand on top
6)lastly put the second hand on top
NOTE: I painted the second hand red didn't look good :)
If you have trouble following the steps here is a video to help you:
## Step 6: Painting and Glueing the Roses
There is no right or wrong way at this step you just mix the blue and red paint.To get a purple tone blue and red has to be the same amount.To get a bit more maroon color mix red with a little bit of blue.To get the lavander color mix the purple with a lot of white.
I cut the bottom of the roses to make it easier to glue.But after cutting they became a bit loose so I wrapped the green wire around them.
## Step 7: Done...
Thats pretty much it I hope it was clear and I hope you enjoyed :) | finemath-3plus |
/**
* ...
* @author paul
*/
function initCBX(object, id, options) {
var design = "assets";
if(object == null){
jQuery.noConflict();
var cboxClass;
cboxClass = jQuery(id).attr("class");
if(jQuery.browser.msie && parseInt(jQuery.browser.version)<8 ){
jQuery(id).colorbox();
}
else{
if(cboxClass.indexOf("cboxElement") == -1){
if(options.classes.image.id){
jQuery('.'+options.classes.image.id).colorbox({transition:options.classes.image.transition, slideshow:options.classes.image.slideshow, slideshowSpeed:options.classes.image.slideshowSpeed});
}
if(options.classes.video){
if(options.classes.video.id){
jQuery('.'+options.classes.video.id).colorbox({iframe:true, innerWidth:options.classes.video.innerWidth, innerHeight:options.classes.video.innerHeight, transition:options.classes.image.transition, slideshow:options.classes.image.slideshow, slideshowSpeed:options.classes.image.slideshowSpeed});
}
}
if(options.classes.swf){
if(options.classes.swf.id){
var cbxSWFSrc = jQuery('.'+options.classes.swf.id).attr("href");
var objEmbd = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+options.classes.video.innerWidth+'" HEIGHT="'+options.classes.video.innerHeight+'" id="cbxSWF" ALIGN="">'+
'<PARAM NAME=movie VALUE="'+cbxSWFSrc+'">' +
'<PARAM NAME=quality VALUE=high>' +
'<PARAM NAME=wmode VALUE=transparent>'+
'<PARAM NAME=bgcolor VALUE=#333399>'+
'<EMBED src="'+cbxSWFSrc+'" quality=high wmode=transparent WIDTH="'+options.classes.video.innerWidth+'" HEIGHT="'+options.classes.video.innerHeight+'" NAME="Yourfilename" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>'+
'</OBJECT>';
jQuery('.'+options.classes.swf.id).colorbox({html:objEmbd, transition:options.classes.image.transition, slideshow:options.classes.image.slideshow, slideshowSpeed:options.classes.image.slideshowSpeed});
}
}
}
}
jQuery(id).trigger('click');
return;
}
loadjQuery = function(filename) {
loadjQuery.getScript(object.path+"/"+filename);
loadjQuery.retry(0);
}
loadColorbox = function(filename) {
loadColorbox.getScript(object.path+"/"+filename);
loadColorbox.retry(0);
}
loadjQuery.getScript = function(filename) {
if(typeof jQuery == "undefined"){
var script = document.createElement('script');
script.setAttribute("type","text/javascript");
script.setAttribute("src", filename);
document.getElementsByTagName("head")[0].appendChild(script);
}
}
loadColorbox.getScript = function(filename) {
if(typeof jQuery.colorbox == "undefined"){
var link = document.createElement('link');
link.setAttribute('media', 'screen');
link.setAttribute('href', object.path+'/'+design+'/colorbox.css');
link.setAttribute('rel', 'stylesheet');
document.getElementsByTagName("head")[0].appendChild(link);
var script = document.createElement('script');
script.setAttribute("type","text/javascript");
script.setAttribute("src", filename);
document.getElementsByTagName("head")[0].appendChild(script);
}
}
loadjQuery.retry = function(time_elapsed) {
if (typeof jQuery == "undefined") {
if (time_elapsed <= 5000) {
setTimeout("loadjQuery.retry(" + (time_elapsed + 200) + ")", 200);
}
}
else {
if(typeof jQuery.colorbox == "undefined"){
loadColorbox("jquery.colorbox-min.js");
}
}
}
loadColorbox.retry = function(time_elapsed) {
if (typeof jQuery.colorbox == "undefined") {
if (time_elapsed <= 5000) {
setTimeout("loadColorbox.retry(" + (time_elapsed + 200) + ")", 200);
}
}
}
if(typeof jQuery == "undefined"){
loadjQuery("jquery-1.7.2.min.js");
}
else if(typeof jQuery.colorbox == "undefined"){
loadColorbox("jquery.colorbox-min.js");
}
}
| PhoenixInteractiveNL/emuControlCenter-ecc-core/tools/3dGallery_scripts/circulargallery/colorbox/swf.js.communication.js |
# Identifying Untrustworthy Predictions in Neural Networks
by Geometric Gradient Analysis
Leo Schwinn
An Nguyen
Rene Raab
Leon Bungert
Daniel Tenbrinck
Dario Zanca
Martin Burger
Bjoern Eskofier
Department Artificial Intelligence in Biomedical Engineering, Univ. of Erlangen-Nurnberg, Germany
###### Abstract
The susceptibility of deep neural networks to untrustworthy predictions, including out-of-distribution (OOD) data and adversarial examples, still prevent their widespread use in safety-critical applications. Most existing methods either require a re-training of a given model to achieve robust identification of adversarial attacks or are limited to out-of-distribution sample detection only. In this work, we propose a geometric gradient analysis (GGA) to improve the identification of untrustworthy predictions without retraining of a given model. GGA analyzes the geometry of the loss landscape of neural networks based on the saliency maps of their respective input. To motivate the proposed approach, we provide theoretical connections between gradients' geometrical properties and local minima of the loss function. Furthermore, we demonstrate that the proposed method outperforms prior approaches in detecting OOD data and adversarial attacks, including state-of-the-art and adaptive attacks.
## 1 Introduction
Deep neural networks (DNNs) are known to achieve remarkable results when the distribution of the training and test data are similar. However, this assumption is often violated in real-world scenarios where so-called out-of-distribution (OOD) data may be observed which are not covered by the training set. DNNs have been shown to make high-confidence predictions for OOD data even if it does not contain any semantic information, e.g., randomly generated noise (Hendrycks and Gimpel, 2017). This behaviour can lead to fatal outcomes in safety-critical applications, for example in autonomous driving, where the algorithm might fail to call for human intervention when it is confronted with OOD data. In addition to the overconfidence of DNNs, it is widely recognized that most DNNs are vulnerable to imperceptible input perturbations called adversarial examples (Goodfellow et al., 2015; Madry et al., 2018). These perturbations can lead to incorrect predictions by the neural network and therefore pose an additional security risk. Many approaches have been proposed to make neural networks more robust in terms of adversarial examples (Goodfellow et al., 2015; Madry et al., 2018; Gowal et al., 2020). Nevertheless, there is still a wide gap between the accuracy on unperturbed data and adversarial examples.
An alternative to training robust DNNs is the early detection of attacks (Lee et al., 2018; Chen et al., 2020). Identified attacks can then be forwarded for further human assessment. One line of research investigates geometric properties of neural networks in the input space to explain their classification decisions and detect adversarial attacks. Fawzi et al. (2017) demonstrate that the decision boundaries of neural networks are mostly flat around the training data and only show considerable curvature in very few directions. Jetley et al. (2018) illustrate that these high-curvature directions are mainly responsible for the final classification decision and thus can be exploited by adversarial attacks to induce misclassifications. However, Fawzi et al. (2017) only focus on detecting small adversarial perturbations and Jetley et al. (2018) restrict themselves to the theoretical analysis of the loss landscape.
In this work we focus on the detection of two major problems of DNNs, namely OOD data and adversarial attacks. We propose a novel methodology inspired by the analysis of geometric properties in the input space of neural networks, which we name geometric gradient analysis (GGA). Here, we analyze and interpret the gradient of a neural network with respect to its input, in the following referred to as _saliency map_. More precisely, for a given input sample we inspect the geometric relation among all possible saliency maps, calculated for each output class of the model. This is achieved by a pairwise calculation of the cosine similarity between saliency maps. GGA can be used with any pretrained differentiable neural network and does not require any re-training of the model. Figure 1 shows input samples of a neural network in the top row and the respective cosine similarities between the saliency maps of every output class in the bottom row. Figure 0(a) exemplifies that if an input is correctly classified by the model, the saliency map of the predicted class (i.e. the digit 7) generally points in a direction which is opposite to the saliency maps of all other classes. This results in low average cosine similarity between these saliency maps in the rows and columns of class label 7 (blue colored squares). Accordingly, the saliency maps of the other classes mostly align and display a high average cosine similarity (red colored squares). In contrast, in the case of a OOD sample or adversarial attack, the saliency maps of the non-predicted classes point towards different directions and the cosine similarity is considerably lower on average. The contributions of this paper can be summarized as follows. First, we theoretically motivate the proposed GGA method by deriving a connection between the local minima of the loss landscape and the geometric behavior of gradients. Subsequently, we quantitatively demonstrate that for common OOD tasks GGA is highly competitive compared to prior methods. Furthermore, we demonstrate that GGA successfully identifies a diverse variety of adversarial attacks and show that the geometric relation between gradients is difficult to compromise with adaptive attacks.
## 2 Related Work
Our proposed method combines ideas from several areas of neural network research. This includes out-of-distribution detection, robust out-of-distribution detection which combines OOD detection and adversarial attacks, and model saliency. In this section, we briefly review prior work in these research areas.
Previous works have established that softmax-based neural networks tend to make overconfident predictions in the presence of misclassifications, OOD data, and adversarial attacks [1, 11, 12, 13, 14]. Hendrycks and Gimpel (2017) propose a baseline method for detecting OOD data which utilizes the softmax output of a neural network. Depending on a pre-defined threshold based on the softmax score they define samples as either in- or out-of-distribution. Liang et al. (2018) further enhance this baseline. They apply temperature scaling to the softmax scores and additionally add small perturbations to the input to increase the difference between in- and out-of-distribution samples. While both approaches have been shown to work on OOD data, they fail in the presence of adversarial attacks [10].
Lee et al. (2018) evaluate their detection framework both on OOD and adversarial samples. They calculate class-conditional Gaussian distributions from the pre-trained networks and discriminate samples based on the Mahalanobis distance between the distributions. Chen et al. (2020) proposed a combined framework for detecting OOD data and adversarial attacks as robust out-of-distribution (ROOD) detection. They extend the threat model to attacks on OOD data which aim to fool the adversarial detector as well as the classification model. They augment the training data of neural networks with both perturbed inlier and outlier data and demonstrate improved robustness compared to prior methods. Nevertheless, both methods require adversarial examples for training the respective detector.
Another line of research has found that as neural networks become more robust, the interpretability of their saliency maps increases [17, 14]. Gu and Tresp (2019) propose enhanced Guided Backpropagation and show that the classifications of adversarial images can be explained by saliency-based methods. Ye et al. (2020) demonstrate that the saliency maps of adversarial
Figure 1: Input samples of a neural network in the top row and the respective cosine similarity matrices in the bottom row (matrices which contain the pairwise cosine similarity between the saliency map w.r.t. every class-specific logit). Correct classification results in high average cosine similarity (red) between the saliency maps of non-predicted classes while adversarial attacks and outliers can be detected by saliency maps that are less aligned between non-predicted-classes (blue).
and benign examples exhibit different properties and utilize this behaviour to detect adversarial attacks. However, Dombrowski et al. (2019) observe that explanation-based methods can be manipulated by adversarial attacks as well, which limits the robustness of these methods.
## 3 Geometric Gradient Analysis
In this section we first introduce the necessary mathematical notation and describe the proposed geometric gradient analysis (GGA) method. Then, necessary and sufficient conditions for local minima in the loss function using non-local gradient information are given to further motivate the geometrical gradient analysis.
Let \((x,y)\) be a pair consisting of an input sample \(x\in\mathbb{R}^{d}\) and its corresponding class label \(y\in\{1,\ldots,C\}\) in a supervised classification task. We denote by \(F_{\theta}\) a neural network parametrized by the parameter vector \(\theta\in\Theta\), and by \(\hat{k}\) the class predicted by the neural network for a given sample \(x\). We define \(\mathcal{L}(F_{\theta}(x),y)\) as the loss function of the neural network. The GGA method can be summarized as follows. We first define \(s_{i}(x)\in\mathbb{R}^{d}\) as the saliency map of the \(i\)-th class for a given sample \(x\) as
\[s_{i}(x)=\text{sgn}\left(\nabla_{x}\mathcal{L}(F_{\theta}(x),i)\right), \tag{1}\]
where sgn indicates the element-wise sign operation. As common for adversarial attacks (Goodfellow et al., 2015; Madry et al., 2018) we use the sign of the gradient instead of utilizing the gradient directly. This has shown to be effective for approximating the direction which will maximize the loss w.r.t. to the respective class (Goodfellow et al., 2015; Madry et al., 2018) and has been more effective for GGA as well in our experiments. Omitting the dependency on \(x\), the cosine similarity matrix \(\text{CSM}\equiv\text{CSM}(x)\), for a given sample \(x\) is defined as
\[\text{CSM}=(c_{ij})\in\mathbb{R}^{C\times C},c_{ij}=\frac{s_{i}\cdot s_{j}}{|s _{i}||s_{j}|} \tag{2}\]
where \(i,j\in\{1,...,C\}\) and \(c_{ij}\) represent the cosine similarity between the two saliency maps \(s_{i}\) and \(s_{j}\). In contrast to previous methods, which rely solely on the saliency w.r.t. the predicted class, GGA takes into account the geometric properties between the saliency maps of all possible output classes. Considering multiple saliency maps simultaneously makes GGA more difficult to attack. To fool the trained neural network as well as the GGA detector, an attacker must cause a misclassification while simultaneously retaining the geometric properties between the saliency maps of all output classes. As we demonstrate in Section 5.1, after network training correctly classified inputs \(x\) are mostly mapped onto a local minimum of the loss landscape w.r.t. the predicted class \(\hat{k}\). For these correctly classified samples the saliency maps of non-predicted classes \(s_{i},s_{j}\), \(i,j\neq\hat{k}\), point away from the local minimum and exhibit a high average cosine similarity. In contrast, incorrectly classified samples leave the vicinity of these local optima and show different saliency maps for different classes and thus a lower average cosine similarity and more variance between the saliency maps.
Necessary and sufficient conditions for local minima of the loss function:To further motivate the analysis of the geometry of gradients in the input space of neural networks we introduce a property that lets us identify if a given data point lies on a local minimum of the loss landscape. First, we observe that the following holds.
**Theorem 1**.: _Let \(\zeta_{x}\) be defined by_
\[\zeta_{x}\equiv\zeta_{x}(\hat{x}):=\frac{\langle-\nabla_{x}\mathcal{L}(F_{ \theta}(\hat{x}),i),x-\hat{x}\rangle}{|\nabla_{x}\mathcal{L}(F_{\theta}(\hat {x}),i)||x-\hat{x}|},\quad\hat{x}\neq x. \tag{3}\]
_The point \(x\) is a local minimum of \(\mathcal{L}(F_{\theta}(\cdot),i)\) if and only if_
\[0\leq\liminf_{|x-\hat{x}|\to 0}\zeta_{x}(\hat{x})\leq\limsup_{|x-\hat{x}|\to 0}\zeta_{x}(\hat{x})\leq 1. \tag{4}\]
The proof of Theorem 1 is divided in two steps. We first prove that equation 4 is necessarily met if the function \(x\mapsto\mathcal{L}(F_{\theta}(x),i)\) attains a local minimum in \(x\). This follows from
**Lemma 1**.: _Let \(f:\mathbb{R}^{d}\rightarrow\mathbb{R}\) be a \(C^{1}\)-function and let \(x\) be a local minimum of \(f\). Then it holds_
\[0 \leq\liminf_{|x-\hat{x}|\to 0}\frac{\langle-\nabla f(\hat{x}),x- \hat{x}\rangle}{|\nabla f(\hat{x})||x-\hat{x}|}\] \[\leq\limsup_{|x-\hat{x}|\to 0}\frac{\langle-\nabla f(\hat{x}),x- \hat{x}\rangle}{|\nabla f(\hat{x})||x-\hat{x}|}\leq 1.\]
Proof.: Taylor expanding around \(\hat{x}\) gives
\[f(x)=f(\hat{x})+\langle\nabla f(\hat{x}),x-\hat{x}\rangle+o(|x-\hat{x}|),\]
which can be reordered to
\[\frac{f(\hat{x})-f(x)}{|x-\hat{x}|}=\frac{\langle-\nabla f(\hat{x}),x-\hat{x} \rangle}{|x-\hat{x}|}+o(1).\]
If \(x\) is a local minimum, one obtains
\[0\leq\liminf_{|x-\hat{x}|\to 0}\frac{\langle-\nabla f(\hat{x}),x-\hat{x} \rangle}{|x-\hat{x}|}\]
which directly implies the desired inequality.
Non-negativity of the cosine similarity in equation 3 can also be brought into correspondence with positive semi-definiteness of the Hessian of \(f\) which follows from
**Lemma 2**.: _Let \(f:\mathbb{R}^{d}\rightarrow\mathbb{R}\) be a \(C^{2}\)-function. Then for all vectors \(e\in\mathbb{R}^{d}\) with \(|e|=1\) it holds_
\[\lim_{r\to 0}\left\langle\frac{\nabla f(x+re)-\nabla f(x)}{r},e\right\rangle= \left\langle Hf(x)e,e\right\rangle.\]Proof.: We compute
\[\left\langle\frac{\nabla f(x+re)-\nabla f(x)}{r},e\right\rangle\] \[=\left\langle\frac{1}{r}\int_{0}^{r}\frac{\mathrm{d}}{\mathrm{d}t} \nabla f(x+te)\mathrm{d}t,e\right\rangle\] \[=\left\langle\frac{1}{r}\int_{0}^{r}Hf(x+ty)e\mathrm{d}t,e\right\rangle\]
where \(Hf=(\partial_{t}\partial_{j}f)_{i,j}\) denotes the Hessian matrix of \(f\). Since \(f\) is a \(C^{2}\)-function, the integral \(\frac{1}{r}\int_{0}^{r}Hf(x+ty)\mathrm{d}t\) converges to \(Hf(x)\) as \(r\to 0\). Therefore, one obtains
\[\lim_{r\to 0}\left\langle\frac{1}{r}\int_{0}^{r}Hf(x+ty)e\mathrm{d}t,e \right\rangle=\left\langle Hf(x)e,e\right\rangle.\]
We can now proceed to the proof of Theorem 1.
Proof of Theorem 1.: Applying Lemma 1 to \(f(x):=\mathcal{L}(F_{\theta}(x),i)\) shows that equation 4 is necessary for \(x\) to be a local minimum.
For the converse direction we argue as follows: First, we note that equation 4 implies that \(x\) is a critical point with \(\nabla f(x)=0\). Otherwise one could set \(\tilde{x}=x-t\nabla f(x)\) with \(t>0\) and obtain
\[\frac{\left\langle-\nabla f(\tilde{x}),x-\tilde{x}\right\rangle}{\left|\nabla f (\tilde{x})\right||x-\tilde{x}|}=\frac{\left\langle-\nabla f(\tilde{x}), \nabla f(x)\right\rangle}{\left|\nabla f(\tilde{x})\right||\nabla f(x)|} \rightarrow-1,\]
as \(\left|x-\tilde{x}\right|\to 0\), since \(\nabla f\) is continuous. This is a contradiction to equation 4 and hence \(\nabla f(x)=0\).
This allows us to compute
\[\frac{\left\langle-\nabla f(\tilde{x}),x-\tilde{x}\right\rangle}{ \left|\nabla f(\tilde{x})\right||x-\tilde{x}|}\] \[=\frac{\left\langle\nabla f(x)-\nabla f(\tilde{x}),x-\tilde{x} \right\rangle}{\left|\nabla f(x)-\nabla f(\tilde{x})\right||x-\tilde{x}|}\] \[=\left\langle\frac{\nabla f(x)-\nabla f(\tilde{x})}{\left|x- \tilde{x}\right|},\frac{x-\tilde{x}}{\left|x-\tilde{x}\right|}\right\rangle \frac{\left|x-\tilde{x}\right|}{\left|\nabla f(x)-\nabla f(\tilde{x})\right|}.\]
Hence, if this expression is asymptotically non-negative for all \(\tilde{x}\) converging to \(x\), we can choose arbitrary \(e\in\mathbb{R}^{d}\) with \(|e|=1\), define \(\tilde{x}=x+re\) and apply Lemma 2 to get
\[0\leq\lim_{r\to 0}\left\langle\frac{\nabla f(x+re)-\nabla f(x)}{r},e \right\rangle=\left\langle Hf(x)e,e\right\rangle.\]
Since \(e\) was arbitrary, this means that \(x\) is a local minimum of the loss \(f\).
## 4 Experiments
In this section we first analyze the characteristics of the loss landscape of neural networks in case of correct and incorrect classifications. Further, we demonstrate the effectiveness of GGA on several benchmark data sets. We compare GGA to two other methods which also not necessarily require any re-training of the neural network and do not utilize adversarial examples for training the outlier/adversarial detector. Namely, the method proposed in [1] (called _Baseline_ in the following) and the _ODIN method_[10]. We additionally consider the method proposed by Lee et al. [2018] (called _Maha_ in the following), which requires the detector to be trained with adversarial examples. | 2102.12196v1.mmd |
jsonp({"cep":"58995000","cidade":"Mana\u00edra","uf":"PB","estado":"Para\u00edba"});
| lfreneda/cepdb-api/v1/58995000.jsonp.js |
{% extends "administrator/base.django.js" %}
{% load extjs %}
{% block imports %}
{{ block.super }}
Ext.require('devilry.extjshelpers.PermissionChecker');
Ext.require('devilry.examiner.ActiveAssignmentsView');
Ext.require('devilry.administrator.DashboardButtonBar');
{% endblock %}
{% block appjs %}
{{ block.super }}
{{ restfulapi.RestfulSimplifiedNode|extjs_model }};
{{ restfulapi.RestfulSimplifiedSubject|extjs_model }};
{{ restfulapi.RestfulSimplifiedPeriod|extjs_model:"subject" }};
{{ restfulapi.RestfulSimplifiedAssignment|extjs_model }};
var nodestore = {{ restfulapi.RestfulSimplifiedNode|extjs_store }};
var subjectstore = {{ restfulapi.RestfulSimplifiedSubject|extjs_store }};
var periodstore = {{ restfulapi.RestfulSimplifiedPeriod|extjs_store }};
nodestore.pageSize = 1;
subjectstore.pageSize = 1;
periodstore.pageSize = 1;
var is_superuser = {{ user.is_superuser|lower }};
{% endblock %}
{% block onready %}
{{ block.super }}
var dashboard_assignment_model = {{ restfulapi.RestfulSimplifiedAssignment|extjs_model:"subject,period" }}
var dashboard_periodmodel = {{ restfulapi.RestfulSimplifiedPeriod|extjs_model:"subject" }}
var permchecker = Ext.create('devilry.extjshelpers.PermissionChecker', {
stores: [nodestore, subjectstore, periodstore],
//renderTo: 'no-permissions-message',
emptyHtml: '<div class="section info-small extravisible-small"><h1>{{ DEVILRY_ADMINISTRATOR_NO_PERMISSION_MSG.title }}</h1>' +
'<p>{{ DEVILRY_ADMINISTRATOR_NO_PERMISSION_MSG.body }}</p></div>',
listeners: {
allLoaded: function(loadedItems, loadedWithRecords) {
Ext.getBody().unmask();
if(is_superuser || loadedWithRecords > 0) {
var activeAssignmentsView = Ext.create('devilry.examiner.ActiveAssignmentsView', {
model: dashboard_assignment_model,
dashboard_url: DASHBOARD_URL
});
Ext.getCmp('active-assignments').add(activeAssignmentsView);
var activePeriodsView = Ext.create('devilry.extjshelpers.ActivePeriodsGrid', {
model: dashboard_periodmodel,
dashboard_url: DASHBOARD_URL
});
Ext.getCmp('active-periods').add(activePeriodsView);
searchwidget.show();
}
}
}
});
var buttonbar = Ext.create('devilry.administrator.DashboardButtonBar', {
node_modelname: {{ restfulapi.RestfulSimplifiedNode|extjs_modelname }},
subject_modelname: {{ restfulapi.RestfulSimplifiedSubject|extjs_modelname }},
period_modelname: {{ restfulapi.RestfulSimplifiedPeriod|extjs_modelname }},
assignment_modelname: {{ restfulapi.RestfulSimplifiedAssignment|extjs_modelname }},
is_superuser: is_superuser,
nodestore: nodestore,
subjectstore: subjectstore,
periodstore: periodstore
});
Ext.create('Ext.container.Viewport', {
layout: 'border',
style: 'background-color: transparent',
items: [{
region: 'north',
xtype: 'pageheader',
navclass: 'administrator'
}, {
region: 'south',
xtype: 'pagefooter'
}, {
region: 'center',
xtype: 'container',
border: false,
padding: {left: 20, right: 20},
layout: {
type: 'vbox',
align: 'stretch'
},
items: [searchwidget, {xtype:'box', height: 20}, permchecker, buttonbar, {
xtype: 'container',
flex: 1,
layout: {
type: 'hbox',
align: 'stretch'
},
items: [{
xtype: 'panel',
flex: 3,
layout: 'fit',
border: false,
id: 'active-periods'
}, {
xtype: 'box',
width: 30
}, {
xtype: 'panel',
flex: 7,
layout: 'fit',
border: false,
id: 'active-assignments'
}]
}]
}]
});
nodestore.load();
subjectstore.load();
periodstore.load();
{% endblock %}
| vegarang/devilry-django-devilry/apps/administrator/templates/administrator/main.django.js |
#ifndef __PLAT_DMA_H
#define __PLAT_DMA_H
#define DMAC_REG(x) (*((volatile u32 *)(DMAC_REGS_VIRT + (x))))
#define DCSR(n) DMAC_REG((n) << 2)
#define DALGN DMAC_REG(0x00a0) /* DMA Alignment Register */
#define DINT DMAC_REG(0x00f0) /* DMA Interrupt Register */
#define DDADR(n) DMAC_REG(0x0200 + ((n) << 4))
#define DSADR(n) DMAC_REG(0x0204 + ((n) << 4))
#define DTADR(n) DMAC_REG(0x0208 + ((n) << 4))
#define DCMD(n) DMAC_REG(0x020c + ((n) << 4))
#define DRCMR(n) DMAC_REG((((n) < 64) ? 0x0100 : 0x1100) + \
(((n) & 0x3f) << 2))
#define DCSR_RUN (1 << 31) /* Run Bit (read / write) */
#define DCSR_NODESC (1 << 30) /* No-Descriptor Fetch (read / write) */
#define DCSR_STOPIRQEN (1 << 29) /* Stop Interrupt Enable (read / write) */
#define DCSR_REQPEND (1 << 8) /* Request Pending (read-only) */
#define DCSR_STOPSTATE (1 << 3) /* Stop State (read-only) */
#define DCSR_ENDINTR (1 << 2) /* End Interrupt (read / write) */
#define DCSR_STARTINTR (1 << 1) /* Start Interrupt (read / write) */
#define DCSR_BUSERR (1 << 0) /* Bus Error Interrupt (read / write) */
#define DCSR_EORIRQEN (1 << 28) /* End of Receive Interrupt Enable (R/W) */
#define DCSR_EORJMPEN (1 << 27) /* Jump to next descriptor on EOR */
#define DCSR_EORSTOPEN (1 << 26) /* STOP on an EOR */
#define DCSR_SETCMPST (1 << 25) /* Set Descriptor Compare Status */
#define DCSR_CLRCMPST (1 << 24) /* Clear Descriptor Compare Status */
#define DCSR_CMPST (1 << 10) /* The Descriptor Compare Status */
#define DCSR_EORINTR (1 << 9) /* The end of Receive */
#define DRCMR_MAPVLD (1 << 7) /* Map Valid (read / write) */
#define DRCMR_CHLNUM 0x1f /* mask for Channel Number (read / write) */
#define DDADR_DESCADDR 0xfffffff0 /* Address of next descriptor (mask) */
#define DDADR_STOP (1 << 0) /* Stop (read / write) */
#define DCMD_INCSRCADDR (1 << 31) /* Source Address Increment Setting. */
#define DCMD_INCTRGADDR (1 << 30) /* Target Address Increment Setting. */
#define DCMD_FLOWSRC (1 << 29) /* Flow Control by the source. */
#define DCMD_FLOWTRG (1 << 28) /* Flow Control by the target. */
#define DCMD_STARTIRQEN (1 << 22) /* Start Interrupt Enable */
#define DCMD_ENDIRQEN (1 << 21) /* End Interrupt Enable */
#define DCMD_ENDIAN (1 << 18) /* Device Endian-ness. */
#define DCMD_BURST8 (1 << 16) /* 8 byte burst */
#define DCMD_BURST16 (2 << 16) /* 16 byte burst */
#define DCMD_BURST32 (3 << 16) /* 32 byte burst */
#define DCMD_WIDTH1 (1 << 14) /* 1 byte width */
#define DCMD_WIDTH2 (2 << 14) /* 2 byte width (HalfWord) */
#define DCMD_WIDTH4 (3 << 14) /* 4 byte width (Word) */
#define DCMD_LENGTH 0x01fff /* length mask (max = 8K - 1) */
/*
* Descriptor structure for PXA's DMA engine
* Note: this structure must always be aligned to a 16-byte boundary.
*/
typedef struct pxa_dma_desc {
volatile u32 ddadr; /* Points to the next descriptor + flags */
volatile u32 dsadr; /* DSADR value for the current transfer */
volatile u32 dtadr; /* DTADR value for the current transfer */
volatile u32 dcmd; /* DCMD value for the current transfer */
} pxa_dma_desc;
typedef enum {
DMA_PRIO_HIGH = 0,
DMA_PRIO_MEDIUM = 1,
DMA_PRIO_LOW = 2
} pxa_dma_prio;
/*
* DMA registration
*/
int __init pxa_init_dma(int irq, int num_ch);
int pxa_request_dma (char *name,
pxa_dma_prio prio,
void (*irq_handler)(int, void *),
void *data);
void pxa_free_dma (int dma_ch);
/*
* Cooperation with pxa_dma + dmaengine while there remains at least one pxa
* driver not converted to dmaengine.
*/
#if defined(CONFIG_PXA_DMA)
extern int pxad_toggle_reserved_channel(int legacy_channel);
#else
static inline int pxad_toggle_reserved_channel(int legacy_channel)
{
return 0;
}
#endif
extern void __init pxa2xx_set_dmac_info(int nb_channels, int nb_requestors);
#endif /* __PLAT_DMA_H */
| geminy/aidear-oss/linux/linux-4.7/arch/arm/plat-pxa/include/plat/dma.h |
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
*/
Y.Env.evt = {
handles: {},
plugins: {}
};
| co-ment/comt-src/cm/media/js/lib/yui/yui3-3.15.0/src/event-custom/js/event.js |
package squidpony.squidmath;
/**
* A simple interface for RandomnessSources that have the additional property of a state that can be re-set.
* Created by Tommy Ettinger on 9/15/2015.
*/
public interface StatefulRandomness extends RandomnessSource {
/**
* Get the current internal state of the Reseedable as a long.
* @return the current internal state of this object.
*/
public long getState();
/**
* Set the current internal state of this Reseedable with a long.
*
* @param state a 64-bit long. You should avoid passing 0, even though some implementations can handle that.
*/
public void setState(long state);
}
| davidbecker/SquidLib-squidlib-util/src/main/java/squidpony/squidmath/StatefulRandomness.java |
/*
* Copyright 2012, 2013 Thomas Schöps
*
* This file is part of OpenOrienteering.
*
* OpenOrienteering 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.
*
* OpenOrienteering 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 OpenOrienteering. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPENORIENTEERING_DUPLICATE_EQUALS_T_H
#define OPENORIENTEERING_DUPLICATE_EQUALS_T_H
#include <QObject>
// IWYU pragma: no_include <QString>
/**
* @test Test that duplicates of symbols and objects are equal to their originals.
*/
class DuplicateEqualsTest : public QObject
{
Q_OBJECT
private slots:
void initTestCase();
void symbols();
void symbols_data();
void objects();
void objects_data();
};
#endif
| sikmir/mapper-test/duplicate_equals_t.h |
Tornant a Comarques: de març 2015
Durant uns anys, mentre estudiava, em vaig passar els caps de setmana treballant en una botiga de roba d’un centre comercial. Eren jornades de 12 hores de 10 del matí a 10 de la nit, amb una pausa curteta per dinar. Ensenyava americanes, pantalons, roba d’home, de dona i de canalla. Uns dels clients que recordo eren una parella estrafeta amb un nen.
L’home era molt baixet i calb amb una estructura física molt desproporcionada: cames molt curtes, braços molt llargs, cos estret. Tota la roba que portava li quedava desgarbada i sobrera. La seva dona era també baixa però rodona duia faldilla quasi sempre ensenyant les cames gruixudes i blanques, tenia els cabells llisos negres i molt però que molt greixosos ( bruts diría jo). El nen, ho sé perque m’hi vaig fixar, era una monada.
Una vegada van venir a comprar pantalons pel marit. Com acostumavem a fer jo vaig prendre mides per fer-li fer la vora dels baixos. Imitant el que feien les meves companyes (més experimentades que jo) vaig apuntar amb agulles el troç que calia escurçar i vaig deixar els pantalons perque la modista els arreglés. No tinc ni idea de com ho vaig fer, si em vaig equivocar o no, o com coi vaig fotre les agulles. El cas és que quan la setmana següent va tornar la familia trap a buscar l’encàrrec, els camals d’ aquells pantalons s’havien reduit a la mínima expressió i si aquell pobre home ja era lleig, camacurt i malgirbat amb aquells pantalons posats, amb una evident falta de material tèxtil al capdavall, feia una fila que no us la podeu imaginar.
Jo savia perfectament que era culpa meva que alguna cosa no havia sortit com era previst. Que l’havia cagat. I molt. L’encarregada em va demanar explicacions davant d’ells i jo em volia morir. No podía mirar-me aquella gent i parlar amb ells sense que em vingués un atac. Savia que estaba mal fet però va ser superior a mí. Mentre la meva jefa discutía amb ells com ho resolien jo m’havia d’amagar dins els emprovadors perque ningú em veiés pixar-me de riure amb total descontrol.
Publicat per Teresa a 8:48 2 comentaris:
Etiquetes de comentaris: comarques, em passa pel cap, esclavitut, homenots, imperfeccions, íntim i personal, puagh, tonteries, va passar | c4-ca |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Kbproto(AutotoolsPackage, XorgPackage):
"""X Keyboard Extension.
This extension defines a protcol to provide a number of new capabilities
and controls for text keyboards."""
homepage = "https://cgit.freedesktop.org/xorg/proto/kbproto"
xorg_mirror_path = "proto/kbproto-1.0.7.tar.gz"
version('1.0.7', sha256='828cb275b91268b1a3ea950d5c0c5eb076c678fdf005d517411f89cc8c3bb416')
depends_on('pkgconfig', type='build')
depends_on('util-macros', type='build')
| LLNL/spack-var/spack/repos/builtin/packages/kbproto/package.py |
AliAnalysisTaskEmcalJetHCorrelations* AddTaskEmcalJetHCorrelations(
const char *nTracks = "usedefault",
const char *nCaloClusters = "usedefault",
// Jet options
const Double_t trackBias = 5,
const Double_t clusterBias = 5,
// Mixed event options
const Int_t nTracksMixedEvent = 0, // Additionally acts as a switch for enabling mixed events
const Int_t minNTracksMixedEvent = 5000,
const Int_t minNEventsMixedEvent = 5,
const UInt_t nCentBinsMixedEvent = 10,
// Triggers
UInt_t trigEvent = AliVEvent::kAny,
UInt_t mixEvent = AliVEvent::kAny,
// Options
const Bool_t lessSparseAxes = 0,
const Bool_t widerTrackBin = 0,
// Corrections
const Int_t doEffCorrSW = 0,
const Bool_t embeddingCorrection = kFALSE,
const char * embeddingCorrectionFilename = "alien:///alice/cern.ch/user/r/rehlersi/embeddingCorrection.root",
const char * embeddingCorrectionHistName = "embeddingCorrection",
const char *suffix = "biased"
)
{
AliAnalysisTaskEmcalJetHCorrelations * task = AliAnalysisTaskEmcalJetHCorrelations::AddTaskEmcalJetHCorrelations(
nTracks, nCaloClusters,
trackBias, clusterBias,
nTracksMixedEvent, minNTracksMixedEvent, minNEventsMixedEvent,
nCentBinsMixedEvent,
trigEvent, mixEvent,
lessSparseAxes,
widerTrackBin,
doEffCorrSW,
embeddingCorrection,
embeddingCorrectionFilename, embeddingCorrectionHistName,
suffix
);
return task;
}
| mkrzewic/AliPhysics-PWGJE/EMCALJetTasks/macros/AddTaskEmcalJetHCorrelations.C |
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2017 Dan "Ducky" Little
*
* 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.
*/
/** Tests for the toolbar reducer set.
*
*/
import { createStore, combineReducers } from 'redux';
import toolbarReducer from 'gm3/reducers/toolbar';
import * as actions from 'gm3/actions/toolbar';
describe('Toolbar reducer tests', () => {
let store = null;
// before each test refresh the store.
beforeEach(() => {
store = createStore(combineReducers({
'toolbar': toolbarReducer
}));
});
test('Add a tool to the toolbar', () => {
store.dispatch(actions.addTool('root', {
name: 'sample',
label: 'Sample',
actionType: 'service', actionDetail: 'sample'
}));
const tb = store.getState();
expect(tb.toolbar.root.length).toBe(1);
});
test('Add a drawer to the toolbar', () => {
store.dispatch(actions.addDrawer('root', {
name: 'drawer0', label: 'Drawer 0',
}));
store.dispatch(actions.addTool('drawer0', {
name: 'sample1', label: 'Sample 1',
actionType: 'service', actionDetail: 'sample2'
}));
const tb = store.getState();
// ensure both the drawer and the tool made it on to
// the toolbar "stack"
expect(tb.toolbar.root.length).toBe(1);
// ensure the tool "sample1" made it into drawer0.
expect(tb.toolbar.drawer0.length).toBe(1);
expect(tb.toolbar.drawer0[0].name).toBe('sample1');
});
test('Remove a tool from the toolbar', () => {
// create five tools, remove the third one.
for(let i = 0; i < 5; i++) {
store.dispatch(actions.addTool('root', {
name: 'tool' + i, label: 'Tool ' + i,
actionType: 'service', actionDetail: '',
}));
}
// add a drawer
store.dispatch(actions.addDrawer('root', {
name: 'drawer0', label: 'Drawer 0',
}));
store.dispatch(actions.addTool('drawer0', {
name: 'sample1', label: 'Sample 1',
actionType: 'service', actionDetail: 'sample2'
}));
// test removing a tool
store.dispatch(actions.remove('tool3'));
let tb = store.getState();
expect(tb.toolbar.root.length).toBe(5);
// test removing a drawer
store.dispatch(actions.remove('drawer0'));
tb = store.getState();
expect(tb.toolbar.root.length).toBe(4);
});
test('Adding a tool to the "front" of the toolbar', () => {
// using null for the root and null for the order
// also checks the "default" settings in the reducer.
store.dispatch(actions.addTool(null, {
name: 'second', label: 'second'
}, null));
store.dispatch(actions.addTool('root', {
name: 'first', label: 'first'
}, 'first'));
const tb = store.getState();
expect(tb.toolbar.root.length).toBe(2);
expect(tb.toolbar.root[0].name).toBe('first');
});
});
| geomoose/gm3-tests/gm3/reducers/toolbar.test.js |
/* Copyright 2015 BlackBerry Ltd.
Licensed under the Apache License, Version 2.0 (the 'License');
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the specific language
governing permissions and limitations under the License. */
angular.module('avatarSpinner', [])
.factory('avatarSpinner', function($rootScope) {
$rootScope.clearSelects = false;
$rootScope.selectMode = false;
$rootScope.selectedItems = [];
$rootScope.selectedEls = [];
return {
// clear all selections
clearAllSelections: function() {
var els = $rootScope.selectedEls;
for (var el in els) {
var wrapperEl = els[el][0].childNodes[1];
wrapperEl = angular.element(wrapperEl)[0].children[0];
wrapperEl.classList.remove('spin-thumbnail');
var checkmark = angular.element(wrapperEl)[0].children[1];
checkmark.classList.remove('checkmark-scale');
var label = angular.element(wrapperEl)[0].children[0];
label.style.display = 'block';
var parentEl = angular.element(els[el][0]);
parentEl = angular.element(parentEl);
parentEl.removeClass('selected-item');
}
$rootScope.clearSelects = false;
$rootScope.selectMode = false;
$rootScope.selectedItems = [];
$rootScope.selectedEls = [];
},
// clear individual item
clearSelection: function(el, parentEl, lastNameInitialEl, checkmarkEl, id) {
el.removeClass('spin-thumbnail');
parentEl.removeClass('selected-item');
checkmarkEl.classList.remove('checkmark-scale');
lastNameInitialEl.style.display = 'block';
$rootScope.selectedItems = _.without($rootScope.selectedItems, _.findWhere(
$rootScope.selectedItems, {
idContact: id
}));
}
};
})
.directive('avatarSpinner', function($rootScope, $timeout, avatarSpinner) {
return {
restrict: 'E',
template: '<div class="thumbnail-spinner-wrapper" contact-id="{{ id }}"><p class="thumbnail-label">{{ label }}</p><i class="checkmark icon ion-ios-checkmark-empty"></i></div>',
link: function(scope, element, attrs) {
var contact = JSON.parse(attrs.itemData);
scope.label = attrs.label;
scope.id = contact.idContact;
element.bind('click', function() {
var wrapperEl = angular.element(element).parent();
var parentEl = angular.element(element[0].children[0]);
var lastNameInitialEl = parentEl[0].children[0];
var checkmarkEl = parentEl[0].children[1];
var isSelected = angular.element(wrapperEl).hasClass('selected-item');
// de-select
if (isSelected) {
avatarSpinner.clearSelection(parentEl, wrapperEl, lastNameInitialEl,
checkmarkEl,
contact.idContact);
}
// select
else {
$rootScope.selectMode = true;
$rootScope.clearSelects = true;
$timeout(function() {
parentEl.addClass('spin-thumbnail');
wrapperEl.addClass('selected-item');
$timeout(function() {
lastNameInitialEl.style.display = 'none';
$timeout(function() {
checkmarkEl.classList.add('checkmark-scale');
}, 120);
}, 150);
}, 1);
$rootScope.selectedItems.push(contact);
$rootScope.selectedEls.push(wrapperEl);
}
scope.$apply();
});
}
};
});
| ctetreault/Cross-Platform-Samples-sfdc-contact-list/www/js/directives/ct-avatar-spinner/ct-avatar-spinner.js |
/*
===============================================================================
FILE: laszip_decompress_selective_v3.hpp
CONTENTS:
Contains bit mask definitions for selective decompression.
PROGRAMMERS:
[email protected] - http://rapidlasso.com
COPYRIGHT:
(c) 2007-2017, martin isenburg, rapidlasso - fast tools to catch reality
This is free software; you can redistribute and/or modify it under the
terms of the GNU Lesser General Licence as published by the Free Software
Foundation. See the COPYING file for more information.
This software is distributed WITHOUT ANY WARRANTY and without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CHANGE HISTORY:
14 April 2017 -- created at Lo Que Hay where Gui was having birthday dinner
===============================================================================
*/
#ifndef LASZIP_DECOMPRESS_SELECTIVE_V3_HPP
#define LASZIP_DECOMPRESS_SELECTIVE_V3_HPP
#define LASZIP_DECOMPRESS_SELECTIVE_ALL 0xFFFFFFFF
#define LASZIP_DECOMPRESS_SELECTIVE_CHANNEL_RETURNS_XY 0x00000000
#define LASZIP_DECOMPRESS_SELECTIVE_Z 0x00000001
#define LASZIP_DECOMPRESS_SELECTIVE_CLASSIFICATION 0x00000002
#define LASZIP_DECOMPRESS_SELECTIVE_FLAGS 0x00000004
#define LASZIP_DECOMPRESS_SELECTIVE_INTENSITY 0x00000008
#define LASZIP_DECOMPRESS_SELECTIVE_SCAN_ANGLE 0x00000010
#define LASZIP_DECOMPRESS_SELECTIVE_USER_DATA 0x00000020
#define LASZIP_DECOMPRESS_SELECTIVE_POINT_SOURCE 0x00000040
#define LASZIP_DECOMPRESS_SELECTIVE_GPS_TIME 0x00000080
#define LASZIP_DECOMPRESS_SELECTIVE_RGB 0x00000100
#define LASZIP_DECOMPRESS_SELECTIVE_NIR 0x00000200
#define LASZIP_DECOMPRESS_SELECTIVE_WAVEPACKET 0x00000400
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE0 0x00010000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE1 0x00020000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE2 0x00040000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE3 0x00080000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE4 0x00100000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE5 0x00200000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE6 0x00400000
#define LASZIP_DECOMPRESS_SELECTIVE_BYTE7 0x00800000
#define LASZIP_DECOMPRESS_SELECTIVE_EXTRA_BYTES 0xFFF00000
#endif // LASZIP_DECOMPRESS_SELECTIVE_V3_HPP
| strummerTFIU/TFG-IsometricMaps-LAStools/LASzip/src/laszip_decompress_selective_v3.hpp |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
from flask import Blueprint, render_template, flash, g, redirect, url_for
mod = Blueprint("mod_traceroute",
__name__,
url_prefix="/module/traceroute",
template_folder="templates",
static_folder="static"
)
@mod.route("/")
def home():
return render_template("mod_traceroute/index.html") | CyberTaoFlow/netgrafio-web/mod_traceroute/views.py |
'use strict';
var test = require('prova');
var createBucket = require('../../../js/data/create_bucket');
var BufferSet = require('../../../js/data/buffer/buffer_set');
var LineBucket = require('../../../js/data/line_bucket');
var FillBucket = require('../../../js/data/fill_bucket');
var SymbolBucket = require('../../../js/data/symbol_bucket');
test('createBucket', function(t) {
var buffers = new BufferSet();
t.ok(createBucket({type: 'line'}, buffers) instanceof LineBucket);
t.ok(createBucket({type: 'fill'}, buffers) instanceof FillBucket);
t.ok(createBucket({type: 'symbol'}, buffers) instanceof SymbolBucket);
t.end();
});
| gbif/map-gl-frontend/mapbox-gl-js/test/js/data/create_bucket.test.js |
Lo Taak Ontwikkeling Essay - 947 Words - AvroArrow
beskou kan word, kan as 'n belangrike ...view middle of the document...
'n Persoon is
huishouding wat onder R3500 pm verdien, word gesien
dat hulle in armoede leef. Dit maak ± 50% van alle
huishoudings in Kaapstad uit. Die effek is grootliks dat
kinders geforseer word om vroeër uit die skoolstelsel te
tree en om hul gesin finansieel te ondersteun en dus nie
die nodige opvoeding kry om suksesvol in die toekoms
te wees nie
Wanneer 'n persoon sy werk verloor, verkry hy dalk nie
meer 'n inkomste nie. Om nie te werk wanneer daar 'n
behoefte aan 'n werk bestaan nie, kan ernstige gevolge
hê. Dit kan daartoe lei dat individue nie hul basiese
behoeftes (bv. kos, klere en water) kan bekostig nie.
Regeringsoplossing(s)
Daar is verskeie redes vir werkloosheid. Die mees
algemeenste redes vir werkloosheid is 'n gebrek aan
goeie kwaliteit opvoedings institute, 'n ekonomiese
afswaai en arbeidsonrus in 'n spesifieke land.
Volgens Alan de Winde, Wes-Kaapse Minister van
finansies, ekonomiese ontwikkeling en toerisme is
infrastruktuur die beste manier om uit 'n ekonomiese
droogte te kom en sodoende meer werk te skep.
Ander regeringsoplossings sluit in om
werkloosheidstoelae in werking te stel om die
werkloosheid probleem op te los. Dié idee behels dat
diegene wat die geld ontvang, meeste van dit aan
basiese behoeftes bestee, d.w.s. die vraag in bv. voedsel
neem toe, dus moet die verskaffer meer werkers
aanstel om aan die vraag te voorsien
Persoonlike oplossing(s)
'n Geskikte oplossing vir werkloosheid, volgens my, sal
wees om in opvoeding te belê en liewerste kapitaal
daaraan te bestee as om werklose mense meer geld te
gee om meer werk te skep. Daar is geen doel om meer
werkgeleenthede te skep as die meerderheid van die
land nie gekwalifiseerd is om die werk te doen nie.
Onproduktiewe Arbiedsmag
Other Papers Like Lo Taak Ontwikkeling | c4-af |
/**
* Copyright 2010 The ForPlay 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 forplay.core;
/**
* Fetches and returns assets. This interface assumes that some or all assets
* are asynchronously loaded. Loading
*/
public interface AssetManager {
/**
* Return an Image, given a path to the image resource.
* @param path a path to the resource
* @return the image
*/
Image getImage(String path);
/**
* Return a Sound, given a path to the sound resource.
*
* @param path a path to the resource
* @return the sound
*/
Sound getSound(String path);
/**
* Return a String, given a path to a text resource.
*
* @param path a path to the resource
* @return the text
*/
void getText(String path, ResourceCallback<String> callback);
/**
* @return <code>true</code> if all requested assets have been loaded or errored out,
* or <code>false</code> if there are assets remaining to be retrieved
*/
boolean isDone();
/**
* @return how many assets have not yet been loaded or errored out
*/
int getPendingRequestCount();
}
| pyricau/forplay-clone-pyricau-core/src/forplay/core/AssetManager.java |
'use strict';
/* Filters */
angular.module('budgetTracker.filters', []).filter('checkmark', function () {
return function (input) {
return input ? '\u2713' : '\u2718';
};
})
.filter('interpolate', ['version', function (version) {
return function (text) {
return String(text).replace(/\%VERSION\%/mg, version);
};
}])
.filter('reverse', [function () {
return function (items) {
return items.slice().reverse();
};
}])
.filter('removeUndef', [function(){
return function(inputArr){
var output = [];
angular.forEach(inputArr, function(value, key){
if (key !== undefined && value !== undefined){
this.push(value);
}
}, output);
return output;
};
}]);
| jeffrpowell/budgettracker2-app/filters.js |
concreteGoogleMapInit = function () {
$('.googleMapCanvas').each(function () {
try {
var latitude = $(this).data('latitude');
var longitude = $(this).data('longitude');
var zoom = $(this).data('zoom');
var scrollwheel = $(this).data('scrollwheel');
var draggable = $(this).data('draggable');
var latlng = new google.maps.LatLng(latitude, longitude);
var mapOptions = {
zoom: zoom,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: false,
scrollwheel: scrollwheel,
draggable: draggable,
mapTypeControl: false
};
var map = new google.maps.Map(this, mapOptions);
new google.maps.Marker({
position: latlng,
map: map
});
} catch (e) {
$(this).replaceWith($('<p />').text(e.message));
}
});
};
| rikzuiderlicht/concrete5-concrete/blocks/google_map/view.js |
import Vue from 'vue'
import { getZIndex } from '../util/helpers'
interface options extends Vue {
$refs: {
content: Element
}
}
/* @vue/component */
export default Vue.extend<options>().extend({
name: 'stackable',
data () {
return {
stackClass: 'unpecified',
stackElement: null as Element | null,
stackExclude: null as Element[] | null,
stackMinZIndex: 0,
isActive: false
}
},
computed: {
activeZIndex (): number {
if (typeof window === 'undefined') return 0
const content = this.stackElement || this.$refs.content
// Return current zindex if not active
const index = !this.isActive
? getZIndex(content)
: this.getMaxZIndex(this.stackExclude || [content]) + 2
if (index == null) return index
// Return max current z-index (excluding self) + 2
// (2 to leave room for an overlay below, if needed)
return parseInt(index)
}
},
methods: {
getMaxZIndex (exclude: Element[] = []) {
const base = this.$el
// Start with lowest allowed z-index or z-index of
// base component's element, whichever is greater
const zis = [this.stackMinZIndex, getZIndex(base)]
// Convert the NodeList to an array to
// prevent an Edge bug with Symbol.iterator
// https://github.com/vuetifyjs/vuetify/issues/2146
const activeElements = [...document.getElementsByClassName(this.stackClass)]
// Get z-index for all active dialogs
for (let index = 0; index < activeElements.length; index++) {
if (!exclude.includes(activeElements[index])) {
zis.push(getZIndex(activeElements[index]))
}
}
return Math.max(...zis)
}
}
})
| Phlow2001/vuetify-packages/vuetify/src/mixins/stackable.ts |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jena.web;
import org.apache.jena.graph.Graph ;
import org.apache.jena.graph.NodeFactory ;
import org.apache.jena.query.DatasetAccessor ;
import org.apache.jena.rdf.model.Model ;
import org.apache.jena.rdf.model.ModelFactory ;
/** Adapter between Dataset/Model level and DatasetGraph/Graph level */
public class DatasetAdapter implements DatasetAccessor
{
private final DatasetGraphAccessor updater ;
public DatasetAdapter(DatasetGraphAccessor updater) { this.updater = updater ; }
/** Get the default model of a Dataset */
@Override
public Model getModel()
{
Graph g = updater.httpGet() ;
return ModelFactory.createModelForGraph(g) ;
}
/** Get a named model of a Dataset */
@Override
public Model getModel(String graphUri)
{
Graph g = updater.httpGet(NodeFactory.createURI(graphUri)) ;
if ( g == null )
return null ;
return ModelFactory.createModelForGraph(g) ;
}
@Override
public boolean containsModel(String graphUri)
{
return updater.httpHead(NodeFactory.createURI(graphUri)) ;
}
/** Put (replace) the default model of a Dataset */
@Override
public void putModel(Model data)
{
updater.httpPut(data.getGraph()) ;
}
/** Put (create/replace) a named model of a Dataset */
@Override
public void putModel(String graphUri, Model data)
{
updater.httpPut(NodeFactory.createURI(graphUri), data.getGraph()) ;
}
/** Delete (which means clear) the default model of a Dataset */
@Override
public void deleteDefault()
{
updater.httpDelete() ;
}
/** Delete a named model of a Dataset */
@Override
public void deleteModel(String graphUri)
{
updater.httpDelete(NodeFactory.createURI(graphUri)) ;
}
/** Add statements to the default model of a Dataset */
@Override
public void add(Model data)
{
updater.httpPost(data.getGraph()) ;
}
/** Add statements to a named model of a Dataset */
@Override
public void add(String graphUri, Model data)
{
updater.httpPost(NodeFactory.createURI(graphUri), data.getGraph()) ;
}
}
| samaitra/jena-jena-arq/src/main/java/org/apache/jena/web/DatasetAdapter.java |
from django.db import models
# Create your models here.
MEASUREMENT = (
('c', 'cups'),
('tsp', 'teaspoons'),
('tbsp', 'tablespoons'),
('item', 'item'),
)
class Step(models.Model):
"""A step in a recipe"""
order = models.IntegerField()
directions = models.TextField()
recipe = models.ForeignKey('Recipe')
class Tag(models.Model):
"""A tag to identify a recipe"""
name = models.CharField(max_length=50)
recipes = models.ManyToManyField('Recipe')
def __str__(self):
return self.name
class RecipeIngredient(models.Model):
ingredient = models.ForeignKey('Ingredient')
recipe = models.ForeignKey('Recipe')
quantity = models.FloatField()
unit = models.CharField(choices=MEASUREMENT, max_length=10)
description = models.CharField(max_length=100)
notes = models.TextField()
class Ingredient(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
class Recipe(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
| creffett/reffipe-reffipe/website/models.py |
Proof of Lemma 6.1
Let \(||.||\) be the usual Euclidean norm, and \(\langle.\rangle\) its associated scalar product. We have that
\[\rho(UV(S))=\max_{x,||x||=1}\langle UV(S)x,x\rangle.\]
Let \(k\in[K]\),
\[\langle UV(S)e_{k},e_{k}\rangle=\sum_{l=1}^{n}(1-\mu^{LR}(l,S))u_{lk}v_{lk} \leq\frac{1}{n}\sum_{l=1}^{n}(1-\mu^{LR}(l,S)),\]
\[\leq\frac{1}{n}\left(n-|S|+\sum_{l\in S}(1-e^{-\alpha\sum_{k\in[K]}u_{lk}V_{k} (S)})\right),\]
where the first inequality follows from the assumption made above on the coefficients \(u_{lk}v_{lk}\). Furthermore, since \(\alpha\leq\log n\),
\[e^{-\alpha\sum_{k\in[K]}u_{lk}V_{k}(S)}\geq e^{-\alpha\sum_{k\in[K]}u_{lk} \sum_{j\in N_{+}}v_{jk}}=e^{-\alpha}\geq\frac{1}{n}.\]
Hence
\[\langle UV(S)e_{k},e_{k}\rangle\leq\frac{1}{n}\left(n-|S|+|S|\left(1-\frac{1} {n}\right)\right)=1-\frac{|S|}{n^{2}}\leq 1-\frac{1}{n^{2}}.\]The inequality holds for all \(e_{i},i\in[n]\), and therefore \(\forall x\in\mathds{R}^{K}\) such that \(||x||=1\). Hence,
\[\rho(UV(S))\leq 1-\frac{1}{n^{2}}.\]
### Proof of Lemma 6.2
Let \(S\in N\) be the chosen subset of products, and let \(i\in S\). We recall from Section 3.1, that
\[\pi(i,S)=\lambda^{T}\left(I_{n}-Diag((1-\mu(i,S)))\rho(N,N)\right)^{-1}\Pi(S)e _{i}. \tag{10}\]
This result still holds as the Generalized Multinomial Logit model with Low rank matrix has the same assumptions as the one needed to get this result. However, there is some difference with the assumptions made in Section 4. On the contrary of the Generalized Markov chain model presented in Section 4, we now have that
\[\mu^{LR}(i,S)=e^{-\alpha\times\left(\sum_{k\in[K]}u_{ik}V_{k}(S)\right)}\]
and
\[\rho(N,N)=\sum_{k\in[K]}\mathbf{u}_{k}\mathbf{v}_{k}^{T},\]
where \(\mathbf{v}_{k}=(v_{1k},...,v_{nk})\). Therefore we have to compute the coefficients of the matrix
\[\left(I_{n}-Diag((1-\mu^{LR}(i,S)))\rho(N,N)\right)^{-1}\]
under this new model. We know that
\[\left(I_{n}-Diag((1-\mu^{LR}(i,S)))\rho(N,N)\right)^{-1}=\sum_{l=0}^{\infty} \left(Diag((1-\mu^{LR}(i,S)))\rho(N,N)\right)^{l}. \tag{11}\]
We use the following notations:
* let \(M:=Diag((1-\mu^{LR}(i,S)))\rho(N,N)=\left((1-\mu^{LR}(i,S))\rho_{ij}\right)_{ i,j\in[n]}\),
* let \(UV(S)=\left(\sum_{l=1}^{n}(1-\mu^{LR}(l,S))u_{lk}v_{lm}\right)_{k,m\in[K]}\),* for \(l\in\mathds{N}\), we note \(\left(UV(S)^{l}\right)_{k^{\prime}k}\) the coefficient of indices \(k^{\prime},k\) of the matrix \(UV(S)^{l}\), ie of the matrix \(UV(S)\) elevated to the power of \(l\).
First, we show by induction that
\[\forall l\geq 1\quad M^{l}=\left((1-\mu^{LR}(i,S))\sum_{k,k^{\prime}\in[K]}u_{ ik}v_{jk^{\prime}}\left(UV(S)^{l-1}\right)_{k^{\prime}k}\right)_{i\in[n],j\in N _{+}}\]
**Initiation** For \(l=1\), we use the definition of \(M\) and \(\rho(N,N)\)
\[M=\left((1-\mu^{LR}(i,S))\rho_{ij}\right)_{i,j\in[n]}=\left((1-\mu^{LR}(i,S)) \sum_{k\in[K]}u_{ik}v_{jk}\right)_{i,j\in[n]}.\]
Since \(UV(S)^{0}=I_{K}\), we have that \((UV(S)^{0})_{k^{\prime}k}=\mathds{1}_{k^{\prime}=k}\). Therefore
\[M=\left((1-\mu^{LR}(i,S))\sum_{k,k^{\prime}\in[K]}u_{ik}v_{jk^{\prime}}\left( UV(S)^{0}\right)_{k^{\prime}k}\right)_{i,j\in[n]}.\]
The result holds for \(l=1\).
**Inductive step** Suppose that the result holds for a certain \(l\in\mathds{N}^{*}\). We compute the coefficient of indices \(i,j\) of \(M^{l+1}\):
\[\left(M^{l+1}\right)_{ij}=\sum_{q=1}^{n}\left(M^{l}\right)_{iq}(1-\mu^{LR}(q,S ))\rho_{qj}\]
Using the induction hypothesis,
\[\left(M^{l+1}\right)_{ij} =\sum_{q=1}^{n}\left((1-\mu^{LR}(i,S))\sum_{k,k^{\prime}\in[K]}u_ {ik}v_{qk^{\prime}}\left(UV(S)^{l-1}\right)_{k^{\prime}k}\right)(1-\mu^{LR}(q,S))\sum_{k^{\prime\prime}\in[K]}u_{qk^{\prime\prime}}v_{jk^{\prime\prime}}\] \[=(1-\mu^{LR}(i,S))\sum_{k,k^{\prime\prime}\in[K]}u_{ik}v_{jk^{ \prime\prime}}\sum_{k^{\prime}\in[K]}(UV(S))_{k^{\prime\prime}k^{\prime}} \left(UV(S)^{l-1}\right)_{k^{\prime}k}\] \[=(1-\mu^{LR}(i,S))\sum_{k,k^{\prime\prime}\in[K]}u_{ik}v_{jk^{ \prime\prime}}\left(UV(S)^{l}\right)_{k^{\prime\prime}k}.\]
[MISSING_PAGE_FAIL:42]
Since \(\mu^{LR}(j,S)=0,\forall j\notin S\), after reorganizing the terms, we can rewrite this as
\[R^{LR}(S)= \sum_{i\in[n]}\lambda_{i}(1-\mu^{LR}(i,S))\sum_{k,k^{\prime}=1}^{K}u _{ik}(I-UV(S))_{k^{\prime}k}^{-1}\left(\sum_{l\in S}v_{lk^{\prime}}\mu^{LR}(l,S) p_{l}\right)\] \[+\sum_{i\in S}\lambda_{i}\mu^{LR}(i,S)p_{i}.\]
Finally, writing the sum over \(k,k^{\prime}\) in matrix form and using the notation \(\mathbf{u}_{i}=\{u_{ik}\}_{k=1}^{K}\) and \(\mathbf{v}_{j}=\{v_{jk}\}_{k=1}^{K}\), we get
\[R^{LR}(S)=\sum_{i\in[n]}\lambda_{i}(1-\mu^{LR}(i,S))\left(\sum_{j\in S}p_{j} \mu^{LR}(j,S)\mathbf{u}_{i}^{T}[I-UV(S)]^{-1}\mathbf{v}_{j}\right)+\sum_{i\in S }\lambda_{i}\mu^{LR}(i,S)p_{i},\]
which concludes the proof. | 1911.06716v4.mmd |
module ShouldaPaginationMacros
# Example:
# context "a GET to index logged in as admin" do
# setup do
# login_as_admin
# get :index
# end
# should_paginate_collection :users
# should_display_pagination
# end
def self.should_paginate_collection(collection_name)
should "paginate #{collection_name}" do
assert collection = assigns(collection_name),
"Controller isn't assigning to @#{collection_name.to_s}."
assert_kind_of WillPaginate::Collection, collection,
"@#{collection_name.to_s} isn't a WillPaginate collection."
end
end
def self.should_display_pagination
should "display pagination" do
assert_select "div.pagination", { :minimum => 1 },
"View isn't displaying pagination. Add <%= will_paginate @collection %>."
end
end
# Example:
# context "a GET to index not logged in as admin" do
# setup { get :index }
# should_not_paginate_collection :users
# should_not_display_pagination
# end
def self.should_not_paginate_collection(collection_name)
should "not paginate #{collection_name}" do
assert collection = assigns(collection_name),
"Controller isn't assigning to @#{collection_name.to_s}."
assert_not_equal WillPaginate::Collection, collection.class,
"@#{collection_name.to_s} is a WillPaginate collection."
end
end
def self.should_not_display_pagination
should "not display pagination" do
assert_select "div.pagination", { :count => 0 },
"View is displaying pagination. Check your logic."
end
end
end
class ActiveSupport::TestCase
extend ShouldaPaginationMacros
end | jbasdf/overlord-test/rails_test/test/shoulda_macros/pagination.rb |
/*
* Copyright (c) International Business Machines Corp., 2006
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Author: Artem B. Bityutskiy
*
* UBI (Unsorted Block Images) library.
*/
#ifndef __LIBUBI_INT_H__
#define __LIBUBI_INT_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
* UBI heavily makes use of the sysfs file system to interact with users-pace.
* The below are pre-define UBI file and directory names.
*/
#define SYSFS_UBI "class/ubi"
#define UBI_DEV_NAME_PATT "ubi%d"
#define UBI_VER "version"
#define DEV_DEV "dev"
#define UBI_VOL_NAME_PATT "ubi%d_%d"
#define DEV_AVAIL_EBS "avail_eraseblocks"
#define DEV_TOTAL_EBS "total_eraseblocks"
#define DEV_BAD_COUNT "bad_peb_count"
#define DEV_EB_SIZE "eraseblock_size"
#define DEV_MAX_EC "max_ec"
#define DEV_MAX_RSVD "reserved_for_bad"
#define DEV_MAX_VOLS "max_vol_count"
#define DEV_MIN_IO_SIZE "min_io_size"
#define VOL_TYPE "type"
#define VOL_DEV "dev"
#define VOL_ALIGNMENT "alignment"
#define VOL_DATA_BYTES "data_bytes"
#define VOL_RSVD_EBS "reserved_ebs"
#define VOL_EB_SIZE "usable_eb_size"
#define VOL_CORRUPTED "corrupted"
#define VOL_NAME "name"
/**
* libubi - UBI library description data structure.
*
* @sysfs sysfs file system path
* @sysfs_ubi UBI directory in sysfs
* @ubi_dev UBI device sysfs directory pattern
* @ubi_version UBI version file sysfs path
* @dev_dev UBI device's major/minor numbers file pattern
* @dev_avail_ebs count of available eraseblocks sysfs path pattern
* @dev_total_ebs total eraseblocks count sysfs path pattern
* @dev_bad_count count of bad eraseblocks sysfs path pattern
* @dev_eb_size size of UBI device's eraseblocks sysfs path pattern
* @dev_max_ec maximum erase counter sysfs path pattern
* @dev_bad_rsvd count of physical eraseblock reserved for bad eraseblocks
* handling
* @dev_max_vols maximum volumes number count sysfs path pattern
* @dev_min_io_size minimum I/O unit size sysfs path pattern
* @ubi_vol UBI volume sysfs directory pattern
* @vol_type volume type sysfs path pattern
* @vol_dev volume's major/minor numbers file pattern
* @vol_alignment volume alignment sysfs path pattern
* @vol_data_bytes volume data size sysfs path pattern
* @vol_rsvd_ebs volume reserved size sysfs path pattern
* @vol_eb_size volume eraseblock size sysfs path pattern
* @vol_corrupted volume corruption flag sysfs path pattern
* @vol_name volume name sysfs path pattern
*/
struct libubi
{
char *sysfs;
char *sysfs_ubi;
char *ubi_dev;
char *ubi_version;
char *dev_dev;
char *dev_avail_ebs;
char *dev_total_ebs;
char *dev_bad_count;
char *dev_eb_size;
char *dev_max_ec;
char *dev_bad_rsvd;
char *dev_max_vols;
char *dev_min_io_size;
char *ubi_vol;
char *vol_type;
char *vol_dev;
char *vol_alignment;
char *vol_data_bytes;
char *vol_rsvd_ebs;
char *vol_eb_size;
char *vol_corrupted;
char *vol_name;
char *vol_max_count;
};
static int read_int(const char *file, int *value);
static int dev_read_int(const char *patt, int dev_num, int *value);
static int dev_read_ll(const char *patt, int dev_num, long long *value);
static int dev_read_data(const char *patt, int dev_num, void *buf, int buf_len);
static int vol_read_int(const char *patt, int dev_num, int vol_id, int *value);
static int vol_read_ll(const char *patt, int dev_num, int vol_id,
long long *value);
static int vol_read_data(const char *patt, int dev_num, int vol_id, void *buf,
int buf_len);
static char *mkpath(const char *path, const char *name);
static int find_dev_num(struct libubi *lib, const char *node);
static int find_dev_num_vol(struct libubi *lib, const char *node);
static int find_vol_num(struct libubi *lib, int dev_num, const char *node);
#ifdef __cplusplus
}
#endif
#endif /* !__LIBUBI_INT_H__ */
| atmark-techno/atmark-dist-user/mtd-utils/ubi-utils/src/libubi_int.h |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with this
# work for additional information regarding copyright ownership. The ASF
# licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
module Buildr #:nodoc:
module Shell #:nodoc:
class BeanShell < Base
include Buildr::JRebel
VERSION = '2.0b4'
specify :name => :bsh, :languages => [:java]
class << self
def version
Buildr.settings.build['bsh'] || VERSION
end
def artifact
"org.beanshell:bsh:jar:#{version}"
end
end
def launch(task)
cp = ( project.compile.dependencies +
[project.path_to(:target, :classes), Buildr.artifact(BeanShell.artifact)] +
task.classpath )
Java::Commands.java 'bsh.Console', {
:properties => jrebel_props(project).merge(task.properties),
:classpath => cp,
:java_args => jrebel_args + task.java_args
}
end
end # BeanShell
class JIRB < Base
include JRebel
JRUBY_VERSION = '1.6.2'
def launch(task)
if jruby_home # if JRuby is installed, use it
cp = project.compile.dependencies +
[project.path_to(:target, :classes)] +
Dir.glob("#{jruby_home}#{File::SEPARATOR}lib#{File::SEPARATOR}*.jar") +
task.classpath
props = {
'jruby.home' => jruby_home,
'jruby.lib' => "#{jruby_home}#{File::SEPARATOR}lib"
}
props.merge! jrebel_props(project)
props.merge! task.properties
unless Util.win_os?
uname = `uname -m`
cpu = if uname =~ /i[34567]86/
'i386'
elsif uname == 'i86pc'
'x86'
elsif uname =~ /amd64|x86_64/
'amd64'
end
os = `uname -s | tr '[A-Z]' '[a-z]'`
path = if os == 'darwin'
'darwin'
else
"#{os}-#{cpu}"
end
props['jna.boot.library.path'] = "#{jruby_home}/lib/native/#{path}"
end
props['jruby.script'] = if Util.win_os? then 'jruby.bat' else 'jruby' end
props['jruby.shell'] = if Util.win_os? then 'cmd.exe' else '/bin/sh' end
args = [
"-Xbootclasspath/a:#{Dir.glob("#{jruby_home}#{File::SEPARATOR}lib#{File::SEPARATOR}jruby*.jar").join File::PATH_SEPARATOR}"
] + jrebel_args + task.java_args
Java::Commands.java 'org.jruby.Main', "#{jruby_home}#{File::SEPARATOR}bin#{File::SEPARATOR}jirb", {
:properties => props,
:classpath => cp,
:java_args => args
}
else
cp = project.compile.dependencies + [ jruby_artifact, project.path_to(:target, :classes) ] +
task.classpath
props = jrebel_props(project).merge(task.properties)
args = jrebel_args + task.java_args
Java::Commands.java 'org.jruby.Main', '--command', 'irb', {
:properties => props,
:classpath => cp,
:java_args => args
}
end
end
private
def jruby_home
@jruby_home ||= RUBY_PLATFORM =~ /java/ ? RbConfig::CONFIG['prefix'] : ENV['JRUBY_HOME']
end
def jruby_artifact
version = Buildr.settings.build['jruby'] || JRUBY_VERSION
"org.jruby:jruby-complete:jar:#{version}"
end
end
end
end
Buildr::Shell.providers << Buildr::Shell::BeanShell
Buildr::Shell.providers << Buildr::Shell::JIRB
| tomwscott/GoCD-tools/jruby-1.7.11/lib/ruby/gems/shared/gems/buildr-1.4.22-java/lib/buildr/core/shell.rb |
var expect = require('chai').expect
, setup = require('../../../../setup')
, teardown = require('../../../../teardown')
, create = require('jsr-client')
, Constants = require('jsr-constants')
, OK = Constants.OK.toString()
, client;
describe('jsr-server (tcp):', function() {
before(function(done) {
setup(function() {
client = create();
client.once('connect', done);
})
});
after(teardown);
it('should reply with byte length (setrange)', function(done) {
var k = 'foo'
, v = 'hello world';
client.set(k, v, function onReply(err, reply) {
expect(err).to.eql(null);
expect(reply).to.eql(OK);
client.setrange(k, 6, 'redis', function onReply(err, reply) {
expect(err).to.eql(null);
expect(reply).to.eql(11);
client.get(k, function onReply(err, reply) {
expect(err).to.eql(null);
expect(reply).to.eql('hello redis');
done();
});
});
});
});
});
| freeformsystems/jsr-server-test/spec/tcp/database/string/setrange.js |
const mod = require("./module")
module.exports = {
installMsaModule: async itf => {
await require("./install")(itf)
},
startMsaModule: () => new mod.MsaSheet(""),
...mod
} | mysimpleapp/msa-sheet-index.js |
/* Generated by CIL v. 1.7.0 */
/* print_CIL_Input is false */
struct _IO_FILE;
struct timeval;
extern float strtof(char const *str , char const *endptr ) ;
extern void signal(int sig , void *func ) ;
typedef struct _IO_FILE FILE;
extern int atoi(char const *s ) ;
extern double strtod(char const *str , char const *endptr ) ;
extern int fclose(void *stream ) ;
extern void *fopen(char const *filename , char const *mode ) ;
extern void abort() ;
extern void exit(int status ) ;
extern int raise(int sig ) ;
extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ;
extern int strcmp(char const *a , char const *b ) ;
extern int rand() ;
extern unsigned long strtoul(char const *str , char const *endptr , int base ) ;
void RandomFunc(unsigned char input[1] , unsigned char output[1] ) ;
extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ;
extern int gettimeofday(struct timeval *tv , void *tz , ...) ;
extern int printf(char const *format , ...) ;
int main(int argc , char *argv[] ) ;
void megaInit(void) ;
extern unsigned long strlen(char const *s ) ;
extern long strtol(char const *str , char const *endptr , int base ) ;
extern unsigned long strnlen(char const *s , unsigned long maxlen ) ;
extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ;
struct timeval {
long tv_sec ;
long tv_usec ;
};
extern void *malloc(unsigned long size ) ;
extern int scanf(char const *format , ...) ;
void RandomFunc(unsigned char input[1] , unsigned char output[1] )
{
unsigned char state[1] ;
unsigned char local1 ;
{
state[0UL] = input[0UL] ^ (unsigned char)219;
local1 = 0UL;
while (local1 < (unsigned char)0) {
state[local1] = state[0UL] << (((state[0UL] >> (unsigned char)1) & (unsigned char)7) | 1UL);
local1 += 2UL;
}
output[0UL] = (state[0UL] | 214125455UL) | (unsigned char)221;
}
}
void megaInit(void)
{
{
}
}
int main(int argc , char *argv[] )
{
unsigned char input[1] ;
unsigned char output[1] ;
int randomFuns_i5 ;
unsigned char randomFuns_value6 ;
int randomFuns_main_i7 ;
{
megaInit();
if (argc != 2) {
printf("Call this program with %i arguments\n", 1);
exit(-1);
} else {
}
randomFuns_i5 = 0;
while (randomFuns_i5 < 1) {
randomFuns_value6 = (unsigned char )strtoul(argv[randomFuns_i5 + 1], 0, 10);
input[randomFuns_i5] = randomFuns_value6;
randomFuns_i5 ++;
}
RandomFunc(input, output);
if (output[0] == 255) {
printf("You win!\n");
} else {
}
randomFuns_main_i7 = 0;
while (randomFuns_main_i7 < 1) {
printf("%u\n", output[randomFuns_main_i7]);
randomFuns_main_i7 ++;
}
}
}
| tum-i22/obfuscated-programs-tigress-generated-programs/empty-Seed2-RandomFuns-Type_char-ControlStructures_8-BB1-ForBound_boundedInput-Operators_Shiftlt_Shiftrt_Lt_Gt_Le_Ge_Eq_Ne_BAnd_BXor_BOr.c |
5 способов стать умнее.: biboroda — LiveJournal
", "url": "https://biboroda.livejournal.com/6148394.html", "image": { "@type": "ImageObject", "url": "https://pp.vk.me/c543103/v543103112/5f8e/NWvGcpdeSE0.jpg" }, "author": { "@type": "Person", "name": "Анатолій Андросюк, Всем Взаимофренд !", "image": "https://l-userpic.livejournal.com/120627946/42794268" }, "publisher": { "@type": "Organization", "name": "Journal biboroda", "logo": { "@type": "ImageObject", "url": "https://biboroda.livejournal.com", "contentUrl": "https://l-userpic.livejournal.com/120627946/42794268" } } } | c4-be |
## Wednesday, 3 December 2014
### introducing pick-elt
So, we are slowly trying to work towards what humans do. eg, the plurals, the easy definition of close relatives and so on. Today, random greetings. Makes use of merge-labels() and pick-elt. First, let's introduce pick-elt.
The definition of pick-elt is simply, given a superposition randomly return a ket in that superposition. Currently it is unweighted. ie, there is no bias in choice of ket. It is probably useful later to define a weighted pick-elt.
Anyway, a pick-elt example:
sa: pick-elt (|a> + |b> + |c> + |d> + |e> + |f> + |g> + |h>)
|e>
where dot "." in the console means repeat last computation.
sa: .
|a>
sa: .
|c>
sa: .
|h>
sa: .
|g>
So that should be clear enough. Each time it randomly picks kets.
I guess I should also note that it preserves coeffs:
sa: pick-elt (10|a> + 3.141592|pi> + |fred> + 7|cats>)
7.000|cats>
sa: .
7.000|cats>
sa: .
10.000|a>
sa: .
7.000|cats>
sa: .
3.142|pi>
And I suppose you could say pick-elt has a little similarity with the idea of wave-function collapse in QM. Just a little. Indeed, for the QM case you would need a weighted-pick-elt.
eg, Schrodinger's cat in BKO might look like:
sa: is-alive |cat> #=> normalize pick-elt (0.5|yes> + 0.5|no>)
-- ask if the cat is alive?
sa: is-alive |cat>
|no>
sa: .
|no>
sa: .
|yes>
where "normalize" sets the sum of the coeffs of the superposition it is applied to to 1.
eg:
sa: normalize (3|a> + 10|b> + |c>)
0.214|a> + 0.714|b> + 0.071|c>
And that's about it for pick-elt. Very useful all over the place. | finemath-3plus |
var {
GraphQLSchema,
GraphQLObjectType,
GraphQLString,
GraphQLList,
GraphQLInt,
GraphQLBoolean,
GraphQLUnionType,
GraphQLFloat
} = require('graphql');
var {
mediaType
} = require('./mediaSchema.js');
const tagDataType = new GraphQLObjectType({
name: "tagData",
description: "json structure for Tag Data Type",
fields: ()=> ({
media_count: {type: GraphQLInt},
name: {type: GraphQLString}
})
})
const tagNameType = new GraphQLObjectType({
name: "tagName",
description: "json structure for Tag Name Type",
fields: ()=> ({
data: {type: tagDataType}
})
})
const tagMediaRecentType = new GraphQLObjectType({
name: "mediaRecent",
description: "json structure for Media Recent Type",
fields: ()=> ({
data: {type: new GraphQLList(mediaType)}
})
})
const tagSearchType = new GraphQLObjectType({
name: "tagSearch",
description: "json structure for Tag Search Type",
fields: ()=> ({
data: {type: new GraphQLList(tagDataType)}
})
})
module.exports = {
tagNameType,
tagMediaRecentType,
tagSearchType
}
| longshuicy/custom-graphiql-bind-graphql-data/schema/instagramSchema/tagsSchema.js |
/***************************************************************************
This file is part of the CheeseTronic Music Tools
url : http://reduz.com.ar/cheesetronic
copyright : (C) 2003 by Juan Linietsky
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
//
//
// C++ Interface: selection
//
// Description:
//
//
// Author: Juan Linietsky <[email protected]>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef SELECTION_H_
#define SELECTION_H_
class Selection {
bool active;
int point_1;
int point_2;
int max;
public:
void set_point_1(int p_idx);
void set_point_2(int p_idx);
void set_active(bool p_active);
void set_max(int p_max);
int get_point_1();
int get_point_2();
int get_begin();
int get_end();
int get_size();
bool is_in_range(int p_idx);
bool is_active();
void clear();
Selection();
};
#endif /* selection.h */
| reduz/chibitracker-tracker/selection.h |
You are here: Home > Talent Exam
All posts from
Organisation : FIITJEE
Exam Name : Big Bang Edge Test
Year : 2023
Website : https://bigbangedge.com/samplepaper.php
Contents :
Big Bang Edge Test Sample Paper
FIITJEE Big Bang Edge Test – 2023 for students presently in Class V (going to VI) (Paper 1) SAMPLE PAPER
Time: 3 Hours (9:30 am – 12:30 pm)
Maximum Marks: 240
Recommended Time: 35 Minutes for Section – I
Section – I : APTITUDE TEST
This section contains 18 Multiple Choice Questions number 1 to 18. Each question has 4 choices (A), (B), (C) and (D), out of which ONLY ONE is correct.
1. Select the correct alternative from the given choices.
12, 36, 150, 392, 1452, __
(A) 2452
(B) 2197
(C) 2246
(D) 2366
2. Select the correct alternative from the given choices.
49, 1625, 3649, 6481, __
(A) 81100
(B) 100144
(C) 100121
(D) 121169
3. Select the correct alternative from the given choices.
4, 18, 100, 294, __
(A) 1000
(B) 1100
(C) 1210
(D) 1452
4. Select the correct alternative from the given choices.
3, 35, 99, 195, __, 483
(A) 343
(B) 371
(C) 353
(D) 323
5. Arrange the given words in alphabetical order and tick the one that comes last:
(A) abandon
(B) actuate
(C) accumulate
(D) acquit
6. Arrange the given words in alphabetical order and tick the one that comes at the second place:
(A) music
(B) mint
(C) mink
(D) murder
7. If a meaningful word can be formed by re-arranging the letters USCALA; the last letter of the word so formed is the answer. Which one is that?
(A) C
(B) S
(C) A
(D) L
8. Look at this series: 2, 1, (1/2), (1/4), … What number should come next?
(A) (1/3)
(B) (1/8)
(C) (2/8)
(D) (1/16)
9. Look at this series: 7, 10, 8, 11, 9, 12, … What number should come next?
(A) 7
(B) 10
(C) 12
(D) 13
10. Look at this series: 36, 34, 30, 28, 24, … What number should come next?
(A) 20
(B) 22
(C) 23
(D) 26
11. Look at this series: 3, 4, 7, 8, 11, 12, … What number should come next?
(A) 7
(B) 10
(C) 14
(D) 15
Scheme of Examination for Big Bang Edge Test
Time: 3 Hours (9:30 am – 12:30 pm)
Maximum Marks: 240
Instructions:
Caution: Class, Paper, Code as given above MUST be correctly marked on the answer OMR sheet before attempting the paper. Wrong Class, Paper or Code will give wrong results.
1. You are advised to devote 35 Minutes on Section-I, 35 Minutes on Section-II, 50 Minutes on Section-III, 30 Minutes on Section-IV and 30 Minutes on Section-V.
2. This Question paper consists of 5 sections. Marking scheme is given in table below:
Section | Subject | Question no. | Marking Scheme for each question
SECTION – I
APTITUDE TEST
1 to 12 +3 0
13 to 18 +4 0
SECTION – II
PHYSICS (PART-A) 19 to 22 +2 0
CHEMISTRY (PART-B) 23 to 26 +2 0
MATHEMATICS (PART-C) 27 to 31 +2 0
BIOLOGY (PART-D) 32 to 36 +2 0
SECTION – III
PHYSICS (PART-A) 37 to 48 +1.5 0
CHEMISTRY (PART-B) 49 to 60 +1.5 0
MATHEMATICS (PART-C) 61 to 72 +1.5 0
BIOLOGY (PART-D) 73 to 84 +1.5 0
SECTION – IV
PHYSICS (PART-A) 85 to 88 +3 0
CHEMISTRY (PART-B) 89 to 92 +3 0
BIOLOGY (PART-C) 93 to 96 +3 0
SECTION – V
MATHEMATICS (PART-A) 97 to 102 +3 0
MATHEMATICS (PART-B) 103 to 108 +3 0
3. Answers have to be marked on the OMR sheet. The Question Paper contains blank spaces for your rough work. No additional sheets will be provided for rough work.
4. Blank papers, clip boards, log tables, slide rule, calculator, cellular phones, pagers and electronic devices, in any form, are not allowed.
5. Before attempting paper write your OMR Answer Sheet No., Registration Number, Name and Test Centre in the space provided at the bottom of this sheet.
6. See method of marking of bubbles at the back of cover page for question no. 103 to 108.
Note: Please check this Question Paper contains all 108 questions in serial order. If not so, exchange for the correct Question Paper.
Syllabus For Big Bang Edge Test
For Class V Students (going to Class VI in 2024)
GENERAL SCIENCE :
PHYSICS
1. Measurement
2. Force and Energy
3. Simple Machine
CHEMISTRY
1. Solids, Liquids and Gases
2. Rocks and Minerals
3. Natural Calamities
BIOLOGY
1. Food & Health
2. Plant – Growth & Structure
3. Animal – Habitat & Adaptation
MATHEMATICS :
1. Multiples and Factors
2. Fractions and Decimals
3. Averages
4. Profit and Loss
5. Percentage
6. Triangle
The Test intends to check the general awareness of the student at Class – V level. | finemath-3plus |
Jak používáte kapesní počítač? (výsledky ankety) – MobilMania.cz
Jak používáte kapesní počítač? (výsledky ankety)
Michal Hron 17. února 2004
článek Recenze hry pro N-Gage: Tom Clancy`s Splinter Cell SDÍLET NA FACEBOOKU TWEETNOUT
Přibližně před týdnem jsem inicioval ve fóru anketu na téma "Kolik z vás používá PDA". Jelikož mi psali nejen autoři příspěvků, abych celou anketu nezapomněl vyhodnotit, udělal jsem malý přehled zjištěných informací.
Nečekaná úspěšnost
Celá anketa byla nad mé očekávání úspěšná a alespoň částečně jsem získal přehled o používání PDA. Právě tyto informace mi na českém internetu chyběly. Z ankety například vyplývá, kolik z celkových 69 respondentů používá své PDA nejen jako pracovní nástroj, ale i jako multimediální přístroj pro zábavu. Tento poměr se pohybuje kolem 70 % pro práci a 30 % pro zábavu.
Pocket PC nebo Palm?
Nejpodstatnější informací bezesporu zůstává používaný operační systém. V tomto případě se přiklonilo k Billovu monopolu 32 přispěvatelů, k PalmOS pak 24. Zastoupení měl samozřejmě i Symbian se svými čtyřmi hlasy a své místo si stále více dobývá i programátory tolik oblíbený Linux (2 hlasy). To je ale opravdu jen velice nepřesný popis celkového stavu trhu, pokud bychom totiž zaškatulkovali mezi PDA i chytré telefony typu Nokia 6600 či Siemens SX1, má Microsoft dalšího zdatného konkurenta v podobě Symbianu. K Symbianu bych ještě podotknul, že v anketě se vyskytl samozřejmě i Epoc zastoupený např. Psionem. Jelikož je ale Epoc duchovním otcem Symbianu, je započítán ve výsledku právě jako tento operační systém.
Zajímavým faktem je, proč uživatelé dávají přednost danému operačnímu systému. V tomto případě budeme porovnávat pouze dva největší rivaly - Palm OS s Windows Mobile. Zatímco zarytí palmisté nedají na svého miláčka dopustit, počet uživatelů Pocket PC se stále zvyšuje. Proč je tomu tak? Z došlých příspěvků jsme se mohli dočíst mnoho zajímavých názorů. Hlavní srovnání těchto dvou systémů lze vystihnout velmi krátce. Palm vítězí dostupností programových prostředků a ve většině případů i cenou. Oproti tomu ale není tak zažitý, což je nesporná výhoda Microsoftu. Sám velmi pochybuji o tom, že nezkušený uživatel sáhne spíše po Palmu než po Pocket PC.
I když se přístroje, které v sobě spojují několik funkčně rozdílných zařízení, těší stále větší oblibě, uživatelé PDA dávají nadále přednost samostatnému PDA. Toto řešení je pro ně přijatelnější než „all in one“ koncepce chytrých telefonů, která podle názoru mnohých z nich ořezává funkce samostatných zařízení. Za tento koncept se postavilo pouze 19 uživatelů oproti 48, kteří vyznávají samostatné přístroje.
Co jsme ještě zjistili
Většina uživatelů PDA z této ankety pochází ze zaměstnanecké sféry (38), hned za nimi se umístili studenti (většinou vysokoškolští) v počtu 17 respondentů a podnikatelé zde byli zastoupeni pouze šesti příspěvky. Používání PDA s sebou přináší samozřejmě možnost propojení s | c4-cs |
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2010 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.
*
* Special thanks to Steve Tramer for implementing this.
*/
#ifdef USE_TI_NETWORK
#import <Foundation/Foundation.h>
#import "TiProxy.h"
#import "TiNetworkTCPSocketProxy.h"
#import <Foundation/NSNetServices.h>
// NSNetService Delegate
@interface TiNetworkBonjourServiceProxy : TiProxy<NSNetServiceDelegate> {
TiNetworkTCPSocketProxy* socket;
NSNetService* service;
BOOL local;
BOOL published;
NSString* error;
NSCondition* connectCondition;
NSNetServiceBrowser* domainBrowser;
NSMutableArray* domains;
NSString* searchError;
BOOL searching;
NSCondition* searchCondition;
}
-(NSNetService*)service;
-(id)initWithContext:(id<TiEvaluator>)context_ service:(NSNetService*)service_ local:(bool)local_;
-(void)publish:(id)arg;
-(void)resolve:(id)args;
-(void)stop:(id)arg;
@property(readonly) TiNetworkTCPSocketProxy* socket;
@property(readonly, nonatomic) NSString* name;
@property(readonly, nonatomic) NSString* type;
@property(readonly, nonatomic) NSString* domain;
@property(readonly, nonatomic, getter=isLocal) NSNumber* local;
#pragma mark internal
-(void)searchDomains:(id)unused;
-(void)stopDomainSearch:(id)unused;
-(NSNumber*)isSearching:(id)unused;
+(NSString*)stringForErrorCode:(NSNetServicesError)code;
@end
#endif
| gianina-ingenuity/titanium-branch-deep-linking-testbed/x/mobilesdk/osx/5.5.1.GA/iphone/include/TiNetworkBonjourServiceProxy.h |
'use strict';
var expect = require('chai').expect;
var request = require('request');
var express = require('express');
var User = require('./userController.js');
describe('Controller: UserCtrl', function () {
beforeEach(function(){
// Expire any active token
// Delete cookies
});
it('Should should not allow an unidentifed user reach a privileged page', function(){
// checkAuth Test
});
it('Should add a new user to database', function(){
// Signup Test
});
it('It should give access to restricted pages', function(){
// Login Test
});
}); | FatalBadgers/FatalBadgers-server/user/userControllerSpec.js |
/*!
{
"name": "ES5 Strict Mode",
"property": "strictmode",
"caniuse": "sctrict-mode",
"notes": [{
"name": "ECMAScript 5.1 Language Specification",
"href": "http://www.ecma-international.org/ecma-262/5.1/"
}],
"authors": ["@kangax"],
"tags": ["es5"]
}
!*/
/* DOC
Check if browser implements ECMAScript 5 Object strict mode.
*/
define(['Modernizr'], function( Modernizr ) {
Modernizr.addTest('strictmode', (function(){'use strict'; return !this; })());
});
| glibey/drupal7-sites/all/libraries/modernizr/feature-detects/es5/strictmode.js |
/*
* Copyright 2008-2010 Digital Enterprise Research Institute (DERI)
*
* 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.sindice.rdfcommons.model;
/**
* Filter for triples of a triple set.
*
* @see TripleSet
* @author Michele Mostarda ( [email protected] )
* @version $Id$
*/
public interface TripleFilter {
/**
* Accepts a subject.
*
* @param triple triple to be accepted.
* @return <code>true</code> if accepted, <code>false</code> otherwise.
*/
boolean acceptTriple(Triple triple);
}
| Bilal84/rdf-commons-core/src/main/java/org/sindice/rdfcommons/model/TripleFilter.java |
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2015 - ROLI Ltd.
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Details of these licenses can be found at: www.gnu.org/licenses
JUCE 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.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information.
==============================================================================
*/
/**
A very minimal FFT class.
This is only a simple low-footprint implementation and isn't tuned for speed - it may
be useful for simple applications where one of the more complex FFT libraries would be
overkill. (But in the future it may end up becoming optimised of course...)
The FFT class itself contains lookup tables, so there's some overhead in creating
one, you should create and cache an FFT object for each size/direction of transform
that you need, and re-use them to perform the actual operation.
*/
class JUCE_API FFT
{
public:
/** Initialises an object for performing either a forward or inverse FFT with the given size.
The the number of points the FFT will operate on will be 2 ^ order.
*/
FFT (int order, bool isInverse);
/** Destructor. */
~FFT();
/** A complex number, for the purposes of the FFT class. */
struct Complex
{
float r; /**< Real part. */
float i; /**< Imaginary part. */
};
/** Performs an out-of-place FFT, either forward or inverse depending on the mode
that was passed to this object's constructor.
The arrays must contain at least getSize() elements.
*/
void perform (const Complex* input, Complex* output) const noexcept;
/** Performs an in-place forward transform on a block of real data.
The size of the array passed in must be 2 * getSize(), and the first half
should contain your raw input sample data. On return, the array will contain
complex frequency + phase data, and can be passed to performRealOnlyInverseTransform()
in order to convert it back to reals.
*/
void performRealOnlyForwardTransform (float* inputOutputData) const noexcept;
/** Performs a reverse operation to data created in performRealOnlyForwardTransform().
The size of the array passed in must be 2 * getSize(), containing complex
frequency and phase data. On return, the first half of the array will contain
the reconstituted samples.
*/
void performRealOnlyInverseTransform (float* inputOutputData) const noexcept;
/** Takes an array and simply transforms it to the frequency spectrum.
This may be handy for things like frequency displays or analysis.
*/
void performFrequencyOnlyForwardTransform (float* inputOutputData) const noexcept;
/** Returns the number of data points that this FFT was created to work with. */
int getSize() const noexcept { return size; }
private:
JUCE_PUBLIC_IN_DLL_BUILD (struct FFTConfig)
ScopedPointer<FFTConfig> config;
const int size;
void performRealOnlyForwardTransform (Complex*, float*) const noexcept;
void performRealOnlyInverseTransform (Complex*, float*) const noexcept;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FFT)
};
| the-synister/the-source-juce/modules/juce_audio_basics/effects/juce_FFT.h |
"""Add users to briefs
Revision ID: 510
Revises: 500
Create Date: 2016-01-25 17:08:03.550222
"""
# revision identifiers, used by Alembic.
revision = '510'
down_revision = '500'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table('brief_users',
sa.Column('brief_id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['brief_id'], ['briefs.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('brief_id', 'user_id')
)
def downgrade():
op.drop_table('brief_users')
| alphagov/digitalmarketplace-api-migrations/versions/510_add_users_to_briefs.py |
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var XmlElementNames_1 = require("../../Core/XmlElementNames");
var SearchFilter_RelationalFilter_1 = require("./SearchFilter.RelationalFilter");
/**
* Represents a search filter that checks if a property is not equal to a given value or other property.
*/
var IsNotEqualTo = (function (_super) {
__extends(IsNotEqualTo, _super);
function IsNotEqualTo(propertyDefinition, otherPropertyDefinitionOrValue) {
arguments.length === 0 ? _super.call(this) : _super.call(this, propertyDefinition, otherPropertyDefinitionOrValue);
}
/**
* @internal Gets the name of the XML element.
*
* @return {string} XML element name.
*/
IsNotEqualTo.prototype.GetXmlElementName = function () { return XmlElementNames_1.XmlElementNames.IsNotEqualTo; };
return IsNotEqualTo;
}(SearchFilter_RelationalFilter_1.RelationalFilter));
exports.IsNotEqualTo = IsNotEqualTo;
| eino-makitalo/ews-javascript-npmbuild-js/Search/Filters/SearchFilter.IsNotEqualTo.js |
version https://git-lfs.github.com/spec/v1
oid sha256:f0544709a150ef17481f4a481a24bc5ced3a4be870ffd9707c533f69dd4f1544
size 1665
| yogeshsaroya/new-cdnjs-ajax/libs/tinymce/3.5.8/plugins/advlink/langs/kl_dlg.js |
var loadImage = require('load-img')
var noop = function () {}
module.exports = svgToImage
function svgToImage (svg, opt, cb) {
if (typeof opt === 'function') {
cb = opt
opt = {}
}
cb = cb || noop
opt = opt || {}
if (typeof window === 'undefined') {
return bail('window global is undefined; not in a browser')
}
var DOMURL = getURL()
if (!DOMURL ||
typeof DOMURL.createObjectURL !== 'function' ||
typeof DOMURL.revokeObjectURL !== 'function') {
return bail('browser does not support URL.createObjectURL')
}
if (typeof window.Blob === 'undefined') {
return bail('browser does not support Blob constructor')
}
if (!Array.isArray(svg)) {
svg = [ svg ]
}
var blob
try {
blob = new window.Blob(svg, {
type: 'image/svg+xml;charset=utf-8'
})
} catch (e) {
return bail(e)
}
var url = DOMURL.createObjectURL(blob)
loadImage(url, opt, function (err, img) {
DOMURL.revokeObjectURL(url)
if (err) {
// try again for Safari 8.0, using simple encodeURIComponent
// this will fail with DOM content but at least it works with SVG
var url2 = 'data:image/svg+xml,' + encodeURIComponent(svg.join(''))
return loadImage(url2, opt, cb)
}
cb(err, img)
})
function bail (msg) {
process.nextTick(function () {
cb(new Error(msg))
})
}
}
function getURL () {
return window.URL ||
window.webkitURL ||
window.mozURL ||
window.msURL
}
| Jam3/svg-to-image-index.js |
'use strict' /* @flow */
import React from 'react'
import ReactCSS from 'reactcss'
import SliderSwatch from './SliderSwatch'
export class SliderSwatches extends ReactCSS.Component {
constructor() {
super()
this.handleClick = this.handleClick.bind(this)
}
classes(): any {
return {
'default': {
swatches: {
marginTop: '20px',
},
swatch: {
boxSizing: 'border-box',
width: '20%',
paddingRight: '1px',
float: 'left',
},
clear: {
clear: 'both',
},
},
}
}
handleClick(data: any) {
this.props.onClick(data)
}
render(): any {
return (
<div is="swatches">
<div is="swatch">
<SliderSwatch {...this.props} offset=".80" active={ Math.round(this.props.hsl.l * 100) / 100 == .80 && Math.round(this.props.hsl.s * 100) / 100 == .50 } onClick={ this.handleClick } first />
</div>
<div is="swatch">
<SliderSwatch {...this.props} offset=".65" active={ Math.round(this.props.hsl.l * 100) / 100 == .65 && Math.round(this.props.hsl.s * 100) / 100 == .50 } onClick={ this.handleClick } />
</div>
<div is="swatch">
<SliderSwatch {...this.props} offset=".50" active={ Math.round(this.props.hsl.l * 100) / 100 == .50 && Math.round(this.props.hsl.s * 100) / 100 == .50 } onClick={ this.handleClick } />
</div>
<div is="swatch">
<SliderSwatch {...this.props} offset=".35" active={ Math.round(this.props.hsl.l * 100) / 100 == .35 && Math.round(this.props.hsl.s * 100) / 100 == .50 } onClick={ this.handleClick } />
</div>
<div is="swatch">
<SliderSwatch {...this.props} offset=".20" active={ Math.round(this.props.hsl.l * 100) / 100 == .20 && Math.round(this.props.hsl.s * 100) / 100 == .50 } onClick={ this.handleClick } last />
</div>
<div is="clear" />
</div>
)
}
}
export default SliderSwatches
| JedWatson/react-color-src/components/slider/SliderSwatches.js |
set :stage, "production"
set :user, 'deployuser'
set :use_sudo, false
server '0.0.0.0', :app, :web, :db, :primary => true
## For multiple server setups
#
# server '0.0.0.0', :app, :web, :primary => true
# server '0.0.0.0', :app, :web
# # Don't push code to this server with 'cap deploy'
# server '0.0.0.0', :db, :no_release => true
# Site base directory
set :base_dir, "/var/local/www/example"
set :deploy_to, File.join(fetch(:base_dir))
# Webroot
set :current_dir, "httpdocs"
# Path to WordPress, supports WP at the root (empty string) and WordPress
# in a custom location (webroot/wp in our example).
set(:wp_path) { File.join(release_path, "wp") }
# Deploy strategy - use :remote_cache when possible, but some servers need :copy
#set :deploy_via, :copy
set :deploy_via, :remote_cache
# Specify a git branch to deploy
#
# Using fetch() here allows you to set your branch from the command line,
# but allows a default, "master" in this case.
#
# cap deploy -s branch=my-custom-branch
#
set :branch, fetch(:branch, "master")
#=============================================================================
# Files to link or copy into web root from capistrano's shared directory
# Symlinks are symlinked in
# wp_symlinks defaults to:
# "cache" => "wp-content/cache"
# "uploads" => "wp-content/uploads"
# "blogs.dir" => "wp-content/blogs.dir"
#
# To override, set the target to nil:
#
#set :wp_symlinks, [{
# "cache" => nil
#}]
#
# Or add other files:
#
#set :wp_symlinks, [{
# "authcache" => "wp-content/authcache"
#}]
#
# Configs are copied in, and default to:
# "db-config.php" => "/",
# "advanced-cache.php" => "wp-content/",
# "object-cache.php" => "wp-content/",
# "*.html" => "/",
#
# To override (like wp_symlinks):
#set :wp_configs, [{
#}]
#
# Stage-specific overrides are copied from the config directory,
# like production-example.txt or staging-example.txt
# Default list:
#
# "local-config.php" => "local-config.php",
# ".htaccess" => ".htaccess"
#
# To override or add other files (as above, but note no []):
#
#set :stage_specific_overrides, {
#}
| crowdfavorite/gem-capistrano-wp-lib/capistrano/templates/config/deploy/production.rb |
// This gives you default context menu (cut, copy, paste)
// in all input fields and textareas across your app.
(function () {
'use strict';
var remote = require('remote');
var Menu = remote.require('menu');
var MenuItem = remote.require('menu-item');
var cut = new MenuItem({
label: "Cut",
click: function () {
document.execCommand("cut");
}
});
var copy = new MenuItem({
label: "Copy",
click: function () {
document.execCommand("copy");
}
})
var paste = new MenuItem({
label: "Paste",
click: function () {
document.execCommand("paste");
}
});
var textMenu = new Menu();
textMenu.append(cut);
textMenu.append(copy);
textMenu.append(paste);
document.addEventListener('contextmenu', function(e) {
switch (e.target.nodeName) {
case 'TEXTAREA':
case 'INPUT':
e.preventDefault();
textMenu.popup(remote.getCurrentWindow());
break;
}
}, false);
}());
| arvindr21/slush-electron-templates/build/vendor/electron_boilerplate/context_menu.js |
package pl.stqa.pft.sandbox;
public class Point {
double x;
double y;
public Point(double x, double y) {
this.x = x;
this.y = y;
}
public double distance(Point p) {
return Math.sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y));
}
}
| Dolodosia/java_pft_daria-sandbox/src/main/java/pl/stqa/pft/sandbox/Point.java |
def is_palin(s):
'''returns True iff s is a palindrome'''
if len(s) <= 1:
return True
return s[0] == s[-1] and is_palin(s[1:-1])
| schmit/intro-python-course-lectures/code/rec_palindrome.py |
“…Həzrəti Məhəmməd peyğəmbərin zamanında olsaydı…” | Alpaninfo
Əsas səhifə Ailə-Sağlamlıq “…Həzrəti Məhəmməd peyğəmbərin zamanında olsaydı…”
Milli.Az xəbər verir ki, tanınmış kardioloq “Əsl tibbin 10 şifrəsi” adlı konfransda sağlam qidalanmanın sirlərindən danışıb. Karatay hesab edir ki, şirin sular və qazlı içkilər Həzrəti Məhəmməd peyğəmbərin zamanında olsaydı, onları haram məhsullar siyahısına daxil edərdi.
Canan Karatay ABŞ-da yaşayan dünyaca məşhur həkim Mehmet Özün “Yapon badımcanı möcüzədir” açıqlamasını tənqid edib və sözlərinə bunları əlavə edib: “Səhhətimizin durumu öz əlimizdədir. Çünki orqanizmin necə işlədiyini biləndə, problemləri həll edirik. ABŞ-da yaşayan məşhur ürək cərrahımız yapon badımcanını möcüzə adlandırıb. Bunların heç bir sübutu yoxdur. Möcüzə deyilən mövhum yoxdur. Ərzaqdan və bitkilərdən möcüzə olmaz. Hamısı yalandır və hamısı ticarətdir, xəbəriniz olsun. Ürək həkimi və daxili xəstəliklər professoru olaraq onu deyə bilərəm ki, insan orqanizmi sağlam olduğu və hüceyrələr normal çalışdığı müddətdə möcüzəyə ehtiyacınız qalmır”.
Professor spirtə bağlı olmayan qaraciyər yağlanması haqqında da məlumatlar verib. O, çıxışında bildirib ki, artıq 10 yaşlı uşaqların qaraciyərində yağlanma var: “Mən 51 ildir həkiməm. Əvvəllər həqiqətən də pivə və spirtli içkilərdən çox istifadə edənlərin qaraciyəri yağlanardı. Amma indi 10 yaşlı uşaqların da qaraciyərində yağlanma var. 10 yaşlı uşaqlar alkoqol qəbul etmirlər. Şirin sular və qazlı içkilər içirlər. 1-2 yaşından etibarən uşaqlarda qazlı içkilərə qarşı asılılıq yaranmağa başlayır. Qazlı içkilər və şirin sular Həzrəti Məhəmməd peyğəmbərin zamanında olsaydı, onların haram olduğunu deyərdi. Bəziləri “Uşaqlarımıza C vitamini verməyək” sualları ilə şikayət edir. İllərlə meyvə sularının C vitamini mənbəyi olduğu deyilir. Xalqımız da həm uşaqlarına meyvə sularını verir, həm də özləri içir və nəticədə, qarınları yağlanır.
Bunların hamısını düzəltmək və qarşısını almaq öz əlimizdədir. Heç biri genetik deyil”. (publika.az)
Əvvəlki məqaləHəmməruzəçilərin səfəri təxirə salınıb
Növbəti məqalədə“Avropa İrana qarşı hər növ sanksiyaya qarşı çıx | c4-az |
package com.programmerr47.whitecodetesttask.api.accessoryEnums;
/**
* @author Michael Spitsin
* @since 2014-08-22
*/
public enum FriendsOrder {
name,
hints,
random,
mobile
}
| programmerr47/whitecode-test-task-app/src/main/java/com/programmerr47/whitecodetesttask/api/accessoryEnums/FriendsOrder.java |
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule AppRegistry
* @flow
*/
'use strict';
var BatchedBridge = require('BatchedBridge');
var BugReporting = require('BugReporting');
var ReactNative = require('ReactNative');
const infoLog = require('infoLog');
var invariant = require('fbjs/lib/invariant');
var renderApplication = require('renderApplication');
const { HeadlessJsTaskSupport } = require('NativeModules');
if (__DEV__) {
// In order to use Cmd+P to record/dump perf data, we need to make sure
// this module is available in the bundle
require('RCTRenderingPerf');
}
type Task = (taskData: any) => Promise<void>;
type TaskProvider = () => Task;
var runnables = {};
var runCount = 1;
const tasks: Map<string, TaskProvider> = new Map();
type ComponentProvider = () => ReactClass<any>;
type AppConfig = {
appKey: string,
component?: ComponentProvider,
run?: Function,
};
/**
* `AppRegistry` is the JS entry point to running all React Native apps. App
* root components should register themselves with
* `AppRegistry.registerComponent`, then the native system can load the bundle
* for the app and then actually run the app when it's ready by invoking
* `AppRegistry.runApplication`.
*
* To "stop" an application when a view should be destroyed, call
* `AppRegistry.unmountApplicationComponentAtRootTag` with the tag that was
* pass into `runApplication`. These should always be used as a pair.
*
* `AppRegistry` should be `require`d early in the `require` sequence to make
* sure the JS execution environment is setup before other modules are
* `require`d.
*/
var AppRegistry = {
registerConfig: function(config: Array<AppConfig>) {
for (var i = 0; i < config.length; ++i) {
var appConfig = config[i];
if (appConfig.run) {
AppRegistry.registerRunnable(appConfig.appKey, appConfig.run);
} else {
invariant(appConfig.component, 'No component provider passed in');
AppRegistry.registerComponent(appConfig.appKey, appConfig.component);
}
}
},
registerComponent: function(appKey: string, getComponentFunc: ComponentProvider): string {
runnables[appKey] = {
run: (appParameters) =>
renderApplication(getComponentFunc(), appParameters.initialProps, appParameters.rootTag)
};
return appKey;
},
registerRunnable: function(appKey: string, func: Function): string {
runnables[appKey] = {run: func};
return appKey;
},
getAppKeys: function(): Array<string> {
return Object.keys(runnables);
},
runApplication: function(appKey: string, appParameters: any): void {
const msg =
'Running application "' + appKey + '" with appParams: ' +
JSON.stringify(appParameters) + '. ' +
'__DEV__ === ' + String(__DEV__) +
', development-level warning are ' + (__DEV__ ? 'ON' : 'OFF') +
', performance optimizations are ' + (__DEV__ ? 'OFF' : 'ON');
infoLog(msg);
BugReporting.addSource('AppRegistry.runApplication' + runCount++, () => msg);
invariant(
runnables[appKey] && runnables[appKey].run,
'Application ' + appKey + ' has not been registered. This ' +
'is either due to a require() error during initialization ' +
'or failure to call AppRegistry.registerComponent.'
);
runnables[appKey].run(appParameters);
},
unmountApplicationComponentAtRootTag: function(rootTag : number) {
ReactNative.unmountComponentAtNodeAndRemoveContainer(rootTag);
},
/**
* Register a headless task. A headless task is a bit of code that runs without a UI.
* @param taskKey the key associated with this task
* @param task a promise returning function that takes some data passed from the native side as
* the only argument; when the promise is resolved or rejected the native side is
* notified of this event and it may decide to destroy the JS context.
*/
registerHeadlessTask: function(taskKey: string, task: TaskProvider): void {
if (tasks.has(taskKey)) {
console.warn(`registerHeadlessTask called multiple times for same key '${taskKey}'`);
}
tasks.set(taskKey, task);
},
/**
* Only called from native code. Starts a headless task.
*
* @param taskId the native id for this task instance to keep track of its execution
* @param taskKey the key for the task to start
* @param data the data to pass to the task
*/
startHeadlessTask: function(taskId: number, taskKey: string, data: any): void {
const taskProvider = tasks.get(taskKey);
if (!taskProvider) {
throw new Error(`No task registered for key ${taskKey}`);
}
taskProvider()(data)
.then(() => HeadlessJsTaskSupport.notifyTaskFinished(taskId))
.catch(reason => {
console.error(reason);
HeadlessJsTaskSupport.notifyTaskFinished(taskId);
});
}
};
BatchedBridge.registerCallableModule(
'AppRegistry',
AppRegistry
);
module.exports = AppRegistry;
| Right-Men/Ironman-node_modules/react-native/Libraries/ReactNative/AppRegistry.js |
Rejection protocols to address high sparsity of the search space
Although evolution improves sample efficiency over random search, it does not resolve the high sparsity issue of the search space. This motivates us to develop two rejection protocols to filter out bad layers after short training. A layer must pass both tests to be considered by evolution.
Figure 3: CIFAR-10 accuracy calibrations of 5K random layers over three architectures. The calibration is far from perfect. For example, layers performing well on ResNet-CIFAR may not be able to outperform random guess on MobileNetV2-CIFAR.
Figure 2: CIFAR-10 accuracy histograms of 5K random layers over three architectures.
Quality.We discard layers that achieve less than \(20\%^{2}\) CIFAR-10 validation accuracy after training for 100 steps. Since the vast majority of the candidate layers attain poor accuracies, this simple mechanism ensures the compute resources to concentrate on the full training of a small number of promising candidates. Empirically, this speeds up the search by up to two orders of magnitude.
Stability.In addition to quality, we reject layers that are subject to numerical instability. The basic idea is to stress-test the candidate layer by _adversarially_ adjusting the model weights \(\theta\) towards the direction of maximizing the network's gradient norm. Formally, let \(\ell(\theta,G)\) be the training loss of a model when paired with computation graph \(G\) computed based on a small batch of images. Instability of training is reflected by the worst-case gradient norm: \(\max_{\theta}\left\|\partial\ell(\theta,G)/\partial\theta\right\|_{2}\). We seek to maximize this value by performing gradient ascent along the direction of \(\frac{\partial\left\|\partial\ell(\theta,G)/\partial\theta\right\|_{2}}{ \partial\theta}\) up to 100 steps. Layers whose gradient norm exceeding \(10^{8}\) are rejected. The stability test focuses on robustness because it considers the worst case, hence is complementary to the quality test. This test is highly efficient-gradients of many layers are forced to quickly blow up in less than 5 steps.
### Multi-architecture evaluation to promote strong generalization
To explicitly promote strong generalization, we formulate the search as a multi-objective optimization problem, where each candidate layer is always evaluated over multiple different _anchor_ architectures to obtain a set of fitness scores. We choose three architectures as the anchors, including ResNet50 [13] (v2)3, MobileNetV2 [14] and EfficientNet-B0 [15]. Widths and strides of these Imagenet architectures are adapted w.r.t the CIFAR-10 dataset [56] (Appendix B), on which they will be trained and evaluated for speedy feedback. The block definitions of the anchor architectures are shown in Figure 4.
Footnote 2: This is twice as good as random guess on CIFAR-10.
Tournament Selection Criterion.As each layer is paired with multiple architectures, and therefore has multiple scores, there are multiple ways to decide the tournament winner within evolution:
_Average_: Layer with the highest average accuracy wins (e.g., B in Figure 5 wins because it has the highest average performance on the two models.).
_Pareto_: A random layer on the Pareto frontier wins (e.g., A, B, C in Figure 5 are equal likely to win as none of them can be dominated by other candidates.).
Empirically we observe that different architectures have different accuracy variations. For example, ResNet has been observed to have a higher accuracy variance than MobileNet and EfficientNet on CIFAR-10 proxy tasks. Hence, under the Average criterion, the search will bias towards helping ResNet, not MobileNet nor EfficientNet. We therefore propose to use the Pareto frontier criterion to avoid this bias. Our method is novel, but reminiscent of NSGA-II [57], a well-established multi-objective genetic algorithm, in terms of simultaneously optimizing all the non-dominated solutions.
Figure 4: Block definitions of anchor architectures: ResNet-CIFAR (_left_), MobileNetV2-CIFAR (_center_), and EfficientNet-CIFAR (_right_).4.
Figure 5: Illustration of tournament selection criteria for multi-objective optimization. Candidate B wins under the Average criterion. Each of A, B, C wins with probability \(\frac{1}{3}\) under the Pareto criterion.
Experiments
We include details of our experiments in Appendix C, including settings and hyperparameters of the proxy task, search method, reranking, and full-fledged evaluations. In summary, we did the search on CIFAR-10, and re-ranked the top-10 layers on a held-out set of ImageNet to obtain the best 3 layers. The top-10 layers are reported in Appendix D. For all results below, our layers and baseline layers are compared under identical training setup. Hyperparameters are directly inherited from the original implementations (usually in favor of BN-based layers) without tuning w.r.t EvoNorms. | 2004.02967v5.mmd |
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena 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 of the License.
//
// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project without restriction. Specifically, if other files
// instantiate templates or use macros or inline functions from this
// file, or you compile this file and link it with other files to produce
// an executable, this file does not by itself cause the resulting
// executable to be covered by the GNU General Public License. This
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
#ifndef MLN_CORE_IMAGE_DMORPH_ALL_HH
# define MLN_CORE_IMAGE_DMORPH_ALL_HH
/// \file
///
/// File that includes all domain morpher image types.
# include <mln/core/image/dmorph/transformed_image.hh>
# include <mln/core/image/dmorph/extended.hh>
# include <mln/core/image/dmorph/extension_fun.hh>
# include <mln/core/image/dmorph/extension_ima.hh>
# include <mln/core/image/dmorph/extension_val.hh>
# include <mln/core/image/dmorph/hexa.hh>
# include <mln/core/image/dmorph/image_if.hh>
# include <mln/core/image/dmorph/image2d_h.hh>
# include <mln/core/image/dmorph/p2p_image.hh>
# include <mln/core/image/dmorph/slice_image.hh>
# include <mln/core/image/dmorph/sub_image.hh>
# include <mln/core/image/dmorph/sub_image_if.hh>
# include <mln/core/image/dmorph/unproject_image.hh>
#endif // ! MLN_CORE_IMAGE_DMORPH_ALL_HH
| codingforfun/Olena-Mirror-milena/mln/core/image/dmorph/all.hh |
#ifndef LINEEDITINTERFACE_H
#define LINEEDITINTERFACE_H
#include <QString>
#include <functional>
class QWidget;
struct LineEditInterface {
virtual ~LineEditInterface()
{
}
typedef std::function<void()> textChanged_t;
virtual void editingFinishedCbk(const textChanged_t& cb) = 0;
virtual void textChangedCbk(const textChanged_t& cb) = 0;
virtual QWidget* mainWidget() = 0;
virtual void init(const QString& placeholderText, QValidator* qValidator) = 0;
virtual void setPlaceholderText(const QString& placeholderText) = 0;
virtual void setDisabled(bool state) = 0;
virtual int getTextLength() = 0;
virtual const QString getText() = 0;
virtual void setText(const QString& text) = 0;
};
#endif // LINEEDITINTERFACE_H
| GENIVI/CANdevStudio-src/common/guiinterface/lineeditinterface.h |
from django.db import models
class Route(models.Model):
key = models.CharField(max_length=16, unique=True)
url = models.CharField(max_length=128)
auth_username = models.CharField(max_length=128)
auth_password = models.CharField(max_length=128)
def __str__(self):
return "{}: {}".format(self.key, self.url)
| hwayne/ripper-beam-ripper/forwarder/models.py |
command_dict = {}
def command(command_name):
def decorator(func):
print(command_name)
command_dict[command_name] = func
return func
return decorator | AntoDev96/GuidaSky-decorators/command.py |
#!/usr/bin/python -B
################################################################################
# Copyright (c) 2014 Phil Smith
#
# 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.
################################################################################
################################################################################
# @Title: client.py
#
# @Author: Phil Smith
#
# @Date: Thu, 25-Dec-14 06:19PM
#
# @Project: New Wemo
#
# @Purpose: Client test app.
#
################################################################################
import os
import socket
import os.path as op
class Client(object):
"""
Client class for local socket test.
"""
def __init__(self):
"""
Initialize structures.
"""
self.tx_socket = socket.socket( socket.AF_UNIX, socket.SOCK_DGRAM )
self.rx_socket = socket.socket( socket.AF_UNIX, socket.SOCK_DGRAM )
# Transmit to the server input
self.tx_endpoint = "/tmp/wemo_srv_in"
# Receive from the server output
self.rx_endpoint = "/tmp/wemo_srv_out"
def test_connect(self):
if not op.exists( self.tx_endpoint ):
print "Endpoint does not exist."
return
self.tx_socket.connect(self.tx_endpoint)
# Commands will also take the wemo's friendly name
# e.g. self.tx_socket.send("off_cmd crockpot")
self.tx_socket.send("on_cmd all")
self.tx_socket.send("list_cmd")
raw_data = self.rx_socket.recv( 4096 )
if raw_data:
print raw_data
def connect_rx(self):
"""
Connects this app to it's rx socket.
"""
# Socket already in use will return socket.error(98)
# Get rid of it before trying to connect.
# Note: must check for 'exists' no 'isfile' because sockets
# are not "files".
if op.exists( self.rx_endpoint ):
os.remove( self.rx_endpoint )
self.rx_socket = socket.socket( socket.AF_UNIX, socket.SOCK_DGRAM )
try:
self.rx_socket.bind( self.rx_endpoint )
except Exception as e:
print e.args
print "Could not connect to socket: %s" % self.rx_endpoint
exit(1)
if __name__ == "__main__":
cli = Client()
cli.connect_rx()
cli.test_connect()
| civissmith/WeMo-client.py |
Script.include("../BenchmarkLib.js");
var TRACING_RULES = "" +
"trace.*=true\n" +
"*.detail=true\n" +
"";
Resources.overrideUrlPrefix(TEST_ROOT, Script.resolvePath(".."));
var testScript = new TestScript();
testScript.addTest({
name: "measureTimingHifiqa-master",
loader: TestScript.locationLoader("hifi://hifiqa-master", true),
tracingRules: TRACING_RULES,
traceActions: TestScript.measureTimingSteps([
{ time: 5, step: 0.1, keepActive: true, pos: { x: 29.2, y: -8.3, z: -26.2 }, ori:{ yaw: 127.1 } }, // landing point
{ time: 5, step: 0.1, keepActive: true, pos: { x: 20.4, y: -9.3, z: 1.4 }, ori:{ yaw: 90.9 } }, // looking at quad
{ time: 5, step: 0.1, keepActive: true, pos: { x: -29.8, y: -9.0, z: 15.0 }, ori:{ yaw: -125.2 } }, // engine pod
{ time: 5, step: 0.1, keepActive: true, pos: { x: -22.1, y: -4.9, z: -47.3 }, ori:{ yaw: 173.6 } }, // near a chatterbox
{ time: 5, step: 0.1, keepActive: true, pos: { x: -196.8, y: -7.8, z: 82.1 }, ori:{ yaw: 40.7 } }, // capitol
]),
duration: 30
});
testScript.runTests(); | highfidelity/hifi_tests-benchmarks/hifiqa-master/measureTimingHifiqa-master.js |
'use strict';
const _ = require('lodash');
const Generator = require('yeoman-generator');
module.exports = class extends Generator {
constructor(args, options) {
super(args, options);
this.option('taskRunner', {
type: String,
required: false,
default: 'gulpfile',
desc: 'TaskRunner module'
});
this.option('testing', {
type: String,
required: false,
default: 'node_unit',
desc: 'Testing module'
});
}
writing() {
const fileName = `${this.options.taskRunner}.js`;
var avaibleTest = this.options.testing;
if (this.options.taskRunner == 'gulpfile') {
var devDependencies = {
'gulp': '^3.9.1',
'gulp-eslint': '^4.0.0'
}
var test = 'gulp'
if (avaibleTest === 'node_unit') {
devDependencies['gulp-nodeunit'] = '^0.1.0';
} else if (avaibleTest === 'mocha') {
devDependencies['gulp-mocha'] = '^4.3.1';
devDependencies['chai'] = '^4.0.2';
} else if (avaibleTest === 'jasmine') {
devDependencies['gulp-jasmine'] = '^2.4.2 ';
}
}
if (this.options.taskRunner == 'Gruntfile') {
var devDependencies = {
'grunt-cli': '^1.2.0',
'grunt-contrib-eslint': '^0.0.5',
'grunt-contrib-watch': '^1.0.0',
'load-grunt-tasks': '^3.5.2',
'time-grunt': '^1.4.0'
}
var test = 'grunt'
if (avaibleTest === 'node_unit') {
devDependencies['grunt-contrib-nodeunit'] = '^1.0.0';
} else if (avaibleTest === 'mocha') {
devDependencies['grunt-mocha-cli'] = '^3.0.0';
devDependencies['chai'] = '^4.0.2';
} else if (avaibleTest === 'jasmine') {
devDependencies['grunt-contrib-jasmine'] = '^1.1.0';
}
}
const pkgJson = {
devDependencies: devDependencies,
scripts: {
test: test
}
};
this.fs.extendJSON(
this.destinationPath('package.json'),
pkgJson
);
this.fs.copyTpl(
this.templatePath(fileName),
this.destinationPath(fileName), {
testing: avaibleTest,
srcPath: this.options.projectRoot
}
);
}
}; | yashprit/generator-bode-generators/runner/index.js |
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: The RegExp.prototype source property has the attribute DontEnum
es5id: 15.10.7.1_A8
description: >
Checking if enumerating the source property of RegExp.prototype
fails
---*/
var __re = RegExp.prototype;
//CHECK#0
if (__re.hasOwnProperty('source') !== true) {
$ERROR('#0: __re = RegExp.prototype; __re.hasOwnProperty(\'source\') === true');
}
//CHECK#1
if (__re.propertyIsEnumerable('source') !== false) {
$ERROR('#1: __re = RegExp.prototype; __re.propertyIsEnumerable(\'source\') === false');
}
//CHECK#2
var count = 0
for (var p in __re){
if (p==="source") count++
}
if (count !== 0) {
$ERROR('#2: count = 0; __re = RegExp.prototype; for (p in __re){ if (p==="source") count++; } count === 0. Actual: ' + (count));
}
| m0ppers/arangodb-3rdParty/V8/V8-5.0.71.39/test/test262/data/test/built-ins/RegExp/prototype/source/S15.10.7.1_A8.js |
/*
* File: app/model/CommonModel.js
*
* This file was generated by Sencha Architect version 3.2.0.
* http://www.sencha.com/products/architect/
*
* This file requires use of the Ext JS 5.1.x library, under independent license.
* License of Sencha Architect does not include license for Ext JS 5.1.x. For more
* details see http://www.sencha.com/license or contact [email protected].
*
* This file will be auto-generated each and everytime you save your project.
*
* Do NOT hand edit this file.
*/
Ext.define('FrontHPApp.model.CommonModel', {
extend: 'Ext.data.Model',
alias: 'model.commonmodel',
requires: [
'Ext.data.field.Integer'
],
fields: [
{
//type: 'int',
name: 'id'
},
{
name: 'name'
}
]
}); | Thawatchai-T/FontHPRepository-Com.Ktbl.FontHP.Web/app/model/CommonModel.js |
package iotapp.applehater.cn.iotapp;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class SelectActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select);
}
}
| zh-h/IoTApp-app/src/main/java/iotapp/applehater/cn/iotapp/SelectActivity.java |
from django.template import Library
register = Library()
# http://djangosnippets.org/snippets/1357/ by zalun
@register.filter
def get_range( value ):
"""
Filter - returns a list containing range made from given value
Usage (in template):
<ul>{% for i in 3|get_range %}
<li>{{ i }}. Do something</li>
{% endfor %}</ul>
Results with the HTML:
<ul>
<li>0. Do something</li>
<li>1. Do something</li>
<li>2. Do something</li>
</ul>
Instead of 3 one may use the variable set in the views
"""
return range( value )
| fiee/croisee-croisee/croisee/templatetags/range_tags.py |
package com.jaisingh.android.myappportfolio;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void launchSpotify(View view) {
Toast.makeText(MainActivity.this, "This button will launch my Spotify App", Toast.LENGTH_SHORT).show();
}
public void launchScores(View view) {
Toast.makeText(MainActivity.this, "This button will launch my Scores App", Toast.LENGTH_SHORT).show();
}
public void launchLibrary(View view) {
Toast.makeText(MainActivity.this, "This button will launch my Library App", Toast.LENGTH_SHORT).show();
}
public void launchBuilder(View view) {
Toast.makeText(MainActivity.this, "This button will launch my Build it Bigger App", Toast.LENGTH_SHORT).show();
}
public void launchReader(View view) {
Toast.makeText(MainActivity.this, "This button will launch my XYZ Reader App", Toast.LENGTH_SHORT).show();
}
public void launchCapstone(View view) {
Toast.makeText(MainActivity.this, "This button will launch my Capstone App", Toast.LENGTH_SHORT).show();
}
}
| abhishekjiitr/My-Android-Apps-app/src/main/java/com/jaisingh/android/myappportfolio/MainActivity.java |
"use strict";
admin
.controller( "DashboardController", [ "$scope", "$http", "$sce", "$rootScope", "$templateCache", "$translate",
"comics", "users", function( $scope, $http, $sce, $rootScope, $templateCache, $translate, comics,
users ) {
$scope.users = users;
$scope.comics = comics;
$scope.$emit = function ( eventName ) {
$rootScope.$emit( eventName );
};
/** Compile templates. */
$( "script[type=\"text/ng-template\"]" ).each(function () {
var $this = $( this );
$templateCache.put( $this.attr( "id" ), $this.text() );
});
/** Allow all controllers access to unified notifier wrapper. */
$rootScope.alertResponse = function ( response ) {
if ( response.status >= 200 && response.status < 300 ) {
this._alertSuccess( response.data && response.data.success ?
response.data.success :
"Action was successful." );
} else {
this._alertError( response.data && response.data.error ?
response.data.error :
"Error " + response.status + ": " + response.statusText );
}
};
$rootScope._alertSuccess = function ( message ) {
this._noty( message, "success" );
};
$rootScope._alertError = function ( message ) {
this._noty( message, "error" );
};
$rootScope._noty = function ( message, type ) {
noty({
text: message,
layout: "bottomRight",
theme: "bootstrapTheme",
killer: true,
animation: {
easing: 'linear',
speed: 0,
open: {
height: 'toggle'
},
close: {
height: 'toggle'
},
},
type: type
});
}
$rootScope.ok = true;
/** Wrapper for convenient error messages. */
$rootScope.error = function ( message ) {
$translate( message ).then( function ( message ) {
$rootScope.alertResponse({
data: {
error: message
}
});
});
};
/** Wrapper for convenient success messages. */
$rootScope.success = function ( message ) {
$translate( message ).then( function ( message ) {
$rootScope.alertResponse({
status: 200,
data: {
success: message
}
});
});
};
/** Common helper: various places in code need to blur active element. */
$rootScope.blurActiveElement = function () {
document.activeElement.blur();
};
}]);
| cezarykluczynski/ComicCMS2-public/js/admin/Controller/Dashboard.js |
$(function () {
/*
$(".JsSelect").selectbox({
// width of new select
widthOfSelect: 200, // number (150) || number + percents (1-100%) || string ("auto")
// show or not tooltip text if text is too long and not displayed
isShowTitle: false, // true || false
// content of icon element
contentOfIcon: "", // text or html string
// height of drop down list
heightOfList: 300, // number
// css classes of elements
classes: {
select: "select",
text: "select-text",
icon: "select-icon",
list: "select-list",
item: "select-item"
},
// call back function before open select
beforeOpen: function (newSelect, data) {
// newSelect - new pseudo select element (<span />)
// data = {html: html of newSelect, value: value of newSelect}
// this = original <select/>
},
// call back function after close select
afterClose: function (newSelect, data) {
// newSelect - new pseudo select element (<span />)
// data = {html: html of newSelect, value: value of newSelect}
// this = original <select/>
}
});
*/
// initialize
$(".JsSelect").selectbox({
widthOfSelect: 70,
contentOfIcon: "▼",
isShowTitle: true,
heightOfList: 300,
classes: {
select: "simple-select",
text: "simple-select-text",
icon: "simple-select-icon",
list: "simple-select-list",
item: "simple-select-item"
},
beforeOpen: function (newSelect, data) {
console.log("beforeOpen " + data.html + " " + data.value);
},
afterClose: function (newSelect, data) {
console.log("afterClose " + data.html + " " + data.value);
}
});
// add event handler before open new pseudo select
$(".JsSelect").on("beforeOpen",function (event, newSelect, data) {
// event - jQuery event object
// newSelect - new pseudo select element (<span />)
// data = {html: html of newSelect, value: value of newSelect}
// this = original <select/>
$(".JsTypeEvent").html("Event before open <select />");
$(".JsValue").html("data = {html: " + data.html + ", value: " + data.value + "}");
})
// add event handler after close new pseudo select
.on("afterClose", function (event, newSelect, data) {
// event - jQuery event object
// newSelect - new pseudo select element (<span />)
// data = {html: html of newSelect, value: value of newSelect}
// this = original <select/>
$(".JsTypeEvent").html("Event after close <select />");
$(".JsValue").html("data = {html: " + data.html + ", value: " + data.value + "}");
});
// initialize
$(".JsSelect2").selectbox({
widthOfSelect: 300,
isShowTitle: false,
heightOfList: 400,
classes: {
select: "long-select",
text: "long-select-text",
icon: "long-select-icon",
list: "long-select-list",
item: "long-select-item"
},
// add event handler before open new pseudo select
beforeOpen: function (newSelect, data) {
console.log("beforeOpen " + data.html + " " + data.value);
},
// add event handler after close new pseudo select
afterClose: function (newSelect, data) {
console.log("afterClose " + data.html + " " + data.value);
}
});
// initialize
$(".JsSelect3").selectbox({
widthOfSelect: 150,
isShowTitle: true,
heightOfList: 200,
classes: {
select: "middle-select",
text: "middle-select-text",
icon: "middle-select-icon",
list: "middle-select-list",
item: "middle-select-item"
}
});
}); | kefir-100/selectbox-selectbox/scripts/main.js |
Kernelized Stein Discrepancy
Informative thinning requires a goodness-of-fit metric to distinguish between "good" samples and "bad" samples.
Figure 1: Current dictionary \(\mathbf{D}_{t-1}\) in green. New sample \(\mathbf{x}_{t}\) added in yellow to form \(\hat{\mathbf{D}}_{t}\). Then redundant red samples are thinned.
In general, evaluation of metrics between the empirical estimate \(q_{\text{D}}\) and the target \(p\) is intractable. The powerful combination of Stein's method (Stein, 1972) and Reproducing Kernel Hilbert Spaces (Berlinet & Thomas-Agnan, 2011; Sriperumbudur et al., 2010) permits one to evaluate discrepancies between \(q_{\text{D}}\) and \(p\) in closed form (Liu et al., 2016). Let \(k\) be a base kernel, for example the inverse multi-quadratic (IMQ) kernel
\[k(\mathbf{x},\mathbf{y})=\left(1+\|\mathbf{x}-\mathbf{y}\|_{2}^{2}\right)^{-0.5} \tag{3}\]
or the Radial Basis Function (RBF) kernel
\[k(\mathbf{x},\mathbf{y})=\exp\left(-\|\mathbf{x}-\mathbf{y}\|_{2}^{2}/2h\right). \tag{4}\]
Next define the _Stein kernel_
\[k_{0}(\mathbf{x},\mathbf{y})= \nabla_{\mathbf{x}}\log p(\mathbf{x})^{T}\nabla_{\mathbf{y}}\log p (\mathbf{y})k(\mathbf{x},\mathbf{y})\] \[+\nabla_{\mathbf{y}}\log p(\mathbf{y})^{T}\nabla_{\mathbf{x}}k( \mathbf{x},\mathbf{y})\] \[+\nabla_{\mathbf{x}}\log p(\mathbf{x})^{T}\nabla_{\mathbf{y}}k( \mathbf{x},\mathbf{y})+\sum_{i=1}^{d}\frac{\partial^{2}k(\mathbf{x},\mathbf{y })}{\partial\mathbf{x}_{i}\partial\mathbf{y}_{i}}\, \tag{5}\]
where \(p\) is a fixed target density, \(d\) is the dimension of each particle \(\mathbf{x},\mathbf{y}\in\mathcal{X}\) and the score function \(\nabla_{\mathbf{x}}\log p(\mathbf{x})\) can be estimated without knowledge of the normalizing constants \(Z\). Stein's method in this context specifies a constructed RKHS \(\mathcal{K}_{0}\) with Stein kernel \(k_{0}\) (5) in turn constructed from the base kernel \(k\). Then the kernelized Stein discrepancy (KSD) of an empirical measure \(q_{\text{D}}\) with respect to a target density \(p\) is the RKHS norm in \(\mathcal{K}_{0}\) given by
\[\operatorname{KSD}(q_{\text{D}})=\sqrt{\frac{1}{n^{2}}\sum_{\mathbf{x}_{i}, \mathbf{x}_{j}\in\text{D}}k_{0}(\mathbf{x}_{i},\mathbf{x}_{j})}. \tag{6}\]
For simplicity our notation suppresses the dependence on the target density \(p\) and the RKHS \(\mathcal{K}\).
### Online Thinning - Outer Loop
In Algorithm 1 we propose an online thinning algorithm that can generate compressed representations of a measure \(\mathbb{P}\) with access only to a stream of samples \(\mathbf{S}\), the unnormalized density \(\tilde{p}\), and the score function \(\nabla\log\tilde{p}\). Our sampler performs informative thinning in a flexible online fashion by discarding points that do not make a sufficient contribution to minimizing the KSD objective \(\operatorname{KSD}(q_{\text{D}_{t}})\) where \(\text{D}_{t}\) is the thinned dictionary produced by step \(t\) of our algorithm.
```
Target density \(p\), initial dictionary \(\text{D}_{0}\), point sequence \(\mathbf{S}=\{\mathbf{x}_{i}\}_{i=1}^{\infty}\), budget sequence \(\{\epsilon_{t}\}_{t=1}^{\infty}\), minimum sample size function \(f\). for\(t\) in \([1,2,3,\dots]\)do Receive new sample \(\mathbf{x}_{t}\) from \(\mathbf{S}\) Add sample \(\mathbf{x}_{t}\) to dictionary: \(\tilde{\text{D}}_{t}=\text{D}_{t-1}\cup\{\mathbf{x}_{t}\}\) Thin via Algorithm 2: \(\text{D}_{t}=\operatorname{KSDT}(p,\tilde{\text{D}}_{t},\epsilon_{t},f(t))\) endfor
```
**Algorithm 1**Online KSD Thinning (KSDT)
At each step the thinning budget schedule \(\epsilon_{t}\) controls the compression/fidelity tradeoff of the thinned approximation. The minimum dictionary size function \(f(t)\) must satisfy the relationship \(f(t)=\Omega\left(\sqrt{t\log(t)}\right)\) to preserve the
\begin{table}
\begin{tabular}{c|c|c|c|c} \multicolumn{5}{c}{**Online KSD Thinning**} \\ \hline Method & Online & Informative & Discard Past Samples & Model Order Growth \\ \hline MCMC Thinning & ✓ & ✗ & ✗ & \(n\) \\ \hline Stein Thinning (Riabiz et al., 2020) & ✗ & ✓ & ✓ & NA \\ \hline SPMCMC (Chen et al., 2019) & ✓ & ✓ & ✗ & \(n\) \\ \hline This work & ✓ & ✓ & ✓ & \(o\left(\sqrt{n\log(n)}\right)\) \\ \hline \end{tabular}
\end{table}
Table 1: Methods for Generating Compressed Non-Parametric Representations
Figure 2: A geometric view of online KSD thinning (Algorithm 1). We update \(\text{D}_{t-1}\), fix a KSD \(\epsilon\)-neighborhood, and greedily remove points until we hit the boundary of this neighborhood. By tuning the compression-induced error to the information contained in the update direction, i.e., the red arrow representing Eq. (7), we obtain the green dot \(\text{D}_{t}\), which is the update output by Algorithm 2.
consistency our algorithm. However, if one tolerates non-vanishing asymptotic bias, then \(f(t)\) may be set to a small constant \(\epsilon_{t}=\epsilon\). We discuss practical selection of \(\epsilon\) and the resultant dictionary \(\mathbf{D}\) in the following section. Our approach differs from the related work of (Chen et al., 2019) in that we thin the entire dictionary at each step. In contrast, no prior samples are thinned in the Stein Point MCMC algorithm presented by (Chen et al., 2019). By thinning the entire dictionary we can remove previously sampled points that are inessential for ensuring the representation is consistent. A major advantage of this approach is that our online thinning algorithm can automatically determine the number of points required based on the complexity of the target measure \(\mathbb{P}\). We demonstrate this in Section 4.4. | 2201.07130v2.mmd |
var mongoose = require('mongoose')
var Types = [
'PostComment',
'Follow',
'CommentReply',
'CommentMention',
'Welcome',
]
var NotificationSchema = new mongoose.Schema({
receiver: { type: mongoose.Schema.ObjectId, ref: 'User', required: true, index: true },
// Notifications with the same identifier MAY be aggregated.
identifier: { type: String, required: true },
type: { type: String, enum: Types, required: true },
data: { }, // name, thumbnail, path...
instances: {
type: [{
key: { type: String, required: true },
data: { }, // name, avatarUrl?
created:{ type: Date, default: Date.now },
}],
required: false,
},
created: { type: Date },
updated: { type: Date, index: true },
}, {
// autoIndex: false
})
NotificationSchema.index({ identifier: 1, receiver: 1 })
NotificationSchema.pre('save', function (next) {
if (!this.created) {
this.created = new Date()
}
if (!this.updated) {
this.updated = this.created
}
next()
})
NotificationSchema.statics.Types = Types
module.exports = NotificationSchema
| f03lipe/qilabs-app/models/notification.js |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function appendServerDirectoryOption(incoming) {
if (!incoming.get('server'))
return incoming;
if (incoming.get('directory')) {
return incoming.setIn(['server', 'directory'], incoming.has('directory'));
}
return incoming;
}
exports.appendServerDirectoryOption = appendServerDirectoryOption;
//# sourceMappingURL=appendServerDirectoryOption.js.map | cferreirasuazo/pokedex-node_modules/browser-sync/dist/cli/transforms/appendServerDirectoryOption.js |
import React, { Component, PropTypes } from 'react'
import { Ripple } from './ripple'
class RippleButton extends Component {
static propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string,
onClick: PropTypes.func,
text: PropTypes.string,
}
static defaultProps = {
onClick: () => {},
className: '',
text: '',
}
constructor() {
super()
this.state = {
cursorPos: {}
}
}
handleClick(e) {
// Get Cursor Position
let cursorPos = {
top: e.clientY,
left: e.clientX,
// Prevent Component duplicates do ripple effect at the same time
time: Date.now()
}
this.setState({ cursorPos: cursorPos })
}
render() {
const { className } = this.props || 'glare-button'
return (
<div
className={`${className} Ripple-parent`}
onClick={(e) => {
this.handleClick(e)
this.props.onClick()
}}>
{this.props.children}
<Ripple cursorPos={this.state.cursorPos} />
</div>
)
}
}
export default RippleButton
| cannoneyed/tmm-glare-src/components/shared/rippleButton.js |
class Solution {
public:
int diameterOfBinaryTree(TreeNode* root) {
maxDm = 0;
getMaxDepth(root);
return maxDm;
}
private:
int maxDm;
int getMaxDepth(TreeNode* root) {
if (root == NULL) {
return 0;
}
int leftDm = getMaxDepth(root->left);
int rightDm = getMaxDepth(root->right);
maxDm = max(leftDm + rightDm, maxDm);
return 1 + max(leftDm, rightDm);
}
};
| ZzJing/ugrad-algorithm-intro-tree/TreeLongestPath.cpp |
/**
* Copyright (c) 2012 Andreas Madsen
* MIT License
*/
var vows = require('vows'),
path = require('path'),
fs = require('fs'),
async = require('async'),
assert = require('assert'),
common = require('../common.js'),
cahier = require(common.cahier);
// remove temp content
common.reset();
var convert;
vows.describe('testing cahier converter - create directory').addBatch({
'when a cahier object is created': {
topic: function () {
// create convert object
async.series([
// create cahier object
function (callback) {
convert = cahier(common.options, callback);
},
// setup cahier object
function (callback) {
// simpel handlers, will add first and second exports properties
convert.handle('json', 'string', function (content, next) {
var obj = JSON.parse(content);
obj.first = 'first';
next( JSON.stringify(obj) );
});
convert.handle('json', 'string', function (content, next) {
var obj = JSON.parse(content);
obj.second = 'second';
next( JSON.stringify(obj) );
});
convert.convert('js', 'json');
callback(null);
}
], this.callback);
},
'no errors should be returned': function (error, dum) {
assert.ifError(error);
}
}
}).addBatch({
'when reading a file for first time': {
topic: function () {
return common.handleStream( convert.read('/subdir/static.json') );
},
'the content should be parsed by handlers': function (error, content) {
assert.ifError(error);
assert.deepEqual(JSON.parse(content), {
zero: 'zero',
position: 'root',
first: 'first',
second: 'second'
});
},
'the stat file': {
topic: function () {
var self = this;
setTimeout(function () {
async.parallel({
'origin': fs.stat.bind(fs, path.resolve(common.options.source, 'subdir/static.json')),
'compiled': fs.stat.bind(fs, path.resolve(common.options.cache, 'subdir/static.json')),
'cache': fs.readFile.bind(fs, common.options.state, 'utf8')
}, self.callback);
}, 200);
},
'should be updated': function (error, result) {
assert.deepEqual({
mtime: result.origin.mtime.getTime(),
size: result.origin.size,
compiled: result.compiled.size
}, JSON.parse(result.cache)['subdir/static.json']);
}
},
'the chached file': {
topic: function () {
fs.readFile(path.resolve(common.options.cache, 'subdir/static.json'), 'utf8', this.callback);
},
'should be created': function (error, content) {
assert.ifError(error);
assert.deepEqual(JSON.parse(content), {
zero: 'zero',
position: 'root',
first: 'first',
second: 'second'
});
}
}
}
}).exportTo(module);
| AndreasMadsen/cahier-test/simple/convert-directory.js |
/*******************************************************************************
* Open Behavioral Health Information Technology Architecture (OBHITA.org)
*
* 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 the <organization> 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 <COPYRIGHT HOLDER> 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.
******************************************************************************/
package gov.samhsa.acs.brms.domain;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
/**
* The Enum SubjectPurposeOfUse.
*/
@XmlEnum
public enum SubjectPurposeOfUse {
@XmlEnumValue("HMARKT")
healthcareMarketing("HMARKT"),
@XmlEnumValue("HOPERAT")
healthcareOperations("HOPERAT"),
@XmlEnumValue("HOUTCOMS")
outcomeMeasure("HOUTCOMS"),
@XmlEnumValue("HPRGRP")
programReporting("HPRGRP"),
@XmlEnumValue("PERFMSR")
performanceMeasure("PERFMSR"),
@XmlEnumValue("HPAYMT")
healthcarePayment("HPAYMT"),
@XmlEnumValue("HRESCH")
healthcareResearch("HRESCH"),
@XmlEnumValue("CLINTRCH")
clinicalTrialResearch("CLINTRCH"),
@XmlEnumValue("TREAT")
treatment("TREAT"),
@XmlEnumValue("ETREAT")
emergencyTreatment("ETREAT"),
@XmlEnumValue("POPHLTH")
populationHealthTreatment("POPHLTH");
private final String purpose;
SubjectPurposeOfUse(String p) {purpose = p;}
public static SubjectPurposeOfUse fromValue(String v) {
return valueOf(v);
}
public String getPurpose() {return purpose;}
}
| tlin-fei/ds4p-DS4P/access-control-service/brms/factmodel/src/main/java/gov/samhsa/acs/brms/domain/SubjectPurposeOfUse.java |
/**
* @author Victor Lantigua
* @description This file should be included in the issue view page.
*/
/**
* Lazy Loading Comments Class
*/
var LazyComments = {
perPage: 5, // The number of comments to load per request
currentPage: 1, // The current page
offset: 0,
issueId: null,
init: function(issueId) {
var self = this;
self.issueId = issueId;
// Bind form submit handler
$('#comments-form').on('submit', function() {
event.preventDefault();
self.addComment($(this));
});
// Bind show more button click handler
$('#btn-show-more').on('click', function() {
self.lazyLoad($(this));
});
// Bind edit button click handler
$('#comments-list').on('click', '.btn-edit-comment', function(event) {
event.stopPropagation();
event.preventDefault();
var $comment = $(this).parent().siblings('.comment');
$comment.editable({
//selector: '.editable',
type: 'textarea',
name: 'comment',
toggle: 'manual',
ajaxOptions: {
type: 'POST'
}
});
$comment.editable('show');
});
// Bind delete button click handler
$('#comments-list').on('click', '.btn-remove-comment', function(event) {
event.preventDefault();
var $btn = $(this);
if (confirm("Are you sure you want to remove this comment?")) {
$.post('/issue_comments/update/' + $btn.attr('data-id'), {name: 'archived', value: 1});
$btn.parent().closest('.media').fadeOut();
}
});
},
/**
* Lazy loads comments
*/
lazyLoad: function($showMoreBtn) {
var self = this;
$showMoreBtn.attr('disabled', true).text('Loading...');
$.ajax({
url: '/issue_comments',
type: 'GET',
data: {
issue_id: self.issueId,
limit: self.perPage,
offset: self.offset + (self.currentPage * self.perPage)
}
}).done(function(html) {
self.currentPage++;
if (html.length > 0) { // Show comments
$('#comments-list').append(html);
$showMoreBtn.attr('disabled', false).text('Show More');
} else { // No more comments to show, hide button.
$showMoreBtn.hide();
}
}).fail(function(data) {
var data = JSON.parse(data.responseText);
$showMoreBtn.attr('disabled', false).text('Show More');
alert('Error: ' + data.error_message);
});
},
/**
* Submits a new comment
*/
addComment: function($form) {
var self = this,
$submitBtn = $form.find('button[type=submit]').attr('disabled', true);
$.ajax({
url: '/issue_comments/create',
type: 'POST',
data: $form.serialize()
}).done(function(data) {
$form[0].reset();
$submitBtn.attr('disabled', false);
self.offset++;
if ($('#comments-list').find('.media').length) { // Add it to the top of the list.
$('#comments-list').prepend(data);
} else { // First comment, replace empty text with comment.
$('#comments-list').html(data);
}
}).fail(function(data) {
var data = JSON.parse(data.responseText);
$submitBtn.attr('disabled', false);
alert('Error: ' + data.error_message);
});
}
};
| victor-nbcuni/bugger-assets/js/pages/issue/lazy-comments.js |
/* MDH WCET BENCHMARK SUITE. */
/* 2012/09/28, Jan Gustafsson <[email protected]>
* Changes:
* - This program redefines the C standard function fabs and sqrt. Therefore, these functions has been renamed with prefix qurt_.
* - qurt.c:95:6: warning: explicitly assigning a variable of type 'double' to itself: fixed
* - qurt.c:105:6: warning: unused variable 'flag' [-Wunused-variable]: fixed
*/
/*************************************************************************/
/* */
/* SNU-RT Benchmark Suite for Worst Case Timing Analysis */
/* ===================================================== */
/* Collected and Modified by S.-S. Lim */
/* [email protected] */
/* Real-Time Research Group */
/* Seoul National University */
/* */
/* */
/* < Features > - restrictions for our experimental environment */
/* */
/* 1. Completely structured. */
/* - There are no unconditional jumps. */
/* - There are no exit from loop bodies. */
/* (There are no 'break' or 'return' in loop bodies) */
/* 2. No 'switch' statements. */
/* 3. No 'do..while' statements. */
/* 4. Expressions are restricted. */
/* - There are no multiple expressions joined by 'or', */
/* 'and' operations. */
/* 5. No library calls. */
/* - All the functions needed are implemented in the */
/* source file. */
/* */
/* */
/*************************************************************************/
/* */
/* FILE: qurt.c */
/* SOURCE : Turbo C Programming for Engineering by Hyun Soo Ahn */
/* */
/* DESCRIPTION : */
/* */
/* Root computation of quadratic equations. */
/* The real and imaginary parts of the solution are stored in the */
/* array x1[] and x2[]. */
/* */
/* REMARK : */
/* */
/* EXECUTION TIME : */
/* */
/* */
/*************************************************************************/
/*
** Benchmark Suite for Real-Time Applications, by Sung-Soo Lim
**
** III-7. qurt.c : the root computation of a quadratic equation
** (from the book C Programming for EEs by Hyun Soon Ahn)
*/
double a[3], x1[2], x2[2];
int flag;
int qurt();
double qurt_fabs(double n)
{
double f;
if (n >= 0) f = n;
else f = -n;
return f;
}
double qurt_sqrt(val)
double val;
{
double x = val/10;
double dx;
double diff;
double min_tol = 0.00001;
int i, flag;
flag = 0;
if (val == 0 ) x = 0;
else {
for (i=1;i<20;i++)
{
if (!flag) {
dx = (val - (x*x)) / (2.0 * x);
x = x + dx;
diff = val - (x*x);
if (qurt_fabs(diff) <= min_tol) flag = 1;
}
else {} /* JG */
/* x =x; */
}
}
return (x);
}
int main()
{
/* int flag; */ /* JG */
a[0] = 1.0;
a[1] = -3.0;
a[2] = 2.0;
qurt();
a[0] = 1.0;
a[1] = -2.0;
a[2] = 1.0;
qurt();
a[0] = 1.0;
a[1] = -4.0;
a[2] = 8.0;
qurt();
return 0;
}
int qurt()
{
double d, w1, w2;
if(a[0] == 0.0) return(999);
d = a[1]*a[1] - 4 * a[0] * a[2];
w1 = 2.0 * a[0];
w2 = qurt_sqrt(qurt_fabs(d));
if(d > 0.0)
{
flag = 1;
x1[0] = (-a[1] + w2) / w1;
x1[1] = 0.0;
x2[0] = (-a[1] - w2) / w1;
x2[1] = 0.0;
return(0);
}
else if(d == 0.0)
{
flag = 0;
x1[0] = -a[1] / w1;
x1[1] = 0.0;
x2[0] = x1[0];
x2[1] = 0.0;
return(0);
}
else
{
flag = -1;
w2 /= w1;
x1[0] = -a[1] / w1;
x1[1] = w2;
x2[0] = x1[0];
x2[1] = -w2;
return(0);
}
}
| zhangyz/llvm-slicing-test/C/source/WCET/qurt.c |
//
// FBPromoPrize.h
// Pods
//
// Created by Tony Sullivan on 8/3/16.
//
//
#import <Foundation/Foundation.h>
@interface FBPromoPrize : NSObject
@property (nonatomic, strong) NSString *title;
@property (nonatomic, strong) NSString *icon;
@end
| Fanbeat/fanbeat-ios-sdk-FanBeat/Classes/FBPromoPrize.h |
'use strict';
/* global logger */
const _ = require('lodash');
const H = require('higher');
const EngineHelpers = require('@getlazy/engine-helpers');
const HelperContainer = EngineHelpers.HelperContainer;
const EngineHttpServer = EngineHelpers.EngineHttpServer;
// We are implicitly using `this` in overridden methods but eslint keep telling us not to.
// lazy ignore class-methods-use-this
class PmdJavaHelperContainer extends HelperContainer {
constructor() {
// Per image-metadata our helper container ID is pmd-java.
super('pmd-java');
}
_getBaseContainerExecParams() {
return {
User: 'root',
Cmd: ['/usr/local/pmd-bin/bin/run.sh', 'pmd', '-R', 'java-basic,java-typeresolution',
'-f', 'codeclimate', '-d']
};
}
_processContainerOutput(buffers) {
// In this engine each line is a separate JSON so we first put together all the buffers
// and then we split them per lines.
const jsonLines = _
.chain(buffers)
.map(buffer => buffer && buffer.payload && buffer.payload.toString())
.join('')
.split('\n')
.value();
// Once the output has been split into lines, parse each line and create a warning for it.
return {
warnings: _
.chain(jsonLines)
.reject(_.isEmpty)
.map((jsonLine) => {
try {
// Clean \u0000 at the end of the jsonLine.
let cleanJsonLine;
if (_.last(jsonLine) === '\u0000') {
cleanJsonLine = jsonLine.slice(0, jsonLine.length - 1);
} else {
cleanJsonLine = jsonLine;
}
const warning = JSON.parse(cleanJsonLine);
return {
type: 'Warning',
line: H.ifFalsy(_.get(warning, 'location.lines.begin'), 0),
column: 1,
message: warning.description
};
} catch (e) {
logger.error('Failed to parse JSON', jsonLine, e);
return null;
}
})
.filter()
.value()
};
}
}
class PmdJavaEngineHttpServer extends EngineHttpServer {
beforeListening() {
this._helperContainer = new PmdJavaHelperContainer();
return Promise.resolve();
}
getMeta() {
return {
languages: ['Java']
};
}
analyzeFile(...args) {
// Pass forward the arguments to the engine.
return this._helperContainer.analyzeFile(...args)
.then((result) => {
// Mark the code as checked.
_.assignIn(result, {
status: {
codeChecked: true
}
});
return result;
});
}
afterListening() {
this._helperContainer = null;
return Promise.resolve();
}
}
class Engine {
start() {
const port = process.env.PORT || 80;
this._server = new PmdJavaEngineHttpServer(port);
return this._server.start();
}
stop() {
return this._server.stop()
.then(() => {
this._server = null;
});
}
}
module.exports = Engine;
| getlazy/lazy-source/engines/pmd-java/pmd-java-engine.js |
Bouru...Bouru...: VIDEO: Δεν παίζεται η Τανζανή!
VIDEO: Δεν παίζεται η Τανζανή!
Ο θηλυκός Ετό ή Ντρογκμπά ; Είναι απο την Τανζανία και αποδυκνύει ότι ποδόσφαιρο παίζουν και οι γυναίκες!
Δες την νεαρή κοπέλα να κάνει "τρελά" κόλπα με την μπάλα , κόλπα που έχουμε δει απο μεγάλους ποδοσφαιριστές!
Αναρτήθηκε από Bouru...Bouru... στις 2:18 π.μ.
Βασικοί κανόνες οικιακής υγιεινής - Αναρωτιέστε πόσο συχνά πρέπει να αλλάζετε σεντόνια και να αερίζετε τους χώρους στους οποίους περνάτε αρκετό από τον χρόνο σας; Παρακάτω θα βρείτε χρήσιμες...
Η Ρωσία δεν έχει στα «χέρια» της πλέον μεγάλο μέρος του αμερικάνικου χρέους - Η Ρωσία δεν συμπεριλαμβάνεται πλέον στην κατάταξη των ξένων κρατών που διακρατούν σημαντικό μέρος των δεκαετών ομολόγων του αμερικανικού δημοσίου, σύμφων...
Το εξοχικό μου - Το εξοχικό μου | c4-cy |
Subsets and Splits