code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
3
942
language
stringclasses
30 values
license
stringclasses
15 values
size
int32
3
1.05M
/* (c)2014|US-UltimateShip. Univali - Universidade do Vale do Itajaí. GeraçãoTec - Projeto Filnal Batalha Final em JAVA. Criadores: Alexandre <alexandreess@gmail.com> Carlos Eduardo Passos de Sousa <carloseduardosousa@gmail.com> Henrique Wilhelm <henrique.wilhelm@gmail.com> Jaison dos santos <jaison1906@gmail.com> Otavio Ribeiro <otavioribeiro@capflorianopolis.org.br> */ package br.com.intagrator.cap8; public class TrabFlowLayout extends java.awt.Frame { /** * */ private static final long serialVersionUID = 1L; //Método @param args public static void main(String[] args) { // TODO Auto-generated method stub } }
carlosedusousa/curso-java-fonts
layouts-em-Java/src/br/com/intagrator/cap8/TrabFlowLayout.java
Java
mit
653
package ch11.product_serial; public class Product { private String name; private double price; private int quantity; /** Constructs a product with empty name and 0 price and quantity. */ public Product() { name = ""; price = 0; quantity = 0; } /** Constructs a product with the given name, price and quantity. @param aName product name @param aPrice product price @param aQuantity product quantity */ public Product(String aName, double aPrice, int aQuantity) { name = aName; price = aPrice; quantity = aQuantity; } /** Returns the product name. @return the product name */ public String getName() { return name; } /** Returns the product price. @return the product price */ public double getPrice() { return price; } /** Returns the product quantity. @return the product quantity */ public int getQuantity() { return quantity; } /** Sets the product price. @param newPrice the new product price */ public void setPrice(double newPrice) { price = newPrice; } /** Sets the product quantity. @param newQuantity the new product quantity */ public void setQuantity(int newQuantity) { quantity = newQuantity; } public String toString() { return super.toString()+" : "+ this.name + " (" +this.price+" , "+this.quantity+")"; } }
raeffu/prog2
src/ch11/product_serial/Product.java
Java
mit
1,562
var expect = chai.expect; var assert = chai.assert; var Utils = { elementContainer: undefined, _init: function(){ this.elementContainer = document.createElement('div'); this.elementContainer.setAttribute('data-element-container', ''); this.elementContainer.style.display = 'none'; document.body.appendChild(this.elementContainer); return this; }, append: function(selector, html){ var div = document.createElement('div'); div.innerHTML = html; var children = Array.prototype.slice.call(div.childNodes); var length = children.length; var parents = document.querySelectorAll(selector); for(var p=0; p<parents.length; p++){ var parent = parents[p]; while(children.length){ var child = children.pop(); parent.appendChild(child); } } }, remove: function(parentSelector, childSelector){ var parents = document.querySelectorAll(parentSelector); for(var p=0; p<parents.length; p++){ var parent = parents[p]; var children = parent.querySelectorAll(childSelector); children = Array.prototype.slice.call(children); while(children.length){ var child = children.pop(); parent.removeChild(child); } } } }._init();
hkvalvik/element-observer
test/utils.js
JavaScript
mit
1,413
from django.db import models from django.core.exceptions import ImproperlyConfigured from django import forms from django.conf import settings import warnings try: from keyczar import keyczar except ImportError: raise ImportError('Using an encrypted field requires the Keyczar module. ' 'You can obtain Keyczar from http://www.keyczar.org/.') class EncryptionWarning(RuntimeWarning): pass class BaseEncryptedField(models.Field): prefix = 'enc_str:::' def __init__(self, *args, **kwargs): if not hasattr(settings, 'ENCRYPTED_FIELD_KEYS_DIR'): raise ImproperlyConfigured('You must set the ENCRYPTED_FIELD_KEYS_DIR setting to your Keyczar keys directory.') self.crypt = keyczar.Crypter.Read(settings.ENCRYPTED_FIELD_KEYS_DIR) # Encrypted size is larger than unencrypted self.unencrypted_length = max_length = kwargs.get('max_length', None) if max_length: max_length = len(self.prefix) + len(self.crypt.Encrypt('x' * max_length)) # TODO: Re-examine if this logic will actually make a large-enough # max-length for unicode strings that have non-ascii characters in them. kwargs['max_length'] = max_length super(BaseEncryptedField, self).__init__(*args, **kwargs) def to_python(self, value): if isinstance(self.crypt.primary_key, keyczar.keys.RsaPublicKey): retval = value elif value and (value.startswith(self.prefix)): retval = self.crypt.Decrypt(value[len(self.prefix):]) if retval: retval = retval.decode('utf-8') else: retval = value return retval def get_db_prep_value(self, value, connection, prepared=False): if value and not value.startswith(self.prefix): # We need to encode a unicode string into a byte string, first. # keyczar expects a bytestring, not a unicode string. if type(value) == unicode: value = value.encode('utf-8') # Truncated encrypted content is unreadable, # so truncate before encryption max_length = self.unencrypted_length if max_length and len(value) > max_length: warnings.warn("Truncating field %s from %d to %d bytes" % ( self.name, len(value), max_length), EncryptionWarning ) value = value[:max_length] value = self.prefix + self.crypt.Encrypt(value) return value class EncryptedTextField(BaseEncryptedField): __metaclass__ = models.SubfieldBase def get_internal_type(self): return 'TextField' def formfield(self, **kwargs): defaults = {'widget': forms.Textarea} defaults.update(kwargs) return super(EncryptedTextField, self).formfield(**defaults) def south_field_triple(self): "Returns a suitable description of this field for South." # We'll just introspect the _actual_ field. from south.modelsinspector import introspector field_class = "django.db.models.fields.TextField" args, kwargs = introspector(self) # That's our definition! return (field_class, args, kwargs) class EncryptedCharField(BaseEncryptedField): __metaclass__ = models.SubfieldBase def __init__(self, *args, **kwargs): super(EncryptedCharField, self).__init__(*args, **kwargs) def get_internal_type(self): return "CharField" def formfield(self, **kwargs): defaults = {'max_length': self.max_length} defaults.update(kwargs) return super(EncryptedCharField, self).formfield(**defaults) def south_field_triple(self): "Returns a suitable description of this field for South." # We'll just introspect the _actual_ field. from south.modelsinspector import introspector field_class = "django.db.models.fields.CharField" args, kwargs = introspector(self) # That's our definition! return (field_class, args, kwargs)
orbitvu/django-extensions
django_extensions/db/fields/encrypted.py
Python
mit
4,102
package de.yellow_ray.bluetoothtest; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.Log; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.UUID; import de.yellow_ray.bluetoothtest.protocol.Package; public class BluetoothService<T extends BluetoothClient> { public static final String TAG = "BluetoothService"; public static final int MESSAGE_DISCONNECTED = 0; public static final int MESSAGE_CONNECTING = 1; public static final int MESSAGE_CONNECTING_FAILED = 2; public static final int MESSAGE_CONNECTED = 3; private final BluetoothAdapter mBluetoothAdapter; private final Handler mHandler; private BluetoothSocket mSocket = null; private ConnectThread mConnectThread = null; private TechnoBluetoothClient mClientThread = null; BluetoothService(final Handler handler) { mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); mHandler = handler; notifyDisconnected(); } public void connect(final BluetoothDevice device) { if (mSocket != null && mSocket.isConnected()) { closeSocket(); } notifyConnecting(device); mConnectThread = new ConnectThread(device); mConnectThread.start(); } public void disconnect() { closeSocket(); } public void sendPackage(Package pkg) { if (mClientThread != null) { mClientThread.sendPackage(pkg); } } public void setParameter(int id, float value) { if (mClientThread != null) { mClientThread.setParameter(id, value); } } private void notifyDisconnected() { notifyDisconnected(""); } private void notifyDisconnected(final String reason) { Message msg = mHandler.obtainMessage(MESSAGE_DISCONNECTED); Bundle bundle = new Bundle(); bundle.putString("reason", reason); msg.setData(bundle); msg.sendToTarget(); } private void notifyConnecting(final BluetoothDevice device) { Message msg = mHandler.obtainMessage(MESSAGE_CONNECTING); Bundle bundle = new Bundle(); bundle.putParcelable("device", device); msg.setData(bundle); msg.sendToTarget(); } private void notifyConnectingFailed(final BluetoothDevice device, final String reason) { Message msg = mHandler.obtainMessage(MESSAGE_CONNECTING_FAILED); Bundle bundle = new Bundle(); bundle.putParcelable("device", device); bundle.putString("reason", reason); msg.setData(bundle); msg.sendToTarget(); } private void notifyConnected(final BluetoothDevice device) { Message msg = mHandler.obtainMessage(MESSAGE_CONNECTED); Bundle bundle = new Bundle(); bundle.putParcelable("device", device); msg.setData(bundle); msg.sendToTarget(); } public void closeSocketAfterError(final String reason) { try { if (mSocket != null) { mSocket.close(); } notifyDisconnected(reason); } catch (IOException e) { Log.e(TAG, "Could not close the client socket", e); notifyDisconnected("Could not close the client socket: " + e.toString()); } } private void closeSocket() { try { try { if (mClientThread != null) { mClientThread.stopClient(); mClientThread.join(); } } catch (InterruptedException e) { e.printStackTrace(); } if (mSocket != null) { mSocket.close(); notifyDisconnected(); } } catch (IOException e) { Log.e(TAG, "Could not close the client socket", e); notifyDisconnected("Could not close the client socket: " + e.toString()); } } private void handleConnection(final BluetoothSocket socket) { try { InputStream input = mSocket.getInputStream(); OutputStream output = mSocket.getOutputStream(); mClientThread = new TechnoBluetoothClient(this, mHandler, input, output); mClientThread.start(); notifyConnected(socket.getRemoteDevice()); } catch (IOException e) { Log.w(TAG, e); notifyConnectingFailed(socket.getRemoteDevice(), e.toString()); closeSocket(); } } private class ConnectThread extends Thread { private BluetoothDevice mDevice = null; public ConnectThread(BluetoothDevice device) { mDevice = device; } public void run() { // Cancel discovery because it otherwise slows down the connection. mBluetoothAdapter.cancelDiscovery(); try { mSocket = mDevice.createRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-00805f9b34fb")); } catch (IOException e) { Log.e(TAG, "Socket's create() method failed", e); notifyConnectingFailed(mDevice, e.toString()); closeSocket(); return; } try { // Connect to the remote device through the socket. This call blocks // until it succeeds or throws an exception. mSocket.connect(); } catch (IOException connectException) { // Unable to connect; close the socket and return. Log.w(TAG, "Unable to connect!"); Log.w(TAG, connectException); try { Class<?> clazz = mSocket.getRemoteDevice().getClass(); Class<?>[] paramTypes = new Class<?>[]{Integer.TYPE}; Method m = clazz.getMethod("createRfcommSocket", paramTypes); Object[] params = new Object[]{Integer.valueOf(1)}; mSocket = (BluetoothSocket) m.invoke(mSocket.getRemoteDevice(), params); mSocket.connect(); } catch (IOException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { Log.w(TAG, e); notifyConnectingFailed(mDevice, e.toString()); closeSocket(); return; } } handleConnection(mSocket); } } }
m0r13/technoqualle-android
app/src/main/java/de/yellow_ray/bluetoothtest/BluetoothService.java
Java
mit
6,754
/* eslint-disable no-console */ const path = require('path'); const { promisify } = require('util'); const render = require('koa-ejs'); const helmet = require('helmet'); const { Provider } = require('../lib'); // require('oidc-provider'); const Account = require('./support/account'); const configuration = require('./support/configuration'); const routes = require('./routes/koa'); const { PORT = 3000, ISSUER = `http://localhost:${PORT}` } = process.env; configuration.findAccount = Account.findAccount; let server; (async () => { let adapter; if (process.env.MONGODB_URI) { adapter = require('./adapters/mongodb'); // eslint-disable-line global-require await adapter.connect(); } const prod = process.env.NODE_ENV === 'production'; const provider = new Provider(ISSUER, { adapter, ...configuration }); const directives = helmet.contentSecurityPolicy.getDefaultDirectives(); delete directives['form-action']; const pHelmet = promisify(helmet({ contentSecurityPolicy: { useDefaults: false, directives, }, })); provider.use(async (ctx, next) => { const origSecure = ctx.req.secure; ctx.req.secure = ctx.request.secure; await pHelmet(ctx.req, ctx.res); ctx.req.secure = origSecure; return next(); }); if (prod) { provider.proxy = true; provider.use(async (ctx, next) => { if (ctx.secure) { await next(); } else if (ctx.method === 'GET' || ctx.method === 'HEAD') { ctx.status = 303; ctx.redirect(ctx.href.replace(/^http:\/\//i, 'https://')); } else { ctx.body = { error: 'invalid_request', error_description: 'do yourself a favor and only use https', }; ctx.status = 400; } }); } render(provider.app, { cache: false, viewExt: 'ejs', layout: '_layout', root: path.join(__dirname, 'views'), }); provider.use(routes(provider).routes()); server = provider.listen(PORT, () => { console.log(`application is listening on port ${PORT}, check its /.well-known/openid-configuration`); }); })().catch((err) => { if (server && server.listening) server.close(); console.error(err); process.exitCode = 1; });
panva/node-oidc-provider
example/standalone.js
JavaScript
mit
2,219
package com.instructure.canvasapi.api; import com.instructure.canvasapi.model.CanvasContext; import com.instructure.canvasapi.model.NotificationPreferenceResponse; import com.instructure.canvasapi.utilities.APIHelpers; import com.instructure.canvasapi.utilities.CanvasCallback; import com.instructure.canvasapi.utilities.CanvasRestAdapter; import java.util.ArrayList; import retrofit.RestAdapter; import retrofit.http.GET; import retrofit.http.PUT; import retrofit.http.Path; import retrofit.http.Query; public class NotificationPreferencesAPI { //Frequency keys public static final String IMMEDIATELY = "immediately"; public static final String DAILY = "daily"; public static final String WEEKLY = "weekly"; public static final String NEVER = "never"; public interface NotificationPreferencesInterface { @GET("/users/{user_id}/communication_channels/{communication_channel_id}/notification_preferences") void getNotificationPreferences(@Path("user_id") long userId, @Path("communication_channel_id") long communicationChannelId, CanvasCallback<NotificationPreferenceResponse> callback); @GET("/users/{user_id}/communication_channels/{type}/{address}/notification_preferences") void getNotificationPreferencesForType(@Path("user_id") long userId, @Path("type") String type, @Path("address") String address, CanvasCallback<NotificationPreferenceResponse> callback); @GET("/users/{user_id}/communication_channels/{communication_channel_id}/notification_preferences/{notification}") void getSingleNotificationPreference(@Path("user_id") long userId, @Path("communication_channel_id") long communicationChannelId, @Path("notification") String notification, CanvasCallback<NotificationPreferenceResponse> callback); @GET("/users/{user_id}/communication_channels/{type}/{address}/notification_preferences/{notification}") void getSingleNotificationPreferencesForType(@Path("user_id") long userId, @Path("type") String type, @Path("address") String address, @Path("notification") String notification, CanvasCallback<NotificationPreferenceResponse> callback); @PUT("/users/self/communication_channels/{communication_channel_id}/notification_preferences/{notification}") void updateSingleNotificationPreference(@Path("communication_channel_id") long communicationChannelId, @Path("notification") String notification, CanvasCallback<NotificationPreferenceResponse> callback); @PUT("/users/self/communication_channels/{type}/{address}/notification_preferences/{notification}") void updateSingleNotificationPreferenceForType(@Path("type") String type, @Path("address") String address, @Path("notification") String notification, CanvasCallback<NotificationPreferenceResponse> callback); @PUT("/users/self/communication_channels/{communication_channel_id}/notification_preferences{notification_preferences}") void updateMultipleNotificationPreferences(@Path("communication_channel_id") long communicationChannelId, @Path(value = "notification_preferences", encode = false) String notifications, CanvasCallback<NotificationPreferenceResponse> callback); } ///////////////////////////////////////////////////////////////////////// // Build Interface Helpers ///////////////////////////////////////////////////////////////////////// private static NotificationPreferencesInterface buildInterface(CanvasCallback<?> callback, CanvasContext canvasContext) { RestAdapter restAdapter = CanvasRestAdapter.buildAdapter(callback, canvasContext, false); return restAdapter.create(NotificationPreferencesInterface.class); } public static void getNotificationPreferences(final long userId, final long communicationChannelId, final CanvasCallback<NotificationPreferenceResponse> callback) { if (APIHelpers.paramIsNull(callback)) { return; } buildInterface(callback, null).getNotificationPreferences(userId, communicationChannelId, callback); } public static void getNotificationPreferencesByType(final long userId, final String type, final String address, final CanvasCallback<NotificationPreferenceResponse> callback) { if (APIHelpers.paramIsNull(callback)) { return; } buildInterface(callback, null).getNotificationPreferencesForType(userId, type, address, callback); } public static void getSingleNotificationPreference(final long userId, final long communicationChannelId, final String notification, final CanvasCallback<NotificationPreferenceResponse> callback) { if (APIHelpers.paramIsNull(callback)) { return; } buildInterface(callback, null).getSingleNotificationPreference(userId, communicationChannelId, notification, callback); } public static void getSingleNotificationPreferencesForType(final long userId, final String type, final String address, final String notification, final CanvasCallback<NotificationPreferenceResponse> callback) { if (APIHelpers.paramIsNull(callback)) { return; } buildInterface(callback, null).getSingleNotificationPreferencesForType(userId, type, address, notification, callback); } public static void updateSingleNotificationPreference(final long communicationChannelId, final String notification, final CanvasCallback<NotificationPreferenceResponse> callback) { if (APIHelpers.paramIsNull(callback)) { return; } buildInterface(callback, null).updateSingleNotificationPreference(communicationChannelId, notification, callback); } public static void updateSingleNotificationPreferenceForType(final String type, final String address, final String notification, final CanvasCallback<NotificationPreferenceResponse> callback) { if (APIHelpers.paramIsNull(callback)) { return; } buildInterface(callback, null).updateSingleNotificationPreferenceForType(type, address, notification, callback); } public static void updateMultipleNotificationPreferences(final long communicationChannelId, final ArrayList<String> notifications, final String frequency, final CanvasCallback<NotificationPreferenceResponse> callback) { if (APIHelpers.paramIsNull(callback)) { return; } buildInterface(callback, null).updateMultipleNotificationPreferences(communicationChannelId, buildNotificationPreferenceList(notifications, frequency), callback); } private static String buildNotificationPreferenceList(ArrayList<String> notifications, String frequency) { StringBuilder builder = new StringBuilder(); builder.append("?"); for(String preference : notifications) { builder.append("notification_preferences"); builder.append("["); builder.append(preference); builder.append("]"); builder.append("[frequency]"); builder.append("="); builder.append(frequency); builder.append("&"); } String notificationsString = builder.toString(); if(notificationsString.endsWith("&")) { notificationsString = notificationsString.substring(0, notificationsString.length() - 1); } return notificationsString; } }
nbutton23/CanvasAPI
src/main/java/com/instructure/canvasapi/api/NotificationPreferencesAPI.java
Java
mit
7,235
// All symbols in the Vertical Forms block as per Unicode v8.0.0: [ '\uFE10', '\uFE11', '\uFE12', '\uFE13', '\uFE14', '\uFE15', '\uFE16', '\uFE17', '\uFE18', '\uFE19', '\uFE1A', '\uFE1B', '\uFE1C', '\uFE1D', '\uFE1E', '\uFE1F' ];
mathiasbynens/unicode-data
8.0.0/blocks/Vertical-Forms-symbols.js
JavaScript
mit
245
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>YPlan?</title> <!-- Bootstrap Core CSS --> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/googlePlaces.css" rel="stylesheet"> <link href="css/full-width-pics.css" rel="stylesheet"> <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/> <link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"/> </head> <body> <!-- Navigation --> <nav class="navbar navbar-inverse navbar-fixed-top" id="navBar" role="navigation"> <div class="container"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="index.html" ><img class="img-responsive img-center" src=".\res\logo.png" alt=""></a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li> <a href="recipePuppy.html">Master Chef Mode</a> </li> <li> <a href="netflix.html">Netflix &amp; Chill</a> </li> <li> <a href="places.html">Out &amp; About</a> </li> </ul> </div> <!-- /.navbar-collapse --> </div> <!-- /.container --> </nav> <!-- Content Section --> <!-- Page Content --> <div class="container"> <!-- Page Heading --> <div class="row"> <div id="header" class="col-md-8 col-md-offset-3"> <h1> <b>Out &amp; About <br> <p>but where to go exactly...? </p> </b> </h1> </div> </div> <div class="row"> <div class="row" id="container1"></div> <hr> </div> </div> <!-- /.container --> <!-- jQuery --> <script src="js/jquery.js"></script> <!-- Bootstrap Core JavaScript --> <script src="js/bootstrap.min.js"></script> <script src="js/request.js"></script> <script> findLocation(); </script> </body> </html>
jmepg/yplan_web
places.html
HTML
mit
3,044
require 'erb' require 'tilt' require 'rack/mime' class MailView autoload :Mapper, 'mail_view/mapper' class << self def default_email_template_path File.expand_path('../mail_view/email.html.erb', __FILE__) end def default_index_template_path File.expand_path('../mail_view/index.html.erb', __FILE__) end def call(env) new.call(env) end end def call(env) @rack_env = env path_info = env["PATH_INFO"] if path_info == "" || path_info == "/" links = self.actions.map do |action| [action, "#{env["SCRIPT_NAME"]}/#{action}"] end ok index_template.render(Object.new, :links => links) elsif path_info =~ /([\w_]+)(\.\w+)?$/ name = $1 format = $2 || ".html" if actions.include?(name) ok render_mail(name, send(name), format) else not_found end else not_found(true) end end protected def actions public_methods(false).map(&:to_s) - ['call'] end def email_template Tilt.new(email_template_path) end def email_template_path self.class.default_email_template_path end def index_template Tilt.new(index_template_path) end def index_template_path self.class.default_index_template_path end private def ok(body) [200, {"Content-Type" => "text/html"}, [body]] end def not_found(pass = false) if pass [404, {"Content-Type" => "text/html", "X-Cascade" => "pass"}, ["Not Found"]] else [404, {"Content-Type" => "text/html"}, ["Not Found"]] end end def render_mail(name, mail, format = nil) body_part = mail if mail.multipart? content_type = Rack::Mime.mime_type(format) body_part = mail.parts.find { |part| part.content_type.match(content_type) } || mail.parts.first end email_template.render(Object.new, :name => name, :mail => mail, :body_part => body_part) end end
WindStill/mail_view
lib/mail_view.rb
Ruby
mit
1,999
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Coq bench</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../../..">Unstable</a></li> <li><a href=".">8.4.dev / contrib:circuits 8.4.dev</a></li> <li class="active"><a href="">2014-12-12 08:42:09</a></li> </ul> <ul class="nav navbar-nav navbar-right"> <li><a href="../../../../../about.html">About</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href=".">« Up</a> <h1> contrib:circuits <small> 8.4.dev <span class="label label-success">5 s</span> </small> </h1> <p><em><script>document.write(moment("2014-12-12 08:42:09 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2014-12-12 08:42:09 UTC)</em><p> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>ruby lint.rb unstable ../unstable/packages/coq:contrib:circuits/coq:contrib:circuits.8.4.dev</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> <dt>Output</dt> <dd><pre>The package is valid. </pre></dd> </dl> <h2>Dry install</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --dry-run coq:contrib:circuits.8.4.dev coq.8.4.dev</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>1 s</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.4.dev). The following actions will be performed: - install coq:contrib:circuits.8.4.dev === 1 to install === =-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= =-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Building coq:contrib:circuits.8.4.dev: coq_makefile -f Make -o Makefile make -j4 make install Installing coq:contrib:circuits.8.4.dev. </pre></dd> </dl> <p>Dry install without Coq, to test if the problem was incompatibility with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --deps-only coq:contrib:circuits.8.4.dev</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>2 s</dd> </dl> <h2>Install</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --verbose coq:contrib:circuits.8.4.dev</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>5 s</dd> <dt>Output</dt> <dd><pre>The following actions will be performed: - install coq:contrib:circuits.8.4.dev === 1 to install === =-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= [coq:contrib:circuits] Fetching https://gforge.inria.fr/git/coq-contribs/circuits.git#v8.4 Initialized empty Git repository in /home/bench/.opam/packages.dev/coq:contrib:circuits.8.4.dev/.git/ [master (root-commit) a2b6c96] opam-git-init From https://gforge.inria.fr/git/coq-contribs/circuits * [new branch] v8.4 -&gt; opam-ref * [new branch] v8.4 -&gt; origin/v8.4 ADDER/Adder.v ADDER/AdderProof.v ADDER/FullAdder.v ADDER/HalfAdder.v ADDER/IncrDecr.v BLOCK/Fill_defs.v BLOCK/Fill_impl.v BLOCK/Fill_proof.v BLOCK/Fill_spec.v GENE/Arith_compl.v GENE/BV.v GENE/Bool_compl.v GENE/Lists_compl.v GENE/Lists_field.v GENE/Lists_replace.v GENE/Memo.v LICENSE MULTIPLIER/Definitions.v MULTIPLIER/LemPrelim.v MULTIPLIER/MultSeq.v Make Makefile README bench.log description HEAD is now at d84f507 Fix contribs broken by addition of eta-expansion =-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Building coq:contrib:circuits.8.4.dev: coq_makefile -f Make -o Makefile make -j4 make install &quot;coqdep&quot; -c -slash -R . Circuits &quot;MULTIPLIER/MultSeq.v&quot; &gt; &quot;MULTIPLIER/MultSeq.v.d&quot; || ( RV=$?; rm -f &quot;MULTIPLIER/MultSeq.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;MULTIPLIER/Definitions.v&quot; &gt; &quot;MULTIPLIER/Definitions.v.d&quot; || ( RV=$?; rm -f &quot;MULTIPLIER/Definitions.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;MULTIPLIER/LemPrelim.v&quot; &gt; &quot;MULTIPLIER/LemPrelim.v.d&quot; || ( RV=$?; rm -f &quot;MULTIPLIER/LemPrelim.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;GENE/Lists_compl.v&quot; &gt; &quot;GENE/Lists_compl.v.d&quot; || ( RV=$?; rm -f &quot;GENE/Lists_compl.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;GENE/Lists_replace.v&quot; &gt; &quot;GENE/Lists_replace.v.d&quot; || ( RV=$?; rm -f &quot;GENE/Lists_replace.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;GENE/BV.v&quot; &gt; &quot;GENE/BV.v.d&quot; || ( RV=$?; rm -f &quot;GENE/BV.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;GENE/Lists_field.v&quot; &gt; &quot;GENE/Lists_field.v.d&quot; || ( RV=$?; rm -f &quot;GENE/Lists_field.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;GENE/Memo.v&quot; &gt; &quot;GENE/Memo.v.d&quot; || ( RV=$?; rm -f &quot;GENE/Memo.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;GENE/Bool_compl.v&quot; &gt; &quot;GENE/Bool_compl.v.d&quot; || ( RV=$?; rm -f &quot;GENE/Bool_compl.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;GENE/Arith_compl.v&quot; &gt; &quot;GENE/Arith_compl.v.d&quot; || ( RV=$?; rm -f &quot;GENE/Arith_compl.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;BLOCK/Fill_defs.v&quot; &gt; &quot;BLOCK/Fill_defs.v.d&quot; || ( RV=$?; rm -f &quot;BLOCK/Fill_defs.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;BLOCK/Fill_proof.v&quot; &gt; &quot;BLOCK/Fill_proof.v.d&quot; || ( RV=$?; rm -f &quot;BLOCK/Fill_proof.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;BLOCK/Fill_impl.v&quot; &gt; &quot;BLOCK/Fill_impl.v.d&quot; || ( RV=$?; rm -f &quot;BLOCK/Fill_impl.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;BLOCK/Fill_spec.v&quot; &gt; &quot;BLOCK/Fill_spec.v.d&quot; || ( RV=$?; rm -f &quot;BLOCK/Fill_spec.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;ADDER/HalfAdder.v&quot; &gt; &quot;ADDER/HalfAdder.v.d&quot; || ( RV=$?; rm -f &quot;ADDER/HalfAdder.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;ADDER/AdderProof.v&quot; &gt; &quot;ADDER/AdderProof.v.d&quot; || ( RV=$?; rm -f &quot;ADDER/AdderProof.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;ADDER/IncrDecr.v&quot; &gt; &quot;ADDER/IncrDecr.v.d&quot; || ( RV=$?; rm -f &quot;ADDER/IncrDecr.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;ADDER/FullAdder.v&quot; &gt; &quot;ADDER/FullAdder.v.d&quot; || ( RV=$?; rm -f &quot;ADDER/FullAdder.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . Circuits &quot;ADDER/Adder.v&quot; &gt; &quot;ADDER/Adder.v.d&quot; || ( RV=$?; rm -f &quot;ADDER/Adder.v.d&quot;; exit ${RV} ) &quot;coqc&quot; -q -R . Circuits GENE/Arith_compl &quot;coqc&quot; -q -R . Circuits GENE/Bool_compl &quot;coqc&quot; -q -R . Circuits GENE/Lists_compl &quot;coqc&quot; -q -R . Circuits ADDER/HalfAdder &quot;coqc&quot; -q -R . Circuits ADDER/FullAdder &quot;coqc&quot; -q -R . Circuits GENE/Lists_field &quot;coqc&quot; -q -R . Circuits GENE/Lists_replace &quot;coqc&quot; -q -R . Circuits GENE/BV &quot;coqc&quot; -q -R . Circuits ADDER/Adder &quot;coqc&quot; -q -R . Circuits GENE/Memo &quot;coqc&quot; -q -R . Circuits ADDER/AdderProof &quot;coqc&quot; -q -R . Circuits MULTIPLIER/Definitions &quot;coqc&quot; -q -R . Circuits MULTIPLIER/LemPrelim &quot;coqc&quot; -q -R . Circuits ADDER/IncrDecr &quot;coqc&quot; -q -R . Circuits MULTIPLIER/MultSeq &quot;coqc&quot; -q -R . Circuits BLOCK/Fill_defs &quot;coqc&quot; -q -R . Circuits BLOCK/Fill_spec &quot;coqc&quot; -q -R . Circuits BLOCK/Fill_impl &quot;coqc&quot; -q -R . Circuits BLOCK/Fill_proof for i in ADDER/Adder.vo ADDER/FullAdder.vo ADDER/IncrDecr.vo ADDER/AdderProof.vo ADDER/HalfAdder.vo BLOCK/Fill_spec.vo BLOCK/Fill_impl.vo BLOCK/Fill_proof.vo BLOCK/Fill_defs.vo GENE/Arith_compl.vo GENE/Bool_compl.vo GENE/Memo.vo GENE/Lists_field.vo GENE/BV.vo GENE/Lists_replace.vo GENE/Lists_compl.vo MULTIPLIER/LemPrelim.vo MULTIPLIER/Definitions.vo MULTIPLIER/MultSeq.vo; do \ install -d `dirname &quot;/home/bench/.opam/system/lib/coq/user-contrib&quot;/Circuits/$i`; \ install -m 0644 $i &quot;/home/bench/.opam/system/lib/coq/user-contrib&quot;/Circuits/$i; \ done Installing coq:contrib:circuits.8.4.dev. </pre></dd> </dl> <h2>Installation size</h2> <p>Total: 339 K</p> <ul> <li>53 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/BLOCK/Fill_impl.vo</code></li> <li>39 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/GENE/Lists_field.vo</code></li> <li>31 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/GENE/Lists_compl.vo</code></li> <li>25 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/MULTIPLIER/MultSeq.vo</code></li> <li>22 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/BLOCK/Fill_spec.vo</code></li> <li>20 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/MULTIPLIER/Definitions.vo</code></li> <li>18 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/GENE/Arith_compl.vo</code></li> <li>18 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/ADDER/Adder.vo</code></li> <li>12 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/GENE/Lists_replace.vo</code></li> <li>12 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/ADDER/AdderProof.vo</code></li> <li>11 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/GENE/BV.vo</code></li> <li>11 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/MULTIPLIER/LemPrelim.vo</code></li> <li>11 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/ADDER/IncrDecr.vo</code></li> <li>10 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/BLOCK/Fill_proof.vo</code></li> <li>10 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/GENE/Bool_compl.vo</code></li> <li>10 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/ADDER/FullAdder.vo</code></li> <li>7 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/BLOCK/Fill_defs.vo</code></li> <li>5 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/ADDER/HalfAdder.vo</code></li> <li>5 K <code>/home/bench/.opam/system/lib/coq/user-contrib/Circuits/GENE/Memo.vo</code></li> <li>1 K <code>/home/bench/.opam/system/lib/coq:contrib:circuits/opam.config</code></li> <li>1 K <code>/home/bench/.opam/system/install/coq:contrib:circuits.install</code></li> </ul> <h2>Uninstall</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq:contrib:circuits.8.4.dev</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>1 s</dd> <dt>Output</dt> <dd><pre>The following actions will be performed: - remove coq:contrib:circuits.8.4.dev === 1 to remove === =-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= [coq:contrib:circuits] Fetching https://gforge.inria.fr/git/coq-contribs/circuits.git#v8.4 =-=- Removing Packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Removing coq:contrib:circuits.8.4.dev. rm -R /home/bench/.opam/system/lib/coq/user-contrib/Circuits </pre></dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> <small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small> </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
coq-bench/coq-bench.github.io-old
clean/Linux-x86_64-4.01.0-1.2.0/unstable/8.4.dev/contrib:circuits/8.4.dev/2014-12-12_08-42-09.html
HTML
mit
15,180
const LOAD = 'lance-web/serviceTypes/LOAD'; const LOAD_SUCCESS = 'lance-web/serviceTypes/LOAD_SUCCESS'; const LOAD_FAIL = 'lance-web/serviceTypes/LOAD_FAIL'; const EDIT_START = 'lance-web/serviceTypes/EDIT_START'; const EDIT_STOP = 'lance-web/serviceTypes/EDIT_STOP'; const SAVE = 'lance-web/serviceTypes/SAVE'; const SAVE_SUCCESS = 'lance-web/serviceTypes/SAVE_SUCCESS'; const SAVE_FAIL = 'lance-web/serviceTypes/SAVE_FAIL'; const REMOVE = 'lance-web/serviceTypes/REMOVE'; const REMOVE_SUCCESS = 'lance-web/serviceTypes/REMOVE_SUCCESS'; const REMOVE_FAIL = 'lance-web/serviceTypes/REMOVE_FAIL'; const CLEAR_ERRORS = 'lance-web/serviceTypes/CLEAR_ERRORS'; const initialState = { loaded: false, editing: {}, saveError: {} }; export default function reducer(state = initialState, action = {}) { switch (action.type) { case LOAD: return { ...state, loading: true }; case LOAD_SUCCESS: return { ...state, loading: false, loaded: true, data: action.result.serviceTypes, error: null }; case LOAD_FAIL: return { ...state, loading: false, loaded: false, data: null, error: action.error }; case EDIT_START: return { ...state, editing: { ...state.editing, [action.id]: true } }; case EDIT_STOP: return { ...state, editing: { ...state.editing, [action.id]: false } }; case SAVE: return { ...state, loading: true, error: null }; case SAVE_SUCCESS: return { ...state, data: [...state.data, action.result.serviceType], loading: false, error: null }; case SAVE_FAIL: return { ...state, loading: false, error: action.error }; case REMOVE: return { ...state, loading: true, error: null }; case REMOVE_SUCCESS: let idx; for (let jdx = 0; jdx < state.data.length; jdx++) { if (state.data[jdx].id === action.id) { idx = jdx; } } return { ...state, data: [ ...state.data.slice(0, idx), ...state.data.slice(idx + 1)], loading: false, error: null }; case REMOVE_FAIL: return { ...state, loading: false, error: action.error }; case CLEAR_ERRORS: return { ...state, error: null }; default: return state; } } export function isLoaded(globalState) { return globalState.serviceTypes && globalState.serviceTypes.loaded; } export function filter(term) { return { types: [LOAD, LOAD_SUCCESS, LOAD_FAIL], promise: (client) => client.post('/serviceType/filter/', {data: {title: term}}) // params not used, just shown as demonstration }; } export function load() { return { types: [LOAD, LOAD_SUCCESS, LOAD_FAIL], promise: (client) => client.get('/serviceType/load') // params not used, just shown as demonstration }; } export function save(serviceType) { return { types: [SAVE, SAVE_SUCCESS, SAVE_FAIL], id: serviceType.id, promise: (client) => client.post('/serviceType/save', { data: serviceType }) }; } export function remove(id) { return { types: [REMOVE, REMOVE_SUCCESS, REMOVE_FAIL], id: id, promise: (client) => client.post('/serviceType/remove', {data: {id: id}}) }; } export function clearErrors() { return { type: CLEAR_ERRORS }; } export function editStart(id) { return { type: EDIT_START, id }; } export function editStop(id) { return { type: EDIT_STOP, id }; }
jairoandre/lance-web-hot
src/redux/modules/serviceTypes.js
JavaScript
mit
3,767
#include "editaddressdialog.h" #include "ui_editaddressdialog.h" #include "addresstablemodel.h" #include "guiutil.h" #include <QDataWidgetMapper> #include <QMessageBox> EditAddressDialog::EditAddressDialog(Mode mode, QWidget *parent) : QDialog(parent), ui(new Ui::EditAddressDialog), mapper(0), mode(mode), model(0) { ui->setupUi(this); GUIUtil::setupAddressWidget(ui->addressEdit, this); switch(mode) { case NewReceivingAddress: setWindowTitle(tr("New receiving address")); ui->addressEdit->setEnabled(false); break; case NewSendingAddress: setWindowTitle(tr("New sending address")); break; case EditReceivingAddress: setWindowTitle(tr("Edit receiving address")); ui->addressEdit->setEnabled(false); break; case EditSendingAddress: setWindowTitle(tr("Edit sending address")); break; } mapper = new QDataWidgetMapper(this); mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); } EditAddressDialog::~EditAddressDialog() { delete ui; } void EditAddressDialog::setModel(AddressTableModel *model) { this->model = model; if(!model) return; mapper->setModel(model); mapper->addMapping(ui->labelEdit, AddressTableModel::Label); mapper->addMapping(ui->addressEdit, AddressTableModel::Address); } void EditAddressDialog::loadRow(int row) { mapper->setCurrentIndex(row); } bool EditAddressDialog::saveCurrentRow() { if(!model) return false; switch(mode) { case NewReceivingAddress: case NewSendingAddress: address = model->addRow( mode == NewSendingAddress ? AddressTableModel::Send : AddressTableModel::Receive, ui->labelEdit->text(), ui->addressEdit->text()); break; case EditReceivingAddress: case EditSendingAddress: if(mapper->submit()) { address = ui->addressEdit->text(); } break; } return !address.isEmpty(); } void EditAddressDialog::accept() { if(!model) return; if(!saveCurrentRow()) { switch(model->getEditStatus()) { case AddressTableModel::OK: // Failed with unknown reason. Just reject. break; case AddressTableModel::NO_CHANGES: // No changes were made during edit operation. Just reject. break; case AddressTableModel::INVALID_ADDRESS: QMessageBox::warning(this, windowTitle(), tr("The entered address \"%1\" is not a valid Delux address.").arg(ui->addressEdit->text()), QMessageBox::Ok, QMessageBox::Ok); break; case AddressTableModel::DUPLICATE_ADDRESS: QMessageBox::warning(this, windowTitle(), tr("The entered address \"%1\" is already in the address book.").arg(ui->addressEdit->text()), QMessageBox::Ok, QMessageBox::Ok); break; case AddressTableModel::WALLET_UNLOCK_FAILURE: QMessageBox::critical(this, windowTitle(), tr("Could not unlock wallet."), QMessageBox::Ok, QMessageBox::Ok); break; case AddressTableModel::KEY_GENERATION_FAILURE: QMessageBox::critical(this, windowTitle(), tr("New key generation failed."), QMessageBox::Ok, QMessageBox::Ok); break; } return; } QDialog::accept(); } QString EditAddressDialog::getAddress() const { return address; } void EditAddressDialog::setAddress(const QString &address) { this->address = address; ui->addressEdit->setText(address); }
deluxcoin/delux
src/qt/editaddressdialog.cpp
C++
mit
3,729
package org.csap.agent.stats.service ; import java.util.concurrent.TimeUnit ; import javax.management.MBeanServerConnection ; import javax.management.ObjectName ; import org.csap.agent.CsapApis ; import org.csap.agent.model.ServiceAlertsEnum ; import org.csap.agent.stats.ServiceCollector ; import org.csap.helpers.CSAP ; import org.csap.helpers.CsapApplication ; //import org.javasimon.CounterSample ; //import org.javasimon.SimonManager ; //import org.javasimon.Split ; //import org.javasimon.StopwatchSample ; //import org.javasimon.jmx.SimonManagerMXBean ; import org.slf4j.Logger ; import org.slf4j.LoggerFactory ; import com.fasterxml.jackson.databind.ObjectMapper ; import com.fasterxml.jackson.databind.node.ObjectNode ; public class JmxCustomCollector { public static final String TOMCAT_SERVLET_CONTEXT_TOKEN = "__CONTEXT__" ; final Logger logger = LoggerFactory.getLogger( getClass( ) ) ; ObjectMapper jacksonMapper = new ObjectMapper( ) ; private ObjectNode deltaLastCollected = jacksonMapper.createObjectNode( ) ; private ServiceCollector serviceCollector ; CsapApis csapApis ; public JmxCustomCollector ( ServiceCollector serviceCollector, CsapApis csapApis ) { this.serviceCollector = serviceCollector ; this.csapApis = csapApis ; } /** * * Each JVM can optionally specify additional attributes to collect * * @param instance * @param serviceNamePort * @param collectionResults * @param mbeanConn */ public void collect ( MBeanServerConnection mbeanConn , ServiceCollectionResults collectionResults ) { // System.err.println( "\n\n xxx logging issues\n\n " ); logger.debug( "\n\n ============================ Getting JMX Custom Metrics for {} \n\n", collectionResults.getServiceInstance( ).getServiceName_Port( ) ) ; collectionResults .getServiceInstance( ) .getServiceMeters( ) .stream( ) .filter( meter -> ! meter.getMeterType( ).isHttp( ) ) .forEach( serviceMeter -> { Object attributeCollected = 0 ; var jmxAttributeTimer = csapApis.metrics( ).startTimer( ) ; boolean isCollectionSuccesful = false ; try { logger.debug( "serviceMeter: {}", serviceMeter ) ; if ( serviceMeter.getMeterType( ).isMbean( ) ) { attributeCollected = collectCustomMbean( serviceMeter, collectionResults, mbeanConn ) ; // } else if ( serviceMeter.getMeterType().isSimon() ) { // // attributeCollected = collectCustomSimon( serviceMeter, simonMgrMxBean, // mbeanConn, collectionResults ) ; } else { logger.warn( "Unexpected meter type: {}", serviceMeter.toString( ) ) ; throw new Exception( "Unknown metric type" ) ; } isCollectionSuccesful = true ; } catch ( Throwable e ) { if ( ! serviceMeter.isIgnoreErrors( ) ) { // SLA will monitor counts csapApis.metrics( ).incrementCounter( "csap.collect-jmx.service.failures" ) ; csapApis.metrics( ).incrementCounter( "collect-jmx.service.failures." + collectionResults.getServiceInstance( ).getName( ) ) ; csapApis.metrics( ).incrementCounter( "collect-jmx.service-failures." + collectionResults.getServiceInstance( ).getName( ) + "-" + serviceMeter.getCollectionId( ) ) ; if ( serviceCollector.isShowWarnings( ) ) { String reason = e.getMessage( ) ; if ( reason != null && reason.length( ) > 60 ) { reason = e .getClass( ) .getName( ) ; } logger.warn( CsapApplication.header( "Failed to collect {} for service {}\n Reason: {}, Cause: {}" ), serviceMeter.getCollectionId( ), collectionResults.getServiceInstance( ) .getServiceName_Port( ), reason, e.getCause( ) ) ; logger.debug( "{}", CSAP.buildCsapStack( e ) ) ; } } logger.debug( "{} Failed getting custom metrics for: {}, reason: {}", collectionResults.getServiceInstance( ).getServiceName_Port( ), serviceMeter.getCollectionId( ), CSAP.buildCsapStack( e ) ) ; } finally { long resultLong = -1l ; if ( attributeCollected instanceof Long ) { resultLong = (Long) attributeCollected ; } else if ( attributeCollected instanceof Integer ) { resultLong = (Integer) attributeCollected ; } else if ( attributeCollected instanceof Double ) { Double d = (Double) attributeCollected ; d = d * serviceMeter.getMultiplyBy( ) ; if ( serviceMeter.getCollectionId( ).equals( "SystemCpuLoad" ) || serviceMeter.getCollectionId( ).equals( "ProcessCpuLoad" ) ) { logger.debug( "Adding multiple by for cpu values: {}", serviceMeter .getCollectionId( ) ) ; d = d * 100 ; } else if ( d < 1 ) { logger.debug( "{}: Multiplying {} by 1000 to store. Add divideBy 1000", collectionResults.getServiceInstance( ).getServiceName_Port( ), serviceMeter.getCollectionId( ) ) ; d = d * 1000 ; } resultLong = Math.round( d ) ; } else if ( attributeCollected instanceof Boolean ) { logger.debug( "Got a boolean result" ) ; Boolean b = (Boolean) attributeCollected ; if ( b ) { resultLong = 1 ; } else { resultLong = 0 ; } } logger.debug( "{} metric: {} , jmxResultObject: {} , resultLong: {}", collectionResults.getServiceInstance( ).getName( ), serviceMeter.getCollectionId( ), attributeCollected, resultLong ) ; if ( serviceMeter.getCollectionId( ).equalsIgnoreCase( ServiceAlertsEnum.JAVA_HEARTBEAT ) ) { // for hearbeats, store the time IF it has passed if ( resultLong == 1 ) { var nanos = csapApis.metrics( ).stopTimer( jmxAttributeTimer, "collect-jmx.service-attribute" ) ; resultLong = TimeUnit.NANOSECONDS.toMillis( nanos ) ; // some apps return very quickly due to not actually // implementing. return 1 if that happens if ( resultLong == 0 ) { resultLong = 1 ; // minimum of 1 to indicate success } // for checks. } collectionResults .getServiceInstance( ) .getDefaultContainer( ).setJmxHeartbeatMs( resultLong ) ; } if ( ! ( attributeCollected instanceof Double ) ) { resultLong = resultLong * serviceMeter.getMultiplyBy( ) ; } resultLong = Math.round( resultLong / serviceMeter.getDivideBy( serviceCollector .getCollectionIntervalSeconds( ) ) ) ; // simon delta is handled in simon collection if ( serviceMeter.isDelta( ) ) { long last = resultLong ; String key = collectionResults.getServiceInstance( ).getServiceName_Port( ) + serviceMeter .getCollectionId( ) ; if ( deltaLastCollected.has( key ) && isCollectionSuccesful ) { resultLong = resultLong - deltaLastCollected.get( key ).asLong( ) ; if ( resultLong < 0 ) { resultLong = 0 ; } } else { resultLong = 0 ; } // Only update the delta when collection is successful; // otherwise leave last collected in place if ( isCollectionSuccesful ) { deltaLastCollected.put( key, last ) ; } } logger.debug( "\n\n{} ====> metricId: {}, resultLong: {} \n\n", collectionResults.getServiceInstance( ).getName( ), serviceMeter.getCollectionId( ), resultLong ) ; collectionResults.addCustomResultLong( serviceMeter.getCollectionId( ), resultLong ) ; } } ) ; } private Object collectCustomMbean ( ServiceMeter serviceMeter , ServiceCollectionResults jmxResults , MBeanServerConnection mbeanConn ) throws Exception { Object jmxResultObject = 0 ; String mbeanNameCustom = serviceMeter.getMbeanName( ) ; if ( mbeanNameCustom.contains( TOMCAT_SERVLET_CONTEXT_TOKEN ) ) { // Some servlet metrics require version string in name // logger.info("****** version: " + // jmxResults.getInstanceConfig().getMavenVersion()); String version = jmxResults .getServiceInstance( ) .getMavenVersion( ) ; if ( jmxResults .getServiceInstance( ) .isScmDeployed( ) ) { version = jmxResults .getServiceInstance( ) .getScmVersion( ) ; version = version.split( " " )[0] ; // first word of // scm // scmVersion=3.5.6-SNAPSHOT // Source build // by ... } // WARNING: version must be updated when testing. String serviceContext = "//localhost/" + jmxResults .getServiceInstance( ) .getContext( ) ; // if ( !jmxResults.getServiceInstance().is_springboot_server() ) { // serviceContext += "##" + version ; // } mbeanNameCustom = mbeanNameCustom.replaceAll( TOMCAT_SERVLET_CONTEXT_TOKEN, serviceContext ) ; logger.debug( "Using custom name: {} ", mbeanNameCustom ) ; } String mbeanAttributeName = serviceMeter.getMbeanAttribute( ) ; if ( mbeanAttributeName.equals( "SystemCpuLoad" ) ) { // Reuse already collected values (load is stateful) jmxResultObject = Long.valueOf( serviceCollector.getCollected_HostCpu( ).get( 0 ).asLong( ) ) ; } else if ( mbeanAttributeName.equals( "ProcessCpuLoad" ) ) { // Reuse already collected values jmxResultObject = Long.valueOf( jmxResults.getCpuPercent( ) ) ; } else if ( serviceMeter.getCollectionId( ).equalsIgnoreCase( ServiceAlertsEnum.JAVA_HEARTBEAT ) && ! serviceCollector.isPublishSummaryAndPerformHeartBeat( ) && ! serviceCollector .isTestHeartBeat( ) ) { // special case to avoid double heartbeats // reUse collected value from earlier interval. jmxResultObject = Long.valueOf( jmxResults.getServiceInstance( ).getDefaultContainer( ) .getJmxHeartbeatMs( ) ) ; } else { logger.debug( "Collecting mbean: {}, attribute: {}", mbeanNameCustom, mbeanAttributeName ) ; jmxResultObject = mbeanConn.getAttribute( new ObjectName( mbeanNameCustom ), mbeanAttributeName ) ; } logger.debug( "Result for {} is: {}", mbeanAttributeName, jmxResultObject ) ; return jmxResultObject ; } }
csap-platform/csap-core
csap-core-service/src/main/java/org/csap/agent/stats/service/JmxCustomCollector.java
Java
mit
10,207
/* * The MIT License (MIT) * * Copyright (c) 2015 Microsoft Corporation * * -=- Robust Distributed System Nucleus (rDSN) -=- * * 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. */ /* * Description: * What is this file about? * * Revision history: * xxxx-xx-xx, author, first version * xxxx-xx-xx, author, fix bug about xxx */ # ifdef _WIN32 # define _WINSOCK_DEPRECATED_NO_WARNINGS 1 # include <Winsock2.h> # include <ws2tcpip.h> # include <Windows.h> # pragma comment(lib, "ws2_32.lib") # else # include <sys/socket.h> # include <netdb.h> # include <ifaddrs.h> # include <netinet/in.h> # include <arpa/inet.h> # if defined(__FreeBSD__) # include <netinet/in.h> # endif # endif # include <dsn/internal/ports.h> # include <dsn/service_api_c.h> # include <dsn/cpp/address.h> # include <dsn/internal/task.h> # include "group_address.h" # include "uri_address.h" namespace dsn { const rpc_address rpc_group_address::_invalid; } #ifdef _WIN32 static void net_init() { static std::once_flag flag; static bool flag_inited = false; if (!flag_inited) { std::call_once(flag, [&]() { WSADATA wsaData; WSAStartup(MAKEWORD(2, 2), &wsaData); flag_inited = true; }); } } #endif // name to ip etc. DSN_API uint32_t dsn_ipv4_from_host(const char* name) { sockaddr_in addr; memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; if ((addr.sin_addr.s_addr = inet_addr(name)) == (unsigned int)(-1)) { hostent* hp = ::gethostbyname(name); int err = # ifdef _WIN32 (int)::WSAGetLastError() # else h_errno # endif ; if (hp == nullptr) { derror("gethostbyname failed, name = %s, err = %d.", name, err); return 0; } else { memcpy( (void*)&(addr.sin_addr.s_addr), (const void*)hp->h_addr, (size_t)hp->h_length ); } } // converts from network byte order to host byte order return (uint32_t)ntohl(addr.sin_addr.s_addr); } // if network_interface is "", then return the first "eth" prefixed non-loopback ipv4 address. DSN_API uint32_t dsn_ipv4_local(const char* network_interface) { uint32_t ret = 0; # ifndef _WIN32 static const char loopback[4] = { 127, 0, 0, 1 }; struct ifaddrs* ifa = nullptr; if (getifaddrs(&ifa) == 0) { struct ifaddrs* i = ifa; while (i != nullptr) { if (i->ifa_name != nullptr && i->ifa_addr != nullptr && i->ifa_addr->sa_family == AF_INET ) { if (strcmp(i->ifa_name, network_interface) == 0 || (network_interface[0] == '\0' && strncmp(i->ifa_name, "eth", 3) == 0 && strncmp((const char*)&((struct sockaddr_in *)i->ifa_addr)->sin_addr.s_addr, loopback, 4) != 0) ) ret = (uint32_t)ntohl(((struct sockaddr_in *)i->ifa_addr)->sin_addr.s_addr); break; } i = i->ifa_next; } if (i == nullptr) { derror("get local ip from network interfaces failed, network_interface = %s\n", network_interface); } if (ifa != nullptr) { // remember to free it freeifaddrs(ifa); } } #endif return ret; } DSN_API const char* dsn_address_to_string(dsn_address_t addr) { char* p = dsn::tls_dsn.scratch_next(); auto sz = sizeof(dsn::tls_dsn.scratch_buffer[0]); struct in_addr net_addr; # ifdef _WIN32 char* ip_str; # else int ip_len; # endif switch (addr.u.v4.type) { case HOST_TYPE_IPV4: net_addr.s_addr = htonl((uint32_t)addr.u.v4.ip); # ifdef _WIN32 ip_str = inet_ntoa(net_addr); snprintf_p(p, sz, "%s:%hu", ip_str, (uint16_t)addr.u.v4.port); # else inet_ntop(AF_INET, &net_addr, p, sz); ip_len = strlen(p); snprintf_p(p + ip_len, sz - ip_len, ":%hu", (uint16_t)addr.u.v4.port); # endif break; case HOST_TYPE_URI: p = (char*)(uintptr_t)addr.u.uri.uri; break; case HOST_TYPE_GROUP: p = (char*)(((dsn::rpc_group_address*)(uintptr_t)(addr.u.group.group))->name()); break; default: p = (char*)"invalid address"; break; } return (const char*)p; } DSN_API dsn_address_t dsn_address_build( const char* host, uint16_t port ) { dsn::rpc_address addr(host, port); return addr.c_addr(); } DSN_API dsn_address_t dsn_address_build_ipv4( uint32_t ipv4, uint16_t port ) { dsn::rpc_address addr(ipv4, port); return addr.c_addr(); } DSN_API dsn_address_t dsn_address_build_group( dsn_group_t g ) { dsn::rpc_address addr; addr.assign_group(g); return addr.c_addr(); } DSN_API dsn_address_t dsn_address_build_uri( dsn_uri_t uri ) { dsn::rpc_address addr; addr.assign_uri(uri); return addr.c_addr(); } DSN_API dsn_group_t dsn_group_build(const char* name) // must be paired with release later { auto g = new ::dsn::rpc_group_address(name); return g; } DSN_API bool dsn_group_add(dsn_group_t g, dsn_address_t ep) { auto grp = (::dsn::rpc_group_address*)(g); ::dsn::rpc_address addr(ep); return grp->add(addr); } DSN_API void dsn_group_set_leader(dsn_group_t g, dsn_address_t ep) { auto grp = (::dsn::rpc_group_address*)(g); ::dsn::rpc_address addr(ep); grp->set_leader(addr); } DSN_API dsn_address_t dsn_group_get_leader(dsn_group_t g) { auto grp = (::dsn::rpc_group_address*)(g); return grp->leader().c_addr(); } DSN_API bool dsn_group_is_leader(dsn_group_t g, dsn_address_t ep) { auto grp = (::dsn::rpc_group_address*)(g); return grp->leader() == ep; } DSN_API bool dsn_group_is_update_leader_on_rpc_forward(dsn_group_t g) { auto grp = (::dsn::rpc_group_address*)(g); return grp->is_update_leader_on_rpc_forward(); } DSN_API void dsn_group_set_update_leader_on_rpc_forward(dsn_group_t g, bool v) { auto grp = (::dsn::rpc_group_address*)(g); grp->set_update_leader_on_rpc_forward(v); } DSN_API dsn_address_t dsn_group_next(dsn_group_t g, dsn_address_t ep) { auto grp = (::dsn::rpc_group_address*)(g); ::dsn::rpc_address addr(ep); return grp->next(addr).c_addr(); } DSN_API dsn_address_t dsn_group_forward_leader(dsn_group_t g) { auto grp = (::dsn::rpc_group_address*)(g); grp->leader_forward(); return grp->leader().c_addr(); } DSN_API bool dsn_group_remove(dsn_group_t g, dsn_address_t ep) { auto grp = (::dsn::rpc_group_address*)(g); ::dsn::rpc_address addr(ep); return grp->remove(addr); } DSN_API void dsn_group_destroy(dsn_group_t g) { auto grp = (::dsn::rpc_group_address*)(g); delete grp; } DSN_API dsn_uri_t dsn_uri_build(const char* url) // must be paired with destroy later { return (dsn_uri_t)new ::dsn::rpc_uri_address(url); } DSN_API void dsn_uri_destroy(dsn_uri_t uri) { delete (::dsn::rpc_uri_address*)(uri); }
ykwd/rDSN
src/core/core/address.cpp
C++
mit
8,222
#include <iostream> #include <cstdlib> #include <cassert> #include <vector> #include <stdio.h> using namespace std; //Proxy-class for [][] operation template <typename T> class Matrix_Row { private: T *row; size_t m; public: Matrix_Row<T>(T* a, size_t cnt) { row = a; m = cnt; } T& operator[](size_t i) { if (i >= m) { assert(!"index out of range"); exit(1); } return row[i]; } }; template <typename T> class Matrix { private: size_t n; //rows count size_t m; //columns count T **arr; public: Matrix (int row, int col) { arr = (T **)malloc(row * sizeof(T*) + row * col * sizeof(T)); T *buf; buf = (T*)(arr + row); for (int i = 0; i < row; ++i) { arr[i] = buf + i * col; } n = row; m = col; } size_t columns() { return m; } size_t rows() { return n; } Matrix<T>(const Matrix& mt) { int row = mt.n, col = mt.m; arr = (T **)malloc(row * sizeof(T*) + row * col * sizeof(T)); T *buf; buf = (T*)(arr + row); for (int i = 0; i < row; ++i) { arr[i] = buf + i * col; } n = row; m = col; for (size_t i = 0; i < n; ++i) { for (size_t j = 0; j < m; ++j) { arr[i][j] = mt.arr[i][j]; } } } Matrix<T>& operator=(Matrix& mt) { if (this == &mt) return *this; int row = mt.n, col = mt.m; free(arr); arr = (T **)malloc(row * sizeof(T*) + row * col * sizeof(T)); T *buf; buf = (T*)(arr + row); for (int i = 0; i < row; ++i) { arr[i] = buf + i * col; } n = row; m = col; for (size_t i = 0; i < n; ++i) { for (size_t j = 0; j < m; ++j) { arr[i][j] = mt.arr[i][j]; } } return *this; } Matrix(Matrix&& mt) { n = mt.n; m = mt.m; arr = mt.arr; mt.arr = nullptr; } Matrix& operator=(Matrix&& movied) { if (this == &movied) return *this; free(arr); arr = movied.arr; n = movied.n; m = movied.m; movied.arr = nullptr; return *this; } Matrix_Row<T> operator[](size_t i) { if (i >= n) { assert(!"index out of range"); exit(1); } return Matrix_Row<T>(arr[i], m); //m for check if column index our of range } Matrix& operator*=(vector <T> &v) { if (m != v.size()) { assert(!"the vector has an unsuitable length"); //during matrix multiplication on vector from right, vector size must be equal to matrix colimn count exit(1); } Matrix res = Matrix(n, 1); for (size_t i = 0; i < n; ++i) { res[i][0] = 0; for (size_t j = 0; j < m; ++j){ res[i][0] += arr[i][j] * v[j]; } } int row = res.n, col = res.m; free(arr); arr = (T **)malloc(row * sizeof(T*) + row * col * sizeof(T)); T *buf; buf = (T*)(arr + row); for (int i = 0; i < row; ++i) { arr[i] = buf + i * col; } n = row; m = col; for (size_t i = 0; i < n; ++i) { for (size_t j = 0; j < m; ++j) { arr[i][j] = res.arr[i][j]; } } return *this; } Matrix& operator*=(T k) { for (size_t i = 0; i < n; ++i) { for (size_t j = 0; j < m; ++j) { arr[i][j] *= k; } } return *this; } int operator==(Matrix& mt) { if (n != mt.rows() || m != mt.columns()) return 0; int flag = 1; for (size_t i = 0; i < n && flag; ++i) { for (size_t j = 0; j < m && flag; ++j) { flag = (arr[i][j] == mt[i][j]); } } return flag; } int operator!=(Matrix& mt) { return !(*this == mt); } //with_size - flag of outputing matrix sizes //format - format string for 1 element of matrix void print(int with_size, char *format) { if (with_size) { printf("%lu %lu\n", n, m); } for (size_t i = 0; i < n; ++i) { for (size_t j = 0; j < m; ++j) { printf(format, arr[i][j]); } printf("\n"); } } //print version with standart format of each element outputing void print(int with_size) { char c[] = "%lf "; print(with_size, c); } ~Matrix() { free(arr); } };
mtrempoltsev/msu_cpp_autumn_2017
homework/Zimnyukov/05/Matrix.cpp
C++
mit
4,826
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package com.azure.spring.autoconfigure.cosmos; import com.azure.cosmos.models.CosmosContainerProperties; import com.azure.spring.autoconfigure.cosmos.domain.Person; import com.azure.spring.autoconfigure.cosmos.domain.PersonRepository; import com.azure.spring.data.cosmos.core.CosmosTemplate; import com.azure.spring.data.cosmos.core.convert.MappingCosmosConverter; import com.azure.spring.data.cosmos.core.mapping.CosmosMappingContext; import com.azure.spring.data.cosmos.repository.config.EnableCosmosRepositories; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.MockitoAnnotations; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Configuration; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) public class CosmosRepositoriesAutoConfigurationUnitTest { private AnnotationConfigApplicationContext context; private CosmosTemplate cosmosTemplate; @BeforeAll public void beforeAll() { cosmosTemplate = mock(CosmosTemplate.class); CosmosMappingContext mappingContext = new CosmosMappingContext(); MappingCosmosConverter cosmosConverter = new MappingCosmosConverter(mappingContext, new ObjectMapper()); when(cosmosTemplate.getContainerProperties(any())).thenReturn(mock(CosmosContainerProperties.class)); when(cosmosTemplate.getConverter()).thenReturn(cosmosConverter); } @BeforeEach public void setUp() { MockitoAnnotations.openMocks(this); } @AfterEach public void close() { if (this.context != null) { this.context.close(); } } @Test public void testDefaultRepositoryConfiguration() throws Exception { prepareApplicationContext(TestConfiguration.class); assertNotNull(this.context.getBean(PersonRepository.class)); } @Test public void autoConfigNotKickInIfManualConfigDidNotCreateRepositories() throws Exception { prepareApplicationContext(InvalidCustomConfiguration.class); assertThrows(NoSuchBeanDefinitionException.class, () -> this.context.getBean(PersonRepository.class)); } private void prepareApplicationContext(Class<?>... configurationClasses) { this.context = new AnnotationConfigApplicationContext(); this.context.register(configurationClasses); this.context.register(CosmosRepositoriesAutoConfiguration.class); this.context.getBeanFactory().registerSingleton("cosmosTemplate", cosmosTemplate); this.context.refresh(); } @Configuration @TestAutoConfigurationPackage(Person.class) protected static class TestConfiguration { } @Configuration @EnableCosmosRepositories("foo.bar") @TestAutoConfigurationPackage(CosmosRepositoriesAutoConfigurationUnitTest.class) protected static class InvalidCustomConfiguration { } }
Azure/azure-sdk-for-java
sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/autoconfigure/cosmos/CosmosRepositoriesAutoConfigurationUnitTest.java
Java
mit
3,673
#### react flexbox component ```bash npm install react-flexify --save ``` ```js import Flex from 'react-flexify'; ``` ```html <Flex row> // flex container <Flex grow='1' shrink='2' basis='400px'>hi</Flex> // flex-item, <Flex flex='1 2 400px' tag='span'>hi</Flex> // flex-item, <span>hi</span> <div> hi </div> // normal html element <Flex column alignItems='stretch' tag='section' className='bla' data-custom='hi'> <aside>...</aside> .... </Flex> // flex-container, section.bla.fcol.f-ai-s(data-custom='hi') > aside </Flex> ``` #### Usage: ```js <Flex inline // display: inline-flex row // flex-direction, default column // flex-direction: column justifyContent='flex-start|...', alignItems='center' alignContent='center', alignSelf='auto', order='1', wrap='wrap' tag='article' // wrapper html element tag, default: 'div' grow='1' shrink='1', basis='1', flex='1 2 400px' data-custom-data // custom attrs > </Flex> ``` - All props are optional. if none of `inline|row|column` is present, then just render `this.props.children` wrapped with `tag`(default is `div`) - `inline` => flex display level, set this to change to `inline-flex`. (default is `flex`) - `row|column` => A flex container, with flex-direction: row|column; and other default rules display: flex; justify-content: space-around; align-items: center; align-content: center; flex-wrap: wrap - ... set other props to override its default value. - can also pass other props(`data-`), will be set on wrapper element
jl-/react-flexify
README.md
Markdown
mit
1,645
#include "Arduino.h" #ifndef PINS_H #define PINS_H class In { public: class Digital { public: static const byte Pulse = 0; }; class Analog { public: static const byte DutyCycle = 0; }; }; class Out { public: class Digital { public: static const byte HalfSpeed = 1; static const byte QuarterSpeed = 5; static const byte EighthSpeed = 9; }; class Analog { public: }; }; #endif
renaudbedard/littlebits-arduino
Sketches/UberLatch/Pins.h
C
mit
479
<?php include('class.phpmailer.php'); $mail = new PHPMailer(); $mail->IsHTML(true); $mail->IsSMTP(); $mail->SMTPAuth = true; $mail->SMTPSecure = "ssl"; $mail->Host = "smtp.gmail.com"; $mail->Port = 465; $mail->Username = "Xarafire"; $mail->Password = "symwe!@#123"; $fromname = "Asiimwe Apollo Abraham"; $To = trim($email,"\r\n"); $tContent = ''; $abcd="Stuff is Hard"; $tContent .="<table width='550px' colspan='2' cellpadding='4'> <tr><td align='center'><img src='imgpath' width='100' height='100'></td></tr> <tr><td height='20'>&nbsp;</td></tr> <tr> <td> <table cellspacing='1' cellpadding='1' width='100%' height='100%'> <tr><td align='center'><h2>Hello World<h2></td></tr/> <tr><td>&nbsp;</td></tr> <tr><td align='center'>Name: ".trim(NAME,"\r\n")."</td></tr> <tr><td align='center'>ABCD TEXT: ".$abcd."</td></tr> <tr><td>&nbsp;</td></tr> </table> </td> </tr> </table>"; $mail->From = "aasiimwe@dcareug.com"; $mail->FromName = $fromname; $mail->Subject = "John Doe"; $mail->Body = $tContent; $mail->AddAddress($To); $mail->set('X-Priority', '1'); //Priority 1 = High, 3 = Normal, 5 = low $mail->Send();
aasiimweDataCare/Dev_ftf
Dev_CPM/testMail.php
PHP
mit
1,437
<template> <div class="slide" style="display: flex; width: 100%;"> <div class="slide-content" style="display: flex; width: 100%;"> <div class="live-code" style="display: flex; width: 100%;" data-entry-path="demos/demo-tessel-webcam" data-output-path="tmp/demo-tessel-webcam"> <div class="split-pane fixed-left"> <div class="split-pane-component" style="width: 20em; background: black; display: flex; align-items: center;"> <canvas data-type="webcam" data-source="#webcam-video" style="width: 100%;"></canvas> </div> <div class="split-pane-divider divider" style="background: #aaa; left: 20em; width: 5px;"></div> <div class="split-pane-component" style="left: 20em; margin-left: 5px; display: flex; flex-direction: column;"> <ul class="nav nav-tabs" role="tablist"> <li class="nav-item"><a class="nav-link" href="#" aria-controls="index.js" role="tab">index.js</a></li> <li class="nav-item"><a class="nav-link" href="#" aria-controls="terminal" role="tab">Terminal</a></li> </ul> <div class="tab-content" style="height: 100%; overflow: auto;"> <div role="tabpanel" class="tab-pane" data-tab-id="index.js" style="position: relative;"> <textarea data-type="code" data-mode="javascript" data-language="javascript" data-file="index.js"></textarea> </div> <div role="tabpanel" class="tab-pane tab-pane-full-height" data-tab-id="terminal" style="position: relative;"> <div data-type="terminal" data-dir="tmp/demo-tessel-webcam" data-autorun="CXXFLAGS='-mmacosx-version-min=10.9' LDFLAGS='-mmacosx-version-min=10.9' yarn"></div> </div> </div> <div class="btn-group" role="group" style="position: absolute; top: 0; right: 0; z-index: 10;"> <button type="button" data-target="all" data-type="save-button" class="btn btn-secondary"><i class="fa fa-4x fa-save"></i></button> </div> </div> </div> </div> </div> </div> <script type="text/template"> ($slideHolder => { const LiveCodeSlide = require('LiveCodeSlide').default; const init = () => { const liveCode = new LiveCodeSlide($slideHolder, {}, () => { //livecode created callback }); //manual manage tabs, as we don't want to work with element ids $slideHolder.find(`a[role=tab]`).click(e => { e.preventDefault(); const tabId = $(e.target).attr(`aria-controls`); const $tab = $slideHolder.find(`[data-tab-id="${tabId}"]`); $slideHolder.find(`.nav-tabs .active, .tab-content .active`).removeClass(`active`); $(e.target).addClass(`active`); $tab.addClass(`active`); liveCode.layout(); }); //enable split pane $slideHolder.find(`div.split-pane`).splitPane(); $slideHolder.find(`div.split-pane`).on(`resize`, () => liveCode.layout()); //select the first tab requestAnimationFrame(() => $slideHolder.find(`a[role=tab]`).first().click()); } init(); })(document.$slideHolder); </script><img onLoad="var s = document.createElement('script'); s.innerHTML = this.previousSibling.innerHTML; document.$slideHolder = $(this).closest('.slide-frame'); this.parentNode.appendChild(s);" style="display: none;" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="/> </template>
wouterverweirder/javascript-workout
dist/presentation/slides/keynote.062.desktop.html
HTML
mit
3,446
#line 1 "src/readstat_por_parse.rl" #include "readstat.h" #include "readstat_por_parse.h" #include <unistd.h> #line 10 "src/readstat_por_parse.c" static const int por_field_parse_start = 1; static const int por_field_parse_en_main = 1; #line 9 "src/readstat_por_parse.rl" int readstat_por_parse_double(const char *data, size_t len, double *result, readstat_error_handler error_cb, void *user_ctx) { int retval = 0; double val = 0.0; long num = 0; long frac = 0; long exp = 0; long temp_val = 0; long frac_len = 0; const unsigned char *val_start = NULL; const unsigned char *p = (const unsigned char *)data; const unsigned char *eof = p + len; int cs; int is_negative = 0, exp_is_negative = 0; int success = 0; #line 40 "src/readstat_por_parse.c" { cs = por_field_parse_start; } #line 45 "src/readstat_por_parse.c" { switch ( cs ) { st1: p += 1; case 1: switch( (*p) ) { case 32: goto st1; case 42: goto st2; case 45: goto st3; case 46: goto st4; } if ( (*p) > 57 ) { if ( 65 <= (*p) && (*p) <= 84 ) goto tr5; } else if ( (*p) >= 48 ) goto tr5; goto st0; st0: cs = 0; goto _out; st2: p += 1; case 2: if ( (*p) == 46 ) goto tr6; goto st0; tr6: #line 51 "src/readstat_por_parse.rl" { success = 1; {p++; cs = 12; goto _out;} } goto st12; st12: p += 1; case 12: #line 80 "src/readstat_por_parse.c" goto st0; st3: p += 1; case 3: if ( (*p) == 46 ) goto tr7; if ( (*p) > 57 ) { if ( 65 <= (*p) && (*p) <= 84 ) goto tr8; } else if ( (*p) >= 48 ) goto tr8; goto st0; tr7: #line 47 "src/readstat_por_parse.rl" { is_negative = 1; } goto st4; st4: p += 1; case 4: #line 100 "src/readstat_por_parse.c" if ( (*p) > 57 ) { if ( 65 <= (*p) && (*p) <= 84 ) goto tr9; } else if ( (*p) >= 48 ) goto tr9; goto st0; tr9: #line 40 "src/readstat_por_parse.rl" { temp_val = 0; val_start = p; } #line 32 "src/readstat_por_parse.rl" { if ((*p) >= '0' && (*p) <= '9') { temp_val = 30 * temp_val + ((*p) - '0'); } else if ((*p) >= 'A' && (*p) <= 'T') { temp_val = 30 * temp_val + (10 + (*p) - 'A'); } } goto st5; tr11: #line 32 "src/readstat_por_parse.rl" { if ((*p) >= '0' && (*p) <= '9') { temp_val = 30 * temp_val + ((*p) - '0'); } else if ((*p) >= 'A' && (*p) <= 'T') { temp_val = 30 * temp_val + (10 + (*p) - 'A'); } } goto st5; st5: p += 1; case 5: #line 132 "src/readstat_por_parse.c" if ( (*p) == 47 ) goto tr10; if ( (*p) > 57 ) { if ( 65 <= (*p) && (*p) <= 84 ) goto tr11; } else if ( (*p) >= 48 ) goto tr11; goto st0; tr10: #line 42 "src/readstat_por_parse.rl" { frac = temp_val; frac_len = (p - val_start); } #line 51 "src/readstat_por_parse.rl" { success = 1; {p++; cs = 13; goto _out;} } goto st13; tr15: #line 44 "src/readstat_por_parse.rl" { num = temp_val; } #line 51 "src/readstat_por_parse.rl" { success = 1; {p++; cs = 13; goto _out;} } goto st13; tr18: #line 45 "src/readstat_por_parse.rl" { exp = temp_val; } #line 51 "src/readstat_por_parse.rl" { success = 1; {p++; cs = 13; goto _out;} } goto st13; st13: p += 1; case 13: #line 162 "src/readstat_por_parse.c" goto st0; tr5: #line 40 "src/readstat_por_parse.rl" { temp_val = 0; val_start = p; } #line 32 "src/readstat_por_parse.rl" { if ((*p) >= '0' && (*p) <= '9') { temp_val = 30 * temp_val + ((*p) - '0'); } else if ((*p) >= 'A' && (*p) <= 'T') { temp_val = 30 * temp_val + (10 + (*p) - 'A'); } } goto st6; tr8: #line 44 "src/readstat_por_parse.rl" { is_negative = 1; } #line 40 "src/readstat_por_parse.rl" { temp_val = 0; val_start = p; } #line 32 "src/readstat_por_parse.rl" { if ((*p) >= '0' && (*p) <= '9') { temp_val = 30 * temp_val + ((*p) - '0'); } else if ((*p) >= 'A' && (*p) <= 'T') { temp_val = 30 * temp_val + (10 + (*p) - 'A'); } } goto st6; tr16: #line 32 "src/readstat_por_parse.rl" { if ((*p) >= '0' && (*p) <= '9') { temp_val = 30 * temp_val + ((*p) - '0'); } else if ((*p) >= 'A' && (*p) <= 'T') { temp_val = 30 * temp_val + (10 + (*p) - 'A'); } } goto st6; st6: p += 1; case 6: #line 203 "src/readstat_por_parse.c" switch( (*p) ) { case 43: goto tr12; case 45: goto tr13; case 46: goto tr14; case 47: goto tr15; } if ( (*p) > 57 ) { if ( 65 <= (*p) && (*p) <= 84 ) goto tr16; } else if ( (*p) >= 48 ) goto tr16; goto st0; tr12: #line 44 "src/readstat_por_parse.rl" { num = temp_val; } goto st7; tr22: #line 42 "src/readstat_por_parse.rl" { frac = temp_val; frac_len = (p - val_start); } goto st7; st7: p += 1; case 7: #line 227 "src/readstat_por_parse.c" if ( (*p) > 57 ) { if ( 65 <= (*p) && (*p) <= 84 ) goto tr17; } else if ( (*p) >= 48 ) goto tr17; goto st0; tr17: #line 40 "src/readstat_por_parse.rl" { temp_val = 0; val_start = p; } #line 32 "src/readstat_por_parse.rl" { if ((*p) >= '0' && (*p) <= '9') { temp_val = 30 * temp_val + ((*p) - '0'); } else if ((*p) >= 'A' && (*p) <= 'T') { temp_val = 30 * temp_val + (10 + (*p) - 'A'); } } goto st8; tr19: #line 32 "src/readstat_por_parse.rl" { if ((*p) >= '0' && (*p) <= '9') { temp_val = 30 * temp_val + ((*p) - '0'); } else if ((*p) >= 'A' && (*p) <= 'T') { temp_val = 30 * temp_val + (10 + (*p) - 'A'); } } goto st8; tr20: #line 45 "src/readstat_por_parse.rl" { exp_is_negative = 1; } #line 40 "src/readstat_por_parse.rl" { temp_val = 0; val_start = p; } #line 32 "src/readstat_por_parse.rl" { if ((*p) >= '0' && (*p) <= '9') { temp_val = 30 * temp_val + ((*p) - '0'); } else if ((*p) >= 'A' && (*p) <= 'T') { temp_val = 30 * temp_val + (10 + (*p) - 'A'); } } goto st8; st8: p += 1; case 8: #line 273 "src/readstat_por_parse.c" if ( (*p) == 47 ) goto tr18; if ( (*p) > 57 ) { if ( 65 <= (*p) && (*p) <= 84 ) goto tr19; } else if ( (*p) >= 48 ) goto tr19; goto st0; tr13: #line 44 "src/readstat_por_parse.rl" { num = temp_val; } goto st9; tr23: #line 42 "src/readstat_por_parse.rl" { frac = temp_val; frac_len = (p - val_start); } goto st9; st9: p += 1; case 9: #line 293 "src/readstat_por_parse.c" if ( (*p) > 57 ) { if ( 65 <= (*p) && (*p) <= 84 ) goto tr20; } else if ( (*p) >= 48 ) goto tr20; goto st0; tr14: #line 44 "src/readstat_por_parse.rl" { num = temp_val; } goto st10; st10: p += 1; case 10: #line 307 "src/readstat_por_parse.c" if ( (*p) > 57 ) { if ( 65 <= (*p) && (*p) <= 84 ) goto tr21; } else if ( (*p) >= 48 ) goto tr21; goto st0; tr21: #line 40 "src/readstat_por_parse.rl" { temp_val = 0; val_start = p; } #line 32 "src/readstat_por_parse.rl" { if ((*p) >= '0' && (*p) <= '9') { temp_val = 30 * temp_val + ((*p) - '0'); } else if ((*p) >= 'A' && (*p) <= 'T') { temp_val = 30 * temp_val + (10 + (*p) - 'A'); } } goto st11; tr24: #line 32 "src/readstat_por_parse.rl" { if ((*p) >= '0' && (*p) <= '9') { temp_val = 30 * temp_val + ((*p) - '0'); } else if ((*p) >= 'A' && (*p) <= 'T') { temp_val = 30 * temp_val + (10 + (*p) - 'A'); } } goto st11; st11: p += 1; case 11: #line 339 "src/readstat_por_parse.c" switch( (*p) ) { case 43: goto tr22; case 45: goto tr23; case 47: goto tr10; } if ( (*p) > 57 ) { if ( 65 <= (*p) && (*p) <= 84 ) goto tr24; } else if ( (*p) >= 48 ) goto tr24; goto st0; } if ( p == eof ) { switch ( cs ) { case 12: #line 49 "src/readstat_por_parse.rl" { val = NAN; } break; #line 360 "src/readstat_por_parse.c" } } _out: {} } #line 55 "src/readstat_por_parse.rl" val = 1.0 * num; if (frac_len) val += frac / pow(30.0, frac_len); if (exp_is_negative) exp *= -1; if (exp) { val *= pow(10.0, exp); } if (is_negative) val *= -1; if (!success) { retval = -1; if (error_cb) { char error_buf[1024]; snprintf(error_buf, sizeof(error_buf), "Read bytes: %ld Ending state: %d\n", (long)(p - (const unsigned char *)data), cs); error_cb(error_buf, user_ctx); } } if (retval == 0) { if (result) *result = val; retval = (p - (const unsigned char *)data); } /* suppress warning */ (void)por_field_parse_en_main; return retval; }
karissa/ReadStat
src/readstat_por_parse.c
C
mit
8,862
export namespace StorageUtils { let hasLocalStorageCache: boolean; export function hasLocalStorage(): boolean { if (hasLocalStorageCache) { return hasLocalStorageCache; } // hasLocalStorage is used to safely ensure we can use localStorage // taken from https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#Feature-detecting_localStorage let storage: any = { length: 0 }; try { storage = window['localStorage']; let x = '__storage_test__'; storage.setItem(x, x); storage.removeItem(x); hasLocalStorageCache = true; } catch (e) { hasLocalStorageCache = e instanceof DOMException && ( // everything except Firefox e.code === 22 || // Firefox e.code === 1014 || // test name field too, because code might not be present // everything except Firefox e.name === 'QuotaExceededError' || // Firefox e.name === 'NS_ERROR_DOM_QUOTA_REACHED') && // acknowledge QuotaExceededError only if there's something already stored storage.length !== 0; } return hasLocalStorageCache; } /** * Stores a string item into localStorage. * @param key the item's key * @param data the item's data */ export function setItem(key: string, data: string): void { if (StorageUtils.hasLocalStorage()) { window.localStorage.setItem(key, data); } } /** * Gets an item's string value from the localStorage. * @param key the key to look up its associated value * @return {string | null} Returns the string if found, null if there is no data stored for the key */ export function getItem(key: string): string | null { if (StorageUtils.hasLocalStorage()) { return window.localStorage.getItem(key); } else { return null; } } /** * Stores an object into localStorage. The object will be serialized to JSON. The following types are supported * in addition to the default types: * - ColorUtils.Color * * @param key the key to store the data to * @param data the object to store */ export function setObject<T>(key: string, data: T): void { if (StorageUtils.hasLocalStorage()) { let json = JSON.stringify(data); setItem(key, json); } } /** * Gets an object for the given key from localStorage. The object will be deserialized from JSON. Beside the * default types, the following types are supported: * - ColorUtils.Color * * @param key the key to look up its associated object * @return {any} Returns the object if found, null otherwise */ export function getObject<T>(key: string): T { if (StorageUtils.hasLocalStorage()) { let json = getItem(key); if (key) { let object = JSON.parse(json); return <T>object; } } return null; } }
bitmovin/bitmovin-player-ui
src/ts/storageutils.ts
TypeScript
mit
2,905
--- layout: page title: Hogan Group Dinner date: 2016-05-24 author: Joseph Escobar tags: weekly links, java status: published summary: Mauris non leo magna. Aliquam fermentum tristique nunc, eget vulputate. banner: images/banner/leisure-03.jpg booking: startDate: 08/22/2019 endDate: 08/27/2019 ctyhocn: BTRDNHX groupCode: HGD published: true --- Fusce pellentesque vulputate mauris sed bibendum. Mauris dapibus rhoncus nulla, vestibulum vehicula dolor rutrum in. Cras ultricies tortor sit amet sem tincidunt vulputate. Sed volutpat sem et nisi elementum laoreet id id sem. Duis sagittis dictum faucibus. Maecenas consectetur venenatis ligula at porta. Curabitur tincidunt eros eu turpis egestas pretium. Curabitur sit amet arcu dignissim, mattis justo quis, faucibus tellus. 1 Nulla vel metus vel orci sodales ornare 1 Cras facilisis ex at commodo dapibus 1 Duis ac turpis porta, tempor augue et, gravida ipsum 1 Nullam eleifend ex sit amet finibus convallis. In hac habitasse platea dictumst. Nulla imperdiet condimentum odio a hendrerit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla porttitor pulvinar tortor, vitae gravida turpis vestibulum ut. Mauris congue nibh vel augue tempor, sit amet pretium quam dignissim. Vivamus nec tellus sit amet enim egestas tristique at a lorem. Pellentesque ornare mauris quis tellus volutpat dignissim. Suspendisse consectetur ac ligula ut efficitur. Sed semper at justo et iaculis. Praesent vel risus vitae diam venenatis rhoncus. Etiam vulputate est vitae dapibus efficitur. Vestibulum in metus id risus vehicula convallis. Pellentesque at consequat augue. Cras aliquet auctor sodales. Donec et fringilla odio, eget elementum erat. Suspendisse vitae odio dui.
KlishGroup/prose-pogs
pogs/B/BTRDNHX/HGD/index.md
Markdown
mit
1,728
--- layout: page title: Valley Dragon Industries Dinner date: 2016-05-24 author: Christina Silva tags: weekly links, java status: published summary: Nam ullamcorper neque in varius volutpat. Cras vitae ex. banner: images/banner/office-01.jpg booking: startDate: 09/21/2017 endDate: 09/25/2017 ctyhocn: PORINHX groupCode: VDID published: true --- Donec sed ipsum bibendum, bibendum justo vitae, pulvinar elit. Proin ultrices tellus in sapien efficitur varius. In consectetur suscipit ex non volutpat. Praesent nisi ex, sagittis vitae arcu ac, ornare laoreet odio. Quisque eu interdum mi, ut bibendum tellus. Proin fringilla eleifend viverra. Cras efficitur diam augue, at egestas ligula ultricies eget. Nam ut hendrerit sem, non gravida lacus. Nullam vulputate suscipit tellus, eget maximus nisi viverra et. Curabitur nec erat ut lacus lacinia luctus. Donec ornare posuere commodo. Nam mattis ac sapien a condimentum. Phasellus scelerisque eleifend tellus a fermentum. Maecenas placerat erat ut erat venenatis, quis dictum augue scelerisque. Fusce lobortis est in interdum pharetra. * Vestibulum id sem dictum, ultricies lorem semper, sodales lectus * Morbi efficitur sapien vitae lobortis varius * Curabitur at nisl eu ex mattis congue * Nullam luctus mi sodales ex convallis bibendum * Curabitur ac tellus nec libero sollicitudin pulvinar id non velit. Proin aliquam felis ac ante iaculis tincidunt. Aenean viverra justo quam, eget bibendum elit dignissim molestie. Donec non dolor molestie elit porttitor maximus. Mauris eleifend eleifend felis id cursus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vestibulum accumsan diam risus, sed dapibus nunc volutpat ultrices. Morbi placerat pulvinar sollicitudin. Nulla tincidunt scelerisque leo vel egestas. Etiam ac orci quis sem semper interdum sed sed augue. Mauris sed orci ligula. In venenatis sagittis laoreet. Nulla fringilla ipsum mollis urna fermentum, ac aliquet est consequat. Sed et nunc odio. In sit amet ex ac est facilisis convallis. Maecenas cursus molestie ipsum. Ut rutrum est sit amet lacus suscipit, eu pulvinar sem congue. Etiam eu odio semper, consequat diam et, volutpat nisi. Curabitur vitae lacus eros. Suspendisse vel purus orci. Cras consequat interdum elementum. Sed urna ante, aliquet id eleifend id, ornare et mi. Mauris eu lorem purus. Duis magna ex, mattis a nulla eget, aliquet hendrerit enim. Aenean gravida risus enim, ut aliquet felis semper ac.
KlishGroup/prose-pogs
pogs/P/PORINHX/VDID/index.md
Markdown
mit
2,485
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using System.Drawing; using System.Drawing.Imaging; using System.Threading; using System.Text; namespace BrowserNatives { class Maximize { //Consts const int SW_SHOWMAXIMIZED = 3; //Imports [DllImport("user32.dll")] static extern bool IsZoomed (IntPtr hWnd); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool ShowWindow (IntPtr hWnd, int nCmdShow); //Methods static void MaximizeWindow (IntPtr hWnd) { using (new ForegroundWindowGuard()) ShowWindow(hWnd, SW_SHOWMAXIMIZED); } static void CheckIsWindowMaximized (IntPtr hWnd) { Console.Out.WriteLine(IsZoomed(hWnd)); } static void Main (string[] args) { if (args.Length == 0 || args.Length > 2) { Console.Error.Write("Incorrect arguments"); Environment.Exit(1); } IntPtr hWnd = (IntPtr)int.Parse(args[0]); bool isStatusQuery = false; if (args.Length == 2) { if (args[1] == "status") isStatusQuery = true; else { Console.Error.Write("Incorrect arguments"); Environment.Exit(1); } } if (isStatusQuery) CheckIsWindowMaximized(hWnd); else MaximizeWindow(hWnd); } } }
AndreyBelym/testcafe-browser-tools
src/natives/maximize/win/Maximize.cs
C#
mit
1,625
package fr.rohichi.engine3d; public class Pair { public int x; public int y; }
Rohichi/3DEngine
src/fr/rohichi/engine3d/Pair.java
Java
mit
88
package info.pinlab.ttada.dbcache; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class SqliteConnectionWrapper { private final String url; Connection conn = null; Statement statement = null; private String tableName = "pinjson"; private SqliteConnectionWrapper(String url) throws SQLException{ try { Class.forName("org.sqlite.JDBC"); } catch (ClassNotFoundException e) { throw new IllegalStateException("DB can't be loaded!"); } this.url = url; conn = DriverManager.getConnection(this.url); this.statement = conn.createStatement(); if(isTableExists()){ //-- great, do nothing --// }else{ this.statement.executeUpdate("create table " + tableName +" (id integer, json string)"); } } private boolean isTableExists() throws SQLException{ DatabaseMetaData meta = conn.getMetaData(); ResultSet tables = meta.getTables(null, null, null, new String[] {"TABLE"}); while(tables.next()){ if(tableName.equals(tables.getString("TABLE_NAME"))){ return true; } } return false; } public String readJsonString(String id){ return null; } /** * Updates or creates json data with given id. * * @param id for json string * @param json the json string (escaped) * @return the id */ public String updateJsonString(String id, String json){ return null; } public boolean close(){ try{ if(!conn.isClosed()){ conn.close(); return true; } }catch(SQLException log){ //-- ignore --// } return false; } public static class SqliteConnectionBuilder{ String name = null; String path = null; //-- DB save path - if exists public SqliteConnectionBuilder setDbName(String name){ this.name = name; return this; } public SqliteConnectionBuilder setDbPath(String path){ this.path = path; return this; } public SqliteConnectionWrapper build(){ if (name == null){ throw new IllegalStateException("DB name can't be null!"); } SqliteConnectionWrapper conn = null; try{ conn = new SqliteConnectionWrapper("jdbc:sqlite:sample.db" + name); }catch(SQLException e){ throw new IllegalStateException("DB error: '" + e.getMessage() + "'"); } return conn; } } }
kinokocchi/Ttada
parent/dbcache/src/main/java/info/pinlab/ttada/dbcache/SqliteConnectionWrapper.java
Java
mit
2,370
'use strict'; // 서비스 단위 테스트 describe('서비스 단위 테스트', function() { beforeEach(module('myApp.services')); describe('버전 서비스 테스트', function() { it('현재 버전 반환', inject(function(version) { expect(version).toEqual('0.1'); })); }); });
eu81273/angularjs-testing-example
test/unit/servicesSpec.js
JavaScript
mit
313
<?php namespace AMQPy; use AMQPEnvelope; use AMQPQueue; use AMQPy\Client\Delivery; use AMQPy\Serializers\Exceptions\SerializerException; use AMQPy\Serializers\SerializersPool; use AMQPy\Support\DeliveryBuilder; use Exception; abstract class AbstractListener { private $queue; private $serializers; private $builder; private $read_timeout; public function __construct(AMQPQueue $queue, SerializersPool $serializers_pool, DeliveryBuilder $delivery_builder) { $this->serializers = $serializers_pool; $this->queue = $queue; $this->builder = $delivery_builder; } public function getQueue() { return $this->queue; } public function getSerializers() { return $this->serializers; } public function getBuilder() { return $this->builder; } public function isEndless() { return !$this->queue->getConnection()->getReadTimeout(); } public function setEndless($is_endless) { $is_endless = (bool)$is_endless; if ($this->isEndless() === $is_endless) { return $is_endless; } if ($is_endless) { $this->read_timeout = $this->queue->getConnection()->getReadTimeout(); $this->queue->getConnection()->setReadTimeout(0); } else { if ($this->read_timeout) { $this->queue->getConnection()->setReadTimeout($this->read_timeout); $this->read_timeout = null; } } return $is_endless; } public function get($auto_ack = false) { $envelope = $this->queue->get($auto_ack ? AMQP_AUTOACK : AMQP_NOPARAM); if ($envelope) { $delivery = $this->builder->build($envelope); } else { $delivery = null; } return $delivery; } /** * Attach consumer to process payload from queue * * @param AbstractConsumer $consumer Consumer to process payload and handle possible errors * @param bool $auto_ack Should message been acknowledged upon receive * * @return mixed * * @throws SerializerException * @throws Exception Any exception from pre/post-consume handlers and from exception handler */ public function consume(AbstractConsumer $consumer, $auto_ack = false) { if (!$consumer->active()) { // prevent dirty consumer been listening on queue return; } $outside_error = null; try { $consumer->begin($this); $this->queue->consume( function (AMQPEnvelope $envelope /*, AMQPQueue $queue*/) use ($consumer) { $delivery = $this->builder->build($envelope); $this->feed($delivery, $consumer); return $consumer->active(); }, $auto_ack ? AMQP_AUTOACK : AMQP_NOPARAM ); } catch (Exception $e) { $outside_error = $e; } try { $this->queue->cancel(); } catch (Exception $e) { } $consumer->end($this, $outside_error); if ($outside_error) { throw $outside_error; } } abstract public function feed(Delivery $delivery, AbstractConsumer $consumer); public function accept(Delivery $delivery) { return $this->queue->ack($delivery->getEnvelope()->getDeliveryTag()); } public function resend(Delivery $delivery) { $this->queue->nack($delivery->getEnvelope()->getDeliveryTag(), AMQP_REQUEUE); } public function drop(Delivery $delivery) { $this->queue->nack($delivery->getEnvelope()->getDeliveryTag()); } }
pinepain/amqpy
src/AMQPy/AbstractListener.php
PHP
mit
3,816
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution { // Complete the marsExploration function below. static int marsExploration(String s) { int count = 0; char[] c = s.toCharArray(); for(int i=0;i<c.length-2;i+=3) { if(c[i]!='S') count++; if(c[i+1]!='O') count++; if(c[i+2]!='S') count++; } return count; } private static final Scanner scanner = new Scanner(System.in); public static void main(String[] args) throws IOException { BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH"))); String s = scanner.nextLine(); int result = marsExploration(s); bufferedWriter.write(String.valueOf(result)); bufferedWriter.newLine(); bufferedWriter.close(); scanner.close(); } }
dusadpiyush96/Competetive
HackerRank/Algorithm/Strings/MarsExploration.java
Java
mit
1,004
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Drawing.Drawing2D; using Common; namespace CustomControls { public partial class PasswordMeter : UserControl { private string password; private LinearGradientBrush brush = null; #region Color Array private Color[] Colors = { Color.FromArgb(255,255,0,0), Color.FromArgb(255,255,1,0), Color.FromArgb(255,255,2,0), Color.FromArgb(255,255,4,0), Color.FromArgb(255,255,5,0), Color.FromArgb(255,255,6,0), Color.FromArgb(255,255,7,0), Color.FromArgb(255,255,8,0), Color.FromArgb(255,255,10,0), Color.FromArgb(255,255,11,0), Color.FromArgb(255,255,12,0), Color.FromArgb(255,255,13,0), Color.FromArgb(255,255,15,0), Color.FromArgb(255,255,16,0), Color.FromArgb(255,255,17,0), Color.FromArgb(255,255,19,0), Color.FromArgb(255,255,20,0), Color.FromArgb(255,255,21,0), Color.FromArgb(255,255,22,0), Color.FromArgb(255,255,23,0), Color.FromArgb(255,255,25,0), Color.FromArgb(255,255,26,0), Color.FromArgb(255,255,27,0), Color.FromArgb(255,255,28,0), Color.FromArgb(255,255,30,0), Color.FromArgb(255,255,31,0), Color.FromArgb(255,255,32,0), Color.FromArgb(255,255,34,0), Color.FromArgb(255,255,35,0), Color.FromArgb(255,255,36,0), Color.FromArgb(255,255,37,0), Color.FromArgb(255,255,38,0), Color.FromArgb(255,255,40,0), Color.FromArgb(255,255,41,0), Color.FromArgb(255,255,42,0), Color.FromArgb(255,255,43,0), Color.FromArgb(255,255,44,0), Color.FromArgb(255,255,46,0), Color.FromArgb(255,255,47,0), Color.FromArgb(255,255,48,0), Color.FromArgb(255,255,49,0), Color.FromArgb(255,255,51,0), Color.FromArgb(255,255,52,0), Color.FromArgb(255,255,53,0), Color.FromArgb(255,255,55,0), Color.FromArgb(255,255,56,0), Color.FromArgb(255,255,57,0), Color.FromArgb(255,255,58,0), Color.FromArgb(255,255,59,0), Color.FromArgb(255,255,61,0), Color.FromArgb(255,255,62,0), Color.FromArgb(255,255,63,0), Color.FromArgb(255,255,64,0), Color.FromArgb(255,255,66,0), Color.FromArgb(255,255,67,0), Color.FromArgb(255,255,68,0), Color.FromArgb(255,255,70,0), Color.FromArgb(255,255,71,0), Color.FromArgb(255,255,72,0), Color.FromArgb(255,255,73,0), Color.FromArgb(255,255,74,0), Color.FromArgb(255,255,76,0), Color.FromArgb(255,255,77,0), Color.FromArgb(255,255,78,0), Color.FromArgb(255,255,80,0), Color.FromArgb(255,255,81,0), Color.FromArgb(255,255,82,0), Color.FromArgb(255,255,83,0), Color.FromArgb(255,255,85,0), Color.FromArgb(255,255,86,0), Color.FromArgb(255,255,87,0), Color.FromArgb(255,255,88,0), Color.FromArgb(255,255,89,0), Color.FromArgb(255,255,91,0), Color.FromArgb(255,255,92,0), Color.FromArgb(255,255,93,0), Color.FromArgb(255,255,95,0), Color.FromArgb(255,255,96,0), Color.FromArgb(255,255,97,0), Color.FromArgb(255,255,98,0), Color.FromArgb(255,255,100,0), Color.FromArgb(255,255,101,0), Color.FromArgb(255,255,102,0), Color.FromArgb(255,255,103,0), Color.FromArgb(255,255,104,0), Color.FromArgb(255,255,106,0), Color.FromArgb(255,255,107,0), Color.FromArgb(255,255,108,0), Color.FromArgb(255,255,110,0), Color.FromArgb(255,255,111,0), Color.FromArgb(255,255,112,0), Color.FromArgb(255,255,113,0), Color.FromArgb(255,255,115,0), Color.FromArgb(255,255,116,0), Color.FromArgb(255,255,117,0), Color.FromArgb(255,255,118,0), Color.FromArgb(255,255,119,0), Color.FromArgb(255,255,121,0), Color.FromArgb(255,255,122,0), Color.FromArgb(255,255,123,0), Color.FromArgb(255,255,124,0), Color.FromArgb(255,255,125,0), Color.FromArgb(255,255,127,0), Color.FromArgb(255,255,128,0), Color.FromArgb(255,255,129,0), Color.FromArgb(255,255,131,0), Color.FromArgb(255,255,132,0), Color.FromArgb(255,255,133,0), Color.FromArgb(255,255,134,0), Color.FromArgb(255,255,136,0), Color.FromArgb(255,255,137,0), Color.FromArgb(255,255,138,0), Color.FromArgb(255,255,139,0), Color.FromArgb(255,255,140,0), Color.FromArgb(255,255,142,0), Color.FromArgb(255,255,143,0), Color.FromArgb(255,255,144,0), Color.FromArgb(255,255,146,0), Color.FromArgb(255,255,147,0), Color.FromArgb(255,255,148,0), Color.FromArgb(255,255,149,0), Color.FromArgb(255,255,151,0), Color.FromArgb(255,255,152,0), Color.FromArgb(255,255,153,0), Color.FromArgb(255,255,154,0), Color.FromArgb(255,255,155,0), Color.FromArgb(255,255,155,0), Color.FromArgb(255,255,156,0), Color.FromArgb(255,255,157,0), Color.FromArgb(255,255,158,0), Color.FromArgb(255,255,159,0), Color.FromArgb(255,255,159,0), Color.FromArgb(255,255,160,0), Color.FromArgb(255,255,161,0), Color.FromArgb(255,255,162,0), Color.FromArgb(255,255,163,0), Color.FromArgb(255,255,163,0), Color.FromArgb(255,255,164,0), Color.FromArgb(255,255,165,0), Color.FromArgb(255,255,166,0), Color.FromArgb(255,255,167,0), Color.FromArgb(255,255,167,0), Color.FromArgb(255,255,168,0), Color.FromArgb(255,255,169,0), Color.FromArgb(255,255,170,0), Color.FromArgb(255,255,171,0), Color.FromArgb(255,255,171,0), Color.FromArgb(255,255,172,0), Color.FromArgb(255,255,173,0), Color.FromArgb(255,255,174,0), Color.FromArgb(255,255,175,0), Color.FromArgb(255,255,175,0), Color.FromArgb(255,255,176,0), Color.FromArgb(255,255,177,0), Color.FromArgb(255,255,178,0), Color.FromArgb(255,255,179,0), Color.FromArgb(255,255,179,0), Color.FromArgb(255,255,180,0), Color.FromArgb(255,255,181,0), Color.FromArgb(255,255,181,0), Color.FromArgb(255,255,182,0), Color.FromArgb(255,255,183,0), Color.FromArgb(255,255,184,0), Color.FromArgb(255,255,185,0), Color.FromArgb(255,255,185,0), Color.FromArgb(255,255,186,0), Color.FromArgb(255,255,187,0), Color.FromArgb(255,255,188,0), Color.FromArgb(255,255,189,0), Color.FromArgb(255,255,189,0), Color.FromArgb(255,255,190,0), Color.FromArgb(255,255,191,0), Color.FromArgb(255,255,192,0), Color.FromArgb(255,255,193,0), Color.FromArgb(255,255,193,0), Color.FromArgb(255,255,194,0), Color.FromArgb(255,255,195,0), Color.FromArgb(255,255,196,0), Color.FromArgb(255,255,197,0), Color.FromArgb(255,255,197,0), Color.FromArgb(255,255,198,0), Color.FromArgb(255,255,199,0), Color.FromArgb(255,255,200,0), Color.FromArgb(255,255,201,0), Color.FromArgb(255,255,201,0), Color.FromArgb(255,255,202,0), Color.FromArgb(255,255,203,0), Color.FromArgb(255,255,204,0), Color.FromArgb(255,255,205,0), Color.FromArgb(255,255,205,0), Color.FromArgb(255,255,206,0), Color.FromArgb(255,255,207,0), Color.FromArgb(255,255,208,0), Color.FromArgb(255,255,209,0), Color.FromArgb(255,255,209,0), Color.FromArgb(255,255,210,0), Color.FromArgb(255,255,211,0), Color.FromArgb(255,255,212,0), Color.FromArgb(255,255,213,0), Color.FromArgb(255,255,213,0), Color.FromArgb(255,255,214,0), Color.FromArgb(255,255,215,0), Color.FromArgb(255,255,216,0), Color.FromArgb(255,255,217,0), Color.FromArgb(255,255,217,0), Color.FromArgb(255,255,218,0), Color.FromArgb(255,255,219,0), Color.FromArgb(255,255,220,0), Color.FromArgb(255,255,221,0), Color.FromArgb(255,255,221,0), Color.FromArgb(255,255,222,0), Color.FromArgb(255,255,223,0), Color.FromArgb(255,255,224,0), Color.FromArgb(255,255,225,0), Color.FromArgb(255,255,225,0), Color.FromArgb(255,255,226,0), Color.FromArgb(255,255,227,0), Color.FromArgb(255,255,228,0), Color.FromArgb(255,255,229,0), Color.FromArgb(255,255,229,0), Color.FromArgb(255,255,230,0), Color.FromArgb(255,255,231,0), Color.FromArgb(255,255,232,0), Color.FromArgb(255,255,233,0), Color.FromArgb(255,255,233,0), Color.FromArgb(255,255,234,0), Color.FromArgb(255,255,235,0), Color.FromArgb(255,255,236,0), Color.FromArgb(255,255,237,0), Color.FromArgb(255,255,237,0), Color.FromArgb(255,255,238,0), Color.FromArgb(255,255,239,0), Color.FromArgb(255,255,240,0), Color.FromArgb(255,255,241,0), Color.FromArgb(255,255,241,0), Color.FromArgb(255,255,242,0), Color.FromArgb(255,255,243,0), Color.FromArgb(255,255,244,0), Color.FromArgb(255,255,245,0), Color.FromArgb(255,255,245,0), Color.FromArgb(255,255,246,0), Color.FromArgb(255,255,247,0), Color.FromArgb(255,255,248,0), Color.FromArgb(255,255,249,0), Color.FromArgb(255,255,249,0), Color.FromArgb(255,255,250,0), Color.FromArgb(255,255,251,0), Color.FromArgb(255,255,252,0), Color.FromArgb(255,255,253,0), Color.FromArgb(255,255,253,0), Color.FromArgb(255,255,254,0), Color.FromArgb(255,255,255,0), Color.FromArgb(255,255,255,0), Color.FromArgb(255,254,254,1), Color.FromArgb(255,253,254,1), Color.FromArgb(255,252,254,1), Color.FromArgb(255,251,253,2), Color.FromArgb(255,251,253,2), Color.FromArgb(255,250,252,3), Color.FromArgb(255,249,252,3), Color.FromArgb(255,248,252,3), Color.FromArgb(255,247,251,4), Color.FromArgb(255,247,251,4), Color.FromArgb(255,246,250,5), Color.FromArgb(255,245,250,5), Color.FromArgb(255,244,250,5), Color.FromArgb(255,243,249,6), Color.FromArgb(255,243,249,6), Color.FromArgb(255,242,248,7), Color.FromArgb(255,241,248,7), Color.FromArgb(255,240,248,7), Color.FromArgb(255,239,247,8), Color.FromArgb(255,239,247,8), Color.FromArgb(255,238,247,8), Color.FromArgb(255,237,246,9), Color.FromArgb(255,237,246,9), Color.FromArgb(255,236,245,10), Color.FromArgb(255,235,245,10), Color.FromArgb(255,234,245,10), Color.FromArgb(255,233,244,11), Color.FromArgb(255,233,244,11), Color.FromArgb(255,232,243,12), Color.FromArgb(255,231,243,12), Color.FromArgb(255,230,243,12), Color.FromArgb(255,230,242,13), Color.FromArgb(255,229,242,13), Color.FromArgb(255,228,242,13), Color.FromArgb(255,227,241,14), Color.FromArgb(255,227,241,14), Color.FromArgb(255,226,240,15), Color.FromArgb(255,225,240,15), Color.FromArgb(255,224,240,15), Color.FromArgb(255,223,239,16), Color.FromArgb(255,223,239,16), Color.FromArgb(255,222,238,17), Color.FromArgb(255,221,238,17), Color.FromArgb(255,220,238,17), Color.FromArgb(255,219,237,18), Color.FromArgb(255,219,237,18), Color.FromArgb(255,218,236,19), Color.FromArgb(255,217,236,19), Color.FromArgb(255,216,236,19), Color.FromArgb(255,215,235,20), Color.FromArgb(255,215,235,20), Color.FromArgb(255,214,234,21), Color.FromArgb(255,213,234,21), Color.FromArgb(255,213,234,21), Color.FromArgb(255,212,233,22), Color.FromArgb(255,211,233,22), Color.FromArgb(255,210,233,22), Color.FromArgb(255,209,232,23), Color.FromArgb(255,209,232,23), Color.FromArgb(255,208,231,24), Color.FromArgb(255,207,231,24), Color.FromArgb(255,206,231,24), Color.FromArgb(255,205,230,25), Color.FromArgb(255,205,230,25), Color.FromArgb(255,204,229,26), Color.FromArgb(255,203,229,26), Color.FromArgb(255,202,229,26), Color.FromArgb(255,201,228,27), Color.FromArgb(255,201,228,27), Color.FromArgb(255,200,227,28), Color.FromArgb(255,199,227,28), Color.FromArgb(255,198,227,28), Color.FromArgb(255,197,226,29), Color.FromArgb(255,197,226,29), Color.FromArgb(255,196,226,29), Color.FromArgb(255,195,225,30), Color.FromArgb(255,195,225,30), Color.FromArgb(255,194,224,31), Color.FromArgb(255,193,224,31), Color.FromArgb(255,192,224,31), Color.FromArgb(255,191,223,32), Color.FromArgb(255,191,223,32), Color.FromArgb(255,190,222,33), Color.FromArgb(255,189,222,33), Color.FromArgb(255,188,222,33), Color.FromArgb(255,187,221,34), Color.FromArgb(255,187,221,34), Color.FromArgb(255,186,220,35), Color.FromArgb(255,185,220,35), Color.FromArgb(255,184,220,35), Color.FromArgb(255,183,219,36), Color.FromArgb(255,183,219,36), Color.FromArgb(255,182,219,36), Color.FromArgb(255,181,218,37), Color.FromArgb(255,181,218,37), Color.FromArgb(255,180,217,38), Color.FromArgb(255,179,217,38), Color.FromArgb(255,178,217,38), Color.FromArgb(255,177,216,39), Color.FromArgb(255,177,216,39), Color.FromArgb(255,176,215,40), Color.FromArgb(255,175,215,40), Color.FromArgb(255,174,215,40), Color.FromArgb(255,173,214,41), Color.FromArgb(255,173,214,41), Color.FromArgb(255,172,213,42), Color.FromArgb(255,171,213,42), Color.FromArgb(255,171,213,42), Color.FromArgb(255,170,212,43), Color.FromArgb(255,169,212,43), Color.FromArgb(255,168,212,43), Color.FromArgb(255,167,211,44), Color.FromArgb(255,167,211,44), Color.FromArgb(255,166,210,45), Color.FromArgb(255,165,210,45), Color.FromArgb(255,164,210,45), Color.FromArgb(255,163,209,46), Color.FromArgb(255,163,209,46), Color.FromArgb(255,162,208,47), Color.FromArgb(255,161,208,47), Color.FromArgb(255,160,208,47), Color.FromArgb(255,159,207,48), Color.FromArgb(255,159,207,48), Color.FromArgb(255,158,206,49), Color.FromArgb(255,157,206,49), Color.FromArgb(255,156,206,49), Color.FromArgb(255,155,205,50), Color.FromArgb(255,155,205,50), Color.FromArgb(255,154,205,50), Color.FromArgb(255,153,204,51), Color.FromArgb(255,152,203,51), Color.FromArgb(255,151,202,50), Color.FromArgb(255,149,202,50), Color.FromArgb(255,148,201,49), Color.FromArgb(255,146,200,49), Color.FromArgb(255,145,199,48), Color.FromArgb(255,144,198,48), Color.FromArgb(255,143,197,48), Color.FromArgb(255,141,196,47), Color.FromArgb(255,140,195,47), Color.FromArgb(255,139,194,46), Color.FromArgb(255,137,194,46), Color.FromArgb(255,136,193,45), Color.FromArgb(255,134,192,45), Color.FromArgb(255,133,191,44), Color.FromArgb(255,132,190,44), Color.FromArgb(255,131,189,44), Color.FromArgb(255,129,188,43), Color.FromArgb(255,128,187,43), Color.FromArgb(255,127,186,42), Color.FromArgb(255,125,186,42), Color.FromArgb(255,124,184,41), Color.FromArgb(255,122,184,41), Color.FromArgb(255,121,183,40), Color.FromArgb(255,120,182,40), Color.FromArgb(255,119,181,40), Color.FromArgb(255,118,180,39), Color.FromArgb(255,116,179,39), Color.FromArgb(255,115,178,38), Color.FromArgb(255,113,178,38), Color.FromArgb(255,112,177,37), Color.FromArgb(255,111,176,37), Color.FromArgb(255,109,175,36), Color.FromArgb(255,108,174,36), Color.FromArgb(255,107,173,36), Color.FromArgb(255,106,172,35), Color.FromArgb(255,104,171,35), Color.FromArgb(255,103,170,34), Color.FromArgb(255,101,170,34), Color.FromArgb(255,100,169,33), Color.FromArgb(255,98,168,33), Color.FromArgb(255,97,167,32), Color.FromArgb(255,96,166,32), Color.FromArgb(255,95,165,32), Color.FromArgb(255,93,164,31), Color.FromArgb(255,92,163,31), Color.FromArgb(255,91,162,30), Color.FromArgb(255,89,162,30), Color.FromArgb(255,88,160,29), Color.FromArgb(255,86,160,29), Color.FromArgb(255,85,159,28), Color.FromArgb(255,84,158,28), Color.FromArgb(255,83,157,28), Color.FromArgb(255,81,156,27), Color.FromArgb(255,80,155,27), Color.FromArgb(255,79,154,26), Color.FromArgb(255,77,154,26), Color.FromArgb(255,76,152,25), Color.FromArgb(255,74,152,25), Color.FromArgb(255,73,151,24), Color.FromArgb(255,72,150,24), Color.FromArgb(255,70,149,23), Color.FromArgb(255,69,148,23), Color.FromArgb(255,68,147,23), Color.FromArgb(255,67,146,22), Color.FromArgb(255,65,145,22), Color.FromArgb(255,64,144,21), Color.FromArgb(255,62,144,21), Color.FromArgb(255,61,143,20), Color.FromArgb(255,59,142,20), Color.FromArgb(255,58,141,19), Color.FromArgb(255,57,140,19), Color.FromArgb(255,56,139,19), Color.FromArgb(255,54,138,18), Color.FromArgb(255,53,137,18), Color.FromArgb(255,52,136,17), Color.FromArgb(255,50,136,17), Color.FromArgb(255,49,135,16), Color.FromArgb(255,47,134,16), Color.FromArgb(255,46,133,15), Color.FromArgb(255,45,132,15), Color.FromArgb(255,44,131,15), Color.FromArgb(255,42,130,14), Color.FromArgb(255,41,129,14), Color.FromArgb(255,40,128,13), Color.FromArgb(255,38,128,13), Color.FromArgb(255,37,126,12), Color.FromArgb(255,35,126,12), Color.FromArgb(255,34,125,11), Color.FromArgb(255,33,124,11), Color.FromArgb(255,32,123,11), Color.FromArgb(255,31,122,10), Color.FromArgb(255,29,122,10), Color.FromArgb(255,28,120,9), Color.FromArgb(255,26,120,9), Color.FromArgb(255,25,119,8), Color.FromArgb(255,24,118,8), Color.FromArgb(255,22,117,7), Color.FromArgb(255,21,116,7), Color.FromArgb(255,20,115,7), Color.FromArgb(255,19,114,6), Color.FromArgb(255,17,113,6), Color.FromArgb(255,16,112,5), Color.FromArgb(255,14,112,5), Color.FromArgb(255,13,111,4), Color.FromArgb(255,11,110,4), Color.FromArgb(255,10,109,3), Color.FromArgb(255,9,108,3), Color.FromArgb(255,8,107,3), Color.FromArgb(255,6,106,2), Color.FromArgb(255,5,105,2), Color.FromArgb(255,4,104,1), Color.FromArgb(255,2,104,1), Color.FromArgb(255,1,102,0), Color.FromArgb(255,0,102,0), Color.FromArgb(255,0,102,0), Color.FromArgb(255,0,102,0)}; #endregion public PasswordMeter() { InitializeComponent(); password = ""; UpdateControl(); } public void SetPassword(String pwd) { password = pwd; UpdateControl(); } protected override void OnPaintBackground(PaintEventArgs e) { if (brush != null) e.Graphics.FillRectangle(brush, this.ClientRectangle); } private void UpdateControl() { int score = PasswordUtils.ComputePasswordScore(password); lbText.Text = PasswordUtils.GetPasswordStrengthText(score); int x1 = score * 4; int x2 = x1 + 99; if (x2 >= 500) x2 = 499; Color clr1 = Colors[x1]; Color clr2 = Colors[x2]; if (brush != null) { brush.Dispose(); brush = null; } brush = new LinearGradientBrush( new Point(0, 0), new Point(this.Width, this.Height), clr1, clr2); Refresh(); } private void PasswordMeter_Load(object sender, EventArgs e) { // Needed to ensure control is drawn correctly at start up. SetPassword(""); } } }
sassy224/PasswordTextBox
CustomControls/PasswordMeter.cs
C#
mit
33,534
#pragma once #ifndef XAMCC_YOUR_ROOT_NAMESPACE_BEGIN #define XAMCC_YOUR_ROOT_NAMESPACE_BEGIN namespace Mntone { #endif #ifndef XAMCC_YOUR_ROOT_NAMESPACE_END #define XAMCC_YOUR_ROOT_NAMESPACE_END } #endif #include "Preprocessor\PropertyPreprocessor.h" #include "Preprocessor\DependencyObjectPreprocessor.h" #include "Foundation\TimeSpanReference.h" #include "Foundation\EventWrapper.h" #include "Commands\RelayCommand.h" #include "Commands\RelayCommand.generic.h" #include "DependencyObjectCollectionCpp.h" #include "DispatcherHelper.h" #include "ViewModelHelper.h"
mntone/Xamcc
Mntone.Xamcc/Mntone.Xamcc.Shared/include/Xamcc.h
C
mit
591
<HTML><HEAD> <TITLE>Review for So I Married an Axe Murderer (1993)</TITLE> <LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css"> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1 ALIGN="CENTER" CLASS="title"><A HREF="/Title?0108174">So I Married an Axe Murderer (1993)</A></H1><H3 ALIGN=CENTER>reviewed by<BR><A HREF="/ReviewsBy?Jon+A+Webb">Jon A Webb</A></H3><HR WIDTH="40%" SIZE="4"> <PRE> SO I MARRIED AN AXE MURDERER A film review by Jon A. Webb Copyright 1993 Jon A. Webb</PRE> <P> As the title suggests, this is a B-movie-style romantic comedy. It is a vehicle for Michael Myers, who gets to do several different characters: beat poet, Scottish father, romantic guy. Nancy Travis stars, but does not distinguish herself, as the potential axe murderess.</P> <P> I thought the movie worked fairly well as a vehicle for Myers. I liked him both as a beat poet and as his own Scottish father (who sings sentimental favorites from the House of Stewart -- that is, Rod).</P> <P> In terms of plot, though, forget it. The film makes no pretense of caring about coherence or much else. What does Myers's character do for a living? Why do the police know so little about "Mrs. X"? Why were none of the disappearances reported? Etc. If this were a complete fantasy I could see the these details as unimportant, but the film is not constructed that way.</P> <P> There are a few fine comic actors in small but fun roles. Alan Arkin plays the police sergeant, Charles Grodin is the commandeered motorist, and Phil Hartman plays a guard at Alcatraz.</P> <P> The fine actress Brenda Fricker, who is unfortunately (for her career) no longer young, is wasted in a humiliating role. Remarkable, isn't it, how men can mature into interesting characters who get great parts (De Niro, Nicholson), while fine actresses disappear after a certain age (e.g., Streep).</P> <P> This is a fun movie if you like Michael Myers. It is a reasonable date movie. But its quality puts it more in the VCR rental arena.</P> <PRE>-- J</PRE> <PRE>. </PRE> <HR><P CLASS=flush><SMALL>The review above was posted to the <A HREF="news:rec.arts.movies.reviews">rec.arts.movies.reviews</A> newsgroup (<A HREF="news:de.rec.film.kritiken">de.rec.film.kritiken</A> for German reviews).<BR> The Internet Movie Database accepts no responsibility for the contents of the review and has no editorial control. Unless stated otherwise, the copyright belongs to the author.<BR> Please direct comments/criticisms of the review to relevant newsgroups.<BR> Broken URLs inthe reviews are the responsibility of the author.<BR> The formatting of the review is likely to differ from the original due to ASCII to HTML conversion. </SMALL></P> <P ALIGN=CENTER>Related links: <A HREF="/Reviews/">index of all rec.arts.movies.reviews reviews</A></P> </P></BODY></HTML>
xianjunzhengbackup/code
data science/machine_learning_for_the_web/chapter_4/movie/2038.html
HTML
mit
2,967
# generated from catkin/cmake/env-hooks/05.catkin-test-results.sh.develspace.in export CATKIN_TEST_RESULTS_DIR="/home/ubuntu/ros/catkin_ws/src/rover5_ros/build/test_results" export ROS_TEST_RESULTS_DIR="$CATKIN_TEST_RESULTS_DIR"
chcbaram/rover5_ros
build/devel/etc/catkin/profile.d/05.catkin-test-results.sh
Shell
mit
230
try: print 'Importing ....' from base import * # noqa from local import * # noqa except ImportError: import traceback print traceback.format_exc() print 'Unable to find moderation/settings/local.py' try: from post_env_commons import * # noqa except ImportError: pass
CareerVillage/slack-moderation
src/moderation/settings/__init__.py
Python
mit
305
class LockerController < ApplicationController def index @filenames = Dir.glob(File.join(APP_CONFIG[:locker], '*')) end end
jronallo/digitization-locker
app/controllers/locker_controller.rb
Ruby
mit
131
using Autofac; using AutoMapper; using Miningcore.Blockchain.Ergo.Configuration; using Miningcore.Configuration; using Miningcore.Extensions; using Miningcore.Messaging; using Miningcore.Mining; using Miningcore.Payments; using Miningcore.Persistence; using Miningcore.Persistence.Model; using Miningcore.Persistence.Repositories; using Miningcore.Time; using Miningcore.Util; using Block = Miningcore.Persistence.Model.Block; using Contract = Miningcore.Contracts.Contract; using static Miningcore.Util.ActionUtils; namespace Miningcore.Blockchain.Ergo; [CoinFamily(CoinFamily.Ergo)] public class ErgoPayoutHandler : PayoutHandlerBase, IPayoutHandler { public ErgoPayoutHandler( IComponentContext ctx, IConnectionFactory cf, IMapper mapper, IShareRepository shareRepo, IBlockRepository blockRepo, IBalanceRepository balanceRepo, IPaymentRepository paymentRepo, IMasterClock clock, IMessageBus messageBus) : base(cf, mapper, shareRepo, blockRepo, balanceRepo, paymentRepo, clock, messageBus) { Contract.RequiresNonNull(ctx, nameof(ctx)); Contract.RequiresNonNull(balanceRepo, nameof(balanceRepo)); Contract.RequiresNonNull(paymentRepo, nameof(paymentRepo)); this.ctx = ctx; } protected readonly IComponentContext ctx; protected ErgoClient ergoClient; private string network; private ErgoPaymentProcessingConfigExtra extraPoolPaymentProcessingConfig; protected override string LogCategory => "Ergo Payout Handler"; private class PaymentException : Exception { public PaymentException(string msg) : base(msg) { } } private void ReportAndRethrowApiError(string action, Exception ex, bool rethrow = true) { var error = ex.Message; if(ex is ApiException<ApiError> apiException) error = apiException.Result.Detail ?? apiException.Result.Reason; logger.Warn(() => $"{action}: {error}"); if(rethrow) throw ex; } private async Task UnlockWallet(CancellationToken ct) { logger.Info(() => $"[{LogCategory}] Unlocking wallet"); var walletPassword = extraPoolPaymentProcessingConfig.WalletPassword ?? string.Empty; await Guard(() => ergoClient.WalletUnlockAsync(new Body4 {Pass = walletPassword}, ct), ex => { if (ex is ApiException<ApiError> apiException) { var error = apiException.Result.Detail; if (error != null && !error.ToLower().Contains("already unlocked")) throw new PaymentException($"Failed to unlock wallet: {error}"); } else throw ex; }); logger.Info(() => $"[{LogCategory}] Wallet unlocked"); } private async Task LockWallet(CancellationToken ct) { logger.Info(() => $"[{LogCategory}] Locking wallet"); await Guard(() => ergoClient.WalletLockAsync(ct), ex => ReportAndRethrowApiError("Failed to lock wallet", ex)); logger.Info(() => $"[{LogCategory}] Wallet locked"); } #region IPayoutHandler public virtual async Task ConfigureAsync(ClusterConfig clusterConfig, PoolConfig poolConfig, CancellationToken ct) { Contract.RequiresNonNull(poolConfig, nameof(poolConfig)); logger = LogUtil.GetPoolScopedLogger(typeof(ErgoPayoutHandler), poolConfig); this.poolConfig = poolConfig; this.clusterConfig = clusterConfig; extraPoolPaymentProcessingConfig = poolConfig.PaymentProcessing.Extra.SafeExtensionDataAs<ErgoPaymentProcessingConfigExtra>(); ergoClient = ErgoClientFactory.CreateClient(poolConfig, clusterConfig, null); // detect chain var info = await ergoClient.GetNodeInfoAsync(ct); network = ErgoConstants.RegexChain.Match(info.Name).Groups[1].Value.ToLower(); } public virtual async Task<Block[]> ClassifyBlocksAsync(IMiningPool pool, Block[] blocks, CancellationToken ct) { Contract.RequiresNonNull(poolConfig, nameof(poolConfig)); Contract.RequiresNonNull(blocks, nameof(blocks)); if(blocks.Length == 0) return blocks; var coin = poolConfig.Template.As<ErgoCoinTemplate>(); var pageSize = 100; var pageCount = (int) Math.Ceiling(blocks.Length / (double) pageSize); var result = new List<Block>(); var minConfirmations = extraPoolPaymentProcessingConfig?.MinimumConfirmations ?? (network == "mainnet" ? 720 : 72); var minerRewardsPubKey = await ergoClient.MiningReadMinerRewardPubkeyAsync(ct); var minerRewardsAddress = await ergoClient.MiningReadMinerRewardAddressAsync(ct); for(var i = 0; i < pageCount; i++) { // get a page full of blocks var page = blocks .Skip(i * pageSize) .Take(pageSize) .ToArray(); // fetch header ids for blocks in page var headerBatch = page.Select(block => ergoClient.GetFullBlockAtAsync((int) block.BlockHeight, ct)).ToArray(); await Guard(()=> Task.WhenAll(headerBatch), ex=> logger.Debug(ex)); for(var j = 0; j < page.Length; j++) { var block = page[j]; var headerTask = headerBatch[j]; if(!headerTask.IsCompletedSuccessfully) { if(headerTask.IsFaulted) logger.Warn(()=> $"Failed to fetch block {block.BlockHeight}: {headerTask.Exception?.InnerException?.Message ?? headerTask.Exception?.Message}"); else logger.Warn(()=> $"Failed to fetch block {block.BlockHeight}: {headerTask.Status.ToString().ToLower()}"); continue; } var headerIds = headerTask.Result; // fetch blocks var blockBatch = headerIds.Select(x=> ergoClient.GetFullBlockByIdAsync(x, ct)).ToArray(); await Guard(()=> Task.WhenAll(blockBatch), ex=> logger.Debug(ex)); var blockHandled = false; var pkMismatchCount = 0; var nonceMismatchCount = 0; var coinbaseNonWalletTxCount = 0; foreach (var blockTask in blockBatch) { if(blockHandled) break; if(!blockTask.IsCompletedSuccessfully) continue; var fullBlock = blockTask.Result; // only consider blocks with pow-solution pk matching ours if(fullBlock.Header.PowSolutions.Pk != minerRewardsPubKey.RewardPubKey) { pkMismatchCount++; continue; } // only consider blocks with pow-solution nonce matching what we have on file if(fullBlock.Header.PowSolutions.N != block.TransactionConfirmationData) { nonceMismatchCount++; continue; } var coinbaseWalletTxFound = false; // reset block reward block.Reward = 0; foreach(var blockTx in fullBlock.BlockTransactions.Transactions) { var walletTx = await Guard(()=> ergoClient.WalletGetTransactionAsync(blockTx.Id, ct)); var coinbaseOutput = walletTx?.Outputs?.FirstOrDefault(x => x.Address == minerRewardsAddress.RewardAddress); if(coinbaseOutput != null) { coinbaseWalletTxFound = true; block.ConfirmationProgress = Math.Min(1.0d, (double) walletTx.NumConfirmations / minConfirmations); block.Reward += coinbaseOutput.Value / ErgoConstants.SmallestUnit; block.Hash = fullBlock.Header.Id; if(walletTx.NumConfirmations >= minConfirmations) { // matured and spendable coinbase transaction block.Status = BlockStatus.Confirmed; block.ConfirmationProgress = 1; } } } blockHandled = coinbaseWalletTxFound; if(blockHandled) { result.Add(block); if(block.Status == BlockStatus.Confirmed) { logger.Info(() => $"[{LogCategory}] Unlocked block {block.BlockHeight} worth {FormatAmount(block.Reward)}"); messageBus.NotifyBlockUnlocked(poolConfig.Id, block, coin); } else messageBus.NotifyBlockConfirmationProgress(poolConfig.Id, block, coin); } else coinbaseNonWalletTxCount++; } if(!blockHandled) { string orphanReason = null; if(pkMismatchCount == blockBatch.Length) orphanReason = "pk mismatch"; else if(nonceMismatchCount == blockBatch.Length) orphanReason = "nonce mismatch"; else if(coinbaseNonWalletTxCount == blockBatch.Length) orphanReason = "no related coinbase tx found in wallet"; if(!string.IsNullOrEmpty(orphanReason)) { block.Status = BlockStatus.Orphaned; block.Reward = 0; result.Add(block); logger.Info(() => $"[{LogCategory}] Block {block.BlockHeight} classified as orphaned due to {orphanReason}"); messageBus.NotifyBlockUnlocked(poolConfig.Id, block, coin); } } } } return result.ToArray(); } public virtual Task CalculateBlockEffortAsync(IMiningPool pool, Block block, double accumulatedBlockShareDiff, CancellationToken ct) { block.Effort = accumulatedBlockShareDiff * ErgoConstants.ShareMultiplier / block.NetworkDifficulty; return Task.FromResult(true); } public override double AdjustShareDifficulty(double difficulty) { return difficulty * ErgoConstants.ShareMultiplier; } public virtual async Task PayoutAsync(IMiningPool pool, Balance[] balances, CancellationToken ct) { Contract.RequiresNonNull(balances, nameof(balances)); // build args var amounts = balances .Where(x => x.Amount > 0) .ToDictionary(x => x.Address, x => Math.Round(x.Amount, 4)); if(amounts.Count == 0) return; var balancesTotal = amounts.Sum(x => x.Value); try { logger.Info(() => $"[{LogCategory}] Paying {FormatAmount(balances.Sum(x => x.Amount))} to {balances.Length} addresses"); // get wallet status var status = await ergoClient.GetWalletStatusAsync(ct); if(!status.IsInitialized) throw new PaymentException($"Wallet is not initialized"); if(!status.IsUnlocked) await UnlockWallet(ct); // get balance var walletBalances = await ergoClient.WalletBalancesAsync(ct); var walletTotal = walletBalances.Balance / ErgoConstants.SmallestUnit; logger.Info(() => $"[{LogCategory}] Current wallet balance is {FormatAmount(walletTotal)}"); // bail if balance does not satisfy payments if(walletTotal < balancesTotal) { logger.Warn(() => $"[{LogCategory}] Wallet balance currently short of {FormatAmount(balancesTotal - walletTotal)}. Will try again."); return; } // validate addresses logger.Info("Validating addresses ..."); foreach(var pair in amounts) { var validity = await Guard(() => ergoClient.CheckAddressValidityAsync(pair.Key, ct)); if(validity == null || !validity.IsValid) logger.Warn(()=> $"Address {pair.Key} is not valid!"); } // Create request batch var requests = amounts.Select(x => new PaymentRequest { Address = x.Key, Value = (long) (x.Value * ErgoConstants.SmallestUnit), }).ToArray(); var txId = await Guard(()=> ergoClient.WalletPaymentTransactionGenerateAndSendAsync(requests, ct), ex => { if(ex is ApiException<ApiError> apiException) { var error = apiException.Result.Detail ?? apiException.Result.Reason; if(error.Contains("reason:")) error = error.Substring(error.IndexOf("reason:")); throw new PaymentException($"Payment transaction failed: {error}"); } else throw ex; }); if(string.IsNullOrEmpty(txId)) throw new PaymentException("Payment transaction failed to return a transaction id"); // payment successful logger.Info(() => $"[{LogCategory}] Payment transaction id: {txId}"); await PersistPaymentsAsync(balances, txId); NotifyPayoutSuccess(poolConfig.Id, balances, new[] {txId}, null); } catch(PaymentException ex) { logger.Error(() => $"[{LogCategory}] {ex.Message}"); NotifyPayoutFailure(poolConfig.Id, balances, ex.Message, null); } finally { await LockWallet(ct); } } #endregion // IPayoutHandler }
coinfoundry/miningcore
src/Miningcore/Blockchain/Ergo/ErgoPayoutHandler.cs
C#
mit
14,286
<?php Breadcrumbs::for('admin.email-templates.index', function ($trail) { $trail->push(__('labels.backend.access.email-templates.management'), route('admin.email-templates.index')); }); Breadcrumbs::for('admin.email-templates.create', function ($trail) { $trail->parent('admin.email-templates.index'); $trail->push(__('labels.backend.access.email-templates.management'), route('admin.email-templates.create')); }); Breadcrumbs::for('admin.email-templates.edit', function ($trail, $id) { $trail->parent('admin.email-templates.index'); $trail->push(__('labels.backend.access.email-templates.management'), route('admin.email-templates.edit', $id)); });
viralsolani/laravel-adminpanel
routes/breadcrumbs/backend/email-templates/email-template.php
PHP
mit
673
--- title: Contact type: single --- # Contact ## Send us a message <form name="Contact Form" netlify-honeypot="phone" action="/thanks.html" class="bg-black-05 black-70 pa3" netlify> <label class="db f5 fw4 mb2">Name <input type="text" name="name" class="b--black-30 ba db input-reset mb3 pa2 w-100" required></label> <label class="db f5 fw4 mb2">Email <input type="email" name="email" class="b--black-30 ba db input-reset mb3 pa2 w-100" required></label> <label class="dn">Don’t fill this out: <input name="phone"></label> <label class="db f5 fw4 mb2">Message <textarea name="message" class="b--black-30 ba border-box br2 db h4 hover-black mb4 pa2 w-100" required></textarea></label> <button type="submit" class="bg-rope bn fw4 hover-bg-dark-rope input-reset ph4 pv3 pointer white">Send</button> </form>
covingtondoan/radiorounds
site/content/contact.md
Markdown
mit
833
MIME-Version: 1.0 Server: CERN/3.0 Date: Monday, 06-Jan-97 21:51:50 GMT Content-Type: text/html Content-Length: 1973 Last-Modified: Monday, 14-Aug-95 19:07:53 GMT <HTML> <HEAD> <TITLE>Links to Austin</TITLE> </HEAD> <BODY BGCOLOR="#90DDB0" TEXT="#002233" LINK="#AA2233" VLINK="#44ll88"> <CENTER> <H1>AUSTIN -- The Music Capitol</H1> </CENTER> <CENTER><IMG SRC="GIF_pic/line.colorbar.gif" ALT="----------"></CENTER> <UL> <LI><A HREF="http://www.ci.austin.tx.us/"> Austin City Connection</A> <LI><A HREF="http://www.quadralay.com/www/Austin/Austin.html"> Austin City Limits (Quadralay's page)</A> <LI><A HREF="http://www.dentalnet.com/aim/austinov/"> Austin Overview</A> <LI><A HREF="http://www.tech.net/austin/"> <CODE>TECH.NET</CODE> Austin Information Center</A> <LI><A HREF="http://www.chataqua.com/ARN/ARNSC/ARNSCAustin/ARNAustin.html"> Austin Relocation Network</A> </UL> <H2>Useful Sites</H2> <UL> <LI><A HREF="http://www.awpi.com/AustinAxis/index.html"> Austin Axis</A> -- A Web magazine about Austin <LI><A HREF="http://www.auschron.com/"> The Austin Chronicle</A>, a free Austin weekly on the Internet. <LI><A HREF="http://www.ci.austin.tx.us/PK/PKCALEN.HTM#EVENTS"> Recreational Events Calendar</A> <LI><A HREF="http://www.quadralay.com:80/www/Austin/AustinOrgs/AWWWUG/AWWWUG.html"> Austin WWW Users Group Home Page</A> <LI><A HREF="http://www.yp.com:80/"> Austin Internet Yellow Page</A> </UL> <FONT SIZE="4">Don't forget the <A HREF="http://www.quadralay.com/www/Austin/AustinMusic/AustinMusic.html"> <BLINK>Music</BLINK></A>, the best tradition of Austin.</FONT><P> Oh! As a new Austinite, I like <A HREF="http://www.realtime.net/~dhbrown/"> Swimming in Austin</A>!<P> <CENTER><IMG SRC="GIF_pic/line.colorbar.gif" ALT="----------"></CENTER><P> <IMG SRC="/images/stanford/at-work.gif" ALT="AT-WORK:">This site is under construction!<P> Last modified: Aug 14, 1995<P> <ADDRESS> Zhu, Qing<BR> University of Texas at Austin<BR> Department of Computer Sciences<BR> Austin, TX 78712<BR> <A HREF="mailto:zhuqing@cs.utexas.edu">zhuqing@cs.utexas.edu</A> </ADDRESS> </BODY> </HTML>
ML-SWAT/Web2KnowledgeBase
webkb/other/texas/http:^^www.cs.utexas.edu^users^zhuqing^austin.html
HTML
mit
2,144
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- // ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING // // DO NOT EDIT this file to adjust your configuration. Create your own // APM_Config.h and use APM_Config.h.example as a reference. // // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING /// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // // Default and automatic configuration details. // // Notes for maintainers: // // - Try to keep this file organised in the same order as APM_Config.h.example // #include "defines.h" /// /// DO NOT EDIT THIS INCLUDE - if you want to make a local change, make that /// change in your local copy of APM_Config.h. /// #ifdef USE_CMAKE_APM_CONFIG #include "APM_Config_cmake.h" // <== Prefer cmake config if it exists #else #include "APM_Config.h" // <== THIS INCLUDE, DO NOT EDIT IT. EVER. #endif /// /// DO NOT EDIT THIS INCLUDE - if you want to make a local change, make that /// change in your local copy of APM_Config.h. /// // Just so that it's completely clear... #define ENABLED 1 #define DISABLED 0 // this avoids a very common config error #define ENABLE ENABLED #define DISABLE DISABLED ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // HARDWARE CONFIGURATION AND CONNECTIONS ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// #ifdef CONFIG_APM_HARDWARE #error CONFIG_APM_HARDWARE option is depreated! use CONFIG_HAL_BOARD instead. #endif #ifndef MAV_SYSTEM_ID # define MAV_SYSTEM_ID 1 #endif ////////////////////////////////////////////////////////////////////////////// // FrSky telemetry support // #ifndef FRSKY_TELEM_ENABLED #if CONFIG_HAL_BOARD == HAL_BOARD_APM1 || CONFIG_HAL_BOARD == HAL_BOARD_APM2 # define FRSKY_TELEM_ENABLED DISABLED #else # define FRSKY_TELEM_ENABLED ENABLED #endif #endif ////////////////////////////////////////////////////////////////////////////// // Optical flow sensor support // #ifndef OPTFLOW #if AP_AHRS_NAVEKF_AVAILABLE # define OPTFLOW ENABLED #else # define OPTFLOW DISABLED #endif #endif ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // RADIO CONFIGURATION ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // Radio channel limits // // Note that these are not called out in APM_Config.h.reference. // #ifndef CH5_MIN # define CH5_MIN 1000 #endif #ifndef CH5_MAX # define CH5_MAX 2000 #endif #ifndef CH6_MIN # define CH6_MIN 1000 #endif #ifndef CH6_MAX # define CH6_MAX 2000 #endif #ifndef CH7_MIN # define CH7_MIN 1000 #endif #ifndef CH7_MAX # define CH7_MAX 2000 #endif #ifndef CH8_MIN # define CH8_MIN 1000 #endif #ifndef CH8_MAX # define CH8_MAX 2000 #endif #ifndef FLAP_1_PERCENT # define FLAP_1_PERCENT 0 #endif #ifndef FLAP_1_SPEED # define FLAP_1_SPEED 0 #endif #ifndef FLAP_2_PERCENT # define FLAP_2_PERCENT 0 #endif #ifndef FLAP_2_SPEED # define FLAP_2_SPEED 0 #endif ////////////////////////////////////////////////////////////////////////////// // FLIGHT_MODE // FLIGHT_MODE_CHANNEL // #ifndef FLIGHT_MODE_CHANNEL # define FLIGHT_MODE_CHANNEL 8 #endif #if (FLIGHT_MODE_CHANNEL != 5) && (FLIGHT_MODE_CHANNEL != 6) && (FLIGHT_MODE_CHANNEL != 7) && (FLIGHT_MODE_CHANNEL != 8) # error XXX # error XXX You must set FLIGHT_MODE_CHANNEL to 5, 6, 7 or 8 # error XXX #endif #if !defined(FLIGHT_MODE_1) # define FLIGHT_MODE_1 RTL #endif #if !defined(FLIGHT_MODE_2) # define FLIGHT_MODE_2 RTL #endif #if !defined(FLIGHT_MODE_3) # define FLIGHT_MODE_3 FLY_BY_WIRE_A #endif #if !defined(FLIGHT_MODE_4) # define FLIGHT_MODE_4 FLY_BY_WIRE_A #endif #if !defined(FLIGHT_MODE_5) # define FLIGHT_MODE_5 MANUAL #endif #if !defined(FLIGHT_MODE_6) # define FLIGHT_MODE_6 MANUAL #endif ////////////////////////////////////////////////////////////////////////////// // THROTTLE_FAILSAFE // THROTTLE_FS_VALUE // SHORT_FAILSAFE_ACTION // LONG_FAILSAFE_ACTION #ifndef THROTTLE_FAILSAFE # define THROTTLE_FAILSAFE ENABLED #endif #ifndef THROTTLE_FS_VALUE # define THROTTLE_FS_VALUE 950 #endif #ifndef SHORT_FAILSAFE_ACTION # define SHORT_FAILSAFE_ACTION 0 #endif #ifndef LONG_FAILSAFE_ACTION # define LONG_FAILSAFE_ACTION 0 #endif ////////////////////////////////////////////////////////////////////////////// // AUTO_TRIM // #ifndef AUTO_TRIM # define AUTO_TRIM DISABLED #endif ////////////////////////////////////////////////////////////////////////////// // THROTTLE_OUT // #ifndef THROTTE_OUT # define THROTTLE_OUT ENABLED #endif ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // STARTUP BEHAVIOUR ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // GROUND_START_DELAY // #ifndef GROUND_START_DELAY # define GROUND_START_DELAY 0 #endif ////////////////////////////////////////////////////////////////////////////// // ENABLE ELEVON_MIXING // #ifndef ELEVON_MIXING # define ELEVON_MIXING DISABLED #endif #ifndef ELEVON_REVERSE # define ELEVON_REVERSE DISABLED #endif #ifndef ELEVON_CH1_REVERSE # define ELEVON_CH1_REVERSE DISABLED #endif #ifndef ELEVON_CH2_REVERSE # define ELEVON_CH2_REVERSE DISABLED #endif ////////////////////////////////////////////////////////////////////////////// // CAMERA TRIGGER AND CONTROL // // uses 1182 bytes of memory #ifndef CAMERA # define CAMERA ENABLED #endif ////////////////////////////////////////////////////////////////////////////// // MOUNT (ANTENNA OR CAMERA) // // uses 7726 bytes of memory on 2560 chips (all options are enabled) #ifndef MOUNT # define MOUNT ENABLED #endif ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // FLIGHT AND NAVIGATION CONTROL ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // Altitude measurement and control. // #ifndef ALTITUDE_MIX # define ALTITUDE_MIX 1 #endif ////////////////////////////////////////////////////////////////////////////// // AIRSPEED_CRUISE // #ifndef AIRSPEED_CRUISE # define AIRSPEED_CRUISE 12 // 12 m/s #endif #define AIRSPEED_CRUISE_CM AIRSPEED_CRUISE*100 ////////////////////////////////////////////////////////////////////////////// // MIN_GNDSPEED // #ifndef MIN_GNDSPEED # define MIN_GNDSPEED 0 // m/s (0 disables) #endif #define MIN_GNDSPEED_CM MIN_GNDSPEED*100 ////////////////////////////////////////////////////////////////////////////// // FLY_BY_WIRE_B airspeed control // #ifndef AIRSPEED_FBW_MIN # define AIRSPEED_FBW_MIN 9 #endif #ifndef AIRSPEED_FBW_MAX # define AIRSPEED_FBW_MAX 22 #endif #ifndef ALT_HOLD_FBW # define ALT_HOLD_FBW 0 #endif #define ALT_HOLD_FBW_CM ALT_HOLD_FBW*100 ////////////////////////////////////////////////////////////////////////////// // Servo Mapping // #ifndef THROTTLE_MIN # define THROTTLE_MIN 0 // percent #endif #ifndef THROTTLE_CRUISE # define THROTTLE_CRUISE 45 #endif #ifndef THROTTLE_MAX # define THROTTLE_MAX 75 #endif ////////////////////////////////////////////////////////////////////////////// // Autopilot control limits // #ifndef HEAD_MAX # define HEAD_MAX 45 #endif #ifndef PITCH_MAX # define PITCH_MAX 20 #endif #ifndef PITCH_MIN # define PITCH_MIN -25 #endif #define HEAD_MAX_CENTIDEGREE HEAD_MAX * 100 #define PITCH_MAX_CENTIDEGREE PITCH_MAX * 100 #define PITCH_MIN_CENTIDEGREE PITCH_MIN * 100 #ifndef RUDDER_MIX # define RUDDER_MIX 0.5f #endif ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // DEBUGGING ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // Dataflash logging control // #ifndef LOGGING_ENABLED # define LOGGING_ENABLED ENABLED #endif #if CONFIG_HAL_BOARD == HAL_BOARD_APM1 || CONFIG_HAL_BOARD == HAL_BOARD_APM2 #define DEFAULT_LOG_BITMASK \ MASK_LOG_ATTITUDE_MED | \ MASK_LOG_GPS | \ MASK_LOG_PM | \ MASK_LOG_NTUN | \ MASK_LOG_CTUN | \ MASK_LOG_MODE | \ MASK_LOG_CMD | \ MASK_LOG_COMPASS | \ MASK_LOG_CURRENT | \ MASK_LOG_TECS | \ MASK_LOG_CAMERA | \ MASK_LOG_RC #else // other systems have plenty of space for full logs #define DEFAULT_LOG_BITMASK 0xffff #endif ////////////////////////////////////////////////////////////////////////////// // Navigation defaults // #ifndef WP_RADIUS_DEFAULT # define WP_RADIUS_DEFAULT 90 #endif #ifndef LOITER_RADIUS_DEFAULT # define LOITER_RADIUS_DEFAULT 60 #endif #ifndef ALT_HOLD_HOME # define ALT_HOLD_HOME 100 #endif #define ALT_HOLD_HOME_CM ALT_HOLD_HOME*100 #ifndef USE_CURRENT_ALT # define USE_CURRENT_ALT FALSE #endif #ifndef INVERTED_FLIGHT_PWM # define INVERTED_FLIGHT_PWM 1750 #endif #ifndef PX4IO_OVERRIDE_PWM # define PX4IO_OVERRIDE_PWM 1750 #endif ////////////////////////////////////////////////////////////////////////////// // Developer Items // #ifndef SCALING_SPEED # define SCALING_SPEED 15.0 #endif // use this to completely disable the CLI. We now default the CLI to // off on smaller boards. #ifndef CLI_ENABLED #if HAL_CPU_CLASS > HAL_CPU_CLASS_16 # define CLI_ENABLED ENABLED #else # define CLI_ENABLED DISABLE #endif #endif // use this to disable geo-fencing #ifndef GEOFENCE_ENABLED # define GEOFENCE_ENABLED ENABLED #endif // pwm value on FENCE_CHANNEL to use to enable fenced mode #ifndef FENCE_ENABLE_PWM # define FENCE_ENABLE_PWM 1750 #endif // a digital pin to set high when the geo-fence triggers. Defaults // to -1, which means don't activate a pin #ifndef FENCE_TRIGGERED_PIN # define FENCE_TRIGGERED_PIN -1 #endif // if RESET_SWITCH_CH is not zero, then this is the PWM value on // that channel where we reset the control mode to the current switch // position (to for example return to switched mode after failsafe or // fence breach) #ifndef RESET_SWITCH_CHAN_PWM # define RESET_SWITCH_CHAN_PWM 1750 #endif // OBC Failsafe enable #ifndef OBC_FAILSAFE #if HAL_CPU_CLASS >= HAL_CPU_CLASS_75 # define OBC_FAILSAFE ENABLED #else # define OBC_FAILSAFE DISABLED #endif #endif #if OBC_FAILSAFE == ENABLED && HAL_CPU_CLASS < HAL_CPU_CLASS_75 #define CLI_ENABLED DISABLED #endif /* build a firmware version string. GIT_VERSION comes from Makefile builds */ #ifndef GIT_VERSION #define FIRMWARE_STRING THISFIRMWARE #else #define FIRMWARE_STRING THISFIRMWARE " (" GIT_VERSION ")" #endif
Yndal/ArduPilot-SensorPlatform
ardupilot/ArduPlane/config.h
C
mit
12,281
package gosquare type Meta struct { Code int `json:"code"` ErrorType string `json:"errorType"` ErrorDetails string `json:"errorDetails"` } type Notifications []Notification type Notification struct { Type string `json:"type"` Item interface{} `json:"item"` }
aykutaras/gosquare
base.go
GO
mit
286
package Mod.Items; import java.util.List; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.boss.EntityDragon; import net.minecraft.entity.boss.EntityWither; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import Mod.Lib.Refrence; import Mod.Main.Main; import Mod.Misc.MiscDamage; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ModItemSilverSword extends ItemSword { public ModItemSilverSword(int i, EnumToolMaterial enumToolMaterial){ super(i, enumToolMaterial); setCreativeTab(Main.CreativeTab); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon(Refrence.Mod_Id + ":" + "SilverSword"); } public boolean hitEntity(ItemStack itemstack, EntityLivingBase EntityHit, EntityLivingBase EntityAttacker) { if(EntityHit instanceof EntityDragon || EntityHit instanceof EntityWither || EntityHit instanceof EntityPlayer){ }else{ EntityHit.attackEntityFrom(new MiscDamage("Silver Sword", StatCollector.translateToLocal("string.death.silversword").replace("%Killed", EntityHit.getTranslatedEntityName().replace("%Killer", EntityAttacker.getTranslatedEntityName()))), 80F); EntityHit.attackEntityAsMob(EntityHit); if (itemstack.stackTagCompound == null){ itemstack.setTagCompound(new NBTTagCompound()); } if(itemstack.stackTagCompound.getInteger("Kills") == 0){ itemstack.stackTagCompound.setInteger("Kills", 1); }else{ itemstack.stackTagCompound.setInteger("Kills", itemstack.stackTagCompound.getInteger("Kills") + 1); } itemstack.stackTagCompound.setString("LastMob", EntityHit.getTranslatedEntityName()); itemstack.attemptDamageItem(1, EntityHit.worldObj.rand); } return false; } public void onCreated(ItemStack item, World world, EntityPlayer player) { if (item.stackTagCompound == null){ item.setTagCompound(new NBTTagCompound()); } item.stackTagCompound.setString("MadeBy", player.username); } @Override public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("items.desc.silversword.1")); if(itemstack.stackTagCompound != null){ list.add(StatCollector.translateToLocal("items.desc.silversword.2") + ": " + itemstack.stackTagCompound.getInteger("Kills")); if(itemstack.stackTagCompound.getString("LastMob") == null) list.add(StatCollector.translateToLocal("items.desc.silversword.4")); else list.add(StatCollector.translateToLocal("items.desc.silversword.3") + ": " + itemstack.stackTagCompound.getString("LastMob")); if(itemstack.stackTagCompound.getString("MadeBy") == null) list.add(StatCollector.translateToLocal("items.desc.silversword.6")); else list.add(StatCollector.translateToLocal("items.desc.silversword.5") + ": " + itemstack.stackTagCompound.getString("MadeBy")); }else{ list.add(StatCollector.translateToLocal("items.desc.silversword.2") + ": 0"); list.add(StatCollector.translateToLocal("items.desc.silversword.4")); list.add(StatCollector.translateToLocal("items.desc.silversword.6")); } } public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { return false; } }
tm1990/MiscItemsAndBlocks
common/Mod/Items/ModItemSilverSword.java
Java
mit
4,575
<?php namespace Dflydev\EncryptedFigCookies\Encryption\Adapter; use Dflydev\EncryptedFigCookies\Encryption\Encryption; use Zend\Filter\Decrypt; use Zend\Filter\Encrypt; class ZendCryptEncryption implements Encryption { /** * @var Decrypt */ private $decrypt; /** * @var Encrypt */ private $encrypt; public function __construct(Decrypt $decrypt, Encrypt $encrypt) { $this->decrypt = $decrypt; $this->encrypt = $encrypt; } public function decrypt($value) { return $this->decrypt->filter($value); } public function encrypt($value) { return $this->encrypt->filter($value); } }
dflydev/dflydev-encrypted-fig-cookies
src/Dflydev/EncryptedFigCookies/Encryption/Adapter/ZendCryptEncryption.php
PHP
mit
684
<b>Angular Component Using Observables!</b> <h6 style="margin-bottom: 0">VALUES:</h6> <div *ngFor="let value of values">- {{ value }}</div> <h6 style="margin-bottom: 0">ERRORs:</h6> <div>Errors: {{anyErrors}}</div> <h6 style="margin-bottom: 0">FINISHED:</h6> <div>Finished: {{ finished }}</div> <button style="margin-top: 2rem;" (click)="setData()">Init</button> <h3>Javascript: Arrow functions </h3> <code>function funcName(params) &#123; return params + 2; &#125;</code> can be shorterned Using <br/> <code>var funcName() = params => params + 2</code> <p><strong>Examples</strong></p><br/> <code>(parameters) => &#123; statements &#125;</code><br/> If we have no parameters, we express an arrow function like this:<br/> <code>() => &#123; statements &#125;</code><br/> When you only have one parameter, the opening parenthesis are optional:<br/> <code>parameters => &#123; statements &#125;</code><br/> Finally, if you are returning an expression, you remove the brackets:<br/> <code>parameters => expression</code><br/> reference: https://codeburst.io/javascript-arrow-functions-for-beginners-926947fc0cdc
imsangram/ng-course2
src/app/observables/observable.component.html
HTML
mit
1,116
<?php namespace Lyra; use Lyra\Interfaces\Widget; class WidgetRegistry implements \Lyra\Interfaces\WidgetRegistry { /** * {@inheritdoc} */ protected $widgets; public function __construct() { $this->widgets = []; } /** * {@inheritdoc} */ public function addWidget(\Lyra\Interfaces\Widget $widget) { return $this->widgets[$widget->getName()] = $widget; } /** * {@inheritdoc} */ public function getWidget($alias) { if (!isset($this->widgets[$alias])) { throw new ServiceNotFoundException(sprintf('Widget %s is actually not load into the WidgetRegistry'), $alias); } return $this->widgets[$alias]; } }
uaktags/lyraEngine
src/WidgetRegistry.php
PHP
mit
754
package com.tactfactory.harmony.platform.android.updater; import java.io.File; import java.io.IOException; import java.io.StringWriter; import com.tactfactory.harmony.generator.BaseGenerator; import com.tactfactory.harmony.platform.IAdapter; import com.tactfactory.harmony.updater.IAddEntityField; import com.tactfactory.harmony.utils.ConsoleUtils; import com.tactfactory.harmony.utils.TactFileUtils; import freemarker.template.Template; import freemarker.template.TemplateException; public class AddEntityFieldAndroid implements IAddEntityField{ private final String templatePath; private final String sourceFile; public AddEntityFieldAndroid( String templatePath, String sourceFile) { this.templatePath = templatePath; this.sourceFile = sourceFile; } @Override public void execute(BaseGenerator<? extends IAdapter> generator) { File file = new File(this.sourceFile); if (file != null && file.isFile()) { String strFile = TactFileUtils.fileToString(file); try { final Template tpl = generator.getCfg().getTemplate(this.templatePath); StringWriter out = new StringWriter(); tpl.process(generator.getDatamodel(), out); strFile = strFile.substring(0, strFile.lastIndexOf('}')); strFile = strFile.concat(out.toString() + "\n}"); TactFileUtils.writeStringToFile(file, strFile); } catch (IOException | TemplateException e) { ConsoleUtils.displayError(e); } } } }
TACTfactory/harmony-core
src/com/tactfactory/harmony/platform/android/updater/AddEntityFieldAndroid.java
Java
mit
1,647
<?php namespace Sideclick\EntityHelperBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; class SideclickEntityHelperBundle extends Bundle { }
Sideclick/EntityHelperBundle
src/SideclickEntityHelperBundle.php
PHP
mit
150
#!/usr/bin/env bash script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source $script_dir/../external/libshellscript/libshellscript/libshellscript.sh install_path=$HOME/.shell/kube-ps1 mkdir -p $(dirname $install_path) if ! [[ -e $install_path ]]; then print_information "installing kube-ps1" git clone https://github.com/jonmosco/kube-ps1.git $install_path else cd $install_path git pull fi
colajam93/dotfiles
kube-ps1/install.sh
Shell
mit
422
#ifndef COMPONENT_HPP #define COMPONENT_HPP #include "messages/spa_subscription_reply.hpp" #include "messages/spa_subscription_request.hpp" #include "messages/spa_data.hpp" #include "spa_communicator.hpp" #include "spa_message.hpp" #include <iostream> #include <memory> #include <vector> struct Subscriber { Subscriber(LogicalAddress la, uint16_t d) : subscriberAddress(la), deliveryRateDivisor(d) {} LogicalAddress subscriberAddress; uint16_t deliveryRateDivisor; }; class Component { public: typedef std::shared_ptr<SpaCommunicator> Com; Component(Com communicator = nullptr, LogicalAddress address = LogicalAddress(0, 0)) : communicator(communicator), address(address), dialogId(0), publishIter(1) { subscribers.reserve(8); // Default to 8 subscribers } virtual ~Component() {} //virtual void appShutdown() = 0; void publish(); virtual void sendSpaData(LogicalAddress) = 0; virtual void handleSpaData(std::shared_ptr<SpaMessage>) = 0; virtual void appInit() = 0; void sendMsg(std::shared_ptr<SpaMessage> message) { if (message == nullptr || communicator == nullptr) { return; } communicator->send(message); } void receiveMessage(std::shared_ptr<SpaMessage>); void handleSubscriptionReply(std::shared_ptr<SpaMessage>); void registerSubscriptionRequest(std::shared_ptr<SpaMessage>); void subscribe( LogicalAddress producer, uint8_t priority, uint32_t leasePeriod, uint16_t deliveryRateDivisor); Com communicator; protected: LogicalAddress address; uint8_t publishIter; uint16_t dialogId; std::vector<Subscriber> subscribers; // Should we make this a vector of pointers? }; #endif
SmallSatGasTeam/OpenSPA
lib/component.hpp
C++
mit
1,736
<!-- Replaced strings --> <form class="form-signin form-horizontal" id="replaced_strings_form" role="form"> <div class="col-sm-10 col-sm-offset-4"> <h2 class="form-signin-heading"><?= $this->lang->line("replaced_string_settings"); ?></h2> </div> <div class="form-group"> <div class="col-sm-offset-4 col-sm-6"> <input type="text" id="alert_word_count" name="alert_word_count" class="form-control" placeholder="<?= $this->lang->line("username"); ?>" required autofocus> </div> </div> </div> </form>
boh1996/TwitterAnalytics
v1/application/views/admin_strings_view.php
PHP
mit
511
/** ****************************************************************************** * @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_conf.h * @author MCD Application Team * @version V1.8.0 * @date 04-November-2016 * @brief Library configuration file. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2 * * 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. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F4xx_CONF_H #define __STM32F4xx_CONF_H /* Includes ------------------------------------------------------------------*/ /* Uncomment the line below to enable peripheral header file inclusion */ #include "stm32f4xx_adc.h" #include "stm32f4xx_crc.h" #include "stm32f4xx_dbgmcu.h" #include "stm32f4xx_dma.h" #include "stm32f4xx_exti.h" #include "stm32f4xx_flash.h" #include "stm32f4xx_gpio.h" #include "stm32f4xx_i2c.h" #include "stm32f4xx_iwdg.h" #include "stm32f4xx_pwr.h" #include "stm32f4xx_rcc.h" #include "stm32f4xx_rtc.h" #include "stm32f4xx_sdio.h" #include "stm32f4xx_spi.h" #include "stm32f4xx_syscfg.h" #include "stm32f4xx_tim.h" #include "stm32f4xx_usart.h" #include "stm32f4xx_wwdg.h" #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ #if defined (STM32F429_439xx) #include "stm32f4xx_cryp.h" #include "stm32f4xx_hash.h" #include "stm32f4xx_rng.h" #include "stm32f4xx_can.h" #include "stm32f4xx_dac.h" #include "stm32f4xx_dcmi.h" #include "stm32f4xx_dma2d.h" #include "stm32f4xx_fmc.h" #include "stm32f4xx_ltdc.h" #include "stm32f4xx_sai.h" #endif /* STM32F429_439xx */ #if defined (STM32F427_437xx) #include "stm32f4xx_cryp.h" #include "stm32f4xx_hash.h" #include "stm32f4xx_rng.h" #include "stm32f4xx_can.h" #include "stm32f4xx_dac.h" #include "stm32f4xx_dcmi.h" #include "stm32f4xx_dma2d.h" #include "stm32f4xx_fmc.h" #include "stm32f4xx_sai.h" #endif /* STM32F427_437xx */ #if defined (STM32F40_41xxx) #include "stm32f4xx_cryp.h" #include "stm32f4xx_hash.h" #include "stm32f4xx_rng.h" #include "stm32f4xx_can.h" #include "stm32f4xx_dac.h" #include "stm32f4xx_dcmi.h" #include "stm32f4xx_fsmc.h" #endif /* STM32F40_41xxx */ /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* If an external clock source is used, then the value of the following define should be set to the value of the external clock source, else, if no external clock is used, keep this define commented */ /*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */ /* Uncomment the line below to expanse the "assert_param" macro in the Standard Peripheral Library drivers code */ /* #define USE_FULL_ASSERT 1 */ /* Exported macro ------------------------------------------------------------*/ #ifdef USE_FULL_ASSERT /** * @brief The assert_param macro is used for function's parameters check. * @param expr: If expr is false, it calls assert_failed function * which reports the name of the source file and the source * line number of the call that failed. * If expr is true, it returns no value. * @retval None */ #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) /* Exported functions ------------------------------------------------------- */ void assert_failed(uint8_t* file, uint32_t line); #else #define assert_param(expr) ((void)0) #endif /* USE_FULL_ASSERT */ #endif /* __STM32F4xx_CONF_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
craftit/BMC2-Firmware
Firmware/ext/STM32F4xx_DSP_StdPeriph_Lib/Project/STM32F4xx_StdPeriph_Examples/FMC/FMC_SDRAM_SRAM_BankSwitch/stm32f4xx_conf.h
C
mit
4,504
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>18 --> 19</title> <link href="./../../assets/style.css" rel="stylesheet"> </head> <body> <h2>You have to be fast</h2> <a href="./f1bdca944d6aea435faa46b38cfdd496460c0037b4764850c66feea2d0c2393a.html">Teleport</a> <hr> <a href="./../../about.md">About</a> (Spoilers! ) <script src="./../../assets/md5.js"></script> <script> window.currentLevel = 7; </script> <script src="./../../assets/script.js"></script> </body> </html>
simonmysun/praxis
TAIHAO2019/pub/SmallGame/AsFastAsYouCan2/5615562191eb5885cf1c5c0241907a712af52704d4e670ab7a61759544b5326b.html
HTML
mit
550
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package com.microsoft.spring.data.gremlin.repository.config; import org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport; import org.springframework.data.repository.config.RepositoryConfigurationExtension; import java.lang.annotation.Annotation; public class GremlinRepositoryRegistrar extends RepositoryBeanDefinitionRegistrarSupport { @Override protected Class<? extends Annotation> getAnnotation() { return EnableGremlinRepositories.class; } @Override protected RepositoryConfigurationExtension getExtension() { return new GremlinRepositoryConfigurationExtension(); } }
selvasingh/azure-sdk-for-java
sdk/spring/azure-spring-data-gremlin/src/main/java/com/microsoft/spring/data/gremlin/repository/config/GremlinRepositoryRegistrar.java
Java
mit
746
/* * Message.cc * * Created on: Apr 13, 2014 * Author: wilfeli */ #include "Message.h" Message::Message(std::string s_):type(s_){}; MessagePSSendPayment::MessagePSSendPayment(IPSAgent* a_, double q_, std::string type_): Message(type_), getter(a_), q(q_){}; MessagePSSendPayment::MessagePSSendPayment(double q_, std::string type_): Message(type_), q(q_){}; //MessageSellC::MessageSellC(Message* inf_, Contract<Agent, Agent>* c_): inf(inf_), contract(c_){ // type = "SellC"; //}; MessageMarketLSellC::MessageMarketLSellC (MarketL* _sender, IBuyerL* _buyer, double _p, double _q): sender(_sender), buyer(_buyer), p(_p), q(_q) { type = "MarketLSellC"; }; MessageMarketCSellGoodC::MessageMarketCSellGoodC (MarketC* _sender, IBuyerC* _buyer, double _p, double _q): sender(_sender), buyer(_buyer), p(_p), q(_q) { type = "MarketCSellGoodC"; }; MessageMarketLCheckAsk::MessageMarketLCheckAsk (MarketL* _sender, double _p_eq): sender(_sender), p_eq(_p_eq){ type = "MarketLCheckAsk"; }; MessageMarketLCheckBid::MessageMarketLCheckBid (MarketL* _sender, double _p_eq): sender(_sender), p_eq(_p_eq){ type = "MarketLCheckBid"; }; MessageMarketCCheckAsk::MessageMarketCCheckAsk (MarketC* _sender, double _p_eq): sender(_sender), p_eq(_p_eq){ type = "MarketCCheckAsk"; }; MessageMarketCCheckBid::MessageMarketCCheckBid (MarketC* _sender, double _p_eq): sender(_sender), p_eq(_p_eq){ type = "MarketCCheckBid"; }; MessageGoodC::MessageGoodC(double q_, double p_): q(q_), p(p_){ type = "asGC"; }; MessageBankruptcy::MessageBankruptcy(F* agent_): agent(agent_){ type = "Bankruptcy"; }; MessageBankruptcyH::MessageBankruptcyH(H* agent_): agent(agent_){ type = "Bankruptcy"; }; MessageMakeDec::MessageMakeDec(){ type = "MakeDec"; }; MessageStatus::MessageStatus(double status_): status(status_){ type = "Status"; };
wilfeli/DMGameBasic
src/Message.cpp
C++
mit
1,845
import React, { PropTypes, Component } from 'react'; import cx from 'classnames'; import Modal from '../Modal'; import FontIcon from '../FontIcon'; import s from './AssignTo.scss'; class AssignTo extends Component { state = { nodeIdx: null, treeData: [], }; componentDidMount = () => this.setState({ nodeIdx: this.props.document.tags, treeData: this.props.treeData.map(node => this.props.document.tags.indexOf(node.id) !== -1 ? Object.assign({}, node, { isTarget: true }) : Object.assign({}, node, { isTarget: false }) ), }); /** * Handles dismiss */ handleOnDismiss = () => this.props.onCancel(); /** * Handles confirmation */ handleOnConfirm = () => { this.props.onConfirm(this.props.document._id, this.state.nodeIdx); this.handleOnDismiss(); }; /** * Handles click on tree view's element * @param {String} id - Current Tree Node * @param {Event} event - Event * @param isDisabled {Boolean} */ handleOnClickOnTreeItem = (id, event, isDisabled) => { event.stopPropagation(); if (!isDisabled) { const { nodeIdx } = this.state; const newNodeIdx = nodeIdx.indexOf(id) !== -1 ? nodeIdx.filter(node => node !== id) // remove if already added : [...new Set([...this.state.nodeIdx, id])]; this.setState({ nodeIdx: newNodeIdx, isRoot: false, treeData: this.state.treeData.map(node => newNodeIdx.indexOf(node.id) !== -1 ? Object.assign({}, node, { isTarget: true }) : Object.assign({}, node, { isTarget: false }) ), }); } }; /** * Handles key down on tree view's element * @param {String} id - Current Tree Node ID * @param {Event} event - Event * @param isDisabled {Boolean} */ handleOnKeyDownOnTreeItem = (id, event, isDisabled) => { if (!isDisabled) { if (event.keyCode === 13 || event.keyCode === 32) { this.handleOnClickOnTreeItem(id, event, isDisabled); // enter or space } } }; /** * Render tree item * @param {Object} [node] Tree Node * @param {number} [key] * @return {XML} Tree Item. */ renderChild = (node) => { const { treeData } = this.state; const { canAssignSystemTags } = this.props; const isDisabled = !canAssignSystemTags && node.isSystem; const children = node ? treeData.map(child => child.parentId === node.id ? this.renderChild(child) : null) : null; return node.id === '0' ? null : ( <li role="treeitem" key={node.id} tabIndex="0" onClick={(event) => this.handleOnClickOnTreeItem(node.id, event, isDisabled)} onKeyDown={(event) => this.handleOnKeyDownOnTreeItem(node.id, event)} className={cx(s.child, { [s.child_target]: node.isTarget, [s.child_disabled]: isDisabled, })} > <div className={s.item}> <FontIcon name={cx({ ['folder']: node.isTarget, ['folder-o']: !node.isTarget, })} /> <span>{node.name}</span> </div> <ul className={s.node} role="group"> { children } </ul> </li> ); }; render() { const { strCancelLabel, strCaption, strSaveLabel } = this.props; const { nodeIdx, treeData } = this.state; return ( <Modal caption={strCaption} confirmText={strSaveLabel} customBodyClassName={s.muted} dismissText={strCancelLabel} isConfirmDisabled={nodeIdx === null} onConfirm={this.handleOnConfirm} onDismiss={this.handleOnDismiss} > <div className={s.tree}> <ul className={s.node} role="tree"> { treeData.map(node => node.isRoot ? this.renderChild(node) : null )} </ul> </div> </Modal> ); } } AssignTo.propTypes = { canAssignSystemTags: PropTypes.bool, document: PropTypes.object, message: PropTypes.string, onCancel: PropTypes.func, onConfirm: PropTypes.func, onMount: PropTypes.func, strCancelLabel: PropTypes.string, strCaption: PropTypes.string, strSaveLabel: PropTypes.string, tagId: PropTypes.string, tagName: PropTypes.string, treeData: PropTypes.array, }; AssignTo.defaultProps = { canAssignSystemTags: false, message: '', treeData: [], }; export default AssignTo;
peinanshow/react-redux-samples
src/components/common/AssignTo/AssignTo.js
JavaScript
mit
4,465
import { Component } from '@angular/core'; import { NgForm } from '@angular/forms'; import { AppConfig, AppRequest } from '../shared/index'; import { UserModel } from '../+users/user.interface'; import { TranslationComponent } from '../shared/translation/translation.component'; import { CacheComponent } from '../shared/cache/cache.component'; import { AlertComponent } from 'ng2-bootstrap/ng2-bootstrap'; @Component({ moduleId: module.id, selector: 'sd-profile', templateUrl: 'profile.component.html', directives: [AlertComponent], providers: [AppConfig, AppRequest] }) export class ProfileComponent { private _apiUrl = "user"; private _errorMessage: any; hostUpload: string; tr: any; alerts: any = {}; model: UserModel; userBack: any; constructor( private _tr: TranslationComponent, private _cache: CacheComponent, private _appRequest: AppRequest ) { this.tr = _tr.getTranslation(_cache.getItem('lang')); _cache.dataAdded$.subscribe((data: any) => { if (data.hasOwnProperty('user')) this.model = data['user']; this.model.chpassword = false; this.model.password = ""; this.model.newpassword = ""; this.model.newrepassword = ""; this.userBack = this.model; if (data.hasOwnProperty('lang')) { this.tr = _tr.getTranslation(data['lang']); } }); } isValid() { let valid = true; if (!this.model.email || !this.model.role) { valid = false; } if (this.model.chpassword && ( !this.model.password || this.model.password.length < 5 || !this.model.newpassword || this.model.newpassword.length < 5 || !this.model.newrepassword || this.model.newrepassword.length < 5 )) { valid = false; } return valid; } /** * Send update request to API */ changeProfile() { let sendData = [this.model]; this._appRequest.putAction(this._apiUrl, sendData) .subscribe((res: any) => { if (res.hasOwnProperty("warning")) { this.alerts.warning = this.tr[res.warning]; } if (res.hasOwnProperty("info")) { if (res.info === 1) { this.alerts.info = this.tr.profileChanged; } if (res.info === 0) { this.alerts.warning = this.tr.profileNotChanged; this.model = this.userBack; } } }, (error: any) => this._errorMessage = error ); } /** * Close profile info alert */ closeAlert(alert: string) { this.alerts[alert] = null; } }
martinsvb/Angular2_bootstrap_seed
src/client/app/+profile/profile.component.ts
TypeScript
mit
2,850
/* The MIT License (MIT) Copyright (c) 2014 Harun Hasdal Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.github.harunhasdal.livecycle.sftp; public class SFTPParameterException extends RuntimeException { public SFTPParameterException() { super(); } public SFTPParameterException(String s) { super(s); } public SFTPParameterException(String s, Throwable throwable) { super(s, throwable); } public SFTPParameterException(Throwable throwable) { super(throwable); } }
harunhasdal/sftp-connector
src/main/java/com/github/harunhasdal/livecycle/sftp/SFTPParameterException.java
Java
mit
1,476
/* * This file is part of the OpenMV project. * Copyright (c) 2013/2014 Ibrahim Abdelkader <i.abdalkader@gmail.com> * This work is licensed under the MIT license, see the file LICENSE for details. * * Filter Functions. * * Filter functions bypass the default line processing in sensor.c, and pre-process lines. * Processing is done on the fly, i.e. filters are called from after each line is received. * * Note: bpp is the target bpp, not the line bpp (the line is always 2 bytes per pixel) if the target bpp is 1 * it means the image currently being read is going to be Grayscale, and the function needs to output w*1bpp. */ #include <stdint.h> #include "imlib.h" // RGB565 to YUV table extern const int8_t yuv_table[196608]; void im_filter_bw(uint8_t *src, uint8_t *dst, int size, int bpp, void *args) { int lower = ((int*)args)[0]; int upper = ((int*)args)[1]; if (bpp == 1) { // Extract Y channel from YUV and process for (int i=0; i<size; i++) { dst[i] = (src[i<<1] >= lower && src[i<<1] <= upper) ? 0xFF : 0; } } else { // Lookup Y channel from RGB2YUV uint16_t *srcrgb = (uint16_t*) src; uint16_t *dstrgb = (uint16_t*) dst; for (int i=0; i<size; i++) { int y = yuv_table[srcrgb[i] * 3 + 0]+128; dstrgb[i] = (y >= lower && y <= upper) ? 0xFFFF : 0; } } } // Thresholds taken from "Skin Segmentation Using YUV and RGB Color Spaces" Zaher Hamid Al-Tairi void im_filter_skin(uint8_t *src, uint8_t *dst, int size, int bpp, void *args) { if (bpp == 1) { // Kinda works for (int i=0; i<size; i+=2, src+=4) { //uint8_t y0 = src[0]; uint8_t u = src[1]; //uint8_t y1 = src[2]; uint8_t v = src[3]; // YCbCr dst[i+0] = (u>80 && u<130 && v>136 && v<200 && v>u) ? 255 : 0; dst[i+1] = (u>80 && u<130 && v>136 && v<200 && v>u) ? 255 : 0; } } else { // This doesn't work uint16_t *srcrgb = (uint16_t*) src; uint16_t *dstrgb = (uint16_t*) dst; for (int i=0; i<size; i++) { int r = IM_R528(srcrgb[i]); int g = IM_G628(srcrgb[i]); int b = IM_B528(srcrgb[i]); //int y = yuv_table[srcrgb[i] * 3 + 0] + 128; int u = (int) yuv_table[srcrgb[i] * 3 + 1] + 128; int v = (int) yuv_table[srcrgb[i] * 3 + 2] + 128; dstrgb[i] = (u>80 && u<130 && v>136 && v<200 && r>80 && g>30 && b>15 && (((r-g)*(r-g)) > 225)) ? srcrgb[i] : 0; } } }
lgranade/ciaa_cv
x86/omv/im_filter.c
C
mit
2,625
import test from 'tape'; import Validation from '../../src/validation'; import _ from 'lodash'; const v = new Validation(); test('isFalse: validates isFalse', t => { let rule = {a: "isFalse"}; t.equal(v.validate({a: false}, rule), undefined); t.deepEqual(v.validate({a: true}, rule), {a: ['must be false']}); rule = {a: {validate: "isFalse", message: '${$propertyPath}:${$value} is not false'}}; t.equal(v.validate({a: false}, rule), undefined); t.deepEqual(v.validate({a: true}, rule), {a: ['a:true is not false']}); rule = { a: { validate: "isFalse", value: "b < c", message: "b:${$this.b} must be greater than c:${$this.c}" } }; t.equal(v.validate({a: true, b: 2, c: 1}, rule), undefined); t.deepEqual(v.validate({a: false, b: 1, c: 2}, rule), {a: ['b:1 must be greater than c:2']}); rule = { a: [{ validate: "isFalse", value: "b < c", message: "b:${$this.b} must be greater than c:${$this.c}" }] }; t.equal(v.validate({a: true, b: 2, c: 1}, rule), undefined); t.deepEqual(v.validate({a: false, b: 1, c: 2}, rule), {a: ['b:1 must be greater than c:2']}); t.end(); });
buttonwoodcx/bcx-validation
test/standard-transformers-and-validators/is-false.spec.js
JavaScript
mit
1,160
/* Copyright (c) 2007 Danny Chapman http://www.rowlhouse.co.uk This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * @author Muzer(muzerly@gmail.com) * @link http://code.google.com/p/jiglibflash */ (function(jigLib){ var Vector3D=jigLib.Vector3D; var JConfig=jigLib.JConfig; var Vector3D=jigLib.Vector3D; var Matrix3D=jigLib.Matrix3D; var JMatrix3D=jigLib.JMatrix3D; var JNumber3D=jigLib.JNumber3D; var MaterialProperties=jigLib.MaterialProperties; var PhysicsState=jigLib.PhysicsState; var PhysicsSystem=jigLib.PhysicsSystem; var JAABox=jigLib.JAABox; var RigidBody=function(skin){ this._useDegrees = (JConfig.rotationType == "DEGREES") ? true : false; this._id = RigidBody.idCounter++; this._skin = skin; this._material = new MaterialProperties(); this._bodyInertia = new Matrix3D(); this._bodyInvInertia = JMatrix3D.getInverseMatrix(this._bodyInertia); this._currState = new PhysicsState(); this._oldState = new PhysicsState(); this._storeState = new PhysicsState(); this._invOrientation = JMatrix3D.getInverseMatrix(this._currState.get_orientation()); this._currLinVelocityAux = new Vector3D(); this._currRotVelocityAux = new Vector3D(); this._force = new Vector3D(); this._torque = new Vector3D(); this._linVelDamping = new Vector3D(0.995, 0.995, 0.995); this._rotVelDamping = new Vector3D(0.5, 0.5, 0.5); this._maxLinVelocities = 500; this._maxRotVelocities = 50; this._velChanged = false; this._inactiveTime = 0; this.isActive = this._activity = true; this._movable = true; this._origMovable = true; this.collisions = []; this._constraints = []; this._nonCollidables = []; this._storedPositionForActivation = new Vector3D(); this._bodiesToBeActivatedOnMovement = []; this._lastPositionForDeactivation = this._currState.position.clone(); this._lastOrientationForDeactivation = this._currState.get_orientation().clone(); this._type = "Object3D"; this._boundingSphere = 0; this._boundingBox = new JAABox(new Vector3D(), new Vector3D()); this._boundingBox.clear(); } RigidBody.idCounter = 0; RigidBody.prototype._id=null; RigidBody.prototype._skin=null; RigidBody.prototype._type=null; RigidBody.prototype._boundingSphere=null; RigidBody.prototype._boundingBox=null; RigidBody.prototype._currState=null; RigidBody.prototype._oldState=null; RigidBody.prototype._storeState=null; RigidBody.prototype._invOrientation=null; RigidBody.prototype._currLinVelocityAux=null; RigidBody.prototype._currRotVelocityAux=null; RigidBody.prototype._mass=null; RigidBody.prototype._invMass=null; RigidBody.prototype._bodyInertia=null; RigidBody.prototype._bodyInvInertia=null; RigidBody.prototype._worldInertia=null; RigidBody.prototype._worldInvInertia=null; RigidBody.prototype._force=null; RigidBody.prototype._torque=null; RigidBody.prototype._linVelDamping=null; RigidBody.prototype._rotVelDamping=null; RigidBody.prototype._maxLinVelocities=null; RigidBody.prototype._maxRotVelocities=null; RigidBody.prototype._velChanged=null; RigidBody.prototype._activity=null; RigidBody.prototype._movable=null; RigidBody.prototype._origMovable=null; RigidBody.prototype._inactiveTime=null; // The list of bodies that need to be activated when we move away from our stored position RigidBody.prototype._bodiesToBeActivatedOnMovement=null; RigidBody.prototype._storedPositionForActivation=null;// The position stored when we need to notify other bodies RigidBody.prototype._lastPositionForDeactivation=null;// last position for when trying the deactivate RigidBody.prototype._lastOrientationForDeactivation=null;// last orientation for when trying to deactivate RigidBody.prototype._material=null; RigidBody.prototype._rotationX = 0; RigidBody.prototype._rotationY = 0; RigidBody.prototype._rotationZ = 0; RigidBody.prototype._useDegrees=null; RigidBody.prototype._nonCollidables=null; RigidBody.prototype._constraints=null; RigidBody.prototype.collisions=null; RigidBody.prototype.isActive=null; RigidBody.prototype.radiansToDegrees=function(rad){ return rad * 180 / Math.PI; } RigidBody.prototype.degreesToRadians=function(deg){ return deg * Math.PI / 180; } RigidBody.prototype.get_rotationX=function(){ return this._rotationX;//(_useDegrees) ? radiansToDegrees(_rotationX) : _rotationX; } RigidBody.prototype.get_rotationY=function(){ return this._rotationY;//(_useDegrees) ? radiansToDegrees(_rotationY) : _rotationY; } RigidBody.prototype.get_rotationZ=function(){ return this._rotationZ;//(_useDegrees) ? radiansToDegrees(_rotationZ) : _rotationZ; } /** * px - angle in Radians or Degrees */ RigidBody.prototype.set_rotationX=function(px){ //var rad:Number = (_useDegrees) ? degreesToRadians(px) : px; this._rotationX = px; this.setOrientation(this.createRotationMatrix()); } /** * py - angle in Radians or Degrees */ RigidBody.prototype.set_rotationY=function(py){ //var rad:Number = (_useDegrees) ? degreesToRadians(py) : py; this._rotationY = py; this.setOrientation(this.createRotationMatrix()); } /** * pz - angle in Radians or Degrees */ RigidBody.prototype.set_rotationZ=function(pz){ //var rad:Number = (_useDegrees) ? degreesToRadians(pz) : pz; this._rotationZ = pz; this.setOrientation(this.createRotationMatrix()); } RigidBody.prototype.pitch=function(rot){ this.setOrientation(JMatrix3D.getAppendMatrix3D(this.get_currentState().orientation, JMatrix3D.getRotationMatrixAxis(rot, Vector3D.X_AXIS))); } RigidBody.prototype.yaw=function(rot){ this.setOrientation(JMatrix3D.getAppendMatrix3D(this.get_currentState().orientation, JMatrix3D.getRotationMatrixAxis(rot, Vector3D.Y_AXIS))); } RigidBody.prototype.roll=function(rot){ this.setOrientation(JMatrix3D.getAppendMatrix3D(this.get_currentState().orientation, JMatrix3D.getRotationMatrixAxis(rot, Vector3D.Z_AXIS))); } RigidBody.prototype.createRotationMatrix=function(){ var matrix3D = new Matrix3D(); matrix3D.appendRotation(this._rotationX, Vector3D.X_AXIS); matrix3D.appendRotation(this._rotationY, Vector3D.Y_AXIS); matrix3D.appendRotation(this._rotationZ, Vector3D.Z_AXIS); return matrix3D; } RigidBody.prototype.setOrientation=function(orient){ //this._currState.get_orientation() = orient.clone(); this._currState.set_orientation(orient.clone()); this.updateInertia(); this.updateState(); } RigidBody.prototype.get_x=function(){ return this._currState.position.x; } RigidBody.prototype.get_y=function(){ return this._currState.position.y; } RigidBody.prototype.get_z=function(){ return this._currState.position.z; } RigidBody.prototype.set_x=function(px){ this._currState.position.x = px; this.updateState(); } RigidBody.prototype.set_y=function(py){ this._currState.position.y = py; this.updateState(); } RigidBody.prototype.set_z=function(pz){ this._currState.position.z = pz; this.updateState(); } RigidBody.prototype.moveTo=function(pos){ this._currState.position = pos.clone(); this.updateState(); } RigidBody.prototype.updateState=function(){ this._currState.linVelocity = new Vector3D(); this._currState.rotVelocity = new Vector3D(); this.copyCurrentStateToOld(); this.updateBoundingBox(); } RigidBody.prototype.setVelocity=function(vel){ this._currState.linVelocity = vel.clone(); } RigidBody.prototype.setAngVel=function(angVel){ this._currState.rotVelocity = angVel.clone(); } RigidBody.prototype.setVelocityAux=function(vel){ this._currLinVelocityAux = vel.clone(); } RigidBody.prototype.setAngVelAux=function(angVel){ this._currRotVelocityAux = angVel.clone(); } RigidBody.prototype.addGravity=function(){ if (!this._movable){ return; } this._force = this._force.add(JNumber3D.getScaleVector(jigLib.PhysicsSystem.getInstance().get_gravity(), this._mass)); this._velChanged = true; } RigidBody.prototype.addExternalForces=function(dt){ this.addGravity(); } RigidBody.prototype.addWorldTorque=function(t){ if (!this._movable){ return; } this._torque = this._torque.add(t); this._velChanged = true; this.setActive(); } RigidBody.prototype.addBodyTorque=function(t){ if (!this._movable){ return; } JMatrix3D.multiplyVector(this._currState.get_orientation(), t); this.addWorldTorque(t); } // functions to add forces in the world coordinate frame RigidBody.prototype.addWorldForce=function(f, p){ if (!this._movable){ return; } this._force = this._force.add(f); this.addWorldTorque(p.subtract(this._currState.position).crossProduct(f)); this._velChanged = true; this.setActive(); } // functions to add forces in the body coordinate frame RigidBody.prototype.addBodyForce=function(f, p){ if (!this._movable){ return; } JMatrix3D.multiplyVector(this._currState.get_orientation(), f); JMatrix3D.multiplyVector(this._currState.get_orientation(), p); this.addWorldForce(f, this._currState.position.add(p)); } // This just sets all forces etc to zero RigidBody.prototype.clearForces=function(){ this._force = new Vector3D(); this._torque = new Vector3D(); } // functions to add impulses in the world coordinate frame RigidBody.prototype.applyWorldImpulse=function(impulse, pos){ if (!this._movable){ return; } this._currState.linVelocity = this._currState.linVelocity.add(JNumber3D.getScaleVector(impulse, this._invMass)); var rotImpulse = pos.subtract(this._currState.position).crossProduct(impulse); JMatrix3D.multiplyVector(this._worldInvInertia, rotImpulse); this._currState.rotVelocity = this._currState.rotVelocity.add(rotImpulse); this._velChanged = true; } RigidBody.prototype.applyWorldImpulseAux=function(impulse, pos){ if (!this._movable){ return; } this._currLinVelocityAux = this._currLinVelocityAux.add(JNumber3D.getScaleVector(impulse, this._invMass)); var rotImpulse = pos.subtract(this._currState.position).crossProduct(impulse); JMatrix3D.multiplyVector(this._worldInvInertia, rotImpulse); this._currRotVelocityAux = this._currRotVelocityAux.add(rotImpulse); this._velChanged = true; } // functions to add impulses in the body coordinate frame RigidBody.prototype.applyBodyWorldImpulse=function(impulse, delta){ if (!this._movable){ return; } this._currState.linVelocity = this._currState.linVelocity.add(JNumber3D.getScaleVector(impulse, this._invMass)); var rotImpulse = delta.crossProduct(impulse); JMatrix3D.multiplyVector(this._worldInvInertia, rotImpulse); this._currState.rotVelocity = this._currState.rotVelocity.add(rotImpulse); this._velChanged = true; } RigidBody.prototype.applyBodyWorldImpulseAux=function(impulse, delta){ if (!this._movable){ return; } this._currLinVelocityAux = this._currLinVelocityAux.add(JNumber3D.getScaleVector(impulse, this._invMass)); var rotImpulse = delta.crossProduct(impulse); JMatrix3D.multiplyVector(this._worldInvInertia, rotImpulse); this._currRotVelocityAux = this._currRotVelocityAux.add(rotImpulse); this._velChanged = true; } RigidBody.prototype.addConstraint=function(constraint){ if (!this.findConstraint(constraint)){ this._constraints.push(constraint); } } RigidBody.prototype.removeConstraint=function(constraint){ if (this.findConstraint(constraint)){ this._constraints.splice(this._constraints.indexOf(constraint), 1); } } RigidBody.prototype.removeAllConstraints=function(){ this._constraints = []; } RigidBody.prototype.findConstraint=function(constraint){ for(var i=0; i<this._constraints.length;i++){ if (constraint == this._constraints[i]){ return true; } } return false; } // implementation updates the velocity/angular rotation with the force/torque. RigidBody.prototype.updateVelocity=function(dt){ if (!this._movable || !this._activity){ return; } this._currState.linVelocity = this._currState.linVelocity.add(JNumber3D.getScaleVector(this._force, this._invMass * dt)); var rac = JNumber3D.getScaleVector(this._torque, dt); JMatrix3D.multiplyVector(this._worldInvInertia, rac); this._currState.rotVelocity = this._currState.rotVelocity.add(rac); } // Updates the position with the auxiliary velocities, and zeros them RigidBody.prototype.updatePositionWithAux=function(dt){ if (!this._movable || !this._activity){ this._currLinVelocityAux = new Vector3D(); this._currRotVelocityAux = new Vector3D(); return; } var ga = jigLib.PhysicsSystem.getInstance().get_gravityAxis(); if (ga != -1){ var arr = JNumber3D.toArray(this._currLinVelocityAux); arr[(ga + 1) % 3] *= 0.1; arr[(ga + 2) % 3] *= 0.1; JNumber3D.copyFromArray(this._currLinVelocityAux, arr); } var angMomBefore = this._currState.rotVelocity.clone(); JMatrix3D.multiplyVector(this._worldInertia, angMomBefore); this._currState.position = this._currState.position.add(JNumber3D.getScaleVector(this._currState.linVelocity.add(this._currLinVelocityAux), dt)); var dir = this._currState.rotVelocity.add(this._currRotVelocityAux); var ang = dir.get_length() * 180 / Math.PI; if (ang > 0){ dir.normalize(); ang *= dt; var rot = JMatrix3D.getRotationMatrix(dir.x, dir.y, dir.z, ang); this._currState.set_orientation(JMatrix3D.getAppendMatrix3D(this._currState.get_orientation(), rot)); this.updateInertia(); } this._currLinVelocityAux = new Vector3D(); this._currRotVelocityAux = new Vector3D(); JMatrix3D.multiplyVector(this._worldInvInertia, angMomBefore); this._currState.rotVelocity = angMomBefore.clone(); this.updateBoundingBox(); } RigidBody.prototype.postPhysics=function(dt){ } // function provided for the use of Physics system RigidBody.prototype.tryToFreeze=function(dt){ if (!this._movable || !this._activity){ return; } if (this._currState.position.subtract(this._lastPositionForDeactivation).get_length() > JConfig.posThreshold){ this._lastPositionForDeactivation = this._currState.position.clone(); this._inactiveTime = 0; return; } var ot = JConfig.orientThreshold; var deltaMat = JMatrix3D.getSubMatrix(this._currState.get_orientation(), this._lastOrientationForDeactivation); var cols = JMatrix3D.getCols(deltaMat); if (cols[0].get_length() > ot || cols[1].get_length() > ot || cols[2].get_length() > ot){ this._lastOrientationForDeactivation = this._currState.get_orientation().clone(); this._inactiveTime = 0; return; } if (this.getShouldBeActive()){ return; } this._inactiveTime += dt; if (this._inactiveTime > JConfig.deactivationTime){ this._lastPositionForDeactivation = this._currState.position.clone(); this._lastOrientationForDeactivation = this._currState.get_orientation().clone(); this.setInactive(); } } RigidBody.prototype.set_mass=function(m){ this._mass = m; this._invMass = 1 / m; this.setInertia(this.getInertiaProperties(m)); } RigidBody.prototype.setInertia=function(matrix3D){ this._bodyInertia = matrix3D.clone(); this._bodyInvInertia = JMatrix3D.getInverseMatrix(this._bodyInertia.clone()); this.updateInertia(); } RigidBody.prototype.updateInertia=function(){ this._invOrientation = JMatrix3D.getTransposeMatrix(this._currState.get_orientation()); this._worldInertia = JMatrix3D.getAppendMatrix3D( this._invOrientation, JMatrix3D.getAppendMatrix3D(this._currState.get_orientation(), this._bodyInertia) ); this._worldInvInertia = JMatrix3D.getAppendMatrix3D( this._invOrientation, JMatrix3D.getAppendMatrix3D(this._currState.get_orientation(), this._bodyInvInertia) ); } // prevent velocity updates etc RigidBody.prototype.get_movable=function(){ return this._movable; } RigidBody.prototype.set_movable=function(mov){ if (this._type == "PLANE" || this._type == "TERRAIN") { return; } this._movable = mov; this.isActive = this._activity = mov; this._origMovable = mov; } RigidBody.prototype.internalSetImmovable=function(){ this._origMovable = this._movable; this._movable = false; } RigidBody.prototype.internalRestoreImmovable=function(){ this._movable = this._origMovable; } RigidBody.prototype.getVelChanged=function(){ return this._velChanged; } RigidBody.prototype.clearVelChanged=function(){ this._velChanged = false; } RigidBody.prototype.setActive=function(activityFactor){ if(!activityFactor) activityFactor=1; if (this._movable){ this.isActive = this._activity = true; this._inactiveTime = (1 - activityFactor) * JConfig.deactivationTime; } } RigidBody.prototype.setInactive=function(){ if (this._movable){ this.isActive = this._activity = false; } } // Returns the velocity of a point at body-relative position RigidBody.prototype.getVelocity=function(relPos){ return this._currState.linVelocity.add(this._currState.rotVelocity.crossProduct(relPos)); } // As GetVelocity but just uses the aux velocities RigidBody.prototype.getVelocityAux=function(relPos){ return this._currLinVelocityAux.add(this._currRotVelocityAux.crossProduct(relPos)); } // indicates if the velocity is above the threshold for freezing RigidBody.prototype.getShouldBeActive=function(){ return ((this._currState.linVelocity.get_length() > JConfig.velThreshold) || (this._currState.rotVelocity.get_length() > JConfig.angVelThreshold)); } RigidBody.prototype.getShouldBeActiveAux=function(){ return ((this._currLinVelocityAux.get_length() > JConfig.velThreshold) || (this._currRotVelocityAux.get_length() > JConfig.angVelThreshold)); } // damp movement as the body approaches deactivation RigidBody.prototype.dampForDeactivation=function(){ this._currState.linVelocity.x *= this._linVelDamping.x; this._currState.linVelocity.y *= this._linVelDamping.y; this._currState.linVelocity.z *= this._linVelDamping.z; this._currState.rotVelocity.x *= this._rotVelDamping.x; this._currState.rotVelocity.y *= this._rotVelDamping.y; this._currState.rotVelocity.z *= this._rotVelDamping.z; this._currLinVelocityAux.x *= this._linVelDamping.x; this._currLinVelocityAux.y *= this._linVelDamping.y; this._currLinVelocityAux.z *= this._linVelDamping.z; this._currRotVelocityAux.x *= this._rotVelDamping.x; this._currRotVelocityAux.y *= this._rotVelDamping.y; this._currRotVelocityAux.z *= this._rotVelDamping.z; var r = 0.5; var frac = this._inactiveTime / JConfig.deactivationTime; if (frac < r){ return; } var scale = 1 - ((frac - r) / (1 - r)); if (scale < 0){ scale = 0; }else if (scale > 1){ scale = 1; } this._currState.linVelocity = JNumber3D.getScaleVector(this._currState.linVelocity, scale); this._currState.rotVelocity = JNumber3D.getScaleVector(this._currState.rotVelocity, scale); } // function provided for use of physics system. Activates any // body in its list if it's moved more than a certain distance, // in which case it also clears its list. RigidBody.prototype.doMovementActivations=function(){ if (this._bodiesToBeActivatedOnMovement.length == 0 || this._currState.position.subtract(this._storedPositionForActivation).get_length() < JConfig.posThreshold){ return; } for (var i = 0; i < this._bodiesToBeActivatedOnMovement.length; i++){ jigLib.PhysicsSystem.getInstance().activateObject(this._bodiesToBeActivatedOnMovement[i]); } this._bodiesToBeActivatedOnMovement = []; } // adds the other body to the list of bodies to be activated if // this body moves more than a certain distance from either a // previously stored position, or the position passed in. RigidBody.prototype.addMovementActivation=function(pos, otherBody){ var len = this._bodiesToBeActivatedOnMovement.length; for (var i = 0; i < len; i++){ if (this._bodiesToBeActivatedOnMovement[i] == otherBody){ return; } } if (this._bodiesToBeActivatedOnMovement.length == 0){ this._storedPositionForActivation = pos; } this._bodiesToBeActivatedOnMovement.push(otherBody); } // Marks all constraints/collisions as being unsatisfied RigidBody.prototype.setConstraintsAndCollisionsUnsatisfied=function(){ for(var i=0;i<this._constraints.length;i++){ this._constraints[i].set_satisfied(false); } for(var i=0;i<this.collisions.length;i++){ this.collisions[i].satisfied = false; } } RigidBody.prototype.segmentIntersect=function(out, seg, state){ return false; } RigidBody.prototype.getInertiaProperties=function(m){ return new Matrix3D(); } RigidBody.prototype.updateBoundingBox=function(){ } RigidBody.prototype.hitTestObject3D=function(obj3D){ var num1 = this._currState.position.subtract(obj3D.get_currentState().position).get_length(); var num2 = this._boundingSphere + obj3D.get_boundingSphere(); if (num1 <= num2){ return true; } return false; } RigidBody.prototype.findNonCollidablesBody=function(body){ for(var i=0;i<this._nonCollidables.length;i++){ if (body == this._nonCollidables[i]){ return true; } } return false; } RigidBody.prototype.disableCollisions=function(body){ if (!this.findNonCollidablesBody(body)){ this._nonCollidables.push(body); } } RigidBody.prototype.enableCollisions=function(body){ if (this.findNonCollidablesBody(body)){ this._nonCollidables.splice(this._nonCollidables.indexOf(body), 1); } } // copies the current position etc to old - normally called only by physicsSystem. RigidBody.prototype.copyCurrentStateToOld=function(){ this._oldState.position = this._currState.position.clone(); this._oldState.set_orientation(this._currState.get_orientation().clone()); this._oldState.linVelocity = this._currState.linVelocity.clone(); this._oldState.rotVelocity = this._currState.rotVelocity.clone(); } // Copy our current state into the stored state RigidBody.prototype.storeState=function(){ this._storeState.position = this._currState.position.clone(); this._storeState.set_orientation(this._currState.get_orientation().clone()); this._storeState.linVelocity = this._currState.linVelocity.clone(); this._storeState.rotVelocity = this._currState.rotVelocity.clone(); } // restore from the stored state into our current state. RigidBody.prototype.restoreState=function(){ this._currState.position = this._storeState.position.clone(); this._currState.set_orientation(this._storeState.get_orientation().clone()); this._currState.linVelocity = this._storeState.linVelocity.clone(); this._currState.rotVelocity = this._storeState.rotVelocity.clone(); } // the "working" state RigidBody.prototype.get_currentState=function(){ return this._currState; } // the previous state - copied explicitly using copyCurrentStateToOld RigidBody.prototype.get_oldState=function(){ return this._oldState; } RigidBody.prototype.get_id=function(){ return this._id; } RigidBody.prototype.get_type=function(){ return this._type; } RigidBody.prototype.get_skin=function(){ return this._skin; } RigidBody.prototype.get_boundingSphere=function(){ return this._boundingSphere; } RigidBody.prototype.get_boundingBox=function(){ return this._boundingBox; } // force in world frame RigidBody.prototype.get_force=function(){ return this._force; } // torque in world frame RigidBody.prototype.get_mass=function(){ return this._mass; } RigidBody.prototype.get_invMass=function(){ return this._invMass; } // inertia tensor in world space RigidBody.prototype.get_worldInertia=function(){ return this._worldInertia; } // inverse inertia in world frame RigidBody.prototype.get_worldInvInertia=function(){ return this._worldInvInertia; } RigidBody.prototype.get_nonCollidables=function(){ return this._nonCollidables; } //every dimension should be set to 0-1; RigidBody.prototype.set_linVelocityDamping=function(vel){ this._linVelDamping.x = JNumber3D.getLimiteNumber(vel.x, 0, 1); this._linVelDamping.y = JNumber3D.getLimiteNumber(vel.y, 0, 1); this._linVelDamping.z = JNumber3D.getLimiteNumber(vel.z, 0, 1); } RigidBody.prototype.get_linVelocityDamping=function(){ return this._linVelDamping; } //every dimension should be set to 0-1; RigidBody.prototype.set_rotVelocityDamping=function(vel){ this._rotVelDamping.x = JNumber3D.getLimiteNumber(vel.x, 0, 1); this._rotVelDamping.y = JNumber3D.getLimiteNumber(vel.y, 0, 1); this._rotVelDamping.z = JNumber3D.getLimiteNumber(vel.z, 0, 1); } RigidBody.prototype.get_rotVelocityDamping=function(){ return this._rotVelDamping; } //limit the max value of body's line velocity RigidBody.prototype.set_maxLinVelocities=function(vel){ this._maxLinVelocities = JNumber3D.getLimiteNumber(Math.abs(vel), 0, 500); } RigidBody.prototype.get_maxLinVelocities=function(){ return this._maxLinVelocities; } //limit the max value of body's angle velocity RigidBody.prototype.set_maxRotVelocities=function(vel){ this._maxRotVelocities = JNumber3D.getLimiteNumber(Math.abs(vel), JNumber3D.NUM_TINY, 50); } RigidBody.prototype.get_maxRotVelocities=function(){ return this._maxRotVelocities; } RigidBody.prototype.limitVel=function(){ this._currState.linVelocity.x = JNumber3D.getLimiteNumber(this._currState.linVelocity.x, -this._maxLinVelocities, this._maxLinVelocities); this._currState.linVelocity.y = JNumber3D.getLimiteNumber(this._currState.linVelocity.y, -this._maxLinVelocities, this._maxLinVelocities); this._currState.linVelocity.z = JNumber3D.getLimiteNumber(this._currState.linVelocity.z, -this._maxLinVelocities, this._maxLinVelocities); } RigidBody.prototype.limitAngVel=function(){ var fx = Math.abs(this._currState.rotVelocity.x) / this._maxRotVelocities; var fy = Math.abs(this._currState.rotVelocity.y) / this._maxRotVelocities; var fz = Math.abs(this._currState.rotVelocity.z) / this._maxRotVelocities; var f = Math.max(fx, fy, fz); if (f > 1){ this._currState.rotVelocity = JNumber3D.getDivideVector(this._currState.rotVelocity, f); } } RigidBody.prototype.getTransform=function(){ if (this._skin != null){ return this._skin.get_transform(); }else{ return null; } } //update skin RigidBody.prototype.updateObject3D=function(){ if (this._skin != null){ this._skin.set_transform(JMatrix3D.getAppendMatrix3D(this._currState.get_orientation(), JMatrix3D.getTranslationMatrix(this._currState.position.x, this._currState.position.y, this._currState.position.z))); } } RigidBody.prototype.get_material=function(){ return this._material; } //coefficient of elasticity RigidBody.prototype.get_restitution=function(){ return this._material.get_restitution(); } RigidBody.prototype.set_restitution=function(restitution){ this._material.set_restitution(JNumber3D.getLimiteNumber(restitution, 0, 1)); } //coefficient of friction RigidBody.prototype.get_friction=function(){ return this._material.get_friction(); } RigidBody.prototype.set_friction=function(friction){ this._material.set_friction(JNumber3D.getLimiteNumber(friction, 0, 1)); } jigLib.RigidBody=RigidBody; })(jigLib)
Pervasive/Lively3D
Dropbox/Lively3D/Resources/MiniGolf/scripts/rigid_body.js
JavaScript
mit
29,886
@charset "utf-8"; * { margin:0px; padding:0px; font-family:"Consolas","Microsoft YaHei","Hiragino Sans GB","WenQuanYi Micro Hei",sans-serif; outline:none; border:none; color:#666; font-size:16px; } body { min-width:1000px; } div { position:relative; } img { width:100%; height:100%; } button { cursor:pointer; } button::-moz-focus-inner { border:0; } ul { list-style:none; } .container { width:400px; left:50%; margin-left:-200px; } .title { text-align:center; margin-top:20px; font-size:32px; } .form { margin-top:20px; border:1px solid #f2f2f2; padding-top:10px; padding-bottom:20px; } .form-ele { margin-top:10px; height:40px; line-height:40px; } .form-ele-1 { float:left; width:100px; text-align:right; } .form-ele-2 { float:left; width:156px; padding-left:10px; padding-right:10px; height:38px; border:1px solid #f2f2f2; margin-left:20px; text-align:center; transition:border 0.5s; } .form-ele-2:focus { border:1px solid #fe9c1d; } .form-ele-3 { float:left; width:80px; margin-left:20px; } .error { height:40px; line-height:40px; text-align:center; color:#f00; } .btn-con { height:40px; text-align:center; } .btn { background-color:#f2f2f2; width:200px; height:38px; border:1px solid #ddd; } .btn:hover { background-color:#fe9c1d; border:1px solid #fe9c1d; color:#fff; } .btn:active { background-color:#ef8b09; border:1px solid #ef8b09; color:#fff; } .result { margin-top:20px; background-color:#f2f2f2; } .result-title { text-align:center; background-color:#e2e2e2; height:40px; line-height:40px; } .result-ele { height:40px; line-height:40px; padding-left:20px; padding-right:20px; } .result-ele-1 { float:left; width:100px; text-align:right; } .result-ele-2 { float:left; width:220px; margin-left:40px; }
KK-ZHUANG/Stock-Commission
code/index.css
CSS
mit
2,037
#### 2016-04-06 * Added ECA252 (CB4858_UK) into analysis. #### 2015-11-05 * Updated number of wild isolates, isotypes, and more by adding UChicago and UChicago2 Strains. * Finished fastq sheet. #### 2015-11-04 * Fastq Libraries were renamed as follows to improve readability. Note that not all libraries are present as some were completely dropped. | orig_library_name | new_lib_name | |:--------------------|:---------------| | 81771 | PL_1 | | EA68 | PL_2 | | ECA30_c02hkac | PL_3 | | ECA30_c03b2ab | PL_4 | | ECA31_c02hkac | PL_5 | | ECA31_c03b2ab | PL_6 | | ECA32_c02hkac | PL_7 | | ECA32_c03b2ab | PL_8 | | ECA33_c045gab | PL_9 | | ECA34Pool_c099uac | PL_10 | | ECA34Pool_d0mbhac | PL_11 | | ECA34_c045gab | PL_12 | | ECA35_c099uac | PL_13 | | ECA35_d0mbhac | PL_14 | | ECA36_c099uac | PL_15 | | ECA36_d0mbhac | PL_16 | | ECA37_d0ncdac | PL_17 | | ECA38_c099uac | PL_18 | | ECA38_d0mbhac | PL_19 | | ECA39_d0ncdac | PL_20 | | ECA40_d0ncdac | PL_21 | | ECA41_d0ncdac | PL_22 | | ECA44_47 | PL_23 | | ECAmp_c0g61ac | PL_24 | | 62GECAA_1 | ML_1 | | 7028LAB_5 | ML_2 | | B00B7AB_3 | ML_3 | | B00TWAB_3 | ML_4 | | C02D1AC_1 | ML_5 | | D09NFAC_4 | ML_6 | | D0A7EAC_1 | ML_7 | * All strains in trim/raw being accounted for. Number of sequences and SHA1 sums being added.
AndersenLab/Andersen-Lab-Strains
change_log.md
Markdown
mit
1,803
<?php namespace Admingenerator\GeneratorBundle\QueryFilter; interface QueryFilterInterface { /** * @param object $query the query object interface depend of the ORM * * @api */ function setQuery($query); /** * @return the query object interface depend of the ORM * * @api */ function getQuery(); /** * Add filter for Default db types (types, not found * by others add*Filter() methods * * @param string $field the db field * @param string $value the search value * * @api */ function addDefaultFilter($field, $value); }
marius1092/test
vendor/bundles/Admingenerator/GeneratorBundle/QueryFilter/QueryFilterInterface.php
PHP
mit
629
<!DOCTYPE html> <html class="pl"> <head> <title>Pattern Lab</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width" /> <link rel="stylesheet" href="/assets/../components/css/pattern-scaffolding.css?1500631430" media="all" /> <link rel="stylesheet" href="/assets/style.css?1500631430" media="all" /> <!-- Begin Pattern Lab (Required for Pattern Lab to run properly) --> <!-- never cache patterns --> <meta http-equiv="cache-control" content="max-age=0" /> <meta http-equiv="cache-control" content="no-cache" /> <meta http-equiv="expires" content="0" /> <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" /> <meta http-equiv="pragma" content="no-cache" /> <link rel="stylesheet" href="../../styleguide/css/styleguide.min.css?1500631430" media="all"> <link rel="stylesheet" href="../../styleguide/css/prism-typeahead.min.css?1500631430" media="all" /> <!-- End Pattern Lab --> </head> <body class="b-body"> <main> <!-- for js not found errors (only in styleguide)--> <div class="visually-hidden"> <div id="tabs" class="tabs"></div> </div> <!-- View All Patterns in a Pattern Sub-Type --> <div class="sg-main" role="main"> <!-- Patterns --> <div id="sg-patterns"> <div id="viewall-layouts-grid" class="sg-subtype"> <h2> <a href="../../patterns/04-layouts-grid/index.html" class="patternLink" data-patternpartial="viewall-layouts-grid"> grid </a> </h2> <div class="sg-pattern-body"> </div> </div> <div id="layouts-grid" class="sg-pattern"> <div class="sg-pattern-head"> <h3 class="sg-pattern-title"> <a href="../../patterns/04-layouts-grid-grid/04-layouts-grid-grid.html" class="patternLink" data-patternpartial="layouts-grid" title="Link to Pattern"> Grid Single Column Layout (Default) </a> </h3> <div class="sg-pattern-breadcrumb"> </div> <a href="#" data-patternpartial="layouts-grid" title="View Pattern Info" id="sg-pattern-extra-toggle-layouts-grid" class="sg-pattern-extra-toggle"> <span>&#9660;</span> </a> </div> <div class="sg-pattern-extra" id="sg-pattern-extra-layouts-grid"></div> <div class="sg-pattern-example"> <div class="l-grid"> <div class="l-grid__item"> <div class="m-card js-lazy-bg" data-original="/assets/img/landing/Appetiser_cold.png"> <div class="m-card__title">Холодные и горячие закуски</div> </div> </div> <div class="l-grid__item"> <div class="m-card js-lazy-bg" data-original="/assets/img/landing/Appetiser_cold.png"> <div class="m-card__title">Холодные и горячие закуски</div> </div> </div> </div> </div> <script type="text/json" id="sg-pattern-data-layouts-grid" class="sg-pattern-data"> {"lineage":[],"lineageR":[],"patternBreadcrumb":{"patternType":"layouts","patternSubtype":"grid"},"patternDesc":"","patternExtension":"twig","patternName":"Grid Single Column Layout (Default)","patternPartial":"layouts-grid","patternState":""} </script> </div><!--end .sg-pattern--> <div id="layouts-grid-" class="sg-pattern"> <div class="sg-pattern-head"> <h3 class="sg-pattern-title"> <a href="../../patterns/04-layouts-grid-grid-2col/04-layouts-grid-grid-2col.html" class="patternLink" data-patternpartial="layouts-grid-" title="Link to Pattern"> grid </a> </h3> <div class="sg-pattern-breadcrumb"> </div> <a href="#" data-patternpartial="layouts-grid-" title="View Pattern Info" id="sg-pattern-extra-toggle-layouts-grid-" class="sg-pattern-extra-toggle"> <span>&#9660;</span> </a> </div> <div class="sg-pattern-extra" id="sg-pattern-extra-layouts-grid-"></div> <div class="sg-pattern-example"> <div class="l-grid l-grid--2col"> <div class="l-grid__item"> <div class="m-card js-lazy-bg" data-original="/assets/img/landing/Appetiser_cold.png"> <div class="m-card__title">Холодные и горячие закуски</div> </div> </div> <div class="l-grid__item"> <div class="m-card js-lazy-bg" data-original="/assets/img/landing/Appetiser_cold.png"> <div class="m-card__title">Холодные и горячие закуски</div> </div> </div> <div class="l-grid__item"> <div class="m-card js-lazy-bg" data-original="/assets/img/landing/Appetiser_cold.png"> <div class="m-card__title">Холодные и горячие закуски</div> </div> </div> <div class="l-grid__item"> <div class="m-card js-lazy-bg" data-original="/assets/img/landing/Appetiser_cold.png"> <div class="m-card__title">Холодные и горячие закуски</div> </div> </div> </div> </div> <script type="text/json" id="sg-pattern-data-layouts-grid-" class="sg-pattern-data"> {"lineage":false,"lineageR":[],"patternBreadcrumb":{"patternType":"layouts","patternSubtype":"grid"},"patternDesc":"","patternExtension":"twig","patternName":"grid ","patternPartial":"layouts-grid-","patternState":""} </script> </div><!--end .sg-pattern--> </div> <!--end #sg-patterns--> </div><!--end .sg-main--> <!--DO NOT REMOVE--> <script type="text/json" id="sg-pattern-data-footer" class="sg-pattern-data"> {"patternPartial":"viewall-layouts-grid"} </script> <script> /*! * scriptLoader - v0.1 * * Copyright (c) 2014 Dave Olsen, http://dmolsen.com * Licensed under the MIT license * */ var scriptLoader = { run: function(js,cb,target) { var s = document.getElementById(target+'-'+cb); for (var i = 0; i < js.length; i++) { var src = (typeof js[i] != 'string') ? js[i].src : js[i]; var c = document.createElement('script'); c.src = '../../'+src+'?'+cb; if (typeof js[i] != 'string') { if (js[i].dep !== undefined) { c.onload = function(dep,cb,target) { return function() { scriptLoader.run(dep,cb,target); } }(js[i].dep,cb,target); } } s.parentNode.insertBefore(c,s); } } } </script> <script id="pl-js-polyfill-insert-1500631430"> (function() { if (self != top) { var cb = '1500631430'; var js = []; if (typeof document !== 'undefined' && !('classList' in document.documentElement)) { js.push('styleguide/bower_components/classList.min.js'); } scriptLoader.run(js,cb,'pl-js-polyfill-insert'); } })(); </script> <script id="pl-js-insert-1500631430"> (function() { if (self != top) { var cb = '1500631430'; var js = [ { 'src': 'styleguide/bower_components/jwerty.min.js', 'dep': [ 'styleguide/js/patternlab-pattern.min.js' ] } ]; scriptLoader.run(js,cb,'pl-js-insert'); } })(); </script> <!-- ToDo: Review Paths to all js --> <!-- may need to change these below based on path --> <!-- <script src="../../../../../../../core/assets/vendor/domready/ready.min.js"></script> --> <!-- <script src="../../../../../../../core/misc/drupal.js"></script> --> <script src="https://code.jquery.com/jquery-2.2.4.js" integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.4.1/velocity.js"></script> <script src="/assets/js/scripts.js"></script> </main> </body> </html>
AlexKomm/alexkomm.github.io
patterns/04-layouts-grid/index.html
HTML
mit
7,631
package model; /** * Тип дорожки. */ public enum LineType { /** * Верхняя. Проходит через левый нижний, левый верхний и правый верхний углы карты. */ TOP, /** * Центральная. Напрямую соединяет левый нижний и правый верхний углы карты. */ MIDDLE, /** * Нижняя. Проходит через левый нижний, правый нижний и правый верхний углы карты. */ BOTTOM }
spookiecookie/russianaicup
codewizards2016/java-cgdk/src/main/java/model/LineType.java
Java
mit
606
app.factory('Pizza', ['$resource', 'LoginService', function ($resource, LoginService) { const headers = { token: getToken }; return $resource('./api/pizzas/:id', { id: '@_id' }, { query: { method: 'GET', isArray: true, headers }, save: { method: 'POST', headers }, update: { method: 'PUT', headers }, remove: { method: 'DELETE', headers, params: { id: '@id' } } } ); function getToken() { return LoginService.getToken(); } }]);
auromota/easy-pizza-api
src/public/js/factories/pizzaFactory.js
JavaScript
mit
778
/* * The MIT License * * Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, * Stephen Connolly, Tom Huybrechts, InfraDNA, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package hudson.model; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.infradna.tool.bridge_method_injector.WithBridgeMethods; import hudson.BulkChange; import hudson.ExtensionList; import hudson.ExtensionPoint; import hudson.Util; import hudson.XmlFile; import hudson.init.Initializer; import static hudson.init.InitMilestone.JOB_LOADED; import static hudson.util.Iterators.reverse; import hudson.cli.declarative.CLIResolver; import hudson.model.labels.LabelAssignmentAction; import hudson.model.queue.AbstractQueueTask; import hudson.model.queue.Executables; import hudson.model.queue.QueueListener; import hudson.model.queue.QueueTaskFuture; import hudson.model.queue.ScheduleResult; import hudson.model.queue.ScheduleResult.Created; import hudson.model.queue.SubTask; import hudson.model.queue.FutureImpl; import hudson.model.queue.MappingWorksheet; import hudson.model.queue.MappingWorksheet.Mapping; import hudson.model.queue.QueueSorter; import hudson.model.queue.QueueTaskDispatcher; import hudson.model.queue.Tasks; import hudson.model.queue.WorkUnit; import hudson.model.Node.Mode; import hudson.model.listeners.SaveableListener; import hudson.model.queue.CauseOfBlockage; import hudson.model.queue.FoldableAction; import hudson.model.queue.CauseOfBlockage.BecauseLabelIsBusy; import hudson.model.queue.CauseOfBlockage.BecauseNodeIsOffline; import hudson.model.queue.CauseOfBlockage.BecauseLabelIsOffline; import hudson.model.queue.CauseOfBlockage.BecauseNodeIsBusy; import hudson.model.queue.WorkUnitContext; import hudson.security.ACL; import hudson.security.AccessControlled; import java.nio.file.Files; import java.nio.file.InvalidPathException; import jenkins.security.QueueItemAuthenticatorProvider; import jenkins.util.Timer; import hudson.triggers.SafeTimerTask; import java.util.concurrent.TimeUnit; import hudson.util.XStream2; import hudson.util.ConsistentHash; import hudson.util.ConsistentHash.Hash; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Collection; import java.util.Collections; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; import java.util.TreeSet; import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Nonnull; import javax.servlet.ServletException; import jenkins.model.Jenkins; import jenkins.security.QueueItemAuthenticator; import jenkins.util.AtmostOneTaskExecutor; import org.acegisecurity.AccessDeniedException; import org.acegisecurity.Authentication; import org.jenkinsci.bytecode.AdaptField; import org.jenkinsci.remoting.RoleChecker; import org.kohsuke.accmod.restrictions.NoExternalUse; import org.kohsuke.stapler.HttpResponse; import org.kohsuke.stapler.HttpResponses; import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.DoNotUse; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import javax.annotation.CheckForNull; import javax.annotation.Nonnegative; import jenkins.model.queue.AsynchronousExecution; import jenkins.model.queue.CompositeCauseOfBlockage; import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.interceptor.RequirePOST; /** * Build queue. * * <p> * This class implements the core scheduling logic. {@link Task} represents the executable * task that are placed in the queue. While in the queue, it's wrapped into {@link Item} * so that we can keep track of additional data used for deciding what to execute when. * * <p> * Items in queue goes through several stages, as depicted below: * <pre>{@code * (enter) --> waitingList --+--> blockedProjects * | ^ * | | * | v * +--> buildables ---> pending ---> left * ^ | * | | * +---(rarely)---+ * }</pre> * * <p> * Note: In the normal case of events pending items only move to left. However they can move back * if the node they are assigned to execute on disappears before their {@link Executor} thread * starts, where the node is removed before the {@link Executable} has been instantiated it * is safe to move the pending item back to buildable. Once the {@link Executable} has been * instantiated the only option is to let the {@link Executable} bomb out as soon as it starts * to try an execute on the node that no longer exists. * * <p> * In addition, at any stage, an item can be removed from the queue (for example, when the user * cancels a job in the queue.) See the corresponding field for their exact meanings. * * @author Kohsuke Kawaguchi * @see QueueListener * @see QueueTaskDispatcher */ @ExportedBean public class Queue extends ResourceController implements Saveable { /** * Items that are waiting for its quiet period to pass. * * <p> * This consists of {@link Item}s that cannot be run yet * because its time has not yet come. */ private final Set<WaitingItem> waitingList = new TreeSet<WaitingItem>(); /** * {@link Task}s that can be built immediately * but blocked because another build is in progress, * required {@link Resource}s are not available, * blocked via {@link QueueTaskDispatcher#canRun(Item)}, * or otherwise blocked by {@link Task#isBuildBlocked()}. */ private final ItemList<BlockedItem> blockedProjects = new ItemList<BlockedItem>(); /** * {@link Task}s that can be built immediately * that are waiting for available {@link Executor}. * This list is sorted in such a way that earlier items are built earlier. */ private final ItemList<BuildableItem> buildables = new ItemList<BuildableItem>(); /** * {@link Task}s that are being handed over to the executor, but execution * has not started yet. */ private final ItemList<BuildableItem> pendings = new ItemList<BuildableItem>(); private transient volatile Snapshot snapshot = new Snapshot(waitingList, blockedProjects, buildables, pendings); /** * Items that left queue would stay here for a while to enable tracking via {@link Item#getId()}. * * This map is forgetful, since we can't remember everything that executed in the past. */ private final Cache<Long,LeftItem> leftItems = CacheBuilder.newBuilder().expireAfterWrite(5*60, TimeUnit.SECONDS).build(); /** * Data structure created for each idle {@link Executor}. * This is a job offer from the queue to an executor. * * <p> * For each idle executor, this gets created to allow the scheduling logic * to assign a work. Once a work is assigned, the executor actually gets * started to carry out the task in question. */ public static class JobOffer extends MappingWorksheet.ExecutorSlot { public final Executor executor; /** * The work unit that this {@link Executor} is going to handle. */ private WorkUnit workUnit; private JobOffer(Executor executor) { this.executor = executor; } @Override protected void set(WorkUnit p) { assert this.workUnit == null; this.workUnit = p; assert executor.isParking(); executor.start(workUnit); // LOGGER.info("Starting "+executor.getName()); } @Override public Executor getExecutor() { return executor; } /** * @deprecated discards information; prefer {@link #getCauseOfBlockage} */ @Deprecated public boolean canTake(BuildableItem item) { return getCauseOfBlockage(item) == null; } /** * Checks whether the {@link Executor} represented by this object is capable of executing the given task. * @return a reason why it cannot, or null if it could * @since 2.37 */ public @CheckForNull CauseOfBlockage getCauseOfBlockage(BuildableItem item) { Node node = getNode(); if (node == null) { return CauseOfBlockage.fromMessage(Messages._Queue_node_has_been_removed_from_configuration(executor.getOwner().getDisplayName())); } CauseOfBlockage reason = node.canTake(item); if (reason != null) { return reason; } for (QueueTaskDispatcher d : QueueTaskDispatcher.all()) { reason = d.canTake(node, item); if (reason != null) { return reason; } } // inlining isAvailable: if (workUnit != null) { // unlikely in practice (should not have even found this executor if so) return CauseOfBlockage.fromMessage(Messages._Queue_executor_slot_already_in_use()); } if (executor.getOwner().isOffline()) { return new CauseOfBlockage.BecauseNodeIsOffline(node); } if (!executor.getOwner().isAcceptingTasks()) { // Node.canTake (above) does not consider RetentionStrategy.isAcceptingTasks return new CauseOfBlockage.BecauseNodeIsNotAcceptingTasks(node); } return null; } /** * Is this executor ready to accept some tasks? */ public boolean isAvailable() { return workUnit == null && !executor.getOwner().isOffline() && executor.getOwner().isAcceptingTasks(); } @CheckForNull public Node getNode() { return executor.getOwner().getNode(); } public boolean isNotExclusive() { return getNode().getMode() == Mode.NORMAL; } @Override public String toString() { return String.format("JobOffer[%s #%d]",executor.getOwner().getName(), executor.getNumber()); } } private volatile transient LoadBalancer loadBalancer; private volatile transient QueueSorter sorter; private transient final AtmostOneTaskExecutor<Void> maintainerThread = new AtmostOneTaskExecutor<Void>(new Callable<Void>() { @Override public Void call() throws Exception { maintain(); return null; } @Override public String toString() { return "Periodic Jenkins queue maintenance"; } }); private transient final ReentrantLock lock = new ReentrantLock(); private transient final Condition condition = lock.newCondition(); public Queue(@Nonnull LoadBalancer loadBalancer) { this.loadBalancer = loadBalancer.sanitize(); // if all the executors are busy doing something, then the queue won't be maintained in // timely fashion, so use another thread to make sure it happens. new MaintainTask(this).periodic(); } public LoadBalancer getLoadBalancer() { return loadBalancer; } public void setLoadBalancer(@Nonnull LoadBalancer loadBalancer) { if(loadBalancer==null) throw new IllegalArgumentException(); this.loadBalancer = loadBalancer.sanitize(); } public QueueSorter getSorter() { return sorter; } public void setSorter(QueueSorter sorter) { this.sorter = sorter; } /** * Simple queue state persistence object. */ static class State { public long counter; public List<Item> items = new ArrayList<Item>(); } /** * Loads the queue contents that was {@link #save() saved}. */ public void load() { lock.lock(); try { try { // Clear items, for the benefit of reloading. waitingList.clear(); blockedProjects.clear(); buildables.clear(); pendings.clear(); // first try the old format File queueFile = getQueueFile(); if (queueFile.exists()) { try (BufferedReader in = new BufferedReader(new InputStreamReader(Files.newInputStream(queueFile.toPath())))) { String line; while ((line = in.readLine()) != null) { AbstractProject j = Jenkins.getInstance().getItemByFullName(line, AbstractProject.class); if (j != null) j.scheduleBuild(); } } catch (InvalidPathException e) { throw new IOException(e); } // discard the queue file now that we are done queueFile.delete(); } else { queueFile = getXMLQueueFile(); if (queueFile.exists()) { Object unmarshaledObj = new XmlFile(XSTREAM, queueFile).read(); List items; if (unmarshaledObj instanceof State) { State state = (State) unmarshaledObj; items = state.items; WaitingItem.COUNTER.set(state.counter); } else { // backward compatibility - it's an old List queue.xml items = (List) unmarshaledObj; long maxId = 0; for (Object o : items) { if (o instanceof Item) { maxId = Math.max(maxId, ((Item)o).id); } } WaitingItem.COUNTER.set(maxId); } for (Object o : items) { if (o instanceof Task) { // backward compatibility schedule((Task)o, 0); } else if (o instanceof Item) { Item item = (Item)o; if (item.task == null) { continue; // botched persistence. throw this one away } if (item instanceof WaitingItem) { item.enter(this); } else if (item instanceof BlockedItem) { item.enter(this); } else if (item instanceof BuildableItem) { item.enter(this); } else { throw new IllegalStateException("Unknown item type! " + item); } } } // I just had an incident where all the executors are dead at AbstractProject._getRuns() // because runs is null. Debugger revealed that this is caused by a MatrixConfiguration // object that doesn't appear to be de-serialized properly. // I don't know how this problem happened, but to diagnose this problem better // when it happens again, save the old queue file for introspection. File bk = new File(queueFile.getPath() + ".bak"); bk.delete(); queueFile.renameTo(bk); queueFile.delete(); } } } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to load the queue file " + getXMLQueueFile(), e); } finally { updateSnapshot(); } } finally { lock.unlock(); } } /** * Persists the queue contents to the disk. */ public void save() { if(BulkChange.contains(this)) return; XmlFile queueFile = new XmlFile(XSTREAM, getXMLQueueFile()); lock.lock(); try { // write out the queue state we want to save State state = new State(); state.counter = WaitingItem.COUNTER.longValue(); // write out the tasks on the queue for (Item item: getItems()) { if(item.task instanceof TransientTask) continue; state.items.add(item); } try { queueFile.write(state); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to write out the queue file " + getXMLQueueFile(), e); } } finally { lock.unlock(); } SaveableListener.fireOnChange(this, queueFile); } /** * Wipes out all the items currently in the queue, as if all of them are cancelled at once. */ public void clear() { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); lock.lock(); try { try { for (WaitingItem i : new ArrayList<WaitingItem>( waitingList)) // copy the list as we'll modify it in the loop i.cancel(this); blockedProjects.cancelAll(); pendings.cancelAll(); buildables.cancelAll(); } finally { updateSnapshot(); } } finally { lock.unlock(); } scheduleMaintenance(); } private File getQueueFile() { return new File(Jenkins.getInstance().getRootDir(), "queue.txt"); } /*package*/ File getXMLQueueFile() { return new File(Jenkins.getInstance().getRootDir(), "queue.xml"); } /** * @deprecated as of 1.311 * Use {@link #schedule(AbstractProject)} */ @Deprecated public boolean add(AbstractProject p) { return schedule(p)!=null; } /** * Schedule a new build for this project. * @see #schedule(Task, int) */ public @CheckForNull WaitingItem schedule(AbstractProject p) { return schedule(p, p.getQuietPeriod()); } /** * Schedules a new build with a custom quiet period. * * <p> * Left for backward compatibility with &lt;1.114. * * @since 1.105 * @deprecated as of 1.311 * Use {@link #schedule(Task, int)} */ @Deprecated public boolean add(AbstractProject p, int quietPeriod) { return schedule(p, quietPeriod)!=null; } /** * @deprecated as of 1.521 * Use {@link #schedule2(Task, int, List)} */ @Deprecated public WaitingItem schedule(Task p, int quietPeriod, List<Action> actions) { return schedule2(p, quietPeriod, actions).getCreateItem(); } /** * Schedules an execution of a task. * * @param actions * These actions can be used for associating information scoped to a particular build, to * the task being queued. Upon the start of the build, these {@link Action}s will be automatically * added to the {@link Run} object, and hence available to everyone. * For the convenience of the caller, this list can contain null, and those will be silently ignored. * @since 1.311 * @return * {@link hudson.model.queue.ScheduleResult.Refused} if Jenkins refused to add this task into the queue (for example because the system * is about to shutdown.) Otherwise the task is either merged into existing items in the queue * (in which case you get {@link hudson.model.queue.ScheduleResult.Existing} instance back), or a new item * gets created in the queue (in which case you get {@link Created}. * * Note the nature of the queue * is that such {@link Item} only captures the state of the item at a particular moment, * and by the time you inspect the object, some of its information can be already stale. * * That said, one can still look at {@link Queue.Item#future}, {@link Queue.Item#getId()}, etc. */ public @Nonnull ScheduleResult schedule2(Task p, int quietPeriod, List<Action> actions) { // remove nulls actions = new ArrayList<Action>(actions); for (Iterator<Action> itr = actions.iterator(); itr.hasNext();) { Action a = itr.next(); if (a==null) itr.remove(); } lock.lock(); try { try { for (QueueDecisionHandler h : QueueDecisionHandler.all()) if (!h.shouldSchedule(p, actions)) return ScheduleResult.refused(); // veto return scheduleInternal(p, quietPeriod, actions); } finally { updateSnapshot(); } } finally { lock.unlock(); } } /** * Schedules an execution of a task. * * @since 1.311 * @return * {@link hudson.model.queue.ScheduleResult.Existing} if this task is already in the queue and * therefore the add operation was no-op. Otherwise {@link hudson.model.queue.ScheduleResult.Created} * indicates the {@link WaitingItem} object added, although the nature of the queue * is that such {@link Item} only captures the state of the item at a particular moment, * and by the time you inspect the object, some of its information can be already stale. * * That said, one can still look at {@link WaitingItem#future}, {@link WaitingItem#getId()}, etc. */ private @Nonnull ScheduleResult scheduleInternal(Task p, int quietPeriod, List<Action> actions) { lock.lock(); try { try { Calendar due = new GregorianCalendar(); due.add(Calendar.SECOND, quietPeriod); // Do we already have this task in the queue? Because if so, we won't schedule a new one. List<Item> duplicatesInQueue = new ArrayList<Item>(); for (Item item : liveGetItems(p)) { boolean shouldScheduleItem = false; for (QueueAction action : item.getActions(QueueAction.class)) { shouldScheduleItem |= action.shouldSchedule(actions); } for (QueueAction action : Util.filter(actions, QueueAction.class)) { shouldScheduleItem |= action.shouldSchedule((new ArrayList<Action>(item.getAllActions()))); } if (!shouldScheduleItem) { duplicatesInQueue.add(item); } } if (duplicatesInQueue.isEmpty()) { LOGGER.log(Level.FINE, "{0} added to queue", p); // put the item in the queue WaitingItem added = new WaitingItem(due, p, actions); added.enter(this); scheduleMaintenance(); // let an executor know that a new item is in the queue. return ScheduleResult.created(added); } LOGGER.log(Level.FINE, "{0} is already in the queue", p); // but let the actions affect the existing stuff. for (Item item : duplicatesInQueue) { for (FoldableAction a : Util.filter(actions, FoldableAction.class)) { a.foldIntoExisting(item, p, actions); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "after folding {0}, {1} includes {2}", new Object[] {a, item, item.getAllActions()}); } } } boolean queueUpdated = false; for (WaitingItem wi : Util.filter(duplicatesInQueue, WaitingItem.class)) { // make sure to always use the shorter of the available due times if (wi.timestamp.before(due)) continue; // waitingList is sorted, so when we change a timestamp we need to maintain order wi.leave(this); wi.timestamp = due; wi.enter(this); queueUpdated = true; } if (queueUpdated) scheduleMaintenance(); // REVISIT: when there are multiple existing items in the queue that matches the incoming one, // whether the new one should affect all existing ones or not is debatable. I for myself // thought this would only affect one, so the code was bit of surprise, but I'm keeping the current // behaviour. return ScheduleResult.existing(duplicatesInQueue.get(0)); } finally { updateSnapshot(); } } finally { lock.unlock(); } } /** * @deprecated as of 1.311 * Use {@link #schedule(Task, int)} */ @Deprecated public boolean add(Task p, int quietPeriod) { return schedule(p, quietPeriod)!=null; } public @CheckForNull WaitingItem schedule(Task p, int quietPeriod) { return schedule(p, quietPeriod, new Action[0]); } /** * @deprecated as of 1.311 * Use {@link #schedule(Task, int, Action...)} */ @Deprecated public boolean add(Task p, int quietPeriod, Action... actions) { return schedule(p, quietPeriod, actions)!=null; } /** * Convenience wrapper method around {@link #schedule(Task, int, List)} */ public @CheckForNull WaitingItem schedule(Task p, int quietPeriod, Action... actions) { return schedule2(p, quietPeriod, actions).getCreateItem(); } /** * Convenience wrapper method around {@link #schedule2(Task, int, List)} */ public @Nonnull ScheduleResult schedule2(Task p, int quietPeriod, Action... actions) { return schedule2(p, quietPeriod, Arrays.asList(actions)); } /** * Cancels the item in the queue. If the item is scheduled more than once, cancels the first occurrence. * * @return true if the project was indeed in the queue and was removed. * false if this was no-op. */ public boolean cancel(Task p) { lock.lock(); try { try { LOGGER.log(Level.FINE, "Cancelling {0}", p); for (WaitingItem item : waitingList) { if (item.task.equals(p)) { return item.cancel(this); } } // use bitwise-OR to make sure that both branches get evaluated all the time return blockedProjects.cancel(p) != null | buildables.cancel(p) != null; } finally { updateSnapshot(); } } finally { lock.unlock(); } } private void updateSnapshot() { Snapshot revised = new Snapshot(waitingList, blockedProjects, buildables, pendings); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.log(Level.FINEST, "{0} → {1}; leftItems={2}", new Object[] {snapshot, revised, leftItems.asMap()}); } snapshot = revised; } public boolean cancel(Item item) { LOGGER.log(Level.FINE, "Cancelling {0} item#{1}", new Object[] {item.task, item.id}); lock.lock(); try { try { return item.cancel(this); } finally { updateSnapshot(); } } finally { lock.unlock(); } } /** * Called from {@code queue.jelly} and {@code entries.jelly}. */ @RequirePOST public HttpResponse doCancelItem(@QueryParameter long id) throws IOException, ServletException { Item item = getItem(id); if (item != null) { cancel(item); } // else too late, ignore (JENKINS-14813) return HttpResponses.forwardToPreviousPage(); } public boolean isEmpty() { Snapshot snapshot = this.snapshot; return snapshot.waitingList.isEmpty() && snapshot.blockedProjects.isEmpty() && snapshot.buildables.isEmpty() && snapshot.pendings.isEmpty(); } private WaitingItem peek() { return waitingList.iterator().next(); } /** * Gets a snapshot of items in the queue. * * Generally speaking the array is sorted such that the items that are most likely built sooner are * at the end. */ @Exported(inline=true) public Item[] getItems() { Snapshot s = this.snapshot; List<Item> r = new ArrayList<Item>(); for(WaitingItem p : s.waitingList) { r = checkPermissionsAndAddToList(r, p); } for (BlockedItem p : s.blockedProjects){ r = checkPermissionsAndAddToList(r, p); } for (BuildableItem p : reverse(s.buildables)) { r = checkPermissionsAndAddToList(r, p); } for (BuildableItem p : reverse(s.pendings)) { r= checkPermissionsAndAddToList(r, p); } Item[] items = new Item[r.size()]; r.toArray(items); return items; } private List<Item> checkPermissionsAndAddToList(List<Item> r, Item t) { if (t.task instanceof hudson.security.AccessControlled) { if (((hudson.security.AccessControlled)t.task).hasPermission(hudson.model.Item.READ) || ((hudson.security.AccessControlled) t.task).hasPermission(hudson.security.Permission.READ)) { r.add(t); } } return r; } /** * Returns an array of Item for which it is only visible the name of the task. * * Generally speaking the array is sorted such that the items that are most likely built sooner are * at the end. */ @Restricted(NoExternalUse.class) @Exported(inline=true) public StubItem[] getDiscoverableItems() { Snapshot s = this.snapshot; List<StubItem> r = new ArrayList<StubItem>(); for(WaitingItem p : s.waitingList) { r = filterDiscoverableItemListBasedOnPermissions(r, p); } for (BlockedItem p : s.blockedProjects){ r = filterDiscoverableItemListBasedOnPermissions(r, p); } for (BuildableItem p : reverse(s.buildables)) { r = filterDiscoverableItemListBasedOnPermissions(r, p); } for (BuildableItem p : reverse(s.pendings)) { r= filterDiscoverableItemListBasedOnPermissions(r, p); } StubItem[] items = new StubItem[r.size()]; r.toArray(items); return items; } private List<StubItem> filterDiscoverableItemListBasedOnPermissions(List<StubItem> r, Item t) { if (t.task instanceof hudson.model.Item) { if (!((hudson.model.Item)t.task).hasPermission(hudson.model.Item.READ) && ((hudson.model.Item)t.task).hasPermission(hudson.model.Item.DISCOVER)) { r.add(new StubItem(new StubTask(t.task))); } } return r; } /** * Like {@link #getItems()}, but returns an approximation that might not be completely up-to-date. * * <p> * At the expense of accuracy, this method does not usually lock {@link Queue} and therefore is faster * in a highly concurrent situation. * * <p> * The list obtained is an accurate snapshot of the queue at some point in the past. The snapshot * is updated and normally no more than one second old, but this is a soft commitment that might * get violated when the lock on {@link Queue} is highly contended. * * <p> * This method is primarily added to make UI threads run faster. * * @since 1.483 * @deprecated Use {@link #getItems()} directly. As of 1.607 the approximation is no longer needed. */ @Deprecated public List<Item> getApproximateItemsQuickly() { return Arrays.asList(getItems()); } public Item getItem(long id) { Snapshot snapshot = this.snapshot; for (Item item : snapshot.blockedProjects) { if (item.id == id) return item; } for (Item item : snapshot.buildables) { if (item.id == id) return item; } for (Item item : snapshot.pendings) { if (item.id == id) return item; } for (Item item : snapshot.waitingList) { if (item.id == id) { return item; } } return leftItems.getIfPresent(id); } /** * Gets all the {@link BuildableItem}s that are waiting for an executor in the given {@link Computer}. */ public List<BuildableItem> getBuildableItems(Computer c) { Snapshot snapshot = this.snapshot; List<BuildableItem> result = new ArrayList<BuildableItem>(); _getBuildableItems(c, snapshot.buildables, result); _getBuildableItems(c, snapshot.pendings, result); return result; } private void _getBuildableItems(Computer c, List<BuildableItem> col, List<BuildableItem> result) { Node node = c.getNode(); if (node == null) // Deleted computers cannot take build items... return; for (BuildableItem p : col) { if (node.canTake(p) == null) result.add(p); } } /** * Gets the snapshot of all {@link BuildableItem}s. */ public List<BuildableItem> getBuildableItems() { Snapshot snapshot = this.snapshot; ArrayList<BuildableItem> r = new ArrayList<BuildableItem>(snapshot.buildables); r.addAll(snapshot.pendings); return r; } /** * Gets the snapshot of all {@link BuildableItem}s. */ public List<BuildableItem> getPendingItems() { return new ArrayList<BuildableItem>(snapshot.pendings); } /** * Gets the snapshot of all {@link BlockedItem}s. */ protected List<BlockedItem> getBlockedItems() { return new ArrayList<BlockedItem>(snapshot.blockedProjects); } /** * Returns the snapshot of all {@link LeftItem}s. * * @since 1.519 */ public Collection<LeftItem> getLeftItems() { return Collections.unmodifiableCollection(leftItems.asMap().values()); } /** * Immediately clear the {@link #getLeftItems} cache. * Useful for tests which need to verify that no links to a build remain. * @since 1.519 */ public void clearLeftItems() { leftItems.invalidateAll(); } /** * Gets all items that are in the queue but not blocked * * @since 1.402 */ public List<Item> getUnblockedItems() { Snapshot snapshot = this.snapshot; List<Item> queuedNotBlocked = new ArrayList<Item>(); queuedNotBlocked.addAll(snapshot.waitingList); queuedNotBlocked.addAll(snapshot.buildables); queuedNotBlocked.addAll(snapshot.pendings); // but not 'blockedProjects' return queuedNotBlocked; } /** * Works just like {@link #getUnblockedItems()} but return tasks. * * @since 1.402 */ public Set<Task> getUnblockedTasks() { List<Item> items = getUnblockedItems(); Set<Task> unblockedTasks = new HashSet<Task>(items.size()); for (Queue.Item t : items) unblockedTasks.add(t.task); return unblockedTasks; } /** * Is the given task currently pending execution? */ public boolean isPending(Task t) { Snapshot snapshot = this.snapshot; for (BuildableItem i : snapshot.pendings) if (i.task.equals(t)) return true; return false; } /** * How many {@link BuildableItem}s are assigned for the given label? * @param l Label to be checked. If null, any label will be accepted. * If you want to count {@link BuildableItem}s without assigned labels, * use {@link #strictCountBuildableItemsFor(hudson.model.Label)}. * @return Number of {@link BuildableItem}s for the specified label. */ public @Nonnegative int countBuildableItemsFor(@CheckForNull Label l) { Snapshot snapshot = this.snapshot; int r = 0; for (BuildableItem bi : snapshot.buildables) for (SubTask st : bi.task.getSubTasks()) if (null == l || bi.getAssignedLabelFor(st) == l) r++; for (BuildableItem bi : snapshot.pendings) for (SubTask st : bi.task.getSubTasks()) if (null == l || bi.getAssignedLabelFor(st) == l) r++; return r; } /** * How many {@link BuildableItem}s are assigned for the given label? * <p> * The implementation is quite similar to {@link #countBuildableItemsFor(hudson.model.Label)}, * but it has another behavior for null parameters. * @param l Label to be checked. If null, only jobs without assigned labels * will be taken into the account. * @return Number of {@link BuildableItem}s for the specified label. * @since 1.615 */ public @Nonnegative int strictCountBuildableItemsFor(@CheckForNull Label l) { Snapshot _snapshot = this.snapshot; int r = 0; for (BuildableItem bi : _snapshot.buildables) for (SubTask st : bi.task.getSubTasks()) if (bi.getAssignedLabelFor(st) == l) r++; for (BuildableItem bi : _snapshot.pendings) for (SubTask st : bi.task.getSubTasks()) if (bi.getAssignedLabelFor(st) == l) r++; return r; } /** * Counts all the {@link BuildableItem}s currently in the queue. */ public int countBuildableItems() { return countBuildableItemsFor(null); } /** * Gets the information about the queue item for the given project. * * @return null if the project is not in the queue. */ public Item getItem(Task t) { Snapshot snapshot = this.snapshot; for (Item item : snapshot.blockedProjects) { if (item.task.equals(t)) return item; } for (Item item : snapshot.buildables) { if (item.task.equals(t)) return item; } for (Item item : snapshot.pendings) { if (item.task.equals(t)) return item; } for (Item item : snapshot.waitingList) { if (item.task.equals(t)) { return item; } } return null; } /** * Gets the information about the queue item for the given project. * * @return null if the project is not in the queue. * @since 1.607 */ private List<Item> liveGetItems(Task t) { lock.lock(); try { List<Item> result = new ArrayList<Item>(); result.addAll(blockedProjects.getAll(t)); result.addAll(buildables.getAll(t)); // Do not include pendings—we have already finalized WorkUnitContext.actions. if (LOGGER.isLoggable(Level.FINE)) { List<BuildableItem> thePendings = pendings.getAll(t); if (!thePendings.isEmpty()) { LOGGER.log(Level.FINE, "ignoring {0} during scheduleInternal", thePendings); } } for (Item item : waitingList) { if (item.task.equals(t)) { result.add(item); } } return result; } finally { lock.unlock(); } } /** * Gets the information about the queue item for the given project. * * @return null if the project is not in the queue. */ public List<Item> getItems(Task t) { Snapshot snapshot = this.snapshot; List<Item> result = new ArrayList<Item>(); for (Item item : snapshot.blockedProjects) { if (item.task.equals(t)) { result.add(item); } } for (Item item : snapshot.buildables) { if (item.task.equals(t)) { result.add(item); } } for (Item item : snapshot.pendings) { if (item.task.equals(t)) { result.add(item); } } for (Item item : snapshot.waitingList) { if (item.task.equals(t)) { result.add(item); } } return result; } /** * Returns true if this queue contains the said project. */ public boolean contains(Task t) { return getItem(t)!=null; } /** * Called when the executor actually starts executing the assigned work unit. * * This moves the task from the pending state to the "left the queue" state. */ /*package*/ void onStartExecuting(Executor exec) throws InterruptedException { lock.lock(); try { try { final WorkUnit wu = exec.getCurrentWorkUnit(); pendings.remove(wu.context.item); LeftItem li = new LeftItem(wu.context); li.enter(this); } finally { updateSnapshot(); } } finally { lock.unlock(); } } /** * Checks the queue and runs anything that can be run. * * <p> * When conditions are changed, this method should be invoked. * <p> * This wakes up one {@link Executor} so that it will maintain a queue. */ @WithBridgeMethods(void.class) public Future<?> scheduleMaintenance() { // LOGGER.info("Scheduling maintenance"); return maintainerThread.submit(); } /** * Checks if the given item should be prevented from entering into the {@link #buildables} state * and instead stay in the {@link #blockedProjects} state. */ private boolean isBuildBlocked(Item i) { if (i.task.isBuildBlocked() || !canRun(i.task.getResourceList())) return true; for (QueueTaskDispatcher d : QueueTaskDispatcher.all()) { if (d.canRun(i)!=null) return true; } return false; } /** * Make sure we don't queue two tasks of the same project to be built * unless that project allows concurrent builds. */ private boolean allowNewBuildableTask(Task t) { if (t.isConcurrentBuild()) { return true; } return !buildables.containsKey(t) && !pendings.containsKey(t); } /** * Some operations require to be performed with the {@link Queue} lock held. Use one of these methods rather * than locking directly on Queue in order to allow for future refactoring. * @param runnable the operation to perform. * @since 1.592 */ public static void withLock(Runnable runnable) { final Jenkins jenkins = Jenkins.getInstanceOrNull(); // TODO confirm safe to assume non-null and use getInstance() final Queue queue = jenkins == null ? null : jenkins.getQueue(); if (queue == null) { runnable.run(); } else { queue._withLock(runnable); } } /** * Some operations require the {@link Queue} lock held. Use one of these methods rather * than locking directly on Queue in order to allow for future refactoring. * * @param callable the operation to perform. * @param <V> the type of return value * @param <T> the type of exception. * @return the result of the callable. * @throws T the exception of the callable * @since 1.592 */ public static <V, T extends Throwable> V withLock(hudson.remoting.Callable<V, T> callable) throws T { final Jenkins jenkins = Jenkins.getInstanceOrNull(); // TODO confirm safe to assume non-null and use getInstance() final Queue queue = jenkins == null ? null : jenkins.getQueue(); if (queue == null) { return callable.call(); } else { return queue._withLock(callable); } } /** * Some operations require to be performed with the {@link Queue} lock held. Use one of these methods rather * than locking directly on Queue in order to allow for future refactoring. * * @param callable the operation to perform. * @param <V> the type of return value * @return the result of the callable. * @throws Exception if the callable throws an exception. * @since 1.592 */ public static <V> V withLock(java.util.concurrent.Callable<V> callable) throws Exception { final Jenkins jenkins = Jenkins.getInstanceOrNull(); // TODO confirm safe to assume non-null and use getInstance() final Queue queue = jenkins == null ? null : jenkins.getQueue(); if (queue == null) { return callable.call(); } else { return queue._withLock(callable); } } /** * Invokes the supplied {@link Runnable} if the {@link Queue} lock was obtained without blocking. * * @param runnable the operation to perform. * @return {@code true} if the lock was available and the operation was performed. * @since 1.618 */ public static boolean tryWithLock(Runnable runnable) { final Jenkins jenkins = Jenkins.getInstanceOrNull(); // TODO confirm safe to assume non-null and use getInstance() final Queue queue = jenkins == null ? null : jenkins.getQueue(); if (queue == null) { runnable.run(); return true; } else { return queue._tryWithLock(runnable); } } /** * Wraps a {@link Runnable} with the {@link Queue} lock held. * * @param runnable the operation to wrap. * @since 1.618 */ public static Runnable wrapWithLock(Runnable runnable) { final Jenkins jenkins = Jenkins.getInstanceOrNull(); // TODO confirm safe to assume non-null and use getInstance() final Queue queue = jenkins == null ? null : jenkins.getQueue(); return queue == null ? runnable : new LockedRunnable(runnable); } /** * Wraps a {@link hudson.remoting.Callable} with the {@link Queue} lock held. * * @param callable the operation to wrap. * @since 1.618 */ public static <V, T extends Throwable> hudson.remoting.Callable<V, T> wrapWithLock(hudson.remoting.Callable<V, T> callable) { final Jenkins jenkins = Jenkins.getInstanceOrNull(); // TODO confirm safe to assume non-null and use getInstance() final Queue queue = jenkins == null ? null : jenkins.getQueue(); return queue == null ? callable : new LockedHRCallable<>(callable); } /** * Wraps a {@link java.util.concurrent.Callable} with the {@link Queue} lock held. * * @param callable the operation to wrap. * @since 1.618 */ public static <V> java.util.concurrent.Callable<V> wrapWithLock(java.util.concurrent.Callable<V> callable) { final Jenkins jenkins = Jenkins.getInstanceOrNull(); // TODO confirm safe to assume non-null and use getInstance() final Queue queue = jenkins == null ? null : jenkins.getQueue(); return queue == null ? callable : new LockedJUCCallable<V>(callable); } @Override protected void _await() throws InterruptedException { condition.await(); } @Override protected void _signalAll() { condition.signalAll(); } /** * Some operations require to be performed with the {@link Queue} lock held. Use one of these methods rather * than locking directly on Queue in order to allow for future refactoring. * @param runnable the operation to perform. * @since 1.592 */ protected void _withLock(Runnable runnable) { lock.lock(); try { runnable.run(); } finally { lock.unlock(); } } /** * Invokes the supplied {@link Runnable} if the {@link Queue} lock was obtained without blocking. * * @param runnable the operation to perform. * @return {@code true} if the lock was available and the operation was performed. * @since 1.618 */ protected boolean _tryWithLock(Runnable runnable) { if (lock.tryLock()) { try { runnable.run(); } finally { lock.unlock(); } return true; } else { return false; } } /** * Some operations require to be performed with the {@link Queue} lock held. Use one of these methods rather * than locking directly on Queue in order to allow for future refactoring. * * @param callable the operation to perform. * @param <V> the type of return value * @param <T> the type of exception. * @return the result of the callable. * @throws T the exception of the callable * @since 1.592 */ protected <V, T extends Throwable> V _withLock(hudson.remoting.Callable<V, T> callable) throws T { lock.lock(); try { return callable.call(); } finally { lock.unlock(); } } /** * Some operations require to be performed with the {@link Queue} lock held. Use one of these methods rather * than locking directly on Queue in order to allow for future refactoring. * * @param callable the operation to perform. * @param <V> the type of return value * @return the result of the callable. * @throws Exception if the callable throws an exception. * @since 1.592 */ protected <V> V _withLock(java.util.concurrent.Callable<V> callable) throws Exception { lock.lock(); try { return callable.call(); } finally { lock.unlock(); } } /** * Queue maintenance. * * <p> * Move projects between {@link #waitingList}, {@link #blockedProjects}, {@link #buildables}, and {@link #pendings} * appropriately. * * <p> * Jenkins internally invokes this method by itself whenever there's a change that can affect * the scheduling (such as new node becoming online, # of executors change, a task completes execution, etc.), * and it also gets invoked periodically (see {@link Queue.MaintainTask}.) */ public void maintain() { lock.lock(); try { try { LOGGER.log(Level.FINE, "Queue maintenance started on {0} with {1}", new Object[] {this, snapshot}); // The executors that are currently waiting for a job to run. Map<Executor, JobOffer> parked = new HashMap<Executor, JobOffer>(); {// update parked (and identify any pending items whose executor has disappeared) List<BuildableItem> lostPendings = new ArrayList<BuildableItem>(pendings); for (Computer c : Jenkins.getInstance().getComputers()) { for (Executor e : c.getExecutors()) { if (e.isInterrupted()) { // JENKINS-28840 we will deadlock if we try to touch this executor while interrupt flag set // we need to clear lost pendings as we cannot know what work unit was on this executor // while it is interrupted. (All this dancing is a result of Executor extending Thread) lostPendings.clear(); // we'll get them next time around when the flag is cleared. LOGGER.log(Level.FINEST, "Interrupt thread for executor {0} is set and we do not know what work unit was on the executor.", e.getDisplayName()); continue; } if (e.isParking()) { LOGGER.log(Level.FINEST, "{0} is parking and is waiting for a job to execute.", e.getDisplayName()); parked.put(e, new JobOffer(e)); } final WorkUnit workUnit = e.getCurrentWorkUnit(); if (workUnit != null) { lostPendings.remove(workUnit.context.item); } } } // pending -> buildable for (BuildableItem p: lostPendings) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "BuildableItem {0}: pending -> buildable as the assigned executor disappeared", p.task.getFullDisplayName()); } p.isPending = false; pendings.remove(p); makeBuildable(p); // TODO whatever this is for, the return value is being ignored, so this does nothing at all } } final QueueSorter s = sorter; {// blocked -> buildable // copy as we'll mutate the list and we want to process in a potentially different order List<BlockedItem> blockedItems = new ArrayList<>(blockedProjects.values()); // if facing a cycle of blocked tasks, ensure we process in the desired sort order if (s != null) { s.sortBlockedItems(blockedItems); } else { Collections.sort(blockedItems, QueueSorter.DEFAULT_BLOCKED_ITEM_COMPARATOR); } for (BlockedItem p : blockedItems) { String taskDisplayName = LOGGER.isLoggable(Level.FINEST) ? p.task.getFullDisplayName() : null; LOGGER.log(Level.FINEST, "Current blocked item: {0}", taskDisplayName); if (!isBuildBlocked(p) && allowNewBuildableTask(p.task)) { LOGGER.log(Level.FINEST, "BlockedItem {0}: blocked -> buildable as the build is not blocked and new tasks are allowed", taskDisplayName); // ready to be executed Runnable r = makeBuildable(new BuildableItem(p)); if (r != null) { p.leave(this); r.run(); // JENKINS-28926 we have removed a task from the blocked projects and added to building // thus we should update the snapshot so that subsequent blocked projects can correctly // determine if they are blocked by the lucky winner updateSnapshot(); } } } } // waitingList -> buildable/blocked while (!waitingList.isEmpty()) { WaitingItem top = peek(); if (top.timestamp.compareTo(new GregorianCalendar()) > 0) { LOGGER.log(Level.FINEST, "Finished moving all ready items from queue."); break; // finished moving all ready items from queue } top.leave(this); Task p = top.task; if (!isBuildBlocked(top) && allowNewBuildableTask(p)) { // ready to be executed immediately Runnable r = makeBuildable(new BuildableItem(top)); String topTaskDisplayName = LOGGER.isLoggable(Level.FINEST) ? top.task.getFullDisplayName() : null; if (r != null) { LOGGER.log(Level.FINEST, "Executing runnable {0}", topTaskDisplayName); r.run(); } else { LOGGER.log(Level.FINEST, "Item {0} was unable to be made a buildable and is now a blocked item.", topTaskDisplayName); new BlockedItem(top).enter(this); } } else { // this can't be built now because another build is in progress // set this project aside. new BlockedItem(top).enter(this); } } if (s != null) s.sortBuildableItems(buildables); // Ensure that identification of blocked tasks is using the live state: JENKINS-27708 & JENKINS-27871 updateSnapshot(); // allocate buildable jobs to executors for (BuildableItem p : new ArrayList<BuildableItem>( buildables)) {// copy as we'll mutate the list in the loop // one last check to make sure this build is not blocked. if (isBuildBlocked(p)) { p.leave(this); new BlockedItem(p).enter(this); LOGGER.log(Level.FINE, "Catching that {0} is blocked in the last minute", p); // JENKINS-28926 we have moved an unblocked task into the blocked state, update snapshot // so that other buildables which might have been blocked by this can see the state change updateSnapshot(); continue; } String taskDisplayName = LOGGER.isLoggable(Level.FINEST) ? p.task.getFullDisplayName() : null; if (p.task instanceof FlyweightTask) { Runnable r = makeFlyWeightTaskBuildable(new BuildableItem(p)); if (r != null) { p.leave(this); LOGGER.log(Level.FINEST, "Executing flyweight task {0}", taskDisplayName); r.run(); updateSnapshot(); } } else { List<JobOffer> candidates = new ArrayList<>(parked.size()); List<CauseOfBlockage> reasons = new ArrayList<>(parked.size()); for (JobOffer j : parked.values()) { CauseOfBlockage reason = j.getCauseOfBlockage(p); if (reason == null) { LOGGER.log(Level.FINEST, "{0} is a potential candidate for task {1}", new Object[]{j, taskDisplayName}); candidates.add(j); } else { LOGGER.log(Level.FINEST, "{0} rejected {1}: {2}", new Object[] {j, taskDisplayName, reason}); reasons.add(reason); } } MappingWorksheet ws = new MappingWorksheet(p, candidates); Mapping m = loadBalancer.map(p.task, ws); if (m == null) { // if we couldn't find the executor that fits, // just leave it in the buildables list and // check if we can execute other projects LOGGER.log(Level.FINER, "Failed to map {0} to executors. candidates={1} parked={2}", new Object[]{p, candidates, parked.values()}); p.transientCausesOfBlockage = reasons.isEmpty() ? null : reasons; continue; } // found a matching executor. use it. WorkUnitContext wuc = new WorkUnitContext(p); LOGGER.log(Level.FINEST, "Found a matching executor for {0}. Using it.", taskDisplayName); m.execute(wuc); p.leave(this); if (!wuc.getWorkUnits().isEmpty()) { LOGGER.log(Level.FINEST, "BuildableItem {0} marked as pending.", taskDisplayName); makePending(p); } else LOGGER.log(Level.FINEST, "BuildableItem {0} with empty work units!?", p); // Ensure that identification of blocked tasks is using the live state: JENKINS-27708 & JENKINS-27871 // The creation of a snapshot itself should be relatively cheap given the expected rate of // job execution. You probably would need 100's of jobs starting execution every iteration // of maintain() before this could even start to become an issue and likely the calculation // of isBuildBlocked(p) will become a bottleneck before updateSnapshot() will. Additionally // since the snapshot itself only ever has at most one reference originating outside of the stack // it should remain in the eden space and thus be cheap to GC. // See https://jenkins-ci.org/issue/27708?focusedCommentId=225819&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-225819 // or https://jenkins-ci.org/issue/27708?focusedCommentId=225906&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-225906 // for alternative fixes of this issue. updateSnapshot(); } } } finally { updateSnapshot(); } } finally { lock.unlock(); } } /** * Tries to make an item ready to build. * @param p a proposed buildable item * @return a thunk to actually prepare it (after leaving an earlier list), or null if it cannot be run now */ private @CheckForNull Runnable makeBuildable(final BuildableItem p) { if (p.task instanceof FlyweightTask) { String taskDisplayName = LOGGER.isLoggable(Level.FINEST) ? p.task.getFullDisplayName() : null; if (!isBlockedByShutdown(p.task)) { Runnable runnable = makeFlyWeightTaskBuildable(p); LOGGER.log(Level.FINEST, "Converting flyweight task: {0} into a BuildableRunnable", taskDisplayName); if(runnable != null){ return runnable; } //this is to solve JENKINS-30084: the task has to be buildable to force the provisioning of nodes. //if the execution gets here, it means the task could not be scheduled since the node //the task is supposed to run on is offline or not available. //Thus, the flyweighttask enters the buildables queue and will ask Jenkins to provision a node LOGGER.log(Level.FINEST, "Flyweight task {0} is entering as buildable to provision a node.", taskDisplayName); return new BuildableRunnable(p); } // if the execution gets here, it means the task is blocked by shutdown and null is returned. LOGGER.log(Level.FINEST, "Task {0} is blocked by shutdown.", taskDisplayName); return null; } else { // regular heavyweight task return new BuildableRunnable(p); } } /** * This method checks if the flyweight task can be run on any of the available executors * @param p - the flyweight task to be scheduled * @return a Runnable if there is an executor that can take the task, null otherwise */ @CheckForNull private Runnable makeFlyWeightTaskBuildable(final BuildableItem p){ //we double check if this is a flyweight task if (p.task instanceof FlyweightTask) { Jenkins h = Jenkins.getInstance(); Map<Node, Integer> hashSource = new HashMap<Node, Integer>(h.getNodes().size()); // Even if master is configured with zero executors, we may need to run a flyweight task like MatrixProject on it. hashSource.put(h, Math.max(h.getNumExecutors() * 100, 1)); for (Node n : h.getNodes()) { hashSource.put(n, n.getNumExecutors() * 100); } ConsistentHash<Node> hash = new ConsistentHash<Node>(NODE_HASH); hash.addAll(hashSource); Label lbl = p.getAssignedLabel(); String fullDisplayName = p.task.getFullDisplayName(); for (Node n : hash.list(fullDisplayName)) { final Computer c = n.toComputer(); if (c == null || c.isOffline()) { continue; } if (lbl!=null && !lbl.contains(n)) { continue; } if (n.canTake(p) != null) { continue; } LOGGER.log(Level.FINEST, "Creating flyweight task {0} for computer {1}", new Object[]{fullDisplayName, c.getName()}); return new Runnable() { @Override public void run() { c.startFlyWeightTask(new WorkUnitContext(p).createWorkUnit(p.task)); makePending(p); } }; } } return null; } private static Hash<Node> NODE_HASH = new Hash<Node>() { public String hash(Node node) { return node.getNodeName(); } }; private boolean makePending(BuildableItem p) { // LOGGER.info("Making "+p.task+" pending"); // REMOVE p.isPending = true; return pendings.add(p); } /** @deprecated Use {@link #isBlockedByShutdown} instead. */ @Deprecated public static boolean ifBlockedByHudsonShutdown(Task task) { return isBlockedByShutdown(task); } /** * Checks whether a task should not be scheduled because {@link Jenkins#isQuietingDown()}. * @param task some queue task * @return true if {@link Jenkins#isQuietingDown()} unless this is a {@link NonBlockingTask} * @since 1.598 */ public static boolean isBlockedByShutdown(Task task) { return Jenkins.getInstance().isQuietingDown() && !(task instanceof NonBlockingTask); } public Api getApi() { return new Api(this); } /** * Marks {@link Task}s that are not persisted. * @since 1.311 */ public interface TransientTask extends Task {} /** * Marks {@link Task}s that do not consume {@link Executor}. * @see OneOffExecutor * @since 1.318 */ public interface FlyweightTask extends Task {} /** * Marks {@link Task}s that are not affected by the {@linkplain Jenkins#isQuietingDown()} quieting down}, * because these tasks keep other tasks executing. * @see #isBlockedByShutdown * @since 1.336 */ public interface NonBlockingTask extends Task {} /** * Task whose execution is controlled by the queue. * * <p> * {@link #equals(Object) Value equality} of {@link Task}s is used * to collapse two tasks into one. This is used to avoid infinite * queue backlog. * * <p> * Pending {@link Task}s are persisted when Hudson shuts down, so * it needs to be persistable via XStream. To create a non-persisted * transient Task, extend {@link TransientTask} marker interface. * * <p> * Plugins are encouraged to extend from {@link AbstractQueueTask} * instead of implementing this interface directly, to maintain * compatibility with future changes to this interface. * * <p> * Plugins are encouraged to implement {@link AccessControlled} otherwise * the tasks will be hidden from display in the queue. * * <p> * For historical reasons, {@link Task} object by itself * also represents the "primary" sub-task (and as implied by this * design, a {@link Task} must have at least one sub-task.) * Most of the time, the primary subtask is the only sub task. */ public interface Task extends ModelObject, SubTask { /** * Returns true if the execution should be blocked * for temporary reasons. * * <p> * Short-hand for {@code getCauseOfBlockage()!=null}. */ boolean isBuildBlocked(); /** * @deprecated as of 1.330 * Use {@link CauseOfBlockage#getShortDescription()} instead. */ @Deprecated String getWhyBlocked(); /** * If the execution of this task should be blocked for temporary reasons, * this method returns a non-null object explaining why. * * <p> * Otherwise this method returns null, indicating that the build can proceed right away. * * <p> * This can be used to define mutual exclusion that goes beyond * {@link #getResourceList()}. * @return by default, null */ @CheckForNull default CauseOfBlockage getCauseOfBlockage() { return null; } /** * Unique name of this task. * * <p> * This method is no longer used, left here for compatibility. Just return {@link #getDisplayName()}. */ String getName(); /** * @see hudson.model.Item#getFullDisplayName() */ String getFullDisplayName(); /** * Checks the permission to see if the current user can abort this executable. * Returns normally from this method if it's OK. * <p> * NOTE: If you have implemented {@link AccessControlled} this should just be * {@code checkPermission(hudson.model.Item.CANCEL);} * * @throws AccessDeniedException if the permission is not granted. */ void checkAbortPermission(); /** * Works just like {@link #checkAbortPermission()} except it indicates the status by a return value, * instead of exception. * Also used by default for {@link hudson.model.Queue.Item#hasCancelPermission}. * <p> * NOTE: If you have implemented {@link AccessControlled} this should just be * {@code return hasPermission(hudson.model.Item.CANCEL);} * * @return false * if the user doesn't have the permission. */ boolean hasAbortPermission(); /** * Returns the URL of this task relative to the context root of the application. * * <p> * When the user clicks an item in the queue, this is the page where the user is taken to. * Hudson expects the current instance to be bound to the URL returned by this method. * * @return * URL that ends with '/'. */ String getUrl(); /** * True if the task allows concurrent builds, where the same {@link Task} is executed * by multiple executors concurrently on the same or different nodes. * @return by default, false * @since 1.338 */ default boolean isConcurrentBuild() { return false; } /** * Obtains the {@link SubTask}s that constitute this task. * * <p> * The collection returned by this method must also contain the primary {@link SubTask} * represented by this {@link Task} object itself as the first element. * The returned value is read-only. * * <p> * At least size 1. * * @return by default, {@code this} * @since 1.377 */ default Collection<? extends SubTask> getSubTasks() { return Collections.singleton(this); } /** * This method allows the task to provide the default fallback authentication object to be used * when {@link QueueItemAuthenticator} fails to authenticate the build. * * <p> * When the task execution touches other objects inside Jenkins, the access control is performed * based on whether this {@link Authentication} is allowed to use them. * * @return by default, {@link ACL#SYSTEM} * @since 1.520 * @see QueueItemAuthenticator * @see Tasks#getDefaultAuthenticationOf(Queue.Task) */ default @Nonnull Authentication getDefaultAuthentication() { return ACL.SYSTEM; } /** * This method allows the task to provide the default fallback authentication object to be used * when {@link QueueItemAuthenticator} fails to authenticate the build. * * <p> * When the task execution touches other objects inside Jenkins, the access control is performed * based on whether this {@link Authentication} is allowed to use them. * * <p> * This method was added to an interface after it was created, so plugins built against * older versions of Jenkins may not have this method implemented. Called private method _getDefaultAuthenticationOf(Task) on {@link Tasks} * to avoid {@link AbstractMethodError}. * * @since 1.592 * @see QueueItemAuthenticator * @see Tasks#getDefaultAuthenticationOf(Queue.Task, Queue.Item) */ default @Nonnull Authentication getDefaultAuthentication(Queue.Item item) { return getDefaultAuthentication(); } } /** * Represents the real meat of the computation run by {@link Executor}. * * <h2>Views</h2> * <p> * Implementation must have <tt>executorCell.jelly</tt>, which is * used to render the HTML that indicates this executable is executing. */ public interface Executable extends Runnable { /** * Task from which this executable was created. * * <p> * Since this method went through a signature change in 1.377, the invocation may results in * {@link AbstractMethodError}. * Use {@link Executables#getParentOf(Queue.Executable)} that avoids this. */ @Nonnull SubTask getParent(); /** * Called by {@link Executor} to perform the task. * @throws AsynchronousExecution if you would like to continue without consuming a thread */ @Override void run() throws AsynchronousExecution; /** * Estimate of how long will it take to execute this executable. * Measured in milliseconds. * * @return -1 if it's impossible to estimate; default, {@link SubTask#getEstimatedDuration} * @since 1.383 */ default long getEstimatedDuration() { return Executables.getParentOf(this).getEstimatedDuration(); } /** * Used to render the HTML. Should be a human readable text of what this executable is. */ @Override String toString(); } /** * Item in a queue. */ @ExportedBean(defaultVisibility = 999) public static abstract class Item extends Actionable { private final long id; /** * Unique ID (per master) that tracks the {@link Task} as it moves through different stages * in the queue (each represented by different subtypes of {@link Item} and into any subsequent * {@link Run} instance (see {@link Run#getQueueId()}). * @return * @since 1.601 */ @Exported public long getId() { return id; } @AdaptField(was=int.class, name="id") @Deprecated public int getIdLegacy() { if (id > Integer.MAX_VALUE) { throw new IllegalStateException("Sorry, you need to update any Plugins attempting to " + "assign 'Queue.Item.id' to an int value. 'Queue.Item.id' is now a long value and " + "has incremented to a value greater than Integer.MAX_VALUE (2^31 - 1)."); } return (int) id; } /** * Project to be built. */ @Exported public final Task task; private /*almost final*/ transient FutureImpl future; private final long inQueueSince; /** * Build is blocked because another build is in progress, * required {@link Resource}s are not available, or otherwise blocked * by {@link Task#isBuildBlocked()}. */ @Exported public boolean isBlocked() { return this instanceof BlockedItem; } /** * Build is waiting the executor to become available. * This flag is only used in {@link Queue#getItems()} for * 'pseudo' items that are actually not really in the queue. */ @Exported public boolean isBuildable() { return this instanceof BuildableItem; } /** * True if the item is starving for an executor for too long. */ @Exported public boolean isStuck() { return false; } /** * Since when is this item in the queue. * @return Unix timestamp */ @Exported public long getInQueueSince() { return this.inQueueSince; } /** * Returns a human readable presentation of how long this item is already in the queue. * E.g. something like '3 minutes 40 seconds' */ public String getInQueueForString() { long duration = System.currentTimeMillis() - this.inQueueSince; return Util.getTimeSpanString(duration); } /** * Can be used to wait for the completion (either normal, abnormal, or cancellation) of the {@link Task}. * <p> * Just like {@link #getId()}, the same object tracks various stages of the queue. */ @WithBridgeMethods(Future.class) public QueueTaskFuture<Executable> getFuture() { return future; } /** * If this task needs to be run on a node with a particular label, * return that {@link Label}. Otherwise null, indicating * it can run on anywhere. * * <p> * This code takes {@link LabelAssignmentAction} into account, then fall back to {@link SubTask#getAssignedLabel()} */ public Label getAssignedLabel() { for (LabelAssignmentAction laa : getActions(LabelAssignmentAction.class)) { Label l = laa.getAssignedLabel(task); if (l!=null) return l; } return task.getAssignedLabel(); } /** * Test if the specified {@link SubTask} needs to be run on a node with a particular label. * <p> * This method takes {@link LabelAssignmentAction} into account, the first * non-null assignment will be returned. * Otherwise falls back to {@link SubTask#getAssignedLabel()} * @param st {@link SubTask} to be checked. * @return Required {@link Label}. Otherwise null, indicating it can run on anywhere. */ public @CheckForNull Label getAssignedLabelFor(@Nonnull SubTask st) { for (LabelAssignmentAction laa : getActions(LabelAssignmentAction.class)) { Label l = laa.getAssignedLabel(st); if (l!=null) return l; } return st.getAssignedLabel(); } /** * Convenience method that returns a read only view of the {@link Cause}s associated with this item in the queue. * * @return can be empty but never null * @since 1.343 */ public final List<Cause> getCauses() { CauseAction ca = getAction(CauseAction.class); if (ca!=null) return Collections.unmodifiableList(ca.getCauses()); return Collections.emptyList(); } @Restricted(DoNotUse.class) // used from Jelly public String getCausesDescription() { List<Cause> causes = getCauses(); StringBuilder s = new StringBuilder(); for (Cause c : causes) { s.append(c.getShortDescription()).append('\n'); } return s.toString(); } protected Item(Task task, List<Action> actions, long id, FutureImpl future) { this.task = task; this.id = id; this.future = future; this.inQueueSince = System.currentTimeMillis(); for (Action action: actions) addAction(action); } protected Item(Task task, List<Action> actions, long id, FutureImpl future, long inQueueSince) { this.task = task; this.id = id; this.future = future; this.inQueueSince = inQueueSince; for (Action action: actions) addAction(action); } protected Item(Item item) { this(item.task, new ArrayList<Action>(item.getAllActions()), item.id, item.future, item.inQueueSince); } /** * Returns the URL of this {@link Item} relative to the context path of Jenkins * * @return * URL that ends with '/'. * @since 1.519 */ @Exported public String getUrl() { return "queue/item/"+id+'/'; } /** * Gets a human-readable status message describing why it's in the queue. */ @Exported public final String getWhy() { CauseOfBlockage cob = getCauseOfBlockage(); return cob!=null ? cob.getShortDescription() : null; } /** * Gets an object that describes why this item is in the queue. */ public abstract CauseOfBlockage getCauseOfBlockage(); /** * Gets a human-readable message about the parameters of this item * @return String */ @Exported public String getParams() { StringBuilder s = new StringBuilder(); for (ParametersAction pa : getActions(ParametersAction.class)) { for (ParameterValue p : pa.getParameters()) { s.append('\n').append(p.getShortDescription()); } } return s.toString(); } /** * Checks whether a scheduled item may be canceled. * @return by default, the same as {@link hudson.model.Queue.Task#hasAbortPermission} */ public boolean hasCancelPermission() { return task.hasAbortPermission(); } public String getDisplayName() { // TODO Auto-generated method stub return null; } public String getSearchUrl() { // TODO Auto-generated method stub return null; } /** @deprecated Use {@link #doCancelItem} instead. */ @Deprecated @RequirePOST public HttpResponse doCancelQueue() throws IOException, ServletException { Jenkins.getInstance().getQueue().cancel(this); return HttpResponses.forwardToPreviousPage(); } /** * Returns the identity that this task carries when it runs, for the purpose of access control. * * When the task execution touches other objects inside Jenkins, the access control is performed * based on whether this {@link Authentication} is allowed to use them. Implementers, if you are unsure, * return the identity of the user who queued the task, or {@link ACL#SYSTEM} to bypass the access control * and run as the super user. * * @since 1.520 */ @Nonnull public Authentication authenticate() { for (QueueItemAuthenticator auth : QueueItemAuthenticatorProvider.authenticators()) { Authentication a = auth.authenticate(this); if (a!=null) return a; } return task.getDefaultAuthentication(this); } public Api getApi() { return new Api(this); } private Object readResolve() { this.future = new FutureImpl(task); return this; } @Override public String toString() { return getClass().getName() + ':' + task + ':' + id; } /** * Enters the appropriate queue for this type of item. */ /*package*/ abstract void enter(Queue q); /** * Leaves the appropriate queue for this type of item. */ /*package*/ abstract boolean leave(Queue q); /** * Cancels this item, which updates {@link #future} to notify the listener, and * also leaves the queue. * * @return true * if the item was successfully cancelled. */ /*package*/ boolean cancel(Queue q) { boolean r = leave(q); if (r) { future.setAsCancelled(); LeftItem li = new LeftItem(this); li.enter(q); } return r; } } /** * A Stub class for {@link Task} which exposes only the name of the Task to be displayed when the user * has DISCOVERY permissions only. */ @Restricted(NoExternalUse.class) @ExportedBean(defaultVisibility = 999) public static class StubTask { private String name; public StubTask(@Nonnull Queue.Task base) { this.name = base.getName(); } @Exported public String getName() { return name; } } /** * A Stub class for {@link Item} which exposes only the name of the Task to be displayed when the user * has DISCOVERY permissions only. */ @Restricted(NoExternalUse.class) @ExportedBean(defaultVisibility = 999) public class StubItem { @Exported public StubTask task; public StubItem(StubTask task) { this.task = task; } } /** * An optional interface for actions on Queue.Item. * Lets the action cooperate in queue management. * * @since 1.300-ish. */ public interface QueueAction extends Action { /** * Returns whether the new item should be scheduled. * An action should return true if the associated task is 'different enough' to warrant a separate execution. */ boolean shouldSchedule(List<Action> actions); } /** * Extension point for deciding if particular job should be scheduled or not. * * <p> * This handler is consulted every time someone tries to submit a task to the queue. * If any of the registered handlers returns false, the task will not be added * to the queue, and the task will never get executed. * * <p> * The other use case is to add additional {@link Action}s to the task * (for example {@link LabelAssignmentAction}) to tasks that are submitted to the queue. * * @since 1.316 */ public static abstract class QueueDecisionHandler implements ExtensionPoint { /** * Returns whether the new item should be scheduled. * * @param actions * List of actions that are to be made available as {@link AbstractBuild#getActions()} * upon the start of the build. This list is live, and can be mutated. */ public abstract boolean shouldSchedule(Task p, List<Action> actions); /** * All registered {@link QueueDecisionHandler}s */ public static ExtensionList<QueueDecisionHandler> all() { return ExtensionList.lookup(QueueDecisionHandler.class); } } /** * {@link Item} in the {@link Queue#waitingList} stage. */ public static final class WaitingItem extends Item implements Comparable<WaitingItem> { private static final AtomicLong COUNTER = new AtomicLong(0); /** * This item can be run after this time. */ @Exported public Calendar timestamp; public WaitingItem(Calendar timestamp, Task project, List<Action> actions) { super(project, actions, COUNTER.incrementAndGet(), new FutureImpl(project)); this.timestamp = timestamp; } static int getCurrentCounterValue() { return COUNTER.intValue(); } public int compareTo(WaitingItem that) { int r = this.timestamp.getTime().compareTo(that.timestamp.getTime()); if (r != 0) return r; if (this.getId() < that.getId()) { return -1; } else if (this.getId() == that.getId()) { return 0; } else { return 1; } } public CauseOfBlockage getCauseOfBlockage() { long diff = timestamp.getTimeInMillis() - System.currentTimeMillis(); if (diff > 0) return CauseOfBlockage.fromMessage(Messages._Queue_InQuietPeriod(Util.getTimeSpanString(diff))); else return CauseOfBlockage.fromMessage(Messages._Queue_Unknown()); } @Override /*package*/ void enter(Queue q) { if (q.waitingList.add(this)) { for (QueueListener ql : QueueListener.all()) { try { ql.onEnterWaiting(this); } catch (Throwable e) { // don't let this kill the queue LOGGER.log(Level.WARNING, "QueueListener failed while processing "+this,e); } } } } @Override /*package*/ boolean leave(Queue q) { boolean r = q.waitingList.remove(this); if (r) { for (QueueListener ql : QueueListener.all()) { try { ql.onLeaveWaiting(this); } catch (Throwable e) { // don't let this kill the queue LOGGER.log(Level.WARNING, "QueueListener failed while processing "+this,e); } } } return r; } } /** * Common part between {@link BlockedItem} and {@link BuildableItem}. */ public static abstract class NotWaitingItem extends Item { /** * When did this job exit the {@link Queue#waitingList} phase? */ @Exported public final long buildableStartMilliseconds; protected NotWaitingItem(WaitingItem wi) { super(wi); buildableStartMilliseconds = System.currentTimeMillis(); } protected NotWaitingItem(NotWaitingItem ni) { super(ni); buildableStartMilliseconds = ni.buildableStartMilliseconds; } } /** * {@link Item} in the {@link Queue#blockedProjects} stage. */ public final class BlockedItem extends NotWaitingItem { public BlockedItem(WaitingItem wi) { super(wi); } public BlockedItem(NotWaitingItem ni) { super(ni); } public CauseOfBlockage getCauseOfBlockage() { ResourceActivity r = getBlockingActivity(task); if (r != null) { if (r == task) // blocked by itself, meaning another build is in progress return CauseOfBlockage.fromMessage(Messages._Queue_InProgress()); return CauseOfBlockage.fromMessage(Messages._Queue_BlockedBy(r.getDisplayName())); } for (QueueTaskDispatcher d : QueueTaskDispatcher.all()) { CauseOfBlockage cause = d.canRun(this); if (cause != null) return cause; } return task.getCauseOfBlockage(); } /*package*/ void enter(Queue q) { LOGGER.log(Level.FINE, "{0} is blocked", this); blockedProjects.add(this); for (QueueListener ql : QueueListener.all()) { try { ql.onEnterBlocked(this); } catch (Throwable e) { // don't let this kill the queue LOGGER.log(Level.WARNING, "QueueListener failed while processing "+this,e); } } } /*package*/ boolean leave(Queue q) { boolean r = blockedProjects.remove(this); if (r) { LOGGER.log(Level.FINE, "{0} no longer blocked", this); for (QueueListener ql : QueueListener.all()) { try { ql.onLeaveBlocked(this); } catch (Throwable e) { // don't let this kill the queue LOGGER.log(Level.WARNING, "QueueListener failed while processing "+this,e); } } } return r; } } /** * {@link Item} in the {@link Queue#buildables} stage. */ public final static class BuildableItem extends NotWaitingItem { /** * Set to true when this is added to the {@link Queue#pendings} list. */ private boolean isPending; /** * Reasons why the last call to {@link #maintain} left this buildable (but not blocked or executing). * May be null but not empty. */ private transient volatile @CheckForNull List<CauseOfBlockage> transientCausesOfBlockage; public BuildableItem(WaitingItem wi) { super(wi); } public BuildableItem(NotWaitingItem ni) { super(ni); } public CauseOfBlockage getCauseOfBlockage() { Jenkins jenkins = Jenkins.getInstance(); if(isBlockedByShutdown(task)) return CauseOfBlockage.fromMessage(Messages._Queue_HudsonIsAboutToShutDown()); List<CauseOfBlockage> causesOfBlockage = transientCausesOfBlockage; Label label = getAssignedLabel(); List<Node> allNodes = jenkins.getNodes(); if (allNodes.isEmpty()) label = null; // no master/agent. pointless to talk about nodes if (label != null) { Set<Node> nodes = label.getNodes(); if (label.isOffline()) { if (nodes.size() != 1) return new BecauseLabelIsOffline(label); else return new BecauseNodeIsOffline(nodes.iterator().next()); } else { if (causesOfBlockage != null && label.getIdleExecutors() > 0) { return new CompositeCauseOfBlockage(causesOfBlockage); } if (nodes.size() != 1) return new BecauseLabelIsBusy(label); else return new BecauseNodeIsBusy(nodes.iterator().next()); } } else if (causesOfBlockage != null && new ComputerSet().getIdleExecutors() > 0) { return new CompositeCauseOfBlockage(causesOfBlockage); } else { return CauseOfBlockage.createNeedsMoreExecutor(Messages._Queue_WaitingForNextAvailableExecutor()); } } @Override public boolean isStuck() { Label label = getAssignedLabel(); if(label!=null && label.isOffline()) // no executor online to process this job. definitely stuck. return true; long d = task.getEstimatedDuration(); long elapsed = System.currentTimeMillis()-buildableStartMilliseconds; if(d>=0) { // if we were running elsewhere, we would have done this build ten times. return elapsed > Math.max(d,60000L)*10; } else { // more than a day in the queue return TimeUnit.MILLISECONDS.toHours(elapsed)>24; } } @Exported public boolean isPending() { return isPending; } @Override /*package*/ void enter(Queue q) { q.buildables.add(this); for (QueueListener ql : QueueListener.all()) { try { ql.onEnterBuildable(this); } catch (Throwable e) { // don't let this kill the queue LOGGER.log(Level.WARNING, "QueueListener failed while processing "+this,e); } } } @Override /*package*/ boolean leave(Queue q) { boolean r = q.buildables.remove(this); if (r) { LOGGER.log(Level.FINE, "{0} no longer blocked", this); for (QueueListener ql : QueueListener.all()) { try { ql.onLeaveBuildable(this); } catch (Throwable e) { // don't let this kill the queue LOGGER.log(Level.WARNING, "QueueListener failed while processing "+this,e); } } } return r; } } /** * {@link Item} in the {@link Queue#leftItems} stage. These are items that had left the queue * by either began executing or by getting cancelled. * * @since 1.519 */ public final static class LeftItem extends Item { public final WorkUnitContext outcome; /** * When item has left the queue and begin executing. */ public LeftItem(WorkUnitContext wuc) { super(wuc.item); this.outcome = wuc; } /** * When item is cancelled. */ public LeftItem(Item cancelled) { super(cancelled); this.outcome = null; } @Override public CauseOfBlockage getCauseOfBlockage() { return null; } /** * If this is representing an item that started executing, this property returns * the primary executable (such as {@link AbstractBuild}) that created out of it. */ @Exported public @CheckForNull Executable getExecutable() { return outcome!=null ? outcome.getPrimaryWorkUnit().getExecutable() : null; } /** * Is this representing a cancelled item? */ @Exported public boolean isCancelled() { return outcome==null; } @Override void enter(Queue q) { q.leftItems.put(getId(),this); for (QueueListener ql : QueueListener.all()) { try { ql.onLeft(this); } catch (Throwable e) { // don't let this kill the queue LOGGER.log(Level.WARNING, "QueueListener failed while processing "+this,e); } } } @Override boolean leave(Queue q) { // there's no leave operation return false; } } private static final Logger LOGGER = Logger.getLogger(Queue.class.getName()); /** * This {@link XStream} instance is used to persist {@link Task}s. */ public static final XStream XSTREAM = new XStream2(); static { XSTREAM.registerConverter(new AbstractSingleValueConverter() { @Override @SuppressWarnings("unchecked") public boolean canConvert(Class klazz) { return hudson.model.Item.class.isAssignableFrom(klazz); } @Override public Object fromString(String string) { Object item = Jenkins.getInstance().getItemByFullName(string); if(item==null) throw new NoSuchElementException("No such job exists: "+string); return item; } @Override public String toString(Object item) { return ((hudson.model.Item) item).getFullName(); } }); XSTREAM.registerConverter(new AbstractSingleValueConverter() { @SuppressWarnings("unchecked") @Override public boolean canConvert(Class klazz) { return Run.class.isAssignableFrom(klazz); } @Override public Object fromString(String string) { String[] split = string.split("#"); String projectName = split[0]; int buildNumber = Integer.parseInt(split[1]); Job<?,?> job = (Job<?,?>) Jenkins.getInstance().getItemByFullName(projectName); if(job==null) throw new NoSuchElementException("No such job exists: "+projectName); Run<?,?> run = job.getBuildByNumber(buildNumber); if(run==null) throw new NoSuchElementException("No such build: "+string); return run; } @Override public String toString(Object object) { Run<?,?> run = (Run<?,?>) object; return run.getParent().getFullName() + "#" + run.getNumber(); } }); /** * Reconnect every reference to {@link Queue} by the singleton. */ XSTREAM.registerConverter(new AbstractSingleValueConverter() { @Override public boolean canConvert(Class klazz) { return Queue.class.isAssignableFrom(klazz); } @Override public Object fromString(String string) { return Jenkins.getInstance().getQueue(); } @Override public String toString(Object item) { return "queue"; } }); } /** * Regularly invokes {@link Queue#maintain()} and clean itself up when * {@link Queue} gets GC-ed. */ private static class MaintainTask extends SafeTimerTask { private final WeakReference<Queue> queue; MaintainTask(Queue queue) { this.queue = new WeakReference<Queue>(queue); } private void periodic() { long interval = 5000; Timer.get().scheduleWithFixedDelay(this, interval, interval, TimeUnit.MILLISECONDS); } protected void doRun() { Queue q = queue.get(); if (q != null) q.maintain(); else cancel(); } } /** * {@link ArrayList} of {@link Item} with more convenience methods. */ private class ItemList<T extends Item> extends ArrayList<T> { public T get(Task task) { for (T item: this) { if (item.task.equals(task)) { return item; } } return null; } public List<T> getAll(Task task) { List<T> result = new ArrayList<T>(); for (T item: this) { if (item.task.equals(task)) { result.add(item); } } return result; } public boolean containsKey(Task task) { return get(task) != null; } public T remove(Task task) { Iterator<T> it = iterator(); while (it.hasNext()) { T t = it.next(); if (t.task.equals(task)) { it.remove(); return t; } } return null; } public void put(Task task, T item) { assert item.task.equals(task); add(item); } public ItemList<T> values() { return this; } /** * Works like {@link #remove(Task)} but also marks the {@link Item} as cancelled. */ public T cancel(Task p) { T x = get(p); if(x!=null) x.cancel(Queue.this); return x; } @SuppressFBWarnings(value = "IA_AMBIGUOUS_INVOCATION_OF_INHERITED_OR_OUTER_METHOD", justification = "It will invoke the inherited clear() method according to Java semantics. " + "FindBugs recommends suppressing warnings in such case") public void cancelAll() { for (T t : new ArrayList<T>(this)) t.cancel(Queue.this); clear(); } } private static class Snapshot { private final Set<WaitingItem> waitingList; private final List<BlockedItem> blockedProjects; private final List<BuildableItem> buildables; private final List<BuildableItem> pendings; public Snapshot(Set<WaitingItem> waitingList, List<BlockedItem> blockedProjects, List<BuildableItem> buildables, List<BuildableItem> pendings) { this.waitingList = new LinkedHashSet<WaitingItem>(waitingList); this.blockedProjects = new ArrayList<BlockedItem>(blockedProjects); this.buildables = new ArrayList<BuildableItem>(buildables); this.pendings = new ArrayList<BuildableItem>(pendings); } @Override public String toString() { return "Queue.Snapshot{waitingList=" + waitingList + ";blockedProjects=" + blockedProjects + ";buildables=" + buildables + ";pendings=" + pendings + "}"; } } private static class LockedRunnable implements Runnable { private final Runnable delegate; private LockedRunnable(Runnable delegate) { this.delegate = delegate; } @Override public void run() { withLock(delegate); } } private class BuildableRunnable implements Runnable { private final BuildableItem buildableItem; private BuildableRunnable(BuildableItem p) { this.buildableItem = p; } @Override public void run() { //the flyweighttask enters the buildables queue and will ask Jenkins to provision a node buildableItem.enter(Queue.this); } } private static class LockedJUCCallable<V> implements java.util.concurrent.Callable<V> { private final java.util.concurrent.Callable<V> delegate; private LockedJUCCallable(java.util.concurrent.Callable<V> delegate) { this.delegate = delegate; } @Override public V call() throws Exception { return withLock(delegate); } } private static class LockedHRCallable<V,T extends Throwable> implements hudson.remoting.Callable<V,T> { private static final long serialVersionUID = 1L; private final hudson.remoting.Callable<V,T> delegate; private LockedHRCallable(hudson.remoting.Callable<V,T> delegate) { this.delegate = delegate; } @Override public V call() throws T { return withLock(delegate); } @Override public void checkRoles(RoleChecker checker) throws SecurityException { delegate.checkRoles(checker); } } @CLIResolver public static Queue getInstance() { return Jenkins.getInstance().getQueue(); } /** * Restores the queue content during the start up. */ @Initializer(after=JOB_LOADED) public static void init(Jenkins h) { h.getQueue().load(); } }
tfennelly/jenkins
core/src/main/java/hudson/model/Queue.java
Java
mit
108,599
require "action_controller" Mime::Type.register "application/pdf", :pdf require "prawn" ActionController::Renderers.add :pdf do |filename, options| pdf = Prawn::Document.new pdf.text render_to_string options send_data pdf.render, :filename => "#{filename}.pdf", :type => "application/pdf", :disposition => "attachment" end module PdfRenderer end
travisjeffery/pdf_renderer
lib/pdf_renderer.rb
Ruby
mit
361
describe('modelAndOptionMapping', function() { var utHelper = window.utHelper; var testCase = utHelper.prepare([ 'echarts/src/component/grid', 'echarts/src/chart/line', 'echarts/src/chart/pie', 'echarts/src/chart/bar', 'echarts/src/component/toolbox', 'echarts/src/component/dataZoom' ]); function getData0(chart, seriesIndex) { return getSeries(chart, seriesIndex).getData().get('y', 0); } function getSeries(chart, seriesIndex) { return chart.getModel().getComponent('series', seriesIndex); } function getModel(chart, type, index) { return chart.getModel().getComponent(type, index); } function countSeries(chart) { return countModel(chart, 'series'); } function countModel(chart, type) { // FIXME // access private return chart.getModel()._componentsMap.get(type).length; } function getChartView(chart, series) { return chart._chartsMap[series.__viewId]; } function countChartViews(chart) { return chart._chartsViews.length; } function saveOrigins(chart) { var count = countSeries(chart); var origins = []; for (var i = 0; i < count; i++) { var series = getSeries(chart, i); origins.push({ model: series, view: getChartView(chart, series) }); } return origins; } function modelEqualsToOrigin(chart, idxList, origins, boolResult) { for (var i = 0; i < idxList.length; i++) { var idx = idxList[i]; expect(origins[idx].model === getSeries(chart, idx)).toEqual(boolResult); } } function viewEqualsToOrigin(chart, idxList, origins, boolResult) { for (var i = 0; i < idxList.length; i++) { var idx = idxList[i]; expect( origins[idx].view === getChartView(chart, getSeries(chart, idx)) ).toEqual(boolResult); } } describe('idNoNameNo', function () { testCase.createChart()('sameTypeNotMerge', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22]}, {type: 'line', data: [33]} ] }; var chart = this.chart; chart.setOption(option); // Not merge var origins = saveOrigins(chart); chart.setOption(option, true); expect(countChartViews(chart)).toEqual(3); expect(countSeries(chart)).toEqual(3); modelEqualsToOrigin(chart, [0, 1, 2], origins, false); viewEqualsToOrigin(chart, [0, 1, 2], origins, true); }); testCase.createChart()('sameTypeMergeFull', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22]}, {type: 'line', data: [33]} ] }; var chart = this.chart; chart.setOption(option); // Merge var origins = saveOrigins(chart); chart.setOption({ series: [ {type: 'line', data: [111]}, {type: 'line', data: [222]}, {type: 'line', data: [333]} ] }); expect(countSeries(chart)).toEqual(3); expect(countChartViews(chart)).toEqual(3); expect(getData0(chart, 0)).toEqual(111); expect(getData0(chart, 1)).toEqual(222); expect(getData0(chart, 2)).toEqual(333); viewEqualsToOrigin(chart, [0, 1, 2], origins, true); modelEqualsToOrigin(chart, [0, 1, 2], origins, true); }); testCase.createChart()('sameTypeMergePartial', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22]}, {type: 'line', data: [33]} ] }; var chart = this.chart; chart.setOption(option); // Merge var origins = saveOrigins(chart); chart.setOption({ series: [ {data: [22222]} ] }); expect(countSeries(chart)).toEqual(3); expect(countChartViews(chart)).toEqual(3); expect(getData0(chart, 0)).toEqual(22222); expect(getData0(chart, 1)).toEqual(22); expect(getData0(chart, 2)).toEqual(33); viewEqualsToOrigin(chart, [0, 1, 2], origins, true); modelEqualsToOrigin(chart, [0, 1, 2], origins, true); }); testCase.createChart()('differentTypeMerge', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22]}, {type: 'line', data: [33]} ] }; var chart = this.chart; chart.setOption(option); // Merge var origins = saveOrigins(chart); chart.setOption({ series: [ {type: 'line', data: [111]}, {type: 'bar', data: [222]}, {type: 'line', data: [333]} ] }); expect(countSeries(chart)).toEqual(3); expect(countChartViews(chart)).toEqual(3); expect(getData0(chart, 0)).toEqual(111); expect(getData0(chart, 1)).toEqual(222); expect(getData0(chart, 2)).toEqual(333); expect(getSeries(chart, 1).type === 'series.bar').toEqual(true); modelEqualsToOrigin(chart, [0, 2], origins, true); modelEqualsToOrigin(chart, [1], origins, false); viewEqualsToOrigin(chart, [0, 2], origins, true); viewEqualsToOrigin(chart, [1], origins, false); }); }); describe('idSpecified', function () { testCase.createChart()('sameTypeNotMerge', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22], id: 20}, {type: 'line', data: [33], id: 30}, {type: 'line', data: [44]}, {type: 'line', data: [55]} ] }; var chart = this.chart; chart.setOption(option); expect(countSeries(chart)).toEqual(5); expect(countChartViews(chart)).toEqual(5); expect(getData0(chart, 0)).toEqual(11); expect(getData0(chart, 1)).toEqual(22); expect(getData0(chart, 2)).toEqual(33); expect(getData0(chart, 3)).toEqual(44); expect(getData0(chart, 4)).toEqual(55); var origins = saveOrigins(chart); chart.setOption(option, true); expect(countChartViews(chart)).toEqual(5); expect(countSeries(chart)).toEqual(5); modelEqualsToOrigin(chart, [0, 1, 2, 3, 4], origins, false); viewEqualsToOrigin(chart, [0, 1, 2, 3, 4], origins, true); }); testCase.createChart()('sameTypeMerge', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22], id: 20}, {type: 'line', data: [33], id: 30}, {type: 'line', data: [44]}, {type: 'line', data: [55]} ] }; var chart = this.chart; chart.setOption(option); var origins = saveOrigins(chart); chart.setOption(option); expect(countChartViews(chart)).toEqual(5); expect(countSeries(chart)).toEqual(5); modelEqualsToOrigin(chart, [0, 1, 2, 3, 4], origins, true); viewEqualsToOrigin(chart, [0, 1, 2, 3, 4], origins, true); }); testCase.createChart()('differentTypeNotMerge', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22], id: 20}, {type: 'line', data: [33], id: 30}, {type: 'line', data: [44]}, {type: 'line', data: [55]} ] }; var chart = this.chart; chart.setOption(option); var origins = saveOrigins(chart); var option2 = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'bar', data: [22], id: 20}, {type: 'line', data: [33], id: 30}, {type: 'bar', data: [44]}, {type: 'line', data: [55]} ] }; chart.setOption(option2, true); expect(countChartViews(chart)).toEqual(5); expect(countSeries(chart)).toEqual(5); modelEqualsToOrigin(chart, [0, 1, 2, 3, 4], origins, false); viewEqualsToOrigin(chart, [0, 2, 4], origins, true); viewEqualsToOrigin(chart, [1, 3], origins, false); }); testCase.createChart()('differentTypeMergeFull', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22], id: 20}, {type: 'line', data: [33], id: 30, name: 'a'}, {type: 'line', data: [44]}, {type: 'line', data: [55]} ] }; var chart = this.chart; chart.setOption(option); var origins = saveOrigins(chart); var option2 = { series: [ {type: 'line', data: [11]}, {type: 'bar', data: [22], id: 20, name: 'a'}, {type: 'line', data: [33], id: 30}, {type: 'bar', data: [44]}, {type: 'line', data: [55]} ] }; chart.setOption(option2); expect(countChartViews(chart)).toEqual(5); expect(countSeries(chart)).toEqual(5); modelEqualsToOrigin(chart, [0, 2, 4], origins, true); modelEqualsToOrigin(chart, [1, 3], origins, false); viewEqualsToOrigin(chart, [0, 2, 4], origins, true); viewEqualsToOrigin(chart, [1, 3], origins, false); }); testCase.createChart()('differentTypeMergePartial1', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22], id: 20}, {type: 'line', data: [33]}, {type: 'line', data: [44], id: 40}, {type: 'line', data: [55]} ] }; var chart = this.chart; chart.setOption(option); var origins = saveOrigins(chart); var option2 = { series: [ {type: 'bar', data: [444], id: 40}, {type: 'line', data: [333]}, {type: 'line', data: [222], id: 20} ] }; chart.setOption(option2); expect(countChartViews(chart)).toEqual(5); expect(countSeries(chart)).toEqual(5); expect(getData0(chart, 0)).toEqual(333); expect(getData0(chart, 1)).toEqual(222); expect(getData0(chart, 2)).toEqual(33); expect(getData0(chart, 3)).toEqual(444); expect(getData0(chart, 4)).toEqual(55); modelEqualsToOrigin(chart, [0, 1, 2, 4], origins, true); modelEqualsToOrigin(chart, [3], origins, false); viewEqualsToOrigin(chart, [0, 1, 2, 4], origins, true); viewEqualsToOrigin(chart, [3], origins, false); }); testCase.createChart()('differentTypeMergePartial2', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22], id: 20} ] }; var chart = this.chart; chart.setOption(option); var option2 = { series: [ {type: 'bar', data: [444], id: 40}, {type: 'line', data: [333]}, {type: 'line', data: [222], id: 20}, {type: 'line', data: [111]} ] }; chart.setOption(option2); expect(countChartViews(chart)).toEqual(4); expect(countSeries(chart)).toEqual(4); expect(getData0(chart, 0)).toEqual(333); expect(getData0(chart, 1)).toEqual(222); expect(getData0(chart, 2)).toEqual(444); expect(getData0(chart, 3)).toEqual(111); }); testCase.createChart()('mergePartialDoNotMapToOtherId', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11], id: 10}, {type: 'line', data: [22], id: 20} ] }; var chart = this.chart; chart.setOption(option); var option2 = { series: [ {type: 'bar', data: [444], id: 40} ] }; chart.setOption(option2); expect(countChartViews(chart)).toEqual(3); expect(countSeries(chart)).toEqual(3); expect(getData0(chart, 0)).toEqual(11); expect(getData0(chart, 1)).toEqual(22); expect(getData0(chart, 2)).toEqual(444); }); testCase.createChart()('idDuplicate', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11], id: 10}, {type: 'line', data: [22], id: 10} ] }; var chart = this.chart; expect(function () { chart.setOption(option); }).toThrowError(/duplicate/); }); testCase.createChart()('nameTheSameButIdNotTheSame', function () { var chart = this.chart; var option = { grid: {}, xAxis: [ {id: 'x1', name: 'a', xxxx: 'x1_a'}, {id: 'x2', name: 'b', xxxx: 'x2_b'} ], yAxis: {} }; chart.setOption(option); var xAxisModel0 = getModel(chart, 'xAxis', 0); var xAxisModel1 = getModel(chart, 'xAxis', 1); expect(xAxisModel0.option.xxxx).toEqual('x1_a'); expect(xAxisModel1.option.xxxx).toEqual('x2_b'); expect(xAxisModel1.option.name).toEqual('b'); var option2 = { xAxis: [ {id: 'k1', name: 'a', xxxx: 'k1_a'}, {id: 'x2', name: 'a', xxxx: 'x2_a'} ] }; chart.setOption(option2); var xAxisModel0 = getModel(chart, 'xAxis', 0); var xAxisModel1 = getModel(chart, 'xAxis', 1); var xAxisModel2 = getModel(chart, 'xAxis', 2); expect(xAxisModel0.option.xxxx).toEqual('x1_a'); expect(xAxisModel1.option.xxxx).toEqual('x2_a'); expect(xAxisModel1.option.name).toEqual('a'); expect(xAxisModel2.option.xxxx).toEqual('k1_a'); }); }); describe('noIdButNameExists', function () { testCase.createChart()('sameTypeNotMerge', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22], name: 'a'}, {type: 'line', data: [33], name: 'b'}, {type: 'line', data: [44]}, {type: 'line', data: [55], name: 'a'} ] }; var chart = this.chart; chart.setOption(option); expect(getSeries(chart, 1)).not.toEqual(getSeries(chart, 4)); expect(countSeries(chart)).toEqual(5); expect(countChartViews(chart)).toEqual(5); expect(getData0(chart, 0)).toEqual(11); expect(getData0(chart, 1)).toEqual(22); expect(getData0(chart, 2)).toEqual(33); expect(getData0(chart, 3)).toEqual(44); expect(getData0(chart, 4)).toEqual(55); var origins = saveOrigins(chart); chart.setOption(option, true); expect(countChartViews(chart)).toEqual(5); expect(countSeries(chart)).toEqual(5); modelEqualsToOrigin(chart, [0, 1, 2, 3, 4], origins, false); viewEqualsToOrigin(chart, [0, 1, 2, 3, 4], origins, true); }); testCase.createChart()('sameTypeMerge', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22], name: 'a'}, {type: 'line', data: [33], name: 'b'}, {type: 'line', data: [44]}, {type: 'line', data: [55], name: 'a'} ] }; var chart = this.chart; chart.setOption(option); var origins = saveOrigins(chart); chart.setOption(option); expect(countChartViews(chart)).toEqual(5); expect(countSeries(chart)).toEqual(5); modelEqualsToOrigin(chart, [0, 1, 2, 3, 4], origins, true); viewEqualsToOrigin(chart, [0, 1, 2, 3, 4], origins, true); }); testCase.createChart()('differentTypeNotMerge', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22], name: 'a'}, {type: 'line', data: [33], name: 'b'}, {type: 'line', data: [44]}, {type: 'line', data: [55], name: 'a'} ] }; var chart = this.chart; chart.setOption(option); var origins = saveOrigins(chart); var option2 = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'bar', data: [22], name: 'a'}, {type: 'line', data: [33], name: 'b'}, {type: 'bar', data: [44]}, {type: 'line', data: [55], name: 'a'} ] }; chart.setOption(option2, true); expect(countChartViews(chart)).toEqual(5); expect(countSeries(chart)).toEqual(5); modelEqualsToOrigin(chart, [0, 1, 2, 3, 4], origins, false); viewEqualsToOrigin(chart, [0, 2, 4], origins, true); viewEqualsToOrigin(chart, [1, 3], origins, false); }); testCase.createChart()('differentTypeMergePartialOneMapTwo', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22], name: 'a'}, {type: 'line', data: [33]}, {type: 'line', data: [44], name: 'b'}, {type: 'line', data: [55], name: 'a'} ] }; var chart = this.chart; chart.setOption(option); var origins = saveOrigins(chart); var option2 = { series: [ {type: 'bar', data: [444], id: 40}, {type: 'line', data: [333]}, {type: 'bar', data: [222], name: 'a'} ] }; chart.setOption(option2); expect(countChartViews(chart)).toEqual(6); expect(countSeries(chart)).toEqual(6); expect(getData0(chart, 0)).toEqual(333); expect(getData0(chart, 1)).toEqual(222); expect(getData0(chart, 2)).toEqual(33); expect(getData0(chart, 3)).toEqual(44); expect(getData0(chart, 4)).toEqual(55); expect(getData0(chart, 5)).toEqual(444); modelEqualsToOrigin(chart, [0, 2, 3, 4], origins, true); modelEqualsToOrigin(chart, [1], origins, false); viewEqualsToOrigin(chart, [0, 2, 3, 4], origins, true); viewEqualsToOrigin(chart, [1], origins, false); }); testCase.createChart()('differentTypeMergePartialTwoMapOne', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22], name: 'a'} ] }; var chart = this.chart; chart.setOption(option); var option2 = { series: [ {type: 'bar', data: [444], name: 'a'}, {type: 'line', data: [333]}, {type: 'line', data: [222], name: 'a'}, {type: 'line', data: [111]} ] }; chart.setOption(option2); expect(countChartViews(chart)).toEqual(4); expect(countSeries(chart)).toEqual(4); expect(getData0(chart, 0)).toEqual(333); expect(getData0(chart, 1)).toEqual(444); expect(getData0(chart, 2)).toEqual(222); expect(getData0(chart, 3)).toEqual(111); }); testCase.createChart()('mergePartialCanMapToOtherName', function () { // Consider case: axis.name = 'some label', which can be overwritten. var option = { xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11], name: 10}, {type: 'line', data: [22], name: 20} ] }; var chart = this.chart; chart.setOption(option); var option2 = { series: [ {type: 'bar', data: [444], name: 40}, {type: 'bar', data: [999], name: 40}, {type: 'bar', data: [777], id: 70} ] }; chart.setOption(option2); expect(countChartViews(chart)).toEqual(3); expect(countSeries(chart)).toEqual(3); expect(getData0(chart, 0)).toEqual(444); expect(getData0(chart, 1)).toEqual(999); expect(getData0(chart, 2)).toEqual(777); }); }); describe('ohters', function () { testCase.createChart()('aBugCase', function () { var option = { series: [ { type:'pie', radius: ['20%', '25%'], center:['20%', '20%'], avoidLabelOverlap: true, hoverAnimation :false, label: { normal: { show: true, position: 'center', textStyle: { fontSize: '30', fontWeight: 'bold' } }, emphasis: { show: true } }, data:[ {value:135, name:'视频广告'}, {value:1548} ] } ] }; var chart = this.chart; chart.setOption(option); chart.setOption({ series: [ { type:'pie', radius: ['20%', '25%'], center: ['20%', '20%'], avoidLabelOverlap: true, hoverAnimation: false, label: { normal: { show: true, position: 'center', textStyle: { fontSize: '30', fontWeight: 'bold' } } }, data: [ {value:135, name:'视频广告'}, {value:1548} ] }, { type:'pie', radius: ['20%', '25%'], center: ['60%', '20%'], avoidLabelOverlap: true, hoverAnimation: false, label: { normal: { show: true, position: 'center', textStyle: { fontSize: '30', fontWeight: 'bold' } } }, data: [ {value:135, name:'视频广告'}, {value:1548} ] } ] }, true); expect(countChartViews(chart)).toEqual(2); expect(countSeries(chart)).toEqual(2); }); testCase.createChart()('color', function () { var option = { backgroundColor: 'rgba(1,1,1,1)', xAxis: {data: ['a']}, yAxis: {}, series: [ {type: 'line', data: [11]}, {type: 'line', data: [22]}, {type: 'line', data: [33]} ] }; var chart = this.chart; chart.setOption(option); expect(chart._model.option.backgroundColor).toEqual('rgba(1,1,1,1)'); // Not merge chart.setOption({ backgroundColor: '#fff' }, true); expect(chart._model.option.backgroundColor).toEqual('#fff'); }); testCase.createChart()('innerId', function () { var option = { xAxis: {data: ['a']}, yAxis: {}, toolbox: { feature: { dataZoom: {} } }, dataZoom: [ {type: 'inside', id: 'a'}, {type: 'slider', id: 'b'} ], series: [ {type: 'line', data: [11]}, {type: 'line', data: [22]} ] }; var chart = this.chart; chart.setOption(option); expect(countModel(chart, 'dataZoom')).toEqual(4); expect(getModel(chart, 'dataZoom', 0).id).toEqual('a'); expect(getModel(chart, 'dataZoom', 1).id).toEqual('b'); // Merge chart.setOption({ dataZoom: [ {type: 'slider', id: 'c'}, {type: 'slider', name: 'x'} ] }); expect(countModel(chart, 'dataZoom')).toEqual(5); expect(getModel(chart, 'dataZoom', 0).id).toEqual('a'); expect(getModel(chart, 'dataZoom', 1).id).toEqual('b'); expect(getModel(chart, 'dataZoom', 4).id).toEqual('c'); }); }); });
ka215/WP-Gentelella
vendors/echarts/test/ut/spec/model/Global.js
JavaScript
mit
29,436
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_19) on Fri Oct 29 16:39:56 MSD 2010 --> <TITLE> Uses of Interface org.apache.poi.ss.usermodel.Comment (POI API Documentation) </TITLE> <META NAME="date" CONTENT="2010-10-29"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Interface org.apache.poi.ss.usermodel.Comment (POI API Documentation)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/apache/poi/ss/usermodel/\class-useComment.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="Comment.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Interface<br>org.apache.poi.ss.usermodel.Comment</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.apache.poi.hssf.usermodel"><B>org.apache.poi.hssf.usermodel</B></A></TD> <TD>usermodel package maps HSSF low level strutures to familiar workbook/sheet model&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.apache.poi.ss.usermodel"><B>org.apache.poi.ss.usermodel</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.apache.poi.xssf.usermodel"><B>org.apache.poi.xssf.usermodel</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.apache.poi.hssf.usermodel"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A> in <A HREF="../../../../../../org/apache/poi/hssf/usermodel/package-summary.html">org.apache.poi.hssf.usermodel</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Classes in <A HREF="../../../../../../org/apache/poi/hssf/usermodel/package-summary.html">org.apache.poi.hssf.usermodel</A> that implement <A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/usermodel/HSSFComment.html" title="class in org.apache.poi.hssf.usermodel">HSSFComment</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents a cell comment - a sticky note associated with a cell.</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../../org/apache/poi/hssf/usermodel/package-summary.html">org.apache.poi.hssf.usermodel</A> with parameters of type <A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>HSSFCell.</B><B><A HREF="../../../../../../org/apache/poi/hssf/usermodel/HSSFCell.html#setCellComment(org.apache.poi.ss.usermodel.Comment)">setCellComment</A></B>(<A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A>&nbsp;comment)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Assign a comment to this cell.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.apache.poi.ss.usermodel"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A> in <A HREF="../../../../../../org/apache/poi/ss/usermodel/package-summary.html">org.apache.poi.ss.usermodel</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../../org/apache/poi/ss/usermodel/package-summary.html">org.apache.poi.ss.usermodel</A> that return <A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A></CODE></FONT></TD> <TD><CODE><B>Drawing.</B><B><A HREF="../../../../../../org/apache/poi/ss/usermodel/Drawing.html#createCellComment(org.apache.poi.ss.usermodel.ClientAnchor)">createCellComment</A></B>(<A HREF="../../../../../../org/apache/poi/ss/usermodel/ClientAnchor.html" title="interface in org.apache.poi.ss.usermodel">ClientAnchor</A>&nbsp;anchor)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A></CODE></FONT></TD> <TD><CODE><B>Cell.</B><B><A HREF="../../../../../../org/apache/poi/ss/usermodel/Cell.html#getCellComment()">getCellComment</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns comment associated with this cell</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;<A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A></CODE></FONT></TD> <TD><CODE><B>Sheet.</B><B><A HREF="../../../../../../org/apache/poi/ss/usermodel/Sheet.html#getCellComment(int, int)">getCellComment</A></B>(int&nbsp;row, int&nbsp;column)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns cell comment for the specified row and column</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../../org/apache/poi/ss/usermodel/package-summary.html">org.apache.poi.ss.usermodel</A> with parameters of type <A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>Cell.</B><B><A HREF="../../../../../../org/apache/poi/ss/usermodel/Cell.html#setCellComment(org.apache.poi.ss.usermodel.Comment)">setCellComment</A></B>(<A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A>&nbsp;comment)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Assign a comment to this cell</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.apache.poi.xssf.usermodel"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A> in <A HREF="../../../../../../org/apache/poi/xssf/usermodel/package-summary.html">org.apache.poi.xssf.usermodel</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Classes in <A HREF="../../../../../../org/apache/poi/xssf/usermodel/package-summary.html">org.apache.poi.xssf.usermodel</A> that implement <A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../org/apache/poi/xssf/usermodel/XSSFComment.html" title="class in org.apache.poi.xssf.usermodel">XSSFComment</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../../org/apache/poi/xssf/usermodel/package-summary.html">org.apache.poi.xssf.usermodel</A> with parameters of type <A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B>XSSFCell.</B><B><A HREF="../../../../../../org/apache/poi/xssf/usermodel/XSSFCell.html#setCellComment(org.apache.poi.ss.usermodel.Comment)">setCellComment</A></B>(<A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel">Comment</A>&nbsp;comment)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Assign a comment to this cell.</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/poi/ss/usermodel/Comment.html" title="interface in org.apache.poi.ss.usermodel"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/apache/poi/ss/usermodel/\class-useComment.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="Comment.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <i>Copyright 2010 The Apache Software Foundation or its licensors, as applicable.</i> </BODY> </HTML>
nimbleapps/export_to_spreadsheet
lib/apache-poi/docs/apidocs/org/apache/poi/ss/usermodel/class-use/Comment.html
HTML
mit
15,959
import { h } from 'omi'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon(h("path", { d: "M5 20v2h5v2l3-3-3-3v2zm9 0h5v2h-5zm3-20H7C5.9 0 5 .9 5 2v14c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zm0 16H7V2h10v14zm-5-9c1.1 0 2-.9 1.99-2 0-1.1-.9-2-2-2S10 3.9 10 5s.89 2 2 2z" }), 'CameraRearOutlined');
AlloyTeam/Nuclear
components/icon/esm/camera-rear-outlined.js
JavaScript
mit
337
package gpg import "context" type contextKey int const ( ctxKeyAlwaysTrust contextKey = iota ctxKeyUseCache ) // WithAlwaysTrust will return a context with the flag for always trust set. func WithAlwaysTrust(ctx context.Context, at bool) context.Context { return context.WithValue(ctx, ctxKeyAlwaysTrust, at) } // IsAlwaysTrust will return the value of the always trust flag or the default // (false). func IsAlwaysTrust(ctx context.Context) bool { bv, ok := ctx.Value(ctxKeyAlwaysTrust).(bool) if !ok { return false } return bv } // WithUseCache returns a context with the value of NoCache set. func WithUseCache(ctx context.Context, nc bool) context.Context { return context.WithValue(ctx, ctxKeyUseCache, nc) } // UseCache returns true if this request should ignore the cache. func UseCache(ctx context.Context) bool { nc, ok := ctx.Value(ctxKeyUseCache).(bool) if !ok { return false } return nc }
gopasspw/gopass
internal/backend/crypto/gpg/context.go
GO
mit
924
// // JSTBridge.h // jstalk // // Created by August Mueller on 9/23/10. // Copyright 2010 Flying Meat Inc. All rights reserved. // #import <Cocoa/Cocoa.h> #import <JavaScriptCore/JavaScriptCore.h> #import "JSTBridgeSupportLoader.h" #import <objc/runtime.h> #import <objc/message.h> #import <sys/mman.h> #import <assert.h> #import <dlfcn.h> @class JSTFunction; @interface JSTBridge : NSObject { JSGlobalContextRef _jsContext; JSClassRef _globalObjectClass; JSClassRef _bridgedObjectClass; JSClassRef _bridgedFunctionClass; JSTFunction *_jstMsgSendFunction; JSObjectRef _jstMsgSendJSFunctionRef; id _delegate; } @property (assign) id delegate; @property (assign) JSGlobalContextRef jsContext; - (void)pushObject:(id)obj withName:(NSString*)name; - (JSValueRef)evalJSString:(NSString*)script withPath:(NSString*)path; - (id)NSObjectForJSObject:(JSObjectRef)jsObj; - (JSTRuntimeInfo*)runtimeInfoForObject:(id)obj; - (JSObjectRef)makeJSObjectWithNSObject:(id)obj runtimeInfo:(JSTRuntimeInfo*)info; - (JSClassRef)bridgedObjectClass; @end @interface NSObject (JSTDelegate) - (void)bridge:(JSTBridge*)bridge hadError:(NSString*)error onLineNumber:(NSInteger)lineNumber atSourcePath:(id)url; @end
ccgus/jstalk
experimental/src/JSTBridge.h
C
mit
1,243
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> <title>kuma test</title> </head> <body> <h1>kuma test</h1> <button type="button" onclick="testWebSocket()">test WebSocket</button> &nbsp;&nbsp;&nbsp;&nbsp; <button type="button" onclick="testHttp()">test HTTP</button> <br><br> <label id="status"></label> <script type='text/javascript' src='./scripts/kuma.js'></script> <script type='text/javascript' src='./scripts/ws-test.js'></script> <script type='text/javascript' src='./scripts/http-test.js'></script> <script type="text/javascript"> function testProgress(bytesReceived, completed) { var str = '' + bytesReceived + ' bytes received'; if (completed) { str += ', test completed'; } document.getElementById('status').innerHTML = str; } function testWebSocket() { var url = ""; if (location.protocol == "https:") { url += "wss://"; } else { url += "ws://"; } url += location.hostname; if (location.port) { url += ":" + location.port; } url += "/"; kuma.testWebSocket(url, testProgress); } function testHttp() { var url = location.protocol + "//" + location.hostname; if (location.port) { url += ":" + location.port; } url += "/testdata"; kuma.testHttp(url, testProgress); } </script> </body> </html>
Jamol/kuma
test/www/index.html
HTML
mit
1,775
using System; using System.Runtime.InteropServices; using EnvDTE; namespace ManuelNaujoks.VSChat { [Guid("173cbcde-e728-442c-82ee-1c29ae3e00af")] public class MyToolWindow : SolutionAwareToolWindowPane { public MyToolWindow() { Caption = Resources.ToolWindowTitle; BitmapResourceID = 301; BitmapIndex = 1; base.Content = new MyControl { GetRelativeCodePosition = MakeRelativeCodePosition, GoToFileAndLine = GoToFileAndLine }; } protected override void OnClose() { var chat = (MyControl)base.Content; chat.Closing(); base.OnClose(); } private void MakeRelativeCodePosition(Action<RelativeCodePosition> callback) { try { var activeDocument = MasterObjekt.ActiveDocument; if (activeDocument != null) { var selection = (TextSelection)activeDocument.Selection; if (selection != null) { if (RawSolution != null) { callback(new RelativeCodePosition(solutionFile: RawSolution.FileName, file: activeDocument.FullName, line: selection.AnchorPoint.Line)); } } } } catch (Exception) { } } private void GoToFileAndLine(string shortcut) { if (RawSolution != null) { var relativeCodePosition = new RelativeCodePosition(solutionFile: RawSolution.FileName, shortcut: shortcut); MasterObjekt.ItemOperations.OpenFile(relativeCodePosition.File, Constants.vsViewKindTextView); var activeDocument = MasterObjekt.ActiveDocument; if (activeDocument != null) { var selection = (TextSelection)activeDocument.Selection; if (selection != null) { selection.GotoLine(relativeCodePosition.Line); } } } } } }
halllo/ManuelsChat
VSChat/MyToolWindow.cs
C#
mit
1,689
'use strict'; module.exports = function(config) { config.set({ basePath: '', frameworks: ['jasmine'], files: [ // bower:js 'public/components/jquery/dist/jquery.js', 'public/components/angular/angular.js', 'public/components/bootstrap/dist/js/bootstrap.js', 'public/components/angular-route/angular-route.js', 'public/components/angular-bootstrap/ui-bootstrap-tpls.js', 'public/components/angular-sanitize/angular-sanitize.js', 'public/components/marked/lib/marked.js', 'public/components/angular-marked/dist/angular-marked.js', 'public/components/highlightjs/highlight.pack.js', 'public/components/angular-clipboard/angular-clipboard.js', 'public/components/angular-toastr/dist/angular-toastr.tpls.js', 'public/components/angular-animate/angular-animate.js', 'public/components/jquery-ui/jquery-ui.js', 'public/components/angular-ui-sortable/sortable.js', 'public/components/ngstorage/ngStorage.js', // endbower 'public/components/angular-mocks/angular-mocks.js', 'public/*.js', 'public/controllers/*.js', 'public/services/*.js', 'public/directives/*.js', 'test/client/*Spec.js' ], exclude: [ ], preprocessors: { }, reporters: ['progress'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: false, browsers: ['PhantomJS'], singleRun: false, concurrency: Infinity }); };
us10096698/spmemo
karma.conf.js
JavaScript
mit
1,492
'use strict'; /** * controller for angular-ladda * An angular directive wrapper for Ladda buttons. */ angular.module('core').controller('LaddaCtrl', ["$scope", "$timeout", function ($scope, $timeout) { $scope.ldloading = {}; $scope.clickBtn = function (style) { $scope.ldloading[style.replace('-', '_')] = true; $timeout(function () { $scope.ldloading[style.replace('-', '_')] = false; }, 2000); }; $scope.clickProgressBtn = function (style) { $scope.ldloading[style.replace('-', '_') + "_progress"] = true; $timeout(function () { $scope.ldloading[style.replace('-', '_') + "_progress"] = 0.1; }, 500); $timeout(function () { $scope.ldloading[style.replace('-', '_') + "_progress"] += 0.1; }, 1000); $timeout(function () { $scope.ldloading[style.replace('-', '_') + "_progress"] += 0.1; }, 1500); $timeout(function () { $scope.ldloading[style.replace('-', '_') + "_progress"] = false; }, 2000); }; }]);
mchammabc/sites
public/modules/core/controllers/laddaCtrl.js
JavaScript
mit
1,099
from distutils.core import setup, Extension setup( name="tentacle_pi.TSL2561", version="1.0", packages = ["tentacle_pi"], ext_modules = [ Extension("tentacle_pi.TSL2561", sources = ["src/tsl2561.c", "src/tsl2561_ext.c"]) ] )
lexruee/tsl2561
setup.py
Python
mit
237
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title> Tag → k8s | recall&#39;s blog </title> <meta name="author" content="recall704" /> <meta name="description" content="" /> <meta name="twitter:card" content="summary" /> <meta name="twitter:site" content="@gohugoio" /> <meta name="twitter:title" content="recall&#39;s blog" /> <meta name="twitter:description" content="" /> <meta name="twitter:image" content="http://www.recall704.com/img/avatar.jpg" /> <meta property="og:type" content="website" /> <meta property="og:title" content="recall&#39;s blog" /> <meta property="og:description" content="" /> <meta property="og:url" content="http://www.recall704.com/tags/k8s/" /> <meta property="og:image" content="http://www.recall704.com/img/avatar.jpg" /> <meta name="generator" content="Hugo 0.54.0" /> <link rel="canonical" href="http://www.recall704.com/tags/k8s/" /> <link rel="alternate" type="application/rss+xml" href="http://www.recall704.com/tags/k8s/index.xml" title="Recall's blog" /> <meta name="renderer" content="webkit" /> <meta name="viewport" content="width=device-width,initial-scale=1" /> <meta name="format-detection" content="telephone=no,email=no,adress=no" /> <meta http-equiv="Cache-Control" content="no-transform" /> <meta name="robots" content="index,follow" /> <meta name="referrer" content="origin-when-cross-origin" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> <meta name="apple-mobile-web-app-title" content="Recall&#39;s blog" /> <meta name="msapplication-tooltip" content="Recall&#39;s blog" /> <meta name='msapplication-navbutton-color' content="#5fbf5e" /> <meta name="msapplication-TileColor" content="#5fbf5e" /> <meta name="msapplication-TileImage" content="/img/tile-image-windows.png" /> <link rel="icon" href="http://www.recall704.com/img/bio.jpg" /> <link rel="icon" type="image/png" sizes="16x16" href="http://www.recall704.com/img/favicon-16x16.png" /> <link rel="icon" type="image/png" sizes="32x32" href="http://www.recall704.com/img/favicon-32x32.png" /> <link rel="icon" sizes="192x192" href="http://www.recall704.com/img/touch-icon-android.png" /> <link rel="apple-touch-icon" href="http://www.recall704.com/img/touch-icon-apple.png" /> <link rel="mask-icon" href="http://www.recall704.com/img/safari-pinned-tab.svg" color="#5fbf5e" /> <link rel="stylesheet" href="//cdn.bootcss.com/video.js/6.2.8/alt/video-js-cdn.min.css" /> <link rel="stylesheet" href="http://www.recall704.com/css/bundle.6271cf88a8.css" /> <!--[if lt IE 9]> <script src="//cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> <script src="//cdn.bootcss.com/video.js/6.2.8/ie8/videojs-ie8.min.js"></script> <![endif]--> <!--[if lte IE 11]> <script src="//cdn.bootcss.com/classlist/1.1.20170427/classList.min.js"></script> <![endif]--> <script src="//cdn.bootcss.com/object-fit-images/3.2.3/ofi.min.js"></script> <script src="//cdn.bootcss.com/smooth-scroll/12.1.4/js/smooth-scroll.polyfills.min.js"></script> </head> <body> <div class="suspension"> <a title="Go to top" class="to-top is-hide"><span class="icon icon-up"></span></a> </div> <header class="site-header"> <img class="avatar" src="http://www.recall704.com/img/bio.jpg" alt="Avatar"> <h2 class="title">Recall&#39;s blog</h2> <p class="subtitle">学无先后,达者为师</p> <button class="menu-toggle" type="button"> <span class="icon icon-menu"></span> </button> <nav class="site-menu collapsed"> <h2 class="offscreen">Main Menu</h2> <ul class="menu-list"> <li class="menu-item "> <a href="http://www.recall704.com/">Home</a> </li> <li class="menu-item "> <a href="http://www.recall704.com/tags/">Tags</a> </li> <li class="menu-item "> <a href="http://www.recall704.com/categories/">Categories</a> </li> <li class="menu-item "> <a href="http://www.recall704.com/series/">series</a> </li> <li class="menu-item "> <a href="http://www.recall704.com/links/">友情链接</a> </li> <li class="menu-item "> <a href="http://www.recall704.com/about/">初恋</a> </li> </ul> </nav> <nav class="social-menu collapsed"> <h2 class="offscreen">Social Networks</h2> <ul class="social-list"> <li class="social-item"> <a href="mailto:tk657309822@gmail.com" title="Email"><span class="icon icon-email"></span></a> </li> <li class="social-item"> <a href="//github.com/recall704" title="GitHub"><span class="icon icon-github"></span></a> </li> <li class="social-item"> <a href="http://www.recall704.com/img/vx.png" title="Wechat"><span class="icon icon-wechat"></span></a> </li> <li class="social-item"> <a rel="alternate" type="application/rss+xml" href="http://www.recall704.com/index.xml"><span class="icon icon-rss" title="RSS"></span></a> </li> </ul> </nav> </header> <section class="main post-list"> <header class="list-header offscreen"> <h2 class="list-label">Posts List</h2> </header> <article class="post-entry"> <header class="post-header"> <h3 class="post-title"><a href="http://www.recall704.com/cloud/k8s-authentication-with-token/" class="post-link">创建 client (一): token 方式访问 k8s API</a></h3> <p class="post-meta">@recall704 · Apr 11, 2018 · 2 min read</p> </header> <p class="post-summary">0x1 概述 k8s 提供了三种认证方式访问 API Server,分别是: 1. ca 认证 k8s 的各个组件,比如 kubelet, kube-proxy 和 API Server 进行通信的时候,一般都是使用证书的形式,配置在 kubeconfig 文件中。 2. token 认证 rook (https://github.com/rook/rook) 、dashboard (https://github.com/kubernetes/dashboard) 这些应用,跑在 k8s 集群内,而且需要访问 k8s 的资源, 运行的时候需要指定 ServiceAccount ,ServiceAccount 又配置了指定的角色和权限。 3. http basic 认证 使用用户名和密码访问 k8s,稍后会有新的文章详细介绍。 0x2 token 认证详解 像 rook、dashboard 这样的应用,它是怎样通过 ServiceAccount 和 k8s API Server 进行通信的呢? 和 k8s API Server 通信需要创建 client, 而创建 client 需要对应的 配置信息(包含了 API Server 的地址和端口,以及认证信息) 我们在 rook 的代码中,可以看到下面这样类似的代码</p> <footer class="post-footer"> <a class="read-more" href="http://www.recall704.com/cloud/k8s-authentication-with-token/">Read More →</a> </footer> </article> <article class="post-entry"> <header class="post-header"> <h3 class="post-title"><a href="http://www.recall704.com/cloud/k8s-node-roles/" class="post-link">k8s 中 node 的 roles</a></h3> <p class="post-meta">@recall704 · Mar 14, 2018 · 1 min read</p> </header> <p class="post-summary">部署 k8s 之后,get nodes 可能会发现 node 上有个 ROLES 但是执行命令: kubectl get nodes 192.168.88.201 -o yaml 在里面却没有发现有 ROLES 这样的字段? 那我们如果要给 node 添加对应的 ROLE 到底要怎么做呢? 通过代码,我们可以知道,k8s 把 label node-role.kubernetes.io/&lt;role&gt;=&#34;&#34; 和 kubernetes.io/role=&#34;&lt;role&gt;&#34; 来定义角色。 所以 master 可以这样 kubectl label node 192.168.88.201 node-role.kubernetes.io/master=true 或者 kubectl label node 192.168.88.201 kubernetes.io/role=master </p> <footer class="post-footer"> <a class="read-more" href="http://www.recall704.com/cloud/k8s-node-roles/">Read More →</a> </footer> </article> <article class="post-entry"> <header class="post-header"> <h3 class="post-title"><a href="http://www.recall704.com/cloud/taint-and-toleration/" class="post-link">k8s 中的污染 Taint 与容忍 Toleration</a></h3> <p class="post-meta">@recall704 · Mar 11, 2018 · 2 min read</p> </header> <p class="post-summary">之前的内部分享中我提到过,pod 最终会被调度到某个具体的 node 上运行。那么有没有某种方式,限制 pod,不让它在某些 node 上运行呢? 或者说,只允许某些 pod 在某些 node 上运行呢? taint 和 toleration 了解一下。 一、 taint (污染) 首先一点,taint 是针对 node 而言的,给 node 增加 taint 的命令如下 kubectl taint nodes node1 aaa=bbb:NoSchedule 其中: 1. aaa 代表 taint 的 key 2. bbb 代表 taint 的 value 3. NoSchedule 代码这个 taint 对应的影响,它可以有三个值 值 含义 NoSchedule 不允许新的 pod 调度到该 node 上,除非 toleration 条件满足;不影响已经运行在该 node 上的 pod PreferNoSchedule 尽可能不要调度到该 node 上,除非 toleration 条件满足;不影响已经运行在该 node 上的 pod NoExecute 驱逐该节点上的 pod 到其它节点,除了 toleration 条件满足的 pod;影响已经运行在该 node 上的所有 pod 我们了解到一点,那就是增加了 taint 的 node,pod 就不会调度到它上面运行了。</p> <footer class="post-footer"> <a class="read-more" href="http://www.recall704.com/cloud/taint-and-toleration/">Read More →</a> </footer> </article> <footer class="list-footer"> <nav class="pagination"> <h3 class="offscreen">Pagination</h3> <a class="pagination-previous" href="http://www.recall704.com/tags/k8s/">← Newer Posts</a> </nav> </footer> </section> <footer class="site-footer"> <p>© 2017-2020 Recall&#39;s blog</p> <p>Powered by <a href="https://gohugo.io/" target="_blank">Hugo</a> with theme <a href="https://github.com/laozhu/hugo-nuo" target="_blank">Nuo</a>.</p> </footer> <script async src="//cdn.bootcss.com/video.js/6.2.8/alt/video.novtt.min.js"></script> <script async src="//cdn.bootcss.com/mathjax/2.7.2/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ['\\(','\\)']], displayMath: [['$$','$$'], ['\\[','\\]']], processEscapes: true, processEnvironments: true, skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'], TeX: { equationNumbers: { autoNumber: "AMS" }, extensions: ["AMSmath.js", "AMSsymbols.js"] } } }); </script> <script type="text/x-mathjax-config"> // Fix <code> tags after MathJax finishes running. This is a // hack to overcome a shortcoming of Markdown. Discussion at // https://github.com/mojombo/jekyll/issues/199 MathJax.Hub.Queue(() => { MathJax.Hub.getAllJax().map(v => v.SourceElement().parentNode.className += ' has-jax'); }); </script> <script src="http://www.recall704.com/js/bundle.fb61ec41f8.js"></script> </body> </html>
recall704/recall704.github.io
tags/k8s/page/2/index.html
HTML
mit
11,766
// --------------------------------------------------------------------------------- // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // // The MIT License (MIT) // // 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. // --------------------------------------------------------------------------------- #pragma once #ifndef CONFIGURATION_H_ #define CONFIGURATION_H_ #include <ctime> #include <sstream> #include <iomanip> #include <locale> #include <string> #include <vector> #include "arduino.h" #include "rapidxml.hpp" #include "rapidxml_utils.hpp" class Configuration { public: typedef struct { std::wstring measure_name; std::wstring unit_of_measure; std::string sensor; } sensor_settings_t; typedef std::vector<sensor_settings_t> SensorsSettings; Configuration(); virtual ~Configuration(); void load(std::string const &filepath); std::string const &host() const; std::string const &user() const; std::string const &password() const; std::string const &eventHubName() const; std::string const &deviceName() const; std::wstring const &deviceNameW() const; std::string const &subject() const; std::wstring const &subjectW() const; std::wstring const &guid() const; std::wstring const &location() const; std::wstring const &organization() const; bool amqpMessageTracking() const; SensorsSettings const &sensors() const; std::wstring getTimeNow() const; private: std::string m_conv_buffer; std::string m_host; std::string m_user; std::string m_password; std::string m_event_hub_name; std::string m_device_name; std::wstring m_device_nameW; std::string m_subject; std::wstring m_subjectW; std::wstring m_guid; std::wstring m_location; std::wstring m_organization; bool m_amqp_message_tracking; SensorsSettings m_sensors; void _parseAppSettings(char* key, char* value); void _parseSensorSettings(char* key, char* value, sensor_settings_t& settings); }; #endif // CONFIGURATION_H_
ScruffyFurn/IotKit
Weather Demo/ConnectTheDotsGalileo/Configuration.h
C
mit
2,998
import React, {PureComponent} from "react"; import "./fill-view.css"; export class FillView extends PureComponent { divRef = null; state = { scale: 1.0 }; setDivRef = (ref) => { this.divRef = ref; }; componentDidMount() { const {percentMargin = 6} = this.props; const adjust = (100 - percentMargin) * 0.01; const {width: contentWidth, height: contentHeight} = this.divRef.getBoundingClientRect(); const {width: parentWidth, height: parentHeight} = this.divRef.parentNode.parentNode.getBoundingClientRect(); const availableWidth = parentWidth * adjust; const availableHeight = parentHeight * adjust; const scale = Math.min(availableWidth / contentWidth, availableHeight / contentHeight); this.setState(() => ({ scale })); } render() { const {children} = this.props; const {scale} = this.state; const contentProps = { ref: this.setDivRef, style: { transform: `scale(${scale})`, } }; return ( <div className="fill-view"> <div {...contentProps}> {children} </div> </div> ) } }
dfbaskin/react-higher-order-components
packages/presentation/src/shared/fill-view.js
JavaScript
mit
1,272
// // BMScreenshotEventManager.h // Pods // // Created by XHY on 2017/5/12. // // #import <Foundation/Foundation.h> @interface BMScreenshotEventManager : NSObject + (instancetype)shareInstance; /* 获取截屏的图片 */ - (UIImage *)snapshotImage; /** 开启监听截屏事件 */ - (void)monitorScreenshotEvent; @end
xiaohuapunk/Benmu-iOS-Library
Source/BMManager/ScreenshotNotification/BMScreenshotEventManager.h
C
mit
330
# Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. # [5.0.0-pre.17](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.16...v5.0.0-pre.17) (2022-02-15) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-pre.16](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.15...v5.0.0-pre.16) (2022-01-12) ### Features * **express, koa:** make transports similar ([#2486](https://github.com/feathersjs/feathers/issues/2486)) ([26aa937](https://github.com/feathersjs/feathers/commit/26aa937c114fb8596dfefc599b1f53cead69c159)) # [5.0.0-pre.15](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.14...v5.0.0-pre.15) (2021-11-27) ### Bug Fixes * **typescript:** Overall typing improvements ([#2478](https://github.com/feathersjs/feathers/issues/2478)) ([b8eb804](https://github.com/feathersjs/feathers/commit/b8eb804158556d9651a8607e3c3fda15e0bfd110)) ### Features * **authentication-oauth:** Allow dynamic oAuth redirect ([#2469](https://github.com/feathersjs/feathers/issues/2469)) ([b7143d4](https://github.com/feathersjs/feathers/commit/b7143d4c0fbe961e714f79512be04449b9bbd7d9)) # [5.0.0-pre.14](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.13...v5.0.0-pre.14) (2021-10-13) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-pre.13](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.12...v5.0.0-pre.13) (2021-10-13) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-pre.12](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.11...v5.0.0-pre.12) (2021-10-12) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-pre.11](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.10...v5.0.0-pre.11) (2021-10-06) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-pre.10](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.9...v5.0.0-pre.10) (2021-09-19) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-pre.9](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.8...v5.0.0-pre.9) (2021-08-09) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-pre.8](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.7...v5.0.0-pre.8) (2021-08-09) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-pre.7](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.6...v5.0.0-pre.7) (2021-08-09) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-pre.6](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.5...v5.0.0-pre.6) (2021-08-08) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-pre.5](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.4...v5.0.0-pre.5) (2021-06-23) ### Bug Fixes * **hooks:** Migrate built-in hooks and allow backwards compatibility ([#2358](https://github.com/feathersjs/feathers/issues/2358)) ([759c5a1](https://github.com/feathersjs/feathers/commit/759c5a19327a731af965c3604119393b3d09a406)) * **koa:** Use extended query parser for compatibility ([#2397](https://github.com/feathersjs/feathers/issues/2397)) ([b2944ba](https://github.com/feathersjs/feathers/commit/b2944bac3ec6d5ecc80dc518cd4e58093692db74)) ### Features * **adapter-commons:** Add support for params.adapter option and move memory adapter to @feathersjs/memory ([#2367](https://github.com/feathersjs/feathers/issues/2367)) ([a43e7da](https://github.com/feathersjs/feathers/commit/a43e7da22b6b981a96d1321736ea9a0cb924fb4f)) # [5.0.0-pre.4](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.3...v5.0.0-pre.4) (2021-05-13) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-pre.3](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.2...v5.0.0-pre.3) (2021-04-21) ### Bug Fixes * **typescript:** Improve TypeScript backwards compatibility ([#2310](https://github.com/feathersjs/feathers/issues/2310)) ([f33be73](https://github.com/feathersjs/feathers/commit/f33be73fc46a533efb15df9aab0658e3240d3897)) ### Features * **dependencies:** Remove direct debug dependency ([#2296](https://github.com/feathersjs/feathers/issues/2296)) ([501d416](https://github.com/feathersjs/feathers/commit/501d4164d30c6a126906dc640cdfdc82207ba34a)) # [5.0.0-pre.2](https://github.com/feathersjs/feathers/compare/v5.0.0-beta.1...v5.0.0-pre.2) (2021-04-06) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-beta.1](https://github.com/feathersjs/feathers/compare/v5.0.0-beta.0...v5.0.0-beta.1) (2021-04-03) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-beta.0](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.1...v5.0.0-beta.0) (2021-03-28) ### Bug Fixes * Update Grant usage and other dependencies ([#2264](https://github.com/feathersjs/feathers/issues/2264)) ([7b0f8fa](https://github.com/feathersjs/feathers/commit/7b0f8fad252419ed0ad0bf259cdf3104d322ab60)) ### Features * Application service types default to any ([#1566](https://github.com/feathersjs/feathers/issues/1566)) ([d93ba9a](https://github.com/feathersjs/feathers/commit/d93ba9a17edd20d3397bb00f4f6e82e804e42ed6)) * Feathers v5 core refactoring and features ([#2255](https://github.com/feathersjs/feathers/issues/2255)) ([2dafb7c](https://github.com/feathersjs/feathers/commit/2dafb7ce14ba57406aeec13d10ca45b1e709bee9)) # [5.0.0-pre.1](https://github.com/feathersjs/feathers/compare/v4.5.11...v5.0.0-pre.1) (2020-12-17) # [5.0.0-pre.0](https://github.com/feathersjs/feathers/compare/v4.5.4...v5.0.0-pre.0) (2020-05-19) **Note:** Version bump only for package @feathersjs/authentication # [5.0.0-pre.0](https://github.com/feathersjs/feathers/compare/v4.5.4...v5.0.0-pre.0) (2020-05-19) ## [4.5.11](https://github.com/feathersjs/feathers/compare/v4.5.10...v4.5.11) (2020-12-05) **Note:** Version bump only for package @feathersjs/authentication ## [4.5.10](https://github.com/feathersjs/feathers/compare/v4.5.9...v4.5.10) (2020-11-08) ### Bug Fixes * **authentication:** consistent response return between local and jwt strategy ([#2042](https://github.com/feathersjs/feathers/issues/2042)) ([8d25be1](https://github.com/feathersjs/feathers/commit/8d25be101a2593a9e789375c928a07780b9e28cf)) ## [4.5.9](https://github.com/feathersjs/feathers/compare/v4.5.8...v4.5.9) (2020-10-09) **Note:** Version bump only for package @feathersjs/authentication ## [4.5.8](https://github.com/feathersjs/feathers/compare/v4.5.7...v4.5.8) (2020-08-12) **Note:** Version bump only for package @feathersjs/authentication ## [4.5.7](https://github.com/feathersjs/feathers/compare/v4.5.6...v4.5.7) (2020-07-24) ### Bug Fixes * **authentication:** Add JWT getEntityQuery ([#2013](https://github.com/feathersjs/feathers/issues/2013)) ([e0e7fb5](https://github.com/feathersjs/feathers/commit/e0e7fb5162940fe776731283b40026c61d9c8a33)) ## [4.5.6](https://github.com/feathersjs/feathers/compare/v4.5.5...v4.5.6) (2020-07-12) ### Bug Fixes * **authentication:** Omit query in JWT strategy ([#2011](https://github.com/feathersjs/feathers/issues/2011)) ([04ce7e9](https://github.com/feathersjs/feathers/commit/04ce7e98515fe9d495cd0e83e0da097e9bcd7382)) ## [4.5.5](https://github.com/feathersjs/feathers/compare/v4.5.4...v4.5.5) (2020-07-11) ### Bug Fixes * **authentication:** Include query params when authenticating via authenticate hook [#2009](https://github.com/feathersjs/feathers/issues/2009) ([4cdb7bf](https://github.com/feathersjs/feathers/commit/4cdb7bf2898385ddac7a1692bc9ac2f6cf5ad446)) ## [4.5.3](https://github.com/feathersjs/feathers/compare/v4.5.2...v4.5.3) (2020-04-17) ### Bug Fixes * **authentication:** Remove entity from connection information on logout ([#1889](https://github.com/feathersjs/feathers/issues/1889)) ([b062753](https://github.com/feathersjs/feathers/commit/b0627530d61babe15dd84369d3093ccae4b780ca)) ## [4.5.2](https://github.com/feathersjs/feathers/compare/v4.5.1...v4.5.2) (2020-03-04) ### Bug Fixes * **authentication:** Improve JWT strategy configuration error message ([#1844](https://github.com/feathersjs/feathers/issues/1844)) ([2c771db](https://github.com/feathersjs/feathers/commit/2c771dbb22d53d4f7de3c3f514e57afa1a186322)) ## [4.5.1](https://github.com/feathersjs/feathers/compare/v4.5.0...v4.5.1) (2020-01-24) **Note:** Version bump only for package @feathersjs/authentication # [4.5.0](https://github.com/feathersjs/feathers/compare/v4.4.3...v4.5.0) (2020-01-18) ### Bug Fixes * Add `params.authentication` type, remove `hook.connection` type ([#1732](https://github.com/feathersjs/feathers/issues/1732)) ([d46b7b2](https://github.com/feathersjs/feathers/commit/d46b7b2abac8862c0e4dbfce20d71b8b8a96692f)) ## [4.4.3](https://github.com/feathersjs/feathers/compare/v4.4.1...v4.4.3) (2019-12-06) **Note:** Version bump only for package @feathersjs/authentication ## [4.4.1](https://github.com/feathersjs/feathers/compare/v4.4.0...v4.4.1) (2019-11-27) **Note:** Version bump only for package @feathersjs/authentication # [4.4.0](https://github.com/feathersjs/feathers/compare/v4.3.11...v4.4.0) (2019-11-27) **Note:** Version bump only for package @feathersjs/authentication ## [4.3.11](https://github.com/feathersjs/feathers/compare/v4.3.10...v4.3.11) (2019-11-11) ### Bug Fixes * **authentication:** Retain object references in authenticate hook ([#1675](https://github.com/feathersjs/feathers/issues/1675)) ([e1939be](https://github.com/feathersjs/feathers/commit/e1939be19d4e79d3f5e2fe69ba894a11c627ae99)) ## [4.3.10](https://github.com/feathersjs/feathers/compare/v4.3.9...v4.3.10) (2019-10-26) **Note:** Version bump only for package @feathersjs/authentication ## [4.3.9](https://github.com/feathersjs/feathers/compare/v4.3.8...v4.3.9) (2019-10-26) ### Bug Fixes * Add jsonwebtoken TypeScript type dependency ([317c80a](https://github.com/feathersjs/feathers/commit/317c80a9205e8853bb830a12c3aa1a19e95f9abc)) * Small type improvements ([#1624](https://github.com/feathersjs/feathers/issues/1624)) ([50162c6](https://github.com/feathersjs/feathers/commit/50162c6e562f0a47c6a280c4f01fff7c3afee293)) ## [4.3.7](https://github.com/feathersjs/feathers/compare/v4.3.6...v4.3.7) (2019-10-14) **Note:** Version bump only for package @feathersjs/authentication ## [4.3.5](https://github.com/feathersjs/feathers/compare/v4.3.4...v4.3.5) (2019-10-07) ### Bug Fixes * Authentication type improvements and timeout fix ([#1605](https://github.com/feathersjs/feathers/issues/1605)) ([19854d3](https://github.com/feathersjs/feathers/commit/19854d3)) * Improve error message when authentication strategy is not allowed ([#1600](https://github.com/feathersjs/feathers/issues/1600)) ([317a312](https://github.com/feathersjs/feathers/commit/317a312)) ## [4.3.4](https://github.com/feathersjs/feathers/compare/v4.3.3...v4.3.4) (2019-10-03) **Note:** Version bump only for package @feathersjs/authentication ## [4.3.3](https://github.com/feathersjs/feathers/compare/v4.3.2...v4.3.3) (2019-09-21) ### Bug Fixes * check for undefined access token ([#1571](https://github.com/feathersjs/feathers/issues/1571)) ([976369d](https://github.com/feathersjs/feathers/commit/976369d)) * Small improvements in dependencies and code sturcture ([#1562](https://github.com/feathersjs/feathers/issues/1562)) ([42c13e2](https://github.com/feathersjs/feathers/commit/42c13e2)) ## [4.3.2](https://github.com/feathersjs/feathers/compare/v4.3.1...v4.3.2) (2019-09-16) **Note:** Version bump only for package @feathersjs/authentication ## [4.3.1](https://github.com/feathersjs/feathers/compare/v4.3.0...v4.3.1) (2019-09-09) ### Bug Fixes * Use long-timeout for JWT expiration timers ([#1552](https://github.com/feathersjs/feathers/issues/1552)) ([65637ec](https://github.com/feathersjs/feathers/commit/65637ec)) # [4.3.0](https://github.com/feathersjs/feathers/compare/v4.3.0-pre.4...v4.3.0) (2019-08-27) **Note:** Version bump only for package @feathersjs/authentication # [4.3.0-pre.4](https://github.com/feathersjs/feathers/compare/v4.3.0-pre.3...v4.3.0-pre.4) (2019-08-22) ### Bug Fixes * Fix auth publisher mistake ([08bad61](https://github.com/feathersjs/feathers/commit/08bad61)) # [4.3.0-pre.3](https://github.com/feathersjs/feathers/compare/v4.3.0-pre.2...v4.3.0-pre.3) (2019-08-19) ### Bug Fixes * Expire and remove authenticated real-time connections ([#1512](https://github.com/feathersjs/feathers/issues/1512)) ([2707c33](https://github.com/feathersjs/feathers/commit/2707c33)) * Update all dependencies ([7d53a00](https://github.com/feathersjs/feathers/commit/7d53a00)) ### Features * Let strategies handle the connection ([#1510](https://github.com/feathersjs/feathers/issues/1510)) ([4329feb](https://github.com/feathersjs/feathers/commit/4329feb)) # [4.3.0-pre.2](https://github.com/feathersjs/feathers/compare/v4.3.0-pre.1...v4.3.0-pre.2) (2019-08-02) ### Bug Fixes * Add getEntityId to JWT strategy and fix legacy Socket authentication ([#1488](https://github.com/feathersjs/feathers/issues/1488)) ([9a3b324](https://github.com/feathersjs/feathers/commit/9a3b324)) * Add method to reliably get default authentication service ([#1470](https://github.com/feathersjs/feathers/issues/1470)) ([e542cb3](https://github.com/feathersjs/feathers/commit/e542cb3)) # [4.3.0-pre.1](https://github.com/feathersjs/feathers/compare/v4.0.0-pre.5...v4.3.0-pre.1) (2019-07-11) **Note:** Version bump only for package @feathersjs/authentication # [4.0.0-pre.5](https://github.com/feathersjs/feathers/compare/v4.0.0-pre.4...v4.0.0-pre.5) (2019-07-10) **Note:** Version bump only for package @feathersjs/authentication # [4.0.0-pre.4](https://github.com/feathersjs/feathers/compare/v4.0.0-pre.3...v4.0.0-pre.4) (2019-07-05) ### Bug Fixes * Updated typings for ServiceMethods ([#1409](https://github.com/feathersjs/feathers/issues/1409)) ([b5ee7e2](https://github.com/feathersjs/feathers/commit/b5ee7e2)) # [4.0.0-pre.3](https://github.com/feathersjs/feathers/compare/v4.0.0-pre.2...v4.0.0-pre.3) (2019-06-01) ### Bug Fixes * Make oAuth paths more consistent and improve authentication client ([#1377](https://github.com/feathersjs/feathers/issues/1377)) ([adb2543](https://github.com/feathersjs/feathers/commit/adb2543)) * Set authenticated: true after successful authentication ([#1367](https://github.com/feathersjs/feathers/issues/1367)) ([9918cff](https://github.com/feathersjs/feathers/commit/9918cff)) * Typings fix and improvements. ([#1364](https://github.com/feathersjs/feathers/issues/1364)) ([515b916](https://github.com/feathersjs/feathers/commit/515b916)) * Update dependencies and fix tests ([#1373](https://github.com/feathersjs/feathers/issues/1373)) ([d743a7f](https://github.com/feathersjs/feathers/commit/d743a7f)) # [4.0.0-pre.2](https://github.com/feathersjs/feathers/compare/v4.0.0-pre.1...v4.0.0-pre.2) (2019-05-15) ### Bug Fixes * Throw NotAuthenticated on token verification errors ([#1357](https://github.com/feathersjs/feathers/issues/1357)) ([e0120df](https://github.com/feathersjs/feathers/commit/e0120df)) # [4.0.0-pre.1](https://github.com/feathersjs/feathers/compare/v4.0.0-pre.0...v4.0.0-pre.1) (2019-05-08) ### Bug Fixes * Always require strategy parameter in authentication ([#1327](https://github.com/feathersjs/feathers/issues/1327)) ([d4a8021](https://github.com/feathersjs/feathers/commit/d4a8021)) * Bring back params.authenticated ([#1317](https://github.com/feathersjs/feathers/issues/1317)) ([a0ffd5e](https://github.com/feathersjs/feathers/commit/a0ffd5e)) * Improve authentication parameter handling ([#1333](https://github.com/feathersjs/feathers/issues/1333)) ([6e77204](https://github.com/feathersjs/feathers/commit/6e77204)) * Merge httpStrategies and authStrategies option ([#1308](https://github.com/feathersjs/feathers/issues/1308)) ([afa4d55](https://github.com/feathersjs/feathers/commit/afa4d55)) * Rename jwtStrategies option to authStrategies ([#1305](https://github.com/feathersjs/feathers/issues/1305)) ([4aee151](https://github.com/feathersjs/feathers/commit/4aee151)) ### Features * Change and *JWT methods to *accessToken ([#1304](https://github.com/feathersjs/feathers/issues/1304)) ([5ac826b](https://github.com/feathersjs/feathers/commit/5ac826b)) # [4.0.0-pre.0](https://github.com/feathersjs/feathers/compare/v3.2.0-pre.1...v4.0.0-pre.0) (2019-04-21) ### Bug Fixes * Added path and method in to express request for passport ([#1112](https://github.com/feathersjs/feathers/issues/1112)) ([afa1cb4](https://github.com/feathersjs/feathers/commit/afa1cb4)) * Authentication core improvements ([#1260](https://github.com/feathersjs/feathers/issues/1260)) ([c5dc7a2](https://github.com/feathersjs/feathers/commit/c5dc7a2)) * Improve JWT authentication option handling ([#1261](https://github.com/feathersjs/feathers/issues/1261)) ([31b956b](https://github.com/feathersjs/feathers/commit/31b956b)) * Make Mocha a proper devDependency for every repository ([#1053](https://github.com/feathersjs/feathers/issues/1053)) ([9974803](https://github.com/feathersjs/feathers/commit/9974803)) * Only merge authenticated property on update ([8a564f7](https://github.com/feathersjs/feathers/commit/8a564f7)) * reduce authentication connection hook complexity and remove unnecessary checks ([fa94b2f](https://github.com/feathersjs/feathers/commit/fa94b2f)) * Update all dependencies to latest ([#1206](https://github.com/feathersjs/feathers/issues/1206)) ([e51e0f6](https://github.com/feathersjs/feathers/commit/e51e0f6)) * **authentication:** Fall back when req.app is not the application when emitting events ([#1185](https://github.com/feathersjs/feathers/issues/1185)) ([6a534f0](https://github.com/feathersjs/feathers/commit/6a534f0)) * Update adapter common tests ([#1135](https://github.com/feathersjs/feathers/issues/1135)) ([8166dda](https://github.com/feathersjs/feathers/commit/8166dda)) * **docs/new-features:** syntax highlighting ([#347](https://github.com/feathersjs/feathers/issues/347)) ([4ab7c95](https://github.com/feathersjs/feathers/commit/4ab7c95)) * **package:** update @feathersjs/commons to version 2.0.0 ([#692](https://github.com/feathersjs/feathers/issues/692)) ([ca665ab](https://github.com/feathersjs/feathers/commit/ca665ab)) * **package:** update debug to version 3.0.0 ([#555](https://github.com/feathersjs/feathers/issues/555)) ([f788804](https://github.com/feathersjs/feathers/commit/f788804)) * **package:** update jsonwebtoken to version 8.0.0 ([#567](https://github.com/feathersjs/feathers/issues/567)) ([6811626](https://github.com/feathersjs/feathers/commit/6811626)) * **package:** update ms to version 2.0.0 ([#509](https://github.com/feathersjs/feathers/issues/509)) ([7e4b0b6](https://github.com/feathersjs/feathers/commit/7e4b0b6)) * **package:** update passport to version 0.4.0 ([#558](https://github.com/feathersjs/feathers/issues/558)) ([dcb14a5](https://github.com/feathersjs/feathers/commit/dcb14a5)) ### Features * @feathersjs/authentication-oauth ([#1299](https://github.com/feathersjs/feathers/issues/1299)) ([656bae7](https://github.com/feathersjs/feathers/commit/656bae7)) * Add AuthenticationBaseStrategy and make authentication option handling more explicit ([#1284](https://github.com/feathersjs/feathers/issues/1284)) ([2667d92](https://github.com/feathersjs/feathers/commit/2667d92)) * Add TypeScript definitions ([#1275](https://github.com/feathersjs/feathers/issues/1275)) ([9dd6713](https://github.com/feathersjs/feathers/commit/9dd6713)) * Authentication v3 core server implementation ([#1205](https://github.com/feathersjs/feathers/issues/1205)) ([1bd7591](https://github.com/feathersjs/feathers/commit/1bd7591)) * Authentication v3 local authentication ([#1211](https://github.com/feathersjs/feathers/issues/1211)) ([0fa5f7c](https://github.com/feathersjs/feathers/commit/0fa5f7c)) * Remove (hook, next) signature and SKIP support ([#1269](https://github.com/feathersjs/feathers/issues/1269)) ([211c0f8](https://github.com/feathersjs/feathers/commit/211c0f8)) * Support params symbol to skip authenticate hook ([#1296](https://github.com/feathersjs/feathers/issues/1296)) ([d16cf4d](https://github.com/feathersjs/feathers/commit/d16cf4d)) ### BREAKING CHANGES * Update authentication strategies for @feathersjs/authentication v3 ## [2.1.16](https://github.com/feathersjs/feathers/compare/@feathersjs/authentication@2.1.15...@feathersjs/authentication@2.1.16) (2019-01-26) ### Bug Fixes * **authentication:** Fall back when req.app is not the application when emitting events ([#1185](https://github.com/feathersjs/feathers/issues/1185)) ([6a534f0](https://github.com/feathersjs/feathers/commit/6a534f0)) ## [2.1.15](https://github.com/feathersjs/feathers/compare/@feathersjs/authentication@2.1.14...@feathersjs/authentication@2.1.15) (2019-01-02) ### Bug Fixes * Update adapter common tests ([#1135](https://github.com/feathersjs/feathers/issues/1135)) ([8166dda](https://github.com/feathersjs/feathers/commit/8166dda)) <a name="2.1.14"></a> ## [2.1.14](https://github.com/feathersjs/feathers/compare/@feathersjs/authentication@2.1.13...@feathersjs/authentication@2.1.14) (2018-12-16) ### Bug Fixes * Added path and method in to express request for passport ([#1112](https://github.com/feathersjs/feathers/issues/1112)) ([afa1cb4](https://github.com/feathersjs/feathers/commit/afa1cb4)) <a name="2.1.13"></a> ## [2.1.13](https://github.com/feathersjs/feathers/compare/@feathersjs/authentication@2.1.12...@feathersjs/authentication@2.1.13) (2018-10-26) **Note:** Version bump only for package @feathersjs/authentication <a name="2.1.12"></a> ## [2.1.12](https://github.com/feathersjs/feathers/compare/@feathersjs/authentication@2.1.11...@feathersjs/authentication@2.1.12) (2018-10-25) ### Bug Fixes * Make Mocha a proper devDependency for every repository ([#1053](https://github.com/feathersjs/feathers/issues/1053)) ([9974803](https://github.com/feathersjs/feathers/commit/9974803)) * Only merge authenticated property on update ([8a564f7](https://github.com/feathersjs/feathers/commit/8a564f7)) <a name="2.1.11"></a> ## [2.1.11](https://github.com/feathersjs/feathers/compare/@feathersjs/authentication@2.1.10...@feathersjs/authentication@2.1.11) (2018-09-21) **Note:** Version bump only for package @feathersjs/authentication <a name="2.1.10"></a> ## [2.1.10](https://github.com/feathersjs/feathers/compare/@feathersjs/authentication@2.1.9...@feathersjs/authentication@2.1.10) (2018-09-17) **Note:** Version bump only for package @feathersjs/authentication <a name="2.1.9"></a> ## [2.1.9](https://github.com/feathersjs/feathers/compare/@feathersjs/authentication@2.1.8...@feathersjs/authentication@2.1.9) (2018-09-02) **Note:** Version bump only for package @feathersjs/authentication <a name="2.1.8"></a> ## 2.1.8 - Migrate to Monorepo ([feathers#462](https://github.com/feathersjs/feathers/issues/462)) ## [v2.1.7](https://github.com/feathersjs/authentication/tree/v2.1.7) (2018-06-29) [Full Changelog](https://github.com/feathersjs/authentication/compare/v2.1.6...v2.1.7) **Fixed bugs:** - XXXOrRestrict undermines provider \(security\) logic [\#395](https://github.com/feathersjs/authentication/issues/395) **Closed issues:** - Customize response of authentication service [\#679](https://github.com/feathersjs/authentication/issues/679) - hook.params.user is null using REST [\#678](https://github.com/feathersjs/authentication/issues/678) - Can't store JWT token to cookie on REST client [\#676](https://github.com/feathersjs/authentication/issues/676) - Is there a way to get req.user without using the authentication middleware? [\#675](https://github.com/feathersjs/authentication/issues/675) **Merged pull requests:** - Remove subject from the JWT verification options [\#686](https://github.com/feathersjs/authentication/pull/686) ([rasendubi](https://github.com/rasendubi)) - Replaced feathers.static with express.static [\#685](https://github.com/feathersjs/authentication/pull/685) ([georgehorrell](https://github.com/georgehorrell)) - Remove dependency on Express and Express middleware [\#683](https://github.com/feathersjs/authentication/pull/683) ([daffl](https://github.com/daffl)) - Update sinon to the latest version 🚀 [\#681](https://github.com/feathersjs/authentication/pull/681) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) ## [v2.1.6](https://github.com/feathersjs/authentication/tree/v2.1.6) (2018-06-01) [Full Changelog](https://github.com/feathersjs/authentication/compare/v2.1.5...v2.1.6) **Closed issues:** - Authentication local strategy not working with a Custom User service [\#672](https://github.com/feathersjs/authentication/issues/672) - CLI command bug: 'Feathers generate authentication' produces bad working 'users' service [\#670](https://github.com/feathersjs/authentication/issues/670) - config\default.json generated without callbackURL config needed to set redirect URL for Google Outh2 [\#669](https://github.com/feathersjs/authentication/issues/669) - HELP WANTED: Authentication strategy 'jwt' is not registered. [\#668](https://github.com/feathersjs/authentication/issues/668) - Authenticate shows error: No auth token [\#667](https://github.com/feathersjs/authentication/issues/667) - authentication - Method: remove [\#662](https://github.com/feathersjs/authentication/issues/662) - NotAuthenticated: jwt expired [\#633](https://github.com/feathersjs/authentication/issues/633) - Authentication via phone number [\#616](https://github.com/feathersjs/authentication/issues/616) - Persist auth tokens on db [\#569](https://github.com/feathersjs/authentication/issues/569) - Tighter integration with feathers-authentication-management [\#393](https://github.com/feathersjs/authentication/issues/393) **Merged pull requests:** - Fix tests to work with latest Sinon [\#674](https://github.com/feathersjs/authentication/pull/674) ([daffl](https://github.com/daffl)) - add option to allowUnauthenticated [\#599](https://github.com/feathersjs/authentication/pull/599) ([MichaelErmer](https://github.com/MichaelErmer)) ## [v2.1.5](https://github.com/feathersjs/authentication/tree/v2.1.5) (2018-04-16) [Full Changelog](https://github.com/feathersjs/authentication/compare/v2.1.4...v2.1.5) **Closed issues:** - feathersjs Invalid token: expired [\#661](https://github.com/feathersjs/authentication/issues/661) - Safari and iOS facebook login can't redirect back, but others can. [\#651](https://github.com/feathersjs/authentication/issues/651) **Merged pull requests:** - Remove payload and user entity on logout. [\#665](https://github.com/feathersjs/authentication/pull/665) ([bertho-zero](https://github.com/bertho-zero)) ## [v2.1.4](https://github.com/feathersjs/authentication/tree/v2.1.4) (2018-04-12) [Full Changelog](https://github.com/feathersjs/authentication/compare/v2.1.3...v2.1.4) **Closed issues:** - Column "createdAt" does not exist" in Autentication [\#660](https://github.com/feathersjs/authentication/issues/660) - How to make a user automatically logined on server side? [\#659](https://github.com/feathersjs/authentication/issues/659) - authentication-jwt functional example [\#657](https://github.com/feathersjs/authentication/issues/657) - "No auth token" with auth0 when following the guide [\#655](https://github.com/feathersjs/authentication/issues/655) - Service returns \[No Auth Token\] same by passing Authorization Token on HEADER [\#641](https://github.com/feathersjs/authentication/issues/641) **Merged pull requests:** - Throw an error for unavailable strategy [\#663](https://github.com/feathersjs/authentication/pull/663) ([daffl](https://github.com/daffl)) - Update sinon to the latest version 🚀 [\#656](https://github.com/feathersjs/authentication/pull/656) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) ## [v2.1.3](https://github.com/feathersjs/authentication/tree/v2.1.3) (2018-03-16) [Full Changelog](https://github.com/feathersjs/authentication/compare/v2.1.2...v2.1.3) **Closed issues:** - ts [\#647](https://github.com/feathersjs/authentication/issues/647) - Using /auth/facebook gives a 404 from vue-router [\#643](https://github.com/feathersjs/authentication/issues/643) - Crash after upgrade to feathersjs v3 [\#642](https://github.com/feathersjs/authentication/issues/642) - SameSite cookie option [\#640](https://github.com/feathersjs/authentication/issues/640) - context.params.user is empty object [\#635](https://github.com/feathersjs/authentication/issues/635) - Token is undefined for authenticated user [\#500](https://github.com/feathersjs/authentication/issues/500) - 1.x: logout timers need to be moved [\#467](https://github.com/feathersjs/authentication/issues/467) **Merged pull requests:** - Merge auk to master [\#653](https://github.com/feathersjs/authentication/pull/653) ([wnxhaja](https://github.com/wnxhaja)) - Update ws to the latest version 🚀 [\#645](https://github.com/feathersjs/authentication/pull/645) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Update sinon-chai to the latest version 🚀 [\#644](https://github.com/feathersjs/authentication/pull/644) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) ## [v2.1.2](https://github.com/feathersjs/authentication/tree/v2.1.2) (2018-02-14) [Full Changelog](https://github.com/feathersjs/authentication/compare/v2.1.1...v2.1.2) **Fixed bugs:** - hook failed with auth & sync [\#540](https://github.com/feathersjs/authentication/issues/540) - JWT Cookie [\#389](https://github.com/feathersjs/authentication/issues/389) **Closed issues:** - forgot password [\#638](https://github.com/feathersjs/authentication/issues/638) - registered many authentication services [\#634](https://github.com/feathersjs/authentication/issues/634) - TypeError: Cannot read property '\_strategy' of undefined [\#632](https://github.com/feathersjs/authentication/issues/632) - How to change 5000ms timeout? [\#628](https://github.com/feathersjs/authentication/issues/628) - cookie reused from server in SSR app [\#619](https://github.com/feathersjs/authentication/issues/619) - Express middleware not setCookie [\#617](https://github.com/feathersjs/authentication/issues/617) - Server to Server Authentication Question [\#612](https://github.com/feathersjs/authentication/issues/612) - No way to share token between socket-rest-express [\#607](https://github.com/feathersjs/authentication/issues/607) - 404 when accessing route using customer authentication [\#579](https://github.com/feathersjs/authentication/issues/579) - \[question\] is it possible to protect by role a create method? [\#564](https://github.com/feathersjs/authentication/issues/564) - Authentication with server-side rendering [\#560](https://github.com/feathersjs/authentication/issues/560) - Problem authenticating using REST middleware [\#495](https://github.com/feathersjs/authentication/issues/495) - A supposed way to auth requests from SSR to Feathers API [\#469](https://github.com/feathersjs/authentication/issues/469) - rename `app.authenticate\(\)` to `app.\_authenticate\(\)` [\#468](https://github.com/feathersjs/authentication/issues/468) **Merged pull requests:** - Delete slack link [\#637](https://github.com/feathersjs/authentication/pull/637) ([vodniciarv](https://github.com/vodniciarv)) - Update @feathersjs/authentication-jwt to the latest version 🚀 [\#631](https://github.com/feathersjs/authentication/pull/631) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Update mocha to the latest version 🚀 [\#629](https://github.com/feathersjs/authentication/pull/629) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Update ws to the latest version 🚀 [\#625](https://github.com/feathersjs/authentication/pull/625) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Options merged [\#611](https://github.com/feathersjs/authentication/pull/611) ([Makingweb](https://github.com/Makingweb)) ## [v2.1.1](https://github.com/feathersjs/authentication/tree/v2.1.1) (2018-01-03) [Full Changelog](https://github.com/feathersjs/authentication/compare/v2.1.0...v2.1.1) **Closed issues:** - Deleted user successfully signs in using JWT [\#615](https://github.com/feathersjs/authentication/issues/615) - Feathers.authenticate gives window undefined \(server-rendered\) [\#573](https://github.com/feathersjs/authentication/issues/573) - Be careful with discard\('password'\) in user [\#434](https://github.com/feathersjs/authentication/issues/434) **Merged pull requests:** - Update readme to correspond with latest release [\#621](https://github.com/feathersjs/authentication/pull/621) ([daffl](https://github.com/daffl)) - Update semistandard to the latest version 🚀 [\#620](https://github.com/feathersjs/authentication/pull/620) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Update mongodb to the latest version 🚀 [\#618](https://github.com/feathersjs/authentication/pull/618) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) ## [v2.1.0](https://github.com/feathersjs/authentication/tree/v2.1.0) (2017-12-06) [Full Changelog](https://github.com/feathersjs/authentication/compare/v2.0.1...v2.1.0) **Closed issues:** - Method "Remove" from Authentication Service gives Internal Server Error when using JWT Authentication with Cookies. [\#606](https://github.com/feathersjs/authentication/issues/606) - Anonymous Authentication fails over Socket.io [\#457](https://github.com/feathersjs/authentication/issues/457) **Merged pull requests:** - Always prevent publishing of authentication events [\#614](https://github.com/feathersjs/authentication/pull/614) ([daffl](https://github.com/daffl)) - Update feathers-memory to the latest version 🚀 [\#613](https://github.com/feathersjs/authentication/pull/613) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) ## [v2.0.1](https://github.com/feathersjs/authentication/tree/v2.0.1) (2017-11-16) [Full Changelog](https://github.com/feathersjs/authentication/compare/v2.0.0...v2.0.1) **Merged pull requests:** - Add default export for better ES module \(TypeScript\) compatibility [\#605](https://github.com/feathersjs/authentication/pull/605) ([daffl](https://github.com/daffl)) ## [v2.0.0](https://github.com/feathersjs/authentication/tree/v2.0.0) (2017-11-09) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.3.1...v2.0.0) **Closed issues:** - is there a way to detect if the token used is correct or not ? [\#601](https://github.com/feathersjs/authentication/issues/601) - option for non-JWT based session [\#597](https://github.com/feathersjs/authentication/issues/597) **Merged pull requests:** - Update nsp to the latest version 🚀 [\#603](https://github.com/feathersjs/authentication/pull/603) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) ## [v1.3.1](https://github.com/feathersjs/authentication/tree/v1.3.1) (2017-11-03) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.4.1...v1.3.1) **Merged pull requests:** - Only set the JWT UUID if it is not already set [\#600](https://github.com/feathersjs/authentication/pull/600) ([daffl](https://github.com/daffl)) ## [v1.4.1](https://github.com/feathersjs/authentication/tree/v1.4.1) (2017-11-01) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.4.0...v1.4.1) **Merged pull requests:** - Update dependencies for release [\#598](https://github.com/feathersjs/authentication/pull/598) ([daffl](https://github.com/daffl)) - Finalize v3 dependency updates [\#596](https://github.com/feathersjs/authentication/pull/596) ([daffl](https://github.com/daffl)) - Update Codeclimate coverage token [\#595](https://github.com/feathersjs/authentication/pull/595) ([daffl](https://github.com/daffl)) ## [v1.4.0](https://github.com/feathersjs/authentication/tree/v1.4.0) (2017-10-25) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.3.0...v1.4.0) **Closed issues:** - An in-range update of socket.io-client is breaking the build 🚨 [\#588](https://github.com/feathersjs/authentication/issues/588) - An in-range update of feathers-hooks is breaking the build 🚨 [\#587](https://github.com/feathersjs/authentication/issues/587) **Merged pull requests:** - Move to npm scope [\#594](https://github.com/feathersjs/authentication/pull/594) ([daffl](https://github.com/daffl)) - Update to Feathers v3 \(Buzzard\) [\#592](https://github.com/feathersjs/authentication/pull/592) ([daffl](https://github.com/daffl)) - Update to new plugin infrastructure [\#591](https://github.com/feathersjs/authentication/pull/591) ([daffl](https://github.com/daffl)) ## [v1.3.0](https://github.com/feathersjs/authentication/tree/v1.3.0) (2017-10-24) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.13...v1.3.0) **Merged pull requests:** - updating the codeclimate setup [\#589](https://github.com/feathersjs/authentication/pull/589) ([ekryski](https://github.com/ekryski)) ## [v0.7.13](https://github.com/feathersjs/authentication/tree/v0.7.13) (2017-10-23) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.2.7...v0.7.13) **Closed issues:** - Error authenticating! Error: Token provided to verifyJWT is missing or not a string ? [\#584](https://github.com/feathersjs/authentication/issues/584) - Visual Studio Code Debug no authentication [\#583](https://github.com/feathersjs/authentication/issues/583) - \[Feature Request\] Cloud DB's [\#581](https://github.com/feathersjs/authentication/issues/581) - Request doesn't contain any headers when user service requested [\#578](https://github.com/feathersjs/authentication/issues/578) - No way to pass Options to auth.express.authenticate. Needed for Google API refreshToken [\#576](https://github.com/feathersjs/authentication/issues/576) - /auth/google 404 Not Found [\#574](https://github.com/feathersjs/authentication/issues/574) - unique email not working while create [\#572](https://github.com/feathersjs/authentication/issues/572) - authentication service not return token jwt [\#571](https://github.com/feathersjs/authentication/issues/571) - typo in jwt default options [\#570](https://github.com/feathersjs/authentication/issues/570) - Generate new app, Google-only auth, throws error [\#568](https://github.com/feathersjs/authentication/issues/568) - An in-range update of feathers is breaking the build 🚨 [\#565](https://github.com/feathersjs/authentication/issues/565) - Documentation not understanding [\#563](https://github.com/feathersjs/authentication/issues/563) - Checking hook.params.headers.authorization [\#552](https://github.com/feathersjs/authentication/issues/552) - Ability to send token as part of URL [\#546](https://github.com/feathersjs/authentication/issues/546) - Anonymous Authentication [\#544](https://github.com/feathersjs/authentication/issues/544) - Quote Error [\#519](https://github.com/feathersjs/authentication/issues/519) - \[example\] CustomStrategy using passport-custom [\#516](https://github.com/feathersjs/authentication/issues/516) - \[Epic\] Auth 2.0.0 [\#513](https://github.com/feathersjs/authentication/issues/513) - ID set to null - Unable to delete with customer ID field. [\#422](https://github.com/feathersjs/authentication/issues/422) - Prefixing socket events [\#418](https://github.com/feathersjs/authentication/issues/418) - Passwordless auth [\#409](https://github.com/feathersjs/authentication/issues/409) - How to authenticate the application client? not only the users [\#405](https://github.com/feathersjs/authentication/issues/405) - Multi-factor Local Auth [\#5](https://github.com/feathersjs/authentication/issues/5) **Merged pull requests:** - Features/typescript fix [\#585](https://github.com/feathersjs/authentication/pull/585) ([TimMensch](https://github.com/TimMensch)) - Update mocha to the latest version 🚀 [\#582](https://github.com/feathersjs/authentication/pull/582) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Update sinon to the latest version 🚀 [\#580](https://github.com/feathersjs/authentication/pull/580) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Update jsonwebtoken to the latest version 🚀 [\#567](https://github.com/feathersjs/authentication/pull/567) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Include Babel Polyfill for Node 4 [\#566](https://github.com/feathersjs/authentication/pull/566) ([daffl](https://github.com/daffl)) - Update passport to the latest version 🚀 [\#558](https://github.com/feathersjs/authentication/pull/558) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Revert "Make feathers-authentication match security documents" [\#556](https://github.com/feathersjs/authentication/pull/556) ([ekryski](https://github.com/ekryski)) - Update debug to the latest version 🚀 [\#555](https://github.com/feathersjs/authentication/pull/555) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Make feathers-authentication match security documents [\#554](https://github.com/feathersjs/authentication/pull/554) ([micaksica2](https://github.com/micaksica2)) - Update sinon to the latest version 🚀 [\#551](https://github.com/feathersjs/authentication/pull/551) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Update ws to the latest version 🚀 [\#549](https://github.com/feathersjs/authentication/pull/549) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Update chai to the latest version 🚀 [\#543](https://github.com/feathersjs/authentication/pull/543) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - adding a default jwt uuid. Refs \#513 [\#539](https://github.com/feathersjs/authentication/pull/539) ([ekryski](https://github.com/ekryski)) - Refresh token must have a user ID [\#419](https://github.com/feathersjs/authentication/pull/419) ([francisco-sanchez-molina](https://github.com/francisco-sanchez-molina)) ## [v1.2.7](https://github.com/feathersjs/authentication/tree/v1.2.7) (2017-07-11) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.2.6...v1.2.7) **Closed issues:** - Connection without password [\#541](https://github.com/feathersjs/authentication/issues/541) - email in lower case ? [\#538](https://github.com/feathersjs/authentication/issues/538) - Im unable to ping feathers server from react native. [\#537](https://github.com/feathersjs/authentication/issues/537) - whats the official way to open cors in feather ? [\#536](https://github.com/feathersjs/authentication/issues/536) - Error options.service does not exist after initial auth setup [\#535](https://github.com/feathersjs/authentication/issues/535) - LogoutTimer not being cleared correctly [\#532](https://github.com/feathersjs/authentication/issues/532) - logoutTimer causing early logouts [\#404](https://github.com/feathersjs/authentication/issues/404) **Merged pull requests:** - fixed meta undefined error [\#542](https://github.com/feathersjs/authentication/pull/542) ([markacola](https://github.com/markacola)) ## [v1.2.6](https://github.com/feathersjs/authentication/tree/v1.2.6) (2017-06-22) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.2.5...v1.2.6) **Closed issues:** - OAuth 2 login for cordova [\#530](https://github.com/feathersjs/authentication/issues/530) **Merged pull requests:** - Change cleartimeout\(\) to lt.clearTimeout\(\) [\#534](https://github.com/feathersjs/authentication/pull/534) ([wnxhaja](https://github.com/wnxhaja)) - Update feathers-authentication-local to the latest version 🚀 [\#533](https://github.com/feathersjs/authentication/pull/533) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) ## [v1.2.5](https://github.com/feathersjs/authentication/tree/v1.2.5) (2017-06-21) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.2.4...v1.2.5) **Closed issues:** - Cannot read property 'user' of undefined - lib\socket\update-entity.js:26:104 [\#529](https://github.com/feathersjs/authentication/issues/529) - Provider is undefined when using restrictToRoles [\#525](https://github.com/feathersjs/authentication/issues/525) - How to make a request to an Endpoint that requires authentication from nodejs? [\#523](https://github.com/feathersjs/authentication/issues/523) **Merged pull requests:** - fixes several issues with update-entity w/ test cases [\#531](https://github.com/feathersjs/authentication/pull/531) ([jerfowler](https://github.com/jerfowler)) ## [v1.2.4](https://github.com/feathersjs/authentication/tree/v1.2.4) (2017-06-08) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.2.3...v1.2.4) **Fixed bugs:** - User \(Entity\) needs to be updated on the socket after authentication [\#293](https://github.com/feathersjs/authentication/issues/293) **Closed issues:** - Express Middleware local -\> jwt does not authorize on redirect [\#518](https://github.com/feathersjs/authentication/issues/518) - Issue with feathers-authentication [\#512](https://github.com/feathersjs/authentication/issues/512) - User Authentication Missing Credentials error \(and subsequent nav authorization\) [\#508](https://github.com/feathersjs/authentication/issues/508) - passport log failure [\#505](https://github.com/feathersjs/authentication/issues/505) - authenticate with a custom username field \(rather than email\) [\#502](https://github.com/feathersjs/authentication/issues/502) - app.get\('auth'\) vs app.get\('authentication'\) [\#497](https://github.com/feathersjs/authentication/issues/497) - Can't get success authorization with pure feathers server [\#491](https://github.com/feathersjs/authentication/issues/491) **Merged pull requests:** - Test and fix for authenticate event with invalid data [\#524](https://github.com/feathersjs/authentication/pull/524) ([daffl](https://github.com/daffl)) - Remove hook.data.payload [\#522](https://github.com/feathersjs/authentication/pull/522) ([marshallswain](https://github.com/marshallswain)) - Update socket entity [\#521](https://github.com/feathersjs/authentication/pull/521) ([marshallswain](https://github.com/marshallswain)) - Made each option, optional [\#515](https://github.com/feathersjs/authentication/pull/515) ([cranesandcaff](https://github.com/cranesandcaff)) - Add feathers-authentication-hooks in readme [\#510](https://github.com/feathersjs/authentication/pull/510) ([bertho-zero](https://github.com/bertho-zero)) - Update ms to the latest version 🚀 [\#509](https://github.com/feathersjs/authentication/pull/509) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Fix default authentication config keys [\#506](https://github.com/feathersjs/authentication/pull/506) ([ekryski](https://github.com/ekryski)) ## [v1.2.3](https://github.com/feathersjs/authentication/tree/v1.2.3) (2017-05-10) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.2.2...v1.2.3) **Closed issues:** - Validating custom express routes [\#498](https://github.com/feathersjs/authentication/issues/498) - Payload won't include userId when logging in with stored localStorage token [\#496](https://github.com/feathersjs/authentication/issues/496) - How to send oauth token authentication to another client server [\#493](https://github.com/feathersjs/authentication/issues/493) - Unhandled Promise Rejection error. [\#489](https://github.com/feathersjs/authentication/issues/489) - No Auth token on authentication resource [\#488](https://github.com/feathersjs/authentication/issues/488) - How to verify JWT in feathers issued by another feathers instance ? [\#484](https://github.com/feathersjs/authentication/issues/484) - hook.params.user [\#483](https://github.com/feathersjs/authentication/issues/483) - Overriding JWT's expiresIn with a value more than 20d prevents users from signing in [\#458](https://github.com/feathersjs/authentication/issues/458) **Merged pull requests:** - Update feathers-socketio to the latest version 🚀 [\#503](https://github.com/feathersjs/authentication/pull/503) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Update socket.io-client to the latest version 🚀 [\#501](https://github.com/feathersjs/authentication/pull/501) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Fix issue with very large token timeout. [\#499](https://github.com/feathersjs/authentication/pull/499) ([asdacap](https://github.com/asdacap)) - Typo [\#492](https://github.com/feathersjs/authentication/pull/492) ([wdmtech](https://github.com/wdmtech)) - Update migrating.md [\#490](https://github.com/feathersjs/authentication/pull/490) ([MichaelErmer](https://github.com/MichaelErmer)) - Update semistandard to the latest version 🚀 [\#487](https://github.com/feathersjs/authentication/pull/487) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Update feathers-hooks to the latest version 🚀 [\#485](https://github.com/feathersjs/authentication/pull/485) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) - Update dependencies to enable Greenkeeper 🌴 [\#482](https://github.com/feathersjs/authentication/pull/482) ([greenkeeper[bot]](https://github.com/apps/greenkeeper)) ## [v1.2.2](https://github.com/feathersjs/authentication/tree/v1.2.2) (2017-04-12) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.2.1...v1.2.2) **Fixed bugs:** - accessToken not being used when provided by client over socketio [\#400](https://github.com/feathersjs/authentication/issues/400) **Closed issues:** - Incompatible old client dependency [\#479](https://github.com/feathersjs/authentication/issues/479) - Using feathers-authentication-client for an existing API? [\#478](https://github.com/feathersjs/authentication/issues/478) - app.authenticate error : UnhandledPromiseRejectionWarning: Unhandled promise rejection \(rejection id: 2\): \* Error \* [\#476](https://github.com/feathersjs/authentication/issues/476) - Make `socket.feathers` data available in authentication hooks [\#475](https://github.com/feathersjs/authentication/issues/475) - Allow the authenticate hook to be called with no parameters [\#473](https://github.com/feathersjs/authentication/issues/473) - Authenticate : How to return more infos ? [\#471](https://github.com/feathersjs/authentication/issues/471) **Merged pull requests:** - Use latest version of feathers-authentication-client [\#480](https://github.com/feathersjs/authentication/pull/480) ([daffl](https://github.com/daffl)) - Resolves \#475 - Socket params are made available to authentication hooks [\#477](https://github.com/feathersjs/authentication/pull/477) ([thomas-p-wilson](https://github.com/thomas-p-wilson)) ## [v1.2.1](https://github.com/feathersjs/authentication/tree/v1.2.1) (2017-04-07) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.2.0...v1.2.1) **Fixed bugs:** - failureRedirect is never used when using with oauth2 [\#387](https://github.com/feathersjs/authentication/issues/387) **Closed issues:** - OAuth guides [\#470](https://github.com/feathersjs/authentication/issues/470) - app.authenticate not working [\#466](https://github.com/feathersjs/authentication/issues/466) - how can I logout using local authentication? [\#465](https://github.com/feathersjs/authentication/issues/465) - How to do Socket.io Authentication [\#462](https://github.com/feathersjs/authentication/issues/462) - Add event filtering by default \(socket.io\) [\#460](https://github.com/feathersjs/authentication/issues/460) - Add ability to control if socket is marked as authenticated. [\#448](https://github.com/feathersjs/authentication/issues/448) - Auth redirect issue [\#425](https://github.com/feathersjs/authentication/issues/425) - E-mail verification step can be bypassed using Postman or Curl [\#391](https://github.com/feathersjs/authentication/issues/391) - Example app [\#386](https://github.com/feathersjs/authentication/issues/386) **Merged pull requests:** - Allow the cookie to be set if action is not `remove` [\#474](https://github.com/feathersjs/authentication/pull/474) ([marshallswain](https://github.com/marshallswain)) ## [v1.2.0](https://github.com/feathersjs/authentication/tree/v1.2.0) (2017-03-23) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.1.1...v1.2.0) **Fixed bugs:** - 1.0 authentication service hooks don't run when client uses feathers-socketio [\#455](https://github.com/feathersjs/authentication/issues/455) - `hook.params.provider` is not set when calling `client.authenticate\(\)` [\#432](https://github.com/feathersjs/authentication/issues/432) - remove method failed with JsonWebTokenError: invalid token [\#388](https://github.com/feathersjs/authentication/issues/388) **Closed issues:** - Token creation has side effect [\#454](https://github.com/feathersjs/authentication/issues/454) - Question: When is userId set? [\#453](https://github.com/feathersjs/authentication/issues/453) - How to authenticate SPA? More precisely how does the redirect works? [\#451](https://github.com/feathersjs/authentication/issues/451) - POST to auth/facebook for FacebookTokenStrategy 404? [\#447](https://github.com/feathersjs/authentication/issues/447) - feathers-authentication 1.1.1 `No auth token` [\#445](https://github.com/feathersjs/authentication/issues/445) - Another readme incorrect and maybe docs to [\#441](https://github.com/feathersjs/authentication/issues/441) - Readme incorrect and maybe docs to [\#440](https://github.com/feathersjs/authentication/issues/440) - npm version issue? [\#439](https://github.com/feathersjs/authentication/issues/439) - setCookie express middleware only works inside hooks [\#438](https://github.com/feathersjs/authentication/issues/438) - createJWT throws 'secret must provided' [\#437](https://github.com/feathersjs/authentication/issues/437) - Not useful error message on NotAuthenticated error [\#436](https://github.com/feathersjs/authentication/issues/436) - Passwordfeld in auth.local does not work as expected [\#435](https://github.com/feathersjs/authentication/issues/435) - Authentication via REST returns token without finding user on db [\#430](https://github.com/feathersjs/authentication/issues/430) **Merged pull requests:** - Filter out all events [\#461](https://github.com/feathersjs/authentication/pull/461) ([daffl](https://github.com/daffl)) - Fix socket auth [\#459](https://github.com/feathersjs/authentication/pull/459) ([marshallswain](https://github.com/marshallswain)) - Fix \#454 Token create has side effect [\#456](https://github.com/feathersjs/authentication/pull/456) ([whollacsek](https://github.com/whollacsek)) - Windows compatible version of the original compile comand with public folder support. [\#442](https://github.com/feathersjs/authentication/pull/442) ([appurist](https://github.com/appurist)) - Add client.js back for consistency [\#433](https://github.com/feathersjs/authentication/pull/433) ([daffl](https://github.com/daffl)) - add string to authenticate \(typescript\) [\#431](https://github.com/feathersjs/authentication/pull/431) ([superbarne](https://github.com/superbarne)) - Add support for Bearer scheme in remove method [\#403](https://github.com/feathersjs/authentication/pull/403) ([boybundit](https://github.com/boybundit)) ## [v1.1.1](https://github.com/feathersjs/authentication/tree/v1.1.1) (2017-03-02) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.1.0...v1.1.1) **Closed issues:** - Authentication over socket.io never answers [\#428](https://github.com/feathersjs/authentication/issues/428) **Merged pull requests:** - Remove lots of hardcoded values for config, and adds the `authenticate` hook [\#427](https://github.com/feathersjs/authentication/pull/427) ([myknbani](https://github.com/myknbani)) ## [v1.1.0](https://github.com/feathersjs/authentication/tree/v1.1.0) (2017-03-01) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.0.2...v1.1.0) **Fixed bugs:** - Mongo update error after logging into Facebook [\#244](https://github.com/feathersjs/authentication/issues/244) **Closed issues:** - Feature Request: Anonymous Authentication Strategy Support [\#423](https://github.com/feathersjs/authentication/issues/423) - Error is not thrown if token that is provided is invalid [\#421](https://github.com/feathersjs/authentication/issues/421) - Request body 'token' parameter disappears [\#420](https://github.com/feathersjs/authentication/issues/420) - Auth2 issue getting JWT token from server when different ports [\#416](https://github.com/feathersjs/authentication/issues/416) - Cookie-based authentication with XHR is not possible [\#413](https://github.com/feathersjs/authentication/issues/413) - JWT Authentication setup failing [\#411](https://github.com/feathersjs/authentication/issues/411) - how to disable service for external usage in version 1.0 [\#410](https://github.com/feathersjs/authentication/issues/410) - v1.0 is removed from npm? [\#408](https://github.com/feathersjs/authentication/issues/408) - Make JWT data more configurable [\#407](https://github.com/feathersjs/authentication/issues/407) - Possible typo [\#406](https://github.com/feathersjs/authentication/issues/406) - Authentication with an existing database with existing hashed \(md5\) passwords [\#398](https://github.com/feathersjs/authentication/issues/398) - can modify selected fields only [\#397](https://github.com/feathersjs/authentication/issues/397) - \[Discussion\] Migrating to 1.0 - hook changes [\#396](https://github.com/feathersjs/authentication/issues/396) - feathers-authentication 'local' strategy requires token? [\#394](https://github.com/feathersjs/authentication/issues/394) - JWT for local auth. [\#390](https://github.com/feathersjs/authentication/issues/390) - Feathers 'Twitter API' style [\#385](https://github.com/feathersjs/authentication/issues/385) - Missing code in example app [\#383](https://github.com/feathersjs/authentication/issues/383) - feathers-authentication errors with any view error, and redirects to /auth/failure [\#381](https://github.com/feathersjs/authentication/issues/381) - what does app.service\('authentication'\).remove\(...\) mean? [\#379](https://github.com/feathersjs/authentication/issues/379) - Rest Endpoints. [\#375](https://github.com/feathersjs/authentication/issues/375) - cordova google-plus signUp with id\_token [\#373](https://github.com/feathersjs/authentication/issues/373) - How to reconnect socket with cookie after page refresh ? [\#372](https://github.com/feathersjs/authentication/issues/372) - Error: Could not find stored JWT and no authentication strategy was given [\#367](https://github.com/feathersjs/authentication/issues/367) - "No auth token" using authenticate strategy: 'jwt' \(v.1.0.0-beta-2\) [\#366](https://github.com/feathersjs/authentication/issues/366) - Navigating to /auth/\<provider\> twice redirects to /auth/failed [\#344](https://github.com/feathersjs/authentication/issues/344) - Meteor auth migration guide [\#334](https://github.com/feathersjs/authentication/issues/334) - Auth 1.0 [\#330](https://github.com/feathersjs/authentication/issues/330) - RSA token secret [\#309](https://github.com/feathersjs/authentication/issues/309) - Add option to use bcrypt [\#300](https://github.com/feathersjs/authentication/issues/300) - Better example of how to change hashing algorithm? \[Question\] [\#289](https://github.com/feathersjs/authentication/issues/289) - issuer doesn't work [\#284](https://github.com/feathersjs/authentication/issues/284) - passport auth question [\#274](https://github.com/feathersjs/authentication/issues/274) - Add support for authenticating active users only [\#259](https://github.com/feathersjs/authentication/issues/259) - 404 response from populateUser\(\) hook [\#258](https://github.com/feathersjs/authentication/issues/258) - Responses hang when token.secret is undefined for local authentication [\#249](https://github.com/feathersjs/authentication/issues/249) - Authentication without password [\#246](https://github.com/feathersjs/authentication/issues/246) - Fix successRedirect to not override cookie path [\#243](https://github.com/feathersjs/authentication/issues/243) - Deprecate verifyToken and populateUser hooks in favour of middleware [\#227](https://github.com/feathersjs/authentication/issues/227) - Authenticating and creating [\#100](https://github.com/feathersjs/authentication/issues/100) - Add a password service [\#83](https://github.com/feathersjs/authentication/issues/83) **Merged pull requests:** - Fix JWT options typo [\#415](https://github.com/feathersjs/authentication/pull/415) ([daffl](https://github.com/daffl)) - Prevent setCookie from mutating authOptions [\#414](https://github.com/feathersjs/authentication/pull/414) ([adrien-k](https://github.com/adrien-k)) - Typescript Definitions [\#412](https://github.com/feathersjs/authentication/pull/412) ([AbraaoAlves](https://github.com/AbraaoAlves)) - Docs for migrating to auth.hooks.authenticate hook [\#399](https://github.com/feathersjs/authentication/pull/399) ([petermikitsh](https://github.com/petermikitsh)) - Typo 'cookie.enable' should be 'cookie.enabled' [\#380](https://github.com/feathersjs/authentication/pull/380) ([whollacsek](https://github.com/whollacsek)) - Docs: Equalize usage of feathers-authenticate [\#378](https://github.com/feathersjs/authentication/pull/378) ([eikaramba](https://github.com/eikaramba)) ## [v1.0.2](https://github.com/feathersjs/authentication/tree/v1.0.2) (2016-12-14) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.0.1...v1.0.2) **Closed issues:** - successRedirect not redirecting [\#364](https://github.com/feathersjs/authentication/issues/364) ## [v1.0.1](https://github.com/feathersjs/authentication/tree/v1.0.1) (2016-12-14) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.0.0...v1.0.1) ## [v1.0.0](https://github.com/feathersjs/authentication/tree/v1.0.0) (2016-12-14) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.12...v1.0.0) **Fixed bugs:** - restrictToOwner does not support multi patch, update and remove [\#228](https://github.com/feathersjs/authentication/issues/228) **Closed issues:** - auth.express.authenticate got undefined [\#363](https://github.com/feathersjs/authentication/issues/363) - Non-standard header structure [\#361](https://github.com/feathersjs/authentication/issues/361) - localEndpoint without local strategy [\#359](https://github.com/feathersjs/authentication/issues/359) - Using custom passport strategies [\#356](https://github.com/feathersjs/authentication/issues/356) - Client-side app.on\('login'\) [\#355](https://github.com/feathersjs/authentication/issues/355) - Payload limiting on `app.get\('user'\)`? [\#354](https://github.com/feathersjs/authentication/issues/354) - Authentication token is missing [\#352](https://github.com/feathersjs/authentication/issues/352) - \[1.0\] The entity on the socket should pull from the strategy options. [\#348](https://github.com/feathersjs/authentication/issues/348) - \[1.0\] Only the first failure is returned on auth failure when chaining multiple strategies [\#346](https://github.com/feathersjs/authentication/issues/346) - Build 0.7.11 does not contain current code on NPMJS [\#342](https://github.com/feathersjs/authentication/issues/342) - feathers-authentication branch 0.8 did not work with payload \(tested on socket\) [\#264](https://github.com/feathersjs/authentication/issues/264) - Add method for updating JWT [\#260](https://github.com/feathersjs/authentication/issues/260) - 1.0 architecture considerations [\#226](https://github.com/feathersjs/authentication/issues/226) - Features/RFC [\#213](https://github.com/feathersjs/authentication/issues/213) - Support access\_token based OAuth2 providers [\#169](https://github.com/feathersjs/authentication/issues/169) - Support openID [\#154](https://github.com/feathersjs/authentication/issues/154) - Disable cookie by default if not using OAuth [\#152](https://github.com/feathersjs/authentication/issues/152) - Add token service tests [\#144](https://github.com/feathersjs/authentication/issues/144) - Add local service tests [\#143](https://github.com/feathersjs/authentication/issues/143) - Add OAuth2 service tests [\#142](https://github.com/feathersjs/authentication/issues/142) - Add OAuth2 integration tests [\#141](https://github.com/feathersjs/authentication/issues/141) - Add integration tests for custom redirects [\#125](https://github.com/feathersjs/authentication/issues/125) - Support mobile authentication via OAuth1 [\#47](https://github.com/feathersjs/authentication/issues/47) - Support OAuth1 [\#42](https://github.com/feathersjs/authentication/issues/42) - Password-less Local Auth with Email / SMS [\#7](https://github.com/feathersjs/authentication/issues/7) **Merged pull requests:** - migrating to semistandard [\#371](https://github.com/feathersjs/authentication/pull/371) ([ekryski](https://github.com/ekryski)) - Logout should always give a response. [\#369](https://github.com/feathersjs/authentication/pull/369) ([marshallswain](https://github.com/marshallswain)) - Clarify that the authenticate hook is required. [\#368](https://github.com/feathersjs/authentication/pull/368) ([marshallswain](https://github.com/marshallswain)) - Fix README example [\#365](https://github.com/feathersjs/authentication/pull/365) ([saiberz](https://github.com/saiberz)) - Remove additional deprecation notice [\#362](https://github.com/feathersjs/authentication/pull/362) ([porsager](https://github.com/porsager)) - fix typo [\#360](https://github.com/feathersjs/authentication/pull/360) ([osenvosem](https://github.com/osenvosem)) - Update feathers-primus to version 2.0.0 🚀 [\#358](https://github.com/feathersjs/authentication/pull/358) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot)) - Create .codeclimate.yml [\#357](https://github.com/feathersjs/authentication/pull/357) ([larkinscott](https://github.com/larkinscott)) - fixing redirect middleware [\#353](https://github.com/feathersjs/authentication/pull/353) ([ekryski](https://github.com/ekryski)) - Remove useless quotes [\#351](https://github.com/feathersjs/authentication/pull/351) ([bertho-zero](https://github.com/bertho-zero)) - A bunch of bug fixes [\#349](https://github.com/feathersjs/authentication/pull/349) ([ekryski](https://github.com/ekryski)) - fix\(docs/new-features\): syntax highlighting [\#347](https://github.com/feathersjs/authentication/pull/347) ([justingreenberg](https://github.com/justingreenberg)) - Update superagent to version 3.0.0 🚀 [\#345](https://github.com/feathersjs/authentication/pull/345) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot)) - Update feathers-memory to version 1.0.0 🚀 [\#343](https://github.com/feathersjs/authentication/pull/343) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot)) - 1.0 Pre-release [\#336](https://github.com/feathersjs/authentication/pull/336) ([ekryski](https://github.com/ekryski)) ## [v0.7.12](https://github.com/feathersjs/authentication/tree/v0.7.12) (2016-11-11) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.11...v0.7.12) **Closed issues:** - App.authenticate uses wrong `this` reference [\#341](https://github.com/feathersjs/authentication/issues/341) - Getting more done in GitHub with ZenHub [\#331](https://github.com/feathersjs/authentication/issues/331) - Need help to use feathers authentication storage in vue vuex [\#329](https://github.com/feathersjs/authentication/issues/329) - How to get user id in hooks? [\#322](https://github.com/feathersjs/authentication/issues/322) - I checked out my new feathersjs app in another machine, created a new user but I can't log in! [\#320](https://github.com/feathersjs/authentication/issues/320) - restrict-to-owner throws error when user id is 0 [\#319](https://github.com/feathersjs/authentication/issues/319) - Not providing sufficient details for an auth provider should not be an error. [\#318](https://github.com/feathersjs/authentication/issues/318) - \[Question\] Is there a way to verify a user with password? [\#316](https://github.com/feathersjs/authentication/issues/316) - 0.8.0 beta 1 bug - this is not defined [\#315](https://github.com/feathersjs/authentication/issues/315) - Client: Document getJWT & verifyJWT [\#313](https://github.com/feathersjs/authentication/issues/313) - Socket client should automatically auth on reconnect [\#310](https://github.com/feathersjs/authentication/issues/310) - app.get\('token'\) doesn't work after a browser refresh. [\#303](https://github.com/feathersjs/authentication/issues/303) - Problem issuing multiple jwt's for the same user [\#302](https://github.com/feathersjs/authentication/issues/302) - restrict-to-owner does not allow Service.remove\(null\) from internal systems [\#301](https://github.com/feathersjs/authentication/issues/301) - How to migrate from restrictToOwner to checkPermissions [\#299](https://github.com/feathersjs/authentication/issues/299) - "username" cannot be used as local strategy usernameField [\#294](https://github.com/feathersjs/authentication/issues/294) - Bad Hook API Design: Hooks are inconsistent and impure functions [\#288](https://github.com/feathersjs/authentication/issues/288) - Mutliple 'user' models for authentication [\#282](https://github.com/feathersjs/authentication/issues/282) - Client should ensure socket.io upgrade is complete before authenticating [\#275](https://github.com/feathersjs/authentication/issues/275) - JWT is not sent after socket reconnection [\#272](https://github.com/feathersjs/authentication/issues/272) - 401 after service is moved/refactored [\#270](https://github.com/feathersjs/authentication/issues/270) - Client side auth should subscribe to user updates so that app.get\('user'\) is fresh [\#195](https://github.com/feathersjs/authentication/issues/195) - Make oauth2 more general [\#179](https://github.com/feathersjs/authentication/issues/179) - Add integration tests for custom service endpoints [\#145](https://github.com/feathersjs/authentication/issues/145) - Create a `requireAuth` wrapper for `verifyToken`, `populateUser`, `restrictToAuth` [\#118](https://github.com/feathersjs/authentication/issues/118) **Merged pull requests:** - babel-core@6.18.2 breaks build 🚨 [\#339](https://github.com/feathersjs/authentication/pull/339) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot)) - 👻😱 Node.js 0.10 is unmaintained 😱👻 [\#337](https://github.com/feathersjs/authentication/pull/337) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot)) - restrictToOwner -Fix check for methodNotAllowed [\#335](https://github.com/feathersjs/authentication/pull/335) ([daffl](https://github.com/daffl)) - Implement login and logout events for REST authentication [\#325](https://github.com/feathersjs/authentication/pull/325) ([daffl](https://github.com/daffl)) - Socket.io authentication tests and login logout event [\#324](https://github.com/feathersjs/authentication/pull/324) ([daffl](https://github.com/daffl)) - Reorganization [\#321](https://github.com/feathersjs/authentication/pull/321) ([ekryski](https://github.com/ekryski)) - client: use Authentication class, make `getJWT` and `verifyJWT` async [\#317](https://github.com/feathersjs/authentication/pull/317) ([marshallswain](https://github.com/marshallswain)) - 0.8 client decode jwt [\#314](https://github.com/feathersjs/authentication/pull/314) ([marshallswain](https://github.com/marshallswain)) - Store config at `app.config` [\#312](https://github.com/feathersjs/authentication/pull/312) ([marshallswain](https://github.com/marshallswain)) - Cookies will match jwt expiry by default. [\#308](https://github.com/feathersjs/authentication/pull/308) ([marshallswain](https://github.com/marshallswain)) - Remove permissions hooks and middleware [\#307](https://github.com/feathersjs/authentication/pull/307) ([daffl](https://github.com/daffl)) - First cut for authentication middleware [\#305](https://github.com/feathersjs/authentication/pull/305) ([daffl](https://github.com/daffl)) - 0.8 - OAuth fixes [\#304](https://github.com/feathersjs/authentication/pull/304) ([marshallswain](https://github.com/marshallswain)) ## [v0.7.11](https://github.com/feathersjs/authentication/tree/v0.7.11) (2016-09-28) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.10...v0.7.11) **Closed issues:** - Unable to authenticate with passport-google-oauth20 [\#295](https://github.com/feathersjs/authentication/issues/295) - "Unauthorized" Response with Hook Data [\#291](https://github.com/feathersjs/authentication/issues/291) - hashPassword in patch [\#286](https://github.com/feathersjs/authentication/issues/286) - Mobile App Facebook Login [\#276](https://github.com/feathersjs/authentication/issues/276) - Socket user should update automatically [\#266](https://github.com/feathersjs/authentication/issues/266) - Get user outside a service [\#261](https://github.com/feathersjs/authentication/issues/261) **Merged pull requests:** - hashPassword fall-through if there's no password [\#287](https://github.com/feathersjs/authentication/pull/287) ([marshallswain](https://github.com/marshallswain)) - Update feathers-memory to version 0.8.0 🚀 [\#285](https://github.com/feathersjs/authentication/pull/285) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot)) - Allow multiple username fields for local auth [\#283](https://github.com/feathersjs/authentication/pull/283) ([sdbondi](https://github.com/sdbondi)) ## [v0.7.10](https://github.com/feathersjs/authentication/tree/v0.7.10) (2016-08-31) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.9...v0.7.10) **Fixed bugs:** - restrictToOwner should not throw an error on mass deletions [\#175](https://github.com/feathersjs/authentication/issues/175) **Closed issues:** - Duplicate Email should be rejected by Default [\#281](https://github.com/feathersjs/authentication/issues/281) - Auth0 & featherjs authorization only [\#277](https://github.com/feathersjs/authentication/issues/277) - Cannot read property 'scope' of undefined [\#273](https://github.com/feathersjs/authentication/issues/273) - Socker.js | Custom successHandler [\#271](https://github.com/feathersjs/authentication/issues/271) - Use feathers-socketio? and rest&socket share session maybe? [\#269](https://github.com/feathersjs/authentication/issues/269) - Ability to invalidate old token/session when user login with another machine. [\#267](https://github.com/feathersjs/authentication/issues/267) - 0.8 authentication before hooks - only ever getting a 401 Unauthorised [\#263](https://github.com/feathersjs/authentication/issues/263) - REST Middleware breaks local auth [\#262](https://github.com/feathersjs/authentication/issues/262) - 0.8: Token Service errors on token auth using client [\#254](https://github.com/feathersjs/authentication/issues/254) - 0.8: Cookies, turning off feathers-session cookie also turns off feathers-jwt cookie. [\#253](https://github.com/feathersjs/authentication/issues/253) - Any example of how to do refresh token? [\#248](https://github.com/feathersjs/authentication/issues/248) - Custom Authentication Hooks [\#236](https://github.com/feathersjs/authentication/issues/236) - Is there an Authenticated Event [\#235](https://github.com/feathersjs/authentication/issues/235) - Error while using /auth/local [\#233](https://github.com/feathersjs/authentication/issues/233) - Providing token to feathers.authentication doesn't work [\#230](https://github.com/feathersjs/authentication/issues/230) - bundled hooks customize errors [\#215](https://github.com/feathersjs/authentication/issues/215) - Hooks should support a callback for conditionally running [\#210](https://github.com/feathersjs/authentication/issues/210) - restrictToRoles hook: More complex determination of "owner". [\#205](https://github.com/feathersjs/authentication/issues/205) - verifyToken hook option to error [\#200](https://github.com/feathersjs/authentication/issues/200) - Allow using restrictToOwner as an after hook [\#123](https://github.com/feathersjs/authentication/issues/123) **Merged pull requests:** - Manually supply an endpoint to the Client authenticate\(\) method [\#278](https://github.com/feathersjs/authentication/pull/278) ([mcnamee](https://github.com/mcnamee)) - Update mocha to version 3.0.0 🚀 [\#257](https://github.com/feathersjs/authentication/pull/257) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot)) - Don’t mix options when signing tokens [\#255](https://github.com/feathersjs/authentication/pull/255) ([marshallswain](https://github.com/marshallswain)) - Attempt to get token right away. [\#252](https://github.com/feathersjs/authentication/pull/252) ([marshallswain](https://github.com/marshallswain)) - Update async to version 2.0.0 🚀 [\#240](https://github.com/feathersjs/authentication/pull/240) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot)) - Creates better way or returning data in a familiar format [\#234](https://github.com/feathersjs/authentication/pull/234) ([codingfriend1](https://github.com/codingfriend1)) - Throws an error if restriction methods are used outside of a find or get hook [\#232](https://github.com/feathersjs/authentication/pull/232) ([codingfriend1](https://github.com/codingfriend1)) - RestrictToOwner now takes an array [\#231](https://github.com/feathersjs/authentication/pull/231) ([sscaff1](https://github.com/sscaff1)) - Adds ability to limit queries unless authenticated and authorized [\#229](https://github.com/feathersjs/authentication/pull/229) ([codingfriend1](https://github.com/codingfriend1)) ## [v0.7.9](https://github.com/feathersjs/authentication/tree/v0.7.9) (2016-06-20) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.8...v0.7.9) **Fixed bugs:** - Calling logout should revoke/blacklist a JWT [\#133](https://github.com/feathersjs/authentication/issues/133) **Closed issues:** - Query email rather than oauth provider id on /auth/\<provider\> [\#223](https://github.com/feathersjs/authentication/issues/223) - Cannot read property \'service\' of undefined [\#222](https://github.com/feathersjs/authentication/issues/222) **Merged pull requests:** - added support for hashing passwords when hook.data is an array [\#225](https://github.com/feathersjs/authentication/pull/225) ([eblin](https://github.com/eblin)) - jwt ssl warning [\#214](https://github.com/feathersjs/authentication/pull/214) ([aboutlo](https://github.com/aboutlo)) ## [v0.7.8](https://github.com/feathersjs/authentication/tree/v0.7.8) (2016-06-09) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.7...v0.7.8) **Closed issues:** - Feathers-authentication assumptions [\#220](https://github.com/feathersjs/authentication/issues/220) - Server-side header option does not accept capital letters [\#218](https://github.com/feathersjs/authentication/issues/218) - How to figure out why redirect to /auth/failure? [\#217](https://github.com/feathersjs/authentication/issues/217) - Getting token via REST is not documented [\#216](https://github.com/feathersjs/authentication/issues/216) - How to use Feathers Client to Authenticate Facebook/Instagram credentials [\#204](https://github.com/feathersjs/authentication/issues/204) - Remove token from localstorage [\#203](https://github.com/feathersjs/authentication/issues/203) - Check user password [\#193](https://github.com/feathersjs/authentication/issues/193) - app.authenticate\(\): Warning: a promise was rejected with a non-error: \[object Object\] [\#191](https://github.com/feathersjs/authentication/issues/191) - Authentication provider for Facebook Account Kit [\#189](https://github.com/feathersjs/authentication/issues/189) **Merged pull requests:** - Lowercase custom header [\#219](https://github.com/feathersjs/authentication/pull/219) ([mmwtsn](https://github.com/mmwtsn)) - mocha@2.5.0 breaks build 🚨 [\#212](https://github.com/feathersjs/authentication/pull/212) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot)) - Small refactoring to simplify structure and remove code duplication [\#209](https://github.com/feathersjs/authentication/pull/209) ([daffl](https://github.com/daffl)) - Use removeItem in the storage on logout [\#208](https://github.com/feathersjs/authentication/pull/208) ([daffl](https://github.com/daffl)) - Misspelled in a comment [\#201](https://github.com/feathersjs/authentication/pull/201) ([tryy3](https://github.com/tryy3)) - Update babel-plugin-add-module-exports to version 0.2.0 🚀 [\#199](https://github.com/feathersjs/authentication/pull/199) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot)) ## [v0.7.7](https://github.com/feathersjs/authentication/tree/v0.7.7) (2016-05-05) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.6...v0.7.7) **Fixed bugs:** - OAuth2 authentication callback failing due to missing property [\#196](https://github.com/feathersjs/authentication/issues/196) **Merged pull requests:** - properly handle optional `\_json` property [\#197](https://github.com/feathersjs/authentication/pull/197) ([nyaaao](https://github.com/nyaaao)) ## [v0.7.6](https://github.com/feathersjs/authentication/tree/v0.7.6) (2016-05-03) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.5...v0.7.6) **Fixed bugs:** - Facebook Authentication should do a patch not an update. [\#174](https://github.com/feathersjs/authentication/issues/174) **Closed issues:** - Authenticated user [\#192](https://github.com/feathersjs/authentication/issues/192) - REST token revoke [\#185](https://github.com/feathersjs/authentication/issues/185) - TypeError: Cannot read property 'service' of undefined [\#173](https://github.com/feathersjs/authentication/issues/173) - Optionally Include password in the params.query object passed to User.find\(\) [\#171](https://github.com/feathersjs/authentication/issues/171) - Pass more to local authentication params [\#165](https://github.com/feathersjs/authentication/issues/165) - Support custom authentication strategies [\#157](https://github.com/feathersjs/authentication/issues/157) **Merged pull requests:** - Allow manipulation of params before checking credentials [\#186](https://github.com/feathersjs/authentication/pull/186) ([saiichihashimoto](https://github.com/saiichihashimoto)) - Update feathers to version 2.0.1 🚀 [\#184](https://github.com/feathersjs/authentication/pull/184) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot)) - fix\(oauth2\): Use patch to update user in oauthCallback [\#183](https://github.com/feathersjs/authentication/pull/183) ([beevelop](https://github.com/beevelop)) ## [v0.7.5](https://github.com/feathersjs/authentication/tree/v0.7.5) (2016-04-23) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.4...v0.7.5) **Fixed bugs:** - restrictToOwner and restrictToRoles have invalid type checking [\#172](https://github.com/feathersjs/authentication/issues/172) **Closed issues:** - user fails to signup with facebook if there is also local auth [\#168](https://github.com/feathersjs/authentication/issues/168) - Unable to authenticate requests when using vanilla Socket.IO [\#166](https://github.com/feathersjs/authentication/issues/166) ## [v0.7.4](https://github.com/feathersjs/authentication/tree/v0.7.4) (2016-04-18) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.3...v0.7.4) **Fixed bugs:** - restrictToOwner and restrictToRoles hooks don't work with nested models [\#163](https://github.com/feathersjs/authentication/issues/163) - Change restrictToOwner error when a request does not contain ID [\#160](https://github.com/feathersjs/authentication/issues/160) **Closed issues:** - authenticate\(\) can leak sensetive user data via token service [\#162](https://github.com/feathersjs/authentication/issues/162) - onBeforeLogin Hook [\#161](https://github.com/feathersjs/authentication/issues/161) **Merged pull requests:** - Hook fixes [\#164](https://github.com/feathersjs/authentication/pull/164) ([ekryski](https://github.com/ekryski)) ## [v0.7.3](https://github.com/feathersjs/authentication/tree/v0.7.3) (2016-04-16) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.2...v0.7.3) ## [v0.7.2](https://github.com/feathersjs/authentication/tree/v0.7.2) (2016-04-16) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.1...v0.7.2) **Closed issues:** - Auth doesn't work with non default local.userEndpoint [\#159](https://github.com/feathersjs/authentication/issues/159) - Automatically add the hashPassword hook to local.userEndpoint [\#158](https://github.com/feathersjs/authentication/issues/158) - Client authentication\(\) storage option not documented [\#155](https://github.com/feathersjs/authentication/issues/155) - restrictToRoles availability inconsistency [\#153](https://github.com/feathersjs/authentication/issues/153) - Does not populate user for other services [\#150](https://github.com/feathersjs/authentication/issues/150) **Merged pull requests:** - Steal Compatibility [\#156](https://github.com/feathersjs/authentication/pull/156) ([marshallswain](https://github.com/marshallswain)) ## [v0.7.1](https://github.com/feathersjs/authentication/tree/v0.7.1) (2016-04-08) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.7.0...v0.7.1) **Closed issues:** - Documentation discrepancies [\#148](https://github.com/feathersjs/authentication/issues/148) - bcrypt is hardcoded [\#146](https://github.com/feathersjs/authentication/issues/146) - Update Docs, Guides, Examples for v0.7 [\#129](https://github.com/feathersjs/authentication/issues/129) - populateUser: allow option to populate without db call. [\#92](https://github.com/feathersjs/authentication/issues/92) **Merged pull requests:** - Update feathers-memory to version 0.7.0 🚀 [\#149](https://github.com/feathersjs/authentication/pull/149) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot)) - fix a typo [\#147](https://github.com/feathersjs/authentication/pull/147) ([chrjean](https://github.com/chrjean)) - Fix copy paste typo in queryWithCurrentUser hook. [\#140](https://github.com/feathersjs/authentication/pull/140) ([juodumas](https://github.com/juodumas)) ## [v0.7.0](https://github.com/feathersjs/authentication/tree/v0.7.0) (2016-03-30) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.6.0...v0.7.0) **Fixed bugs:** - logout should de-authenticate a socket [\#136](https://github.com/feathersjs/authentication/issues/136) - \[Security\] JsonWebToken Lifecycle Concerns; Set HttpOnly = true in JWT cookie [\#132](https://github.com/feathersjs/authentication/issues/132) - restrictToRoles hook needs to throw an error and not scope the query [\#128](https://github.com/feathersjs/authentication/issues/128) - restrictToOwner hook needs to throw an error and not scope the query [\#127](https://github.com/feathersjs/authentication/issues/127) - \[security\] Generated tokens are broadcast to all socket clients \(by default\) [\#126](https://github.com/feathersjs/authentication/issues/126) - \[oAuth\] User profile should be updated every time they are authenticated [\#124](https://github.com/feathersjs/authentication/issues/124) - Logout should clear the cookie [\#122](https://github.com/feathersjs/authentication/issues/122) - Want the default success/fail routes, not the sendFile [\#121](https://github.com/feathersjs/authentication/issues/121) **Closed issues:** - Make all hooks optional if used internally [\#138](https://github.com/feathersjs/authentication/issues/138) - Throw errors for deprecated hooks and update documentation [\#134](https://github.com/feathersjs/authentication/issues/134) - v6.0.0: How can I return the user object along with the token ? [\#131](https://github.com/feathersjs/authentication/issues/131) - user field not getting populated [\#119](https://github.com/feathersjs/authentication/issues/119) - Move to bcryptjs [\#112](https://github.com/feathersjs/authentication/issues/112) - Bundled hooks should pull from auth config to avoid having to pass duplicate props. [\#93](https://github.com/feathersjs/authentication/issues/93) - Customize the JWT payload [\#78](https://github.com/feathersjs/authentication/issues/78) - Needs a test for verifying that a custom tokenEndpoint works. [\#59](https://github.com/feathersjs/authentication/issues/59) - Finish test coverage for existing features. [\#9](https://github.com/feathersjs/authentication/issues/9) **Merged pull requests:** - 0.7 Release [\#139](https://github.com/feathersjs/authentication/pull/139) ([ekryski](https://github.com/ekryski)) ## [v0.6.0](https://github.com/feathersjs/authentication/tree/v0.6.0) (2016-03-24) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.5.1...v0.6.0) **Fixed bugs:** - Token encoding is not using the idField option. [\#107](https://github.com/feathersjs/authentication/issues/107) - Logging out breaks in React Native [\#105](https://github.com/feathersjs/authentication/issues/105) - Updating User Attached to Params in Client [\#102](https://github.com/feathersjs/authentication/issues/102) - local auth should not redirect by default [\#89](https://github.com/feathersjs/authentication/issues/89) **Closed issues:** - Id of user can't be 0 for auth [\#116](https://github.com/feathersjs/authentication/issues/116) - how to authenticate user in the socket.io? [\#111](https://github.com/feathersjs/authentication/issues/111) - Wrong Status Error [\#110](https://github.com/feathersjs/authentication/issues/110) - TypeError: Cannot read property 'service' of undefined \(continued\) [\#108](https://github.com/feathersjs/authentication/issues/108) - `idField` breaks from `tokenService.create\(\)` to `populateUser\(\)` after hook [\#103](https://github.com/feathersjs/authentication/issues/103) **Merged pull requests:** - Bcryptjs [\#137](https://github.com/feathersjs/authentication/pull/137) ([ekryski](https://github.com/ekryski)) - Allow user.id to be 0. Fixes \#116 [\#117](https://github.com/feathersjs/authentication/pull/117) ([marshallswain](https://github.com/marshallswain)) - client should return a 401 error code when no token is provided [\#115](https://github.com/feathersjs/authentication/pull/115) ([ccummings](https://github.com/ccummings)) - v0.6 - Bugs fixes, new hooks, and hook tests [\#109](https://github.com/feathersjs/authentication/pull/109) ([ekryski](https://github.com/ekryski)) - primus client connect event is 'open' [\#106](https://github.com/feathersjs/authentication/pull/106) ([ahdinosaur](https://github.com/ahdinosaur)) ## [v0.5.1](https://github.com/feathersjs/authentication/tree/v0.5.1) (2016-03-15) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.5.0...v0.5.1) ## [v0.5.0](https://github.com/feathersjs/authentication/tree/v0.5.0) (2016-03-14) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.4.1...v0.5.0) **Fixed bugs:** - Client should store token string and not the token object [\#95](https://github.com/feathersjs/authentication/issues/95) **Closed issues:** - using feathers-rest/client with feathers-authentication/client [\#94](https://github.com/feathersjs/authentication/issues/94) - populateUser can pull defaults from config, if available. [\#91](https://github.com/feathersjs/authentication/issues/91) - App level auth routes for multiple sub-routes [\#90](https://github.com/feathersjs/authentication/issues/90) - POST to /auth/local never gets response [\#88](https://github.com/feathersjs/authentication/issues/88) - populate-user.js do not get settings [\#86](https://github.com/feathersjs/authentication/issues/86) - Add rate limiting [\#81](https://github.com/feathersjs/authentication/issues/81) **Merged pull requests:** - Finalizing client side authentication module [\#101](https://github.com/feathersjs/authentication/pull/101) ([daffl](https://github.com/daffl)) - Ten hours is only 36 seconds [\#99](https://github.com/feathersjs/authentication/pull/99) ([mileswilson](https://github.com/mileswilson)) - Fix examples [\#98](https://github.com/feathersjs/authentication/pull/98) ([mastertinner](https://github.com/mastertinner)) - fix html in templates [\#97](https://github.com/feathersjs/authentication/pull/97) ([mastertinner](https://github.com/mastertinner)) - update populateUser\(\) hook [\#87](https://github.com/feathersjs/authentication/pull/87) ([kulakowka](https://github.com/kulakowka)) - Customize the JWT payload [\#80](https://github.com/feathersjs/authentication/pull/80) ([enten](https://github.com/enten)) ## [v0.4.1](https://github.com/feathersjs/authentication/tree/v0.4.1) (2016-02-28) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.4.0...v0.4.1) **Fixed bugs:** - app.logout\(\) fails [\#85](https://github.com/feathersjs/authentication/issues/85) **Closed issues:** - Username response ? [\#84](https://github.com/feathersjs/authentication/issues/84) - User doesn't get populated after authentication with databases that don't use \_id [\#71](https://github.com/feathersjs/authentication/issues/71) - Support client usage in NodeJS [\#52](https://github.com/feathersjs/authentication/issues/52) - Support async storage for React Native [\#51](https://github.com/feathersjs/authentication/issues/51) - RequireAdmin on userService [\#36](https://github.com/feathersjs/authentication/issues/36) - Create test for changing the `usernameField` [\#1](https://github.com/feathersjs/authentication/issues/1) ## [v0.4.0](https://github.com/feathersjs/authentication/tree/v0.4.0) (2016-02-27) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.3.5...v0.4.0) **Closed issues:** - Authentication not worked with hooks.remove\('password'\) [\#82](https://github.com/feathersjs/authentication/issues/82) **Merged pull requests:** - Refactoring for storage service [\#76](https://github.com/feathersjs/authentication/pull/76) ([ekryski](https://github.com/ekryski)) ## [v0.3.5](https://github.com/feathersjs/authentication/tree/v0.3.5) (2016-02-25) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.3.4...v0.3.5) **Merged pull requests:** - Adding support for OAuth2 token based auth strategies. Closes \#46. [\#77](https://github.com/feathersjs/authentication/pull/77) ([ekryski](https://github.com/ekryski)) ## [v0.3.4](https://github.com/feathersjs/authentication/tree/v0.3.4) (2016-02-25) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.3.3...v0.3.4) ## [v0.3.3](https://github.com/feathersjs/authentication/tree/v0.3.3) (2016-02-25) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.3.2...v0.3.3) ## [v0.3.2](https://github.com/feathersjs/authentication/tree/v0.3.2) (2016-02-24) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.3.1...v0.3.2) **Merged pull requests:** - bumping feathers-errors version [\#79](https://github.com/feathersjs/authentication/pull/79) ([ekryski](https://github.com/ekryski)) ## [v0.3.1](https://github.com/feathersjs/authentication/tree/v0.3.1) (2016-02-23) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.3.0...v0.3.1) **Closed issues:** - Fix toLowerCase hook [\#74](https://github.com/feathersjs/authentication/issues/74) - REST auth/local not working if socketio\(\) not set [\#72](https://github.com/feathersjs/authentication/issues/72) - Support mobile authentication via OAuth2 [\#46](https://github.com/feathersjs/authentication/issues/46) **Merged pull requests:** - Fix toLowerCase hook [\#75](https://github.com/feathersjs/authentication/pull/75) ([enten](https://github.com/enten)) ## [v0.3.0](https://github.com/feathersjs/authentication/tree/v0.3.0) (2016-02-19) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.2.4...v0.3.0) **Fixed bugs:** - Don't register successRedirect route if custom one is passed in [\#61](https://github.com/feathersjs/authentication/issues/61) **Closed issues:** - Specify the secret in one place instead of two [\#69](https://github.com/feathersjs/authentication/issues/69) - support a failRedirect [\#62](https://github.com/feathersjs/authentication/issues/62) - Document authentication updates [\#50](https://github.com/feathersjs/authentication/issues/50) **Merged pull requests:** - Config options [\#70](https://github.com/feathersjs/authentication/pull/70) ([ekryski](https://github.com/ekryski)) ## [v0.2.4](https://github.com/feathersjs/authentication/tree/v0.2.4) (2016-02-17) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.2.3...v0.2.4) **Closed issues:** - Find "query" is replaced by token [\#64](https://github.com/feathersjs/authentication/issues/64) **Merged pull requests:** - Add module exports Babel module and test CommonJS compatibility [\#68](https://github.com/feathersjs/authentication/pull/68) ([daffl](https://github.com/daffl)) ## [v0.2.3](https://github.com/feathersjs/authentication/tree/v0.2.3) (2016-02-15) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.2.2...v0.2.3) **Closed issues:** - How to forbid get and find on the userEndpoint? [\#66](https://github.com/feathersjs/authentication/issues/66) - userEndpoint problem in sub-app [\#63](https://github.com/feathersjs/authentication/issues/63) - How to modify successRedirect in local authentication? [\#60](https://github.com/feathersjs/authentication/issues/60) **Merged pull requests:** - Removing assigning token to params.query for sockets. [\#67](https://github.com/feathersjs/authentication/pull/67) ([ekryski](https://github.com/ekryski)) - Fixing client query [\#65](https://github.com/feathersjs/authentication/pull/65) ([fastlorenzo](https://github.com/fastlorenzo)) ## [v0.2.2](https://github.com/feathersjs/authentication/tree/v0.2.2) (2016-02-13) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.2.1...v0.2.2) **Closed issues:** - Custom tokenEndpoint failing [\#57](https://github.com/feathersjs/authentication/issues/57) - TypeError: Cannot read property 'service' of undefined [\#56](https://github.com/feathersjs/authentication/issues/56) - Login returns 500: Internal server error [\#54](https://github.com/feathersjs/authentication/issues/54) **Merged pull requests:** - Fixing token endpoint [\#58](https://github.com/feathersjs/authentication/pull/58) ([marshallswain](https://github.com/marshallswain)) ## [v0.2.1](https://github.com/feathersjs/authentication/tree/v0.2.1) (2016-02-12) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.2.0...v0.2.1) **Closed issues:** - Custom local options not being respected. [\#55](https://github.com/feathersjs/authentication/issues/55) - node can not require\("feathers-authentication"\).default [\#53](https://github.com/feathersjs/authentication/issues/53) ## [v0.2.0](https://github.com/feathersjs/authentication/tree/v0.2.0) (2016-02-12) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.1.2...v0.2.0) **Closed issues:** - Support graceful fallback to cookies [\#45](https://github.com/feathersjs/authentication/issues/45) - Add a client side component for authentication [\#44](https://github.com/feathersjs/authentication/issues/44) - Support OAuth2 [\#43](https://github.com/feathersjs/authentication/issues/43) - Support token based authentication [\#41](https://github.com/feathersjs/authentication/issues/41) - Support local authentication [\#40](https://github.com/feathersjs/authentication/issues/40) - Only sign the JWT with user id. Not the whole user object [\#38](https://github.com/feathersjs/authentication/issues/38) - Discussion: Securing token for socket.io auth [\#33](https://github.com/feathersjs/authentication/issues/33) - Handling expired tokens [\#25](https://github.com/feathersjs/authentication/issues/25) - Support multiple auth providers [\#6](https://github.com/feathersjs/authentication/issues/6) **Merged pull requests:** - Decoupling [\#49](https://github.com/feathersjs/authentication/pull/49) ([ekryski](https://github.com/ekryski)) - Adding an auth client [\#48](https://github.com/feathersjs/authentication/pull/48) ([ekryski](https://github.com/ekryski)) - Validate if provider [\#39](https://github.com/feathersjs/authentication/pull/39) ([mastertinner](https://github.com/mastertinner)) ## [v0.1.2](https://github.com/feathersjs/authentication/tree/v0.1.2) (2016-02-04) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.1.1...v0.1.2) **Closed issues:** - Hooks should support incoming data as arrays of objects. [\#34](https://github.com/feathersjs/authentication/issues/34) - Support authenticating with Username and Password via sockets [\#32](https://github.com/feathersjs/authentication/issues/32) **Merged pull requests:** - Check for params.provider in requireAuth hook [\#37](https://github.com/feathersjs/authentication/pull/37) ([marshallswain](https://github.com/marshallswain)) - safety check for data [\#35](https://github.com/feathersjs/authentication/pull/35) ([deanmcpherson](https://github.com/deanmcpherson)) ## [v0.1.1](https://github.com/feathersjs/authentication/tree/v0.1.1) (2016-01-30) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.1.0...v0.1.1) ## [v0.1.0](https://github.com/feathersjs/authentication/tree/v0.1.0) (2016-01-25) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.0.8...v0.1.0) **Closed issues:** - Get the Travis build to work. [\#27](https://github.com/feathersjs/authentication/issues/27) - Login not working [\#24](https://github.com/feathersjs/authentication/issues/24) - Hooks should be configurable \(they should be functions\) [\#11](https://github.com/feathersjs/authentication/issues/11) - Document the bundled hooks. [\#10](https://github.com/feathersjs/authentication/issues/10) **Merged pull requests:** - Migrate docs to book [\#31](https://github.com/feathersjs/authentication/pull/31) ([marshallswain](https://github.com/marshallswain)) - hashPassword: Async bcrypt usage needs a promise [\#30](https://github.com/feathersjs/authentication/pull/30) ([marshallswain](https://github.com/marshallswain)) - Removing extras from travis.yml [\#29](https://github.com/feathersjs/authentication/pull/29) ([marshallswain](https://github.com/marshallswain)) - Fixing build [\#28](https://github.com/feathersjs/authentication/pull/28) ([marshallswain](https://github.com/marshallswain)) - Adding nsp check [\#26](https://github.com/feathersjs/authentication/pull/26) ([marshallswain](https://github.com/marshallswain)) ## [v0.0.8](https://github.com/feathersjs/authentication/tree/v0.0.8) (2016-01-16) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.0.7...v0.0.8) **Merged pull requests:** - Support services that use pagination. [\#23](https://github.com/feathersjs/authentication/pull/23) ([marshallswain](https://github.com/marshallswain)) ## [v0.0.7](https://github.com/feathersjs/authentication/tree/v0.0.7) (2016-01-07) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.0.6...v0.0.7) **Closed issues:** - Password isn't removed from responses when using a mongoose service for users endpoint [\#19](https://github.com/feathersjs/authentication/issues/19) - next called twice using socket.io and using an unauthenticated service [\#17](https://github.com/feathersjs/authentication/issues/17) - Switch to a callback-based field configuration? [\#15](https://github.com/feathersjs/authentication/issues/15) - Cannot authenticate [\#14](https://github.com/feathersjs/authentication/issues/14) - Allow require without `.default` [\#13](https://github.com/feathersjs/authentication/issues/13) - Login validation [\#2](https://github.com/feathersjs/authentication/issues/2) **Merged pull requests:** - Adding separate route for refreshing a login token. [\#21](https://github.com/feathersjs/authentication/pull/21) ([corymsmith](https://github.com/corymsmith)) - Converting user model to object when using mongoose service [\#20](https://github.com/feathersjs/authentication/pull/20) ([corymsmith](https://github.com/corymsmith)) - Fixing issue where next is called twice when hitting an unauthenticated service via socket.io [\#18](https://github.com/feathersjs/authentication/pull/18) ([corymsmith](https://github.com/corymsmith)) - Fixing usage of mongoose service [\#16](https://github.com/feathersjs/authentication/pull/16) ([corymsmith](https://github.com/corymsmith)) ## [v0.0.6](https://github.com/feathersjs/authentication/tree/v0.0.6) (2015-11-22) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.0.5...v0.0.6) **Closed issues:** - Feathers Auth Configuration Error [\#12](https://github.com/feathersjs/authentication/issues/12) - Make sure we're returning proper error responses. [\#8](https://github.com/feathersjs/authentication/issues/8) ## [v0.0.5](https://github.com/feathersjs/authentication/tree/v0.0.5) (2015-11-19) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.0.4...v0.0.5) ## [v0.0.4](https://github.com/feathersjs/authentication/tree/v0.0.4) (2015-11-19) [Full Changelog](https://github.com/feathersjs/authentication/compare/v0.0.3...v0.0.4) ## [v0.0.3](https://github.com/feathersjs/authentication/tree/v0.0.3) (2015-11-18) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.0.6...v0.0.3) **Merged pull requests:** - allow runtime auth via socket.io [\#4](https://github.com/feathersjs/authentication/pull/4) ([randomnerd](https://github.com/randomnerd)) ## [v1.0.6](https://github.com/feathersjs/authentication/tree/v1.0.6) (2015-11-02) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.0.5...v1.0.6) ## [v1.0.5](https://github.com/feathersjs/authentication/tree/v1.0.5) (2015-11-02) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.0.4...v1.0.5) ## [v1.0.4](https://github.com/feathersjs/authentication/tree/v1.0.4) (2015-11-02) [Full Changelog](https://github.com/feathersjs/authentication/compare/v1.0.3...v1.0.4) ## [v1.0.3](https://github.com/feathersjs/authentication/tree/v1.0.3) (2015-10-12) \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
feathersjs/feathers
packages/authentication/CHANGELOG.md
Markdown
mit
107,114
<?php header("Content-type: text/html; charset=utf-8"); if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Matricula extends CI_Controller { public function __construct(){ parent::__construct(); if(!isset($_SESSION['login'])) die("Sesion terminada. <a href='". base_url()."'>Registrarse e ingresar.</a> "); $this->load->model(ventas.'matricula_model'); $this->load->model(ventas.'alumno_model'); $this->load->model(ventas.'actividad_model'); $this->load->model(maestros.'persona_model'); $this->load->model(seguridad.'permiso_model'); $this->load->model(almacen.'curso_model'); $this->load->model(maestros.'ciclo_model'); $this->load->model(maestros.'aula_model'); $this->load->model(maestros.'tipoestudiociclo_model'); $this->load->model(maestros.'local_model'); $this->load->model(ventas.'apertura_model'); $this->load->helper('menu'); $this->configuracion = $this->config->item('conf_pagina'); $this->login = $this->session->userdata('login'); } public function index() { $this->load->view('seguridad/inicio'); } public function listar($j=0){ $filter = new stdClass(); $filter->rol = $this->session->userdata('rolusu'); $filter->order_by = array("m.MENU_Orden"=>"asc"); $menu = get_menu($filter); $filter = new stdClass(); //$filter->order_by = array("c.CICLOP_Codigo"=>"desc","e.PERSC_ApellidoPaterno"=>"asc","e.PERSC_ApellidoMaterno"=>"asc"); $filter_not = new stdClass(); $registros = count($this->matricula_model->listar($filter,$filter_not)); $matricula = $this->matricula_model->listar($filter,$filter_not,$this->configuracion['per_page'],$j); $item = 1; $lista = array(); if(count($matricula)>0){ foreach($matricula as $indice => $value){ $lista[$indice] = new stdClass(); $lista[$indice]->codigo = $value->ORDENP_Codigo; $lista[$indice]->nombres = $value->PERSC_Nombre; $lista[$indice]->paterno = $value->PERSC_ApellidoPaterno; $lista[$indice]->materno = $value->PERSC_ApellidoMaterno; $lista[$indice]->tipoestudio = $value->TIPC_Nombre; $lista[$indice]->ciclo = $value->COMPC_Nombre; $lista[$indice]->aula = $value->AULAC_Nombre; $lista[$indice]->estado = $value->ORDENC_FlagEstado; $lista[$indice]->fechareg = ($value->fechareg); $lista[$indice]->fecha = date_sql($value->ORDENC_Fecot); } } $configuracion = $this->configuracion; $configuracion['base_url'] = base_url()."index.php/ventas/orden/listar"; $configuracion['total_rows'] = $registros; $this->pagination->initialize($configuracion); /*Enviamos los datos a la vista*/ $data['lista'] = $lista; $data['menu'] = $menu; $data['header'] = get_header(); $data['form_open'] = form_open('',array("name"=>"frmPersona","id"=>"frmPersona","onsubmit"=>"return valida_guiain();")); $data['form_close'] = form_close(); $data['j'] = $j; $data['registros'] = $registros; $data['paginacion'] = $this->pagination->create_links(); $this->load->view("ventas/matricula_index",$data); } public function editar($accion,$codigo=""){ $ciclo = $this->input->get_post('ciclo'); $local = $this->input->get_post('local'); $aula = $this->input->get_post('aula'); $user_id = $this->input->get_post('user_id'); $nombres = $this->input->get_post('nombres'); $tipoestudiociclo = $this->input->get_post('tipoestudiociclo'); $lista = new stdClass(); if($accion == "e"){ $filter = new stdClass(); $filter->matricula = $codigo; $orden = $this->matricula_model->obtener($filter); $lista->nombres = $nombres!=""?$nombres:$orden->firstname." ".$orden->lastname; $lista->tipoestudiociclo = $tipoestudio!=""?$tipoestudio:$orden->TIPP_Codigo; $lista->fecha = date_sql($orden->ORDENC_Fecot); $lista->user_id = $user_id!==""?$user_id:$orden->user_id; $lista->matricula = $orden->ORDENP_Codigo; $lista->estado = $orden->ORDENC_FlagEstado; $lista->ciclo = $ciclo!=""?$ciclo:$orden->CICLOP_Codigo; $lista->local = $local!=""?$local:$orden->LOCP_Codigo; $lista->aula = $aula!=""?$aula:$orden->AULAP_Codigo; $filter = new stdClass(); $filter->ciclo = $ciclo; $filter->order_by = array("d.PERSC_ApellidoPaterno"=>"asc","d.PERSC_ApellidoMaterno"=>"asc","d.PERSC_Nombre"=>"asc"); $lista->alumnos = $this->alumno_model->listar($filter); } elseif($accion == "n"){ $lista->apellidos = ""; $lista->nombres = ""; $lista->tipoestudiociclo = $tipoestudiociclo; $lista->fecha = date("d/m/Y",time()); $lista->user_id = $user_id; $lista->matricula = ""; $lista->estado = 1; $lista->ciclo = $ciclo; $lista->local = $local; $lista->aula = $aula; $filter = new stdClass(); $filter->ciclo = $ciclo; $filter->order_by = array("d.PERSC_ApellidoPaterno"=>"asc","d.PERSC_ApellidoMaterno"=>"asc","d.PERSC_Nombre"=>"asc"); $lista->alumnos = $this->alumno_model->seleccionar("0",$filter); } $arrEstado = array("0"=>"::Seleccione::","1"=>"ACTIVO","2"=>"INACTIVO"); $data['titulo'] = $accion=="e"?"Editar Matricula":"Nueva Matricula"; $data['form_open'] = form_open('',array("name"=>"frmPersona","id"=>"frmPersona")); $data['form_close'] = form_close(); $data['lista'] = $lista; $data['accion'] = $accion; $filter = new stdClass(); $filter->ciclo = $lista->ciclo; $data['seltipoestudiociclo'] = form_dropdown('tipoestudiociclo',$this->tipoestudiociclo_model->seleccionar('0',$filter),$lista->tipoestudiociclo,"id='tipoestudiociclo' class='comboMedio'"); $filter2 = new stdClass(); $filter2->local = $lista->local; $filter2->ciclo = $lista->local; $filter2->tipoestudiociclo = $lista->tipoestudiociclo; $data['selaula'] = form_dropdown('apertura',$this->apertura_model->seleccionar('0',$filter2),$lista->aula,"id='apertura' class='comboMedio'"); $data['selciclo'] = form_dropdown('ciclo',$this->ciclo_model->seleccionar('0'),$lista->ciclo,"id='ciclo' class='comboMedio'"); $data['sellocal'] = form_dropdown('local',$this->local_model->seleccionar('0'),$lista->local,"id='local' class='comboMedio'"); $data['selestado'] = form_dropdown('estado',$arrEstado,$lista->estado,"id='estado' class='comboMedio'"); $data['selalum_total'] = form_multiselect('alum_total[]',$lista->alumnos,$lista->estado,"id='alum_total' class='comboMultipleGrande'"); $data['selalum_matri'] = form_multiselect('alum_matriculados[]',array(),$lista->estado,"id='alum_matriculados' class='comboMultipleGrande'"); $data['oculto'] = form_hidden(array("accion"=>$accion,"codigo"=>$codigo)); $this->load->view("ventas/matricula_nuevo",$data); } public function grabar(){ $accion = $this->input->get_post('accion'); $codigo = $this->input->get_post('codigo'); $data = array( "CICLOP_Codigo" => $this->input->post('ciclo'), "CLIP_Codigo" => $this->input->post('alumno'), "AULAP_Codigo" => $this->input->post('aula'), "TIPP_Codigo" => $this->input->post('tipoestudio'), "ORDENC_Fecot" => date_sql_ret($this->input->post('fecha')), "ORDENC_FlagEstado" => $this->input->post('estado'), "ORDENC_FechaModificacion" => date("Y-m-d",time()) ); $resultado = false; $filter = new stdClass(); $filter->cliente = $this->input->post('alumno'); $filter->curso = $this->input->post('curso'); $ordenes = $this->matricula_model->listar($filter); if($accion == "n"){ if(count($ordenes)==0){ $resultado = true; $this->matricula_model->insertar($data); } } elseif($accion == "e"){ if(count($ordenes)==0){ $resultado = true; $this->matricula_model->modificar($codigo,$data); } else{ $numero = $ordenes[0]->ORDENP_Codigo; if($numero==$this->input->post('matricula')){ $resultado = true; $this->matricula_model->modificar($codigo,$data); } } } echo json_encode($resultado); } public function eliminar(){ $codigo = $this->input->post('codigo'); $filter = new stdClass(); $filter->orden = $codigo; $actividades = $this->actividad_model->listar($filter); $resultado = false; if(count($actividades)==0){ $this->matricula_model->eliminar($codigo); $resultado = true; } echo json_encode($resultado); } public function ver($codigo){ $filter = new stdClass(); $filter->orden = $codigo; $ordenes = $this->matricula_model->obtener($filter); $codproducto = $ordenes->PROD_Codigo; $codcliente = $ordenes->CLIP_Codigo; $filter = new stdClass(); $filter->cliente = $codcliente; $clientes = $this->alumno_model->obtener($filter); $filter = new stdClass(); $filter->curso = $codproducto; $productos = $this->curso_model->obtener($filter); $this->load->library("fpdf/pdf"); $CI = & get_instance(); $CI->pdf->FPDF('P'); $CI->pdf->AliasNbPages(); $CI->pdf->AddPage(); $CI->pdf->SetTextColor(0,0,0); $CI->pdf->SetFillColor(216,216,216); $CI->pdf->SetFont('Arial','B',11); $CI->pdf->Image('img/puertosaber.jpg',10,8,10); $CI->pdf->Cell(0,13,"MATRICULA Nro ".$ordenes->ORDENC_Numero,0,1,"C",0); $CI->pdf->SetFont('Arial','B',7); $CI->pdf->Cell(120,10, "" ,0,1,"L",0); $CI->pdf->Cell(90,5, "CURSO : " ,1,0,"L",0); $CI->pdf->Cell(1,1, "" ,0,0,"L",0); $CI->pdf->Cell(90,5,$productos->PROD_Nombre,1,1,"L",0); $CI->pdf->Cell(90,1, "" ,0,1,"L",0); $CI->pdf->Cell(90,5, "APELLIDOS Y NOMBRES: " ,1,0,"L",0); $CI->pdf->Cell(1,1, "" ,0,0,"L",0); $CI->pdf->Cell(90,5,$clientes->PERSC_ApellidoPaterno." ".$clientes->PERSC_ApellidoMaterno.", ".$clientes->PERSC_Nombre,1,1,"L",0); $CI->pdf->Cell(90,1, "" ,0,1,"L",0); $CI->pdf->Cell(90,5, "USUARIO: " ,1,0,"L",0); $CI->pdf->Cell(1,1, "" ,0,0,"L",0); $CI->pdf->Cell(90,5,$ordenes->ORDENC_Usuario ,1,1,"L",0); $CI->pdf->Cell(90,1, "" ,0,1,"L",0); $CI->pdf->Cell(90,5, "CLAVE: " ,1,0,"L",0); $CI->pdf->Cell(1,1,$ordenes->ORDENC_Password,0,0,"L",0); $CI->pdf->Cell(90,5, "" ,1,1,"L",0); $CI->pdf->Cell(90,1, "" ,0,1,"L",0); $CI->pdf->Cell(90,5, "RESPONSABLE: " ,1,0,"L",0); $CI->pdf->Cell(1,1, "" ,0,0,"L",0); $CI->pdf->Cell(90,5, "" ,1,1,"L",0); $CI->pdf->Cell(90,1, "" ,0,1,"L",0); $CI->pdf->SetTextColor(0,0,0); $CI->pdf->SetFillColor(255,255,255); $CI->pdf->Cell(181,5, "OBSERVACION : " ,0,1,"L",1); $CI->pdf->Cell(181,5,$ordenes->ORDENC_Observacion,1,1,"L",1); $CI->pdf->Output(); } public function buscar($n=""){ $tipo = $this->input->get_post('tipo'); $ot = $this->input->get_post('ot'); $rsocial = $this->input->get_post('rsocial'); $filter = new stdClass(); $filter->anio = date('Y',time()); $filter->tipo = "OT"; $tipoots = $this->tipoot_model->listar($filter); if($tipo=='') $tipo = isset($tipoots->cod_argumento)?$tipoots->cod_argumento:""; $fila = ""; $filter = new stdClass(); $filter->tipoot = $tipo; if($ot!='') $filter->nroot = $ot; if($rsocial!='') $filter->codcliente = $rsocial; if($tipo=="04") $filter->estado = "P"; $ots = $this->ot_model->listarg($filter,array('ot.nroOt'=>'asc')); $tipoOt = form_dropdown('tipo',$this->tipoot_model->seleccionar('',''),$tipo,"id='tipo' class='comboMedio' onchange='busca_tipoOt();'"); if(count($ots)>0){ foreach($ots as $indice=>$value){ $nroot = $value->NroOt; $site = $value->DirOt; $codcli = $value->CodCli; $codot = $value->CodOt; $finot = $value->FinOt; $ftermino = $value->FteOt; $razon_social = $tipo=='04'?$site:$value->razcli; // quitar esto { $finot_envia = $tipo=='04'?date("d/m/Y",time()):$value->FinOt; // } $fila .= "<tr title='Fecha Termino: ".$ftermino."' id='".$codot."' id2='".$tipo."' id3='".$finot."' onclick='listadoot(this);'>"; $fila .= "<td style='width:10%;' align='center'><p class='listadoot'>".$nroot."</p></td>"; $fila .= "<td style='width:35%;' align='left'><p class='listadoot'>".$site."</p></td>"; $fila .= "<td style='width:12%;' align='left'><p class='listadoot'>".$finot."</p></td>"; $fila .= "<td style='width:12%;' align='left'><p class='listadoot'>".$ftermino."</p></td>"; $fila .= "<td style='width:31%;' align='left'><p class='listadoot'>".$razon_social."</p></td>"; $fila .= "</tr>"; } } else{ $fila.="<tr>"; $fila.="<td colspan='3'>NO EXISTEN RESULTADOS</td>"; $fila.="</tr>"; } $data['ot'] = $ot; $data['n'] = $n; $data['fila'] = $fila; $data['tipoot'] = $tipoOt; $data['rsocial'] = $rsocial; $this->load->view(ventas."ot_buscar",$data); } // public function obtener_tipOt($tipoOt){ // $this->load->model(maestros.'tipoot_model'); // $tipoOt = $this->tipoot_model->obtener($tipoOt); // echo json_encode($tipoOt); // } public function export_excel($type) { if($this->session->userdata('data_'.$type)){ $result = $this->session->userdata('data_'.$type); $arr_columns = array(); switch ($type) { case 'listar_requisiciones_ot': $this->reports_model->rpt_general('rpt_'.$type, 'REQUISICIONES POR OT', $result["columns"], $result["rows"],$result["group"]); break; case 'listar_control_pesos1': case 'listar_control_pesos2': case 'listar_control_pesos3': case 'listar_control_pesos4': case 'listar_control_pesos5': case 'listar_control_pesos': $arr_export_detalle = array(); $arr_columns[]['STRING'] = 'NRO.OT'; $arr_columns[]['STRING'] = 'NOMBRE'; $arr_columns[]['STRING'] = 'PROYECTO'; $arr_columns[]['STRING'] = 'TIPO PRODUCTO'; $arr_columns[]['DATE'] = 'F.INICIO'; $arr_columns[]['DATE'] = 'F.TERMINO'; $arr_columns[]['NUMERIC'] = 'W.REQUISICION'; $arr_columns[]['NUMERIC'] = 'W.PPTO.'; //$arr_columns[]['NUMERIC'] = 'W.METRADO'; $arr_columns[]['NUMERIC'] = 'W.O.TECNICA'; $arr_columns[]['NUMERIC'] = 'W.GALVANIZADO'; $arr_columns[]['NUMERIC'] = 'W.PRODUCCION'; $arr_columns[]['NUMERIC'] = 'W.ALMACEN'; $arr_group = array(); $this->reports_model->rpt_general('rpt_'.$type,'Control de pesos',$arr_columns,$result["rows"],$arr_group); break; case'productos_x_ot': $arr_export_detalle = array(); $arr_columns[]['STRING'] = 'NRO.OT'; $arr_columns[]['STRING'] = 'T.TORRE'; $arr_columns[]['STRING'] = 'CODIGO'; $arr_columns[]['STRING'] = 'FAMILIA'; $arr_columns[]['STRING'] = 'DESCRIPCION'; $arr_columns[]['NUMERIC'] = 'INGRESO'; $arr_columns[]['NUMERIC'] = 'SALIDA'; $arr_columns[]['NUMERIC'] = 'SALDO'; $arr_columns[]['NUMERIC'] = 'INGRESO'; $arr_columns[]['NUMERIC'] = 'SALIDA'; $arr_columns[]['NUMERIC'] = 'SALDO'; $arr_group = array('E5:G5'=>'CANTIDAD','H5:K5'=>'MONTO'); $arr_group = array(); $this->reports_model->rpt_general('rpt_'.$type,'pRODUCTOS POR OT',$arr_columns,$result["rows"],$arr_group); break; } }else{ echo "<div style='color:rgb(150,150,150);padding:10px;width:560px;height:160px;border:1px solid rgb(210,210,210);'> No hay datos para exportar </div>"; } } }
ccjuantrujillo/cepreadm
application/controllers/ventas/matricula.php
PHP
mit
18,373
#include "Pch.h" #include "EngineCore.h" #include "GetTextDialog.h" #include "KeyStates.h" //----------------------------------------------------------------------------- GetTextDialog* GetTextDialog::self; //================================================================================================= GetTextDialog::GetTextDialog(const DialogInfo& info) : DialogBox(info), singleline(true) { } //================================================================================================= void GetTextDialog::Draw(ControlDrawData* cdd/* =nullptr */) { GUI.DrawSpriteFull(tBackground, Color::Alpha(128)); GUI.DrawItem(tDialog, global_pos, size, Color::Alpha(222), 16); for(int i = 0; i < 2; ++i) bts[i].Draw(); Rect r = { global_pos.x + 16,global_pos.y + 16,global_pos.x + size.x,global_pos.y + size.y }; GUI.DrawText(GUI.default_font, text, DTF_CENTER, Color::Black, r); textBox.Draw(); } //================================================================================================= void GetTextDialog::Update(float dt) { textBox.mouse_focus = focus; if(Key.Focus() && focus) { for(int i = 0; i < 2; ++i) { bts[i].mouse_focus = focus; bts[i].Update(dt); if(result != -1) goto got_result; } textBox.focus = true; textBox.Update(dt); if(textBox.GetText().empty()) bts[1].state = Button::DISABLED; else if(bts[1].state == Button::DISABLED) bts[1].state = Button::NONE; if(result == -1) { if(Key.PressedRelease(VK_ESCAPE)) result = BUTTON_CANCEL; else if(Key.PressedRelease(VK_RETURN)) { if(!textBox.IsMultiline() || Key.Down(VK_SHIFT)) { Key.SetState(VK_RETURN, IS_UP); result = BUTTON_OK; } } } if(result != -1) { got_result: if(result == BUTTON_OK) *input = textBox.GetText(); GUI.CloseDialog(this); if(event) event(result); } } } //================================================================================================= void GetTextDialog::Event(GuiEvent e) { if(e == GuiEvent_GainFocus) { textBox.focus = true; textBox.Event(GuiEvent_GainFocus); } else if(e == GuiEvent_LostFocus || e == GuiEvent_Close) { textBox.focus = false; textBox.Event(GuiEvent_LostFocus); } else if(e == GuiEvent_WindowResize) { self->pos = self->global_pos = (GUI.wnd_size - self->size) / 2; self->bts[0].global_pos = self->bts[0].pos + self->global_pos; self->bts[1].global_pos = self->bts[1].pos + self->global_pos; self->textBox.global_pos = self->textBox.pos + self->global_pos; } else if(e >= GuiEvent_Custom) { if(e == Result_Ok) result = BUTTON_OK; else if(e == Result_Cancel) result = BUTTON_CANCEL; } } //================================================================================================= GetTextDialog* GetTextDialog::Show(const GetTextDialogParams& params) { if(!self) { DialogInfo info; info.event = nullptr; info.name = "GetTextDialog"; info.parent = nullptr; info.pause = false; info.order = ORDER_NORMAL; info.type = DIALOG_CUSTOM; self = new GetTextDialog(info); self->bts.resize(2); Button& bt1 = self->bts[0], &bt2 = self->bts[1]; bt1.id = Result_Cancel; bt1.size = Int2(100, 40); bt1.parent = self; bt2.id = Result_Ok; bt2.size = Int2(100, 40); bt2.parent = self; self->textBox.pos = Int2(25, 60); } self->Create(params); GUI.ShowDialog(self); return self; } //================================================================================================= void GetTextDialog::Create(const GetTextDialogParams& params) { Button& bt1 = bts[0], &bt2 = bts[1]; int lines = params.lines; if(!params.multiline || params.lines < 1) lines = 1; size = Int2(params.width, 180 + lines * 20); textBox.size = Int2(params.width - 50, 15 + lines * 20); textBox.SetMultiline(params.multiline); textBox.limit = params.limit; textBox.SetText(params.input->c_str()); // ustaw przyciski bt1.pos = Int2(size.x - 100 - 16, size.y - 40 - 16); bt2.pos = Int2(16, size.y - 40 - 16); if(params.custom_names) { bt1.text = (params.custom_names[0] ? params.custom_names[0] : GUI.txCancel); bt2.text = (params.custom_names[1] ? params.custom_names[1] : GUI.txOk); } else { bt1.text = GUI.txCancel; bt2.text = GUI.txOk; } // ustaw parametry result = -1; parent = params.parent; order = parent ? static_cast<DialogBox*>(parent)->order : ORDER_NORMAL; event = params.event; text = params.text; input = params.input; // ustaw pozycjê pos = global_pos = (GUI.wnd_size - size) / 2; bt1.global_pos = bt1.pos + global_pos; bt2.global_pos = bt2.pos + global_pos; textBox.global_pos = textBox.pos + global_pos; }
lcs2/carpg
project/source/engine/gui/GetTextDialog.cpp
C++
mit
4,677
import { module, test } from 'qunit'; import { setupApplicationTest } from 'ember-qunit'; import { currentURL, visit, fillIn, click } from '@ember/test-helpers'; import hasEmberVersion from 'ember-test-helpers/has-ember-version'; import Pretender from 'pretender'; import { invalidateSession, authenticateSession, currentSession } from 'ember-simple-auth/test-support'; import config from '../../config/environment'; module('Acceptance: Authentication', function(hooks) { setupApplicationTest(hooks); let server; hooks.afterEach(function() { if (server) { server.shutdown(); } }); test('logging in with correct credentials works', async function(assert) { server = new Pretender(function() { this.post(`${config.apiHost}/token`, () => [200, { 'Content-Type': 'application/json' }, '{ "access_token": "secret token!", "account_id": 1 }']); this.get(`${config.apiHost}/accounts/1`, () => [200, { 'Content-Type': 'application/json' }, '{ "data": { "type": "accounts", "id": "1", "attributes": { "login": "letme", "name": "Some person" } } }']); }); await invalidateSession(); await visit('/login'); await fillIn('[data-test-identification]', 'identification'); await fillIn('[data-test-password]', 'password'); await click('button[type="submit"]'); assert.equal(currentURL(), '/'); }); test('logging in with incorrect credentials shows an error', async function(assert) { server = new Pretender(function() { this.post(`${config.apiHost}/token`, () => [400, { 'Content-Type': 'application/json' }, '{ "error": "invalid_grant" }']); }); await invalidateSession(); await visit('/login'); await fillIn('[data-test-identification]', 'identification'); await fillIn('[data-test-password]', 'wrong-password!'); await click('button[type="submit"]'); assert.equal(currentURL(), '/login'); assert.ok(document.querySelector('[data-test-error-message]')); }); module('the protected route', function() { if (!hasEmberVersion(2, 4)) { // guard against running test module on unsupported version (before 2.4) return; } test('cannot be visited when the session is not authenticated', async function(assert) { await invalidateSession(); await visit('/protected'); assert.equal(currentURL(), '/login'); }); test('can be visited when the session is authenticated', async function(assert) { server = new Pretender(function() { this.get(`${config.apiHost}/posts`, () => [200, { 'Content-Type': 'application/json' }, '{"data":[]}']); }); await authenticateSession({ userId: 1, otherData: 'some-data' }); await visit('/protected'); let session = currentSession(); assert.equal(currentURL(), '/protected'); assert.equal(session.get('data.authenticated.userId'), 1); assert.equal(session.get('data.authenticated.otherData'), 'some-data'); }); }); module('the protected route in the engine', function() { test('cannot be visited when the session is not authenticated', async function(assert) { await invalidateSession(); await visit('/engine'); assert.equal(currentURL(), '/login'); }); test('can be visited when the session is authenticated', async function(assert) { server = new Pretender(function() { this.get(`${config.apiHost}/posts`, () => [200, { 'Content-Type': 'application/json' }, '{"data":[]}']); }); await authenticateSession({ userId: 1, otherData: 'some-data' }); await visit('/engine'); assert.equal(currentURL(), '/engine'); let session = currentSession(); assert.equal(session.get('data.authenticated.userId'), 1); assert.equal(session.get('data.authenticated.otherData'), 'some-data'); }); test('can invalidate the session', async function(assert) { server = new Pretender(function() { this.get(`${config.apiHost}/posts`, () => [200, { 'Content-Type': 'application/json' }, '{"data":[]}']); }); await authenticateSession({ userId: 1, otherData: 'some-data' }); await visit('/engine'); await click('[data-test-logout-button]'); let session = currentSession(); assert.notOk(session.get('isAuthenticated')); }); }); module('the login route', function() { if (!hasEmberVersion(2, 4)) { // guard against running test module on unsupported version (before 2.4) return; } test('can be visited when the session is not authenticated', async function(assert) { await invalidateSession(); await visit('/login'); assert.equal(currentURL(), '/login'); }); test('cannot be visited when the session is authenticated', async function(assert) { await authenticateSession(); await visit('/login'); assert.equal(currentURL(), '/'); }); }); });
simplabs/ember-simple-auth
packages/classic-test-app/tests/acceptance/authentication-test.js
JavaScript
mit
4,913
# Algorithm-Learning For study algorithm ,if the file you need,welcome. Now is the beganing for Study Algorithm author:bss.If you have any quetion about these demo,please email ... The folder named Algorithm_Cplus,I practice alorithm use c++,by eclipse IDE. Study_Algorithm_Cplus is the workspace.
shuxiashusheng/Algorithm-Learning
README.md
Markdown
mit
300
import * as React from 'react'; import {SvgIconProps} from '../../SvgIcon'; export default function SpeakerNotes(props: SvgIconProps): React.ReactElement<SvgIconProps>;
mattiamanzati/typings-material-ui
svg-icons/action/speaker-notes.d.ts
TypeScript
mit
170
### String Special Operators ### Assume string variable a holds 'Hello' and variable b holds 'Python', then − | Operator | Description | Example | |------------:|:--------------------------------------------------------------------------------------|:------------------------------| | + | Concatenation - Adds values on either side of the operator | a + b will give HelloPython | | * | Repetition - Creates new strings, concatenating multiple copies of the same string | a*2 will give -HelloHello | | [] | Slice - Gives the character from the given index | a[1] will give e | | [ : ] | Range Slice - Gives the characters from the given range | a[1:4] will give ell | | in | Membership - Returns true if a character exists in the given string | H in a will give 1 | | not in | Membership - Returns true if a character does not exist in the given string | M not in a will give 1 | | r/R | Raw String - Suppresses actual meaning of Escape characters. The syntax for raw strings is exactly the same as for normal strings with the exception of the raw string operator, the letter "r," which precedes the quotation marks. The "r" can be lowercase (r) or uppercase (R) and must be placed immediately preceding the first quote mark. | print r'\n' prints \n and print R'\n'prints \n | | % | Format - Performs String formatting | See at next section |
udoyen/pythonlearning
datatypes/string_special_operators.md
Markdown
mit
1,746
require 'ostruct' module AmberbitConfig # Main class that holds whole configuration, acts as open struct, with few tune ups class HashStruct < ::OpenStruct # Initialize with check for conflicts within hash keys def initialize(hash = nil) check_hash_for_conflicts hash if hash super end # Adds access to existing keys through hash operator def [](key) self.send key unless key == nil end # Generates a nested Hash object which is a copy of existing configuration def to_hash _copy = {} @table.each { |key, value| _copy[key] = value.is_a?(HashStruct) ? value.to_hash : value } _copy end # Raise an error if method/configuration isn't set yet. It should prevent typos, because normally it will just # return a nil. With this check you can spot those earlier. def method_missing(method, *args, &block) if method =~ /=\z/ || self.respond_to?(method) super else raise ConfigNotSetError, "Configuration option: '#{method}' was not set" end end # Creates a deeply nested HashStruct from hash. def self.create(object) case object when Array object.map { |item| create(item) } when Hash mapped = {} object.each { |key, value| mapped[key] = create(value) } HashStruct.new mapped else object end end private # Checks if provided option is a hash and if the keys are not in confict with OpenStruct public methods. def check_hash_for_conflicts(hash) raise HashArgumentError, 'It must be a hash' unless hash.is_a?(Hash) unless (conflicts = self.public_methods & hash.keys.map(&:to_sym)).empty? raise HashArgumentError, "Rename keys in order to avoid conflicts with internal calls: #{conflicts.join(', ')}" end end end end
amberbit/amberbit-config
lib/amberbit-config/hash_struct.rb
Ruby
mit
1,867
# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::RecoveryServicesBackup::Mgmt::V2019_05_13 module Models # # Yearly retention schedule. # class YearlyRetentionSchedule include MsRestAzure # @return [RetentionScheduleFormat] Retention schedule format for yearly # retention policy. Possible values include: 'Invalid', 'Daily', 'Weekly' attr_accessor :retention_schedule_format_type # @return [Array<MonthOfYear>] List of months of year of yearly retention # policy. attr_accessor :months_of_year # @return [DailyRetentionFormat] Daily retention format for yearly # retention policy. attr_accessor :retention_schedule_daily # @return [WeeklyRetentionFormat] Weekly retention format for yearly # retention policy. attr_accessor :retention_schedule_weekly # @return [Array<DateTime>] Retention times of retention policy. attr_accessor :retention_times # @return [RetentionDuration] Retention duration of retention Policy. attr_accessor :retention_duration # # Mapper for YearlyRetentionSchedule class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'YearlyRetentionSchedule', type: { name: 'Composite', class_name: 'YearlyRetentionSchedule', model_properties: { retention_schedule_format_type: { client_side_validation: true, required: false, serialized_name: 'retentionScheduleFormatType', type: { name: 'String' } }, months_of_year: { client_side_validation: true, required: false, serialized_name: 'monthsOfYear', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'MonthOfYearElementType', type: { name: 'Enum', module: 'MonthOfYear' } } } }, retention_schedule_daily: { client_side_validation: true, required: false, serialized_name: 'retentionScheduleDaily', type: { name: 'Composite', class_name: 'DailyRetentionFormat' } }, retention_schedule_weekly: { client_side_validation: true, required: false, serialized_name: 'retentionScheduleWeekly', type: { name: 'Composite', class_name: 'WeeklyRetentionFormat' } }, retention_times: { client_side_validation: true, required: false, serialized_name: 'retentionTimes', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'DateTimeElementType', type: { name: 'DateTime' } } } }, retention_duration: { client_side_validation: true, required: false, serialized_name: 'retentionDuration', type: { name: 'Composite', class_name: 'RetentionDuration' } } } } } end end end end
Azure/azure-sdk-for-ruby
management/azure_mgmt_recovery_services_backup/lib/2019-05-13/generated/azure_mgmt_recovery_services_backup/models/yearly_retention_schedule.rb
Ruby
mit
4,112
<!DOCTYPE html><body> <div class="syndicate"> <div class="mSyndicate"> <h1>Press Release</h1> <div class="rounders grey"> <div class="inner"> <div class="t"></div> <p style="margin-bottom:0px;"><span class="green">For Immediate Release:</span> August 9, 2012<br/> <span class="green">Contact:</span><a href="http://www.cdc.gov/media"> Division of News &amp; Electronic Media</a>, Office of Communication<br/> (404) 639-3286</p> </div> <div class="b"> <div></div> </div> </div> <h2>Gradual drop in youth tobacco use continues, but significant problem areas remain</h2> <p><em>Surgeon General's Report outlines key steps to further reducing tobacco use among youth</em></p> <p>Tobacco use among American middle school and high school students showed a slow decline from 2000 to 2011, according to a report from the Centers for Disease Control and Prevention  But when compared with other long-term studies, such as the Youth Risk Behavior Survey, the steep rate of decline from 1997 to 2003 has slowed noticeably. The report published today shows that in 2011 nearly 30 percent of high school males and 18 percent of high school females used some form of tobacco. More than 8 percent of middle school males and nearly 6 percent of middle school females used some form of tobacco in 2011.</p> <p>The report indicates that though tobacco use continued an 11-year downward trend, tobacco use remains high among high school students. For example, among black high school students, cigar use increased significantly from 7.1 percent in 2009 to 11.7 percent in 2011. In 2011, cigar use among high school males (15.7 percent) was comparable to cigarette use (17.7 percent). Cigar use includes the use of cigarette-like cigars that can be packaged and smoked like typical cigarettes, but are taxed at a lower rate, making them more appealing and accessible to youth.  While they contain the same toxic chemicals as cigarettes, no cigars are subject to restrictions on flavorings and misleading descriptors such as “light” or “low tar,” according to the report.</p> <p>Nearly 25 percent of high school males and more than 17 percent of high school females used some form of smoked tobacco product in 2011, while smokeless tobacco use among high school males (12.9 percent) was 8 times higher than among high school females (1.6 percent).</p> <p>“An overall decline in tobacco use is good news, but although 4 out of 5 teens don't smoke, far too many kids start to smoke every day,” said CDC Director Thomas R. Frieden, M.D., M.P.H.  “Most tobacco use begins and becomes established during adolescence. This report is further evidence that we need to do more to prevent our nation’s youth from establishing a deadly addiction to tobacco.”<br/> <br/> The study, “Current Tobacco Use Among Middle and High School Students—United States, 2011,” published in this week’s Morbidity and Mortality Weekly Report reported no significant declines in the use of any tobacco product among middle school students from 2009 to 2011.  However, cigarette use declined from 19.2 percent in 2009 to 15.8 percent among Hispanic high school students. </p> <p>The report reaffirms the need to return youth tobacco use trends to the more rapid rate of decline seen from the late 1990s through 2003. To further reduce tobacco use among young people, the <a href="http://www.cdc.gov/tobacco/data_statistics/sgr/2012/">2012 Surgeon General’s Report</a> recommends making tobacco products less affordable, running hard-hitting mass media campaigns, and evidence-based tobacco control and prevention programs that work in conjunction with new restrictions on the sale, distribution, and marketing of cigarettes and other tobacco products to youth.</p> <p>Tobacco use remains the leading cause of preventable death and disease in the United States.  Cigarette use and exposure to secondhand tobacco smoke kill an estimated 443,000 Americans each year.  The health consequences of tobacco use include heart disease, multiple types of cancer, lung disease, adverse reproductive effects, and the worsening of chronic health conditions.  Yet nearly 4,000 kids under age 18 try their first cigarette every day.  In addition to the cost in human lives, cigarette smoking has been estimated to cost $193 billion annually in direct health care expenses and lost productivity. </p> <p>For an online version of this <em>MMWR</em> report, visit <a href="http://www.cdc.gov/mmwr">http://www.cdc.gov/mmwr</a>. For quitting assistance, call 1-800-QUIT-NOW (1-800-784-8669) or visit <a href="file:///C:\Users\iqj8\AppData\Local\Microsoft\Windows\Temporary%20Internet%20Files\Content.Outlook\8MWGDF7J\www.smokefree.gov">www.smokefree.gov</a>. For more state-specific tobacco data, visit <em>CDC's State Tobacco Activities Tracking and Evaluation System</em> at <a href="http://www.cdc.gov/tobacco/statesystem">http://www.cdc.gov/tobacco/statesystem</a>.</p> <p style="text-align:center;">###<br/> <a href="http://www.hhs.gov/">U.S. DEPARTMENT OF HEALTH AND HUMAN SERVICES</a></p> <p><a href="http://www.cdc.gov/24-7/"><em>CDC works 24/7</em></a><em> saving lives and protecting people from health threats to have a more secure nation. Whether these threats are chronic or acute, manmade or natural, human error or deliberate attack, global or domestic, CDC is the U.S. health protection agency. </em></p> </div> </div> </body></html>
thomasnat1/DataScience2014CDC
scraped/media$releases$2012$p0809_youth_tobacco.html.html
HTML
mit
5,942
<?php /** * Created by PhpStorm. * User: lenovo * Date: 02/08/2016 * Time: 16.37 */ class News_m extends CI_Model{ function m_get_news($limit=null,$offset=null){ if($limit!==null && $offset !== null){ $this->db->limit($limit,$offset); } if(isset($_GET["id"])) { return $this->db->order_by("date_created","desc") ->where("news_category_id", $_GET["id"]) ->get("sc_news") ->result_array(); } return $this->db->order_by("date_created","desc") ->get("sc_news") ->result_array(); } function m_get_news_by_id($news_id){ return $this->db->where("news_id",$news_id) ->get("sc_news")->row_array(); } function m_get_detail($id) { return $this->db->where("news_id", $id) ->from("sc_news") ->join("sc_news_category", "sc_news.news_category_id = sc_news_category.news_category_id") ->get()->row_array(); } function m_get_category() { return $this->db->get("sc_news_category")->result_array(); } } //asdn
Calvinn097/servermedan
application/models/MAIN/News_m.php
PHP
mit
1,108
ember-assign-polyfill ============================================================================== <a href="https://shipshape.io/"><img src="http://i.imgur.com/DWHQjA5.png" width="100" height="100"/></a> **[ember-assign-polyfill is built and maintained by Ship Shape. Contact us for Ember.js consulting, development, and training for your project](https://shipshape.io/ember-consulting)**. [![npm version](https://badge.fury.io/js/ember-assign-polyfill.svg)](http://badge.fury.io/js/ember-assign-polyfill) ![Download count all time](https://img.shields.io/npm/dt/ember-assign-polyfill.svg) [![npm](https://img.shields.io/npm/dm/ember-assign-polyfill.svg)]() [![Ember Observer Score](https://emberobserver.com/badges/ember-assign-polyfill.svg)](https://emberobserver.com/addons/ember-assign-polyfill) [![Build Status](https://travis-ci.org/shipshapecode/ember-assign-polyfill.svg?branch=master)](https://travis-ci.org/shipshapecode/ember-assign-polyfill) This provides a polyfill for the Ember.assign feature added in Ember 2.5. Installation ------------------------------------------------------------------------------ ``` ember install ember-assign-polyfill ``` Usage ------------------------------------------------------------------------------ ```js import Ember from 'ember'; var a = { first: 'Robert' }; var b = { last: 'Wagner' }; var c = { company: 'Ship Shape' }; Ember.assign(a, b, c); // a === { first: 'Robert', last: 'Wagner', company: 'Ship Shape' }, b === { last: 'Wagner' }, c === { company: 'Ship Shape' } ``` Migration ------------------------------------------------------------------------------ ### Applications After you upgrade your application to Ember 2.5, you should remove ember-assign-polyfill from your package.json. ### Addons Addons generally support many different Ember versions, so leaving ember-assign-polyfill in place for consumers of your addon is perfectly normal. When the addon no longer supports Ember versions older than 2.5, we recommend removing ember-assign-polyfill from your package.json and doing a major version bump. Contributing ------------------------------------------------------------------------------ See the [Contributing](CONTRIBUTING.md) guide for details. License ------------------------------------------------------------------------------ This project is licensed under the [MIT License](LICENSE.md).
shipshapecode/ember-assign-polyfill
README.md
Markdown
mit
2,391
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ExtractEmails")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ExtractEmails")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("06f60f4e-3cf1-432e-b0e8-edf4c7631b37")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
zdzdz/CSharp-Part-2-Homeworks
06. Strings-And-Text-Processing-HW/ExtractEmails/Properties/AssemblyInfo.cs
C#
mit
1,402
from flask import Flask, jsonify, request, redirect, url_for import subprocess import os import json from cross_domain import * app = Flask(__name__) ALLOWED_EXTENSIONS = set(['mol', 'smi']) try: TARGET = os.environ['TARGET'] except Exception: print 'export TARGET=<path to data>' exit(1) try: AlGDock = os.environ['AlGDock_Pref'] except Exception: print 'export AlGDock_Pref=<path to BindingPMF_arguments.py>' exit(1) import sys sys.path.insert(0, AlGDock) from BindingPMF_arguments import * #File system functions @app.route('/api/v1.0/proteins', methods=['GET', 'OPTIONS']) @crossdomain(origin='*') def get_protein_names(): proteins = os.walk(TARGET).next()[1] protein_lst = [{"filename": protein} for protein in sorted(proteins) if protein != "scripts"] return jsonify({"files": protein_lst}) @app.route('/api/v1.0/ligands/<protein>', methods=['GET', 'OPTIONS']) @crossdomain(origin='*') def get_ligand_names(protein): ligands = os.walk(os.path.join(TARGET, protein, "ligand")).next()[2] ligand_lst = [{"filename": ligand} for ligand in sorted(ligands) if ".ism" in ligand] return jsonify({"files": ligand_lst}) @app.route('/api/v1.0/ligandSelection/<protein>/<library>', methods=['GET', 'OPTIONS']) @crossdomain(origin='*') def get_ligand_selections(protein, library): trimmed_library = library.split(".ism")[0] + ".A__" try: ligand_selections = sorted(os.walk(os.path.join(TARGET, protein, "AlGDock/cool", trimmed_library)).next()[1]) except Exception: ligand_selections = None return jsonify({"ligandSelections": ligand_selections}) @app.route('/api/v1.0/ligandLine/<protein>/<library>/<lineNumber>', methods=['GET', 'OPTIONS']) @crossdomain(origin='*') def get_ligand_line(protein, library, lineNumber): try: path = os.path.join(TARGET, protein, "ligand", library) library_f = open(path, 'r') for i, line in enumerate(library_f): if i == int(lineNumber) - 1: return line.split()[0] library_f.close() except Exception: return None @app.route('/api/v1.0/addToLibrary/<protein>/', methods=['POST', 'OPTIONS']) @crossdomain(origin='*') def add_to_library(protein): fileJson = request.get_json() libraryName = fileJson["libraryName"] smiles = fileJson["smiles"] path = os.path.join(TARGET, protein, "ligand", libraryName) library_f = open(path, 'a') library_f.write(smiles) library_f.write("\n") library_f.close() return "Added ligand to library." #Gets for preference dropdowns @app.route('/api/v1.0/protocols', methods=['GET', 'OPTIONS']) @crossdomain(origin='*') def get_protocols(): choices = arguments['protocol']['choices'] choice_lst = [{"choice": choice} for choice in choices] return jsonify({"protocol": choice_lst}) @app.route('/api/v1.0/samplers', methods=['GET', 'OPTIONS']) @crossdomain(origin='*') def get_samplers(): choices = arguments['sampler']['choices'] choice_lst = [{"choice": choice} for choice in choices] return jsonify({"sampler": choice_lst}) @app.route('/api/v1.0/sites', methods=['GET', 'OPTIONS']) @crossdomain(origin='*') def get_sites(): choices = arguments['site']['choices'] choice_lst = [{"choice": choice} for choice in choices] return jsonify({"site": choice_lst}) @app.route('/api/v1.0/phases', methods=['GET', 'OPTIONS']) @crossdomain(origin='*') def get_phases(): choices = allowed_phases choice_lst = [{"choice": choice} for choice in choices] return jsonify({"phase": choice_lst}) @app.route('/api/v1.0/runtypes', methods=['GET', 'OPTIONS']) @crossdomain(origin='*') def get_runtype(): choices = arguments['run_type']['choices'] choice_lst = [{"choice": choice} for choice in choices] return jsonify({"runtype": choice_lst}) #Saving preferences file @app.route('/api/v1.0/run/<protein>/<protocol>/<runtype>/<cthermspeed>/<dthermspeed>/<sampler>/<mcmc>/<seedsperstate>/<stepsperseed>/<sweepspercycle>/<attemptspersweep>/<stepspersweep>/<crepxcycles>/<drepxcycles>/<site>/<sxcenter>/<sycenter>/<szcenter>/<sradius>/<sdensity>/<phase>/<cores>/<score>/<from_reps>/<to_reps>/<rmsd>', methods=['GET', 'OPTIONS']) @crossdomain(origin='*') def save_preferences(protein, protocol, runtype, cthermspeed, dthermspeed, sampler, mcmc, seedsperstate, stepsperseed, sweepspercycle, attemptspersweep, stepspersweep, crepxcycles, drepxcycles, site, sxcenter, sycenter, szcenter, sradius, sdensity, phase, cores, score, from_reps, to_reps, rmsd): rmsd_n = " " score_n = " " if rmsd == "false": rmsd_n = "#" if score == "Score" or score == "None": score_n = "#" args = ["./create_saved_args.sh", runtype, protocol, cthermspeed, dthermspeed, sampler, mcmc, seedsperstate, stepsperseed, sweepspercycle, attemptspersweep, stepspersweep, crepxcycles, drepxcycles, site, sxcenter, sycenter, szcenter, sradius, sdensity, phase, cores, score, from_reps, to_reps, rmsd, score_n, rmsd_n] p = subprocess.Popen(args, stdout=subprocess.PIPE) f = open(os.path.join(TARGET, protein, "AlGDock/saved_arguments.py"), 'w') f.write(p.stdout.read()) f.close() return "Preferences File Saved" #Run button @app.route('/api/v1.0/run/<protein>/<ligand>/<email>', methods=['GET', 'OPTIONS']) @crossdomain(origin='*') def run(protein, ligand, email): run_string = "python " + os.path.join(AlGDock, "../Pipeline/run_anchor_and_grow.py") + " --max_jobs 20 --email " + email + " --ligand " + os.path.join(TARGET, protein, "ligand/dock_in", ligand.split(".ism")[0] + ".A__") os.chdir(os.path.join(TARGET, protein, "dock6")) print run_string os.system(run_string) return "Job Sent to Cluster" #Prepare ligands button @app.route('/api/v1.0/prepLigandLibrary/<protein>/<ligand>/<email>', methods=['GET', 'OPTIONS']) @crossdomain(origin='*') def prepareLigandLibrary(protein, ligand, email): run_string = "python " + os.path.join(AlGDock, "../Pipeline/run_prep_ligand_for_dock.py") + " " + ligand + " --email " + email os.chdir(os.path.join(TARGET, protein, "ligand")) print run_string os.system(run_string) return "Ligand is being prepared." if __name__ == '__main__': app.run(debug=True)
gkumar7/AlGDock
gui/api/REST.py
Python
mit
6,256
/**************************************************************************** * positive2.c * * Computer Science 50 * David J. Malan * * Demands that user provide a positive number. * * Demonstrates use of bool. ***************************************************************************/ #include <cs50.h> #include <stdio.h> int main(void) { // loop until user provides a positive integer bool thankful = false; do { printf("I demand that you give me a positive integer: "); if (GetInt() > 0) thankful = true; } while (thankful == false); printf("Thanks for the positive integer!\n"); }
feliposz/learning-stuff
harvard-cs50/src1/positive2.c
C
mit
655
const crypto = require('crypto'); const passwordHashAlgorithm = 'sha1'; module.exports = function(client) { var computeSHA1 = function(str) { return crypto.createHash(passwordHashAlgorithm).update(str).digest('hex'); }; var user = { addUser: function(email, password, callback) { client.incr('global:userId', function(error, id) { if(error) { callback(false); return; }; id --; console.log('Dodaje user z id ' + id); client.setnx('user:' + email + ':id', id, function(error, set) { if (error) { console.log('Error ' + error); callback(false); return; }; console.log('Set ' + set); if (set == 0) { callback(false, 'User ' + email + ' is registred'); return; }; client .multi() .set('user:'+id+':email', email) .set('user:' + id + ':password', computeSHA1(password)) .exec(function(error, results) { if (error) { callback(false); return; }; callback(true); return; }); }); }); }, getUserWithEmail: function(email, callback) { client.get('user:' + email.toLowerCase() + ':id', function(error,id) { if(error) { callback(null); return; } if (id == null) { callback(null); return; } user.getUserWithId(id, callback); }); }, getUserWithId: function(id, callback) { client .multi() .get('user:' + id + ':email') .exec(function(error, results) { if (error) { callback(null); return; } callback({ id: id, email: results[0] }); }); }, validateUser: function(email, password, callback) { user.getUserWithEmail(email, function(user) { if(user == null) { callback(false); return; } client.get('user:' + user.id + ':password', function(error, passwordF) { if(error) { callback(false); return; } callback(computeSHA1(password) == passwordF); }); }); }, }; return user; }; // //user.addUser('test2@o2.pl', 'test', function(result, msg) { // if(result) { // console.log('jest ok'); // } else { // console.log('Error: ' + msg); // } //}); // //user.validateUser('test3@o2.pl', 'test', function(result) { // console.log('Validate: ' + result); //}); // client.set("string key", "string val", redis.print); // client.hset("hash key", "hashtest 1", "some value", redis.print); // client.hset(["hash key", "hashtest 2", "some other value"], redis.print); // client.hkeys("hash key", function (err, replies) { // console.log(replies.length + " replies:"); // replies.forEach(function (reply, i) { // console.log(" " + i + ": " + reply); // }); // client.quit(); // });
yoman07/GeoChatServer
db.js
JavaScript
mit
3,170