text
stringlengths
4
5.48M
meta
stringlengths
14
6.54k
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; namespace Demo.UWP { public sealed partial class MainPage { public MainPage() { this.InitializeComponent(); LoadApplication(new Demo.App()); } } }
{'content_hash': 'e810d35c741de546111160915d58969b', 'timestamp': '', 'source': 'github', 'line_count': 27, 'max_line_length': 52, 'avg_line_length': 21.62962962962963, 'alnum_prop': 0.7808219178082192, 'repo_name': 'duanenewman/Talks', 'id': 'da0f5e8f8231048983c51d00288d511acb676322', 'size': '586', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Xamarin Forms/Writing One App to Rule All Your Platforms/Demo/Demo.UWP/MainPage.xaml.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ASP', 'bytes': '2304'}, {'name': 'C#', 'bytes': '102504'}, {'name': 'Pascal', 'bytes': '142'}]}
title: I would prefer not to categories: Instalation Performance 2017 intro: This work is a telephone performance. A telephone ringing until someone picks it up. A fragmented narration on resistance, string theory and Bartleby the escrivener. featured_image: /media/images/IWouldPreferNotTo1.jpg published: true home_show: false date: 2017-05-06 00:00:00 +0100 --- I would prefer not to is a performance by phone. The main actors are the people picking up the ringing phone exposed in the exhibition room. On my way walking towards home I start a monolog conversation, a narration by phone and leave each listener with a small piece of the story. The story is never complete but on the other hand is it ever? The work was shown the 5th of may at Sala Usurpada a squatted exhibition place in Gacia, Barcelona: Trece ______ para una alteración. The selected artists were asked to occupy the room during 30 minutes. The event was composed by Gerard Ballester and Helena Vinent. Amongst the participating artists: Lucía Egaña, Marc Vives, Isamit Morales, Ariadna Guiteras, Nenazas, José Begega, Alexander Arilla and Sergi Botella. ![image](/media/images/Cartelsmall.jpg) ![image](/media/images/IWouldPreferNotTo2.jpg) ![image](/media/images/IWouldPreferNotTo3.jpg) ![image](/media/images/IWouldPreferNotTo4.jpg) [This is the project's event ](https://www.facebook.com/events/1360062054076936/)
{'content_hash': '73851467fbe1ed63e97ea84099ad4b35', 'timestamp': '', 'source': 'github', 'line_count': 29, 'max_line_length': 443, 'avg_line_length': 48.62068965517241, 'alnum_prop': 0.7836879432624113, 'repo_name': 'FctsFxns/schultzen-web', 'id': '27c7ffe7a2a21d07cc86758e6fe4228ad52fe19d', 'size': '1418', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': '_works/IwouldPreferNotTo.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'HTML', 'bytes': '36617'}, {'name': 'JavaScript', 'bytes': '156371'}, {'name': 'Less', 'bytes': '234972'}, {'name': 'PowerShell', 'bytes': '468'}, {'name': 'Rich Text Format', 'bytes': '1448'}, {'name': 'Ruby', 'bytes': '931'}, {'name': 'SCSS', 'bytes': '3412'}, {'name': 'Shell', 'bytes': '2541'}]}
@interface NSTimer(ZCBlocks) +(id)scheduledTimerWithTimeInterval:(NSTimeInterval)inTimeInterval block:(void (^)())inBlock repeats:(BOOL)inRepeats; +(id)timerWithTimeInterval:(NSTimeInterval)inTimeInterval block:(void (^)())inBlock repeats:(BOOL)inRepeats; @end
{'content_hash': '0ac14150e90a31e7ad7248e754395915', 'timestamp': '', 'source': 'github', 'line_count': 4, 'max_line_length': 117, 'avg_line_length': 65.25, 'alnum_prop': 0.8045977011494253, 'repo_name': 'zhouchengtang/ZCKitFramework', 'id': '2423ca17c62af01124d6272b41447f339a3e7cf6', 'size': '423', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'ZCKit/ZCKit/ZCCategory/Foundation/NSTimer/NSTimer+ZCBlocks.h', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'Objective-C', 'bytes': '1466628'}]}
FROM balenalib/up-core-alpine:3.10-run # remove several traces of python RUN apk del python* # http://bugs.python.org/issue19846 # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 # install python dependencies RUN apk add --no-cache ca-certificates libffi \ && apk add --no-cache libssl1.0 || apk add --no-cache libssl1.1 # key 63C7CC90: public key "Simon McVittie <[email protected]>" imported # key 3372DCFA: public key "Donald Stufft (dstufft) <[email protected]>" imported RUN gpg --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \ && gpg --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \ && gpg --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059 # point Python at a system-provided certificate database. Otherwise, we might hit CERTIFICATE_VERIFY_FAILED. # https://www.python.org/dev/peps/pep-0476/#trust-database ENV SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt ENV PYTHON_VERSION 3.7.9 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" ENV PYTHON_PIP_VERSION 21.0.1 ENV SETUPTOOLS_VERSION 56.0.0 RUN set -x \ && buildDeps=' \ curl \ gnupg \ ' \ && apk add --no-cache --virtual .build-deps $buildDeps \ && curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-alpine-amd64-openssl1.1.tar.gz" \ && echo "858b9a1bfb0deb4fbfebf6c71a5d7b6b6db6ef11ccaea59266521735f81d05d0 Python-$PYTHON_VERSION.linux-alpine-amd64-openssl1.1.tar.gz" | sha256sum -c - \ && tar -xzf "Python-$PYTHON_VERSION.linux-alpine-amd64-openssl1.1.tar.gz" --strip-components=1 \ && rm -rf "Python-$PYTHON_VERSION.linux-alpine-amd64-openssl1.1.tar.gz" \ && if [ ! -e /usr/local/bin/pip3 ]; then : \ && curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \ && echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \ && python3 get-pip.py \ && rm get-pip.py \ ; fi \ && pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \ && find /usr/local \ \( -type d -a -name test -o -name tests \) \ -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ -exec rm -rf '{}' + \ && cd / \ && rm -rf /usr/src/python ~/.cache # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ && ln -sf pip3 pip \ && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -sf idle3 idle \ && ln -sf pydoc3 pydoc \ && ln -sf python3 python \ && ln -sf python3-config python-config CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/[email protected]" \ && echo "Running test-stack@python" \ && chmod +x [email protected] \ && bash [email protected] \ && rm -rf [email protected] RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: Intel 64-bit (x86-64) \nOS: Alpine Linux 3.10 \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.7.9, Pip v21.0.1, Setuptools v56.0.0 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo $'#!/bin/bash\nbalena-info\nbusybox ln -sf /bin/busybox /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && ln -f /bin/sh /bin/sh.real \ && ln -f /bin/sh-shim /bin/sh
{'content_hash': 'd2418ee7252acc987c671177566e61d3', 'timestamp': '', 'source': 'github', 'line_count': 77, 'max_line_length': 728, 'avg_line_length': 53.41558441558441, 'alnum_prop': 0.7109166058837831, 'repo_name': 'nghiant2710/base-images', 'id': '16d106067eaa4b3a308185498489a3a87ad74229', 'size': '4134', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'balena-base-images/python/up-core/alpine/3.10/3.7.9/run/Dockerfile', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Dockerfile', 'bytes': '144558581'}, {'name': 'JavaScript', 'bytes': '16316'}, {'name': 'Shell', 'bytes': '368690'}]}
namespace CrystalQuartz.Core.Domain { using System; public class TriggerData : Activity { public TriggerData(string name, ActivityStatus status) : base(name, status) { } public DateTimeOffset StartDate { get; set; } public DateTimeOffset? EndDate { get; set; } public DateTimeOffset? NextFireDate { get; set; } public DateTimeOffset? PreviousFireDate { get; set; } } }
{'content_hash': 'c996bca89045e8c91814e5c5feb7b298', 'timestamp': '', 'source': 'github', 'line_count': 19, 'max_line_length': 83, 'avg_line_length': 23.42105263157895, 'alnum_prop': 0.6337078651685393, 'repo_name': 'stevebering/CrystalQuartz', 'id': 'aff4906302c6c53e7d2a5b72c8e1541bcac51f36', 'size': '445', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/src/CrystalQuartz.Core/Domain/TriggerData.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ASP', 'bytes': '2400'}, {'name': 'C#', 'bytes': '77161'}, {'name': 'Puppet', 'bytes': '1222'}, {'name': 'Shell', 'bytes': '261'}]}
class BoardEngine::Admin::AdminsController < Admin::AdminsController before_filter :is_from_engine def is_from_engine @is_from_engine = true end end
{'content_hash': '04d72cf8c9f635b50c8c670e4e1b7ec4', 'timestamp': '', 'source': 'github', 'line_count': 7, 'max_line_length': 68, 'avg_line_length': 22.428571428571427, 'alnum_prop': 0.7579617834394905, 'repo_name': 'bayja/board_engine', 'id': 'e8b4d4c63c3ec8150adbbab609e2fe6812b3c87f', 'size': '176', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/controllers/board_engine/admin/admins_controller.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '1282'}, {'name': 'Ruby', 'bytes': '25936'}]}
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading; using Cassandra.IntegrationTests.TestBase; namespace Cassandra.IntegrationTests.TestClusterManagement { public class CcmCluster : ITestCluster { public CcmBridge CcmBridge { get; private set; } private readonly string _version; public CcmCluster(string version, string name, int dc1NodeCount, string clusterIpPrefix, string defaultKeyspace, bool isUsingDefaultConfig = true) : this(version, name, dc1NodeCount, 0, clusterIpPrefix, defaultKeyspace, isUsingDefaultConfig) { } public CcmCluster(string version, string name, int dc1NodeCount, int dc2NodeCount, string clusterIpPrefix, string defaultKeyspace, bool isUsingDefaultConfig = true) { _version = version; Name = name; Dc1NodeCount = dc1NodeCount; Dc2NodeCount = dc2NodeCount; DefaultKeyspace = defaultKeyspace; IsUsingDefaultConfig = isUsingDefaultConfig; IsCreated = false; IsBeingCreated = false; IsStarted = false; ClusterIpPrefix = clusterIpPrefix; InitialContactPoint = ClusterIpPrefix + "1"; SetExpectedHosts(); } private void SetExpectedHosts() { if (ExpectedInitialHosts == null) ExpectedInitialHosts = new List<string>(); // number of hosts should equal the total number of nodes in both data centers for (int i = 1; i <= Dc1NodeCount + Dc2NodeCount; i++) ExpectedInitialHosts.Add(ClusterIpPrefix + i); } public string Name { get; set; } public Builder Builder { get; set; } public Cluster Cluster { get; set; } public ISession Session { get; set; } public int Dc1NodeCount { get; set; } public int Dc2NodeCount { get; set; } public string InitialContactPoint { get; set; } public string ClusterIpPrefix { get; set; } public string DefaultKeyspace { get; set; } public bool IsBeingCreated { get; set; } public bool IsCreated { get; set; } public bool IsStarted { get; set; } public bool IsUsingDefaultConfig { get; set; } public bool IsRemoved { get; set; } public List<string> ExpectedInitialHosts { get; set; } // So far, for CCM only private ProcessOutput _proc { get; set; } public void Create(bool startTheCluster = true, string[] jvmArgs = null, bool useSsl = false) { // if it's already being created in another thread, then wait until this step is complete if (!IsBeingCreated) { IsBeingCreated = true; if (Dc2NodeCount > 0) CcmBridge = CcmBridge.Create(Name, ClusterIpPrefix, Dc1NodeCount, Dc2NodeCount, _version, startTheCluster); else CcmBridge = CcmBridge.Create(Name, ClusterIpPrefix, Dc1NodeCount, _version, startTheCluster, jvmArgs, useSsl); IsBeingCreated = false; IsCreated = true; if (startTheCluster) IsStarted = true; } int sleepMs = 300; int sleepMsMax = 60000; int totalMsSlept = 0; while (IsBeingCreated || !IsCreated) { Trace.TraceInformation(string.Format("Cluster with name: {0}, CcmDir: {1} is being created. Sleeping another {2} MS ... ", Name, CcmBridge.CcmDir.FullName, sleepMs)); Thread.Sleep(sleepMs); totalMsSlept += sleepMs; if (totalMsSlept > sleepMsMax) { throw new Exception("Failed to create cluster in " + sleepMsMax + " MS!"); } } } public void InitClient() { if (Cluster != null && IsStarted) Cluster.Shutdown(); if (Builder == null) Builder = new Builder(); Cluster = Builder.AddContactPoint(InitialContactPoint).Build(); Session = Cluster.Connect(); Session.CreateKeyspaceIfNotExists(DefaultKeyspace); TestUtils.WaitForSchemaAgreement(Cluster); Session.ChangeKeyspace(DefaultKeyspace); } public void ShutDown() { if (!IsStarted) return; if (Cluster != null) Cluster.Shutdown(); CcmBridge.Stop(); IsStarted = false; } public void Remove() { Trace.TraceInformation(string.Format("Removing Cluster with Name: '{0}', InitialContactPoint: {1}, and CcmDir: {2}", Name, InitialContactPoint, CcmBridge.CcmDir)); CcmBridge.SwitchToThis(); CcmBridge.Remove(); IsRemoved = true; } public void DecommissionNode(int nodeId) { CcmBridge.DecommissionNode(nodeId); } public void PauseNode(int nodeId) { CcmBridge.ExecuteCcm(string.Format("node{0} pause", nodeId)); } public void ResumeNode(int nodeId) { CcmBridge.ExecuteCcm(string.Format("node{0} resume", nodeId)); } public void SwitchToThisCluster() { CcmBridge.SwitchToThis(); } public void UseVNodes(string nodesToPopulate) { try { CcmBridge.ExecuteCcm("remove"); } catch { //Don't mind } CcmBridge.ExecuteCcm(String.Format("create {0} -v {1}", CcmBridge.Name, _version)); CcmBridge.ExecuteCcm(String.Format("populate -n {0} -i {1} --vnodes", nodesToPopulate, CcmBridge.IpPrefix), CcmBridge.DefaultCmdTimeout, true); CcmBridge.ExecuteCcm("start", CcmBridge.DefaultCmdTimeout, true); } public void SwitchToThisAndStart() { // only send the 'start' command if it isn't already in the process of starting if (!IsStarted) { SwitchToThisCluster(); Start(); } IsStarted = true; } public void StopForce(int nodeIdToStop) { CcmBridge.StopForce(nodeIdToStop); } public void Stop(int nodeIdToStop) { CcmBridge.Stop(nodeIdToStop); } public void Start() { CcmBridge.Start(); IsStarted = true; } public void Start(int nodeIdToStart, string additionalArgs = null) { CcmBridge.Start(nodeIdToStart, additionalArgs); } public void BootstrapNode(int nodeIdToStart) { CcmBridge.BootstrapNode(nodeIdToStart); } public void BootstrapNode(int nodeIdToStart, string dataCenterName) { CcmBridge.BootstrapNode(nodeIdToStart, dataCenterName); } public void UpdateConfig(params string[] yamlChanges) { if (yamlChanges == null) return; foreach (var setting in yamlChanges) { CcmBridge.ExecuteCcm("updateconf \"" + setting + "\""); } } } }
{'content_hash': '9fcc61ae3084f075fd292978de995200', 'timestamp': '', 'source': 'github', 'line_count': 214, 'max_line_length': 175, 'avg_line_length': 34.82710280373832, 'alnum_prop': 0.5628605930497786, 'repo_name': 'oguimbal/csharp-driver', 'id': 'ef4463024b96b9569b643020d8b98a7e8d3ffb5f', 'size': '7455', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/Cassandra.IntegrationTests/TestClusterManagement/CcmCluster.cs', 'mode': '33261', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '299'}, {'name': 'C#', 'bytes': '2951381'}]}
var ReactSimpleTypeahead = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _srcTypeaheadJsx = __webpack_require__(1); var _srcTypeaheadJsx2 = _interopRequireDefault(_srcTypeaheadJsx); exports['default'] = _srcTypeaheadJsx2['default']; module.exports = exports['default']; /***/ }, /* 1 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var _react = __webpack_require__(2); var _react2 = _interopRequireDefault(_react); var _classnames = __webpack_require__(3); var _classnames2 = _interopRequireDefault(_classnames); var _keyevent = __webpack_require__(4); var _keyevent2 = _interopRequireDefault(_keyevent); var _typeaheadDefaultCss = __webpack_require__(5); var _typeaheadDefaultCss2 = _interopRequireDefault(_typeaheadDefaultCss); var Typeahead = (function (_React$Component) { _inherits(Typeahead, _React$Component); function Typeahead(props) { _classCallCheck(this, Typeahead); _get(Object.getPrototypeOf(Typeahead.prototype), 'constructor', this).call(this, props); this.handleOptionClick = this.handleOptionClick.bind(this); this.handleOptionMouseOver = this.handleOptionMouseOver.bind(this); this.handleInputKeyUp = this.handleInputKeyUp.bind(this); this.handleInputChange = this.handleInputChange.bind(this); this.handleInputBlur = this.handleInputBlur.bind(this); this._navigateUp = this._navigateUp.bind(this); this._navigateDown = this._navigateDown.bind(this); this._setOptionSelected = this._setOptionSelected.bind(this); this._hideResults = this._hideResults.bind(this); this.state = { value: this.props.defaultValue || '', filteredOptions: this.props.options, resultsListVisible: false }; } _createClass(Typeahead, [{ key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { this.setState({ filteredOptions: nextProps.options || this.state.filteredOptions, value: nextProps.defaultValue || this.state.value }); } }, { key: 'handleOptionClick', value: function handleOptionClick(evt) { this._setOptionSelected(); } }, { key: 'handleOptionMouseOver', value: function handleOptionMouseOver(newIndex) { this.setState({ selectedIndex: newIndex }); } }, { key: 'handleInputKeyUp', value: function handleInputKeyUp(evt) { evt.preventDefault(); switch (evt.keyCode) { case _keyevent2['default'].DOM_VK_UP: this._navigateUp(); break; case _keyevent2['default'].DOM_VK_DOWN: this._navigateDown(); break; case _keyevent2['default'].DOM_VK_ESCAPE: this._hideResults(); break; case _keyevent2['default'].DOM_VK_RETURN: case _keyevent2['default'].DOM_VK_ENTER: this._setOptionSelected(); break; } } }, { key: 'handleInputChange', value: function handleInputChange(evt) { var _this = this; evt.preventDefault(); var value = evt.target.value; var filteredOptions = this.props.options.filter(function (opt) { return opt.toLowerCase().includes(value.toLowerCase()); }); var showResultsList = filteredOptions.length > 0 && !!value; var selectedIndex = showResultsList ? this.state.selectedIndex : null; this.setState({ filteredOptions: filteredOptions, value: value, resultsListVisible: showResultsList, selectedIndex: selectedIndex }, function () { _this.props.onInputChange(value); }); } }, { key: 'handleInputBlur', value: function handleInputBlur(evt) { this._hideResults(); this.props.onBlur(evt); } }, { key: '_navigateDown', value: function _navigateDown() { var newIndex = this.state.selectedIndex + 1 || 0; if (newIndex > this.state.filteredOptions.length - 1) { newIndex = 0; } this.setState({ selectedIndex: newIndex, resultsListVisible: true }); } }, { key: '_navigateUp', value: function _navigateUp() { var newIndex = this.state.selectedIndex - 1 || 0; if (newIndex < 0) { newIndex = this.state.filteredOptions.length - 1; } this.setState({ selectedIndex: newIndex, resultsListVisible: true }); } }, { key: '_setOptionSelected', value: function _setOptionSelected() { var _this2 = this; if (this.state.selectedIndex) { var opt = this.state.filteredOptions[this.state.selectedIndex]; } else { var opt = this.props.options.filter(function (opt) { return opt.toLowerCase().includes(_this2.state.value.toLowerCase()); }).pop(); } this.setState({ value: opt, resultsListVisible: false, selectedIndex: undefined }, function () { _this2.props.onOptionSelected(opt); }); } }, { key: '_hideResults', value: function _hideResults() { this.setState({ selectedIndex: undefined, resultsListVisible: false }); } }, { key: 'render', value: function render() { var _this3 = this; var resultsClassNames = (0, _classnames2['default'])(this.props.styles.typeaheadResults, _defineProperty({}, this.props.styles.hidden, !this.state.resultsListVisible)); var optionsItems = this.state.filteredOptions.map(function (opt, i) { var classNames = (0, _classnames2['default'])(_this3.props.styles.typeaheadResult, _defineProperty({}, _this3.props.styles.typeaheadResultFocused, _this3.state.selectedIndex === i)); return _react2['default'].createElement( 'li', { className: classNames, key: i, onClick: _this3.handleOptionClick, onMouseOver: function (e) { _this3.handleOptionMouseOver(i); }, ref: 'option-' + i }, opt ); }); return _react2['default'].createElement( 'div', { className: this.props.styles.typeahead }, _react2['default'].createElement('input', { type: 'text', value: this.state.value, placeholder: this.props.placeholder, onChange: this.handleInputChange, onKeyUp: this.handleInputKeyUp, onBlur: this.handleInputBlur, onFocus: this.props.onFocus, className: this.props.styles.typeaheadInput }), _react2['default'].createElement( 'ul', { className: resultsClassNames }, optionsItems ) ); } }]); return Typeahead; })(_react2['default'].Component); ; Typeahead.defaultProps = { onOptionSelected: function onOptionSelected() {}, onBlur: function onBlur() {}, onFocus: function onFocus() {}, onInputChange: function onInputChange() {}, styles: _typeaheadDefaultCss2['default'] }; Typeahead.propTypes = { defaultValue: _react2['default'].PropTypes.string, options: _react2['default'].PropTypes.arrayOf(_react2['default'].PropTypes.string), onOptionSelected: _react2['default'].PropTypes.func, onBlur: _react2['default'].PropTypes.func, onFocus: _react2['default'].PropTypes.func, onInputChange: _react2['default'].PropTypes.func, styles: _react2['default'].PropTypes.object }; exports['default'] = Typeahead; module.exports = exports['default']; /***/ }, /* 2 */ /***/ function(module, exports) { module.exports = undefined; /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2015 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ 'use strict'; (function () { 'use strict'; function classNames() { var classes = ''; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (!arg) continue; var argType = typeof arg; if ('string' === argType || 'number' === argType) { classes += ' ' + arg; } else if (Array.isArray(arg)) { classes += ' ' + classNames.apply(null, arg); } else if ('object' === argType) { for (var key in arg) { if (arg.hasOwnProperty(key) && arg[key]) { classes += ' ' + key; } } } } return classes.substr(1); } if (typeof module !== 'undefined' && module.exports) { module.exports = classNames; } else if (true) { // AMD. Register as an anonymous module. !(__WEBPACK_AMD_DEFINE_RESULT__ = function () { return classNames; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { window.classNames = classNames; } })(); /***/ }, /* 4 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var KeyEvent = KeyEvent || { DOM_VK_BACK_SPACE: 8, DOM_VK_TAB: 9, DOM_VK_RETURN: 13, DOM_VK_ENTER: 14, DOM_VK_ESCAPE: 27, DOM_VK_UP: 38, DOM_VK_DOWN: 40 }; exports["default"] = KeyEvent; module.exports = exports["default"]; /***/ }, /* 5 */ /***/ function(module, exports, __webpack_require__) { // style-loader: Adds some css to the DOM by adding a <style> tag // load the styles var content = __webpack_require__(6); if(typeof content === 'string') content = [[module.id, content, '']]; // add the styles to the DOM var update = __webpack_require__(8)(content, {}); if(content.locals) module.exports = content.locals; // Hot Module Replacement if(false) { // When the styles change, update the <style> tags if(!content.locals) { module.hot.accept("!!./../node_modules/css-loader/index.js?modules!./typeahead-default.css", function() { var newContent = require("!!./../node_modules/css-loader/index.js?modules!./typeahead-default.css"); if(typeof newContent === 'string') newContent = [[module.id, newContent, '']]; update(newContent); }); } // When the module is disposed, remove the <style> tags module.hot.dispose(function() { update(); }); } /***/ }, /* 6 */ /***/ function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(7)(); // imports // module exports.push([module.id, "._--qJYrANuwmD-KJ0D15a- {\n position: relative;\n}\n\n._13Eh0DVbiZYqwp0BoRFeKL {\n position: relative;\n z-index: 2;\n margin-bottom: 3px !important;\n}\n\n._3FAMB6LjDfPJBcR3sJPY01 {\n background-color: #fff;\n border: 1px solid #ddd;\n border-radius: 3px;\n box-shadow: inset 0 1px 3px rhba(#000, 0.06);\n box-sizing: border-box;\n\n position: relative;\n width: 95%;\n margin: -15px auto 0 auto;\n padding: 15px 0px 3px 0px;\n}\n\n._37Ufml0gd7voiDAuSFHEkX {\n padding: 3px 15px;\n}\n\n._3pNBmUdUlmkH6oaJTY0w6Q {\n background-color: red;\n color: #FFF;\n}\n\n.Te41E-3_CxbJmx76tIfZO {\n display: none;\n}\n\n", ""]); // exports exports.locals = { "typeahead": "_--qJYrANuwmD-KJ0D15a-", "typeaheadInput": "_13Eh0DVbiZYqwp0BoRFeKL", "typeaheadResults": "_3FAMB6LjDfPJBcR3sJPY01", "typeaheadResult": "_37Ufml0gd7voiDAuSFHEkX", "typeaheadResultFocused": "_3pNBmUdUlmkH6oaJTY0w6Q", "hidden": "Te41E-3_CxbJmx76tIfZO" }; /***/ }, /* 7 */ /***/ function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader "use strict"; module.exports = function () { var list = []; // return the list of modules as css string list.toString = function toString() { var result = []; for (var i = 0; i < this.length; i++) { var item = this[i]; if (item[2]) { result.push("@media " + item[2] + "{" + item[1] + "}"); } else { result.push(item[1]); } } return result.join(""); }; // import a list of modules into the list list.i = function (modules, mediaQuery) { if (typeof modules === "string") modules = [[null, modules, ""]]; var alreadyImportedModules = {}; for (var i = 0; i < this.length; i++) { var id = this[i][0]; if (typeof id === "number") alreadyImportedModules[id] = true; } for (i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if (typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { if (mediaQuery && !item[2]) { item[2] = mediaQuery; } else if (mediaQuery) { item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; } list.push(item); } } }; return list; }; /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ var stylesInDom = {}, memoize = function(fn) { var memo; return function () { if (typeof memo === "undefined") memo = fn.apply(this, arguments); return memo; }; }, isOldIE = memoize(function() { return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase()); }), getHeadElement = memoize(function () { return document.head || document.getElementsByTagName("head")[0]; }), singletonElement = null, singletonCounter = 0; module.exports = function(list, options) { if(false) { if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); } options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> // tags it will allow on a page if (typeof options.singleton === "undefined") options.singleton = isOldIE(); var styles = listToStyles(list); addStylesToDom(styles, options); return function update(newList) { var mayRemove = []; for(var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; domStyle.refs--; mayRemove.push(domStyle); } if(newList) { var newStyles = listToStyles(newList); addStylesToDom(newStyles, options); } for(var i = 0; i < mayRemove.length; i++) { var domStyle = mayRemove[i]; if(domStyle.refs === 0) { for(var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](); delete stylesInDom[domStyle.id]; } } }; } function addStylesToDom(styles, options) { for(var i = 0; i < styles.length; i++) { var item = styles[i]; var domStyle = stylesInDom[item.id]; if(domStyle) { domStyle.refs++; for(var j = 0; j < domStyle.parts.length; j++) { domStyle.parts[j](item.parts[j]); } for(; j < item.parts.length; j++) { domStyle.parts.push(addStyle(item.parts[j], options)); } } else { var parts = []; for(var j = 0; j < item.parts.length; j++) { parts.push(addStyle(item.parts[j], options)); } stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; } } } function listToStyles(list) { var styles = []; var newStyles = {}; for(var i = 0; i < list.length; i++) { var item = list[i]; var id = item[0]; var css = item[1]; var media = item[2]; var sourceMap = item[3]; var part = {css: css, media: media, sourceMap: sourceMap}; if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]}); else newStyles[id].parts.push(part); } return styles; } function createStyleElement() { var styleElement = document.createElement("style"); var head = getHeadElement(); styleElement.type = "text/css"; head.appendChild(styleElement); return styleElement; } function createLinkElement() { var linkElement = document.createElement("link"); var head = getHeadElement(); linkElement.rel = "stylesheet"; head.appendChild(linkElement); return linkElement; } function addStyle(obj, options) { var styleElement, update, remove; if (options.singleton) { var styleIndex = singletonCounter++; styleElement = singletonElement || (singletonElement = createStyleElement()); update = applyToSingletonTag.bind(null, styleElement, styleIndex, false); remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true); } else if(obj.sourceMap && typeof URL === "function" && typeof URL.createObjectURL === "function" && typeof URL.revokeObjectURL === "function" && typeof Blob === "function" && typeof btoa === "function") { styleElement = createLinkElement(); update = updateLink.bind(null, styleElement); remove = function() { styleElement.parentNode.removeChild(styleElement); if(styleElement.href) URL.revokeObjectURL(styleElement.href); }; } else { styleElement = createStyleElement(); update = applyToTag.bind(null, styleElement); remove = function() { styleElement.parentNode.removeChild(styleElement); }; } update(obj); return function updateStyle(newObj) { if(newObj) { if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) return; update(obj = newObj); } else { remove(); } }; } var replaceText = (function () { var textStore = []; return function (index, replacement) { textStore[index] = replacement; return textStore.filter(Boolean).join('\n'); }; })(); function applyToSingletonTag(styleElement, index, remove, obj) { var css = remove ? "" : obj.css; if (styleElement.styleSheet) { styleElement.styleSheet.cssText = replaceText(index, css); } else { var cssNode = document.createTextNode(css); var childNodes = styleElement.childNodes; if (childNodes[index]) styleElement.removeChild(childNodes[index]); if (childNodes.length) { styleElement.insertBefore(cssNode, childNodes[index]); } else { styleElement.appendChild(cssNode); } } } function applyToTag(styleElement, obj) { var css = obj.css; var media = obj.media; var sourceMap = obj.sourceMap; if(media) { styleElement.setAttribute("media", media) } if(styleElement.styleSheet) { styleElement.styleSheet.cssText = css; } else { while(styleElement.firstChild) { styleElement.removeChild(styleElement.firstChild); } styleElement.appendChild(document.createTextNode(css)); } } function updateLink(linkElement, obj) { var css = obj.css; var media = obj.media; var sourceMap = obj.sourceMap; if(sourceMap) { // http://stackoverflow.com/a/26603875 css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; } var blob = new Blob([css], { type: "text/css" }); var oldSrc = linkElement.href; linkElement.href = URL.createObjectURL(blob); if(oldSrc) URL.revokeObjectURL(oldSrc); } /***/ } /******/ ]);
{'content_hash': '8cd8d8de5cae2d6ded06013c18ddd23e', 'timestamp': '', 'source': 'github', 'line_count': 732, 'max_line_length': 668, 'avg_line_length': 31.422131147540984, 'alnum_prop': 0.6244945871918612, 'repo_name': 'jamesmccann/react-simple-typeahead', 'id': '120e2cdf34e26261144b6020e9646d2ecab8d6a1', 'size': '23001', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'dist/react-simple-typeahead.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '967'}, {'name': 'JavaScript', 'bytes': '16607'}]}
/*---------------------------------------------------------------------------*/ /** * \addtogroup openmote-button-sensor * @{ * * \file * Driver for for the OpenMote-CC2538 user button */ /*---------------------------------------------------------------------------*/ #include "contiki.h" #include "dev/nvic.h" #include "dev/ioc.h" #include "dev/gpio.h" #include "dev/button-sensor.h" #include "sys/timer.h" #include "sys/ctimer.h" #include "sys/process.h" #include <stdint.h> #include <string.h> /*---------------------------------------------------------------------------*/ #define BUTTON_USER_PORT_BASE GPIO_PORT_TO_BASE(BUTTON_USER_PORT) #define BUTTON_USER_PIN_MASK GPIO_PIN_MASK(BUTTON_USER_PIN) /*---------------------------------------------------------------------------*/ #define DEBOUNCE_DURATION (CLOCK_SECOND >> 4) static struct timer debouncetimer; /*---------------------------------------------------------------------------*/ static clock_time_t press_duration = 0; static struct ctimer press_counter; static uint8_t press_event_counter; process_event_t button_press_duration_exceeded; /*---------------------------------------------------------------------------*/ static void duration_exceeded_callback(void *data) { press_event_counter++; process_post(PROCESS_BROADCAST, button_press_duration_exceeded, &press_event_counter); ctimer_set(&press_counter, press_duration, duration_exceeded_callback, NULL); } /*---------------------------------------------------------------------------*/ /** * \brief Retrieves the value of the button pin * \param type Returns the pin level or the counter of press duration events. * type == BUTTON_SENSOR_VALUE_TYPE_LEVEL or * type == BUTTON_SENSOR_VALUE_TYPE_PRESS_DURATION * respectively */ static int value(int type) { switch(type) { case BUTTON_SENSOR_VALUE_TYPE_LEVEL: return GPIO_READ_PIN(BUTTON_USER_PORT_BASE, BUTTON_USER_PIN_MASK); case BUTTON_SENSOR_VALUE_TYPE_PRESS_DURATION: return press_event_counter; } return 0; } /*---------------------------------------------------------------------------*/ /** * \brief Callback registered with the GPIO module. Gets fired with a button * port/pin generates an interrupt * \param port The port number that generated the interrupt * \param pin The pin number that generated the interrupt. This is the pin * absolute number (i.e. 0, 1, ..., 7), not a mask */ static void btn_callback(uint8_t port, uint8_t pin) { if(!timer_expired(&debouncetimer)) { return; } timer_set(&debouncetimer, DEBOUNCE_DURATION); if(press_duration) { press_event_counter = 0; if(value(BUTTON_SENSOR_VALUE_TYPE_LEVEL) == BUTTON_SENSOR_PRESSED_LEVEL) { ctimer_set(&press_counter, press_duration, duration_exceeded_callback, NULL); } else { ctimer_stop(&press_counter); } } sensors_changed(&button_sensor); } /*---------------------------------------------------------------------------*/ /** * \brief Init function for the User button. * \param type SENSORS_ACTIVE: Activate / Deactivate the sensor (value == 1 * or 0 respectively) * * \param value Depends on the value of the type argument * \return Depends on the value of the type argument */ static int config_user(int type, int value) { switch(type) { case SENSORS_HW_INIT: button_press_duration_exceeded = process_alloc_event(); /* Software controlled */ GPIO_SOFTWARE_CONTROL(BUTTON_USER_PORT_BASE, BUTTON_USER_PIN_MASK); /* Set pin to input */ GPIO_SET_INPUT(BUTTON_USER_PORT_BASE, BUTTON_USER_PIN_MASK); /* Enable edge detection */ GPIO_DETECT_EDGE(BUTTON_USER_PORT_BASE, BUTTON_USER_PIN_MASK); /* Both Edges */ GPIO_TRIGGER_BOTH_EDGES(BUTTON_USER_PORT_BASE, BUTTON_USER_PIN_MASK); ioc_set_over(BUTTON_USER_PORT, BUTTON_USER_PIN, IOC_OVERRIDE_PUE); gpio_register_callback(btn_callback, BUTTON_USER_PORT, BUTTON_USER_PIN); break; case SENSORS_ACTIVE: if(value) { GPIO_ENABLE_INTERRUPT(BUTTON_USER_PORT_BASE, BUTTON_USER_PIN_MASK); NVIC_EnableIRQ(BUTTON_USER_VECTOR); } else { GPIO_DISABLE_INTERRUPT(BUTTON_USER_PORT_BASE, BUTTON_USER_PIN_MASK); NVIC_DisableIRQ(BUTTON_USER_VECTOR); } return value; case BUTTON_SENSOR_CONFIG_TYPE_INTERVAL: press_duration = (clock_time_t)value; break; default: break; } return 1; } /*---------------------------------------------------------------------------*/ SENSORS_SENSOR(button_sensor, BUTTON_SENSOR, value, config_user, NULL); /*---------------------------------------------------------------------------*/ /** @} */
{'content_hash': '9e64a46ba2a8955c77fc8d81ed62e42a', 'timestamp': '', 'source': 'github', 'line_count': 147, 'max_line_length': 79, 'avg_line_length': 32.04081632653061, 'alnum_prop': 0.5579617834394904, 'repo_name': 'arurke/contiki', 'id': '9c6a7d6c88fad01bb1a5e9642b5c2e5b0c7589cc', 'size': '6395', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'platform/openmote-cc2538/dev/button-sensor.c', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Assembly', 'bytes': '150953'}, {'name': 'Awk', 'bytes': '95'}, {'name': 'C', 'bytes': '18834400'}, {'name': 'C++', 'bytes': '1239737'}, {'name': 'CSS', 'bytes': '6645'}, {'name': 'Gnuplot', 'bytes': '1671'}, {'name': 'HTML', 'bytes': '5676'}, {'name': 'JavaScript', 'bytes': '11808'}, {'name': 'Makefile', 'bytes': '54223'}, {'name': 'Objective-C', 'bytes': '77875'}, {'name': 'Perl', 'bytes': '17258'}, {'name': 'Python', 'bytes': '11437'}, {'name': 'Shell', 'bytes': '6925'}, {'name': 'XSLT', 'bytes': '4947'}]}
package nodetemplates import ( "github.com/rancher/rancher/tests/framework/clients/rancher" management "github.com/rancher/rancher/tests/framework/clients/rancher/generated/management/v3" "github.com/rancher/rancher/tests/framework/extensions/rke1/nodetemplates" "github.com/rancher/rancher/tests/framework/pkg/config" ) const harvesterNodeTemplateNameBase = "harvesterNodeConfig" // CreateHarvesterNodeTemplate is a helper function that takes the rancher Client as a parameter and creates // an Harvester node template and returns the NodeTemplate response func CreateHarvesterNodeTemplate(rancherClient *rancher.Client) (*nodetemplates.NodeTemplate, error) { var harvesterNodeTemplateConfig nodetemplates.HarvesterNodeTemplateConfig config.LoadConfig(nodetemplates.HarvesterNodeTemplateConfigurationFileKey, &harvesterNodeTemplateConfig) nodeTemplate := nodetemplates.NodeTemplate{ EngineInstallURL: "https://releases.rancher.com/install-docker/20.10.sh", Name: harvesterNodeTemplateNameBase, HarvesterNodeTemplateConfig: &harvesterNodeTemplateConfig, } resp := &nodetemplates.NodeTemplate{} err := rancherClient.Management.APIBaseClient.Ops.DoCreate(management.NodeTemplateType, nodeTemplate, resp) if err != nil { return nil, err } return resp, nil }
{'content_hash': 'c9d1f42d1e679791f31f28bfd871e38c', 'timestamp': '', 'source': 'github', 'line_count': 30, 'max_line_length': 108, 'avg_line_length': 43.833333333333336, 'alnum_prop': 0.8053231939163498, 'repo_name': 'rancher/rancher', 'id': 'b988c6edb66bb3ca8424fb39f0a4ee577e8c263b', 'size': '1315', 'binary': False, 'copies': '1', 'ref': 'refs/heads/release/v2.7', 'path': 'tests/framework/extensions/rke1/nodetemplates/harvester/create.go', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '395'}, {'name': 'Dockerfile', 'bytes': '17618'}, {'name': 'Go', 'bytes': '10336092'}, {'name': 'Groovy', 'bytes': '119828'}, {'name': 'HCL', 'bytes': '35182'}, {'name': 'JavaScript', 'bytes': '609'}, {'name': 'Jinja', 'bytes': '30303'}, {'name': 'Makefile', 'bytes': '483'}, {'name': 'Mustache', 'bytes': '2113'}, {'name': 'PowerShell', 'bytes': '38206'}, {'name': 'Python', 'bytes': '1720222'}, {'name': 'Shell', 'bytes': '106041'}]}
<html> <script src="../../resources/testdriver.js"></script> <script src="../../resources/testdriver-vendor.js"></script> <body> <form action="resources/popup-allowed-from-gesture-initiated-form-submit-target.html" method="post" target="_blank"> <input id="button" type="submit" value="Click Here" /> </form> <div id="console">FAIL</div> <script> if (window.testRunner) { testRunner.dumpAsText(); testRunner.waitUntilDone(); var button = document.getElementById("button"); window.onload = function() { test_driver.click(button); } } </script> </body> </html>
{'content_hash': '68514095dcf3f98eef2998ca07167706', 'timestamp': '', 'source': 'github', 'line_count': 22, 'max_line_length': 124, 'avg_line_length': 34.22727272727273, 'alnum_prop': 0.5272244355909694, 'repo_name': 'scheib/chromium', 'id': '1106993120167b6cc6384dd3b7213e32659c643e', 'size': '753', 'binary': False, 'copies': '2', 'ref': 'refs/heads/main', 'path': 'third_party/blink/web_tests/fast/events/popup-allowed-from-gesture-initiated-form-submit.html', 'mode': '33188', 'license': 'bsd-3-clause', 'language': []}
namespace Chaos { template <typename Object> class ObjectPool; // Object need __prev() and __next() access methods implementation class ObjectPoolAccess { public: // default BaseObject type for ObjectPool template <typename DrivedObject> struct BaseObject { DrivedObject* __prevobj{}; DrivedObject* __nextobj{}; DrivedObject*& __prev(void) { return __prevobj; } DrivedObject*& __next(void) { return __nextobj; } }; public: template <typename Object> static Object* create(void) { return new Object(); } template <typename Object, typename... Args> static Object* create(Args&&... args) { return new Object(std::forward<Args>(args)...); } template <typename Object> static void destroy(Object* o) { delete o; } template <typename Object> static Object*& prev(Object* o) { return o->__prev(); } template <typename Object> static Object*& next(Object* o) { return o->__next(); } }; template <typename Object> class ObjectPool : private UnCopyable { Object* live_list_{}; Object* free_list_{}; void destroy_list(Object* list) { while (list != nullptr) { auto* o = list; list = ObjectPoolAccess::next(o); ObjectPoolAccess::destroy(o); } } public: ObjectPool(void) { } ~ObjectPool(void) { destroy_list(live_list_); destroy_list(free_list_); } Object* first(void) const { // get the object at the start of the live list return live_list_; } Object* alloc(void) { auto* o = free_list_; if (o != nullptr) free_list_ = ObjectPoolAccess::next(free_list_); else o = ObjectPoolAccess::create<Object>(); ObjectPoolAccess::next(o) = live_list_; ObjectPoolAccess::prev(o) = nullptr; if (live_list_ != nullptr) ObjectPoolAccess::prev(live_list_) = nullptr; live_list_ = o; return o; } template <typename... Args> Object* alloc(Args&&... args) { auto* o = free_list_; if (o != nullptr) free_list_ = ObjectPoolAccess::next(free_list_); else o = ObjectPoolAccess::create<Object>(std::forward<Args>(args)...); ObjectPoolAccess::next(o) = live_list_; ObjectPoolAccess::prev(o) = nullptr; if (live_list_ != nullptr) ObjectPoolAccess::prev(live_list_) = nullptr; live_list_ = o; return o; } void dealloc(Object* o) { if (live_list_ == o) live_list_ = ObjectPoolAccess::next(o); if (ObjectPoolAccess::prev(o) != nullptr) { ObjectPoolAccess::next(ObjectPoolAccess::prev(o)) = ObjectPoolAccess::next(o); } if (ObjectPoolAccess::next(o) != nullptr) { ObjectPoolAccess::prev(ObjectPoolAccess::next(o)) = ObjectPoolAccess::prev(o); } ObjectPoolAccess::next(o) = free_list_; ObjectPoolAccess::prev(o) = nullptr; free_list_ = o; } }; }
{'content_hash': '2e2838a997976d8347fbaf877349930d', 'timestamp': '', 'source': 'github', 'line_count': 127, 'max_line_length': 72, 'avg_line_length': 22.52755905511811, 'alnum_prop': 0.6176162181055574, 'repo_name': 'ASMlover/Chaos', 'id': '282bbd4d0edfddbfe395ff67ee5e5d17ef67d1c7', 'size': '4579', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Chaos/Utility/ObjectPool.hh', 'mode': '33188', 'license': 'bsd-2-clause', 'language': [{'name': 'C', 'bytes': '10208'}, {'name': 'C++', 'bytes': '413707'}, {'name': 'CMake', 'bytes': '10454'}, {'name': 'Python', 'bytes': '1665'}]}
// Portions copyright Hiroshi Ito. Licensed under Apache 2.0 license package com.gs.fw.common.mithra.finder.byteop; import com.gs.fw.common.mithra.attribute.ByteAttribute; import com.gs.fw.common.mithra.databasetype.DatabaseType; import com.gs.fw.common.mithra.extractor.ByteExtractor; import com.gs.fw.common.mithra.extractor.Extractor; import com.gs.fw.common.mithra.extractor.PositionBasedOperationParameterExtractor; import com.gs.fw.common.mithra.finder.InOperation; import com.gs.fw.common.mithra.finder.SqlParameterSetter; import com.gs.fw.common.mithra.finder.ToStringContext; import com.gs.fw.common.mithra.finder.sqcache.ExactMatchSmr; import com.gs.fw.common.mithra.finder.sqcache.NoMatchSmr; import com.gs.fw.common.mithra.finder.sqcache.ShapeMatchResult; import com.gs.fw.common.mithra.finder.sqcache.SuperMatchSmr; import com.gs.fw.common.mithra.util.HashUtil; import org.eclipse.collections.api.iterator.ByteIterator; import org.eclipse.collections.api.set.primitive.ByteSet; import org.eclipse.collections.impl.factory.primitive.ByteSets; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Arrays; import java.util.List; import java.util.TimeZone; public class ByteInOperation extends InOperation implements SqlParameterSetter { private ByteSet set; private transient volatile byte[] copiedArray; public ByteInOperation(ByteAttribute attribute, ByteSet byteSet) { super(attribute); this.set = byteSet.freeze(); } @Override public List getByIndex() { return this.getCache().get(this.getIndexRef(), this.set); } @Override protected int setSqlParameters(PreparedStatement pstmt, int startIndex, TimeZone timeZone, int setStart, int numberToSet, DatabaseType databaseType) throws SQLException { for(int i=setStart;i<setStart+numberToSet;i++) { pstmt.setByte(startIndex++, copiedArray[i]); } return numberToSet; } @Override public byte getSetValueAsByte(int index) { return this.copiedArray[index]; } @Override protected void appendSetToString(ToStringContext toStringContext) { toStringContext.append(this.set.toString()); } @Override protected void populateCopiedArray() { if (this.copiedArray == null) { synchronized (this) { if (this.copiedArray == null) { byte[] temp = this.set.toArray(); Arrays.sort(temp); this.copiedArray = temp; } } } } public int hashCode() { return this.getAttribute().hashCode() ^ this.set.hashCode(); } public boolean equals(Object obj) { if (obj == this) return true; if (obj instanceof ByteInOperation) { ByteInOperation other = (ByteInOperation) obj; return this.getAttribute().equals(other.getAttribute()) && this.set.equals(other.set); } return false; } @Override public int getSetSize() { return this.set.size(); } public Extractor getParameterExtractor() { populateCopiedArray(); return new ParameterExtractor(); } private class ParameterExtractor extends PositionBasedOperationParameterExtractor implements ByteExtractor { public int intValueOf(Object o) { return (int) this.byteValueOf(o); } @Override public int getSetSize() { return ByteInOperation.this.getSetSize(); } public byte byteValueOf(Object o) { return copiedArray[this.getPosition()]; } public int valueHashCode(Object o) { return HashUtil.hash(this.byteValueOf(o)); } public boolean valueEquals(Object first, Object second) { return this.byteValueOf(first) == this.byteValueOf(second); } public boolean valueEquals(Object first, Object second, Extractor secondExtractor) { if (secondExtractor.isAttributeNull(second)) return false; return ((ByteExtractor) secondExtractor).byteValueOf(second) == this.byteValueOf(first); } public Object valueOf(Object anObject) { return Byte.valueOf(this.byteValueOf(anObject)); } } @Override public boolean setContains(Object holder, Extractor extractor) { return this.set.contains(((ByteExtractor)extractor).byteValueOf(holder)); } @Override protected ShapeMatchResult shapeMatchSet(InOperation existingOperation) { ByteIterator byteIterator = this.set.byteIterator(); while(byteIterator.hasNext()) { if (!((ByteInOperation) existingOperation).set.contains(byteIterator.next())) { return NoMatchSmr.INSTANCE; } } return this.set.size() == existingOperation.getSetSize() ? ExactMatchSmr.INSTANCE : new SuperMatchSmr(existingOperation, this); } }
{'content_hash': 'ad8fcfb71391ebf47462905db782e4c9', 'timestamp': '', 'source': 'github', 'line_count': 174, 'max_line_length': 172, 'avg_line_length': 30.70689655172414, 'alnum_prop': 0.6327905670971364, 'repo_name': 'goldmansachs/reladomo', 'id': '6fb68210bdd99704bdd5a5c05065842b3fff3978', 'size': '5927', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'reladomo/src/main/java/com/gs/fw/common/mithra/finder/byteop/ByteInOperation.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '5540'}, {'name': 'CSS', 'bytes': '13402'}, {'name': 'HTML', 'bytes': '64206'}, {'name': 'Java', 'bytes': '18211611'}, {'name': 'JavaScript', 'bytes': '18247'}, {'name': 'Ruby', 'bytes': '11034'}, {'name': 'Shell', 'bytes': '8454'}, {'name': 'XSLT', 'bytes': '383852'}]}
<?php return; class SampleTest extends WP_UnitTestCase { function testSample() { // replace this with some actual testing code $this->assertTrue( true ); } }
{'content_hash': '5916ef204ca4637e7df9defbef7937a3', 'timestamp': '', 'source': 'github', 'line_count': 10, 'max_line_length': 47, 'avg_line_length': 16.6, 'alnum_prop': 0.7048192771084337, 'repo_name': 'alkymst/tps303', 'id': '8dfe6e06dfd32cd548311ada369ad9b3363896d2', 'size': '166', 'binary': False, 'copies': '21', 'ref': 'refs/heads/master', 'path': 'web/app/themes/Avada/includes/avadaredux/avadaredux-framework/tests/test-sample.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '3179127'}, {'name': 'HTML', 'bytes': '50525'}, {'name': 'JavaScript', 'bytes': '7209550'}, {'name': 'PHP', 'bytes': '11022770'}, {'name': 'Ruby', 'bytes': '1950'}, {'name': 'Shell', 'bytes': '3992'}]}
"use strict"; import { ITemplateManifest } from "../getTemplateManifest"; import * as _ from "lodash"; // Returns a standardized version of the name (PascalCase) with any Suffixes that should be ignore removed. export function sanitizedName(name: string, options: ITemplateManifest): string { const pascalCaseValue = _.chain(name).camelCase().upperFirst().value(); let nameToUse = pascalCaseValue; for (const suffixToIgnore of options.suffixesToIgnoreInInput) { if (nameToUse.toLowerCase().endsWith(suffixToIgnore.toLowerCase())) { nameToUse = nameToUse.slice(0, nameToUse.length - suffixToIgnore.length); } } return nameToUse; }
{'content_hash': 'aabf3e29ff9097853291dcdf81684010', 'timestamp': '', 'source': 'github', 'line_count': 21, 'max_line_length': 107, 'avg_line_length': 31.476190476190474, 'alnum_prop': 0.7397881996974282, 'repo_name': 'reesemclean/blueprint', 'id': '0dd41cb3098e75f66fa7010f05d38c4742ff2a70', 'size': '661', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/fileCreator/inputSanitizer.ts', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'HTML', 'bytes': '225'}, {'name': 'Ruby', 'bytes': '2340'}, {'name': 'TypeScript', 'bytes': '25328'}]}
typedef NS_ENUM(NSUInteger, ClipCornerType) { ClipCornerTypeCustom=1, ClipCornerTypeBezier, ClipCornerTypeDraw, }; @interface ClipCornerController : UIViewController -(instancetype)initWithClipCornerType:(ClipCornerType)type; @end
{'content_hash': '93e2606bd58af41ddd972048b9658e5d', 'timestamp': '', 'source': 'github', 'line_count': 8, 'max_line_length': 59, 'avg_line_length': 30.375, 'alnum_prop': 0.8065843621399177, 'repo_name': 'HANSAFUNC/JAModule', 'id': '48dfc43d1d87ae7c1d86770a503a960910527bcd', 'size': '420', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'JKHeaderImageScale/ClipCornerController.h', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Objective-C', 'bytes': '36269'}]}
class Batch < ActiveFedora::Base include Hydra::ModelMixins::CommonMetadata include Hydra::ModelMixins::RightsMetadata include Sufia::ModelMethods include Sufia::Noid has_metadata :name => "descMetadata", :type => BatchRdfDatastream belongs_to :user, :property => "creator" has_many :generic_files, :property => :is_part_of delegate :title, :to => :descMetadata delegate :creator, :to => :descMetadata delegate :part, :to => :descMetadata delegate :status, :to => :descMetadata def self.find_or_create(pid) begin Batch.find(pid) rescue ActiveFedora::ObjectNotFoundError Batch.create({pid: pid}) end end def to_solr(solr_doc={}, opts={}) super(solr_doc, opts) solr_doc[Solrizer.solr_name('noid', Sufia::GenericFile.noid_indexer)] = noid return solr_doc end end
{'content_hash': '059d8d9de1ab3e0ccd0cc18b95f8ba64', 'timestamp': '', 'source': 'github', 'line_count': 30, 'max_line_length': 80, 'avg_line_length': 27.7, 'alnum_prop': 0.690734055354994, 'repo_name': 'neversion/comment_sufia', 'id': '3269d03c441ae42c493e6df02e6b37fe6e998a9a', 'size': '831', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'sufia-models/app/models/batch.rb', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '38769'}, {'name': 'JavaScript', 'bytes': '30778'}, {'name': 'Ruby', 'bytes': '426500'}]}
// Copyright (c) 2011-2013 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "optionsdialog.h" #include "ui_optionsdialog.h" #include "bitcoinunits.h" #include "monitoreddatamapper.h" #include "netbase.h" #include "optionsmodel.h" #include <QDir> #include <QIntValidator> #include <QLocale> #include <QMessageBox> OptionsDialog::OptionsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::OptionsDialog), model(0), mapper(0), fRestartWarningDisplayed_Proxy(false), fRestartWarningDisplayed_Lang(false), fProxyIpValid(true) { ui->setupUi(this); /* Network elements init */ #ifndef USE_UPNP ui->mapPortUpnp->setEnabled(false); #endif ui->proxyIp->setEnabled(false); ui->proxyPort->setEnabled(false); ui->proxyPort->setValidator(new QIntValidator(1, 65535, this)); ui->socksVersion->setEnabled(false); ui->socksVersion->addItem("5", 5); ui->socksVersion->addItem("4", 4); ui->socksVersion->setCurrentIndex(0); connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool))); connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool))); connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->socksVersion, SLOT(setEnabled(bool))); connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning_Proxy())); ui->proxyIp->installEventFilter(this); /* Window elements init */ #ifdef Q_OS_MAC /* remove Window tab on Mac */ ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow)); #endif /* Display elements init */ QDir translations(":translations"); ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant("")); foreach(const QString &langStr, translations.entryList()) { QLocale locale(langStr); /** check if the locale name consists of 2 parts (language_country) */ if(langStr.contains("_")) { #if QT_VERSION >= 0x040800 /** display language strings as "native language - native country (locale name)", e.g. "Deutsch - Deutschland (de)" */ ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") + locale.nativeCountryName() + QString(" (") + langStr + QString(")"), QVariant(langStr)); #else /** display language strings as "language - country (locale name)", e.g. "German - Germany (de)" */ ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" - ") + QLocale::countryToString(locale.country()) + QString(" (") + langStr + QString(")"), QVariant(langStr)); #endif } else { #if QT_VERSION >= 0x040800 /** display language strings as "native language (locale name)", e.g. "Deutsch (de)" */ ui->lang->addItem(locale.nativeLanguageName() + QString(" (") + langStr + QString(")"), QVariant(langStr)); #else /** display language strings as "language (locale name)", e.g. "German (de)" */ ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" (") + langStr + QString(")"), QVariant(langStr)); #endif } } ui->unit->setModel(new BitcoinUnits(this)); /* Widget-to-option mapper */ mapper = new MonitoredDataMapper(this); mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); mapper->setOrientation(Qt::Vertical); /* enable apply button when data modified */ connect(mapper, SIGNAL(viewModified()), this, SLOT(enableApplyButton())); /* disable apply button when new data loaded */ connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableApplyButton())); /* setup/change UI elements when proxy IP is invalid/valid */ connect(this, SIGNAL(proxyIpValid(QValidatedLineEdit *, bool)), this, SLOT(handleProxyIpValid(QValidatedLineEdit *, bool))); } OptionsDialog::~OptionsDialog() { delete ui; } void OptionsDialog::setModel(OptionsModel *model) { this->model = model; if(model) { connect(model, SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); mapper->setModel(model); setMapper(); mapper->toFirst(); } /* update the display unit, to not use the default ("BTC") */ updateDisplayUnit(); /* warn only when language selection changes by user action (placed here so init via mapper doesn't trigger this) */ connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning_Lang())); /* disable apply button after settings are loaded as there is nothing to save */ disableApplyButton(); } void OptionsDialog::setMapper() { /* Main */ mapper->addMapping(ui->bitcoinAtStartup, OptionsModel::StartAtStartup); /* Wallet */ mapper->addMapping(ui->transactionFee, OptionsModel::Fee); mapper->addMapping(ui->spendZeroConfChange, OptionsModel::SpendZeroConfChange); /* Network */ mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP); mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse); mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP); mapper->addMapping(ui->proxyPort, OptionsModel::ProxyPort); mapper->addMapping(ui->socksVersion, OptionsModel::ProxySocksVersion); /* Window */ #ifndef Q_OS_MAC mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray); mapper->addMapping(ui->minimizeOnClose, OptionsModel::MinimizeOnClose); #endif /* Display */ mapper->addMapping(ui->lang, OptionsModel::Language); mapper->addMapping(ui->unit, OptionsModel::DisplayUnit); mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses); mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures); } void OptionsDialog::enableApplyButton() { ui->applyButton->setEnabled(true); } void OptionsDialog::disableApplyButton() { ui->applyButton->setEnabled(false); } void OptionsDialog::enableSaveButtons() { /* prevent enabling of the save buttons when data modified, if there is an invalid proxy address present */ if(fProxyIpValid) setSaveButtonState(true); } void OptionsDialog::disableSaveButtons() { setSaveButtonState(false); } void OptionsDialog::setSaveButtonState(bool fState) { ui->applyButton->setEnabled(fState); ui->okButton->setEnabled(fState); } void OptionsDialog::on_resetButton_clicked() { if(model) { // confirmation dialog QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm options reset"), tr("Some settings may require a client restart to take effect.") + "<br><br>" + tr("Do you want to proceed?"), QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel); if(btnRetVal == QMessageBox::Cancel) return; disableApplyButton(); /* disable restart warning messages display */ fRestartWarningDisplayed_Lang = fRestartWarningDisplayed_Proxy = true; /* reset all options and save the default values (QSettings) */ model->Reset(); mapper->toFirst(); mapper->submit(); /* re-enable restart warning messages display */ fRestartWarningDisplayed_Lang = fRestartWarningDisplayed_Proxy = false; } } void OptionsDialog::on_okButton_clicked() { mapper->submit(); accept(); } void OptionsDialog::on_cancelButton_clicked() { reject(); } void OptionsDialog::on_applyButton_clicked() { mapper->submit(); disableApplyButton(); } void OptionsDialog::showRestartWarning_Proxy() { if(!fRestartWarningDisplayed_Proxy) { QMessageBox::warning(this, tr("Warning"), tr("This setting will take effect after restarting Linkcoin."), QMessageBox::Ok); fRestartWarningDisplayed_Proxy = true; } } void OptionsDialog::showRestartWarning_Lang() { if(!fRestartWarningDisplayed_Lang) { QMessageBox::warning(this, tr("Warning"), tr("This setting will take effect after restarting Linkcoin."), QMessageBox::Ok); fRestartWarningDisplayed_Lang = true; } } void OptionsDialog::updateDisplayUnit() { if(model) { /* Update transactionFee with the current unit */ ui->transactionFee->setDisplayUnit(model->getDisplayUnit()); } } void OptionsDialog::handleProxyIpValid(QValidatedLineEdit *object, bool fState) { // this is used in a check before re-enabling the save buttons fProxyIpValid = fState; if(fProxyIpValid) { enableSaveButtons(); ui->statusLabel->clear(); } else { disableSaveButtons(); object->setValid(fProxyIpValid); ui->statusLabel->setStyleSheet("QLabel { color: red; }"); ui->statusLabel->setText(tr("The supplied proxy address is invalid.")); } } bool OptionsDialog::eventFilter(QObject *object, QEvent *event) { if(event->type() == QEvent::FocusOut) { if(object == ui->proxyIp) { CService addr; /* Check proxyIp for a valid IPv4/IPv6 address and emit the proxyIpValid signal */ emit proxyIpValid(ui->proxyIp, LookupNumeric(ui->proxyIp->text().toStdString().c_str(), addr)); } } return QDialog::eventFilter(object, event); }
{'content_hash': 'c87d9df7d77b914c3ca11e6af02fc436', 'timestamp': '', 'source': 'github', 'line_count': 289, 'max_line_length': 198, 'avg_line_length': 32.29757785467128, 'alnum_prop': 0.6723805442468395, 'repo_name': 'Linkproject/winpro', 'id': '31699267ec2a08479282b5bc0560535f7c44fd07', 'size': '9334', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'src/qt/optionsdialog.cpp', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '92422'}, {'name': 'C++', 'bytes': '2553538'}, {'name': 'CSS', 'bytes': '1127'}, {'name': 'Objective-C++', 'bytes': '5864'}, {'name': 'Python', 'bytes': '69714'}, {'name': 'Shell', 'bytes': '13173'}, {'name': 'TypeScript', 'bytes': '5236295'}]}
package com.bugsnag.functions; import com.adobe.fre.FREContext; import com.adobe.fre.FREFunction; import com.adobe.fre.FREObject; import com.bugsnag.android.Bugsnag; public class RemoveAttribute implements FREFunction { @Override public FREObject call( FREContext context, FREObject[] args ) { String name; String tabName; try { name = args[0].getAsString(); tabName = args[0].getAsString(); } catch(Exception e) { e.printStackTrace(); return null; } Bugsnag.clearMetadata(tabName, name); return null; } }
{'content_hash': 'f08b4aec555895478fe2484b60063e9e', 'timestamp': '', 'source': 'github', 'line_count': 31, 'max_line_length': 65, 'avg_line_length': 21.096774193548388, 'alnum_prop': 0.599388379204893, 'repo_name': 'DigitalStrawberry/ANE-Bugsnag', 'id': '2b58d4bdff8574ca03402960b52d50fe1549f7b7', 'size': '654', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'android/src/com/bugsnag/functions/RemoveAttribute.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ActionScript', 'bytes': '22714'}, {'name': 'C', 'bytes': '366801'}, {'name': 'Java', 'bytes': '9536'}, {'name': 'Objective-C', 'bytes': '397728'}, {'name': 'Objective-C++', 'bytes': '8138'}]}
layout: post title: "Dinosaurs are extinct today" subtitle: "because they lacked opposable thumbs and the brainpower to build a space program." date: 2014-06-10 12:00:00 author: "Jordy Cuan" header-img: "img/post-bg-01.jpg" # Pruebas #category: articles tags: [sample post] --- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Saepe nostrum ullam eveniet pariatur voluptates odit, fuga atque ea nobis sit soluta odio, adipisci quas excepturi maxime quae totam ducimus consectetur?</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius praesentium recusandae illo eaque architecto error, repellendus iusto reprehenderit, doloribus, minus sunt. Numquam at quae voluptatum in officia voluptas voluptatibus, minus!</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nostrum molestiae debitis nobis, quod sapiente qui voluptatum, placeat magni repudiandae accusantium fugit quas labore non rerum possimus, corrupti enim modi! Et.</p> <h2 class="section-heading">Lorem ipsum dolor sit amet</h2> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Saepe nostrum ullam eveniet pariatur voluptates odit, fuga atque ea nobis sit soluta odio, adipisci quas excepturi maxime quae totam ducimus consectetur?</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius praesentium recusandae illo eaque architecto error, repellendus iusto reprehenderit, doloribus, minus sunt. Numquam at quae voluptatum in officia voluptas voluptatibus, minus!</p> <blockquote>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nostrum molestiae debitis nobis, quod sapiente qui voluptatum, placeat magni repudiandae accusantium fugit quas labore non rerum possimus, corrupti enim modi! Et.</blockquote> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Saepe nostrum ullam eveniet pariatur voluptates odit, fuga atque ea nobis sit soluta odio, adipisci quas excepturi maxime quae totam ducimus consectetur?</p> <h2 class="section-heading">Lorem ipsum dolor sit amet</h2> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius praesentium recusandae illo eaque architecto error, repellendus iusto reprehenderit, doloribus, minus sunt. Numquam at quae voluptatum in officia voluptas voluptatibus, minus!</p> <img src="{{ site.baseurl }}/img/post-sample-image.jpg" alt="Image"> <span class="caption text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit.</span> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Saepe nostrum ullam eveniet pariatur voluptates odit, fuga atque ea nobis sit soluta odio, adipisci quas excepturi maxime quae totam ducimus consectetur?</p> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius praesentium recusandae illo eaque architecto error, repellendus iusto reprehenderit, doloribus, minus sunt. Numquam at quae voluptatum in officia voluptas voluptatibus, minus!</p> {% highlight ruby %} def show @widget = Widget(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @widget } end end {% endhighlight %} <pre class="brush: python"> import copy, numpy as np np.random.seed(0) # compute sigmoid nonlinearity def sigmoid(x): output = 1/(1+np.exp(-x)) return output # convert output of sigmoid function to its derivative def sigmoid_output_to_derivative(output): return output*(1-output) # training dataset generation int2binary = {} binary_dim = 8 </pre> <p></p> <p></p> <p></p> <p></p> <p></p> <p></p> <p></p>
{'content_hash': 'c97b2cd3caa97631b73a7cb218115874', 'timestamp': '', 'source': 'github', 'line_count': 85, 'max_line_length': 245, 'avg_line_length': 41.83529411764706, 'alnum_prop': 0.7691226096737908, 'repo_name': 'JordyCuan/jordycuan.github.io', 'id': 'f122a7123608bddd40dc594fcae6aa2eaf722dad', 'size': '3560', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': '_drafts/demo_post.markdown', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '21815'}, {'name': 'HTML', 'bytes': '16172'}, {'name': 'JavaScript', 'bytes': '69913'}, {'name': 'Less', 'bytes': '8020'}, {'name': 'Ruby', 'bytes': '1217'}]}
package org.lanternpowered.server.game; import java.nio.file.Path; import java.nio.file.Paths; public final class DirectoryKeys { /** * The root folder key. */ public static final String ROOT = "root-folder"; /** * The config folder key. */ public static final String CONFIG = "config-folder"; /** * The plugins folder key. */ public static final String PLUGINS = "plugins-folder"; /** * The world folder key. */ public static final String WORLD = "world-folder"; /** * The root world folder key. */ public static final String ROOT_WORLD = "root-world-folder"; public static final class DefaultValues { /** * The root folder {@link Path}. */ public static final Path ROOT = Paths.get(""); /** * The config folder {@link Path}. */ public static final Path CONFIG = ROOT.resolve("config"); /** * The plugins folder {@link Path}. */ public static final Path PLUGINS = ROOT.resolve("plugins"); /** * The libraries folder {@link Path}. */ public static final Path LIBRARIES = ROOT.resolve("libraries"); } private DirectoryKeys() { } }
{'content_hash': '35edf92e555de30500c2d35981ec0788', 'timestamp': '', 'source': 'github', 'line_count': 60, 'max_line_length': 71, 'avg_line_length': 21.45, 'alnum_prop': 0.5641025641025641, 'repo_name': 'LanternPowered/LanternServer', 'id': '136ef02731d6e8fdfbbb39e9e4f60a96981715f3', 'size': '1610', 'binary': False, 'copies': '1', 'ref': 'refs/heads/1.16', 'path': 'src/main/java/org/lanternpowered/server/game/DirectoryKeys.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '8613522'}, {'name': 'Kotlin', 'bytes': '825665'}]}
package cb type FundRaiseResponse struct { FundRaiseData `json:"data"` Metadata interface{} `json:"metadata"` } type FundRaiseData struct { *FundRaise `json:"properties"` Relationships interface{} `json:"relationships"` } type FundRaise struct { Name string `json:"name"` Permalink string `json:"permalink"` MoneyRaised int64 `json:"money_raised"` CurrencyCode string `json:"money_raised_currency_code"` Started string `json:"started_on"` StartedDay int64 `json:"started_on_day"` StartedMonth int64 `json:"started_on_month"` StartedTrustCode int64 `json:"started_on_trust_code"` StartedYear int64 `json:"started_on_year"` Created int64 `json:"created_at"` Updated int64 `json:"updated_at"` } func (c *Client) GetFundRaise(id string) (*FundRaise, error) { var data *FundRaiseResponse err := c.Call("/fund-raise/"+id, nil, &data) if err != nil { return nil, err } return data.FundRaise, nil }
{'content_hash': '2bc5de33e6e825b120d7bd7efb686aee', 'timestamp': '', 'source': 'github', 'line_count': 35, 'max_line_length': 62, 'avg_line_length': 28.65714285714286, 'alnum_prop': 0.6650049850448654, 'repo_name': 'phea/cb', 'id': 'ce6be64536b05d3b8d551386c55acf3b974286b2', 'size': '1067', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'fundraise.go', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Go', 'bytes': '19552'}]}
#pragma strict /* Level Markers Selection Process for LightHouse. Developed by Trent Rand, December 19th, 2014. Current Beta as of December 19th, 2014. */ var player : GameObject; var beacon : GameObject; var scene : float; function Start () { } function OnTriggerStay (player : Collider) { for(var touch : Touch in Input.touches){ if(Input.touchCount == 1) { var ray = Camera.main.ScreenPointToRay(touch.position); var hit : RaycastHit; if (Physics.Raycast (ray, hit, 100)) { if (hit.collider == beacon || hit.collider == player) { Application.LoadLevel(scene); } } } } }
{'content_hash': 'e8c9243bef4221a70006474c88985954', 'timestamp': '', 'source': 'github', 'line_count': 34, 'max_line_length': 65, 'avg_line_length': 18.970588235294116, 'alnum_prop': 0.641860465116279, 'repo_name': 'randtrent/LightHouse', 'id': 'd555a3e1cea35cef0ff8b264f6dece63da7f9401', 'size': '645', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'SelectionScript_STABLE.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'JavaScript', 'bytes': '1965'}]}
package cn.hicc.suguan.dormitory; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("cn.hicc.suguan.dormitory", appContext.getPackageName()); } }
{'content_hash': '4b4f02d3a6b9020db0b4011dede4214f', 'timestamp': '', 'source': 'github', 'line_count': 26, 'max_line_length': 78, 'avg_line_length': 28.923076923076923, 'alnum_prop': 0.7473404255319149, 'repo_name': 'KnowledgeAndAction/Dormitory', 'id': '3b4c9d27ead61853f03b329b9b4235d3ae91d83b', 'size': '752', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/src/androidTest/java/cn/hicc/suguan/dormitory/ExampleInstrumentedTest.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '323900'}]}
tone: 7 eothinon: 10 title: Translation of relics of Ignatius the God-bearer of Antioch saints: - New-martyr Demetrios of Chios # Orthros apolytikion: - Resurrectional Apolytikion - Tone 7 - Glory/Apolytikion of St. Ignatius of Antioch - Tone 4 - Both Now/Resurrectional Theotokion - Tone 4 kathismata: null evlogetaria: null prokeimenon: null canon: Presentation of Christ - Tone 3 little_ektenia_3: 1 normal_exaposteilarion: true exaposteilaria: - Exaposteilarion for St. Ignatius - Tone 2 - Theotokion for St. Ignatius - Tone 2 praises: null doxastikon: null great_doxology: null troparion: null # Divine Liturgy antiphon_12: Normal Sunday antiphon_3: Resurrectional Apolytikion - Tone 7 entrance: false post_entrance: - Resurrectional Apolytikion - Tone 7 - Apolytikion of St. Ignatius of Antioch - Tone 4 ascension: true kontakion: Presentation of Christ - Tone 1 trisagion: false megalynarion: false koinonikon: false post_communion: false post_communion_markdown: false ---
{'content_hash': 'c766026666ad8687b278915c30107646', 'timestamp': '', 'source': 'github', 'line_count': 43, 'max_line_length': 66, 'avg_line_length': 23.674418604651162, 'alnum_prop': 0.7603143418467584, 'repo_name': 'JPry/choir-guides', 'id': 'c4f77d6dcc586f52cd6e5fb24c8ddbe6af2bf709', 'size': '1022', 'binary': False, 'copies': '1', 'ref': 'refs/heads/gh-pages', 'path': '_archives/2017-01-29-translation-of-relics-of-ignatius-the-god-bearer-of-antioch.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '1059'}, {'name': 'HTML', 'bytes': '2274'}, {'name': 'PHP', 'bytes': '9615'}, {'name': 'Ruby', 'bytes': '3219'}]}
''' Copyright 2016, EMC, Inc. Author(s): George Paulos ''' import os import sys import subprocess # set path to common libraries sys.path.append(subprocess.check_output("git rev-parse --show-toplevel", shell=True).rstrip("\n") + "/test/fit_tests/common") import fit_common # Select test group here using @attr from nose.plugins.attrib import attr @attr(all=True, regression=True, smoke=True) class rackhd20_api_views(fit_common.unittest.TestCase): def test_api_20_views_id_get(self): api_data = fit_common.rackhdapi('/api/2.0/views') self.assertEqual(api_data['status'], 200, 'Incorrect HTTP return code, expected 200, got:' + str(api_data['status'])) for item in api_data['json']: view_data = fit_common.rackhdapi('/api/2.0/views/' + item['name']) self.assertEqual(api_data['status'], 200, 'Incorrect HTTP return code, expected 200, got:' + str(api_data['status'])) if __name__ == '__main__': fit_common.unittest.main()
{'content_hash': '5e0fe20d770f00bfc2e52a9ad174977c', 'timestamp': '', 'source': 'github', 'line_count': 28, 'max_line_length': 129, 'avg_line_length': 35.07142857142857, 'alnum_prop': 0.6761710794297352, 'repo_name': 'BillyAbildgaard/RackHD', 'id': '89bccca421cc4be1ebd52333763b7813ce4248a1', 'size': '982', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'test/fit_tests/tests/rackhd20/test_rackhd20_api_views.py', 'mode': '33261', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '696'}, {'name': 'Python', 'bytes': '727696'}, {'name': 'Ruby', 'bytes': '10473'}, {'name': 'Shell', 'bytes': '62533'}]}
<?php namespace App\Http\Requests\Api; use Carbon\Carbon; use Illuminate\Foundation\Http\FormRequest; class CreateAliasRequest extends FormRequest { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return true; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'data.type' => 'required|in:aliases', 'data.attributes.path' => 'required|min:6|max:' . MAX_STRING_LENGTH . '|unique:file_aliases,path', 'data.attributes.hits' => 'numeric|min:0', 'data.attributes.from' => 'sometimes|nullable|date', 'data.attributes.until' => 'sometimes|nullable|date', ]; } /** * returns path. * * @return string */ public function path(): string { $data = $this->get('data', []); return array_get($data, 'attributes.path'); } /** * returns hits. * * @return int|null */ public function hits() { $data = $this->get('data', []); $hits = intval(array_get($data, 'attributes.hits', 0)); return $hits > 0 ? $hits : null; } /** * returns valid from. * * @return Carbon */ public function validFrom(): Carbon { $data = $this->get('data', []); $from = array_get($data, 'attributes.from'); if ($from === null) { return Carbon::now(); } return Carbon::parse($from); } /** * returns valid until. * * @return Carbon|null */ public function validUntil() { $data = $this->get('data', []); $until = array_get($data, 'attributes.until'); if ($until === null) { return null; } return Carbon::parse($until); } }
{'content_hash': 'f9229d578aab162bfbacec3bc419c693', 'timestamp': '', 'source': 'github', 'line_count': 99, 'max_line_length': 110, 'avg_line_length': 20.1010101010101, 'alnum_prop': 0.5005025125628141, 'repo_name': 'ipunkt/fileproxy', 'id': '3af037853eb4355eb81972c74e7961c37f39a7de', 'size': '1990', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/Http/Requests/Api/CreateAliasRequest.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Dockerfile', 'bytes': '568'}, {'name': 'HTML', 'bytes': '14422'}, {'name': 'PHP', 'bytes': '197870'}, {'name': 'Vue', 'bytes': '563'}]}
package com.zbiljic.nodez; public class TransformNodeNullException extends Exception { public final Node transformNode; public final Node sourceNode; public final Object source; public TransformNodeNullException(Node transformNode, Node sourceNode, Object source) { this.transformNode = transformNode; this.sourceNode = sourceNode; this.source = source; } @Override public String toString() { return String.format("TransformNode [%s] response is null while transforming %s", transformNode.getName(), String.valueOf(source)); } }
{'content_hash': '138b65b931a467f6a0b3160060e21fd6', 'timestamp': '', 'source': 'github', 'line_count': 24, 'max_line_length': 85, 'avg_line_length': 27.083333333333332, 'alnum_prop': 0.6569230769230769, 'repo_name': 'zbiljic/nodez', 'id': '636cc4a1c62aa9c78f18fe05d97a545c71a2f866', 'size': '1249', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/com/zbiljic/nodez/TransformNodeNullException.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '189982'}]}
program test use FoX_wxml, only : xmlf_t, xml_OpenFile, xml_Close use FoX_wxml, only : xml_NewElement, xml_AddDOCTYPE, xml_AddInternalEntity implicit none character(len=*), parameter :: filename = 'test.xml' type(xmlf_t) :: xf call xml_OpenFile(filename, xf) call xml_AddDOCTYPE(xf, 'html') call xml_AddInternalEntity(xf, 'copy', 'Copyright &169; Toby White 2006') call xml_NewElement(xf, 'html') call xml_Close(xf) end program test
{'content_hash': 'abec0d8446a7524f8636de220fea9112', 'timestamp': '', 'source': 'github', 'line_count': 16, 'max_line_length': 76, 'avg_line_length': 28.5625, 'alnum_prop': 0.7045951859956237, 'repo_name': 'wilsonCernWq/Simula', 'id': 'c1c2a0fb65745021ffeccb17f3a140c438b8c5f7', 'size': '457', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'fortran/utils/FoX-4.1.2/wxml/test/test_xml_AddInternalEntity_4.f90', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CMake', 'bytes': '26038'}, {'name': 'CSS', 'bytes': '1100'}, {'name': 'Fortran', 'bytes': '2218016'}, {'name': 'HTML', 'bytes': '397873'}, {'name': 'M4', 'bytes': '544767'}, {'name': 'Makefile', 'bytes': '25366'}, {'name': 'Python', 'bytes': '1727'}, {'name': 'Shell', 'bytes': '40683'}]}
package ru.atom.model; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.net.URL; import java.util.Comparator; import java.util.UUID; public class Person { private UUID id; private Gender gender; private String name; private int age; private Location location; private String desctiption; private Image image; private URL instagramUrl; private static ObjectMapper mapper = new ObjectMapper(); public static Person readJson(String json) throws IOException { return mapper.readValue(json, Person.class); } public String writeJson() throws JsonProcessingException { return mapper.writeValueAsString(this); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Person person = (Person) o; if (id != null ? !id.equals(person.id) : person.id != null) return false; if (gender != person.gender) return false; return name != null ? name.equals(person.name) : person.name == null; } @Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (gender != null ? gender.hashCode() : 0); result = 31 * result + (name != null ? name.hashCode() : 0); return result; } public UUID getId() { return id; } public void setId(UUID id) { this.id = id; } public Gender getGender() { return gender; } public void setGender(Gender gender) { this.gender = gender; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public Location getLocation() { return location; } public void setLocation(Location location) { this.location = location; } public String getDesctiption() { return desctiption; } public void setDesctiption(String desctiption) { this.desctiption = desctiption; } public Image getImage() { return image; } public void setImage(Image image) { this.image = image; } public URL getInstagramUrl() { return instagramUrl; } public void setInstagramUrl(URL instagramUrl) { this.instagramUrl = instagramUrl; } }
{'content_hash': '6f95c0eea12f3495be80dd5730140b4f', 'timestamp': '', 'source': 'github', 'line_count': 117, 'max_line_length': 81, 'avg_line_length': 22.247863247863247, 'alnum_prop': 0.6116019976949674, 'repo_name': 'Hunte9999/atom', 'id': 'b9f8cd2c350346c8771912d14fe25cfdb2d3d08f', 'size': '2603', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lecture02/src/main/java/ru/atom/model/Person.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '887'}, {'name': 'HTML', 'bytes': '3596'}, {'name': 'Java', 'bytes': '532528'}, {'name': 'JavaScript', 'bytes': '54267'}, {'name': 'XSLT', 'bytes': '2573'}]}
#import "MBDataHandlerBase.h" #import "MBWebservicesConfigurationParser.h" /** retrieves and sends MBDocument instances to and from a webservice. * The MBWebserviceDataHandler is the top level in the DataHandlers for HTTP network communication. Default behaviour is to process an MBDocument, add the result to the request body and perform an HTTP POST. * The endpoints.xmlx file maps Document names to Webservice URL's together with caching and timeout information. The response body is parsed with an XML parser by default, with JSON configurable. Parsing is validated against the Document Definition. * The response can be handled by a ResultListener, also defined in the endpoints.xmlx file. Matching is by regex, so errors can be flexibly handled. * Override this class to influence behaviour. There are a bunch of template methods for easily changing HTTP headers, HTTP method etc. * For testing with Self Signed Certificates, set the ALLOW_SELFSIGNED_SSL_CERTS flag in the build settings. * Caching is configurable and automatic. The cache key is based on the document name and arguments. For REST webservices the operation name is one of the arguments. */ @interface MBWebserviceDataHandler : MBDataHandlerBase { MBWebservicesConfiguration *_webServiceConfiguration; } // Initialize with configuration read from config files - (id) init; // Initialize with custom configuration - (id) initWithConfiguration:(MBWebservicesConfiguration *)configuration; - (MBDocument *) loadDocument:(NSString *)documentName; - (MBDocument *) loadDocument:(NSString *)documentName withArguments:(MBDocument *)args; - (void) storeDocument:(MBDocument *)document; - (MBEndPointDefinition *) getEndPointForDocument:(NSString*)name; /** override this method to influence the URL used by the client. @param url The URL specified by the EndPointDefinition linked to the Document @param args A Document containing arguments for the call to the Webservice */ -(NSString *)url:(NSString *)url WithArguments:(MBDocument*)args; /** override this method to influence the HTTP headers sent to the webservice. @param doc A Document containing arguments for the call to the Webservice */ -(void) setHTTPHeaders:(NSMutableURLRequest *)request withArguments:(MBDocument*) args; /** override this method to influence the HTTP request body sent to the webservice. @param request The request object for the call to the Webservice @param doc A Document containing arguments for the call to the Webservice */ -(void) setHTTPRequestBody:(NSMutableURLRequest *)request withArguments:(MBDocument*) args; /** Template method that retrieves the data from the webservice. @param request The request object for the call to the Webservice @param documentName The name of the Document being requested from the webservice @param endpoint The EndPointDefinition linked to the Document */ -(NSData *) dataFromRequest:(NSURLRequest *)request withDocumentName:(NSString*) documentName andEndpoint:(MBEndPointDefinition*)endPoint; /** Template method that checks the response against ResultListeners specified in the endpoint definitions and fires the ones that match. @param endpoint The EndPointDefinition linked to the Document @param args A Document containing arguments for the call to the Webservice @param dataString the result of the webservice call in string format. */ -(BOOL) checkResultListenerMatchesInEndpoint:(MBEndPointDefinition *)endpoint withArguments:(MBDocument*)args withResponse:(NSString*)dataString; /** Template method that parses the response and builds a Document. Override to implement or specify a custom parser @param endpoint The EndPointDefinition linked to the Document @param data The webservice response @param documentName The name of the Document being requested from the webservice */ -(MBDocument *) documentWithData:(NSData *)data andDocumentName:(NSString *)documentName; /** override this method to influence the format of the data sent to the webservice. @param doc A Document containing arguments for the call to the Webservice */ -(MBDocument *) reformatRequestArgumentsForServer:(MBDocument * )doc; /** convenience method to add housekeeping information to the request arguments @param element An Element in the Document containing the request arguments */ -(void) addAttributesToRequestArguments:(MBDocument *)doc; /** convenience method to add a checksum to the request arguments @param element An Element in the Document containing the request arguments */ -(void) addChecksumToRequestArguments:(MBElement *)element; @end // Delegate used for callbacks in asynchronous http request. // @interface MBRequestDelegate : NSObject // <NSURLConnectionDelegate> from iOS 5 on { BOOL _finished; NSMutableData *_data; NSURLConnection *_connection; NSError *_err; NSURLResponse *_response; } @property BOOL finished; @property (nonatomic, retain) NSURLConnection *connection; @property (nonatomic, retain) NSError *err; @property (nonatomic, retain) NSURLResponse *response; @property (nonatomic, retain) NSMutableData *data; @end
{'content_hash': 'c5c7b6777cb35bc31ee64eb8059bd045', 'timestamp': '', 'source': 'github', 'line_count': 106, 'max_line_length': 250, 'avg_line_length': 48.0188679245283, 'alnum_prop': 0.7946954813359528, 'repo_name': 'ItudeMobile/itude-mobile-ios-mobbl', 'id': 'f734f88b5bf68e03f97e314c5a290200ee1bdcf8', 'size': '5705', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/xcode/mobbl-core-lib/Services/DataManagerImpl/Handlers/MBWebserviceDataHandler.h', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '787'}, {'name': 'Objective-C', 'bytes': '1210770'}, {'name': 'Shell', 'bytes': '1597'}]}
<?php namespace Trappar\AliceGenerator\Tests\Fixtures; use Doctrine\ORM\Mapping as ORM; use Trappar\AliceGenerator\Annotation as Fixture; /** * @ORM\Entity() */ class DoctrinePersisterTester { /** * @ORM\Column() * @ORM\Id * @ORM\GeneratedValue() */ public $id; /** * @ORM\Column() */ public $mappedProperty; public $unmappedProperty; }
{'content_hash': '884e1b75777ee5f1f506c80d80d4fa73', 'timestamp': '', 'source': 'github', 'line_count': 27, 'max_line_length': 49, 'avg_line_length': 14.62962962962963, 'alnum_prop': 0.6126582278481013, 'repo_name': 'trappar/AliceGenerator', 'id': '0ac1755c295d8454873b4eb055a6ef0fcb07b3c0', 'size': '395', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'tests/Trappar/AliceGenerator/Fixtures/DoctrinePersisterTester.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'PHP', 'bytes': '91183'}]}
using DSA.Algorithms.Sorting; using DSA.DataStructures.Interfaces; using System; using System.Collections.Generic; using System.Linq; namespace DSA.Algorithms.Graphs { /// <summary> /// A static class containing extension methods for graph shortests paths computing using Bellman-Ford's algorithm. /// </summary> public static class BellmanFordShortestPathsFinder { /// <summary> /// Uses Bellman-Ford's algorithm to compute the shortest paths in a weighted graph. Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object containing the shortest paths. TWeight being the type of <see cref="long"/>. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="long"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <returns>Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> containing the shortest paths for the given source vertex. TWeight being the type of <see cref="long"/>.</returns> public static WeightedGraphShortestPaths<TVertex, long> BellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, long> graph, TVertex source) where TVertex : IComparable<TVertex> { return BellmanFordShortestPaths(graph, source, (x, y) => x + y); } /// <summary> /// Tries to compute the shortest paths in a weighted graph with the Bellman-Ford's algorithm. Returns true if successful; otherwise false. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="long"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <param name="shortestPaths">The <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object (TWeight being the type of <see cref="long"/>) that contains the shortest paths of the graph if the algorithm was successful; otherwise null.</param> /// <returns>Returns true if the shortest paths were successfully computed; otherwise false. Also returns false if the given source vertex does not belong to the graph.</returns> public static bool TryGetBellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, long> graph, TVertex source, out WeightedGraphShortestPaths<TVertex, long> shortestPaths) where TVertex : IComparable<TVertex> { return TryGetBellmanFordShortestPaths(graph, source, out shortestPaths, (x, y) => x + y); } /// <summary> /// Uses Bellman-Ford's algorithm to compute the shortest paths in a weighted graph. Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object containing the shortest paths. TWeight being the type of <see cref="int"/>. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="int"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <returns>Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> containing the shortest paths for the given source vertex. TWeight being the type of <see cref="int"/>.</returns> public static WeightedGraphShortestPaths<TVertex, int> BellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, int> graph, TVertex source) where TVertex : IComparable<TVertex> { return BellmanFordShortestPaths(graph, source, (x, y) => x + y); } /// <summary> /// Tries to compute the shortest paths in a weighted graph with the Bellman-Ford's algorithm. Returns true if successful; otherwise false. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="int"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <param name="shortestPaths">The <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object (TWeight being the type of <see cref="int"/>) that contains the shortest paths of the graph if the algorithm was successful; otherwise null.</param> /// <returns>Returns true if the shortest paths were successfully computed; otherwise false. Also returns false if the given source vertex does not belong to the graph.</returns> public static bool TryGetBellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, int> graph, TVertex source, out WeightedGraphShortestPaths<TVertex, int> shortestPaths) where TVertex : IComparable<TVertex> { return TryGetBellmanFordShortestPaths(graph, source, out shortestPaths, (x, y) => x + y); } /// <summary> /// Uses Bellman-Ford's algorithm to compute the shortest paths in a weighted graph. Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object containing the shortest paths. TWeight being the type of <see cref="short"/>. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="short"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <returns>Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> containing the shortest paths for the given source vertex. TWeight being the type of <see cref="short"/>.</returns> public static WeightedGraphShortestPaths<TVertex, short> BellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, short> graph, TVertex source) where TVertex : IComparable<TVertex> { return BellmanFordShortestPaths(graph, source, (x, y) => (short)(x + y)); } /// <summary> /// Tries to compute the shortest paths in a weighted graph with the Bellman-Ford's algorithm. Returns true if successful; otherwise false. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="short"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <param name="shortestPaths">The <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object (TWeight being the type of <see cref="short"/>) that contains the shortest paths of the graph if the algorithm was successful; otherwise null.</param> /// <returns>Returns true if the shortest paths were successfully computed; otherwise false. Also returns false if the given source vertex does not belong to the graph.</returns> public static bool TryGetBellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, short> graph, TVertex source, out WeightedGraphShortestPaths<TVertex, short> shortestPaths) where TVertex : IComparable<TVertex> { return TryGetBellmanFordShortestPaths(graph, source, out shortestPaths, (x, y) => (short)(x + y)); } /// <summary> /// Uses Bellman-Ford's algorithm to compute the shortest paths in a weighted graph. Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object containing the shortest paths. TWeight being the type of <see cref="ulong"/>. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="ulong"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <returns>Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> containing the shortest paths for the given source vertex. TWeight being the type of <see cref="ulong"/>.</returns> public static WeightedGraphShortestPaths<TVertex, ulong> BellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, ulong> graph, TVertex source) where TVertex : IComparable<TVertex> { return BellmanFordShortestPaths(graph, source, (x, y) => x + y); } /// <summary> /// Tries to compute the shortest paths in a weighted graph with the Bellman-Ford's algorithm. Returns true if successful; otherwise false. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="ulong"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <param name="shortestPaths">The <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object (TWeight being the type of <see cref="ulong"/>) that contains the shortest paths of the graph if the algorithm was successful; otherwise null.</param> /// <returns>Returns true if the shortest paths were successfully computed; otherwise false. Also returns false if the given source vertex does not belong to the graph.</returns> public static bool TryGetBellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, ulong> graph, TVertex source, out WeightedGraphShortestPaths<TVertex, ulong> shortestPaths) where TVertex : IComparable<TVertex> { return TryGetBellmanFordShortestPaths(graph, source, out shortestPaths, (x, y) => x + y); } /// <summary> /// Uses Bellman-Ford's algorithm to compute the shortest paths in a weighted graph. Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object containing the shortest paths. TWeight being the type of <see cref="uint"/>. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="uint"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <returns>Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> containing the shortest paths for the given source vertex. TWeight being the type of <see cref="uint"/>.</returns> public static WeightedGraphShortestPaths<TVertex, uint> BellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, uint> graph, TVertex source) where TVertex : IComparable<TVertex> { return BellmanFordShortestPaths(graph, source, (x, y) => x + y); } /// <summary> /// Tries to compute the shortest paths in a weighted graph with the Bellman-Ford's algorithm. Returns true if successful; otherwise false. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="uint"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <param name="shortestPaths">The <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object (TWeight being the type of <see cref="uint"/>) that contains the shortest paths of the graph if the algorithm was successful; otherwise null.</param> /// <returns>Returns true if the shortest paths were successfully computed; otherwise false. Also returns false if the given source vertex does not belong to the graph.</returns> public static bool TryGetBellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, uint> graph, TVertex source, out WeightedGraphShortestPaths<TVertex, uint> shortestPaths) where TVertex : IComparable<TVertex> { return TryGetBellmanFordShortestPaths(graph, source, out shortestPaths, (x, y) => x + y); } /// <summary> /// Uses Bellman-Ford's algorithm to compute the shortest paths in a weighted graph. Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object containing the shortest paths. TWeight being the type of <see cref="ushort"/>. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="ushort"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <returns>Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> containing the shortest paths for the given source vertex. TWeight being the type of <see cref="ushort"/>.</returns> public static WeightedGraphShortestPaths<TVertex, ushort> BellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, ushort> graph, TVertex source) where TVertex : IComparable<TVertex> { return BellmanFordShortestPaths(graph, source, (x, y) => (ushort)(x + y)); } /// <summary> /// Tries to compute the shortest paths in a weighted graph with the Bellman-Ford's algorithm. Returns true if successful; otherwise false. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="ushort"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <param name="shortestPaths">The <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object (TWeight being the type of <see cref="ushort"/>) that contains the shortest paths of the graph if the algorithm was successful; otherwise null.</param> /// <returns>Returns true if the shortest paths were successfully computed; otherwise false. Also returns false if the given source vertex does not belong to the graph.</returns> public static bool TryGetBellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, ushort> graph, TVertex source, out WeightedGraphShortestPaths<TVertex, ushort> shortestPaths) where TVertex : IComparable<TVertex> { return TryGetBellmanFordShortestPaths(graph, source, out shortestPaths, (x, y) => (ushort)(x + y)); } /// <summary> /// Uses Bellman-Ford's algorithm to compute the shortest paths in a weighted graph. Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object containing the shortest paths. TWeight being the type of <see cref="decimal"/>. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="decimal"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <returns>Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> containing the shortest paths for the given source vertex. TWeight being the type of <see cref="decimal"/>.</returns> public static WeightedGraphShortestPaths<TVertex, decimal> BellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, decimal> graph, TVertex source) where TVertex : IComparable<TVertex> { return BellmanFordShortestPaths(graph, source, (x, y) => x + y); } /// <summary> /// Tries to compute the shortest paths in a weighted graph with the Bellman-Ford's algorithm. Returns true if successful; otherwise false. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="decimal"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <param name="shortestPaths">The <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object (TWeight being the type of <see cref="decimal"/>) that contains the shortest paths of the graph if the algorithm was successful; otherwise null.</param> /// <returns>Returns true if the shortest paths were successfully computed; otherwise false. Also returns false if the given source vertex does not belong to the graph.</returns> public static bool TryGetBellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, decimal> graph, TVertex source, out WeightedGraphShortestPaths<TVertex, decimal> shortestPaths) where TVertex : IComparable<TVertex> { return TryGetBellmanFordShortestPaths(graph, source, out shortestPaths, (x, y) => x + y); } /// <summary> /// Uses Bellman-Ford's algorithm to compute the shortest paths in a weighted graph. Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object containing the shortest paths. TWeight being the type of <see cref="double"/>. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="double"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <returns>Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> containing the shortest paths for the given source vertex. TWeight being the type of <see cref="double"/>.</returns> public static WeightedGraphShortestPaths<TVertex, double> BellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, double> graph, TVertex source) where TVertex : IComparable<TVertex> { return BellmanFordShortestPaths(graph, source, (x, y) => x + y); } /// <summary> /// Tries to compute the shortest paths in a weighted graph with the Bellman-Ford's algorithm. Returns true if successful; otherwise false. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="double"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <param name="shortestPaths">The <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object (TWeight being the type of <see cref="double"/>) that contains the shortest paths of the graph if the algorithm was successful; otherwise null.</param> /// <returns>Returns true if the shortest paths were successfully computed; otherwise false. Also returns false if the given source vertex does not belong to the graph.</returns> public static bool TryGetBellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, double> graph, TVertex source, out WeightedGraphShortestPaths<TVertex, double> shortestPaths) where TVertex : IComparable<TVertex> { return TryGetBellmanFordShortestPaths(graph, source, out shortestPaths, (x, y) => x + y); } /// <summary> /// Uses Bellman-Ford's algorithm to compute the shortest paths in a weighted graph. Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object containing the shortest paths. TWeight being the type of <see cref="float"/>. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="float"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <returns>Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> containing the shortest paths for the given source vertex. TWeight being the type of <see cref="float"/>.</returns> public static WeightedGraphShortestPaths<TVertex, float> BellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, float> graph, TVertex source) where TVertex : IComparable<TVertex> { return BellmanFordShortestPaths(graph, source, (x, y) => x + y); } /// <summary> /// Tries to compute the shortest paths in a weighted graph with the Bellman-Ford's algorithm. Returns true if successful; otherwise false. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/> with TWeight being of type <see cref="float"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <param name="shortestPaths">The <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object (TWeight being the type of <see cref="float"/>) that contains the shortest paths of the graph if the algorithm was successful; otherwise null.</param> /// <returns>Returns true if the shortest paths were successfully computed; otherwise false. Also returns false if the given source vertex does not belong to the graph.</returns> public static bool TryGetBellmanFordShortestPaths<TVertex>(this IWeightedGraph<TVertex, float> graph, TVertex source, out WeightedGraphShortestPaths<TVertex, float> shortestPaths) where TVertex : IComparable<TVertex> { return TryGetBellmanFordShortestPaths(graph, source, out shortestPaths, (x, y) => x + y); } /// <summary> /// Uses Bellman-Ford's algorithm to compute the shortest paths in a weighted graph. Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object containing the shortest paths. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <typeparam name="TWeight">The data type of weight of the edges. TWeight implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <param name="weightAdder">The method corresponding to the <see cref="AddWeights{TWeight}"/> delegate used for calculating the sum of two edge weights.</param> /// <returns>Returns a <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> containing the shortest paths for the given source vertex.</returns> public static WeightedGraphShortestPaths<TVertex, TWeight> BellmanFordShortestPaths<TVertex, TWeight>(this IWeightedGraph<TVertex, TWeight> graph, TVertex source, AddWeights<TWeight> weightAdder) where TVertex : IComparable<TVertex> where TWeight : IComparable<TWeight> { if (!graph.ContainsVertex(source)) throw new ArgumentException("Vertex does not belong to the graph!"); WeightedGraphShortestPaths<TVertex, TWeight> shortestPaths; if (TryGetBellmanFordShortestPaths(graph, source, out shortestPaths, weightAdder)) return shortestPaths; else throw new InvalidOperationException("Negative weight cycle found!"); } /// <summary> /// Tries to compute the shortest paths in a weighted graph with the Bellman-Ford's algorithm. Returns true if successful; otherwise false. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <typeparam name="TWeight">The data type of weight of the edges. TWeight implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IWeightedGraph{TVertex, TWeight}"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <param name="shortestPaths">The <see cref="WeightedGraphShortestPaths{TVertex, TWeight}"/> object that contains the shortest paths of the graph if the algorithm was successful; otherwise null.</param> /// <param name="weightAdder">The method corresponding to the <see cref="AddWeights{TWeight}"/> delegate used for calculating the sum of two edge weights.</param> /// <returns>Returns true if the shortest paths were successfully computed; otherwise false. Also returns false if the given source vertex does not belong to the graph.</returns> public static bool TryGetBellmanFordShortestPaths<TVertex, TWeight>(this IWeightedGraph<TVertex, TWeight> graph, TVertex source, out WeightedGraphShortestPaths<TVertex, TWeight> shortestPaths, AddWeights<TWeight> weightAdder) where TVertex : IComparable<TVertex> where TWeight : IComparable<TWeight> { shortestPaths = null; if (!graph.ContainsVertex(source)) return false; // A dictionary holding a vertex as key and as value a key-value pair of its previous vertex in the path(being the key) and the weight of the edge connecting them(being the value). var previousVertices = new Dictionary<TVertex, KeyValuePair<TVertex, TWeight>>(); // The dictionary holding a vertex as key and as value a key-value pair holding the weight of the path from the source vertex(being the key) and the distance from the source vertex(being the value). var weightAndDistance = new Dictionary<TVertex, KeyValuePair<TWeight, int>>(); // Add source vertex to computed weights and distances weightAndDistance.Add(source, new KeyValuePair<TWeight, int>(default(TWeight), 0)); // Get all edges and sort them by their source and then by their destination vertex to create a consistent shortest paths output. var allEdges = graph.Edges.ToList(); if (allEdges.Count > 0) allEdges.QuickSort((x, y) => { int cmp = x.Source.CompareTo(y.Source); if (cmp == 0) cmp = x.Destination.CompareTo(y.Destination); return cmp; }); // We relax all edges n - 1 times and if at the n-th step a relaxation is needed we have a negative cycle int lastStep = graph.VerticesCount - 1; for (int i = 0; i < graph.VerticesCount; i++) { foreach (var edge in allEdges) { var edgeSource = edge.Source; var edgeDestination = edge.Destination; var edgeWeight = edge.Weight; // If we have computed the path to the the source vertex of the edge if (weightAndDistance.ContainsKey(edgeSource)) { var wd = weightAndDistance[edgeSource]; TWeight curWeight = wd.Key; int curDistance = wd.Value; // If the edge destination is the source we continue with the next edge if (object.Equals(source, edgeDestination)) continue; // Compute path weight TWeight pathWeight; if (curWeight == null) pathWeight = edgeWeight; else pathWeight = weightAdder(curWeight, edgeWeight); // If this path is longer than an already computed path we continue with the next edge if (weightAndDistance.ContainsKey(edgeDestination)) { int cmp = pathWeight.CompareTo(weightAndDistance[edgeDestination].Key); if (cmp > 0) continue; else if (cmp == 0)// if path is equal to an already computed path { // we continue with the next edge only if the distance is bigger or equal if (curDistance + 1 >= weightAndDistance[edgeDestination].Value) continue; // if the distance is smaller we update the path with this one } } if (i == lastStep)// if we need to relax on the last iteration we have a negative cycle return false; // Else we save the path previousVertices[edgeDestination] = new KeyValuePair<TVertex, TWeight>(edgeSource, edgeWeight); weightAndDistance[edgeDestination] = new KeyValuePair<TWeight, int>(pathWeight, curDistance + 1); } } } // Remove source vertex from weight and distance dictionary weightAndDistance.Remove(source); shortestPaths = new WeightedGraphShortestPaths<TVertex, TWeight>(source, previousVertices, weightAndDistance); return true; } /// <summary> /// Uses Bellman-Ford's algorithm to compute the shortest paths in an unweighted graph. Shortest paths are computed with the distance between the vertices. Returns an <see cref="UnweightedGraphShortestPaths{TVertex}"/> object containg the shortest paths. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IGraph{TVertex}"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <returns>Returns a <see cref="UnweightedGraphShortestPaths{TVertex}"/> containing the shortest paths for the given source vertex.</returns> public static UnweightedGraphShortestPaths<TVertex> BellmanFordShortestPaths<TVertex>(this IGraph<TVertex> graph, TVertex source) where TVertex : IComparable<TVertex> { if (!graph.ContainsVertex(source)) throw new ArgumentException("Vertex does not belong to the graph!"); UnweightedGraphShortestPaths<TVertex> shortestPaths; if (TryGetBellmanFordShortestPaths(graph, source, out shortestPaths)) return shortestPaths; else throw new InvalidOperationException("Negative weight cycle found!"); } /// <summary> /// Tries to compute the shortest paths in an unweighted graph with the Bellman-Ford's algorithm. Shortest paths are computed with the distance between the vertices. Returns true if successful; otherwise false. /// </summary> /// <typeparam name="TVertex">The data type of the vertices. TVertex implements <see cref="IComparable{T}"/>.</typeparam> /// <param name="graph">The graph structure that implements <see cref="IGraph{TVertex}"/>.</param> /// <param name="source">The source vertex for which the shortest paths are computed.</param> /// <param name="shortestPaths">The <see cref="UnweightedGraphShortestPaths{TVertex}"/> object that contains the shortest paths of the graph if the algorithm was successful; otherwise null.</param> /// <returns>Returns true if the shortest paths were successfully computed; otherwise false. Also returns false if the given source vertex does not belong to the graph.</returns> public static bool TryGetBellmanFordShortestPaths<TVertex>(this IGraph<TVertex> graph, TVertex source, out UnweightedGraphShortestPaths<TVertex> shortestPaths) where TVertex : IComparable<TVertex> { shortestPaths = null; if (!graph.ContainsVertex(source)) return false; // A dictionary holding a vertex as key and its previous vertex in the path as value. var previousVertices = new Dictionary<TVertex, TVertex>(); // A dictionary holding a vertex as key and the distance from the source vertex as value. var pathDistance = new Dictionary<TVertex, int>(); // Add source vertex to computed distances pathDistance.Add(source, 0); // Get all edges and sort them by their source and then by their destination vertex to create a consistent shortest paths output. var allEdges = graph.Edges.ToList(); if (allEdges.Count > 0) allEdges.QuickSort((x, y) => { int cmp = x.Source.CompareTo(y.Source); if (cmp == 0) cmp = x.Destination.CompareTo(y.Destination); return cmp; }); // We relax all edges n - 1 times and if at the n-th step a relaxation is needed we have a negative cycle int lastStep = graph.VerticesCount - 1; for (int i = 0; i < graph.VerticesCount; i++) { foreach (var edge in allEdges) { var edgeSource = edge.Source; var edgeDestination = edge.Destination; // If we have computed the path to the the source vertex of the edge if (pathDistance.ContainsKey(edgeSource)) { int curDistance = pathDistance[edgeSource]; // If the edge destination is the source we continue with the next edge if (object.Equals(source, edgeDestination)) continue; int newDistance = curDistance + 1; // If this distance is bigger or equal than an already computed distance we continue with the next edge if (pathDistance.ContainsKey(edgeDestination)) if (newDistance.CompareTo(pathDistance[edgeDestination]) >= 0) continue; if (i == lastStep)// if we need to relax on the last iteration we have a negative cycle return false; // Else we save the path previousVertices[edgeDestination] = edgeSource; pathDistance[edgeDestination] = newDistance; } } } // Remove source vertex from path distance dictionary pathDistance.Remove(source); shortestPaths = new UnweightedGraphShortestPaths<TVertex>(source, previousVertices, pathDistance); return true; } } }
{'content_hash': '42491392a077113550b38f1171a6019a', 'timestamp': '', 'source': 'github', 'line_count': 472, 'max_line_length': 262, 'avg_line_length': 78.7457627118644, 'alnum_prop': 0.6680477830391734, 'repo_name': 'abdonkov/DSA', 'id': 'ae73992f5c40c18cb8a8e5e148de366d12dce604', 'size': '37170', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'DSA/DSA/Algorithms/Graphs/BellmanFordShortestPathsFinder.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '2441924'}]}
require "timecode/version" module Timecode def self.addzero(val) newval="" if val.to_i <= 9 and not val == "ff" newval="0"+val.to_s else return val end return newval end def self.convert_to_frames(timecode) frames =0 #Split the timecode string into it's component parts. NOTE: The string must #be in the form hh:mm:ss:ff otherwise an error will occur. tc = timecode.split(":") #The following are based on 25 fps. frames = (tc[0].to_i * 90000 + tc[1].to_i* 1500) + tc[2].to_i * 25 + tc[3].to_i return frames end def self.convert_from_frames(frames) intHours, intMins, intSecs, intFrames, intTmp=0 timecode ="" #Convert frames to hours, minutes and seconds. #Total number of seconds intSecs = (frames / 25).to_i #Total number of minutes intMins = (intSecs / 60).to_i #Total number of hours intHours = (intSecs / 3600).to_i #Number of secs remaining after subtracting number of mins. intSecs = ((frames / 25) - (intMins * 60)).to_i #Number of mins remaining after subtracting number of hours. intMins = intMins - (intHours * 60) #Determine the number of frames remaining after subtracting hours,mins and secs intTmp = intSecs * 25 intTmp = intTmp + (intMins * 60 * 25) intTmp = intTmp + (intHours * 60 * 60 * 25) intFrames = frames - intTmp #Convert to string, adding leading 0 where value is less than 10,and separating with ':' timecode = addzero(intHours.to_s) + ":" + addzero(intMins.to_s) + ":" + addzero(intSecs.to_s) + ":" + addzero(intFrames.to_s) return timecode end def self.convert_from_frames_to_datetime_no_frames(frames) intHours, intMins, intSecs, intFrames, intTmp=0 timecode ="" #Convert frames to hours, minutes and seconds. #Total number of seconds intSecs = (frames / 25).to_i #Total number of minutes intMins = (intSecs / 60).to_i #Total number of hours intHours = (intSecs / 3600).to_i #Number of secs remaining after subtracting number of mins. intSecs = ((frames / 25) - (intMins * 60)).to_i #Number of mins remaining after subtracting number of hours. intMins = intMins - (intHours * 60) #Determine the number of frames remaining after subtracting hours,mins and secs intTmp = intSecs * 25 intTmp = intTmp + (intMins * 60 * 25) intTmp = intTmp + (intHours * 60 * 60 * 25) intFrames = frames - intTmp if(intFrames==25) intFrames=24 end #Convert to string, adding leading 0 where value is less than 10,and separating with ':' timecode = addzero(intHours.to_s) + ":" + addzero(intMins.to_s) + ":" + addzero(intSecs.to_s) return timecode end def self.convert_from_frames_to_datetime(frames) intHours, intMins, intSecs, intFrames, intTmp=0 timecode ="" #Convert frames to hours, minutes and seconds. #Total number of seconds intSecs = (frames / 25).to_i #Total number of minutes intMins = (intSecs / 60).to_i #Total number of hours intHours = (intSecs / 3600).to_i #Number of secs remaining after subtracting number of mins. intSecs = ((frames / 25) - (intMins * 60)).to_i #Number of mins remaining after subtracting number of hours. intMins = intMins - (intHours * 60) #Determine the number of frames remaining after subtracting hours,mins and secs intTmp = intSecs * 25 intTmp = intTmp + (intMins * 60 * 25) intTmp = intTmp + (intHours * 60 * 60 * 25) intFrames = frames - intTmp if(intFrames==25) intFrames=24 end #Convert to string, adding leading 0 where value is less than 10,and separating with ':' timecode = addzero(intHours.to_s) + ":" + addzero(intMins.to_s) + ":" + addzero(intSecs.to_s) + "." + "%03d" % (intFrames*40) return timecode end ## # converte un timecode "00:00:30:23" -> 12323 # in BCD time usato da Harrsi per storare i timecode in # ASDB # def self.timecode_to_bcd(timecode) result = timecode.split(":").map{|x| x.to_i(16)}.pack("C*").unpack("N").first return result end def self.add_timecode(timecode1, timecode2) tc1 ,tc2 = 0 tc1 = self.convert_to_frames(timecode1) tc2 = self.convert_to_frames(timecode2) return self.convert_from_frames(tc1 + tc2) end def self.diff_timecode(timecode1, timecode2) tc1 ,tc2 = 0 tc1 = self.convert_to_frames(timecode1) tc2 = self.convert_to_frames(timecode2) return self.convert_from_frames(tc1 - tc2) end end
{'content_hash': 'e00f286f2e188f4da4475a8a86845952', 'timestamp': '', 'source': 'github', 'line_count': 170, 'max_line_length': 134, 'avg_line_length': 29.11764705882353, 'alnum_prop': 0.5981818181818181, 'repo_name': 'lello107/timecode', 'id': 'b4bd2113ecefe916a115469c586ef0e99abed71a', 'size': '4950', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/timecode.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Ruby', 'bytes': '4451'}]}
/* * CrissCross * A multi-purpose cross-platform library. * * A product of IO.IN Research. * * (c) 2006-2008 Steven Noonan. * Licensed under the New BSD License. * */ #ifndef __included_shellsort_test_h #define __included_shellsort_test_h #ifdef ENABLE_SORTS int TestShellSort_IntArray(); int TestShellSort_DArray(); int TestShellSort_LList(); #endif #endif
{'content_hash': 'fcf151356b6dad1b27b39e67cf3fa1e6', 'timestamp': '', 'source': 'github', 'line_count': 23, 'max_line_length': 44, 'avg_line_length': 16.608695652173914, 'alnum_prop': 0.6910994764397905, 'repo_name': 'prophile/crisscross', 'id': '67c8b38575dea24f706916fb7d95700bc0bc9cf8', 'size': '382', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'TestSuite/shellsort.h', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '27849'}, {'name': 'C++', 'bytes': '520371'}, {'name': 'Shell', 'bytes': '2815'}]}
package org.slf4j.helpers; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.event.EventRecodingLogger; /** * @author Chetan Mehrotra */ public class SubstitutableLoggerTest { private static final Set<String> EXCLUDED_METHODS = new HashSet<String>(Arrays.asList("getName")); @Test public void testDelegate() throws Exception { SubstituteLogger log = new SubstituteLogger("foo", null); assertTrue(log.delegate() instanceof EventRecodingLogger); Set<String> expectedMethodSignatures = determineMethodSignatures(Logger.class); LoggerInvocationHandler ih = new LoggerInvocationHandler(); Logger proxyLogger = (Logger) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] { Logger.class }, ih); log.setDelegate(proxyLogger); invokeMethods(log); // Assert that all methods are delegated expectedMethodSignatures.removeAll(ih.getInvokedMethodSignatures()); if (!expectedMethodSignatures.isEmpty()) { fail("Following methods are not delegated " + expectedMethodSignatures.toString()); } } private void invokeMethods(Logger proxyLogger) throws InvocationTargetException, IllegalAccessException { for (Method m : Logger.class.getDeclaredMethods()) { if (!EXCLUDED_METHODS.contains(m.getName())) { m.invoke(proxyLogger, new Object[m.getParameterTypes().length]); } } } private class LoggerInvocationHandler implements InvocationHandler { private final Set<String> invokedMethodSignatures = new HashSet<String>(); public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { invokedMethodSignatures.add(getMethodSignature(method)); if (method.getName().startsWith("is")) { return true; } return null; } public Set<String> getInvokedMethodSignatures() { return invokedMethodSignatures; } } private static Set<String> determineMethodSignatures(Class<Logger> loggerClass) { Set<String> methodSignatures = new HashSet<String>(); for (Method m : loggerClass.getDeclaredMethods()) { if (!EXCLUDED_METHODS.contains(m.getName())) { methodSignatures.add(getMethodSignature(m)); } } return methodSignatures; } private static String getMethodSignature(Method m) { List<String> result = new ArrayList<String>(); result.add(m.getName()); for (Class<?> clazz : m.getParameterTypes()) { result.add(clazz.getSimpleName()); } return result.toString(); } }
{'content_hash': '1e44b2cc936cf424c6ae159f5cf40ab7', 'timestamp': '', 'source': 'github', 'line_count': 88, 'max_line_length': 124, 'avg_line_length': 36.25, 'alnum_prop': 0.6567398119122257, 'repo_name': 'tjth/bitcoinj-lotterycoin', 'id': '0df533614610f9d80a3bc7805db5049ed1c80296', 'size': '4415', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'slf4j-1.7.16/slf4j-api/src/test/java/org/slf4j/helpers/SubstitutableLoggerTest.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ApacheConf', 'bytes': '182'}, {'name': 'CSS', 'bytes': '54899'}, {'name': 'HTML', 'bytes': '10416727'}, {'name': 'Java', 'bytes': '5460862'}, {'name': 'JavaScript', 'bytes': '13726'}, {'name': 'Protocol Buffer', 'bytes': '38063'}]}
package com.bloomberglp.blpapi; import java.util.concurrent.atomic.AtomicLong; public final class CorrelationID { private long bg; private Object bh; private static final AtomicLong bi = new AtomicLong(0L); private int bj; public CorrelationID(long paramLong) { this.bj = 3; this.bg = paramLong; this.bh = null; } public CorrelationID(Object paramObject) { if (paramObject == null) { throw new IllegalArgumentException("Null value"); } this.bj = 7; this.bg = 0L; this.bh = paramObject; } public CorrelationID() { this.bj = 1; this.bg = bi.incrementAndGet(); this.bh = null; } public CorrelationID(CorrelationID paramCorrelationID) { this.bj = paramCorrelationID.bj; this.bg = paramCorrelationID.bg; this.bh = paramCorrelationID.bh; } public long value() { if ((this.bj & 0x4) == 0) { return this.bg; } throw new IllegalStateException(); } public Object object() { if ((this.bj & 0x4) != 0) { return this.bh; } throw new IllegalStateException(); } public boolean isInternal() { return (this.bj & 0x2) == 0; } public boolean isObject() { return (this.bj & 0x4) != 0; } public boolean isValue() { return (this.bj & 0x4) == 0; } public boolean equals(Object paramObject) { if (this == paramObject) { return true; } if ((paramObject instanceof CorrelationID)) { CorrelationID localCorrelationID = (CorrelationID)paramObject; if (this.bj != localCorrelationID.bj) { return false; } return this.bg == localCorrelationID.bg ? true : isObject() ? this.bh.equals(localCorrelationID.bh) : false; } return false; } public int hashCode() { return isValue() ? (int)(this.bg ^ this.bg >>> 32) : this.bh.hashCode(); } public String toString() { switch (this.bj) { case 0: return "Uninitialized"; case 1: return "Internal: " + this.bg; case 3: return "User: " + this.bg; } return "User: " + this.bh.toString(); } }
{'content_hash': '51d2d1690020ab82d3bcf8d2b8551465', 'timestamp': '', 'source': 'github', 'line_count': 110, 'max_line_length': 111, 'avg_line_length': 17.990909090909092, 'alnum_prop': 0.6472966144517434, 'repo_name': 'red2901/sandbox', 'id': 'd62b4992368dabad6a423f8a05442a7219245784', 'size': '2186', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'exceldna/Libs/Bemu/BEmuJava/bemu/src/main/java/com/bloomberglp/blpapi/CorrelationID.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ASP', 'bytes': '7920'}, {'name': 'Assembly', 'bytes': '526787'}, {'name': 'Batchfile', 'bytes': '17812'}, {'name': 'C', 'bytes': '416259'}, {'name': 'C#', 'bytes': '11438116'}, {'name': 'C++', 'bytes': '2770094'}, {'name': 'CMake', 'bytes': '6806'}, {'name': 'CSS', 'bytes': '20674'}, {'name': 'E', 'bytes': '800'}, {'name': 'F#', 'bytes': '702'}, {'name': 'HTML', 'bytes': '9558034'}, {'name': 'Java', 'bytes': '409044'}, {'name': 'JavaScript', 'bytes': '37364'}, {'name': 'Makefile', 'bytes': '54316'}, {'name': 'Objective-C', 'bytes': '1629'}, {'name': 'PowerShell', 'bytes': '10735'}, {'name': 'Python', 'bytes': '1094'}, {'name': 'Shell', 'bytes': '2038'}, {'name': 'Visual Basic', 'bytes': '64564'}]}
package com.spike.giantdataanalysis.coordination.group; import java.util.Map; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.framework.imps.CuratorFrameworkState; import org.apache.curator.framework.recipes.nodes.GroupMember; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import com.spike.giantdataanalysis.coordination.Coordinations; /** * 群组协同 * @author zhoujiagen */ public class GroupCoordination { private static final Logger LOG = LoggerFactory.getLogger(GroupCoordination.class); private final String zookeeperConnectionString; private final String membershipPath; private final String memberId; private final String memberDescription; private CuratorFramework client; private GroupMember groupMember; /** * 群组协同 * @param zookeeperConnectionString ZK连接串 * @param membershipPath 使用的组ZNode路径 * @param memberId 成员标识 * @param memberDescription 成员描述 */ public GroupCoordination(String zookeeperConnectionString, String membershipPath, String memberId, String memberDescription) { Preconditions.checkArgument(StringUtils.isNotBlank(zookeeperConnectionString), "ZK连接串不可为空!"); Preconditions.checkArgument(StringUtils.isNotBlank(membershipPath), "使用的组ZNode路径不可为空!"); Preconditions.checkArgument(StringUtils.isNotBlank(memberId), "成员标识不可为空!"); Preconditions.checkArgument(StringUtils.isNotBlank(memberDescription), " 成员描述不可为空!"); this.zookeeperConnectionString = zookeeperConnectionString; this.membershipPath = membershipPath; this.memberId = memberId; this.memberDescription = memberDescription; this.init(); } public GroupCoordination(CuratorFramework client, String membershipPath, String memberId, String memberDescription) { Preconditions.checkArgument(client != null, "Curator客户端不可为空!"); Preconditions.checkArgument(!CuratorFrameworkState.STOPPED.equals(client.getState()), "Curator客户端已停止!"); Preconditions.checkArgument(StringUtils.isNotBlank(membershipPath), " 使用的ZNode路径不可为空!"); Preconditions.checkArgument(StringUtils.isNotBlank(memberId), "成员标识不可为空!"); Preconditions.checkArgument(StringUtils.isNotBlank(memberDescription), " 成员描述不可为空!"); this.client = client; this.zookeeperConnectionString = client.getZookeeperClient().getCurrentConnectionString(); this.membershipPath = membershipPath; this.memberId = memberId; this.memberDescription = memberDescription; this.init(); } /** * 加入群组. */ public void join() { LOG.info("Member[{}: {}] join Group[{}] on Quorum[{}]", memberId, memberDescription, membershipPath, zookeeperConnectionString); groupMember.start(); } /** * 重新加入群组. */ public void rejoin() { LOG.info("Member[{}: {}] rejoin Group[{}] on Quorum[{}]", memberId, memberDescription, membershipPath, zookeeperConnectionString); this.init(); groupMember.start(); } /** * 退出群组. * @param groupMember */ public void quit() { LOG.info("Member[{}: {}] quit Group[{}] on Quorum[{}]", memberId, memberDescription, membershipPath, zookeeperConnectionString); groupMember.close(); } // 初始化GroupMember. private void init() { if (client == null) { client = CuratorFrameworkFactory.newClient(zookeeperConnectionString, Coordinations.DEFAULT_CURATOR_RETRY_POLICY); client.start(); } else { if (CuratorFrameworkState.LATENT.equals(client.getState())) { client.start(); } } // 组成员 groupMember = new GroupMember(client, membershipPath, memberId, memberDescription.getBytes()); } /** * 获取组中所有成员. * @param groupMember * @return Map[memberId, memberDescription] */ public Map<String, String> getMembers() { Map<String, String> result = Maps.newHashMap(); Map<String, byte[]> members = groupMember.getCurrentMembers(); if (MapUtils.isNotEmpty(members)) { for (String memberId : members.keySet()) { result.put(memberId, String.valueOf(members.get(memberId))); } } return result; } }
{'content_hash': '6e3a91c2815624ae2e89140fef45a0b7', 'timestamp': '', 'source': 'github', 'line_count': 142, 'max_line_length': 98, 'avg_line_length': 30.640845070422536, 'alnum_prop': 0.7246609974718455, 'repo_name': 'zhoujiagen/giant-data-analysis', 'id': 'b74cc3e852020885bf1dd28c57564c4d38f50518', 'size': '4599', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'data-pipeline/infrastructure-coordination/src/main/java/com/spike/giantdataanalysis/coordination/group/GroupCoordination.java', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'Dockerfile', 'bytes': '512'}, {'name': 'FreeMarker', 'bytes': '247'}, {'name': 'Groovy', 'bytes': '565'}, {'name': 'HTML', 'bytes': '509'}, {'name': 'Java', 'bytes': '3666096'}, {'name': 'Python', 'bytes': '126179'}, {'name': 'Ruby', 'bytes': '3140'}, {'name': 'Scala', 'bytes': '165639'}, {'name': 'Shell', 'bytes': '37085'}, {'name': 'Thrift', 'bytes': '7703'}, {'name': 'XSLT', 'bytes': '2430'}]}
// // CLConfluenceClient.h // Confluence client // // Created by Chris Lundie on 09/Apr/2012. // Copyright (c) 2012 Chris Lundie. All rights reserved. // @class GTMHTTPFetcher; #import <Foundation/Foundation.h> extern NSString * const CLConfluenceClientErrorDomain; extern const NSInteger kCLConfluenceClientInvalidServerResponseError; @interface CLConfluenceClient : NSObject /** Designated initializer. \param baseURL Base URL of your server. For example, <https://confluence.example.com>. Must not be nil. */ - (id)initWithBaseURL:(NSURL *)baseURL; - (void)setPassword:(NSString *)password; /** Perform a search. */ - (GTMHTTPFetcher *)searchQuery:(NSString *)query completionHandler:(void(^)(NSError *error, NSArray *result))completionHandler; @property (copy) NSString *username; @property (copy, readonly) NSURL *baseURL; @end
{'content_hash': 'c6f05d49de3649581465e33b4f38ab60', 'timestamp': '', 'source': 'github', 'line_count': 39, 'max_line_length': 128, 'avg_line_length': 21.974358974358974, 'alnum_prop': 0.7456242707117853, 'repo_name': 'clundie/CLConfluenceClient', 'id': 'c04b92e0366a490d8ec309e14e6902c73a269c23', 'size': '857', 'binary': False, 'copies': '1', 'ref': 'refs/heads/develop', 'path': 'CLConfluenceClient.h', 'mode': '33188', 'license': 'mit', 'language': []}
<?php return [ 'components' => [ 'request' => [ 'enableCookieValidation' => true, 'enableCsrfValidation' => true, 'cookieValidationKey' => 'letyii@!$(!&@', ], 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'suffix' => '.html', ], 'authManager' => [ 'class' => 'app\components\LetRbac', ], 'eauth' => array( 'class' => 'nodge\eauth\EAuth', 'popup' => true, // Use the popup window instead of redirecting. 'cache' => false, // Cache component name or false to disable cache. Defaults to 'cache' on production environments. 'cacheExpire' => 0, // Cache lifetime. Defaults to 0 - means unlimited. 'httpClient' => array( // uncomment this to use streams in safe_mode //'useStreamsFallback' => true, ), 'services' => array( // You can change the providers and their classes. 'facebook' => array( // register your app here: https://developers.facebook.com/apps/ 'class' => 'nodge\eauth\services\FacebookOAuth2Service', 'clientId' => '458292227620618', 'clientSecret' => '9d7f855964c8f6d0b29fb7ec189d56a7', ), ), ), ], ];
{'content_hash': '0b28d8c6f15b6c2b9f06cf0088bd3a77', 'timestamp': '', 'source': 'github', 'line_count': 39, 'max_line_length': 128, 'avg_line_length': 36.87179487179487, 'alnum_prop': 0.4909596662030598, 'repo_name': 'letyii/cms', 'id': '14408e859430f556a994dcc193de3382217ad4ce', 'size': '1438', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'config/common.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '2376'}, {'name': 'JavaScript', 'bytes': '22854'}, {'name': 'PHP', 'bytes': '191510'}, {'name': 'Shell', 'bytes': '518'}]}
module DivisionOfLabor.Graphics where import DivisionOfLabor.Board import Graphics.Vty.Widgets.HexGrid tilePrinter :: BoardSpace -> HexTileData tilePrinter BoardSpace{discovered=False,terrainGroup=g}= ('?', (" " ++ show g ++ " ", " "))
{'content_hash': '322c9527576e7a16a56af4bf43c98831', 'timestamp': '', 'source': 'github', 'line_count': 8, 'max_line_length': 93, 'avg_line_length': 30.125, 'alnum_prop': 0.7344398340248963, 'repo_name': 'benweitzman/DivisionOfLabor', 'id': 'c7a2c06967bd90c9de27825f1b3cb878301163e8', 'size': '241', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/DivisionOfLabor-cli/DivisionOfLabor/Graphics.hs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Haskell', 'bytes': '17697'}]}
from setuptools import setup, find_packages from tornask import __version__ setup( name="tornask", version=__version__, description="tornask is a task manager based on tornado", long_description="tornask is a task manager based on tornado.", keywords='python tornask tornado', author="mqingyn", url="https://github.com/mqingyn/tornask", license="BSD", packages=find_packages(), author_email="[email protected]", requires=['tornado', 'futures'], scripts=[], include_package_data=True, zip_safe=True, )
{'content_hash': '565f75cd49a266f9eb3d6573d5c3717e', 'timestamp': '', 'source': 'github', 'line_count': 19, 'max_line_length': 67, 'avg_line_length': 29.36842105263158, 'alnum_prop': 0.6756272401433692, 'repo_name': 'mqingyn/tornask', 'id': '3f9ea82ecef21004d6301aae10602cf897df198e', 'size': '558', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'setup.py', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Python', 'bytes': '5975'}]}
#include "scarphase/internal/predictor/abstract_predictor.hpp" namespace scarphase { namespace internal { namespace predictor { AbstractPredictor::~AbstractPredictor() { // Do nothing } } /* namespace predictor */ } /* namespace internal */ } /* namespace scarphase */
{'content_hash': 'a23b265f4bff3b409d629ca79c05d29e', 'timestamp': '', 'source': 'github', 'line_count': 16, 'max_line_length': 62, 'avg_line_length': 17.375, 'alnum_prop': 0.7266187050359713, 'repo_name': 'uart/libscarphase', 'id': '7f29350c6fa0eeb182c9ae0a8bed7c44d3edaae6', 'size': '1902', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'source/scarphase/internal/predictor/abstract_predictor.cpp', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '16944'}, {'name': 'C++', 'bytes': '188134'}, {'name': 'CMake', 'bytes': '6232'}]}
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} module Models.Article where import Data.Text (Text) import Data.Time (UTCTime) import Database.Persist.TH (mkMigrate, mkPersist, persistLowerCase, share, sqlSettings) import Models.User import Types (Slug) share [mkPersist sqlSettings, mkMigrate "migrateArticle"] [persistLowerCase| Article json sql=articles slug Slug title Text description Text body Text createdAt UTCTime default=now() updatedAt UTCTime Maybe default=NULL userId UserId UniqueSlug slug |]
{'content_hash': 'f1a9c9442516a94db0916cf6b0faceee', 'timestamp': '', 'source': 'github', 'line_count': 35, 'max_line_length': 76, 'avg_line_length': 32.0, 'alnum_prop': 0.5848214285714286, 'repo_name': 'rpereira/servant-blog', 'id': '3c6fcd4d1922cf57c28614b4ce61793308d441fd', 'size': '1120', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/Models/Article.hs', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Haskell', 'bytes': '34942'}]}
<?xml version="1.0" encoding="UTF-8"?> <sv:node sv:name="basedocument" xmlns:sv="http://www.jcp.org/jcr/sv/1.0"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>hipposysedit:templatetype</sv:value> </sv:property> <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> <sv:value>mix:referenceable</sv:value> </sv:property> <sv:node sv:name="hipposysedit:nodetype"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>hippo:handle</sv:value> </sv:property> <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> <sv:value>hippo:hardhandle</sv:value> </sv:property> <sv:node sv:name="hipposysedit:nodetype"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>hipposysedit:nodetype</sv:value> </sv:property> <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> <sv:value>hipposysedit:remodel</sv:value> </sv:property> <sv:property sv:name="hipposysedit:supertype" sv:type="String"> <sv:value>hippo:document</sv:value> <sv:value>hippostdpubwf:document</sv:value> <sv:value>hippostd:publishableSummary</sv:value> </sv:property> <sv:property sv:name="hipposysedit:uri" sv:type="String"> <sv:value>http://www.onehippo.org/myhippoproject/nt/1.0</sv:value> </sv:property> </sv:node> </sv:node> </sv:node>
{'content_hash': 'ac51439fc04aba7f90b3788e39a49a97', 'timestamp': '', 'source': 'github', 'line_count': 33, 'max_line_length': 74, 'avg_line_length': 42.121212121212125, 'alnum_prop': 0.6525179856115108, 'repo_name': 'andianderson522/style-be-hippo', 'id': 'a22019291f6b65c05810cc6407c3f2f421141f7b', 'size': '1390', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'bootstrap/configuration/src/main/resources/namespaces/myhippoproject/basedocument.xml', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '760'}, {'name': 'Shell', 'bytes': '922'}]}
 Write-Host "Downloading picture" Invoke-WebRequest "https://novotomo.files.wordpress.com/2015/06/jcid.jpg" -OutFile C:\temp\test.jpg Write-Host "Setting Wallpaper" Add-Type @" using System; using System.Runtime.InteropServices; using Microsoft.Win32; namespace Wallpaper { public enum Style : int { Tile, Center, Stretch, NoChange } public class Setter { public const int SetDesktopWallpaper = 20; public const int UpdateIniFile = 0x01; public const int SendWinIniChange = 0x02; [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] private static extern int SystemParametersInfo (int uAction, int uParam, string lpvParam, int fuWinIni); public static void SetWallpaper ( string path, Wallpaper.Style style ) { SystemParametersInfo( SetDesktopWallpaper, 0, path, UpdateIniFile | SendWinIniChange ); RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", true); switch( style ) { case Style.Stretch : key.SetValue(@"WallpaperStyle", "2") ; key.SetValue(@"TileWallpaper", "0") ; break; case Style.Center : key.SetValue(@"WallpaperStyle", "1") ; key.SetValue(@"TileWallpaper", "0") ; break; case Style.Tile : key.SetValue(@"WallpaperStyle", "1") ; key.SetValue(@"TileWallpaper", "1") ; break; case Style.NoChange : break; } key.Close(); } } } "@ [Wallpaper.Setter]::SetWallpaper( 'C:\temp\test.jpg', 0 ) Write-Host "Removing Temp file" Remove-Item "C:\temp\test.jpg"
{'content_hash': '631aa534e847ce98b7786df956b2a597', 'timestamp': '', 'source': 'github', 'line_count': 52, 'max_line_length': 110, 'avg_line_length': 33.21153846153846, 'alnum_prop': 0.609148812970469, 'repo_name': 'lino-silva/welcomekit', 'id': 'fbc45aacbf567de50c257d1e06ec80c62a680c4e', 'size': '1729', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'powershell/changewallpaper.ps1', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'PowerShell', 'bytes': '4329'}]}
namespace chrono { class ChContactContainerBase; /// Base class for contact between two generic ChContactable objects. /// T1 and T2 are of ChContactable sub classes. template <class Ta, class Tb> class ChContactTuple { public: typedef typename Ta::type_variable_tuple_carrier typecarr_a; typedef typename Tb::type_variable_tuple_carrier typecarr_b; protected: ChContactContainerBase* container; ///< associated contact container Ta* objA; ///< first ChContactable object in the pair Tb* objB; ///< second ChContactable object in the pair ChVector<> p1; ///< max penetration point on geo1, after refining, in abs space ChVector<> p2; ///< max penetration point on geo2, after refining, in abs space ChVector<double> normal; ///< normal, on surface of master reference (geo1) ChMatrix33<double> contact_plane; ///< the plane of contact (X is normal direction) double norm_dist; ///< penetration distance (negative if going inside) after refining public: // // CONSTRUCTORS // ChContactTuple() {} ChContactTuple(ChContactContainerBase* mcontainer, ///< contact container Ta* mobjA, ///< ChContactable object A Tb* mobjB, ///< ChContactable object B const collision::ChCollisionInfo& cinfo ///< data for the contact pair ) { assert(container); assert(mobjA); assert(mobjB); container = mcontainer; Reset(mobjA, mobjB, cinfo); } virtual ~ChContactTuple() {} // // FUNCTIONS // /// Initialize again this constraint. virtual void Reset(Ta* mobjA, ///< ChContactable object A Tb* mobjB, ///< ChContactable object B const collision::ChCollisionInfo& cinfo ///< data for the contact pair ) { assert(mobjA); assert(mobjB); this->objA = mobjA; this->objB = mobjB; this->p1 = cinfo.vpA; this->p2 = cinfo.vpB; this->normal = cinfo.vN; this->norm_dist = cinfo.distance; // Contact plane ChVector<> Vx, Vy, Vz; ChVector<double> singul(VECT_Y); XdirToDxDyDz(&normal, &singul, &Vx, &Vy, &Vz); contact_plane.Set_A_axis(Vx, Vy, Vz); } /// Get the colliding object A, with point P1 Ta* GetObjA() { return this->objA; } /// Get the colliding object B, with point P2 Tb* GetObjB() { return this->objB; } /// Get the contact coordinate system, expressed in absolute frame. /// This represents the 'main' reference of the link: reaction forces /// are expressed in this coordinate system. Its origin is point P2. /// (It is the coordinate system of the contact plane and normal) ChCoordsys<> GetContactCoords() { ChCoordsys<> mcsys; ChQuaternion<float> mrot = this->contact_plane.Get_A_quaternion(); mcsys.rot.Set(mrot.e0, mrot.e1, mrot.e2, mrot.e3); mcsys.pos = this->p2; return mcsys; } /// Returns the pointer to a contained 3x3 matrix representing the UV and normal /// directions of the contact. In detail, the X versor (the 1s column of the /// matrix) represents the direction of the contact normal. ChMatrix33<double>* GetContactPlane() { return &contact_plane; } /// Get the contact point 1, in absolute coordinates ChVector<> GetContactP1() { return p1; } /// Get the contact point 2, in absolute coordinates ChVector<> GetContactP2() { return p2; } /// Get the contact normal, in absolute coordinates ChVector<double> GetContactNormal() { return normal; } /// Get the contact distance double GetContactDistance() { return norm_dist; } /// Get the contact force, if computed, in contact coordinate system virtual ChVector<> GetContactForce() { return ChVector<>(0); } // // UPDATING FUNCTIONS // virtual void ContIntStateGatherReactions(const unsigned int off_L, ChVectorDynamic<>& L) {} virtual void ContIntStateScatterReactions(const unsigned int off_L, const ChVectorDynamic<>& L) {} virtual void ContIntLoadResidual_CqL(const unsigned int off_L, ///< offset in L multipliers ChVectorDynamic<>& R, ///< result: the R residual, R += c*Cq'*L const ChVectorDynamic<>& L, ///< the L vector const double c ///< a scaling factor ) {} virtual void ContIntLoadConstraint_C(const unsigned int off_L, ///< offset in Qc residual ChVectorDynamic<>& Qc, ///< result: the Qc residual, Qc += c*C const double c, ///< a scaling factor bool do_clamp, ///< apply clamping to c*C? double recovery_clamp ///< value for min/max clamping of c*C ) {} virtual void ContIntLoadResidual_F(ChVectorDynamic<>& R, const double c) {} virtual void ContIntToLCP(const unsigned int off_L, ///< offset in L, Qc const ChVectorDynamic<>& L, ///< const ChVectorDynamic<>& Qc ///< ) {} virtual void ContIntFromLCP(const unsigned int off_L, ///< offset in L ChVectorDynamic<>& L ///< ) {} virtual void InjectConstraints(ChLcpSystemDescriptor& mdescriptor) {} virtual void ConstraintsBiReset() {} virtual void ConstraintsBiLoad_C(double factor = 1., double recovery_clamp = 0.1, bool do_clamp = false) {} virtual void ConstraintsFetch_react(double factor) {} virtual void ConstraintsLiLoadSuggestedSpeedSolution() {} virtual void ConstraintsLiLoadSuggestedPositionSolution() {} virtual void ConstraintsLiFetchSuggestedSpeedSolution() {} virtual void ConstraintsLiFetchSuggestedPositionSolution() {} }; } // END_OF_NAMESPACE____ #endif
{'content_hash': '1b7d19495994956a43e478e10fc846ea', 'timestamp': '', 'source': 'github', 'line_count': 165, 'max_line_length': 111, 'avg_line_length': 38.61818181818182, 'alnum_prop': 0.5792529817953547, 'repo_name': 'PedroTrujilloV/chrono', 'id': 'eaff53c23f193a6e77a1f01d0ec160300d428240', 'size': '7014', 'binary': False, 'copies': '2', 'ref': 'refs/heads/develop', 'path': 'src/physics/ChContactTuple.h', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '1836120'}, {'name': 'C++', 'bytes': '11692274'}, {'name': 'CMake', 'bytes': '225614'}, {'name': 'CSS', 'bytes': '20012'}, {'name': 'Cuda', 'bytes': '2979'}, {'name': 'GLSL', 'bytes': '4214'}, {'name': 'HTML', 'bytes': '2171'}, {'name': 'Inno Setup', 'bytes': '47881'}, {'name': 'Logos', 'bytes': '15488'}, {'name': 'Makefile', 'bytes': '2254'}, {'name': 'Matlab', 'bytes': '4917'}, {'name': 'Objective-C', 'bytes': '40334'}, {'name': 'Python', 'bytes': '132857'}]}
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated from a template. // // Manual changes to this file may cause unexpected behavior in your application. // Manual changes to this file will be overwritten if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.ComponentModel; using System.Data.EntityClient; using System.Data.Objects; using System.Data.Objects.DataClasses; using System.Linq; using System.Runtime.Serialization; using System.Xml.Serialization; [assembly: EdmSchemaAttribute()] #region EDM Relationship Metadata [assembly: EdmRelationshipAttribute("DatabaseModel", "Tasks_PredecessorHosts", "Task", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(Demos.Samples.Resources.WPF_CSharp.GanttChartDataGrid.Database.Task), "Predecessor", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(Demos.Samples.Resources.WPF_CSharp.GanttChartDataGrid.Database.Predecessor), true)] [assembly: EdmRelationshipAttribute("DatabaseModel", "Tasks_Predecessors", "Task", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(Demos.Samples.Resources.WPF_CSharp.GanttChartDataGrid.Database.Task), "Predecessor", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(Demos.Samples.Resources.WPF_CSharp.GanttChartDataGrid.Database.Predecessor), true)] #endregion namespace Demos.Samples.Resources.WPF_CSharp.GanttChartDataGrid.Database { #region Contexts /// <summary> /// No Metadata Documentation available. /// </summary> public partial class DatabaseEntities : ObjectContext { #region Constructors /// <summary> /// Initializes a new DatabaseEntities object using the connection string found in the 'DatabaseEntities' section of the application configuration file. /// </summary> public DatabaseEntities() : base("name=DatabaseEntities", "DatabaseEntities") { this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } /// <summary> /// Initialize a new DatabaseEntities object. /// </summary> public DatabaseEntities(string connectionString) : base(connectionString, "DatabaseEntities") { this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } /// <summary> /// Initialize a new DatabaseEntities object. /// </summary> public DatabaseEntities(EntityConnection connection) : base(connection, "DatabaseEntities") { this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } #endregion #region Partial Methods partial void OnContextCreated(); #endregion #region ObjectSet Properties /// <summary> /// No Metadata Documentation available. /// </summary> public ObjectSet<Predecessor> Predecessors { get { if ((_Predecessors == null)) { _Predecessors = base.CreateObjectSet<Predecessor>("Predecessors"); } return _Predecessors; } } private ObjectSet<Predecessor> _Predecessors; /// <summary> /// No Metadata Documentation available. /// </summary> public ObjectSet<Task> Tasks { get { if ((_Tasks == null)) { _Tasks = base.CreateObjectSet<Task>("Tasks"); } return _Tasks; } } private ObjectSet<Task> _Tasks; #endregion #region AddTo Methods /// <summary> /// Deprecated Method for adding a new object to the Predecessors EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead. /// </summary> public void AddToPredecessors(Predecessor predecessor) { base.AddObject("Predecessors", predecessor); } /// <summary> /// Deprecated Method for adding a new object to the Tasks EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead. /// </summary> public void AddToTasks(Task task) { base.AddObject("Tasks", task); } #endregion } #endregion #region Entities /// <summary> /// No Metadata Documentation available. /// </summary> [EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="Predecessor")] [Serializable()] [DataContractAttribute(IsReference=true)] public partial class Predecessor : EntityObject { #region Factory Method /// <summary> /// Create a new Predecessor object. /// </summary> /// <param name="dependentTaskID">Initial value of the DependentTaskID property.</param> /// <param name="predecessorTaskID">Initial value of the PredecessorTaskID property.</param> /// <param name="dependencyType">Initial value of the DependencyType property.</param> public static Predecessor CreatePredecessor(global::System.Int32 dependentTaskID, global::System.Int32 predecessorTaskID, global::System.Int32 dependencyType) { Predecessor predecessor = new Predecessor(); predecessor.DependentTaskID = dependentTaskID; predecessor.PredecessorTaskID = predecessorTaskID; predecessor.DependencyType = dependencyType; return predecessor; } #endregion #region Primitive Properties /// <summary> /// No Metadata Documentation available. /// </summary> [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] [DataMemberAttribute()] public global::System.Int32 DependentTaskID { get { return _DependentTaskID; } set { if (_DependentTaskID != value) { OnDependentTaskIDChanging(value); ReportPropertyChanging("DependentTaskID"); _DependentTaskID = StructuralObject.SetValidValue(value); ReportPropertyChanged("DependentTaskID"); OnDependentTaskIDChanged(); } } } private global::System.Int32 _DependentTaskID; partial void OnDependentTaskIDChanging(global::System.Int32 value); partial void OnDependentTaskIDChanged(); /// <summary> /// No Metadata Documentation available. /// </summary> [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] [DataMemberAttribute()] public global::System.Int32 PredecessorTaskID { get { return _PredecessorTaskID; } set { if (_PredecessorTaskID != value) { OnPredecessorTaskIDChanging(value); ReportPropertyChanging("PredecessorTaskID"); _PredecessorTaskID = StructuralObject.SetValidValue(value); ReportPropertyChanged("PredecessorTaskID"); OnPredecessorTaskIDChanged(); } } } private global::System.Int32 _PredecessorTaskID; partial void OnPredecessorTaskIDChanging(global::System.Int32 value); partial void OnPredecessorTaskIDChanged(); /// <summary> /// No Metadata Documentation available. /// </summary> [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.Int32 DependencyType { get { return _DependencyType; } set { OnDependencyTypeChanging(value); ReportPropertyChanging("DependencyType"); _DependencyType = StructuralObject.SetValidValue(value); ReportPropertyChanged("DependencyType"); OnDependencyTypeChanged(); } } private global::System.Int32 _DependencyType; partial void OnDependencyTypeChanging(global::System.Int32 value); partial void OnDependencyTypeChanged(); #endregion #region Navigation Properties /// <summary> /// No Metadata Documentation available. /// </summary> [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "Tasks_PredecessorHosts", "Task")] public Task DependentTask { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Task>("DatabaseModel.Tasks_PredecessorHosts", "Task").Value; } set { ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Task>("DatabaseModel.Tasks_PredecessorHosts", "Task").Value = value; } } /// <summary> /// No Metadata Documentation available. /// </summary> [BrowsableAttribute(false)] [DataMemberAttribute()] public EntityReference<Task> DependentTaskReference { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Task>("DatabaseModel.Tasks_PredecessorHosts", "Task"); } set { if ((value != null)) { ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Task>("DatabaseModel.Tasks_PredecessorHosts", "Task", value); } } } /// <summary> /// No Metadata Documentation available. /// </summary> [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "Tasks_Predecessors", "Task")] public Task Task { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Task>("DatabaseModel.Tasks_Predecessors", "Task").Value; } set { ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Task>("DatabaseModel.Tasks_Predecessors", "Task").Value = value; } } /// <summary> /// No Metadata Documentation available. /// </summary> [BrowsableAttribute(false)] [DataMemberAttribute()] public EntityReference<Task> TaskReference { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Task>("DatabaseModel.Tasks_Predecessors", "Task"); } set { if ((value != null)) { ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Task>("DatabaseModel.Tasks_Predecessors", "Task", value); } } } #endregion } /// <summary> /// No Metadata Documentation available. /// </summary> [EdmEntityTypeAttribute(NamespaceName="DatabaseModel", Name="Task")] [Serializable()] [DataContractAttribute(IsReference=true)] public partial class Task : EntityObject { #region Factory Method /// <summary> /// Create a new Task object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="index">Initial value of the Index property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="indentation">Initial value of the Indentation property.</param> /// <param name="start">Initial value of the Start property.</param> /// <param name="finish">Initial value of the Finish property.</param> /// <param name="completion">Initial value of the Completion property.</param> /// <param name="isMilestone">Initial value of the IsMilestone property.</param> /// <param name="assignments">Initial value of the Assignments property.</param> public static Task CreateTask(global::System.Int32 id, global::System.Int32 index, global::System.String name, global::System.Int32 indentation, global::System.DateTime start, global::System.DateTime finish, global::System.DateTime completion, global::System.Boolean isMilestone, global::System.String assignments) { Task task = new Task(); task.ID = id; task.Index = index; task.Name = name; task.Indentation = indentation; task.Start = start; task.Finish = finish; task.Completion = completion; task.IsMilestone = isMilestone; task.Assignments = assignments; return task; } #endregion #region Primitive Properties /// <summary> /// No Metadata Documentation available. /// </summary> [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] [DataMemberAttribute()] public global::System.Int32 ID { get { return _ID; } set { if (_ID != value) { OnIDChanging(value); ReportPropertyChanging("ID"); _ID = StructuralObject.SetValidValue(value); ReportPropertyChanged("ID"); OnIDChanged(); } } } private global::System.Int32 _ID; partial void OnIDChanging(global::System.Int32 value); partial void OnIDChanged(); /// <summary> /// No Metadata Documentation available. /// </summary> [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.Int32 Index { get { return _Index; } set { OnIndexChanging(value); ReportPropertyChanging("Index"); _Index = StructuralObject.SetValidValue(value); ReportPropertyChanged("Index"); OnIndexChanged(); } } private global::System.Int32 _Index; partial void OnIndexChanging(global::System.Int32 value); partial void OnIndexChanged(); /// <summary> /// No Metadata Documentation available. /// </summary> [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.String Name { get { return _Name; } set { OnNameChanging(value); ReportPropertyChanging("Name"); _Name = StructuralObject.SetValidValue(value, false); ReportPropertyChanged("Name"); OnNameChanged(); } } private global::System.String _Name; partial void OnNameChanging(global::System.String value); partial void OnNameChanged(); /// <summary> /// No Metadata Documentation available. /// </summary> [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.Int32 Indentation { get { return _Indentation; } set { OnIndentationChanging(value); ReportPropertyChanging("Indentation"); _Indentation = StructuralObject.SetValidValue(value); ReportPropertyChanged("Indentation"); OnIndentationChanged(); } } private global::System.Int32 _Indentation; partial void OnIndentationChanging(global::System.Int32 value); partial void OnIndentationChanged(); /// <summary> /// No Metadata Documentation available. /// </summary> [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.DateTime Start { get { return _Start; } set { OnStartChanging(value); ReportPropertyChanging("Start"); _Start = StructuralObject.SetValidValue(value); ReportPropertyChanged("Start"); OnStartChanged(); } } private global::System.DateTime _Start; partial void OnStartChanging(global::System.DateTime value); partial void OnStartChanged(); /// <summary> /// No Metadata Documentation available. /// </summary> [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.DateTime Finish { get { return _Finish; } set { OnFinishChanging(value); ReportPropertyChanging("Finish"); _Finish = StructuralObject.SetValidValue(value); ReportPropertyChanged("Finish"); OnFinishChanged(); } } private global::System.DateTime _Finish; partial void OnFinishChanging(global::System.DateTime value); partial void OnFinishChanged(); /// <summary> /// No Metadata Documentation available. /// </summary> [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.DateTime Completion { get { return _Completion; } set { OnCompletionChanging(value); ReportPropertyChanging("Completion"); _Completion = StructuralObject.SetValidValue(value); ReportPropertyChanged("Completion"); OnCompletionChanged(); } } private global::System.DateTime _Completion; partial void OnCompletionChanging(global::System.DateTime value); partial void OnCompletionChanged(); /// <summary> /// No Metadata Documentation available. /// </summary> [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.Boolean IsMilestone { get { return _IsMilestone; } set { OnIsMilestoneChanging(value); ReportPropertyChanging("IsMilestone"); _IsMilestone = StructuralObject.SetValidValue(value); ReportPropertyChanged("IsMilestone"); OnIsMilestoneChanged(); } } private global::System.Boolean _IsMilestone; partial void OnIsMilestoneChanging(global::System.Boolean value); partial void OnIsMilestoneChanged(); /// <summary> /// No Metadata Documentation available. /// </summary> [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] [DataMemberAttribute()] public global::System.String Assignments { get { return _Assignments; } set { OnAssignmentsChanging(value); ReportPropertyChanging("Assignments"); _Assignments = StructuralObject.SetValidValue(value, false); ReportPropertyChanged("Assignments"); OnAssignmentsChanged(); } } private global::System.String _Assignments; partial void OnAssignmentsChanging(global::System.String value); partial void OnAssignmentsChanged(); #endregion #region Navigation Properties /// <summary> /// No Metadata Documentation available. /// </summary> [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "Tasks_PredecessorHosts", "Predecessor")] public EntityCollection<Predecessor> Predecessors { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Predecessor>("DatabaseModel.Tasks_PredecessorHosts", "Predecessor"); } set { if ((value != null)) { ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Predecessor>("DatabaseModel.Tasks_PredecessorHosts", "Predecessor", value); } } } /// <summary> /// No Metadata Documentation available. /// </summary> [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("DatabaseModel", "Tasks_Predecessors", "Predecessor")] public EntityCollection<Predecessor> Successors { get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Predecessor>("DatabaseModel.Tasks_Predecessors", "Predecessor"); } set { if ((value != null)) { ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Predecessor>("DatabaseModel.Tasks_Predecessors", "Predecessor", value); } } } #endregion } #endregion }
{'content_hash': 'a38d7f7d9bb36111100a743c15a54b9d', 'timestamp': '', 'source': 'github', 'line_count': 643, 'max_line_length': 380, 'avg_line_length': 35.54587869362364, 'alnum_prop': 0.5694347217360868, 'repo_name': 'DlhSoftTeam/GanttChartLightLibrary-Demos', 'id': 'ec0352174df21c51ea621056e855e3008900c591', 'size': '22858', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'GanttChartLightLibraryDemos/Demos/Samples.Resources/WPF-CSharp/GanttChartDataGrid/Database/Model1.Designer.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '463'}, {'name': 'C#', 'bytes': '1533993'}, {'name': 'Visual Basic .NET', 'bytes': '2445320'}]}
namespace storage { const size_t kPerStorageAreaQuota = 10 * 1024 * 1024; const size_t kPerStorageAreaOverQuotaAllowance = 100 * 1024; } // namespace storage
{'content_hash': '8ce94286025269fc0c4c9f2f93c99d23', 'timestamp': '', 'source': 'github', 'line_count': 6, 'max_line_length': 60, 'avg_line_length': 26.833333333333332, 'alnum_prop': 0.7577639751552795, 'repo_name': 'nwjs/chromium.src', 'id': 'aa5edd1d07d97bee4912b14996ff804351240e94', 'size': '381', 'binary': False, 'copies': '6', 'ref': 'refs/heads/nw70', 'path': 'components/services/storage/dom_storage/dom_storage_constants.cc', 'mode': '33188', 'license': 'bsd-3-clause', 'language': []}
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{'content_hash': 'b8d35e8fa17869dc6ea9ef2d6ba00d82', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 39, 'avg_line_length': 10.23076923076923, 'alnum_prop': 0.6917293233082706, 'repo_name': 'mdoering/backbone', 'id': 'c6c69289bf1f082480f94c4414b95a5dc0a954f4', 'size': '190', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Desmodium/Desmodium flexuosum/ Syn. Meibomia flexuosa/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []}
<!DOCTYPE html> {% load staticfiles %} <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="description" content="A genotyping service for Arabidopsis thaliana"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"> <title>{% block title %}AraGeno - A genotyping service for Arabiodpsis thaliana{% endblock title %}</title> <!-- Add to homescreen for Chrome on Android --> <meta name="mobile-web-app-capable" content="yes"> <!--<link rel="icon" sizes="192x192" href="{% static 'img/android-desktop.png' %}">--> <!-- Add to homescreen for Safari on iOS --> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-title" content="AraGeno"> <!--<link rel="apple-touch-icon-precomposed" href="{% static 'img/ios-desktop.png' %}">--> <!-- Tile icon for Win8 (144x144 + tile color) --> <!--<meta name="msapplication-TileImage" content="{% static 'img/touch/ms-touch-icon-144x144-precomposed.png' %}">--> <meta name="msapplication-TileColor" content="#3372DF"> <!--<link rel="shortcut icon" href="{% static 'img/favicon.png' %}">--> <link rel="icon" type="image/png" href="{% static 'img/favicon-32x32.png' %}" sizes="32x32" /> <link rel="icon" type="image/png" href="{% static 'img/favicon-16x16.png' %}" sizes="16x16" /> <link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:100,200,300,400,500,700" type="text/css"> <link rel="stylesheet" href="//code.getmdl.io/1.2.1/material.green-blue.min.css" /> <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.3.0/lodash.min.js"></script> <script src="//code.getmdl.io/1.2.1/material.min.js"></script> <script src="//unpkg.com/[email protected]/dist/vue.js"></script> <script src="{% static 'js/vue-charts.js' %}"></script> <!--<script src="{% static 'js/vue-charts.min.js' %}"></script>--> <link rel="stylesheet" href="{% static 'css/styles.css' %}"> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); Vue.config.delimiters = ['${', '}']; ga('create', 'UA-26150757-8', 'auto'); ga('send', 'pageview'); </script> </head> <body> <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header"> <div class="site-header mdl-layout__header"> <div class="mdl-layout__header-row"> <span class="site-title mdl-layout-title"> <a href="{% url 'index' %}"> <img class="site-logo-image" src="{% static 'img/logo.png' %}" alt="AraGeno"> </a> </span> <div class="site-header-spacer mdl-layout-spacer"></div> <div class="site-navigation-container"> <nav class="site-navigation mdl-navigation"> <a class="mdl-navigation__link mdl-typography--text-uppercase" href="{% url 'faq' %}">Faq</a> <!--<a class="mdl-navigation__link mdl-typography--text-uppercase" href="">Sign In</a>--> </nav> </div> <span class="site-mobile-title mdl-layout-title"> <img class="site-logo-image" src="{% static 'img/logo.png' %}"> </span> </div> </div> <main class="site-content mdl-layout__content"> {% block content %}{% endblock content %} <div class="mdl-layout-spacer"></div> <footer class="mdl-mini-footer"> <div class="mdl-mini-footer__left-section"> <div class="mdl-logo">AraGeno</div> <ul class="mdl-mini-footer__link-list"> <li><a href="{% url 'faq' %}">FAQ</a></li> <!--<li><a href="#">Privacy & Terms</a></li>--> <li><a href="{% url 'about' %}">About</a></li> </ul> </div> </footer> </main> </div> </body> </html>
{'content_hash': 'feabfad4e1b1e670d8a92864c7525dab', 'timestamp': '', 'source': 'github', 'line_count': 88, 'max_line_length': 125, 'avg_line_length': 54.89772727272727, 'alnum_prop': 0.525564065410888, 'repo_name': 'Gregor-Mendel-Institute/AraGeno', 'id': 'a5574d86e880d45893ebb32381e460ae4795111d', 'size': '4831', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'arageno/templates/base.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '6285'}, {'name': 'Dockerfile', 'bytes': '349'}, {'name': 'HTML', 'bytes': '74744'}, {'name': 'JavaScript', 'bytes': '35602'}, {'name': 'Python', 'bytes': '57807'}, {'name': 'Shell', 'bytes': '3175'}]}
using System; using System.Collections.Generic; using Kernel_alpha.x86; namespace Kernel_alpha.x86.smbios { public unsafe class ProcessorInfo : Entry { protected string mVendorName; protected string mVersion; protected string mSocket; protected uint mSpeed; public ProcessorInfo(SMBIOS.SMBIOSHeader* Header) : base(Header) { var strings = GetAllStrings(3); mVersion = strings[0]; mSocket = strings[1]; mVendorName = strings[2]; mSpeed = *((ushort*)((uint)Header + 0x16)); Console.WriteLine("Processor Information---->"); Console.WriteLine("Vendor Name ::" + mVendorName); Console.WriteLine("Version ::" + mVersion); Console.WriteLine("Socket ::" + mSocket); Console.WriteLine("Speed ::" + mSpeed.ToString()); } } }
{'content_hash': 'b6301967013279e1b2c90e2723b60891', 'timestamp': '', 'source': 'github', 'line_count': 31, 'max_line_length': 69, 'avg_line_length': 31.29032258064516, 'alnum_prop': 0.5505154639175258, 'repo_name': 'amaneureka/AtomOS', 'id': '40c50fcf42ec198889a17c9abd0ba7cb96cb5c0a', 'size': '972', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/Kernel/Kernel_alpha/x86/smbios/ProcessorInfo.cs', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Assembly', 'bytes': '262'}, {'name': 'Batchfile', 'bytes': '5394'}, {'name': 'C', 'bytes': '4993'}, {'name': 'C#', 'bytes': '1655500'}, {'name': 'Makefile', 'bytes': '357'}, {'name': 'Shell', 'bytes': '14120'}]}
In this chapter we introduce \emph{Refinement Reflection}, a method to extend \emph{legacy} languages---with highly tuned libraries, compilers, and run-times---into theorem provers, by letting programmers specify and verify arbitrary properties of their code simply by writing programs in the legacy language. Refinement types, as presented so far, offer a form of programming with proofs that can be retrofitted into a programming language. % The retrofitting relies upon restricting refinements to so-called ``shallow'' specifications that correspond to \emph{abstract} interpretations of the behavior of functions. % For example, refinements make it easy to specify that the list returned by the @append@ function has size equal to the sum of those of its inputs. % These shallow specifications fall within decidable logical fragments, and hence, can be automatically verified using SMT based refinement typing. Refinements are a pale shadow of what is possible with dependently typed languages like Coq, Agda and Idris which permit ``deep'' specification and verification. % These languages come equipped with mechanisms that \emph{represent} and \emph{manipulate} the exact descriptions of user-defined functions. % For example, we can represent the specification that the @append@ function is associative, and we can manipulate (unfold) its definition to write a small program that constructs a proof of the specification. % Dafny~\citep{dafny}, \fstar~\citep{fstar} and Halo~\citep{halo} take a step towards SMT-based deep verification, by encoding user-defined functions as universally quantified logical formulas or ``axioms''. % This axiomatic approach offers significant automation but relies heavily upon brittle heuristics for ``triggering'' axiom instantiation, giving away decidable, and hence, predictable verification~\citep{Leino16}. % In this chapter, we present a new approach to retrofitting deep verification into existing languages. Our approach reconciles the automation of SMT-based refinement typing with decidable and predictable verification, and enables users to reify pencil-and-paper proofs simply as programs in the source language. \begin{itemize} \item % {Refinement Reflection} % We start this chapter by an overview of refinement reflection: the code implementing a​ user-defined function can be \emph{reflected}​ into the function's (output) refinement type, thus converting the function's (refinement) type signature into a deep specification of the functions behavior. % This simple idea has a profound consequence: at \emph{uses} of the function, the standard rule for (dependent) function application yields a precise, predictable and most importantly, programmer controllable means of \emph{instantiating} the deep specification that is not tethered to brittle SMT heuristics. % Specifically, we show how to use ideas for \emph{defunctionalization} from the theorem proving literature which encode functions and lambdas using uninterpreted symbols, to encode terms from an expressive higher order language as decidable refinements, letting us use SMT-based congruence closure for decidable and predictable verification~(\S~\ref{sec:refinementreflection:theory}). \item % {A Library of Proof Combinators} % Next, we present a \emph{library of combinators} that lets programmers \emph{compose proofs} from basic refinements and function definitions. % We show how to represent proofs simply as unit-values refined by the proposition that they prove. %~(\S~\ref{sec:library}). % We show how to build up sophisticated proofs using a small library of combinators that permits reasoning in an algebraic or equational style. % Furthermore, since proofs are literally just programs, our proof combinators let us use standard language mechanisms like branches (to encode case splits), recursion (to encode induction), and functions (to encode auxiliary lemmas) to write proofs that look very much like transcriptions of their pencil-and-paper analogues~(\S~\ref{sec:refinementreflection:overview}). \item % {Verified Typeclass Laws} % We implemented refinement reflection in \toolname~\citep{Vazou14}, thereby converting the legacy language Haskell into a theorem prover. % We demonstrate the benefits of this conversion by proving typeclass laws. % Haskell's typeclass machinery has led to a suite of expressive abstractions and optimizations which, for correctness, crucially require typeclass \emph{instances} to obey key algebraic laws. We show how reflection can be used to formally verify that many widely used instances of the Monoid, Applicative, Functor, and Monad typeclasses actually satisfy the respective laws, making the use of these typeclasses safe~(\S~\ref{sec:evaluation}). \item % {Verified Deterministic Parallelism} Finally, to showcase the benefits of retrofitting theorem proving onto legacy languages, we perform a case study in \emph{deterministic parallelism}. % % Existing deterministic languages place unchecked obligations on the user to guarantee, \eg the associativity of a fold. % Violations can compromise type soundness and correctness. % Closing this gap requires only modest proof effort---touching only a small subset of the application. % But for this solution to be possible requires a \emph{practical}, \emph{parallel} programming language that supports deep verification. % Before \toolname there was no such parallel language. % % Refinement reflection opens up this new possibility % paving the way towards high-performance with % correctness guarantees. % We show how \toolname lets us verify the unchecked obligations from benchmarks taken from three existing parallel programming systems, and thus, paves the way towards high-performance with correctness guarantees~(\S~\ref{sec:eval-parallelism}). \end{itemize}
{'content_hash': '06e2d132b83c9273ae29c3e52c0a5a41', 'timestamp': '', 'source': 'github', 'line_count': 168, 'max_line_length': 84, 'avg_line_length': 34.529761904761905, 'alnum_prop': 0.8096879848302017, 'repo_name': 'nikivazou/thesis', 'id': '550f07f8d0f65c4c77e8e6329f352adc5d46e1ca', 'size': '5805', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'text/refinementreflection/intro.tex', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Haskell', 'bytes': '2814'}, {'name': 'Makefile', 'bytes': '3832'}, {'name': 'TeX', 'bytes': '3585929'}]}
<?php use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), new Symfony\Bundle\MonologBundle\MonologBundle(), new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new Acme\DynamicFormBundle\AcmeDynamicFormBundle(), ); if (in_array($this->getEnvironment(), array('dev', 'test'))) { $bundles[] = new Acme\DemoBundle\AcmeDemoBundle(); $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); } return $bundles; } public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); } }
{'content_hash': 'e971ac0f7dccd22dd95f07e305db17ab', 'timestamp': '', 'source': 'github', 'line_count': 36, 'max_line_length': 89, 'avg_line_length': 39.22222222222222, 'alnum_prop': 0.6678470254957507, 'repo_name': 'ans0600/dynamicform', 'id': '2551835e0622b94e02134c6b81c1f442ed4ca8ea', 'size': '1412', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/AppKernel.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '2204'}, {'name': 'PHP', 'bytes': '66889'}]}
package com.fkeglevich.rawdumper.controller.feature; import android.os.Handler; import android.os.Looper; import android.widget.TextView; import com.fkeglevich.rawdumper.camera.async.TurboCamera; import com.fkeglevich.rawdumper.camera.data.Displayable; import com.fkeglevich.rawdumper.camera.feature.Feature; import com.fkeglevich.rawdumper.camera.parameter.ParameterChangeEvent; import com.fkeglevich.rawdumper.util.Nullable; import com.fkeglevich.rawdumper.util.event.EventListener; /** * TODO: Add class header * <p> * Created by Flávio Keglevich on 29/10/17. */ public class ValueMeteringController<T extends Displayable> extends FeatureController { public static final int AUTO_VALUE_TEXT_COLOR = 0xFFFFFFFF; public static final int MANUAL_VALUE_TEXT_COLOR = 0xFFFFFF00; private static final int METERING_DELAY_MILLIS = 200; private final EventListener<ParameterChangeEvent<T>> fallbackChangedListener = eventData -> updateViewFromMetering(); private final Runnable meteringRunnable = new Runnable() { @Override public void run() { if (enabled) updateViewFromMetering(); if (fallbackFeature != null) handler.postDelayed(meteringRunnable, METERING_DELAY_MILLIS); } }; private final Handler handler; private final TextView meteringView; private final T defaultValue; private Feature<Nullable<T>> meteringFeature = null; private Feature<T> fallbackFeature = null; private boolean enabled = true; ValueMeteringController(TextView meteringView, T defaultValue) { this.handler = new Handler(Looper.getMainLooper()); this.meteringView = meteringView; this.defaultValue = defaultValue; updateViewFromMetering(); } @Override protected void setup(TurboCamera camera) { fallbackFeature = getFallbackFeature(camera); if (!fallbackFeature.isAvailable()) { reset(); return; } meteringFeature = getMeteringFeature(camera); if (meteringFeature != null && !meteringFeature.isAvailable()) meteringFeature = null; fallbackFeature.getOnChanged().addListener(fallbackChangedListener); handler.post(meteringRunnable); updateViewFromMetering(); } @Override protected void reset() { meteringFeature = null; if (fallbackFeature != null) fallbackFeature.getOnChanged().removeListener(fallbackChangedListener); fallbackFeature = null; updateViewFromMetering(); } @Override protected void disable() { enabled = false; } @Override protected void enable() { enabled = true; } private void setViewText(T value, boolean isAuto) { meteringView.setTextColor(isAuto ? AUTO_VALUE_TEXT_COLOR : MANUAL_VALUE_TEXT_COLOR); meteringView.setText(value.displayValue()); } private void updateViewFromMetering() { if (fallbackFeature == null) { meteringView.setAlpha(0.25f); setViewText(defaultValue, true); return; } meteringView.setAlpha(1f); T fallbackReadings = fallbackFeature.getValue(); if (defaultValue.equals(fallbackReadings)) { Nullable<T> meteringReadings = getMeteringReadings(); if (meteringReadings.isPresent()) setViewText(meteringReadings.get(), true); else setViewText(defaultValue, true); } else setViewText(fallbackReadings, false); } private Nullable<T> getMeteringReadings() { if (meteringFeature == null) return Nullable.of(null); return meteringFeature.getValue(); } @SuppressWarnings("unchecked") private Feature<T> getFallbackFeature(TurboCamera turboCamera) { return turboCamera.getListFeature((Class<T>) defaultValue.getClass()); } @SuppressWarnings("unchecked") private Feature<Nullable<T>> getMeteringFeature(TurboCamera turboCamera) { return turboCamera.getMeteringFeature((Class<T>) defaultValue.getClass()); } }
{'content_hash': '084f9b64b44058eef3b2eb9783dad36f', 'timestamp': '', 'source': 'github', 'line_count': 149, 'max_line_length': 121, 'avg_line_length': 28.7248322147651, 'alnum_prop': 0.658411214953271, 'repo_name': 'fkeglevich/Raw-Dumper', 'id': 'd0ef575b2bff4fbc4ff717d1e879e77e913de815', 'size': '4882', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/src/main/java/com/fkeglevich/rawdumper/controller/feature/ValueMeteringController.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '46226'}, {'name': 'C++', 'bytes': '2215645'}, {'name': 'CMake', 'bytes': '3051'}, {'name': 'GLSL', 'bytes': '3988'}, {'name': 'Java', 'bytes': '1059422'}]}
package org.livetribe.slp.settings; import org.livetribe.slp.SLPError; import org.livetribe.slp.ServiceLocationException; /** * Creates new instances of classes whose full qualified name is specified in configuration settings under * a certain key. */ public class Factories { /** * Creates a new instance of a class whose full qualified name is specified under the given key. * <br /> * The class will be loaded using the current context ClassLoader. * <br /> * If the given settings is null, or it does not contain the specified key, the default value of the key * is taken from the {@link Defaults defaults}. * * @param settings the configuration settings that may specify the full qualified name of the class to create, * overriding the default value * @param key the key under which the full qualified name of the class is specified * @return a new instance of the class specified by the given key * @throws ServiceLocationException if the instance cannot be created * @see #newInstance(Settings, Key, ClassLoader) */ public static <T> T newInstance(Settings settings, Key<String> key) throws ServiceLocationException { // Workaround for compiler bug (#6302954) return Factories.<T>newInstance(settings, key, Thread.currentThread().getContextClassLoader()); } /** * Creates a new instance of a class whose full qualified name is specified under the given key, loading * the class with the given class loader. * <br /> * If the given settings is null, or it does not contain the specified key, the default value of the key * is taken from the {@link Defaults defaults}. * * @param settings the configuration settings that may specify the full qualified name of the class to create, * overriding the default value * @param key the key under which the full qualified name of the class is specified * @param classLoader the class loader to use to load the full qualified name of the class * @return a new instance of the class specified by the given key * @throws ServiceLocationException if the instance cannot be created * @see #newInstance(Settings, Key) */ public static <T> T newInstance(Settings settings, Key<String> key, ClassLoader classLoader) throws ServiceLocationException { Class<?> klass = loadClass(settings, key, classLoader); // Workaround for compiler bug (#6302954) return Factories.<T>newInstance(klass); } private static Class<?> loadClass(Settings settings, Key<String> key, ClassLoader classLoader) { String className = settings == null ? Defaults.get(key) : settings.get(key, Defaults.get(key)); ClassLoader loader = classLoader == null ? Thread.currentThread().getContextClassLoader() : classLoader; try { return loader.loadClass(className); } catch (ClassNotFoundException x) { throw new ServiceLocationException("Could not instantiate " + className, SLPError.INTERNAL_SYSTEM_ERROR); } } private static <T> T newInstance(Class<?> klass) { try { return (T)klass.newInstance(); } catch (Exception x) { throw new ServiceLocationException("Could not instantiate " + klass, SLPError.INTERNAL_SYSTEM_ERROR); } } private Factories() { } }
{'content_hash': 'b3cecd9f7a652c5a1b2b7bb484143242', 'timestamp': '', 'source': 'github', 'line_count': 86, 'max_line_length': 128, 'avg_line_length': 41.04651162790697, 'alnum_prop': 0.6688385269121813, 'repo_name': 'livetribe/livetribe-slp', 'id': 'f819c8d70cbbf6c8d5a464a5bcd144edc0623ff2', 'size': '4148', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'core/src/main/java/org/livetribe/slp/settings/Factories.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '914918'}]}
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="30dp" android:orientation="horizontal"> <TextView android:id="@+id/List_Time_TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:textSize="15sp" android:textColor="#000000" android:singleLine="true" android:paddingTop="5dp" android:paddingBottom="5dp" android:gravity="center" android:layout_weight="1" /> <TextView android:id="@+id/List_Capital_TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:textSize="15sp" android:textColor="#000000" android:singleLine="true" android:paddingTop="5dp" android:paddingBottom="5dp" android:gravity="center" android:layout_weight="1" /> <TextView android:id="@+id/List_Interest_TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:textSize="15sp" android:textColor="#000000" android:singleLine="true" android:paddingTop="5dp" android:paddingBottom="5dp" android:gravity="center" android:layout_weight="1" /> <TextView android:id="@+id/List_MonthPay_TextView" android:layout_width="0dp" android:layout_height="wrap_content" android:textSize="15sp" android:textColor="#000000" android:singleLine="true" android:paddingTop="5dp" android:paddingBottom="5dp" android:gravity="center" android:layout_weight="1" /> </LinearLayout>
{'content_hash': 'ca635c0b613cc4bcfcefa42a2b5d4fdf', 'timestamp': '', 'source': 'github', 'line_count': 54, 'max_line_length': 72, 'avg_line_length': 32.833333333333336, 'alnum_prop': 0.6254935138183869, 'repo_name': 'MichaelLee826/MortgageCalculator', 'id': 'd3bbf2d7662a756dbb52e7765056df356734cae5', 'size': '1773', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'MortgageCalculator11-09/app/src/main/res/layout/list_item.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '400490'}]}
 #pragma once #include <aws/s3/S3_EXPORTS.h> #include <aws/s3/S3Request.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/core/utils/memory/stl/AWSMap.h> #include <utility> namespace Aws { namespace Http { class URI; } //namespace Http namespace S3 { namespace Model { /** */ class AWS_S3_API DeleteBucketTaggingRequest : public S3Request { public: DeleteBucketTaggingRequest(); // Service request name is the Operation name which will send this request out, // each operation should has unique request name, so that we can get operation's name from this request. // Note: this is not true for response, multiple operations may have the same response name, // so we can not get operation's name from response. inline virtual const char* GetServiceRequestName() const override { return "DeleteBucketTagging"; } Aws::String SerializePayload() const override; void AddQueryStringParameters(Aws::Http::URI& uri) const override; Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; /** * Helper function to collect parameters (configurable and static hardcoded) required for endpoint computation. */ EndpointParameters GetEndpointContextParams() const override; /** * <p>The bucket that has the tag set to be removed.</p> */ inline const Aws::String& GetBucket() const{ return m_bucket; } /** * <p>The bucket that has the tag set to be removed.</p> */ inline bool BucketHasBeenSet() const { return m_bucketHasBeenSet; } /** * <p>The bucket that has the tag set to be removed.</p> */ inline void SetBucket(const Aws::String& value) { m_bucketHasBeenSet = true; m_bucket = value; } /** * <p>The bucket that has the tag set to be removed.</p> */ inline void SetBucket(Aws::String&& value) { m_bucketHasBeenSet = true; m_bucket = std::move(value); } /** * <p>The bucket that has the tag set to be removed.</p> */ inline void SetBucket(const char* value) { m_bucketHasBeenSet = true; m_bucket.assign(value); } /** * <p>The bucket that has the tag set to be removed.</p> */ inline DeleteBucketTaggingRequest& WithBucket(const Aws::String& value) { SetBucket(value); return *this;} /** * <p>The bucket that has the tag set to be removed.</p> */ inline DeleteBucketTaggingRequest& WithBucket(Aws::String&& value) { SetBucket(std::move(value)); return *this;} /** * <p>The bucket that has the tag set to be removed.</p> */ inline DeleteBucketTaggingRequest& WithBucket(const char* value) { SetBucket(value); return *this;} /** * <p>The account ID of the expected bucket owner. If the bucket is owned by a * different account, the request fails with the HTTP status code <code>403 * Forbidden</code> (access denied).</p> */ inline const Aws::String& GetExpectedBucketOwner() const{ return m_expectedBucketOwner; } /** * <p>The account ID of the expected bucket owner. If the bucket is owned by a * different account, the request fails with the HTTP status code <code>403 * Forbidden</code> (access denied).</p> */ inline bool ExpectedBucketOwnerHasBeenSet() const { return m_expectedBucketOwnerHasBeenSet; } /** * <p>The account ID of the expected bucket owner. If the bucket is owned by a * different account, the request fails with the HTTP status code <code>403 * Forbidden</code> (access denied).</p> */ inline void SetExpectedBucketOwner(const Aws::String& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = value; } /** * <p>The account ID of the expected bucket owner. If the bucket is owned by a * different account, the request fails with the HTTP status code <code>403 * Forbidden</code> (access denied).</p> */ inline void SetExpectedBucketOwner(Aws::String&& value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner = std::move(value); } /** * <p>The account ID of the expected bucket owner. If the bucket is owned by a * different account, the request fails with the HTTP status code <code>403 * Forbidden</code> (access denied).</p> */ inline void SetExpectedBucketOwner(const char* value) { m_expectedBucketOwnerHasBeenSet = true; m_expectedBucketOwner.assign(value); } /** * <p>The account ID of the expected bucket owner. If the bucket is owned by a * different account, the request fails with the HTTP status code <code>403 * Forbidden</code> (access denied).</p> */ inline DeleteBucketTaggingRequest& WithExpectedBucketOwner(const Aws::String& value) { SetExpectedBucketOwner(value); return *this;} /** * <p>The account ID of the expected bucket owner. If the bucket is owned by a * different account, the request fails with the HTTP status code <code>403 * Forbidden</code> (access denied).</p> */ inline DeleteBucketTaggingRequest& WithExpectedBucketOwner(Aws::String&& value) { SetExpectedBucketOwner(std::move(value)); return *this;} /** * <p>The account ID of the expected bucket owner. If the bucket is owned by a * different account, the request fails with the HTTP status code <code>403 * Forbidden</code> (access denied).</p> */ inline DeleteBucketTaggingRequest& WithExpectedBucketOwner(const char* value) { SetExpectedBucketOwner(value); return *this;} inline const Aws::Map<Aws::String, Aws::String>& GetCustomizedAccessLogTag() const{ return m_customizedAccessLogTag; } inline bool CustomizedAccessLogTagHasBeenSet() const { return m_customizedAccessLogTagHasBeenSet; } inline void SetCustomizedAccessLogTag(const Aws::Map<Aws::String, Aws::String>& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = value; } inline void SetCustomizedAccessLogTag(Aws::Map<Aws::String, Aws::String>&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag = std::move(value); } inline DeleteBucketTaggingRequest& WithCustomizedAccessLogTag(const Aws::Map<Aws::String, Aws::String>& value) { SetCustomizedAccessLogTag(value); return *this;} inline DeleteBucketTaggingRequest& WithCustomizedAccessLogTag(Aws::Map<Aws::String, Aws::String>&& value) { SetCustomizedAccessLogTag(std::move(value)); return *this;} inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const Aws::String& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(const Aws::String& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), std::move(value)); return *this; } inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(const char* key, Aws::String&& value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, std::move(value)); return *this; } inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(Aws::String&& key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(std::move(key), value); return *this; } inline DeleteBucketTaggingRequest& AddCustomizedAccessLogTag(const char* key, const char* value) { m_customizedAccessLogTagHasBeenSet = true; m_customizedAccessLogTag.emplace(key, value); return *this; } private: Aws::String m_bucket; bool m_bucketHasBeenSet = false; Aws::String m_expectedBucketOwner; bool m_expectedBucketOwnerHasBeenSet = false; Aws::Map<Aws::String, Aws::String> m_customizedAccessLogTag; bool m_customizedAccessLogTagHasBeenSet = false; }; } // namespace Model } // namespace S3 } // namespace Aws
{'content_hash': 'aea66b627d83758d8bdf5ee94f7c9b3c', 'timestamp': '', 'source': 'github', 'line_count': 196, 'max_line_length': 233, 'avg_line_length': 42.91836734693877, 'alnum_prop': 0.7098193057536852, 'repo_name': 'aws/aws-sdk-cpp', 'id': 'f5065515ad8d0615702bfd8780a7d96deeb998ea', 'size': '8531', 'binary': False, 'copies': '1', 'ref': 'refs/heads/main', 'path': 'aws-cpp-sdk-s3/include/aws/s3/model/DeleteBucketTaggingRequest.h', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '309797'}, {'name': 'C++', 'bytes': '476866144'}, {'name': 'CMake', 'bytes': '1245180'}, {'name': 'Dockerfile', 'bytes': '11688'}, {'name': 'HTML', 'bytes': '8056'}, {'name': 'Java', 'bytes': '413602'}, {'name': 'Python', 'bytes': '79245'}, {'name': 'Shell', 'bytes': '9246'}]}
Todo::Application.configure do # Settings specified here will take precedence over those in config/application.rb. ActionMailer::Base.smtp_settings = { :address => 'smtp.sendgrid.net', :port => '587', :authentication => :plain, :user_name => ENV['SENDGRID_USERNAME'], :password => ENV['SENDGRID_PASSWORD'], :domain => 'heroku.com', :enable_starttls_auto => true } # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both thread web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # Enable Rack::Cache to put a simple HTTP cache in front of your application # Add `rack-cache` to your Gemfile before enabling this. # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. # config.action_dispatch.rack_cache = true # Disable Rails's static asset server (Apache or nginx will already do this). config.serve_static_assets = false # Compress JavaScripts and CSS. # Disable variable name manging to make AngularJS short dependency syntax work. config.assets.js_compressor = Uglifier.new(mangle: false) # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = true # Generate digests for assets URLs. config.assets.digest = true # Version of your assets, change this if you want to expire all your assets. config.assets.version = '1.0' # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true # Set to :debug to see everything in the log. config.log_level = :info # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ] # Use a different logger for distributed setups. # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) # Use a different cache store in production. # config.cache_store = :mem_cache_store # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = "http://assets.example.com" # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # config.assets.precompile += %w( search.js ) # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false config.action_mailer.default_url_options = { :host => 'todo-rails4-angularjs.shellyapp.com' } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation can not be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Disable automatic flushing of the log to improve performance. # config.autoflush_log = false # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new end
{'content_hash': '2259bfecbfd8cf0f3e0aff6e64cc18e6', 'timestamp': '', 'source': 'github', 'line_count': 89, 'max_line_length': 104, 'avg_line_length': 41.61797752808989, 'alnum_prop': 0.7316414686825053, 'repo_name': 'shenst1/portfolio', 'id': 'c6be63f9f105e1cff20567fa679977eee01512d3', 'size': '3704', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'config/environments/production.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '1814507'}, {'name': 'CoffeeScript', 'bytes': '14852'}, {'name': 'JavaScript', 'bytes': '5889551'}, {'name': 'Ruby', 'bytes': '75628'}]}
Fission ------- Fission [@hid-sp18-521-FissionBlog] is an open source, serverless framework for Kubernetes. It allows you to create HTTP services on Kubernetes from functions and can help make Kubernetes easier to work with by allowing a user to create services without having much knowledge Kubernetes itself. Fissions method of making things easier for the user is to allow the majority of users to be able to work at the source level. It can abstract away containers from the user. To use it, you create functions using a variety of languages and then add them with a CLI tool. Functions are called when their trigger fires and they only consume CPU and memory while they are running. Idle functions consume no resources with the exception of storage. Some of the suggested uses for Fission are chatbots, webhooks, Rest APIs and Kubernetes events. The only languages supported for it right now are NodeJS, PHP, Go, C\# and Python.
{'content_hash': '936eeac0a6d9d261e78722c7ec3e2f1f', 'timestamp': '', 'source': 'github', 'line_count': 17, 'max_line_length': 72, 'avg_line_length': 55.0, 'alnum_prop': 0.8, 'repo_name': 'cloudmesh/book', 'id': 'd32e29cafa49ecea22a25007032ed8d6c25a9949', 'size': '936', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'cloud-technologies/incomming/abstract-fission.md', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '6932'}, {'name': 'Java', 'bytes': '57272'}, {'name': 'Jupyter Notebook', 'bytes': '8570554'}, {'name': 'Makefile', 'bytes': '21197'}, {'name': 'Python', 'bytes': '41397'}, {'name': 'Shell', 'bytes': '5962'}, {'name': 'TeX', 'bytes': '5559442'}]}
import { isPlatformBrowser } from '@angular/common'; import { Inject, Injectable, PLATFORM_ID } from '@angular/core'; import { NB_WINDOW } from '@nebular/theme'; import { EMPTY, Observable, Subject } from 'rxjs'; import { distinctUntilChanged, filter, finalize, map, publish, refCount, takeUntil, tap } from 'rxjs/operators'; interface ObserverWithStream { intersectionObserver: IntersectionObserver; visibilityChange$: Observable<IntersectionObserverEntry[]>; } @Injectable() export class NgdVisibilityService { private readonly isBrowser: boolean; private readonly supportsIntersectionObserver: boolean; private readonly visibilityObservers = new Map<IntersectionObserverInit, ObserverWithStream>(); private readonly topmostObservers = new Map<IntersectionObserverInit, Observable<Element>>(); private readonly visibleElements = new Map<IntersectionObserverInit, Element[]>(); private readonly unobserve$ = new Subject<{ target: Element, options: IntersectionObserverInit }>(); constructor( @Inject(PLATFORM_ID) platformId: Object, @Inject(NB_WINDOW) private window, ) { this.isBrowser = isPlatformBrowser(platformId); this.supportsIntersectionObserver = !!this.window.IntersectionObserver; } visibilityChange(target: Element, options: IntersectionObserverInit): Observable<IntersectionObserverEntry> { if (!this.isBrowser || !this.supportsIntersectionObserver) { return EMPTY; } let visibilityObserver = this.visibilityObservers.get(options); if (!visibilityObserver) { visibilityObserver = this.addVisibilityChangeObserver(options); } const { intersectionObserver, visibilityChange$ } = visibilityObserver; intersectionObserver.observe(target); const targetUnobserved$ = this.unobserve$.pipe(filter(e => e.target === target && e.options === options)); return visibilityChange$.pipe( map((entries: IntersectionObserverEntry[]) => entries.find(entry => entry.target === target)), filter((entry: IntersectionObserverEntry | undefined) => !!entry), finalize(() => { intersectionObserver.unobserve(target); this.removeFromVisible(options, target); }), takeUntil(targetUnobserved$), ); } isTopmostVisible(target: Element, options: IntersectionObserverInit): Observable<boolean> { if (!this.isBrowser || !this.supportsIntersectionObserver) { return EMPTY; } const targetUnobserve$ = this.unobserve$.pipe(filter(e => e.target === target && e.options === options)); const topmostChange$ = this.topmostObservers.get(options) || this.addTopmostChangeObserver(options); const { intersectionObserver } = this.visibilityObservers.get(options); intersectionObserver.observe(target); return topmostChange$.pipe( finalize(() => { intersectionObserver.unobserve(target); this.removeFromVisible(options, target); }), map((element: Element) => element === target), distinctUntilChanged(), takeUntil(targetUnobserve$), ); } unobserve(target: Element, options: IntersectionObserverInit): void { this.unobserve$.next({ target, options }); } private addVisibilityChangeObserver(options: IntersectionObserverInit): ObserverWithStream { const visibilityChange$ = new Subject<IntersectionObserverEntry[]>(); const intersectionObserver = new IntersectionObserver( (entries: IntersectionObserverEntry[]) => visibilityChange$.next(entries), options, ); const refCountedObserver = visibilityChange$.pipe( finalize(() => { this.visibilityObservers.delete(options); this.visibleElements.delete(options); intersectionObserver.disconnect(); }), tap((entries: IntersectionObserverEntry[]) => this.updateVisibleItems(options, entries)), publish(), refCount(), ); const observerWithStream = { intersectionObserver, visibilityChange$: refCountedObserver }; this.visibilityObservers.set(options, observerWithStream); return observerWithStream; } private addTopmostChangeObserver(options: IntersectionObserverInit): Observable<Element> { const { visibilityChange$ } = this.visibilityObservers.get(options) || this.addVisibilityChangeObserver(options); const topmostChange$ = visibilityChange$.pipe( finalize(() => this.topmostObservers.delete(options)), map(() => this.findTopmostElement(options)), distinctUntilChanged(), publish(), refCount(), ); this.topmostObservers.set(options, topmostChange$); return topmostChange$; } private updateVisibleItems(options, entries: IntersectionObserverEntry[]) { for (const entry of entries) { if (entry.isIntersecting) { this.addToVisible(options, entry.target); } else { this.removeFromVisible(options, entry.target); } } } private addToVisible(options: IntersectionObserverInit, element: Element): void { if (!this.visibleElements.has(options)) { this.visibleElements.set(options, []); } const existing = this.visibleElements.get(options); if (existing.indexOf(element) === -1) { existing.push(element); } } private removeFromVisible(options: IntersectionObserverInit, element: Element): void { const visibleEntries = this.visibleElements.get(options); if (!visibleEntries) { return; } const index = visibleEntries.indexOf(element); if (index !== -1) { visibleEntries.splice(index, 1); } } private findTopmostElement(options: IntersectionObserverInit): Element | undefined { const visibleElements = this.visibleElements.get(options); if (!visibleElements) { return; } let topmost: Element; for (const element of visibleElements) { if (!topmost || element.getBoundingClientRect().top < topmost.getBoundingClientRect().top) { topmost = element; } } return topmost; } }
{'content_hash': '032548be3951cb0543d56fd201bba958', 'timestamp': '', 'source': 'github', 'line_count': 166, 'max_line_length': 117, 'avg_line_length': 35.963855421686745, 'alnum_prop': 0.7061976549413735, 'repo_name': 'akveo/react-native-ui-kitten', 'id': 'dfae847886aeaff058dd81dff3730b94a653f4a7', 'size': '5970', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'docs/src/app/@theme/services/visibility.service.ts', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '12430'}, {'name': 'JavaScript', 'bytes': '9645'}, {'name': 'Objective-C', 'bytes': '9004'}, {'name': 'Ruby', 'bytes': '1474'}, {'name': 'Starlark', 'bytes': '1204'}, {'name': 'TypeScript', 'bytes': '917353'}]}
java -jar BluetoothServer.jar pause
{'content_hash': '889f78c6aefc0e8a8e22f0791d198d1d', 'timestamp': '', 'source': 'github', 'line_count': 3, 'max_line_length': 30, 'avg_line_length': 12.333333333333334, 'alnum_prop': 0.8108108108108109, 'repo_name': 'Sendinel/Sendinel', 'id': '9f88d94b70e87d11ea6e06f22e47ccf8aca974da', 'size': '37', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'BluetoothServer/dist/start_win.cmd', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '15388'}, {'name': 'JavaScript', 'bytes': '25980'}, {'name': 'Python', 'bytes': '175933'}, {'name': 'Shell', 'bytes': '22210'}]}
CMS.Use([], function (CMS) { CMS.AssetManager = Class.extend({ loaded: false, url: '/direct/asset/manager/index', domElement: null, modal: null, uploader: null, library: null, fromUrl: null, onInsert: $.noop, init: function (data) { $.extend(this, data); var self = this; if (this.domElement) { this.domElement.click(function () { self.open(); return false; }); } this.loaded = false; }, load: function () { var self = this; $.get(this.url, function (data) { if (data.code.id <= 0) { CMS.Use(['Asset/CMS.AssetList', 'Core/CMS.Modal', 'Asset/CMS.Uploader', 'Asset/CMS.AssetLibrary'], function () { self.domElement = $(data.html); self.modal = new CMS.Modal(self.domElement, { title: 'Asset Manager', fixed: true, width: 450, resizable: false, destroyOnClose: false, modal: true, autoOpen: false }); self.domElement.tabs(); self.uploader = new CMS.Uploader({ domElement: $('#UploadButton'), assetList: new CMS.AssetList({ domElement: $('#new-file-list') }), onInsert: self.onInsert }); self.fromUrl = new CMS.Asset({ onInsert: self.onInsert, url_template: '${size}' }); $('#from-url form', self.domElement).submit(function (e) { e.preventDefault(); self.fromUrl.type = 'image'; self.fromUrl.size = $('#image_url', $(this)).val(); self.fromUrl.caption = $('#image_caption', $(this)).val(); self.onInsert(self.fromUrl, self.fromUrl.size); return false; }); self.library = new CMS.AssetLibrary({ domElement: $('#tabs-3', self.domElement), assetListElement: $('#library-list', self.domElement), onInsert: self.onInsert }); self.domElement.bind('tabsselect', function (event, ui) { if (2 == ui.index && $(ui.panel).is('.asset-tab')) { self.library.load(); } }); self.modal.show(); self.loaded = true; }); } }, 'json'); }, _setupUploader: function (html) { var self = this; self.uploader = new CMS.Uploader({ domElement: $('#UploadButton'), assetList: new CMS.AssetList({ domElement: $('#new-file-list') }), onInsert: self.onInsert }); self.loaded = true; }, open: function () { if (!this.loaded) { this.load(); return; } else { this.modal.show(); } }, close: function () { this.modal.hide(); }, setInsertFunction: function (func) { this.onInsert = func; if (this.uploader) { this.uploader.setInsertFunction(func); } if (this.library) { this.library.setInsertFunction(func); } if (this.fromUrl) { this.fromUrl.setInsertFunction(func); } } }); });
{'content_hash': 'e2405801e33d54b059ab9c73d2148c1a', 'timestamp': '', 'source': 'github', 'line_count': 120, 'max_line_length': 132, 'avg_line_length': 35.31666666666667, 'alnum_prop': 0.3749410099103351, 'repo_name': 'modo/cms', 'id': 'ac8c36f02e8e982bc1a43ba378d1bc4cbd869f08', 'size': '4238', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'upload/CMS/Asset/Resource/js/AssetManager.js', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'ASP', 'bytes': '47707'}, {'name': 'JavaScript', 'bytes': '3535327'}, {'name': 'PHP', 'bytes': '17479231'}, {'name': 'Shell', 'bytes': '1668'}]}
""" .. moduleauthor:: Stephen Raymond Ferg and Robert Lugg (active) .. default-domain:: py .. highlight:: python """ import os import sys from . import utils as ut from .base_boxes import buttonbox from .text_box import textbox from .base_boxes import diropenbox from .base_boxes import fileopenbox from .base_boxes import filesavebox from .derived_boxes import ynbox from .derived_boxes import ccbox from .derived_boxes import boolbox from .derived_boxes import indexbox from .derived_boxes import msgbox from .derived_boxes import integerbox from .derived_boxes import multenterbox from .derived_boxes import enterbox from .derived_boxes import exceptionbox from .derived_boxes import choicebox from .derived_boxes import codebox from .derived_boxes import passwordbox from .derived_boxes import multpasswordbox from .derived_boxes import multchoicebox from . import about from .about import eg_version from .about import abouteasygui # -------------------------------------------------------------- # # test/demo easygui # # ----------------------------------------------------------------------- package_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) def egdemo(): """ Run the EasyGui demo. """ # clear the console print('\n' * 100) msg = list() msg.append("Pick the kind of box that you wish to demo.") msg.append(" * Python version {}".format(sys.version)) msg.append(" * EasyGui version {}".format(eg_version)) msg.append(" * Tk version {}".format(ut.TkVersion)) intro_message = "\n".join(msg) while True: # do forever choices = [ "msgbox", "buttonbox", "buttonbox(image) -- a buttonbox that displays an image", "choicebox", "multchoicebox", "textbox", "ynbox", "ccbox", "enterbox", "enterbox(image) -- an enterbox that displays an image", "exceptionbox", "codebox", "integerbox", "boolbox", "indexbox", "filesavebox", "fileopenbox", "passwordbox", "multenterbox", "multpasswordbox", "diropenbox", "About EasyGui", " Help" ] choice = choicebox( msg=intro_message, title="EasyGui " + eg_version, choices=choices) if not choice: return reply = choice.split() if reply[0] == "msgbox": reply = msgbox("short msg", "This is a long title") print("Reply was: {!r}".format(reply)) elif reply[0] == "About": reply = abouteasygui() elif reply[0] == "Help": _demo_help() elif reply[0] == "buttonbox": reply = buttonbox( choices=['one', 'two', 'two', 'three'], default_choice='two') print("Reply was: {!r}".format(reply)) title = "Demo of Buttonbox with many, many buttons!" msg = ("This buttonbox shows what happens when you " "specify too many buttons.") reply = buttonbox( msg=msg, title=title, choices=choices, cancel_choice='msgbox') print("Reply was: {!r}".format(reply)) elif reply[0] == "buttonbox(image)": _demo_buttonbox_with_image() elif reply[0] == "boolbox": reply = boolbox() print("Reply was: {!r}".format(reply)) elif reply[0] == "enterbox": image = os.path.join(package_dir, "python_and_check_logo.gif") message = ("Enter the name of your best friend." "\n(Result will be stripped.)") reply = enterbox(message, "Love!", " Suzy Smith ") print("Reply was: {!r}".format(reply)) message = ("Enter the name of your best friend." "\n(Result will NOT be stripped.)") reply = enterbox( message, "Love!", " Suzy Smith ", strip=False) print("Reply was: {!r}".format(reply)) reply = enterbox("Enter the name of your worst enemy:", "Hate!") print("Reply was: {!r}".format(reply)) elif reply[0] == "enterbox(image)": image = os.path.join(package_dir, "python_and_check_logo.gif") message = "What kind of snake is this?" reply = enterbox(message, "Quiz", image=image) print("Reply was: {!r}".format(reply)) elif reply[0] == "exceptionbox": try: thisWillCauseADivideByZeroException = 1 / 0 except: exceptionbox() elif reply[0] == "integerbox": reply = integerbox( "Enter a number between 3 and 333", "Demo: integerbox WITH a default value", 222, 3, 333) print("Reply was: {!r}".format(reply)) reply = integerbox( "Enter a number between 0 and 99", "Demo: integerbox WITHOUT a default value" ) print("Reply was: {!r}".format(reply)) elif reply[0] == "diropenbox": _demo_diropenbox() elif reply[0] == "fileopenbox": _demo_fileopenbox() elif reply[0] == "filesavebox": _demo_filesavebox() elif reply[0] == "indexbox": title = reply[0] msg = "Demo of " + reply[0] choices = ["Choice1", "Choice2", "Choice3", "Choice4"] reply = indexbox(msg, title, choices) print("Reply was: {!r}".format(reply)) elif reply[0] == "passwordbox": reply = passwordbox("Demo of password box WITHOUT default" + "\n\nEnter your secret password", "Member Logon") print("Reply was: {!s}".format(reply)) reply = passwordbox("Demo of password box WITH default" + "\n\nEnter your secret password", "Member Logon", "alfie") print("Reply was: {!s}".format(reply)) elif reply[0] == "multenterbox": msg = "Enter your personal information" title = "Credit Card Application" fieldNames = ["Name", "Street Address", "City", "State", "ZipCode"] fieldValues = list() # we start with blanks for the values fieldValues = multenterbox(msg, title, fieldNames) # make sure that none of the fields was left blank while 1: if fieldValues is None: break errs = list() for n, v in zip(fieldNames, fieldValues): if v.strip() == "": errs.append('"{}" is a required field.'.format(n)) if not len(errs): break # no problems found fieldValues = multenterbox( "\n".join(errs), title, fieldNames, fieldValues) print("Reply was: {}".format(fieldValues)) elif reply[0] == "multpasswordbox": msg = "Enter logon information" title = "Demo of multpasswordbox" fieldNames = ["Server ID", "User ID", "Password"] fieldValues = list() # we start with blanks for the values fieldValues = multpasswordbox(msg, title, fieldNames) # make sure that none of the fields was left blank while 1: if fieldValues is None: break errs = list() for n, v in zip(fieldNames, fieldValues): if v.strip() == "": errs.append('"{}" is a required field.\n\n'.format(n)) if not len(errs): break # no problems found fieldValues = multpasswordbox( "".join(errs), title, fieldNames, fieldValues) print("Reply was: {!s}".format(fieldValues)) elif reply[0] == "ynbox": title = "Demo of ynbox" msg = "Were you expecting the Spanish Inquisition?" reply = ynbox(msg, title) print("Reply was: {!r}".format(reply)) if reply: msgbox("NOBODY expects the Spanish Inquisition!", "Wrong!") elif reply[0] == "ccbox": msg = "Insert your favorite message here" title = "Demo of ccbox" reply = ccbox(msg, title) print("Reply was: {!r}".format(reply)) elif reply[0] == "choicebox": title = "Demo of choicebox" longchoice = ( "This is an example of a very long option " "which you may or may not wish to choose." * 2) listChoices = ["nnn", "ddd", "eee", "fff", "aaa", longchoice, "aaa", "bbb", "ccc", "ggg", "hhh", "iii", "jjj", "kkk", "LLL", "mmm", "nnn", "ooo", "ppp", "qqq", "rrr", "sss", "ttt", "uuu", "vvv"] msg = ("Pick something. " + ("A wrapable sentence of text ?! " * 30) + "\nA separate line of text." * 6) reply = choicebox(msg=msg, choices=listChoices) print("Reply was: {!r}".format(reply)) msg = "Pick something. " reply = choicebox(msg=msg, title=title, choices=listChoices) print("Reply was: {!r}".format(reply)) msg = "Pick something. " reply = choicebox( msg="The list of choices is empty!", choices=list()) print("Reply was: {!r}".format(reply)) elif reply[0] == "multchoicebox": listChoices = ["aaa", "bbb", "ccc", "ggg", "hhh", "iii", "jjj", "kkk", "LLL", "mmm", "nnn", "ooo", "ppp", "qqq", "rrr", "sss", "ttt", "uuu", "vvv"] msg = "Pick as many choices as you wish." reply = multchoicebox(msg, "Demo of multchoicebox", listChoices) print("Reply was: {!r}".format(reply)) elif reply[0] == "textbox": _demo_textbox(reply[0]) elif reply[0] == "codebox": _demo_codebox(reply[0]) else: msgbox("Choice\n\n{}\n\nis not recognized".format( choice), "Program Logic Error") return def _demo_textbox(reply): text_snippet = (( "It was the best of times, and it was the worst of times. The rich " "ate cake, and the poor had cake recommended to them, but wished " "only for enough cash to buy bread. The time was ripe for " "revolution! " * 5) + "\n\n") * 10 title = "Demo of textbox" msg = "Here is some sample text. " * 16 reply = textbox(msg, title, text_snippet) print("Reply was: {!s}".format(reply)) def _demo_codebox(reply): # TODO RL: Turn this sample code into the code in this module, just for fun code_snippet = ("dafsdfa dasflkj pp[oadsij asdfp;ij asdfpjkop asdfpok asdfpok asdfpok" * 3) + "\n" + """# here is some dummy Python code for someItem in myListOfStuff: do something(someItem) do something() do something() if somethingElse(someItem): doSomethingEvenMoreInteresting() """ * 16 msg = "Here is some sample code. " * 16 reply = codebox(msg, "Code Sample", code_snippet) print("Reply was: {!r}".format(reply)) def _demo_buttonbox_with_image(): msg = "Do you like this picture?\nIt is " choices = ["Yes", "No", "No opinion"] for image in [ os.path.join(package_dir, "python_and_check_logo.gif"), os.path.join(package_dir, "python_and_check_logo.jpg"), os.path.join(package_dir, "python_and_check_logo.png"), os.path.join(package_dir, "zzzzz.gif")]: reply = buttonbox(msg + image, image=image, choices=choices) print("Reply was: {!r}".format(reply)) def _demo_help(): codebox("EasyGui Help", text=about.EASYGUI_ABOUT_INFORMATION) def _demo_filesavebox(): filename = "myNewFile.txt" title = "File SaveAs" msg = "Save file as:" f = filesavebox(msg, title, default=filename) print("You chose to save file: {}".format(f)) def _demo_diropenbox(): title = "Demo of diropenbox" msg = "Pick the directory that you wish to open." d = diropenbox(msg, title) print("You chose directory...: {}".format(d)) d = diropenbox(msg, title, default="./") print("You chose directory...: {}".format(d)) d = diropenbox(msg, title, default="c:/") print("You chose directory...: {}".format(d)) def _demo_fileopenbox(): msg = "Python files" title = "Open files" default = "*.py" f = fileopenbox(msg, title, default=default) print("You chose to open file: {}".format(f)) default = "./*.gif" msg = "Some other file types (Multi-select)" filetypes = ["*.jpg", ["*.zip", "*.tgs", "*.gz", "Archive files"], ["*.htm", "*.html", "HTML files"]] f = fileopenbox( msg, title, default=default, filetypes=filetypes, multiple=True) print("You chose to open file: %s" % f)
{'content_hash': 'dd8fadcada4f7cef8f1e66c579cb5598', 'timestamp': '', 'source': 'github', 'line_count': 378, 'max_line_length': 140, 'avg_line_length': 35.36772486772487, 'alnum_prop': 0.5263669683596379, 'repo_name': 'harish0507/GMapsScrapper', 'id': '88e3cdfbe84bb4fbe6a7b8899b849ad0ab8854a5', 'size': '13369', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'lib/easygui/build/lib/easygui/boxes/demo.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Python', 'bytes': '455517'}]}
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ucd.denver.com.diskussioner.entity; import java.util.Date; import java.util.List; /** * * @author Chathura */ public class Discussion{ private Integer id; private String topic; private Date startedDate; private List<UserSubscribe> userSubscribeCollection; private User startedUser; private List<Reply> replyCollection; public Discussion() { } public Discussion(Integer id) { this.id = id; } public Discussion(Integer id, String topic) { this.id = id; this.topic = topic; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTopic() { return topic; } public void setTopic(String topic) { this.topic = topic; } public Date getStartedDate() { return startedDate; } public void setStartedDate(Date startedDate) { this.startedDate = startedDate; } public User getStartedUser() { return startedUser; } public void setStartedUser(User startedUser) { this.startedUser = startedUser; } public List<UserSubscribe> getUserSubscribeCollection() { return userSubscribeCollection; } public void setUserSubscribeCollection(List<UserSubscribe> userSubscribeCollection) { this.userSubscribeCollection = userSubscribeCollection; } public List<Reply> getReplyCollection() { return replyCollection; } public void setReplyCollection(List<Reply> replyCollection) { this.replyCollection = replyCollection; } }
{'content_hash': 'edbcb6194a11d0a7e1c53abcf2e62815', 'timestamp': '', 'source': 'github', 'line_count': 93, 'max_line_length': 89, 'avg_line_length': 19.64516129032258, 'alnum_prop': 0.6546250684181719, 'repo_name': 'rupasinghecd/DiskussionANDROID', 'id': '3ef381557695bae4f0df06dce39e04da7ee6137d', 'size': '1827', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Diskussioner/app/src/main/java/ucd/denver/com/diskussioner/entity/Discussion.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '64771'}]}
require 'spree_core' require 'spree_static_content_nested_set/engine'
{'content_hash': '51430374163eb555e97181d211c8099c', 'timestamp': '', 'source': 'github', 'line_count': 2, 'max_line_length': 48, 'avg_line_length': 35.0, 'alnum_prop': 0.8, 'repo_name': 'markalinn/Spree-Static-Content-Nested-Set', 'id': '1c6d710408c4c8ac37fb06bf36a55c8c99031c31', 'size': '70', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/spree_static_content_nested_set.rb', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'JavaScript', 'bytes': '58'}, {'name': 'Ruby', 'bytes': '9604'}]}
package br.com.navegadores; import java.io.File; import java.io.IOException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.ie.InternetExplorerDriverService; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import br.com.configuracoes.InterNavegador; public class DriverInternetExplorer implements InterNavegadores { private InternetExplorerDriverService ieService; private WebDriver getIeConfigurado(String proxy) { org.openqa.selenium.Proxy proxyy = new org.openqa.selenium.Proxy(); proxyy.setHttpProxy(proxy); proxyy.setFtpProxy(proxy); proxyy.setSslProxy(proxy); proxyy.setAutodetect(false); DesiredCapabilities capabilities = DesiredCapabilities .internetExplorer(); capabilities .setCapability( InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, false); capabilities.setCapability(CapabilityType.PROXY, proxyy); capabilities.setBrowserName("ie"); ieService = new InternetExplorerDriverService.Builder() .usingDriverExecutable(new File(InterNavegador.PATH_IEX)) .usingAnyFreePort().build(); try { ieService.start(); } catch (IOException e) { System.out.println(e); } return new RemoteWebDriver(ieService.getUrl(), capabilities); // return new InternetExplorerDriver(capabilities); } @Override public WebDriver getDriver(String proxy) { return getIeConfigurado(proxy); } }
{'content_hash': '4d3672bbcb365d0fe9190c41929a7d4c', 'timestamp': '', 'source': 'github', 'line_count': 53, 'max_line_length': 78, 'avg_line_length': 29.452830188679247, 'alnum_prop': 0.7885970531710442, 'repo_name': 'confsoft/FuncaoWeb', 'id': 'c0a52bfbbcf9cacbad2f3b45d9d3575f49375039', 'size': '1561', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'src/br/com/navegadores/DriverInternetExplorer.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '61303'}]}
```PLSQL PROMPT bind variables are... VAR foo VARCHAR2 SET SERVEROUTPUT ON BEGIN :FOO := 'in PL/SQL blocks'; DBMS_OUTPUT.PUT_LINE('mostly used...'); END; / SET SERVEROUTPUT OFF PRINT foo ``` output ``` bind variables are... PL/SQL procedure successfully completed. mostly used... FOO --- in PL/SQL blocks ``` ```PLSQL PROMPT Where as user variable are... DEFINE FOO = 'useful in SQL scripts' SET VERIFY OFF SELECT '&FOO' AS BAR FROM DUAL; SET VERIFY ON ``` output ``` Where as user variable are... BAR --------------------- useful in SQL scripts ``` To be explict, use bind vars to interact with PL/SQL blocks and user variables are substituion variables that could be used anywhere. The only downside to user variables is that you can't DEFINE a variable with another user variable. Further reading: - [Toadworld using bind variables](http://www.toadworld.com/platforms/oracle/w/wiki/1358.using-bind-variables) - [bind variables performant when using with dynamic (useful instrumention query)](http://www.dba-oracle.com/plsql/t_plsql_efficient.htm)
{'content_hash': '461a4a732b872754d3dbcfb6eb72805a', 'timestamp': '', 'source': 'github', 'line_count': 52, 'max_line_length': 233, 'avg_line_length': 20.846153846153847, 'alnum_prop': 0.7130996309963099, 'repo_name': 'booyaa/overflow', 'id': '2a9e98940f8fa5b1d57e857fa7a3a805ec12996f', 'size': '1120', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'databases/oracle/sqlplus.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '347'}, {'name': 'Lua', 'bytes': '570'}, {'name': 'PLSQL', 'bytes': '5223'}, {'name': 'SQLPL', 'bytes': '1205'}]}
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{'content_hash': 'b789fca808f1753d9bed8c6d65d84d32', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 39, 'avg_line_length': 10.307692307692308, 'alnum_prop': 0.6940298507462687, 'repo_name': 'mdoering/backbone', 'id': '527efcf058feef0ad138443a1b49f82eb7fd51ce', 'size': '180', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Magnoliophyta/Magnoliopsida/Apiales/Apiaceae/Angelica/Angelica hirsuta/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []}
package vn.cybersoft.summerms; import java.io.File; import android.os.Environment; public class Constants { public static final String TAG = "SummerMobileSecurity"; public static final String TAG_SOUND_DETECT = "detect"; public static final boolean DEBUG = true; public static final String NEW_LINE = "\n"; public static final String STRING_CONNECTER = " - "; public static final String UNDERSCORE = "_"; public static final String COMMA = ","; public static final String COLON = ": "; public static final String COLON2 = ":"; public static final String DOT = "."; public static final String THREE_DOT = "..."; public static final String MINUS = "-"; public static final String PLUS = "+"; public static final String SPACE = " "; public static final String EMAIL_FORMAT = "mailto:%s?subject=%s&body=%s"; public static final String SPACE_ENC = "%20"; public static final String SLASH = "/"; public static final String HTTP = "http://"; public static final String HTTP2 = "http"; public static final String HTTPS = "https://"; public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static final String EMPTY_STRING = ""; public static final String SUCCESS = "SUCCESS"; public static final String FAIL = "FAIL"; public static final String UTF8 = "UTF-8"; public static final String CURRENT_PACKAGE = "vn.cybersoft.summerms"; // Application's states public static final int STATE_UNLOCKED = 0; public static final int STATE_LOCKED = 1; public static final int STATE_PINPASSED = 2; // Storage paths public static final String APPLICATION_PATH = Environment.getExternalStorageDirectory() + File.separator + "SummerMobileSecuriry"; public static final String DATABASE_PATH = APPLICATION_PATH + File.separator + "databases"; //Data Monitor public final static String DATE="day"; public final static String VALUE_START_UPLOAD="value_start_upload"; public final static String VALUE_START_UPLOAD_LAST="value_start_upload_last"; public final static String VALUE_START_DOWNLOAD="value_start_download"; public final static String VALUE_START_DOWNLOAD_LAST="value_start_download_last"; public final static String APP_NAME="app_name"; public final static String APP_ID="app_id"; }
{'content_hash': '6294798ab1433601131eee516942b928', 'timestamp': '', 'source': 'github', 'line_count': 56, 'max_line_length': 105, 'avg_line_length': 41.107142857142854, 'alnum_prop': 0.7172024326672459, 'repo_name': 'CyberSoftTeam/SummerMobileSecurity', 'id': '83664a59b0d3a960e77801e84c971b44b076cb39', 'size': '3105', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'SummerMobileSecurity/src/vn/cybersoft/summerms/Constants.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '293025'}]}
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>Episode 17: Big Nuts - BlahCade Podcast</title> <meta name="HandheldFriendly" content="True"> <meta name="MobileOptimized" content="320"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="description" content=""> <meta name="twitter:card" content="summary"> <meta name="twitter:title" content="Episode 17: Big Nuts"> <meta name="twitter:description" content=""> <meta property="og:type" content="article"> <meta property="og:title" content="Episode 17: Big Nuts"> <meta property="og:description" content=""> <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon"> <link href="/apple-touch-icon-precomposed.png" rel="apple-touch-icon"> <link rel="stylesheet" type="text/css" href="//blahcadepinball.com/themes/uno/assets/css/uno.css?v=1488194524268" /> <link rel="canonical" href="http://blahcadepinball.com/2015/04/20/Episode-17-Big-Nuts.html" /> <meta name="referrer" content="origin" /> <meta property="og:site_name" content="BlahCade Podcast" /> <meta property="og:type" content="website" /> <meta property="og:title" content="Episode 17: Big Nuts" /> <meta property="og:description" content="New BlahCade is up and it is quite the show! It&amp;#8217;s called Big Nuts for reasons purely pinball related, we swear. This time around there is a dramatic recreation of the interview Jared did with Zsolt of A.S.K. Homework, featuring Bonzo as the voice of Zsolt." /> <meta property="og:url" content="http://blahcadepinball.com/2015/04/20/Episode-17-Big-Nuts.html" /> <meta property="article:tag" content="Final" /> <meta property="article:tag" content=" LitZ" /> <meta property="article:tag" content=" TotM" /> <meta name="twitter:card" content="summary" /> <meta name="twitter:title" content="Episode 17: Big Nuts" /> <meta name="twitter:description" content="New BlahCade is up and it is quite the show! It&amp;#8217;s called Big Nuts for reasons purely pinball related, we swear. This time around there is a dramatic recreation of the interview Jared did with Zsolt of A.S.K. Homework, featuring Bonzo as the voice of Zsolt." /> <meta name="twitter:url" content="http://blahcadepinball.com/2015/04/20/Episode-17-Big-Nuts.html" /> <script type="application/ld+json"> null </script> <meta name="generator" content="HubPress" /> <link rel="alternate" type="application/rss+xml" title="BlahCade Podcast" href="http://blahcadepinball.com/rss/" /> </head> <body class="post-template tag-Final tag-LitZ tag-TotM no-js"> <span class="mobile btn-mobile-menu"> <i class="icon icon-list btn-mobile-menu__icon"></i> <i class="icon icon-x-circle btn-mobile-close__icon hidden"></i> </span> <header class="panel-cover panel-cover--collapsed " style="background-image: url(/images/cover.jpg)"> <div class="panel-main"> <div class="panel-main__inner panel-inverted"> <div class="panel-main__content"> <a href="http://blahcadepinball.com" title="link to homepage for BlahCade Podcast"><img src="/images/logo.png" width="80" alt="BlahCade Podcast logo" class="panel-cover__logo logo" /></a> <h1 class="panel-cover__title panel-title"><a href="http://blahcadepinball.com" title="link to homepage for BlahCade Podcast">BlahCade Podcast</a></h1> <hr class="panel-cover__divider" /> <p class="panel-cover__description">Digital Pinball, Real Pinball, Movies, Snacks (but mostly Digital Pinball)</p> <hr class="panel-cover__divider panel-cover__divider--secondary" /> <div class="navigation-wrapper"> <nav class="cover-navigation cover-navigation--primary"> <ul class="navigation"> <li class="navigation__item"><a href="http://blahcadepinball.com/#blog" title="link to BlahCade Podcast blog" class="blog-button">Blog</a></li> </ul> </nav> <nav class="cover-navigation navigation--social"> <ul class="navigation"> <!-- Twitter --> <li class="navigation__item"> <a href="https://twitter.com/blahcade" title="Twitter account"> <i class='icon icon-social-twitter'></i> <span class="label">Twitter</span> </a> </li> <!-- Google Plus --> <li class="navigation__item"> <a href="https://plus.google.com/111201633898451444599/" title="Google+ account"> <i class='icon icon-social-google-plus'></i> <span class="label">Google-plus</span> </a> </li> <!-- Github --> <li class="navigation__item"> <a href="https://github.com/blahcadepodcast/" title="Github account"> <i class='icon icon-social-github'></i> <span class="label">Github</span> </a> </li> </li> <!-- Email --> <li class="navigation__item"> <a href="mailto:[email protected]" title="Email [email protected]"> <i class='icon icon-mail'></i> <span class="label">Email</span> </a> </li> </ul> </nav> </div> </div> </div> <div class="panel-cover--overlay"></div> </div> </header> <div class="content-wrapper"> <div class="content-wrapper__inner"> <article class="post-container post-container--single"> <header class="post-header"> <div class="post-meta"> <time datetime="20 Apr 2015" class="post-meta__date date">20 Apr 2015</time> &#8226; <span class="post-meta__tags tags">on <a href="http://blahcadepinball.com/tag/Final/">Final</a>, <a href="http://blahcadepinball.com/tag/LitZ/"> LitZ</a>, <a href="http://blahcadepinball.com/tag/TotM/"> TotM</a></span> <span class="post-meta__author author"><img src="https://avatars.githubusercontent.com/u/17490735?v&#x3D;3" alt="profile image for BlahCade Podcast" class="avatar post-meta__avatar" /> by BlahCade Podcast</span> </div> <h1 class="post-title">Episode 17: Big Nuts</h1> </header> <section class="post tag-Final tag-LitZ tag-TotM"> <div id="preamble"> <div class="sectionbody"> <div class="paragraph"> <p>New BlahCade is up and it is quite the show! It&#8217;s called Big Nuts for reasons purely pinball related, we swear.</p> </div> <div class="paragraph"> <p>This time around there is a dramatic recreation of the interview Jared did with Zsolt of A.S.K. Homework, featuring Bonzo as the voice of Zsolt. Ton of questions answered, not to be missed.</p> </div> <div class="paragraph"> <p>There is also a LitZ despite Sean not being in this session, but that didn&#8217;t stop SYT!</p> </div> <div class="paragraph"> <p>Full results and discussion of March TotM, with shoutouts for those that like hearing their names.</p> </div> <div class="paragraph"> <p>And of course more.</p> </div> <div class="admonitionblock note"> <table> <tr> <td class="icon"> <i class="fa icon-note" title="Note"></i> </td> <td class="content"> <div class="title">Historical Note</div> This is last time a LitZ was ever heard in BlahCade. </td> </tr> </table> </div> </div> </div> <div class="sect1"> <h2 id="_links">Links</h2> <div class="sectionbody"> <div class="paragraph"> <p><a href="http://shoutengine.com/BlahCadePodcast/big-nuts-12305">Stream/Download/RSS</a></p> </div> <div class="paragraph"> <p><a href="https://itunes.apple.com/us/podcast/blahcade-podcast/id1039748922?mt=2">iTunes</a></p> </div> <div class="paragraph"> <p><a href="https://blab.im/BlahCade">Blab.im Live Session</a></p> </div> <div class="paragraph"> <p><a href="https://represent.com/blahcade-shirt">BlahCade T-shirts on represent.com</a></p> </div> </div> </div> <div class="sect1"> <h2 id="_timings">Timings</h2> <div class="sectionbody"> <div class="paragraph"> <p>Not available.</p> </div> </div> </div> </section> </article> <section class="post-comments"> <div id="disqus_thread"></div> <script type="text/javascript"> var disqus_shortname = 'blahcadepodcast'; // required: replace example with your forum shortname /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> </section> <footer class="footer"> <span class="footer__copyright">&copy; 2017. All rights reserved.</span> <span class="footer__copyright"><a href="http://uno.daleanthony.com" title="link to page for Uno Ghost theme">Uno theme</a> by <a href="http://daleanthony.com" title="link to website for Dale-Anthony">Dale-Anthony</a></span> <span class="footer__copyright">Proudly published with <a href="http://hubpress.io" title="link to Hubpress website">Hubpress</a></span> </footer> </div> </div> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js?v="></script> <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.min.js?v="></script> <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js?v="></script> <script type="text/javascript"> jQuery( document ).ready(function() { // change date with ago jQuery('ago.ago').each(function(){ var element = jQuery(this).parent(); element.html( moment(element.text()).fromNow()); }); }); hljs.initHighlightingOnLoad(); </script> <script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> <script type="text/javascript" src="//blahcadepinball.com/themes/uno/assets/js/main.js?v=1488194524268"></script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-83260356-1', 'auto'); ga('send', 'pageview'); </script> </body> </html>
{'content_hash': 'c51baaa2f8a8373cf6bfebe55e7259f5', 'timestamp': '', 'source': 'github', 'line_count': 271, 'max_line_length': 316, 'avg_line_length': 43.025830258302584, 'alnum_prop': 0.6067753001715266, 'repo_name': 'blahcadepodcast/blahcadepodcast.github.io', 'id': '86f8334e5acb984279a8fa90e1ccbb220ac99e40', 'size': '11660', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': '2015/04/20/Episode-17-Big-Nuts.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '466631'}, {'name': 'CoffeeScript', 'bytes': '6630'}, {'name': 'HTML', 'bytes': '5408105'}, {'name': 'JavaScript', 'bytes': '238406'}, {'name': 'Ruby', 'bytes': '806'}, {'name': 'Shell', 'bytes': '2265'}]}
module load gcc/4.8.1 module load r/3.2.2 source ../../config.sh set OUT_DIR = ${ROOT_OUT_DIR}"/compare_to_experimental/LT" mkdir -p $OUT_DIR ${BUILD_DIR}/CompareToTargeted ${DATA_DIR}"/Neuro_04.mzML" ${DATA_DIR}"/Neuro_04_centroid.mzML" ${OUT_DIR}"/out04.tab" ${OUT_DIR}"/calc_out04.tab" ${OUT_DIR}"/scores_out04.tab" Rscript IndividualSpectrumIsotopes.R ${OUT_DIR}"/out04.tab" ${OUT_DIR}"/calc_out04.tab" ${OUT_DIR}"/scores_out04.tab" ${OUT_DIR}"/low_throughput.eps"
{'content_hash': 'a239aa7b3fdf5f3127c72ee9e750bb69', 'timestamp': '', 'source': 'github', 'line_count': 11, 'max_line_length': 176, 'avg_line_length': 42.90909090909091, 'alnum_prop': 0.6927966101694916, 'repo_name': 'UNC-Major-Lab/Fragment-Isotope-Distribution-Paper', 'id': '6eab7e6dc9d09c99b10a14108f8c39337b9c07ff', 'size': '633', 'binary': False, 'copies': '1', 'ref': 'refs/heads/Publication', 'path': 'scripts/experimental/lowThroughput/LSF_compare_to_targeted.sh', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C++', 'bytes': '144455'}, {'name': 'CMake', 'bytes': '3229'}, {'name': 'Java', 'bytes': '13089'}, {'name': 'Matlab', 'bytes': '7293'}, {'name': 'Python', 'bytes': '7419'}, {'name': 'R', 'bytes': '15002'}, {'name': 'Shell', 'bytes': '15542'}]}
package com.toedter.components; import java.io.UnsupportedEncodingException; import java.util.Enumeration; import java.util.Locale; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; /** * This class is a hack to read UTF-8 encoded property files. The implementation * is based on http://www.thoughtsabout.net/blog/archives/000044.html * * @author Kai Toedter * */ public abstract class UTF8ResourceBundle { public static final ResourceBundle getBundle(String baseName, Locale locale) { ResourceBundle bundle = ResourceBundle.getBundle(baseName, locale); if (!(bundle instanceof PropertyResourceBundle)) { return bundle; } return new UTF8PropertyResourceBundle((PropertyResourceBundle) bundle); } private static class UTF8PropertyResourceBundle extends ResourceBundle { PropertyResourceBundle propertyResourceBundle; private UTF8PropertyResourceBundle(PropertyResourceBundle bundle) { this.propertyResourceBundle = bundle; } public Enumeration getKeys() { return propertyResourceBundle.getKeys(); } protected Object handleGetObject(String key) { String value = (String) propertyResourceBundle.handleGetObject(key); if (value != null) { try { return new String(value.getBytes("ISO-8859-1"), "UTF-8"); } catch (UnsupportedEncodingException exception) { throw new RuntimeException( "UTF-8 encoding is not supported.", exception); } } return null; } } }
{'content_hash': 'd63e980dbd2f075b9f239e951052a39e', 'timestamp': '', 'source': 'github', 'line_count': 53, 'max_line_length': 82, 'avg_line_length': 31.943396226415093, 'alnum_prop': 0.6532782043709392, 'repo_name': 'DegJ/miceschoolproject', 'id': 'b0e33d50dbfdc3430079b51d8a8eefe1bd677fe6', 'size': '2585', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'MICE/lib/JCalendar-2/src/com/toedter/components/UTF8ResourceBundle.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '2950'}, {'name': 'Java', 'bytes': '682952'}]}
using System; using System.Reactive.Concurrency; using System.Reactive.Linq; using System.Threading; using System.Windows; using System.Windows.Controls; using Redis.SilverlightClient; namespace Redis.SilverlightTestApp { public partial class MainPage { public MainPage() { InitializeComponent(); this.Loaded += this.MainPageLoaded; } void MainPageLoaded(object sender, RoutedEventArgs e) { RedisSubscriber.SubscribeToChannel("127.0.0.1", 4525, "test-alert") .ObserveOn(SynchronizationContext.Current) .Subscribe(message => { listBoxAlerts.Items.Add(new ListBoxItem { Content = message.Content }); }, ex => { MessageBox.Show(ex.ToString()); }); } } }
{'content_hash': '87181cc7dfcec57c0886854d7135f554', 'timestamp': '', 'source': 'github', 'line_count': 34, 'max_line_length': 95, 'avg_line_length': 27.38235294117647, 'alnum_prop': 0.5456498388829216, 'repo_name': 'vgrigoriu/Redis.SilverlightClient', 'id': '0c9dc12bf37a09b1509a44c4100faeeb25c7d812', 'size': '933', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Redis.SilverlightGap/Redis.SilverlightTestApp/MainPage.xaml.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '33537'}]}
<?php namespace AppointTest\Model; use Appoint\Model\Appoint; use PHPUnit_Framework_TestCase; /* * We are testing for 3 things: * 1. We are all of the Appoint’s properties initially set to NULL? * 2. Will the Appoint’s properties be set correctly when we call exchangeArray()? * 3. Will a default value of NULL be used for properties whose keys are not present in the $data array? */ class AppointTest extends PHPUnit_Framework_TestCase { public function testAppointInitialState() { $Appoint = new Appoint(); $this->assertNull($Appoint->id, '"id" should initially be null'); $this->assertNull($Appoint->reason, '"reason" should initially be null'); $this->assertNull($Appoint->date, '"date" should initially be null'); $this->assertNull($Appoint->patient_name , '"patient_name" should initially be null'); } public function testExchangeArraySetsPropertiesCorrectly() { $Appoint = new Appoint(); $data = array('reason' => 'Sick', 'date' => '2016-06-26 11:00:00', 'patient_name' => 'Some Name'); $Appoint->exchangeArray($data); $this->assertSame($data['reason'], $Appoint->reason, '"reason" was not set correctly'); $this->assertSame($data['date'], $Appoint->date, '"date" was not set correctly'); $this->assertSame($data['patient_name'], $Appoint->patient_name, '"patient_name" was not set correctly'); } public function testExchangeArraySetsPropertiesToNullIfKeysAreNotPresent() { $Appoint = new Appoint(); $Appoint->exchangeArray(array('reason' => 'some reason', 'date' => '2016-06-26 11:00:00', 'patient_name' => 'some name')); $Appoint->exchangeArray(array()); $this->assertNull($Appoint->reason, '"reason" should have defaulted to null'); $this->assertNull($Appoint->date, '"date" should have defaulted to null'); $this->assertNull($Appoint->patient_name, '"patient_name" should have defaulted to null'); } }
{'content_hash': 'd1d4621fbf55e3ed1d628c977f4ab310', 'timestamp': '', 'source': 'github', 'line_count': 52, 'max_line_length': 113, 'avg_line_length': 40.86538461538461, 'alnum_prop': 0.6207058823529412, 'repo_name': 'jbs321/appoint-me', 'id': '2fc22d8709e3ac5a789263ce2c2d1b59aae9e2aa', 'size': '2129', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'module/Appoint/test/AppointTest/Model/AppointTest.php', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'ApacheConf', 'bytes': '711'}, {'name': 'CSS', 'bytes': '12926'}, {'name': 'HTML', 'bytes': '20849'}, {'name': 'JavaScript', 'bytes': '35314'}, {'name': 'PHP', 'bytes': '40492'}]}
// Copyright (c) 2013-2020 Rob Norris and Contributors // This software is licensed under the MIT License (MIT). // For more information see LICENSE or https://opensource.org/licenses/MIT // relies on streaming, so no cats for now package example import cats.Show import cats.syntax.all._ import cats.effect.{ IO, IOApp } import fs2.Stream import doobie._, doobie.implicits._ // Example lifted from slick object FirstExample extends IOApp.Simple { // Our data model final case class Supplier(id: Int, name: String, street: String, city: String, state: String, zip: String) final case class Coffee(name: String, supId: Int, price: Double, sales: Int, total: Int) object Coffee { implicit val show: Show[Coffee] = Show.fromToString } // Some suppliers val suppliers = List( Supplier(101, "Acme, Inc.", "99 Market Street", "Groundsville", "CA", "95199"), Supplier( 49, "Superior Coffee", "1 Party Place", "Mendocino", "CA", "95460"), Supplier(150, "The High Ground", "100 Coffee Lane", "Meadows", "CA", "93966") ) // Some coffees val coffees = List( Coffee("Colombian", 101, 7.99, 0, 0), Coffee("French_Roast", 49, 8.99, 0, 0), Coffee("Espresso", 150, 9.99, 0, 0), Coffee("Colombian_Decaf", 101, 8.99, 0, 0), Coffee("French_Roast_Decaf", 49, 9.99, 0, 0) ) // Our example database action def examples: ConnectionIO[String] = for { // Create and populate _ <- DAO.create ns <- DAO.insertSuppliers(suppliers) nc <- DAO.insertCoffees(coffees) _ <- putStrLn(show"Inserted $ns suppliers and $nc coffees.") // Select and stream the coffees to stdout _ <- DAO.allCoffees.evalMap(c => putStrLn(show"$c")).compile.drain // Get the names and supplier names for all coffees costing less than $9.00, // again streamed directly to stdout _ <- DAO.coffeesLessThan(9.0).evalMap(p => putStrLn(show"$p")).compile.drain // Same thing, but read into a list this time l <- DAO.coffeesLessThan(9.0).compile.toList _ <- putStrLn(l.toString) // Read into a vector this time, with some stream processing v <- DAO.coffeesLessThan(9.0).take(2).map(p => p._1 + "*" + p._2).compile.toVector _ <- putStrLn(v.toString) } yield "All done!" // Entry point. def run: IO[Unit] = { val db = Transactor.fromDriverManager[IO]( "org.h2.Driver", "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", "sa", "" ) for { a <- examples.transact(db).attempt _ <- IO(println(a)) } yield () } /** DAO module provides ConnectionIO constructors for end users. */ object DAO { def coffeesLessThan(price: Double): Stream[ConnectionIO, (String, String)] = Queries.coffeesLessThan(price).stream def insertSuppliers(ss: List[Supplier]): ConnectionIO[Int] = Queries.insertSupplier.updateMany(ss) // bulk insert (!) def insertCoffees(cs: List[Coffee]): ConnectionIO[Int] = Queries.insertCoffee.updateMany(cs) def allCoffees: Stream[ConnectionIO, Coffee] = Queries.allCoffees.stream def create: ConnectionIO[Unit] = Queries.create.run.void } /** Queries module contains "raw" Query/Update values. */ object Queries { def coffeesLessThan(price: Double): Query0[(String, String)] = sql""" SELECT cof_name, sup_name FROM coffees JOIN suppliers ON coffees.sup_id = suppliers.sup_id WHERE price < $price """.query[(String, String)] val insertSupplier: Update[Supplier] = Update[Supplier]("INSERT INTO suppliers VALUES (?, ?, ?, ?, ?, ?)", None) val insertCoffee: Update[Coffee] = Update[Coffee]("INSERT INTO coffees VALUES (?, ?, ?, ?, ?)", None) def allCoffees[A]: Query0[Coffee] = sql"SELECT cof_name, sup_id, price, sales, total FROM coffees".query[Coffee] def create: Update0 = sql""" CREATE TABLE suppliers ( sup_id INT NOT NULL PRIMARY KEY, sup_name VARCHAR NOT NULL, street VARCHAR NOT NULL, city VARCHAR NOT NULL, state VARCHAR NOT NULL, zip VARCHAR NOT NULL ); CREATE TABLE coffees ( cof_name VARCHAR NOT NULL, sup_id INT NOT NULL, price DOUBLE NOT NULL, sales INT NOT NULL, total INT NOT NULL ); ALTER TABLE coffees ADD CONSTRAINT coffees_suppliers_fk FOREIGN KEY (sup_id) REFERENCES suppliers(sup_id); """.update } // Lifted println def putStrLn(s: => String): ConnectionIO[Unit] = FC.delay(println(s)) }
{'content_hash': '3590fda785692ee075c01aebbfc507c8', 'timestamp': '', 'source': 'github', 'line_count': 144, 'max_line_length': 108, 'avg_line_length': 32.43055555555556, 'alnum_prop': 0.621627408993576, 'repo_name': 'tpolecat/doobie', 'id': 'f28fb0dc41c028722c355a847e0f9dc4aafde9d8', 'size': '4670', 'binary': False, 'copies': '1', 'ref': 'refs/heads/main', 'path': 'modules/example/src/main/scala/example/FirstExample.scala', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '329'}, {'name': 'Scala', 'bytes': '1148341'}]}
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. package com.cloud.test; import java.io.File; import java.io.IOException; import java.math.BigInteger; import java.net.URISyntaxException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.UUID; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.apache.log4j.Logger; import org.apache.log4j.xml.DOMConfigurator; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; import com.cloud.host.Status; import com.cloud.service.ServiceOfferingVO; import com.cloud.service.dao.ServiceOfferingDaoImpl; import com.cloud.storage.DiskOfferingVO; import com.cloud.storage.dao.DiskOfferingDaoImpl; import com.cloud.utils.PropertiesUtil; import com.cloud.utils.component.ComponentContext; import com.cloud.utils.db.DB; import com.cloud.utils.db.Transaction; import com.cloud.utils.net.NfsUtils; public class DatabaseConfig { private static final Logger s_logger = Logger.getLogger(DatabaseConfig.class.getName()); private String _configFileName = null; private String _currentObjectName = null; private String _currentFieldName = null; private Map<String, String> _currentObjectParams = null; private static Map<String, String> s_configurationDescriptions = new HashMap<String, String>(); private static Map<String, String> s_configurationComponents = new HashMap<String, String>(); private static Map<String, String> s_defaultConfigurationValues = new HashMap<String, String>(); // Change to HashSet private static HashSet<String> objectNames = new HashSet<String>(); private static HashSet<String> fieldNames = new HashSet<String>(); // Maintain an IPRangeConfig object to handle IP related logic private final IPRangeConfig iprc = ComponentContext.inject(IPRangeConfig.class); // Maintain a PodZoneConfig object to handle Pod/Zone related logic private final PodZoneConfig pzc = ComponentContext.inject(PodZoneConfig.class); // Global variables to store network.throttling.rate and multicast.throttling.rate from the configuration table // Will be changed from null to a non-null value if the value existed in the configuration table private String _networkThrottlingRate = null; private String _multicastThrottlingRate = null; static { // initialize the objectNames ArrayList objectNames.add("zone"); objectNames.add("physicalNetwork"); objectNames.add("vlan"); objectNames.add("pod"); objectNames.add("cluster"); objectNames.add("storagePool"); objectNames.add("secondaryStorage"); objectNames.add("serviceOffering"); objectNames.add("diskOffering"); objectNames.add("user"); objectNames.add("pricing"); objectNames.add("configuration"); objectNames.add("privateIpAddresses"); objectNames.add("publicIpAddresses"); objectNames.add("physicalNetworkServiceProvider"); objectNames.add("virtualRouterProvider"); // initialize the fieldNames ArrayList fieldNames.add("id"); fieldNames.add("name"); fieldNames.add("dns1"); fieldNames.add("dns2"); fieldNames.add("internalDns1"); fieldNames.add("internalDns2"); fieldNames.add("guestNetworkCidr"); fieldNames.add("gateway"); fieldNames.add("netmask"); fieldNames.add("vncConsoleIp"); fieldNames.add("zoneId"); fieldNames.add("vlanId"); fieldNames.add("cpu"); fieldNames.add("ramSize"); fieldNames.add("speed"); fieldNames.add("useLocalStorage"); fieldNames.add("hypervisorType"); fieldNames.add("diskSpace"); fieldNames.add("nwRate"); fieldNames.add("mcRate"); fieldNames.add("price"); fieldNames.add("username"); fieldNames.add("password"); fieldNames.add("firstname"); fieldNames.add("lastname"); fieldNames.add("email"); fieldNames.add("priceUnit"); fieldNames.add("type"); fieldNames.add("value"); fieldNames.add("podId"); fieldNames.add("podName"); fieldNames.add("ipAddressRange"); fieldNames.add("vlanType"); fieldNames.add("vlanName"); fieldNames.add("cidr"); fieldNames.add("vnet"); fieldNames.add("mirrored"); fieldNames.add("enableHA"); fieldNames.add("displayText"); fieldNames.add("domainId"); fieldNames.add("hostAddress"); fieldNames.add("hostPath"); fieldNames.add("guestIpType"); fieldNames.add("url"); fieldNames.add("storageType"); fieldNames.add("category"); fieldNames.add("tags"); fieldNames.add("networktype"); fieldNames.add("clusterId"); fieldNames.add("physicalNetworkId"); fieldNames.add("destPhysicalNetworkId"); fieldNames.add("providerName"); fieldNames.add("vpn"); fieldNames.add("dhcp"); fieldNames.add("dns"); fieldNames.add("firewall"); fieldNames.add("sourceNat"); fieldNames.add("loadBalance"); fieldNames.add("staticNat"); fieldNames.add("portForwarding"); fieldNames.add("userData"); fieldNames.add("securityGroup"); fieldNames.add("nspId"); s_configurationDescriptions.put("host.stats.interval", "the interval in milliseconds when host stats are retrieved from agents"); s_configurationDescriptions.put("storage.stats.interval", "the interval in milliseconds when storage stats (per host) are retrieved from agents"); s_configurationDescriptions.put("volume.stats.interval", "the interval in milliseconds when volume stats are retrieved from agents"); s_configurationDescriptions.put("host", "host address to listen on for agent connection"); s_configurationDescriptions.put("port", "port to listen on for agent connection"); s_configurationDescriptions.put("guest.domain.suffix", "domain suffix for users"); s_configurationDescriptions.put("instance.name", "Name of the deployment instance"); s_configurationDescriptions.put("storage.overprovisioning.factor", "Storage Allocator overprovisioning factor"); s_configurationDescriptions.put("retries.per.host", "The number of times each command sent to a host should be retried in case of failure."); s_configurationDescriptions.put("integration.api.port", "internal port used by the management server for servicing Integration API requests"); s_configurationDescriptions.put("usage.stats.job.exec.time", "the time at which the usage statistics aggregation job will run as an HH24:MM time, e.g. 00:30 to run at 12:30am"); s_configurationDescriptions.put("usage.stats.job.aggregation.range", "the range of time for aggregating the user statistics specified in minutes (e.g. 1440 for daily, 60 for hourly)"); s_configurationDescriptions.put("consoleproxy.domP.enable", "Obsolete"); s_configurationDescriptions.put("consoleproxy.port", "Obsolete"); s_configurationDescriptions.put("consoleproxy.url.port", "Console proxy port for AJAX viewer"); s_configurationDescriptions.put("consoleproxy.ram.size", "RAM size (in MB) used to create new console proxy VMs"); s_configurationDescriptions.put("consoleproxy.cmd.port", "Console proxy command port that is used to communicate with management server"); s_configurationDescriptions.put("consoleproxy.loadscan.interval", "The time interval(in milliseconds) to scan console proxy working-load info"); s_configurationDescriptions.put("consoleproxy.capacityscan.interval", "The time interval(in millisecond) to scan whether or not system needs more console proxy to ensure minimal standby capacity"); s_configurationDescriptions.put("consoleproxy.capacity.standby", "The minimal number of console proxy viewer sessions that system is able to serve immediately(standby capacity)"); s_configurationDescriptions.put("alert.email.addresses", "comma seperated list of email addresses used for sending alerts"); s_configurationDescriptions.put("alert.smtp.host", "SMTP hostname used for sending out email alerts"); s_configurationDescriptions.put("alert.smtp.port", "port the SMTP server is listening on (default is 25)"); s_configurationDescriptions.put("alert.smtp.useAuth", "If true, use SMTP authentication when sending emails. If false, do not use SMTP authentication when sending emails."); s_configurationDescriptions.put("alert.smtp.username", "username for SMTP authentication (applies only if alert.smtp.useAuth is true)"); s_configurationDescriptions.put("alert.smtp.password", "password for SMTP authentication (applies only if alert.smtp.useAuth is true)"); s_configurationDescriptions.put("alert.email.sender", "sender of alert email (will be in the From header of the email)"); s_configurationDescriptions.put("memory.capacity.threshold", "percentage (as a value between 0 and 1) of memory utilization above which alerts will be sent about low memory available"); s_configurationDescriptions.put("cpu.capacity.threshold", "percentage (as a value between 0 and 1) of cpu utilization above which alerts will be sent about low cpu available"); s_configurationDescriptions.put("storage.capacity.threshold", "percentage (as a value between 0 and 1) of storage utilization above which alerts will be sent about low storage available"); s_configurationDescriptions.put("public.ip.capacity.threshold", "percentage (as a value between 0 and 1) of public IP address space utilization above which alerts will be sent"); s_configurationDescriptions.put("private.ip.capacity.threshold", "percentage (as a value between 0 and 1) of private IP address space utilization above which alerts will be sent"); s_configurationDescriptions.put("expunge.interval", "the interval to wait before running the expunge thread"); s_configurationDescriptions.put("network.throttling.rate", "default data transfer rate in megabits per second allowed per user"); s_configurationDescriptions.put("multicast.throttling.rate", "default multicast rate in megabits per second allowed"); s_configurationDescriptions.put("system.vm.use.local.storage", "Indicates whether to use local storage pools or shared storage pools for system VMs."); s_configurationDescriptions.put("snapshot.poll.interval", "The time interval in seconds when the management server polls for snapshots to be scheduled."); s_configurationDescriptions.put("snapshot.max.hourly", "Maximum hourly snapshots for a volume"); s_configurationDescriptions.put("snapshot.max.daily", "Maximum daily snapshots for a volume"); s_configurationDescriptions.put("snapshot.max.weekly", "Maximum weekly snapshots for a volume"); s_configurationDescriptions.put("snapshot.max.monthly", "Maximum monthly snapshots for a volume"); s_configurationDescriptions.put("snapshot.delta.max", "max delta snapshots between two full snapshots."); s_configurationDescriptions.put("snapshot.recurring.test", "Flag for testing recurring snapshots"); s_configurationDescriptions.put("snapshot.test.minutes.per.hour", "Set it to a smaller value to take more recurring snapshots"); s_configurationDescriptions.put("snapshot.test.hours.per.day", "Set it to a smaller value to take more recurring snapshots"); s_configurationDescriptions.put("snapshot.test.days.per.week", "Set it to a smaller value to take more recurring snapshots"); s_configurationDescriptions.put("snapshot.test.days.per.month", "Set it to a smaller value to take more recurring snapshots"); s_configurationDescriptions.put("snapshot.test.weeks.per.month", "Set it to a smaller value to take more recurring snapshots"); s_configurationDescriptions.put("snapshot.test.months.per.year", "Set it to a smaller value to take more recurring snapshots"); s_configurationDescriptions.put("hypervisor.type", "The type of hypervisor that this deployment will use."); s_configurationComponents.put("host.stats.interval", "management-server"); s_configurationComponents.put("storage.stats.interval", "management-server"); s_configurationComponents.put("volume.stats.interval", "management-server"); s_configurationComponents.put("integration.api.port", "management-server"); s_configurationComponents.put("usage.stats.job.exec.time", "management-server"); s_configurationComponents.put("usage.stats.job.aggregation.range", "management-server"); s_configurationComponents.put("consoleproxy.domP.enable", "management-server"); s_configurationComponents.put("consoleproxy.port", "management-server"); s_configurationComponents.put("consoleproxy.url.port", "management-server"); s_configurationComponents.put("alert.email.addresses", "management-server"); s_configurationComponents.put("alert.smtp.host", "management-server"); s_configurationComponents.put("alert.smtp.port", "management-server"); s_configurationComponents.put("alert.smtp.useAuth", "management-server"); s_configurationComponents.put("alert.smtp.username", "management-server"); s_configurationComponents.put("alert.smtp.password", "management-server"); s_configurationComponents.put("alert.email.sender", "management-server"); s_configurationComponents.put("memory.capacity.threshold", "management-server"); s_configurationComponents.put("cpu.capacity.threshold", "management-server"); s_configurationComponents.put("storage.capacity.threshold", "management-server"); s_configurationComponents.put("public.ip.capacity.threshold", "management-server"); s_configurationComponents.put("private.ip.capacity.threshold", "management-server"); s_configurationComponents.put("capacity.check.period", "management-server"); s_configurationComponents.put("network.throttling.rate", "management-server"); s_configurationComponents.put("multicast.throttling.rate", "management-server"); s_configurationComponents.put("event.purge.interval", "management-server"); s_configurationComponents.put("account.cleanup.interval", "management-server"); s_configurationComponents.put("expunge.delay", "UserVmManager"); s_configurationComponents.put("expunge.interval", "UserVmManager"); s_configurationComponents.put("host", "AgentManager"); s_configurationComponents.put("port", "AgentManager"); s_configurationComponents.put("domain", "AgentManager"); s_configurationComponents.put("instance.name", "AgentManager"); s_configurationComponents.put("storage.overprovisioning.factor", "StorageAllocator"); s_configurationComponents.put("retries.per.host", "AgentManager"); s_configurationComponents.put("start.retry", "AgentManager"); s_configurationComponents.put("wait", "AgentManager"); s_configurationComponents.put("ping.timeout", "AgentManager"); s_configurationComponents.put("ping.interval", "AgentManager"); s_configurationComponents.put("alert.wait", "AgentManager"); s_configurationComponents.put("update.wait", "AgentManager"); s_configurationComponents.put("guest.domain.suffix", "AgentManager"); s_configurationComponents.put("consoleproxy.ram.size", "AgentManager"); s_configurationComponents.put("consoleproxy.cmd.port", "AgentManager"); s_configurationComponents.put("consoleproxy.loadscan.interval", "AgentManager"); s_configurationComponents.put("consoleproxy.capacityscan.interval", "AgentManager"); s_configurationComponents.put("consoleproxy.capacity.standby", "AgentManager"); s_configurationComponents.put("consoleproxy.session.max", "AgentManager"); s_configurationComponents.put("consoleproxy.session.timeout", "AgentManager"); s_configurationComponents.put("expunge.workers", "UserVmManager"); s_configurationComponents.put("extract.url.cleanup.interval", "management-server"); s_configurationComponents.put("stop.retry.interval", "HighAvailabilityManager"); s_configurationComponents.put("restart.retry.interval", "HighAvailabilityManager"); s_configurationComponents.put("investigate.retry.interval", "HighAvailabilityManager"); s_configurationComponents.put("migrate.retry.interval", "HighAvailabilityManager"); s_configurationComponents.put("storage.overwrite.provisioning", "UserVmManager"); s_configurationComponents.put("init", "none"); s_configurationComponents.put("system.vm.use.local.storage", "ManagementServer"); s_configurationComponents.put("snapshot.poll.interval", "SnapshotManager"); s_configurationComponents.put("snapshot.max.hourly", "SnapshotManager"); s_configurationComponents.put("snapshot.max.daily", "SnapshotManager"); s_configurationComponents.put("snapshot.max.weekly", "SnapshotManager"); s_configurationComponents.put("snapshot.max.monthly", "SnapshotManager"); s_configurationComponents.put("snapshot.delta.max", "SnapshotManager"); s_configurationComponents.put("snapshot.recurring.test", "SnapshotManager"); s_configurationComponents.put("snapshot.test.minutes.per.hour", "SnapshotManager"); s_configurationComponents.put("snapshot.test.hours.per.day", "SnapshotManager"); s_configurationComponents.put("snapshot.test.days.per.week", "SnapshotManager"); s_configurationComponents.put("snapshot.test.days.per.month", "SnapshotManager"); s_configurationComponents.put("snapshot.test.weeks.per.month", "SnapshotManager"); s_configurationComponents.put("snapshot.test.months.per.year", "SnapshotManager"); s_configurationComponents.put("hypervisor.type", "ManagementServer"); s_defaultConfigurationValues.put("host.stats.interval", "60000"); s_defaultConfigurationValues.put("storage.stats.interval", "60000"); //s_defaultConfigurationValues.put("volume.stats.interval", "-1"); s_defaultConfigurationValues.put("port", "8250"); s_defaultConfigurationValues.put("integration.api.port", "8096"); s_defaultConfigurationValues.put("usage.stats.job.exec.time", "00:15"); // run at 12:15am s_defaultConfigurationValues.put("usage.stats.job.aggregation.range", "1440"); // do a daily aggregation s_defaultConfigurationValues.put("storage.overprovisioning.factor", "2"); s_defaultConfigurationValues.put("retries.per.host", "2"); s_defaultConfigurationValues.put("ping.timeout", "2.5"); s_defaultConfigurationValues.put("ping.interval", "60"); s_defaultConfigurationValues.put("snapshot.poll.interval", "300"); s_defaultConfigurationValues.put("snapshot.max.hourly", "8"); s_defaultConfigurationValues.put("snapshot.max.daily", "8"); s_defaultConfigurationValues.put("snapshot.max.weekly", "8"); s_defaultConfigurationValues.put("snapshot.max.monthly", "8"); s_defaultConfigurationValues.put("snapshot.delta.max", "16"); s_defaultConfigurationValues.put("snapshot.recurring.test", "false"); s_defaultConfigurationValues.put("snapshot.test.minutes.per.hour", "60"); s_defaultConfigurationValues.put("snapshot.test.hours.per.day", "24"); s_defaultConfigurationValues.put("snapshot.test.days.per.week", "7"); s_defaultConfigurationValues.put("snapshot.test.days.per.month", "30"); s_defaultConfigurationValues.put("snapshot.test.weeks.per.month", "4"); s_defaultConfigurationValues.put("snapshot.test.months.per.year", "12"); s_defaultConfigurationValues.put("alert.wait", "1800"); s_defaultConfigurationValues.put("update.wait", "600"); s_defaultConfigurationValues.put("expunge.interval", "86400"); s_defaultConfigurationValues.put("extract.url.cleanup.interval", "120"); s_defaultConfigurationValues.put("instance.name", "VM"); s_defaultConfigurationValues.put("expunge.workers", "1"); s_defaultConfigurationValues.put("stop.retry.interval", "600"); s_defaultConfigurationValues.put("restart.retry.interval", "600"); s_defaultConfigurationValues.put("investigate.retry.interval", "60"); s_defaultConfigurationValues.put("migrate.retry.interval", "120"); s_defaultConfigurationValues.put("event.purge.interval", "86400"); s_defaultConfigurationValues.put("account.cleanup.interval", "86400"); s_defaultConfigurationValues.put("system.vm.use.local.storage", "false"); s_defaultConfigurationValues.put("init", "false"); s_defaultConfigurationValues.put("cpu.overprovisioning.factor", "1"); s_defaultConfigurationValues.put("mem.overprovisioning.factor", "1"); } protected DatabaseConfig() { } /** * @param args - name of server-setup.xml file which contains the bootstrap data */ public static void main(String[] args) { System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"); System.setProperty("javax.xml.parsers.SAXParserFactory", "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"); File file = PropertiesUtil.findConfigFile("log4j-cloud.xml"); if(file != null) { System.out.println("Log4j configuration from : " + file.getAbsolutePath()); DOMConfigurator.configureAndWatch(file.getAbsolutePath(), 10000); } else { System.out.println("Configure log4j with default properties"); } if (args.length < 1) { s_logger.error("error starting database config, missing initial data file"); } else { try { DatabaseConfig config = ComponentContext.inject(DatabaseConfig.class); config.doVersionCheck(); config.doConfig(); System.exit(0); } catch (Exception ex) { System.out.print("Error Caught"); ex.printStackTrace(); s_logger.error("error", ex); } } } public DatabaseConfig(String configFileName) { _configFileName = configFileName; } private void doVersionCheck() { try { String warningMsg = "\nYou are using an outdated format for server-setup.xml. Please switch to the new format.\n"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder dbuilder = dbf.newDocumentBuilder(); File configFile = new File(_configFileName); Document d = dbuilder.parse(configFile); NodeList nodeList = d.getElementsByTagName("version"); if (nodeList.getLength() == 0) { System.out.println(warningMsg); return; } Node firstNode = nodeList.item(0); String version = firstNode.getTextContent(); if (!version.equals("2.0")) { System.out.println(warningMsg); } } catch (ParserConfigurationException parserException) { parserException.printStackTrace(); } catch (IOException ioException) { ioException.printStackTrace(); } catch (SAXException saxException) { saxException.printStackTrace(); } } @DB protected void doConfig() { Transaction txn = Transaction.currentTxn(); try { File configFile = new File(_configFileName); SAXParserFactory spfactory = SAXParserFactory.newInstance(); SAXParser saxParser = spfactory.newSAXParser(); DbConfigXMLHandler handler = new DbConfigXMLHandler(); handler.setParent(this); txn.start(); // Save user configured values for all fields saxParser.parse(configFile, handler); // Save default values for configuration fields saveVMTemplate(); saveRootDomain(); saveDefaultConfiguations(); txn.commit(); // Check pod CIDRs against each other, and against the guest ip network/netmask pzc.checkAllPodCidrSubnets(); } catch (Exception ex) { System.out.print("ERROR IS"+ex); s_logger.error("error", ex); txn.rollback(); } } private void setCurrentObjectName(String name) { _currentObjectName = name; } private void saveCurrentObject() { if ("zone".equals(_currentObjectName)) { saveZone(); } else if ("physicalNetwork".equals(_currentObjectName)) { savePhysicalNetwork(); } else if ("vlan".equals(_currentObjectName)) { saveVlan(); } else if ("pod".equals(_currentObjectName)) { savePod(); } else if ("serviceOffering".equals(_currentObjectName)) { saveServiceOffering(); } else if ("diskOffering".equals(_currentObjectName)) { saveDiskOffering(); } else if ("user".equals(_currentObjectName)) { saveUser(); } else if ("configuration".equals(_currentObjectName)) { saveConfiguration(); } else if ("storagePool".equals(_currentObjectName)) { saveStoragePool(); } else if ("secondaryStorage".equals(_currentObjectName)) { saveSecondaryStorage(); } else if ("cluster".equals(_currentObjectName)) { saveCluster(); } else if ("physicalNetworkServiceProvider".equals(_currentObjectName)) { savePhysicalNetworkServiceProvider(); } else if ("virtualRouterProvider".equals(_currentObjectName)) { saveVirtualRouterProvider(); } _currentObjectParams = null; } @DB public void saveSecondaryStorage() { long dataCenterId = Long.parseLong(_currentObjectParams.get("zoneId")); String url = _currentObjectParams.get("url"); String mountPoint; try { mountPoint = NfsUtils.url2Mount(url); } catch (URISyntaxException e1) { return; } String insertSql1 = "INSERT INTO `host` (`id`, `name`, `status` , `type` , `private_ip_address`, `private_netmask` ,`private_mac_address` , `storage_ip_address` ,`storage_netmask`, `storage_mac_address`, `data_center_id`, `version`, `dom0_memory`, `last_ping`, `resource`, `guid`, `hypervisor_type`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; String insertSqlHostDetails = "INSERT INTO `host_details` (`id`, `host_id`, `name`, `value`) VALUES(?,?,?,?)"; String insertSql2 = "INSERT INTO `op_host` (`id`, `sequence`) VALUES(?, ?)"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql1); stmt.setLong(1, 0); stmt.setString(2, url); stmt.setString(3, "UP"); stmt.setString(4, "SecondaryStorage"); stmt.setString(5, "192.168.122.1"); stmt.setString(6, "255.255.255.0"); stmt.setString(7, "92:ff:f5:ad:23:e1"); stmt.setString(8, "192.168.122.1"); stmt.setString(9, "255.255.255.0"); stmt.setString(10, "92:ff:f5:ad:23:e1"); stmt.setLong(11, dataCenterId); stmt.setString(12, "2.2.4"); stmt.setLong(13, 0); stmt.setLong(14, 1238425896); boolean nfs = false; if (url.startsWith("nfs")) { nfs = true; } if (nfs) { stmt.setString(15, "com.cloud.storage.resource.NfsSecondaryStorageResource"); } else { stmt.setString(15, "com.cloud.storage.secondary.LocalSecondaryStorageResource"); } stmt.setString(16, url); stmt.setString(17, "None"); stmt.executeUpdate(); stmt = txn.prepareAutoCloseStatement(insertSqlHostDetails); stmt.setLong(1, 1); stmt.setLong(2, 1); stmt.setString(3, "mount.parent"); if (nfs) { stmt.setString(4, "/mnt"); } else { stmt.setString(4, "/"); } stmt.executeUpdate(); stmt.setLong(1, 2); stmt.setLong(2, 1); stmt.setString(3, "mount.path"); if (nfs) { stmt.setString(4, mountPoint); } else { stmt.setString(4, url.replaceFirst("file:/", "")); } stmt.executeUpdate(); stmt.setLong(1, 3); stmt.setLong(2, 1); stmt.setString(3, "orig.url"); stmt.setString(4, url); stmt.executeUpdate(); stmt = txn.prepareAutoCloseStatement(insertSql2); stmt.setLong(1, 1); stmt.setLong(2, 1); stmt.executeUpdate(); } catch (SQLException ex) { System.out.println("Error creating secondary storage: " + ex.getMessage()); return; } } @DB public void saveCluster() { String name = _currentObjectParams.get("name"); long id = Long.parseLong(_currentObjectParams.get("id")); long dataCenterId = Long.parseLong(_currentObjectParams.get("zoneId")); long podId = Long.parseLong(_currentObjectParams.get("podId")); String hypervisor = _currentObjectParams.get("hypervisorType"); String insertSql1 = "INSERT INTO `cluster` (`id`, `name`, `data_center_id` , `pod_id`, `hypervisor_type` , `cluster_type`, `allocation_state`) VALUES (?,?,?,?,?,?,?)"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql1); stmt.setLong(1, id); stmt.setString(2, name); stmt.setLong(3, dataCenterId); stmt.setLong(4, podId); stmt.setString(5, hypervisor); stmt.setString(6, "CloudManaged"); stmt.setString(7, "Enabled"); stmt.executeUpdate(); } catch (SQLException ex) { System.out.println("Error creating cluster: " + ex.getMessage()); s_logger.error("error creating cluster", ex); return; } } @DB public void saveStoragePool() { String name = _currentObjectParams.get("name"); long id = Long.parseLong(_currentObjectParams.get("id")); long dataCenterId = Long.parseLong(_currentObjectParams.get("zoneId")); long podId = Long.parseLong(_currentObjectParams.get("podId")); long clusterId = Long.parseLong(_currentObjectParams.get("clusterId")); String hostAddress = _currentObjectParams.get("hostAddress"); String hostPath = _currentObjectParams.get("hostPath"); String storageType = _currentObjectParams.get("storageType"); String uuid = UUID.nameUUIDFromBytes(new String(hostAddress+hostPath).getBytes()).toString(); String insertSql1 = "INSERT INTO `storage_pool` (`id`, `name`, `uuid` , `pool_type` , `port`, `data_center_id` ,`available_bytes` , `capacity_bytes` ,`host_address`, `path`, `created`, `pod_id`,`status` , `cluster_id`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; // String insertSql2 = "INSERT INTO `netfs_storage_pool` VALUES (?,?,?)"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql1); stmt.setLong(1, id); stmt.setString(2, name); stmt.setString(3, uuid); if (storageType == null) { stmt.setString(4, "NetworkFileSystem"); } else { stmt.setString(4, storageType); } stmt.setLong(5, 111); stmt.setLong(6, dataCenterId); stmt.setLong(7,0); stmt.setLong(8,0); stmt.setString(9, hostAddress); stmt.setString(10, hostPath); stmt.setDate(11, new Date(new java.util.Date().getTime())); stmt.setLong(12, podId); stmt.setString(13, Status.Up.toString()); stmt.setLong(14, clusterId); stmt.executeUpdate(); } catch (SQLException ex) { System.out.println("Error creating storage pool: " + ex.getMessage()); s_logger.error("error creating storage pool ", ex); return; } } private void saveZone() { long id = Long.parseLong(_currentObjectParams.get("id")); String name = _currentObjectParams.get("name"); //String description = _currentObjectParams.get("description"); String dns1 = _currentObjectParams.get("dns1"); String dns2 = _currentObjectParams.get("dns2"); String internalDns1 = _currentObjectParams.get("internalDns1"); String internalDns2 = _currentObjectParams.get("internalDns2"); //String vnetRange = _currentObjectParams.get("vnet"); String guestNetworkCidr = _currentObjectParams.get("guestNetworkCidr"); String networkType = _currentObjectParams.get("networktype"); // Check that all IPs are valid String ipError = "Please enter a valid IP address for the field: "; if (!IPRangeConfig.validOrBlankIP(dns1)) { printError(ipError + "dns1"); } if (!IPRangeConfig.validOrBlankIP(dns2)) { printError(ipError + "dns2"); } if (!IPRangeConfig.validOrBlankIP(internalDns1)) { printError(ipError + "internalDns1"); } if (!IPRangeConfig.validOrBlankIP(internalDns2)) { printError(ipError + "internalDns2"); } if (!IPRangeConfig.validCIDR(guestNetworkCidr)) { printError("Please enter a valid value for guestNetworkCidr"); } pzc.saveZone(false, id, name, dns1, dns2, internalDns1, internalDns2, guestNetworkCidr, networkType); } private void savePhysicalNetwork() { long id = Long.parseLong(_currentObjectParams.get("id")); String zoneId = _currentObjectParams.get("zoneId"); String vnetRange = _currentObjectParams.get("vnet"); int vnetStart = -1; int vnetEnd = -1; if (vnetRange != null) { String[] tokens = vnetRange.split("-"); vnetStart = Integer.parseInt(tokens[0]); vnetEnd = Integer.parseInt(tokens[1]); } long zoneDbId = Long.parseLong(zoneId); pzc.savePhysicalNetwork(false, id, zoneDbId, vnetStart, vnetEnd); } private void savePhysicalNetworkServiceProvider() { long id = Long.parseLong(_currentObjectParams.get("id")); long physicalNetworkId = Long.parseLong(_currentObjectParams.get("physicalNetworkId")); String providerName = _currentObjectParams.get("providerName"); long destPhysicalNetworkId = Long.parseLong(_currentObjectParams.get("destPhysicalNetworkId")); String uuid = UUID.randomUUID().toString(); int vpn = Integer.parseInt(_currentObjectParams.get("vpn")); int dhcp = Integer.parseInt(_currentObjectParams.get("dhcp")); int dns = Integer.parseInt(_currentObjectParams.get("dns")); int gateway = Integer.parseInt(_currentObjectParams.get("gateway")); int firewall = Integer.parseInt(_currentObjectParams.get("firewall")); int sourceNat = Integer.parseInt(_currentObjectParams.get("sourceNat")); int lb = Integer.parseInt(_currentObjectParams.get("loadBalance")); int staticNat = Integer.parseInt(_currentObjectParams.get("staticNat")); int pf =Integer.parseInt(_currentObjectParams.get("portForwarding")); int userData =Integer.parseInt(_currentObjectParams.get("userData")); int securityGroup =Integer.parseInt(_currentObjectParams.get("securityGroup")); String insertSql1 = "INSERT INTO `physical_network_service_providers` (`id`, `uuid`, `physical_network_id` , `provider_name`, `state` ," + "`destination_physical_network_id`, `vpn_service_provided`, `dhcp_service_provided`, `dns_service_provided`, `gateway_service_provided`," + "`firewall_service_provided`, `source_nat_service_provided`, `load_balance_service_provided`, `static_nat_service_provided`," + "`port_forwarding_service_provided`, `user_data_service_provided`, `security_group_service_provided`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql1); stmt.setLong(1, id); stmt.setString(2, uuid); stmt.setLong(3, physicalNetworkId); stmt.setString(4, providerName); stmt.setString(5, "Enabled"); stmt.setLong(6, destPhysicalNetworkId); stmt.setInt(7, vpn); stmt.setInt(8, dhcp); stmt.setInt(9, dns); stmt.setInt(10, gateway); stmt.setInt(11, firewall); stmt.setInt(12, sourceNat); stmt.setInt(13, lb); stmt.setInt(14, staticNat); stmt.setInt(15, pf); stmt.setInt(16, userData); stmt.setInt(17, securityGroup); stmt.executeUpdate(); } catch (SQLException ex) { System.out.println("Error creating physical network service provider: " + ex.getMessage()); s_logger.error("error creating physical network service provider", ex); return; } } private void saveVirtualRouterProvider() { long id = Long.parseLong(_currentObjectParams.get("id")); long nspId = Long.parseLong(_currentObjectParams.get("nspId")); String uuid = UUID.randomUUID().toString(); String type = _currentObjectParams.get("type"); String insertSql1 = "INSERT INTO `virtual_router_providers` (`id`, `nsp_id`, `uuid` , `type` , `enabled`) " + "VALUES (?,?,?,?,?)"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql1); stmt.setLong(1, id); stmt.setLong(2, nspId); stmt.setString(3, uuid); stmt.setString(4, type); stmt.setInt(5, 1); stmt.executeUpdate(); } catch (SQLException ex) { System.out.println("Error creating virtual router provider: " + ex.getMessage()); s_logger.error("error creating virtual router provider ", ex); return; } } private void saveVlan() { String zoneId = _currentObjectParams.get("zoneId"); String physicalNetworkIdStr = _currentObjectParams.get("physicalNetworkId"); String vlanId = _currentObjectParams.get("vlanId"); String gateway = _currentObjectParams.get("gateway"); String netmask = _currentObjectParams.get("netmask"); String publicIpRange = _currentObjectParams.get("ipAddressRange"); String vlanType = _currentObjectParams.get("vlanType"); String vlanPodName = _currentObjectParams.get("podName"); String ipError = "Please enter a valid IP address for the field: "; if (!IPRangeConfig.validOrBlankIP(gateway)) { printError(ipError + "gateway"); } if (!IPRangeConfig.validOrBlankIP(netmask)) { printError(ipError + "netmask"); } // Check that the given IP address range was valid if (!checkIpAddressRange(publicIpRange)) { printError("Please enter a valid public IP range."); } // Split the IP address range String[] ipAddressRangeArray = publicIpRange.split("\\-"); String startIP = ipAddressRangeArray[0]; String endIP = null; if (ipAddressRangeArray.length > 1) { endIP = ipAddressRangeArray[1]; } // If a netmask was provided, check that the startIP, endIP, and gateway all belong to the same subnet if (netmask != null && !netmask.equals("")) { if (endIP != null) { if (!IPRangeConfig.sameSubnet(startIP, endIP, netmask)) { printError("Start and end IPs for the public IP range must be in the same subnet, as per the provided netmask."); } } if (gateway != null && !gateway.equals("")) { if (!IPRangeConfig.sameSubnet(startIP, gateway, netmask)) { printError("The start IP for the public IP range must be in the same subnet as the gateway, as per the provided netmask."); } if (endIP != null) { if (!IPRangeConfig.sameSubnet(endIP, gateway, netmask)) { printError("The end IP for the public IP range must be in the same subnet as the gateway, as per the provided netmask."); } } } } long zoneDbId = Long.parseLong(zoneId); String zoneName = PodZoneConfig.getZoneName(zoneDbId); long physicalNetworkId = Long.parseLong(physicalNetworkIdStr); //Set networkId to be 0, the value will be updated after management server starts up pzc.modifyVlan(zoneName, true, vlanId, gateway, netmask, vlanPodName, vlanType, publicIpRange, 0, physicalNetworkId); long vlanDbId = pzc.getVlanDbId(zoneName, vlanId); iprc.saveIPRange("public", -1, zoneDbId, vlanDbId, startIP, endIP, null, physicalNetworkId); } private void savePod() { long id = Long.parseLong(_currentObjectParams.get("id")); String name = _currentObjectParams.get("name"); long dataCenterId = Long.parseLong(_currentObjectParams.get("zoneId")); String privateIpRange = _currentObjectParams.get("ipAddressRange"); String gateway = _currentObjectParams.get("gateway"); String cidr = _currentObjectParams.get("cidr"); String zoneName = PodZoneConfig.getZoneName(dataCenterId); String startIP = null; String endIP = null; String vlanRange = _currentObjectParams.get("vnet"); int vlanStart = -1; int vlanEnd = -1; if (vlanRange != null) { String[] tokens = vlanRange.split("-"); vlanStart = Integer.parseInt(tokens[0]); vlanEnd = Integer.parseInt(tokens[1]); } // Get the individual cidrAddress and cidrSize values String[] cidrPair = cidr.split("\\/"); String cidrAddress = cidrPair[0]; String cidrSize = cidrPair[1]; long cidrSizeNum = Long.parseLong(cidrSize); // Check that the gateway is in the same subnet as the CIDR if (!IPRangeConfig.sameSubnetCIDR(gateway, cidrAddress, cidrSizeNum)) { printError("For pod " + name + " in zone " + zoneName + " , please ensure that your gateway is in the same subnet as the pod's CIDR address."); } pzc.savePod(false, id, name, dataCenterId, gateway, cidr, vlanStart, vlanEnd); if (privateIpRange != null) { // Check that the given IP address range was valid if (!checkIpAddressRange(privateIpRange)) { printError("Please enter a valid private IP range."); } String[] ipAddressRangeArray = privateIpRange.split("\\-"); startIP = ipAddressRangeArray[0]; endIP = null; if (ipAddressRangeArray.length > 1) { endIP = ipAddressRangeArray[1]; } } // Check that the start IP and end IP match up with the CIDR if (!IPRangeConfig.sameSubnetCIDR(startIP, endIP, cidrSizeNum)) { printError("For pod " + name + " in zone " + zoneName + ", please ensure that your start IP and end IP are in the same subnet, as per the pod's CIDR size."); } if (!IPRangeConfig.sameSubnetCIDR(startIP, cidrAddress, cidrSizeNum)) { printError("For pod " + name + " in zone " + zoneName + ", please ensure that your start IP is in the same subnet as the pod's CIDR address."); } if (!IPRangeConfig.sameSubnetCIDR(endIP, cidrAddress, cidrSizeNum)) { printError("For pod " + name + " in zone " + zoneName + ", please ensure that your end IP is in the same subnet as the pod's CIDR address."); } if (privateIpRange != null) { // Save the IP address range iprc.saveIPRange("private", id, dataCenterId, -1, startIP, endIP, null, -1); } } @DB protected void saveServiceOffering() { long id = Long.parseLong(_currentObjectParams.get("id")); String name = _currentObjectParams.get("name"); String displayText = _currentObjectParams.get("displayText"); int cpu = Integer.parseInt(_currentObjectParams.get("cpu")); int ramSize = Integer.parseInt(_currentObjectParams.get("ramSize")); int speed = Integer.parseInt(_currentObjectParams.get("speed")); String useLocalStorageValue = _currentObjectParams.get("useLocalStorage"); // int nwRate = Integer.parseInt(_currentObjectParams.get("nwRate")); // int mcRate = Integer.parseInt(_currentObjectParams.get("mcRate")); boolean ha = Boolean.parseBoolean(_currentObjectParams.get("enableHA")); boolean mirroring = Boolean.parseBoolean(_currentObjectParams.get("mirrored")); boolean useLocalStorage; if (useLocalStorageValue != null) { if (Boolean.parseBoolean(useLocalStorageValue)) { useLocalStorage = true; } else { useLocalStorage = false; } } else { useLocalStorage = false; } ServiceOfferingVO serviceOffering = new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, ha, displayText, useLocalStorage, false, null, false, null, false); Long bytesReadRate = Long.parseLong(_currentObjectParams.get("bytesReadRate")); if ((bytesReadRate != null) && (bytesReadRate > 0)) serviceOffering.setBytesReadRate(bytesReadRate); Long bytesWriteRate = Long.parseLong(_currentObjectParams.get("bytesWriteRate")); if ((bytesWriteRate != null) && (bytesWriteRate > 0)) serviceOffering.setBytesWriteRate(bytesWriteRate); Long iopsReadRate = Long.parseLong(_currentObjectParams.get("iopsReadRate")); if ((iopsReadRate != null) && (iopsReadRate > 0)) serviceOffering.setIopsReadRate(iopsReadRate); Long iopsWriteRate = Long.parseLong(_currentObjectParams.get("iopsWriteRate")); if ((iopsWriteRate != null) && (iopsWriteRate > 0)) serviceOffering.setIopsWriteRate(iopsWriteRate); ServiceOfferingDaoImpl dao = ComponentContext.inject(ServiceOfferingDaoImpl.class); try { dao.persist(serviceOffering); } catch (Exception e) { s_logger.error("error creating service offering", e); } /* String insertSql = "INSERT INTO `cloud`.`service_offering` (id, name, cpu, ram_size, speed, nw_rate, mc_rate, created, ha_enabled, mirrored, display_text, guest_ip_type, use_local_storage) " + "VALUES (" + id + ",'" + name + "'," + cpu + "," + ramSize + "," + speed + "," + nwRate + "," + mcRate + ",now()," + ha + "," + mirroring + ",'" + displayText + "','" + guestIpType + "','" + useLocalStorage + "')"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); stmt.executeUpdate(); } catch (SQLException ex) { s_logger.error("error creating service offering", ex); return; } */ } @DB protected void saveDiskOffering() { long id = Long.parseLong(_currentObjectParams.get("id")); long domainId = Long.parseLong(_currentObjectParams.get("domainId")); String name = _currentObjectParams.get("name"); String displayText = _currentObjectParams.get("displayText"); long diskSpace = Long.parseLong(_currentObjectParams.get("diskSpace")); diskSpace = diskSpace * 1024 * 1024; // boolean mirroring = Boolean.parseBoolean(_currentObjectParams.get("mirrored")); String tags = _currentObjectParams.get("tags"); String useLocal = _currentObjectParams.get("useLocal"); boolean local = false; if (useLocal != null) { local = Boolean.parseBoolean(useLocal); } if (tags != null && tags.length() > 0) { String[] tokens = tags.split(","); StringBuilder newTags = new StringBuilder(); for (String token : tokens) { newTags.append(token.trim()).append(","); } newTags.delete(newTags.length() - 1, newTags.length()); tags = newTags.toString(); } DiskOfferingVO diskOffering = new DiskOfferingVO(domainId, name, displayText, diskSpace, tags, false, null, null, null); diskOffering.setUseLocalStorage(local); Long bytesReadRate = Long.parseLong(_currentObjectParams.get("bytesReadRate")); if (bytesReadRate != null && (bytesReadRate > 0)) diskOffering.setBytesReadRate(bytesReadRate); Long bytesWriteRate = Long.parseLong(_currentObjectParams.get("bytesWriteRate")); if (bytesWriteRate != null && (bytesWriteRate > 0)) diskOffering.setBytesWriteRate(bytesWriteRate); Long iopsReadRate = Long.parseLong(_currentObjectParams.get("iopsReadRate")); if (iopsReadRate != null && (iopsReadRate > 0)) diskOffering.setIopsReadRate(iopsReadRate); Long iopsWriteRate = Long.parseLong(_currentObjectParams.get("iopsWriteRate")); if (iopsWriteRate != null && (iopsWriteRate > 0)) diskOffering.setIopsWriteRate(iopsWriteRate); DiskOfferingDaoImpl offering = ComponentContext.inject(DiskOfferingDaoImpl.class); try { offering.persist(diskOffering); } catch (Exception e) { s_logger.error("error creating disk offering", e); } /* String insertSql = "INSERT INTO `cloud`.`disk_offering` (id, domain_id, name, display_text, disk_size, mirrored, tags) " + "VALUES (" + id + "," + domainId + ",'" + name + "','" + displayText + "'," + diskSpace + "," + mirroring + ", ? )"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); stmt.setString(1, tags); stmt.executeUpdate(); } catch (SQLException ex) { s_logger.error("error creating disk offering", ex); return; } */ } @DB protected void saveThrottlingRates() { boolean saveNetworkThrottlingRate = (_networkThrottlingRate != null); boolean saveMulticastThrottlingRate = (_multicastThrottlingRate != null); if (!saveNetworkThrottlingRate && !saveMulticastThrottlingRate) { return; } String insertNWRateSql = "UPDATE `cloud`.`service_offering` SET `nw_rate` = ?"; String insertMCRateSql = "UPDATE `cloud`.`service_offering` SET `mc_rate` = ?"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt; if (saveNetworkThrottlingRate) { stmt = txn.prepareAutoCloseStatement(insertNWRateSql); stmt.setString(1, _networkThrottlingRate); stmt.executeUpdate(); } if (saveMulticastThrottlingRate) { stmt = txn.prepareAutoCloseStatement(insertMCRateSql); stmt.setString(1, _multicastThrottlingRate); stmt.executeUpdate(); } } catch (SQLException ex) { s_logger.error("error saving network and multicast throttling rates to all service offerings", ex); return; } } // no configurable values for VM Template, hard-code the defaults for now private void saveVMTemplate() { /* long id = 1; String uniqueName = "routing"; String name = "DomR Template"; int isPublic = 0; String path = "template/private/u000000/os/routing"; String type = "ext3"; int requiresHvm = 0; int bits = 64; long createdByUserId = 1; int isReady = 1; String insertSql = "INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, ready) " + "VALUES (" + id + ",'" + uniqueName + "','" + name + "'," + isPublic + ",'" + path + "',now(),'" + type + "'," + requiresHvm + "," + bits + "," + createdByUserId + "," + isReady + ")"; Transaction txn = Transaction.open(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); stmt.executeUpdate(); } catch (SQLException ex) { s_logger.error("error creating vm template: " + ex); } finally { txn.close(); } */ /* // do it again for console proxy template id = 2; uniqueName = "consoleproxy"; name = "Console Proxy Template"; isPublic = 0; path = "template/private/u000000/os/consoleproxy"; type = "ext3"; insertSql = "INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, ready) " + "VALUES (" + id + ",'" + uniqueName + "','" + name + "'," + isPublic + ",'" + path + "',now(),'" + type + "'," + requiresHvm + "," + bits + "," + createdByUserId + "," + isReady + ")"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); stmt.executeUpdate(); } catch (SQLException ex) { s_logger.error("error creating vm template: " + ex); } finally { txn.close(); } */ } @DB protected void saveUser() { // insert system account String insertSql = "INSERT INTO `cloud`.`account` (id, account_name, type, domain_id) VALUES (1, 'system', '1', '1')"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); stmt.executeUpdate(); } catch (SQLException ex) { s_logger.error("error creating system account", ex); } // insert system user insertSql = "INSERT INTO `cloud`.`user` (id, username, password, account_id, firstname, lastname, created)" + " VALUES (1, 'system', RAND(), 1, 'system', 'cloud', now())"; txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); stmt.executeUpdate(); } catch (SQLException ex) { s_logger.error("error creating system user", ex); } // insert admin user long id = Long.parseLong(_currentObjectParams.get("id")); String username = _currentObjectParams.get("username"); String firstname = _currentObjectParams.get("firstname"); String lastname = _currentObjectParams.get("lastname"); String password = _currentObjectParams.get("password"); String email = _currentObjectParams.get("email"); if (email == null || email.equals("")) { printError("An email address for each user is required."); } MessageDigest md5 = null; try { md5 = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { s_logger.error("error saving user", e); return; } md5.reset(); BigInteger pwInt = new BigInteger(1, md5.digest(password.getBytes())); String pwStr = pwInt.toString(16); int padding = 32 - pwStr.length(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < padding; i++) { sb.append('0'); // make sure the MD5 password is 32 digits long } sb.append(pwStr); // create an account for the admin user first insertSql = "INSERT INTO `cloud`.`account` (id, account_name, type, domain_id) VALUES (" + id + ", '" + username + "', '1', '1')"; txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); stmt.executeUpdate(); } catch (SQLException ex) { s_logger.error("error creating account", ex); } // now insert the user insertSql = "INSERT INTO `cloud`.`user` (id, username, password, account_id, firstname, lastname, email, created) " + "VALUES (" + id + ",'" + username + "','" + sb.toString() + "', 2, '" + firstname + "','" + lastname + "','" + email + "',now())"; txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); stmt.executeUpdate(); } catch (SQLException ex) { s_logger.error("error creating user", ex); } } private void saveDefaultConfiguations() { for (String name : s_defaultConfigurationValues.keySet()) { String value = s_defaultConfigurationValues.get(name); saveConfiguration(name, value, null); } } private void saveConfiguration() { String name = _currentObjectParams.get("name"); String value = _currentObjectParams.get("value"); String category = _currentObjectParams.get("category"); saveConfiguration(name, value, category); } @DB protected void saveConfiguration(String name, String value, String category) { String instance = "DEFAULT"; String description = s_configurationDescriptions.get(name); String component = s_configurationComponents.get(name); if (category == null) { category = "Advanced"; } String instanceNameError = "Please enter a non-blank value for the field: "; if (name.equals("instance.name")) { if (value == null || value.isEmpty() || !value.matches("^[A-Za-z0-9]{1,8}$")) { printError(instanceNameError + "configuration: instance.name can not be empty and can only contain numbers and alphabets up to 8 characters long"); } } if (name.equals("network.throttling.rate")) { if (value != null && !value.isEmpty()) { _networkThrottlingRate = value; } } if (name.equals("multicast.throttling.rate")) { if (value != null && !value.isEmpty()) { _multicastThrottlingRate = value; } } String insertSql = "INSERT INTO `cloud`.`configuration` (instance, component, name, value, description, category) " + "VALUES ('" + instance + "','" + component + "','" + name + "','" + value + "','" + description + "','" + category + "')"; String selectSql = "SELECT name FROM cloud.configuration WHERE name = '" + name + "'"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(selectSql); ResultSet result = stmt.executeQuery(); Boolean hasRow = result.next(); if (!hasRow) { stmt = txn.prepareAutoCloseStatement(insertSql); stmt.executeUpdate(); } } catch (SQLException ex) { s_logger.error("error creating configuration", ex); } } private boolean checkIpAddressRange(String ipAddressRange) { String[] ipAddressRangeArray = ipAddressRange.split("\\-"); String startIP = ipAddressRangeArray[0]; String endIP = null; if (ipAddressRangeArray.length > 1) { endIP = ipAddressRangeArray[1]; } if (!IPRangeConfig.validIP(startIP)) { s_logger.error("The private IP address: " + startIP + " is invalid."); return false; } if (!IPRangeConfig.validOrBlankIP(endIP)) { s_logger.error("The private IP address: " + endIP + " is invalid."); return false; } if (!IPRangeConfig.validIPRange(startIP, endIP)) { s_logger.error("The IP range " + startIP + " -> " + endIP + " is invalid."); return false; } return true; } @DB protected void saveRootDomain() { String insertSql = "insert into `cloud`.`domain` (id, name, parent, owner, path, level) values (1, 'ROOT', NULL, 2, '/', 0)"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); stmt.executeUpdate(); } catch (SQLException ex) { s_logger.error("error creating ROOT domain", ex); } /* String updateSql = "update account set domain_id = 1 where id = 2"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareStatement(updateSql); stmt.executeUpdate(); } catch (SQLException ex) { s_logger.error("error updating admin user", ex); } finally { txn.close(); } updateSql = "update account set domain_id = 1 where id = 1"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareStatement(updateSql); stmt.executeUpdate(); } catch (SQLException ex) { s_logger.error("error updating system user", ex); } finally { txn.close(); } */ } class DbConfigXMLHandler extends DefaultHandler { private DatabaseConfig _parent = null; public void setParent(DatabaseConfig parent) { _parent = parent; } @Override public void endElement(String s, String s1, String s2) throws SAXException { if (DatabaseConfig.objectNames.contains(s2) || "object".equals(s2)) { _parent.saveCurrentObject(); } else if (DatabaseConfig.fieldNames.contains(s2) || "field".equals(s2)) { _currentFieldName = null; } } @Override public void startElement(String s, String s1, String s2, Attributes attributes) throws SAXException { if ("object".equals(s2)) { _parent.setCurrentObjectName(convertName(attributes.getValue("name"))); } else if ("field".equals(s2)) { if (_currentObjectParams == null) { _currentObjectParams = new HashMap<String, String>(); } _currentFieldName = convertName(attributes.getValue("name")); } else if (DatabaseConfig.objectNames.contains(s2)) { _parent.setCurrentObjectName(s2); } else if (DatabaseConfig.fieldNames.contains(s2)) { if (_currentObjectParams == null) { _currentObjectParams = new HashMap<String, String>(); } _currentFieldName = s2; } } @Override public void characters(char[] ch, int start, int length) throws SAXException { if ((_currentObjectParams != null) && (_currentFieldName != null)) { String currentFieldVal = new String(ch, start, length); _currentObjectParams.put(_currentFieldName, currentFieldVal); } } private String convertName(String name) { if (name.contains(".")){ String[] nameArray = name.split("\\."); for (int i = 1; i < nameArray.length; i++) { String word = nameArray[i]; nameArray[i] = word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase(); } name = ""; for (int i = 0; i < nameArray.length; i++) { name = name.concat(nameArray[i]); } } return name; } } public static List<String> genReturnList(String success, String message) { List<String> returnList = new ArrayList<String>(2); returnList.add(0, success); returnList.add(1, message); return returnList; } public static void printError(String message) { System.out.println(message); System.exit(1); } public static String getDatabaseValueString(String selectSql, String name, String errorMsg) { Transaction txn = Transaction.open("getDatabaseValueString"); PreparedStatement stmt = null; try { stmt = txn.prepareAutoCloseStatement(selectSql); ResultSet rs = stmt.executeQuery(); if (rs.next()) { String value = rs.getString(name); return value; } else { return null; } } catch (SQLException e) { System.out.println("Exception: " + e.getMessage()); printError(errorMsg); } finally { txn.close(); } return null; } public static long getDatabaseValueLong(String selectSql, String name, String errorMsg) { Transaction txn = Transaction.open("getDatabaseValueLong"); PreparedStatement stmt = null; try { stmt = txn.prepareAutoCloseStatement(selectSql); ResultSet rs = stmt.executeQuery(); if (rs.next()) { return rs.getLong(name); } else { return -1; } } catch (SQLException e) { System.out.println("Exception: " + e.getMessage()); printError(errorMsg); } finally { txn.close(); } return -1; } public static void saveSQL(String sql, String errorMsg) { Transaction txn = Transaction.open("saveSQL"); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(sql); stmt.executeUpdate(); } catch (SQLException ex) { System.out.println("SQL Exception: " + ex.getMessage()); printError(errorMsg); } finally { txn.close(); } } }
{'content_hash': 'a0f2be8a43703a3aaf48d83b99ac2523', 'timestamp': '', 'source': 'github', 'line_count': 1435, 'max_line_length': 352, 'avg_line_length': 47.745644599303134, 'alnum_prop': 0.6289863533532803, 'repo_name': 'mufaddalq/cloudstack-datera-driver', 'id': '63f77b66520d5f27736d62a67eeb16af808c7dd5', 'size': '68515', 'binary': False, 'copies': '1', 'ref': 'refs/heads/4.2', 'path': 'server/src/com/cloud/test/DatabaseConfig.java', 'mode': '33261', 'license': 'apache-2.0', 'language': [{'name': 'ApacheConf', 'bytes': '250'}, {'name': 'Batchfile', 'bytes': '6317'}, {'name': 'CSS', 'bytes': '302008'}, {'name': 'FreeMarker', 'bytes': '4917'}, {'name': 'HTML', 'bytes': '38671'}, {'name': 'Java', 'bytes': '79758943'}, {'name': 'JavaScript', 'bytes': '4237188'}, {'name': 'Perl', 'bytes': '1879'}, {'name': 'Python', 'bytes': '5187499'}, {'name': 'Shell', 'bytes': '803262'}]}
<?php /** * Created by PhpStorm. * User: sullenboom * Date: 26.08.14 * Time: 10:30 */ namespace HealthCheck\Model\Exception; class RuntimeException extends \RuntimeException implements ExceptionInterface {}
{'content_hash': 'a7fbf3888105716f6661da07429e4103', 'timestamp': '', 'source': 'github', 'line_count': 12, 'max_line_length': 78, 'avg_line_length': 17.833333333333332, 'alnum_prop': 0.7383177570093458, 'repo_name': 'sullenboom/sla-healthcheck', 'id': '164547cb3088b57629f95279c61aa8bd843f9b5b', 'size': '214', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'module/HealthCheck/src/HealthCheck/Model/Exception/RuntimeException.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '708'}, {'name': 'CSS', 'bytes': '4634'}, {'name': 'HTML', 'bytes': '13361'}, {'name': 'PHP', 'bytes': '663907'}]}
import collapsibleFactory from '../common/collapsible'; import collapsibleGroupFactory from '../common/collapsible-group'; const PLUGIN_KEY = 'menu'; /* * Manage the behaviour of a menu * @param {jQuery} $menu */ class Menu { constructor($menu) { this.$menu = $menu; this.$body = $('body'); this.hasMaxMenuDisplayDepth = this.$body.find('.navPages-list').hasClass('navPages-list-depth-max'); // Init collapsible this.collapsibles = collapsibleFactory('[data-collapsible]', { $context: this.$menu }); this.collapsibleGroups = collapsibleGroupFactory($menu); // Auto-bind this.onMenuClick = this.onMenuClick.bind(this); this.onDocumentClick = this.onDocumentClick.bind(this); // Listen this.bindEvents(); } collapseAll() { this.collapsibles.forEach(collapsible => collapsible.close()); this.collapsibleGroups.forEach(group => group.close()); } collapseNeighbors($neighbors) { const $collapsibles = collapsibleFactory('[data-collapsible]', { $context: $neighbors }); $collapsibles.forEach($collapsible => $collapsible.close()); } bindEvents() { this.$menu.on('click', this.onMenuClick); this.$body.on('click', this.onDocumentClick); } unbindEvents() { this.$menu.off('click', this.onMenuClick); this.$body.off('click', this.onDocumentClick); } onMenuClick(event) { event.stopPropagation(); if (this.hasMaxMenuDisplayDepth) { const $neighbors = $(event.target).parent().siblings(); this.collapseNeighbors($neighbors); } } onDocumentClick() { this.collapseAll(); } } /* * Create a new Menu instance * @param {string} [selector] * @return {Menu} */ export default function menuFactory(selector = `[data-${PLUGIN_KEY}]`) { const $menu = $(selector).eq(0); const instanceKey = `${PLUGIN_KEY}Instance`; const cachedMenu = $menu.data(instanceKey); if (cachedMenu instanceof Menu) { return cachedMenu; } const menu = new Menu($menu); $menu.data(instanceKey, menu); return menu; }
{'content_hash': '75a5f5258edf0bb069f90ebc5adbb82f', 'timestamp': '', 'source': 'github', 'line_count': 83, 'max_line_length': 108, 'avg_line_length': 26.49397590361446, 'alnum_prop': 0.6211914506593906, 'repo_name': 'bigcommerce/stencil', 'id': '0187215c50ae41d0c0c10c9b23c91d20b64305ea', 'size': '2199', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'assets/js/theme/global/menu.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '289819'}, {'name': 'HTML', 'bytes': '301440'}, {'name': 'JavaScript', 'bytes': '201200'}, {'name': 'Ruby', 'bytes': '291'}]}
class NinjaCopyTargetWriter : public NinjaTargetWriter { public: NinjaCopyTargetWriter(const Target* target, std::ostream& out); ~NinjaCopyTargetWriter() override; void Run() override; private: // Writes the rules top copy the file(s), putting the computed output file // name(s) into the given vector. void WriteCopyRules(std::vector<OutputFile>* output_files); DISALLOW_COPY_AND_ASSIGN(NinjaCopyTargetWriter); }; #endif // TOOLS_GN_NINJA_COPY_TARGET_WRITER_H_
{'content_hash': 'aa59ee37a95be8af69cce91dfd5bb6e8', 'timestamp': '', 'source': 'github', 'line_count': 16, 'max_line_length': 76, 'avg_line_length': 30.1875, 'alnum_prop': 0.7474120082815735, 'repo_name': 'endlessm/chromium-browser', 'id': 'c4919c677fd2fe08d7ae8c75cdff8768ac97f12e', 'size': '854', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'tools/gn/src/gn/ninja_copy_target_writer.h', 'mode': '33188', 'license': 'bsd-3-clause', 'language': []}
var express = require('express'); var router = express.Router(); var _ = require('underscore'); function logout(req, res, next){ if (_.has(req.session, 'user')){ delete req.session.user; } req.flash('info', 'Logged Out'); res.redirect('/'); } // Log out router.get('/', logout); module.exports = router;
{'content_hash': '676d94edab049f88e705fed94250d279', 'timestamp': '', 'source': 'github', 'line_count': 17, 'max_line_length': 36, 'avg_line_length': 19.529411764705884, 'alnum_prop': 0.6054216867469879, 'repo_name': 'dkapell/badger', 'id': '4e14bdb683a62c07250cd9aa4a9a7289aa7c77a3', 'size': '332', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'routes/logout.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '3426'}, {'name': 'HTML', 'bytes': '57948'}, {'name': 'JavaScript', 'bytes': '137077'}]}
#cheeseMap { position: relative; width: 100%; margin-left: 0; /*&:first-of-type { margin-right: @gutter; }*/ } #cheeseMap > h2 { margin-bottom: 40px; transition: opacity 1s linear; } #cheeseMap #map { width: 100%; display: inline-block; text-align: center; position: absolute; transition: all 1s ease-out; } #cheeseMap #map > img { display: inline-block; left: 0; width: 90%; } #cheeseMap #map figcaption { position: absolute; width: 100%; height: 100%; } #cheeseMap #map figcaption a { display: block; opacity: 1; position: absolute; width: 18%; } #cheeseMap #map figcaption a figure { display: block; position: relative; } #cheeseMap #map figcaption a figure figcaption { font-size: 12px; line-height: 16px; font-size: 14px; color: #416e80; z-index: 3; font-family: 'Dom Casual W01 Bold 692333'; text-transform: uppercase; display: block; position: absolute; text-align: center; height: auto; width: 130%; margin-left: -15%; top: -25px; padding-bottom: 25px; background: url(../imgs/cross.png) center bottom no-repeat; transition: none; } #cheeseMap #map figcaption a figure img { width: 100%; position: relative; display: block; z-index: 2; margin-bottom: 0; } #cheeseMap #map figcaption a.bottomLegend figure figcaption { top: auto; bottom: -29px; background-position: top; padding-top: 29px; padding-bottom: 0; } #cheeseMap #map figcaption a#edelsuisse:before { pointer-events: none; position: absolute; display: block; content: ''; width: 86.5%; height: 133.7%; top: -115%; left: -43%; background: url(../imgs/map_trait_edelSuisse.png) no-repeat transparent; background-size: cover; } #cheeseMap #map figcaption a#gottardo:before { pointer-events: none; position: absolute; display: block; content: ''; width: 157%%; height: 115.1%; top: -69%; left: -108%; background: url(../imgs/map_trait_gottardo.png) no-repeat transparent; background-size: cover; } #cheeseMap #map figcaption a#sbrinz:before { pointer-events: none; position: absolute; display: block; content: ''; width: 169%; height: 16%; top: 31%; left: -104%; background: url(../imgs/map_trait_sbrinz.png) no-repeat transparent; background-size: cover; } #cheeseMap #map figcaption a#vacherinfribourgeois:before { pointer-events: none; position: absolute; display: block; content: ''; width: 68.5%; height: 139.7%; top: -87%; left: 41%; background: url(../imgs/map_trait_vacherinFribourgeois.png) no-repeat transparent; background-size: cover; } #cheeseMap #appenzeller, #cheeseMap .imgAppenzeller { top: 2.3%; left: 63.9%; } #cheeseMap #edelsuisse, #cheeseMap .imgEdelsuisse { top: 71.4%; left: 43.7%; } #cheeseMap #emmentaler, #cheeseMap .imgEmmentaler { top: 17.9%; left: 34.1%; } #cheeseMap #gottardo, #cheeseMap .imgGottardo { top: 67.3%; left: 69%; } #cheeseMap #gruyere, #cheeseMap .imgGruyere { top: 31.4%; left: 9.4%; } #cheeseMap #sbrinz, #cheeseMap .imgSbrinz { top: 28.4%; left: 72.8%; } #cheeseMap #tetedemoine, #cheeseMap .imgTetedemoine { top: 2.2%; left: 16.6%; } #cheeseMap #vacherinfribourgeois, #cheeseMap .imgVacherinfribourgeois { top: 67.6%; left: 18.1%; } #cheeseMap #cheeseDetails { position: absolute; height: 100%; } #cheeseMap #cheeseDetails article { padding-top: 200px; padding-bottom: 20px; } #cheeseMap #cheeseDetails article #cheesePlaceholder { position: absolute; top: 0; } #cheeseMap #cheeseDetails article #cheesePlaceholder > img.caliber { margin-bottom: 0; width: 95% !important; } #cheeseMap #cheeseDetails article figure { position: absolute; overflow: hidden; width: 18%; transition: all 1s ease-out; pointer-events: none; } #cheeseMap #cheeseDetails article figure img { position: absolute; } #cheeseMap #cheeseDetails article figure img.cheese { width: 100%; transition: all 1s ease-out; } #cheeseMap #cheeseDetails article figure img.trait { top: 15%; width: 0%; right: 100%; opacity: 0; transition: all 1s ease-out 1s; } #cheeseMap #cheeseDetails article figure img.caliber { padding-right: 0; transition: padding 1s ease-out 1s; } #cheeseMap #cheeseDetails article .close { position: absolute; top: 50px; right: 32px; opacity: 0; } #cheeseMap #cheeseDetails article h1, #cheeseMap #cheeseDetails article p, #cheeseMap #cheeseDetails article h2 { width: 53.64583333333333%; margin-left: 1.6666666666666667%; /*&:first-of-type { margin-right: @gutter; }*/ margin-left: 32.39583333333333%; text-align: left; opacity: 0; transition: none; } #cheeseMap #cheeseDetails article h2 { color: black; font-family: 'OfficinaSansITCW01-BdIt'; font-size: 22px; line-height: 26px; border-bottom: 1px solid #c89e65; padding-bottom: 5px; margin-bottom: 15px; } #cheeseMap #cheeseDetails article .packaging { opacity: 0; transition: none; position: absolute; width: 29.062499999999996%; margin-left: 1.6666666666666667%; /*&:first-of-type { margin-right: @gutter; }*/ } #cheeseMap #cheeseDetails article p b { font-family: 'DIN Next W01 Medium'; color: black; } #cheeseMap #cheeseDetails article p strong { color: #c89e65; margin-top: 8px; display: block; } #cheeseMap.showCheese > h2 { opacity: 0; } #cheeseMap.showCheese #map { width: 16.516667%; margin-left: 1.6666666666666667%; margin-left: 37.395833%; margin-top: 6.7%; } #cheeseMap.showCheese #map a { opacity: 0; } #cheeseMap.showCheese > .caliber { display: none !important; } #cheeseMap.showCheese #cheeseDetails { position: relative; } #cheeseMap.showCheese #cheeseDetails figure { top: 3%; left: 0; width: 55%; } #cheeseMap.showCheese #cheeseDetails figure img.cheese { width: 35%; margin-top: 1.3%; margin-left: 11%; } #cheeseMap.showCheese #cheeseDetails figure img.trait { width: 72.2%; right: 0; position: absolute; top: 2.3%; opacity: 1; } #cheeseMap.showCheese.appenzeller #cheeseDetails .appenzeller h1, #cheeseMap.showCheese.edelsuisse #cheeseDetails .edelsuisse h1, #cheeseMap.showCheese.emmentaler #cheeseDetails .emmentaler h1, #cheeseMap.showCheese.gottardo #cheeseDetails .gottardo h1, #cheeseMap.showCheese.sbrinz #cheeseDetails .sbrinz h1, #cheeseMap.showCheese.tetedemoine #cheeseDetails .tetedemoine h1, #cheeseMap.showCheese.vacherinfribourgeois #cheeseDetails .vacherinfribourgeois h1, #cheeseMap.showCheese.gruyere #cheeseDetails .gruyere h1, #cheeseMap.showCheese.appenzeller #cheeseDetails .appenzeller h2, #cheeseMap.showCheese.edelsuisse #cheeseDetails .edelsuisse h2, #cheeseMap.showCheese.emmentaler #cheeseDetails .emmentaler h2, #cheeseMap.showCheese.gottardo #cheeseDetails .gottardo h2, #cheeseMap.showCheese.sbrinz #cheeseDetails .sbrinz h2, #cheeseMap.showCheese.tetedemoine #cheeseDetails .tetedemoine h2, #cheeseMap.showCheese.vacherinfribourgeois #cheeseDetails .vacherinfribourgeois h2, #cheeseMap.showCheese.gruyere #cheeseDetails .gruyere h2, #cheeseMap.showCheese.appenzeller #cheeseDetails .appenzeller p, #cheeseMap.showCheese.edelsuisse #cheeseDetails .edelsuisse p, #cheeseMap.showCheese.emmentaler #cheeseDetails .emmentaler p, #cheeseMap.showCheese.gottardo #cheeseDetails .gottardo p, #cheeseMap.showCheese.sbrinz #cheeseDetails .sbrinz p, #cheeseMap.showCheese.tetedemoine #cheeseDetails .tetedemoine p, #cheeseMap.showCheese.vacherinfribourgeois #cheeseDetails .vacherinfribourgeois p, #cheeseMap.showCheese.gruyere #cheeseDetails .gruyere p, #cheeseMap.showCheese.appenzeller #cheeseDetails .appenzeller .close, #cheeseMap.showCheese.edelsuisse #cheeseDetails .edelsuisse .close, #cheeseMap.showCheese.emmentaler #cheeseDetails .emmentaler .close, #cheeseMap.showCheese.gottardo #cheeseDetails .gottardo .close, #cheeseMap.showCheese.sbrinz #cheeseDetails .sbrinz .close, #cheeseMap.showCheese.tetedemoine #cheeseDetails .tetedemoine .close, #cheeseMap.showCheese.vacherinfribourgeois #cheeseDetails .vacherinfribourgeois .close, #cheeseMap.showCheese.gruyere #cheeseDetails .gruyere .close, #cheeseMap.showCheese.appenzeller #cheeseDetails .appenzeller .packaging, #cheeseMap.showCheese.edelsuisse #cheeseDetails .edelsuisse .packaging, #cheeseMap.showCheese.emmentaler #cheeseDetails .emmentaler .packaging, #cheeseMap.showCheese.gottardo #cheeseDetails .gottardo .packaging, #cheeseMap.showCheese.sbrinz #cheeseDetails .sbrinz .packaging, #cheeseMap.showCheese.tetedemoine #cheeseDetails .tetedemoine .packaging, #cheeseMap.showCheese.vacherinfribourgeois #cheeseDetails .vacherinfribourgeois .packaging, #cheeseMap.showCheese.gruyere #cheeseDetails .gruyere .packaging { opacity: 1; transition: opacity 1s ease-out 1.5s; } #cheeseMap.transition > .caliber { display: block !important; } #cheeseMap.transition #cheeseDetails { position: absolute; opacity: 0; transition: opacity 0.25s ease-out; }
{'content_hash': 'ad62e31bbda50383d115f09ca0d0cd51', 'timestamp': '', 'source': 'github', 'line_count': 337, 'max_line_length': 91, 'avg_line_length': 26.43620178041543, 'alnum_prop': 0.7294870355819957, 'repo_name': 'atelierZuppinger/book-appartment.sample', 'id': 'bf0d4b6e72f5fb3d8aad92657ded3f24400113d6', 'size': '8909', 'binary': False, 'copies': '1', 'ref': 'refs/heads/dev', 'path': 'web/css/map.css', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '249879'}, {'name': 'JavaScript', 'bytes': '595007'}, {'name': 'PHP', 'bytes': '72336'}, {'name': 'Shell', 'bytes': '2690'}]}
<?php use RESTFulPhalcon\RestModel\Validator, Phalcon\Mvc\Model\Validator\StringLength, Phalcon\Mvc\Model\Validator\Numericality; class UserValidator extends Validator { public function addValidators() { $this->add(new StringLength(array( 'field'=> 'description', 'min' => 3, 'messageMaximum' => 'We don\'t like really long names', 'messageMinimum' => 'Minimum number of characters for description is 10'))); } }
{'content_hash': 'b0208b601fd495ff99c619c91fac8041', 'timestamp': '', 'source': 'github', 'line_count': 19, 'max_line_length': 88, 'avg_line_length': 26.0, 'alnum_prop': 0.6356275303643725, 'repo_name': 'planeonline/service-layer', 'id': '0e4e0db910eb35aca0b3e49009c0cdfeafbaded3', 'size': '494', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/models/validators/UserValidator.php', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'PHP', 'bytes': '1055405'}, {'name': 'Shell', 'bytes': '6280'}, {'name': 'Volt', 'bytes': '130'}]}
check() { if [ `cat ./temporary_file | grep $1 | wc -l` -eq 0 ] ; then echo " $1"; fi } verify() { packages="$packages$(check $1)"; } packages=""; if [ `which uname` ] ; then if [ `uname -a | grep Ubuntu | wc -l` ] ; then echo "\033[31mChecking required Ubuntu packages ...\033[0m"; if [ ! -e ./temporary_file ] ; then # check that the temp file does not exist dpkg -l > ./temporary_file; #To use FFMPEG recording verify "libavformat-dev"; verify "libavcodec-dev"; verify "libavutil-dev"; verify "libswscale-dev"; verify "libavfilter-dev"; #To use the Wiimote in Navigation verify "libcwiid1-dev"; verify "libbluetooth-dev"; #To compile Navigation verify "libsdl1.2-dev"; verify "libgtk2.0-dev"; verify "libxml2-dev"; verify "libudev-dev"; verify "libiw-dev"; if [ "$packages" != "" ] ; then echo "You should install the following packages to compile the Mykonos project with Ubuntu:\n $packages"; echo "Do you want to install them now [y/n] ?"; read user_answer ; if [ "$user_answer" = "y" ]; then sudo apt-get install $packages; fi else echo "ok."; fi rm ./temporary_file; fi fi fi
{'content_hash': 'd629c28cb16c455a560eeb1596001a77', 'timestamp': '', 'source': 'github', 'line_count': 58, 'max_line_length': 109, 'avg_line_length': 21.20689655172414, 'alnum_prop': 0.6008130081300813, 'repo_name': 'feross/oculus-drone', 'id': '134f2bcb8752ae05615a216bf5811a9f29c7c982', 'size': '1312', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'drone-sdk/ARDroneLib/Soft/Build/check_dependencies.sh', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'Assembly', 'bytes': '1657837'}, {'name': 'C', 'bytes': '31483064'}, {'name': 'C++', 'bytes': '2615531'}, {'name': 'CSS', 'bytes': '55313'}, {'name': 'D', 'bytes': '104239'}, {'name': 'Java', 'bytes': '10351'}, {'name': 'JavaScript', 'bytes': '63907'}, {'name': 'Objective-C', 'bytes': '325163'}, {'name': 'Perl', 'bytes': '22218'}, {'name': 'Python', 'bytes': '1995'}, {'name': 'Shell', 'bytes': '58502'}, {'name': 'Verilog', 'bytes': '2853'}]}
package serial; /** * Created by chzhong on 1/20/16. */ public class SerialException extends RuntimeException { /** * Constructs a new {@code SerialException} with the current stack trace * and the specified detail message. * * @param detailMessage the detail message for this exception. */ public SerialException(String detailMessage) { super(detailMessage); } /** * Constructs a new {@code PortNotOpenedException} with the current stack trace, * the specified detail message and the specified cause. * * @param detailMessage the detail message for this exception. * @param throwable */ public SerialException(String detailMessage, Throwable throwable) { super(detailMessage, throwable); } }
{'content_hash': 'e43dcd0fc6fbc7785119156f4228ffb7', 'timestamp': '', 'source': 'github', 'line_count': 27, 'max_line_length': 84, 'avg_line_length': 29.333333333333332, 'alnum_prop': 0.6767676767676768, 'repo_name': 'chzhong/serial-android', 'id': 'e2bde595b479ffdbdda8ef236803f54e07acf8c6', 'size': '792', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'libserial/src/main/java/serial/SerialException.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '49560'}, {'name': 'C++', 'bytes': '221514'}, {'name': 'Java', 'bytes': '72600'}, {'name': 'Makefile', 'bytes': '3118'}, {'name': 'Shell', 'bytes': '712'}]}
<?php namespace Usuarios\Model\Dao; use Usuarios\Model\Entity\Pagina; use Usuarios\Model\Entity\Input; use Usuarios\MisClases\Respuesta; use Usuarios\Model\Dao\Validators\SaveInput; use Usuarios\Model\Dao\Validators\EditInput; use Usuarios\Controller\Params\InputParams; class InputDao { private $adapter; public function __construct($adapter) { $this->adapter = $adapter; $this->params = new InputParams(); $this->params = $this->params->getParams(); } public function deleteSelect($idselect, $idinput) { $response = new \Usuarios\MisClases\Respuesta(); $response->setError(true); $sql = "DELETE FROM select_collections WHERE id_input=" . $idinput . " AND id_select=" . $idselect; $res = $this->adapter->query($sql)->execute(); if ($res) { $response->setError(false); return $response; } } public function deleteSelectValue($idUsuario) { $response = new \Usuarios\MisClases\Respuesta(); $sql = "DELETE FROM input_select_temp WHERE id_input=" . $idUsuario; $response->setError(true); $res = $this->adapter->query($sql)->execute(); if ($res) { $sql = "DELETE FROM select_collections_temp WHERE id_input=" . $idUsuario; $res = $this->adapter->query($sql)->execute(); if ($res) { $response->setError(false); $response->setMensaje(""); } } return $response; } public function deleteItemTempSelectValue($idUsuario, $idItem) { $response = new \Usuarios\MisClases\Respuesta(); $sql = "DELETE FROM input_select_temp WHERE id=$idItem AND id_input=" . $idUsuario; $response->setError(true); $res = $this->adapter->query($sql)->execute(); if ($res) { $response->setError(false); $response->setMensaje(""); } return $response; } public function updateItemTempSelectValue($idUsuario, $idItem, $value, $tipo, $nrespuestas) { $response = new \Usuarios\MisClases\Respuesta(); $sql = "UPDATE input_select_temp "; $sql .= "set tipo=$tipo,valor=$value,respuestas_requeridas=$nrespuestas "; $sql .= "WHERE id=$idItem AND id_input=" . $idUsuario; $response->setError(true); $res = $this->adapter->query($sql)->execute(); if ($res) { $response->setError(false); $response->setMensaje(""); } return $response; } /* public function searchInputTemp($idInput){ $sql = "SELECT COUNT(*) as total FROM input_select_temp WHERE id_input = ".$idInput; $res = $this->adapter->query($sql); $total = 0; if ($res) { $result = $res->execute(); foreach ($result as $r) { $total = $r["total"]; } } return $total; } */ // public function insertTempSelectValue($idUsuario,$value,$tipo,$nrespuestas,$orden){ // $response = new \Usuarios\MisClases\Respuesta(); // // $response->valor = $value; // // if(!$this->searchInputTemp($idUsuario)){ // // $sql = "INSERT INTO input_select_temp (id_input,tipo,respuestas_requeridas) VALUES ("; // $sql .= "'".$idUsuario."',"; // $sql .= "'".$tipo."',"; // $sql .= "'".$nrespuestas."'"; // $sql .= ")"; // // $response->setError(true); // // $res = $this->adapter->query($sql)->execute(); // // if($res){ // $response->setError(false); // $response->setMensaje(""); // } // // } // // $idSelect = $orden;//$this->getIdSelect($idUsuario); // // if(!$idSelect){ // $idSelect = 0; // } // // $sql = "INSERT INTO select_collections_temp (id_input,id_select,value) VALUES ("; // $sql .= "'".$idUsuario."',"; // $sql .= "'".($idSelect)."',"; // $sql .= "'".$value."'"; // $sql .= ")"; // // $res = $this->adapter->query($sql)->execute(); // // if($res){ // $response->idunput = $this->adapter->getDriver()->getLastGeneratedValue(); // $response->setError(false); // $response->setMensaje(""); // } // // // return $response; // } public function saveOrdenValues($inputs) { foreach ($inputs as $input) { $sql = "UPDATE select_collections_temp set id_select = " . $input["orden"] . " WHERE id= " . $input["id"]; $res = $this->adapter->query($sql); $result = $res->execute(); if (!$result) { return false; } } return true; } /* public function getIdSelect($id){ $sql = "SELECT MAX(id_select) as maximo FROM select_collections_temp WHERE id_input = $id"; $res = $this->adapter->query($sql)->execute(); foreach($res as $r){ return $r["maximo"]; } return 0; } */ public function delete($id) { $response = new \Usuarios\MisClases\Respuesta(); $input = $this->fetchOne(array("id" => $id)); if ($input) { $tipo = $input[0]->getTipo(); } $sql = "DELETE FROM inputs WHERE id = $id"; $res = $this->adapter->query($sql)->execute(); if ($res) { switch ($tipo) { case "texto": $sql = "DELETE FROM input_texto WHERE id_input = $id"; $res = $this->adapter->query($sql)->execute(); break; case "dropdown": $sql = "DELETE FROM input_select WHERE id_input = $id"; $res = $this->adapter->query($sql)->execute(); if ($res) { $sql = "DELETE FROM select_collections WHERE id_input = $id"; $res = $this->adapter->query($sql)->execute(); } break; default: break; } $response->setError(false); $response->setMensaje("Item eliminado"); } return $response; } public function save($unaEntity) { $validate = new SaveInput("", $this, $this->params); $respuesta = $validate->validate($unaEntity); $respuesta->id = false; if ($respuesta->getError() === false) { $respuesta = $validate->validateName($unaEntity->getNombre()); } if ($respuesta->getError() === false) { /* Save Start */ $connection = $this->adapter->getDriver()->getConnection(); $connection->beginTransaction(); $sql = "INSERT INTO inputs (nombre,label,required,tipo_input,estado,orden,id_pagina,tamanio,link_ayuda,ayuda) VALUES("; $sql .= "'" . $unaEntity->getNombre() . "',"; $sql .= "'" . $unaEntity->getLabel() . "',"; $sql .= "'" . $unaEntity->getRequired() . "',"; $sql .= "'" . $unaEntity->getTipo() . "',"; $sql .= "'" . $unaEntity->getEstado() . "',"; $sql .= "'" . $unaEntity->getOrden() . "',"; $sql .= "'" . $unaEntity->getIdPagina() . "',"; $sql .= "'" . $unaEntity->getTamanio() . "',"; $sql .= "'" . $unaEntity->getLinkAyuda() . "',"; $sql .= "'" . $unaEntity->getAyuda() . "'"; $sql .= ")"; $result = $this->adapter->query($sql)->execute(); if ($result) { $id = $connection->getLastGeneratedValue(); $unInput = $unaEntity->getControl(); $unInput->setIdInput($id); $respuesta = $this->saveInputType($unInput, $unaEntity->getTipo()); $respuesta->id = $id; if ($respuesta->getError() == true) { $connection->rollback(); } else { $connection->commit(); } } else { $connection->rollback(); } /* End Save */ if ($respuesta->getError() == false) { $respuesta->setError(false); $respuesta->setMensaje("Item saved successfully"); } if (!$result) { $respuesta->setError(true); $respuesta->setMensaje("Error saving item"); } } return $respuesta; } //($idusuario,$select["respuestas_requeridas"],$select["tipo"]) public function saveSelect($idusuario, $idinput) { $sql = "SELECT * FROM input_select_temp WHERE id_input=$idusuario"; $res = $this->adapter->query($sql); $select = new \stdClass; if ($res) { $result = $res->execute(); foreach ($result as $s) { $select->id = $s["id"]; $select->id_input = $s["id_input"]; $select->tipo = $s["tipo"]; $select->respuestas_requeridas = $s["respuestas_requeridas"]; $sql = "INSERT INTO input_select (id_input,tipo,respuestas_requeridas) VALUES ("; $sql .= "'" . $select->id_input . "',"; $sql .= "'" . $select->tipo . "',"; $sql .= "'" . $select->respuestas_requeridas . "'"; $sql .= ")"; $resS = $this->adapter->query($sql)->execute(); } $sql = "SELECT * FROM select_collections_temp WHERE id_input=$idusuario"; $res = $this->adapter->query($sql); $results = $res->execute(); foreach ($results as $s) { $sql = "INSERT INTO select_collections (id_input,id_select,value) VALUES ("; $sql .= "'" . $s["id_input"] . "',"; $sql .= "'" . $s["id_select"] . "',"; $sql .= "'" . $s["value"] . "'"; $sql .= ")"; $resS = $this->adapter->query($sql)->execute(); } } return true; } public function update($unaEntity) { $validate = new EditInput("", $this, $this->params); $unaEntity->setOrden(0); $respuesta = $validate->validate($unaEntity); $respuesta->id = false; if ($respuesta->getError() === false) { $respuesta = $validate->validateName($unaEntity->getNombre()); } if ($respuesta->getError() === false) { /* Save Start */ $connection = $this->adapter->getDriver()->getConnection(); $connection->beginTransaction(); $sql = "UPDATE inputs set required = '" . $unaEntity->getRequired() . "', link_ayuda='" . $unaEntity->getLinkAyuda() . "', nombre='" . $unaEntity->getNombre() . "', tamanio='" . $unaEntity->getTamanio() . "',label='" . $unaEntity->getLabel() . "',ayuda='" . $unaEntity->getAyuda() . "'"; $sql .= " WHERE id =" . $unaEntity->getId(); $result = $this->adapter->query($sql)->execute(); if ($result) { $id = $unaEntity->getId(); $unInput = $unaEntity->getControl(); $unInput->setIdInput($id); $respuesta = $this->updateInputType($unInput, $unaEntity->getTipo()); $respuesta->id = $id; if ($respuesta->getError() == true) { $connection->rollback(); } else { $connection->commit(); } } else { $connection->rollback(); } /* End Save */ if ($respuesta->getError() == false) { $respuesta->setError(false); $respuesta->setMensaje("Item updated successfully"); } if (!$result) { $respuesta->setError(true); $respuesta->setMensaje("Error updating item"); } } return $respuesta; } public function updateInputType($entity, $tipo) { $response = new \Usuarios\MisClases\Respuesta(); $response->setError(true); $sql = ""; switch ($tipo) { case "texto": $sql = "UPDATE input_texto set respuestas_requeridas='" . $entity->getRespuestasRequeridas() . "', ejemplo='" . $entity->getEjemplo() . "', validacion='" . $entity->getValidacion() . "' WHERE id_input=" . $entity->getIdInput() . ""; $result = $this->adapter->query($sql)->execute(); if ($result) { $response->setError(false); } break; case "fecha": $sql = "UPDATE input_fecha set tipo_fecha='" . $entity->getTipoFecha() . "' WHERE id_input=" . $entity->getIdInput() . ""; $result = $this->adapter->query($sql)->execute(); if ($result) { $response->setError(false); } break; case "imagen": $result = true; if ($result) { $response->setError(false); } break; case "dropdown": $sql = "UPDATE input_select SET tipo='" . $entity->getTipo() . "',respuestas_requeridas='" . $entity->getRespuestasRequeridas() . "' " . "WHERE id_input=" . $entity->getIdInput(); $result = $this->adapter->query($sql)->execute(); if ($result) { $sql = "DELETE FROM select_collections " . "WHERE id_input=" . $entity->getIdInput(); $result = $this->adapter->query($sql)->execute(); if ($result) { foreach ($entity->getValues() as $value) { $sql = "INSERT INTO select_collections (id_input,id_select,value,orden) VALUES(" . "'" . $entity->getIdInput() . "'," . "'" . $value["id_select"] . "'," . "'" . $value["value"] . "'," . "'" . $value["orden"] . "')"; $result = $this->adapter->query($sql)->execute(); } } $response->setError(false); $response->setMensaje(""); } break; default: break; } return $response; } public function saveInputType($entity, $tipo) { $response = new \Usuarios\MisClases\Respuesta(); $response->setError(true); $sql = ""; switch ($tipo) { case "texto": $sql = "INSERT INTO input_texto (id_input,respuestas_requeridas,ejemplo,validacion) "; $sql .= "VALUES ('" . $entity->getIdInput() . "','" . $entity->getRespuestasRequeridas() . "','" . $entity->getEjemplo() . "','" . $entity->getValidacion() . "')"; $result = $this->adapter->query($sql)->execute(); if ($result) { $response->setError(false); } break; case "dropdown": $sql = "INSERT INTO input_select (id_input,tipo,respuestas_requeridas) "; $sql .= "VALUES ('" . $entity->getIdInput() . "','" . $entity->getTipo() . "','" . $entity->getRespuestasRequeridas() . "')"; $result = $this->adapter->query($sql)->execute(); if ($result) { foreach ($entity->getValues() as $value) { $a = $value; $sql = "INSERT INTO select_collections (id_input,id_select,value,orden) VALUES("; $sql .= "'" . $entity->getIdInput() . "',"; $sql .= "'" . $value["id"] . "',"; $sql .= "'" . $value["value"] . "',"; $sql .= "'" . $value["orden"] . "'"; $sql .= ")"; $result = $this->adapter->query($sql)->execute(); } $response->setError(false); $response->setMensaje(""); } break; case "fecha": $sql = "INSERT INTO input_fecha (id_input,tipo_fecha) "; $sql .= "VALUES ('" . $entity->getIdInput() . "','" . $entity->getTipoFecha() . "')"; $result = $this->adapter->query($sql)->execute(); if ($result) { $response->setError(false); } break; case "imagen": $sql = "INSERT INTO input_imagen (id_input) "; $sql .= "VALUES ('" . $entity->getIdInput() . "')"; $result = $this->adapter->query($sql)->execute(); if ($result) { $response->setError(false); } break; default: break; } return $response; } public function fetchOneLike($query) { $sql = "SELECT * FROM inputs WHERE estado = 1 AND nombre LIKE '%" . $query . "%' ORDER BY nombre DESC"; $r = array(); $res = $this->adapter->query($sql); if ($res) { $result = $res->execute(); foreach ($result as $entity) { $r[] = array( "id" => $entity["id"], "name" => $entity["nombre"], "avatar" => "", "icon" => "", "type" => ""); } } return $r; } public function fetchOne($array) { $flag = false; $sql = "SELECT * FROM inputs WHERE "; foreach ($array as $key => $value) { if ($flag) { $sql .= " AND $key = '" . $value . "'"; } else { $sql .= " $key = '" . $value . "'"; } $flag = true; } $sql .= " AND estado = 1"; $inputs = array(); $res = $this->adapter->query($sql); if ($res) { $result = $res->execute(); foreach ($result as $entity) { $unInput = new Input(); $unInput->setId($entity["id"]); $unInput->setIdPagina($entity["id_pagina"]); $unInput->setLabel($entity["label"]); $unInput->setEstado($entity["estado"]); $unInput->setNombre($entity["nombre"]); $unInput->setOrden($entity["orden"]); $unInput->setRequired($entity["required"]); $unInput->setTipo($entity["tipo_input"]); $inputs[] = $unInput; } } return $inputs; } public function dummi() { } }
{'content_hash': 'e539795357a6fd42c99bfd9193b2c750', 'timestamp': '', 'source': 'github', 'line_count': 590, 'max_line_length': 299, 'avg_line_length': 32.49322033898305, 'alnum_prop': 0.45031558082520473, 'repo_name': 'jpcodezur/tesisenlinea', 'id': 'f7fb2d4351025ce5285c7b04fca850663ba78cc0', 'size': '19171', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'module/Usuarios/src/Usuarios/Model/Dao/InputDao.php', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'ApacheConf', 'bytes': '711'}, {'name': 'CSS', 'bytes': '249892'}, {'name': 'HTML', 'bytes': '608152'}, {'name': 'JavaScript', 'bytes': '501630'}, {'name': 'PHP', 'bytes': '279300'}]}
<?php class ReverbAttributes { const ORIGIN_MANUAL_SYNC_SINGLE = 'manual_sync_single'; const ORIGIN_MANUAL_SYNC_MULTIPLE = 'manual_sync_multiple'; const ORIGIN_PRODUCT_UPDATE = 'product_update'; const ORIGIN_ORDER = 'order'; const ORIGIN_CRON = 'cron'; protected $module; /** * ReverbSync constructor. * @param Reverb $module_instance */ public function __construct(\Reverb $module_instance) { $this->module = $module_instance; } /** * Get product Reverb attributes * @param integer $productId * @return array */ public function getAttributes($productId) { $sql = new DbQuery(); $sql->select('*') ->from('reverb_attributes', 'ra') ->where('ra.id_product = ' . $productId) ->where('ra.id_lang = ' . $this->module->language_id); $result = Db::getInstance()->getRow($sql); return $result; } /** * Get product Reverb shipping methods * @param integer $attributeId * @return array */ public function getShippingMethods($attributeId) { if (isset($attributeId) && !empty($attributeId)) { $sql = new DbQuery(); $sql->select('rsm.*') ->from('reverb_shipping_methods', 'rsm') ->where('rsm.id_attribute = ' . $attributeId); $result = Db::getInstance()->executeS($sql); return $result; } else { return null; } } }
{'content_hash': '151a496f80ad559547e1eeb14c72184c', 'timestamp': '', 'source': 'github', 'line_count': 60, 'max_line_length': 66, 'avg_line_length': 25.5, 'alnum_prop': 0.5464052287581699, 'repo_name': 'reverbdotcom/prestashop', 'id': '85c718d931d41e21ba7ce788929fc5a722e87119', 'size': '1706', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/reverb/classes/models/ReverbAttributes.php', 'mode': '33261', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '4645'}, {'name': 'JavaScript', 'bytes': '2176'}, {'name': 'PHP', 'bytes': '356442'}, {'name': 'Shell', 'bytes': '4567'}, {'name': 'Smarty', 'bytes': '156215'}]}
<!DOCTYPE HTML> <!-- NewPage --> <html lang="en"> <head><!-- start favicons snippet, use https://realfavicongenerator.net/ --><link rel="apple-touch-icon" sizes="180x180" href="/assets/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png"><link rel="manifest" href="/assets/site.webmanifest"><link rel="mask-icon" href="/assets/safari-pinned-tab.svg" color="#fc4d50"><link rel="shortcut icon" href="/assets/favicon.ico"><meta name="msapplication-TileColor" content="#ffc40d"><meta name="msapplication-config" content="/assets/browserconfig.xml"><meta name="theme-color" content="#ffffff"><!-- end favicons snippet --> <title>com.google.android.exoplayer2.text.ssa Class Hierarchy (ExoPlayer library)</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> <link rel="stylesheet" type="text/css" href="../../../../../../jquery/jquery-ui.css" title="Style"> <script type="text/javascript" src="../../../../../../script.js"></script> <script type="text/javascript" src="../../../../../../jquery/jszip/dist/jszip.min.js"></script> <script type="text/javascript" src="../../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> <!--[if IE]> <script type="text/javascript" src="../../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> <![endif]--> <script type="text/javascript" src="../../../../../../jquery/jquery-3.5.1.js"></script> <script type="text/javascript" src="../../../../../../jquery/jquery-ui.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="com.google.android.exoplayer2.text.ssa Class Hierarchy (ExoPlayer library)"; } } catch(err) { } //--> var pathtoroot = "../../../../../../"; var useModuleDirectories = false; loadScripts(document, 'script');</script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <header role="banner"> <nav role="navigation"> <div class="fixedNav"> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a id="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a id="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../index.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li>Class</li> <li class="navBarCell1Rev">Tree</li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses.html">All&nbsp;Classes</a></li> </ul> <ul class="navListSearch"> <li><label for="search">SEARCH:</label> <input type="text" id="search" value="search" disabled="disabled"> <input type="reset" id="reset" value="reset" disabled="disabled"> </li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> </div> <a id="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> </div> <div class="navPadding">&nbsp;</div> <script type="text/javascript"><!-- $('.navPadding').css('padding-top', $('.fixedNav').css("height")); //--> </script> </nav> </header> <main role="main"> <div class="header"> <h1 class="title">Hierarchy For Package com.google.android.exoplayer2.text.ssa</h1> <span class="packageHierarchyLabel">Package Hierarchies:</span> <ul class="horizontal"> <li><a href="../../../../../../overview-tree.html">All Packages</a></li> </ul> </div> <div class="contentContainer"> <section role="region"> <h2 title="Class Hierarchy">Class Hierarchy</h2> <ul> <li class="circle">java.lang.<a href="https://developer.android.com/reference/java/lang/Object.html" title="class or interface in java.lang" class="externalLink"><span class="typeNameLink" target="_top">Object</span></a> <ul> <li class="circle">com.google.android.exoplayer2.decoder.<a href="../../decoder/SimpleDecoder.html" title="class in com.google.android.exoplayer2.decoder"><span class="typeNameLink">SimpleDecoder</span></a>&lt;I,&#8203;O,&#8203;E&gt; (implements com.google.android.exoplayer2.decoder.<a href="../../decoder/Decoder.html" title="interface in com.google.android.exoplayer2.decoder">Decoder</a>&lt;I,&#8203;O,&#8203;E&gt;) <ul> <li class="circle">com.google.android.exoplayer2.text.<a href="../SimpleSubtitleDecoder.html" title="class in com.google.android.exoplayer2.text"><span class="typeNameLink">SimpleSubtitleDecoder</span></a> (implements com.google.android.exoplayer2.text.<a href="../SubtitleDecoder.html" title="interface in com.google.android.exoplayer2.text">SubtitleDecoder</a>) <ul> <li class="circle">com.google.android.exoplayer2.text.ssa.<a href="SsaDecoder.html" title="class in com.google.android.exoplayer2.text.ssa"><span class="typeNameLink">SsaDecoder</span></a></li> </ul> </li> </ul> </li> </ul> </li> </ul> </section> </div> </main> <footer role="contentinfo"> <nav role="navigation"> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a id="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a id="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../index.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li>Class</li> <li class="navBarCell1Rev">Tree</li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> </div> <a id="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </nav> </footer> </body> </html>
{'content_hash': 'd9237f2e23b3afbf501c81a05c77610f', 'timestamp': '', 'source': 'github', 'line_count': 167, 'max_line_length': 697, 'avg_line_length': 41.38922155688623, 'alnum_prop': 0.6433738425925926, 'repo_name': 'google/ExoPlayer', 'id': '2b31cb08dd7e4f8c2ba7b1892fa1e3ed6a76a0b3', 'size': '6912', 'binary': False, 'copies': '3', 'ref': 'refs/heads/release-v2', 'path': 'docs/doc/reference/com/google/android/exoplayer2/text/ssa/package-tree.html', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C++', 'bytes': '112860'}, {'name': 'CMake', 'bytes': '3728'}, {'name': 'GLSL', 'bytes': '24937'}, {'name': 'Java', 'bytes': '15604745'}, {'name': 'Makefile', 'bytes': '11496'}, {'name': 'Shell', 'bytes': '25523'}]}
@import url('~/css/core.dark.android.css'); Page { background-image: url('~/images/game-board-logo.png'); background-repeat: no-repeat; background-position: center; } actionbar { background-color: black; color: white; } button { font-size: 15vw; horizontal-align: center; /*background-color: #676E5F; color: white;*/ height: 15%; width: 50%; padding: 0%; } Label { font-size: 15vw; text-align: left; border-width: 1; border-color: gray; } TextField.labelAddHighScore { color: black; font-size: 15vw; width: 20%; /*background-color: #676E5F; color: white;*/ } TextField.textFieldAddHighScore { font-size: 15vw; width: 80%; color: blue; /*background-color: white; color: #676E5F;*/ } TextField.disabled { font-size: 15vw; width: 80%; background-color: lightgray; color: black; /*color: #676E5F;*/ } Button.buttonAddHighScore { font-size: 15vw; } TextField { font-size: 15vw; width: 50%; vertical-align: bottom; } GridLayout { padding: 20; } StackLayout { padding: 10; } StackLayout.pushRight { width: 100%; horizontal-align: right; padding: 5; }
{'content_hash': 'fa534c08f06b79166f6ca4a318711e77', 'timestamp': '', 'source': 'github', 'line_count': 78, 'max_line_length': 58, 'avg_line_length': 15.602564102564102, 'alnum_prop': 0.6121610517666393, 'repo_name': 'bradyhouse/house', 'id': '2af186a6a2699c0c2ee687fa323e2f658a3463fe', 'size': '1217', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'fiddles/nativeScript/fiddle-0009-SqliteDb/puzzle/app/view/high-score/add-high-score/add-high-score.css', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '26015'}, {'name': 'CSS', 'bytes': '3541537'}, {'name': 'HTML', 'bytes': '3275889'}, {'name': 'Handlebars', 'bytes': '1593'}, {'name': 'Java', 'bytes': '90609'}, {'name': 'JavaScript', 'bytes': '9249816'}, {'name': 'Less', 'bytes': '3364'}, {'name': 'PHP', 'bytes': '125609'}, {'name': 'Pug', 'bytes': '1758'}, {'name': 'Python', 'bytes': '20858'}, {'name': 'Ruby', 'bytes': '11317'}, {'name': 'SCSS', 'bytes': '37673'}, {'name': 'Shell', 'bytes': '1095755'}, {'name': 'TypeScript', 'bytes': '779887'}]}
package com.sarojaba.namematcher; public class NameMatcher { /** * matching two names. * * @param name1 korean name. ex) 이민호 * @param name2 korean name. ex) 수지 * @return score. */ public static int match(String name1, String name2) { // TODO implement. // references. // http://helloworld.naver.com/helloworld/19187 // http://helloworld.naver.com/helloworld/76650 return 0; } }
{'content_hash': 'a7b7b6e66184f5c03dee5ca7107e78ce', 'timestamp': '', 'source': 'github', 'line_count': 23, 'max_line_length': 54, 'avg_line_length': 17.869565217391305, 'alnum_prop': 0.6642335766423357, 'repo_name': 'sarojaba/name-matcher-test', 'id': '44ed26294f59ded7194163a46519c93682322081', 'size': '421', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/com/sarojaba/namematcher/NameMatcher.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '2767'}]}
<!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.5.0_13) on Sun Jun 29 16:47:06 MSD 2008 --> <TITLE> Uses of Class org.apache.poi.hssf.record.formula.ParenthesisPtg (POI API Documentation) </TITLE> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { parent.document.title="Uses of Class org.apache.poi.hssf.record.formula.ParenthesisPtg (POI API Documentation)"; } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <!-- ========= 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/hssf/record/formula/ParenthesisPtg.html" title="class in org.apache.poi.hssf.record.formula"><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/hssf/record/formula/\class-useParenthesisPtg.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="ParenthesisPtg.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 Class<br>org.apache.poi.hssf.record.formula.ParenthesisPtg</B></H2> </CENTER> No usage of org.apache.poi.hssf.record.formula.ParenthesisPtg <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/hssf/record/formula/ParenthesisPtg.html" title="class in org.apache.poi.hssf.record.formula"><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/hssf/record/formula/\class-useParenthesisPtg.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="ParenthesisPtg.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 2008 The Apache Software Foundation or its licensors, as applicable.</i> </BODY> </HTML>
{'content_hash': '8a21f1ec8ba6dce533b74b746c4889dd', 'timestamp': '', 'source': 'github', 'line_count': 143, 'max_line_length': 246, 'avg_line_length': 44.04895104895105, 'alnum_prop': 0.5966026353389426, 'repo_name': 'stumoodie/MetabolicNotationSubsystem', 'id': '093f9a227d3b2d442fcb376adf62331687facb54', 'size': '6299', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/poi-3.1-FINAL/docs/apidocs/org/apache/poi/hssf/record/formula/class-use/ParenthesisPtg.html', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '3465182'}, {'name': 'Java', 'bytes': '590290'}]}
<?php /* * Plugin Name: Seriously Simple Podcasting * Version: 1.14.10 * Plugin URI: https://www.seriouslysimplepodcasting.com/ * Description: Podcasting the way it's meant to be. No mess, no fuss - just you and your content taking over the world. * Author: Hugh Lashbrooke * Author URI: https://hughlashbrooke.com/ * Requires at least: 4.4 * Tested up to: 4.6 * * Text Domain: seriously-simple-podcasting */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } require_once( 'includes/ssp-functions.php' ); require_once( 'includes/class-ssp-admin.php' ); require_once( 'includes/class-ssp-frontend.php' ); global $ssp_admin, $ss_podcasting; $ssp_admin = new SSP_Admin( __FILE__, '1.14.10' ); $ss_podcasting = new SSP_Frontend( __FILE__, '1.14.10' ); if ( is_admin() ) { global $ssp_settings; require_once( 'includes/class-ssp-settings.php' ); $ssp_settings = new SSP_Settings( __FILE__ ); }
{'content_hash': 'd66a26d502f83e46beccf73a358afe08', 'timestamp': '', 'source': 'github', 'line_count': 32, 'max_line_length': 120, 'avg_line_length': 28.96875, 'alnum_prop': 0.6806903991370011, 'repo_name': 'osqledaren/osqledaren.se', 'id': '32a612f92d94648329c247b1cbbb2552d6b9ce76', 'size': '927', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'wp-content/plugins/seriously-simple-podcasting/seriously-simple-podcasting.php', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '132107'}, {'name': 'JavaScript', 'bytes': '1087185'}, {'name': 'PHP', 'bytes': '946168'}, {'name': 'XSLT', 'bytes': '7254'}]}
<?php require __DIR__ . '/src/Identity/Module.php';
{'content_hash': '082dfc5b9f0ae3b187203b82ae90e3b4', 'timestamp': '', 'source': 'github', 'line_count': 2, 'max_line_length': 45, 'avg_line_length': 25.5, 'alnum_prop': 0.6470588235294118, 'repo_name': 'ruslankus/api133', 'id': '3c1806ecf80e5e8c319a8b0977191e513e06c577', 'size': '51', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'module/Identity/Module.php', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'ApacheConf', 'bytes': '838'}, {'name': 'CSS', 'bytes': '1835'}, {'name': 'HTML', 'bytes': '412715'}, {'name': 'PHP', 'bytes': '74588'}]}
package com.codestd.springstudy.aop.introductions; public interface Animal { public void sleep(); public void shout(); }
{'content_hash': '31b3b37714a1c15f504d25fe3feb748c', 'timestamp': '', 'source': 'github', 'line_count': 8, 'max_line_length': 50, 'avg_line_length': 16.875, 'alnum_prop': 0.7037037037037037, 'repo_name': 'jaune162/Source2015_Learning', 'id': 'e41c916a936ca03f3863c74a9d4131a648c30bc7', 'size': '135', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'springstudy-base/src/main/java/com/codestd/springstudy/aop/introductions/Animal.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '45831'}]}
package com.example.android.wifidirect.discovery; import android.os.Handler; import android.util.Log; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; /** * 客户端Socket 控制类 extends Thread 线程 */ public class ClientSocketHandler extends Thread { private static final String TAG = "ClientSocketHandler"; private Handler handler; private ChatManager chat; private InetAddress mAddress; public ClientSocketHandler(Handler handler, InetAddress groupOwnerAddress) { this.handler = handler; this.mAddress = groupOwnerAddress; } @Override public void run() { Socket socket = new Socket(); try { socket.bind(null); socket.connect(new InetSocketAddress(mAddress.getHostAddress(), WiFiServiceDiscoveryActivity.SERVER_PORT), 5000); Log.w(TAG, "Launching the I/O handler"); chat = new ChatManager(socket, handler); new Thread(chat).start(); } catch (IOException e) { e.printStackTrace(); try { socket.close(); } catch (IOException e1) { e1.printStackTrace(); } return; } } public ChatManager getChat() { return chat; } }
{'content_hash': '5fe60476e5de908ac5f16064e7c04472', 'timestamp': '', 'source': 'github', 'line_count': 52, 'max_line_length': 80, 'avg_line_length': 26.057692307692307, 'alnum_prop': 0.6162361623616236, 'repo_name': 'TBWISK/Wifi-Peer-To-Peer', 'id': '3f2888c009c35bfd6e0c1219c0e8b4e4e4882252', 'size': '1371', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'wiFiDirectServiceDiscovery/src/main/java/com/example/android/wifidirect/discovery/ClientSocketHandler.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '70883'}, {'name': 'Prolog', 'bytes': '213'}]}
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { HttpModule } from '@angular/http'; import { AppComponent } from './app.component'; import { AppRoutingModule, routedComponents } from './app-routing.module'; import { CarDetailComponent } from 'src_app_car-detail_car-detail.component'; import { CarsService } from 'src_app_services_cars.service'; @NgModule({ imports: [ BrowserModule, HttpModule, AppRoutingModule ], declarations: [ AppComponent, CarDetailComponent, routedComponents ], providers: [ CarsService ], bootstrap: [AppComponent], }) export class AppModule { }
{'content_hash': '1b941d7e65ddafc264f1e2c9db514a24', 'timestamp': '', 'source': 'github', 'line_count': 26, 'max_line_length': 77, 'avg_line_length': 27.615384615384617, 'alnum_prop': 0.6643454038997214, 'repo_name': 'irega/angular-scalable-logic-architecture', 'id': '8c5574d377ea18efbcdfdf744a9a16ac308c8245', 'size': '718', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/app/app.module.ts', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'HTML', 'bytes': '1173'}, {'name': 'JavaScript', 'bytes': '22564'}, {'name': 'TypeScript', 'bytes': '8173'}]}
package result import ( "path/filepath" "time" "github.com/getgauge/gauge-proto/go/gauge_messages" "github.com/getgauge/gauge/config" "github.com/getgauge/gauge/env" ) // SuitResult represents the result of suit execution type SuiteResult struct { SpecResults []*SpecResult PreSuite *(gauge_messages.ProtoHookFailure) PostSuite *(gauge_messages.ProtoHookFailure) IsFailed bool SpecsFailedCount int ExecutionTime int64 //in milliseconds UnhandledErrors []error Environment string Tags string ProjectName string Timestamp string SpecsSkippedCount int PreHookMessages []string PostHookMessages []string PreHookScreenshotFiles []string PostHookScreenshotFiles []string PreHookScreenshots [][]byte PostHookScreenshots [][]byte } // NewSuiteResult is a constructor for SuitResult func NewSuiteResult(tags string, startTime time.Time) *SuiteResult { result := new(SuiteResult) result.SpecResults = make([]*SpecResult, 0) result.Timestamp = startTime.Format(config.LayoutForTimeStamp) result.ProjectName = filepath.Base(config.ProjectRoot) result.Environment = env.CurrentEnvironments() result.Tags = tags return result } // SetFailure sets the result to failed func (sr *SuiteResult) SetFailure() { sr.IsFailed = true } // SetSpecsSkippedCount sets the count of specs skipped. func (sr *SuiteResult) SetSpecsSkippedCount() { sr.SpecsSkippedCount = 0 for _, specRes := range sr.SpecResults { if specRes.Skipped { sr.SpecsSkippedCount++ } } } // AddUnhandledError adds the unhandled error to suit result. func (sr *SuiteResult) AddUnhandledError(err error) { sr.UnhandledErrors = append(sr.UnhandledErrors, err) } func (sr *SuiteResult) UpdateExecTime(startTime time.Time) { sr.ExecutionTime = int64(time.Since(startTime) / 1e6) } // AddSpecResult adds a specs result to suit result. func (sr *SuiteResult) AddSpecResult(specResult *SpecResult) { if specResult.IsFailed { sr.IsFailed = true sr.SpecsFailedCount++ } sr.ExecutionTime += specResult.ExecutionTime sr.SpecResults = append(sr.SpecResults, specResult) } // AddSpecResults adds multiple spec results to suit result. func (sr *SuiteResult) AddSpecResults(specResults []*SpecResult) { for _, result := range specResults { sr.AddSpecResult(result) } } func (sr *SuiteResult) GetPreHook() []*gauge_messages.ProtoHookFailure { if sr.PreSuite == nil { return []*gauge_messages.ProtoHookFailure{} } return []*gauge_messages.ProtoHookFailure{sr.PreSuite} } func (sr *SuiteResult) GetPostHook() []*gauge_messages.ProtoHookFailure { if sr.PostSuite == nil { return []*gauge_messages.ProtoHookFailure{} } return []*gauge_messages.ProtoHookFailure{sr.PostSuite} } func (sr *SuiteResult) AddPreHook(f ...*gauge_messages.ProtoHookFailure) { sr.PreSuite = f[0] } func (sr *SuiteResult) AddPostHook(f ...*gauge_messages.ProtoHookFailure) { sr.PostSuite = f[0] } // ExecTime returns the time taken to execute the suit func (sr *SuiteResult) ExecTime() int64 { return sr.ExecutionTime } // GetFailed returns the state of the result func (sr *SuiteResult) GetFailed() bool { return sr.IsFailed } func (sr *SuiteResult) Item() interface{} { return nil }
{'content_hash': '2ff7d693ce2aeb9bf7c8a5cb7f1dd798', 'timestamp': '', 'source': 'github', 'line_count': 122, 'max_line_length': 75, 'avg_line_length': 27.39344262295082, 'alnum_prop': 0.7190305206463196, 'repo_name': 'getgauge/gauge', 'id': 'df3e75a86a909eb8f4fe655022fd8c2752c29529', 'size': '3626', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'execution/result/suiteResult.go', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Go', 'bytes': '1339831'}, {'name': 'JavaScript', 'bytes': '3572'}, {'name': 'NSIS', 'bytes': '10438'}, {'name': 'PowerShell', 'bytes': '4810'}, {'name': 'Python', 'bytes': '1552'}, {'name': 'Ruby', 'bytes': '3061'}, {'name': 'Shell', 'bytes': '25043'}]}
package org.apache.felix.cm.file; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PushbackReader; import java.io.Writer; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.BitSet; import java.util.Collection; import java.util.Dictionary; import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; /** * The <code>ConfigurationHandler</code> class implements configuration reading * form a <code>java.io.InputStream</code> and writing to a * <code>java.io.OutputStream</code> on behalf of the * {@link FilePersistenceManager} class. * * <pre> * cfg = prop &quot;=&quot; value . * prop = symbolic-name . // 1.4.2 of OSGi Core Specification * symbolic-name = token { &quot;.&quot; token } . * token = { [ 0..9 ] | [ a..z ] | [ A..Z ] | '_' | '-' } . * value = [ type ] ( &quot;[&quot; values &quot;]&quot; | &quot;(&quot; values &quot;)&quot; | simple ) . * values = simple { &quot;,&quot; simple } . * simple = &quot;&quot;&quot; stringsimple &quot;&quot;&quot; . * type = // 1-char type code . * stringsimple = // quoted string representation of the value . * </pre> */ public class ConfigurationHandler { protected static final String ENCODING = "UTF-8"; protected static final int TOKEN_NAME = 'N'; protected static final int TOKEN_EQ = '='; protected static final int TOKEN_ARR_OPEN = '['; protected static final int TOKEN_ARR_CLOS = ']'; protected static final int TOKEN_VEC_OPEN = '('; protected static final int TOKEN_VEC_CLOS = ')'; protected static final int TOKEN_COMMA = ','; protected static final int TOKEN_VAL_OPEN = '"'; // '{'; protected static final int TOKEN_VAL_CLOS = '"'; // '}'; // simple types (string & primitive wrappers) protected static final int TOKEN_SIMPLE_STRING = 'T'; protected static final int TOKEN_SIMPLE_INTEGER = 'I'; protected static final int TOKEN_SIMPLE_LONG = 'L'; protected static final int TOKEN_SIMPLE_FLOAT = 'F'; protected static final int TOKEN_SIMPLE_DOUBLE = 'D'; protected static final int TOKEN_SIMPLE_BYTE = 'X'; protected static final int TOKEN_SIMPLE_SHORT = 'S'; protected static final int TOKEN_SIMPLE_CHARACTER = 'C'; protected static final int TOKEN_SIMPLE_BOOLEAN = 'B'; // primitives protected static final int TOKEN_PRIMITIVE_INT = 'i'; protected static final int TOKEN_PRIMITIVE_LONG = 'l'; protected static final int TOKEN_PRIMITIVE_FLOAT = 'f'; protected static final int TOKEN_PRIMITIVE_DOUBLE = 'd'; protected static final int TOKEN_PRIMITIVE_BYTE = 'x'; protected static final int TOKEN_PRIMITIVE_SHORT = 's'; protected static final int TOKEN_PRIMITIVE_CHAR = 'c'; protected static final int TOKEN_PRIMITIVE_BOOLEAN = 'b'; protected static final String CRLF = "\r\n"; protected static final Map code2Type; protected static final Map type2Code; // set of valid characters for "symblic-name" private static final BitSet NAME_CHARS; private static final BitSet TOKEN_CHARS; static { type2Code = new HashMap(); // simple (exclusive String whose type code is not written) type2Code.put( Integer.class, new Integer( TOKEN_SIMPLE_INTEGER ) ); type2Code.put( Long.class, new Integer( TOKEN_SIMPLE_LONG ) ); type2Code.put( Float.class, new Integer( TOKEN_SIMPLE_FLOAT ) ); type2Code.put( Double.class, new Integer( TOKEN_SIMPLE_DOUBLE ) ); type2Code.put( Byte.class, new Integer( TOKEN_SIMPLE_BYTE ) ); type2Code.put( Short.class, new Integer( TOKEN_SIMPLE_SHORT ) ); type2Code.put( Character.class, new Integer( TOKEN_SIMPLE_CHARACTER ) ); type2Code.put( Boolean.class, new Integer( TOKEN_SIMPLE_BOOLEAN ) ); // primitives type2Code.put( Integer.TYPE, new Integer( TOKEN_PRIMITIVE_INT ) ); type2Code.put( Long.TYPE, new Integer( TOKEN_PRIMITIVE_LONG ) ); type2Code.put( Float.TYPE, new Integer( TOKEN_PRIMITIVE_FLOAT ) ); type2Code.put( Double.TYPE, new Integer( TOKEN_PRIMITIVE_DOUBLE ) ); type2Code.put( Byte.TYPE, new Integer( TOKEN_PRIMITIVE_BYTE ) ); type2Code.put( Short.TYPE, new Integer( TOKEN_PRIMITIVE_SHORT ) ); type2Code.put( Character.TYPE, new Integer( TOKEN_PRIMITIVE_CHAR ) ); type2Code.put( Boolean.TYPE, new Integer( TOKEN_PRIMITIVE_BOOLEAN ) ); // reverse map to map type codes to classes, string class mapping // to be added manually, as the string type code is not written and // hence not included in the type2Code map code2Type = new HashMap(); for ( Iterator ti = type2Code.entrySet().iterator(); ti.hasNext(); ) { Map.Entry entry = ( Map.Entry ) ti.next(); code2Type.put( entry.getValue(), entry.getKey() ); } code2Type.put( new Integer( TOKEN_SIMPLE_STRING ), String.class ); NAME_CHARS = new BitSet(); for ( int i = '0'; i <= '9'; i++ ) NAME_CHARS.set( i ); for ( int i = 'a'; i <= 'z'; i++ ) NAME_CHARS.set( i ); for ( int i = 'A'; i <= 'Z'; i++ ) NAME_CHARS.set( i ); NAME_CHARS.set( '_' ); NAME_CHARS.set( '-' ); NAME_CHARS.set( '.' ); NAME_CHARS.set( '\\' ); TOKEN_CHARS = new BitSet(); TOKEN_CHARS.set( TOKEN_EQ ); TOKEN_CHARS.set( TOKEN_ARR_OPEN ); TOKEN_CHARS.set( TOKEN_ARR_CLOS ); TOKEN_CHARS.set( TOKEN_VEC_OPEN ); TOKEN_CHARS.set( TOKEN_VEC_CLOS ); TOKEN_CHARS.set( TOKEN_COMMA ); TOKEN_CHARS.set( TOKEN_VAL_OPEN ); TOKEN_CHARS.set( TOKEN_VAL_CLOS ); TOKEN_CHARS.set( TOKEN_SIMPLE_STRING ); TOKEN_CHARS.set( TOKEN_SIMPLE_INTEGER ); TOKEN_CHARS.set( TOKEN_SIMPLE_LONG ); TOKEN_CHARS.set( TOKEN_SIMPLE_FLOAT ); TOKEN_CHARS.set( TOKEN_SIMPLE_DOUBLE ); TOKEN_CHARS.set( TOKEN_SIMPLE_BYTE ); TOKEN_CHARS.set( TOKEN_SIMPLE_SHORT ); TOKEN_CHARS.set( TOKEN_SIMPLE_CHARACTER ); TOKEN_CHARS.set( TOKEN_SIMPLE_BOOLEAN ); // primitives TOKEN_CHARS.set( TOKEN_PRIMITIVE_INT ); TOKEN_CHARS.set( TOKEN_PRIMITIVE_LONG ); TOKEN_CHARS.set( TOKEN_PRIMITIVE_FLOAT ); TOKEN_CHARS.set( TOKEN_PRIMITIVE_DOUBLE ); TOKEN_CHARS.set( TOKEN_PRIMITIVE_BYTE ); TOKEN_CHARS.set( TOKEN_PRIMITIVE_SHORT ); TOKEN_CHARS.set( TOKEN_PRIMITIVE_CHAR ); TOKEN_CHARS.set( TOKEN_PRIMITIVE_BOOLEAN ); } /** * Writes the configuration data from the <code>Dictionary</code> to the * given <code>OutputStream</code>. * <p> * This method writes at the current location in the stream and does not * close the outputstream. * * @param out * The <code>OutputStream</code> to write the configurtion data * to. * @param properties * The <code>Dictionary</code> to write. * @throws IOException * If an error occurrs writing to the output stream. */ public static void write( OutputStream out, Dictionary properties ) throws IOException { BufferedWriter bw = new BufferedWriter( new OutputStreamWriter( out, ENCODING ) ); for ( Enumeration ce = properties.keys(); ce.hasMoreElements(); ) { String key = ( String ) ce.nextElement(); // cfg = prop "=" value "." . writeQuoted( bw, key ); bw.write( TOKEN_EQ ); writeValue( bw, properties.get( key ) ); bw.write( CRLF ); } bw.flush(); } /** * Reads configuration data from the given <code>InputStream</code> and * returns a new <code>Dictionary</code> object containing the data. * <p> * This method reads from the current location in the stream upto the end of * the stream but does not close the stream at the end. * * @param ins * The <code>InputStream</code> from which to read the * configuration data. * @return A <code>Dictionary</code> object containing the configuration * data. This object may be empty if the stream contains no * configuration data. * @throws IOException * If an error occurrs reading from the stream. This exception * is also thrown if a syntax error is encountered. */ public static Dictionary read( InputStream ins ) throws IOException { return new ConfigurationHandler().readInternal( ins ); } // private constructor, this class is not to be instantiated from the // outside private ConfigurationHandler() { } // ---------- Configuration Input Implementation --------------------------- private int token; private String tokenValue; private int line; private int pos; private Dictionary readInternal( InputStream ins ) throws IOException { BufferedReader br = new BufferedReader( new InputStreamReader( ins, ENCODING ) ); PushbackReader pr = new PushbackReader( br, 1 ); token = 0; tokenValue = null; line = 0; pos = 0; Hashtable configuration = new Hashtable(); token = 0; while ( nextToken( pr ) == TOKEN_NAME ) { String key = tokenValue; // expect equal sign if ( nextToken( pr ) != TOKEN_EQ ) { throw readFailure( token, TOKEN_EQ ); } // expect the token value Object value = readValue( pr ); if ( value != null ) { configuration.put( key, value ); } } return configuration; } /** * value = type ( "[" values "]" | "(" values ")" | simple ) . values = * value { "," value } . simple = "{" stringsimple "}" . type = // 1-char * type code . stringsimple = // quoted string representation of the value . * * @param pr * @return * @throws IOException */ private Object readValue( PushbackReader pr ) throws IOException { // read (optional) type code int type = read( pr ); // read value kind code if type code is not a value kinde code int code; if ( code2Type.containsKey( new Integer( type ) ) ) { code = read( pr ); } else { code = type; type = TOKEN_SIMPLE_STRING; } switch ( code ) { case TOKEN_ARR_OPEN: return readArray( type, pr ); case TOKEN_VEC_OPEN: return readCollection( type, pr ); case TOKEN_VAL_OPEN: Object value = readSimple( type, pr ); ensureNext( pr, TOKEN_VAL_CLOS ); return value; default: return null; } } private Object readArray( int typeCode, PushbackReader pr ) throws IOException { List list = new ArrayList(); for ( ;; ) { int c = read(pr); if ( c == TOKEN_VAL_OPEN ) { Object value = readSimple( typeCode, pr ); if ( value == null ) { // abort due to error return null; } ensureNext( pr, TOKEN_VAL_CLOS ); list.add( value ); c = read( pr ); } if ( c == TOKEN_ARR_CLOS ) { Class type = ( Class ) code2Type.get( new Integer( typeCode ) ); Object array = Array.newInstance( type, list.size() ); for ( int i = 0; i < list.size(); i++ ) { Array.set( array, i, list.get( i ) ); } return array; } else if ( c < 0 ) { return null; } else if ( c != TOKEN_COMMA ) { return null; } } } private Collection readCollection( int typeCode, PushbackReader pr ) throws IOException { Collection collection = new ArrayList(); for ( ;; ) { int c = read( pr ); if ( c == TOKEN_VAL_OPEN ) { Object value = readSimple( typeCode, pr ); if ( value == null ) { // abort due to error return null; } ensureNext( pr, TOKEN_VAL_CLOS ); collection.add( value ); c = read( pr ); } if ( c == TOKEN_VEC_CLOS ) { return collection; } else if ( c < 0 ) { return null; } else if ( c != TOKEN_COMMA ) { return null; } } } private Object readSimple( int code, PushbackReader pr ) throws IOException { switch ( code ) { case -1: return null; case TOKEN_SIMPLE_STRING: return readQuoted( pr ); // Simple/Primitive, only use wrapper classes case TOKEN_SIMPLE_INTEGER: case TOKEN_PRIMITIVE_INT: return Integer.valueOf( readQuoted( pr ) ); case TOKEN_SIMPLE_LONG: case TOKEN_PRIMITIVE_LONG: return Long.valueOf( readQuoted( pr ) ); case TOKEN_SIMPLE_FLOAT: case TOKEN_PRIMITIVE_FLOAT: int fBits = Integer.parseInt( readQuoted( pr ) ); return new Float( Float.intBitsToFloat( fBits ) ); case TOKEN_SIMPLE_DOUBLE: case TOKEN_PRIMITIVE_DOUBLE: long dBits = Long.parseLong( readQuoted( pr ) ); return new Double( Double.longBitsToDouble( dBits ) ); case TOKEN_SIMPLE_BYTE: case TOKEN_PRIMITIVE_BYTE: return Byte.valueOf( readQuoted( pr ) ); case TOKEN_SIMPLE_SHORT: case TOKEN_PRIMITIVE_SHORT: return Short.valueOf( readQuoted( pr ) ); case TOKEN_SIMPLE_CHARACTER: case TOKEN_PRIMITIVE_CHAR: String cString = readQuoted( pr ); if ( cString != null && cString.length() > 0 ) { return new Character( cString.charAt( 0 ) ); } return null; case TOKEN_SIMPLE_BOOLEAN: case TOKEN_PRIMITIVE_BOOLEAN: return Boolean.valueOf( readQuoted( pr ) ); // unknown type code default: return null; } } private void ensureNext( PushbackReader pr, int expected ) throws IOException { int next = read( pr ); if ( next != expected ) { readFailure( next, expected ); } } private boolean checkNext( PushbackReader pr, int expected ) throws IOException { int next = read( pr ); if ( next < 0 ) { return false; } if ( next == expected ) { return true; } return false; } private String readQuoted( PushbackReader pr ) throws IOException { StringBuffer buf = new StringBuffer(); for ( ;; ) { int c = read( pr ); switch ( c ) { // escaped character case '\\': c = read( pr ); switch ( c ) { // well known escapes case 'b': buf.append( '\b' ); break; case 't': buf.append( '\t' ); break; case 'n': buf.append( '\n' ); break; case 'f': buf.append( '\f' ); break; case 'r': buf.append( '\r' ); break; case 'u':// need 4 characters ! char[] cbuf = new char[4]; if ( read( pr, cbuf ) == 4 ) { c = Integer.parseInt( new String( cbuf ), 16 ); buf.append( ( char ) c ); } break; // just an escaped character, unescape default: buf.append( ( char ) c ); } break; // eof case -1: // fall through // separator token case TOKEN_EQ: case TOKEN_VAL_CLOS: pr.unread( c ); return buf.toString(); // no escaping default: buf.append( ( char ) c ); } } } private int nextToken( PushbackReader pr ) throws IOException { int c = ignorableWhiteSpace( pr ); // immediately return EOF if ( c < 0 ) { return ( token = c ); } // check whether there is a name if ( NAME_CHARS.get( c ) || !TOKEN_CHARS.get( c ) ) { // read the property name pr.unread( c ); tokenValue = readQuoted( pr ); return ( token = TOKEN_NAME ); } // check another token if ( TOKEN_CHARS.get( c ) ) { return ( token = c ); } // unexpected character -> so what ?? return ( token = -1 ); } private int ignorableWhiteSpace( PushbackReader pr ) throws IOException { int c = read( pr ); while ( c >= 0 && Character.isWhitespace( ( char ) c ) ) { c = read( pr ); } return c; } private int read( PushbackReader pr ) throws IOException { int c = pr.read(); if ( c == '\r' ) { int c1 = pr.read(); if ( c1 != '\n' ) { pr.unread( c1 ); } c = '\n'; } if ( c == '\n' ) { line++; pos = 0; } else { pos++; } return c; } private int read( PushbackReader pr, char[] buf ) throws IOException { for ( int i = 0; i < buf.length; i++ ) { int c = read( pr ); if ( c >= 0 ) { buf[i] = ( char ) c; } else { return i; } } return buf.length; } private IOException readFailure( int current, int expected ) { return new IOException( "Unexpected token " + current + "; expected: " + expected + " (line=" + line + ", pos=" + pos + ")" ); } // ---------- Configuration Output Implementation -------------------------- private static void writeValue( Writer out, Object value ) throws IOException { Class clazz = value.getClass(); if ( clazz.isArray() ) { writeArray( out, value ); } else if ( value instanceof Collection ) { writeCollection( out, ( Collection ) value ); } else { writeType( out, clazz ); writeSimple( out, value ); } } private static void writeArray( Writer out, Object arrayValue ) throws IOException { int size = Array.getLength( arrayValue ); writeType( out, arrayValue.getClass().getComponentType() ); out.write( TOKEN_ARR_OPEN ); for ( int i = 0; i < size; i++ ) { if ( i > 0 ) out.write( TOKEN_COMMA ); writeSimple( out, Array.get( arrayValue, i ) ); } out.write( TOKEN_ARR_CLOS ); } private static void writeCollection( Writer out, Collection collection ) throws IOException { if ( collection.isEmpty() ) { out.write( TOKEN_VEC_OPEN ); out.write( TOKEN_VEC_CLOS ); } else { Iterator ci = collection.iterator(); Object firstElement = ci.next(); writeType( out, firstElement.getClass() ); out.write( TOKEN_VEC_OPEN ); writeSimple( out, firstElement ); while ( ci.hasNext() ) { out.write( TOKEN_COMMA ); writeSimple( out, ci.next() ); } out.write( TOKEN_VEC_CLOS ); } } private static void writeType( Writer out, Class valueType ) throws IOException { Integer code = ( Integer ) type2Code.get( valueType ); if ( code != null ) { out.write( ( char ) code.intValue() ); } } private static void writeSimple( Writer out, Object value ) throws IOException { if ( value instanceof Double ) { double dVal = ( ( Double ) value ).doubleValue(); value = new Long( Double.doubleToRawLongBits( dVal ) ); } else if ( value instanceof Float ) { float fVal = ( ( Float ) value ).floatValue(); value = new Integer( Float.floatToRawIntBits( fVal ) ); } out.write( TOKEN_VAL_OPEN ); writeQuoted( out, String.valueOf( value ) ); out.write( TOKEN_VAL_CLOS ); } private static void writeQuoted( Writer out, String simple ) throws IOException { if ( simple == null || simple.length() == 0 ) { return; } char c = 0; int len = simple.length(); for ( int i = 0; i < len; i++ ) { c = simple.charAt( i ); switch ( c ) { case '\\': case TOKEN_VAL_CLOS: case ' ': case TOKEN_EQ: out.write( '\\' ); out.write( c ); break; // well known escapes case '\b': out.write( "\\b" ); break; case '\t': out.write( "\\t" ); break; case '\n': out.write( "\\n" ); break; case '\f': out.write( "\\f" ); break; case '\r': out.write( "\\r" ); break; // other escaping default: if ( c < ' ' ) { String t = "000" + Integer.toHexString( c ); out.write( "\\u" + t.substring( t.length() - 4 ) ); } else { out.write( c ); } } } } }
{'content_hash': 'e9312b0f554c549608b490279a2adacd', 'timestamp': '', 'source': 'github', 'line_count': 782, 'max_line_length': 119, 'avg_line_length': 31.531969309462916, 'alnum_prop': 0.4774109822370022, 'repo_name': 'boneman1231/org.apache.felix', 'id': '74ebcd572390bc494c7dbece3d44365125803838', 'size': '25482', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'trunk/configadmin/src/main/java/org/apache/felix/cm/file/ConfigurationHandler.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '1113'}, {'name': 'CSS', 'bytes': '117591'}, {'name': 'Groovy', 'bytes': '2059'}, {'name': 'HTML', 'bytes': '2334581'}, {'name': 'Inno Setup', 'bytes': '4502'}, {'name': 'Java', 'bytes': '21825788'}, {'name': 'JavaScript', 'bytes': '280063'}, {'name': 'Perl', 'bytes': '6262'}, {'name': 'Scala', 'bytes': '27038'}, {'name': 'Shell', 'bytes': '11658'}, {'name': 'XSLT', 'bytes': '136384'}]}
<!DOCTYPE html> <!--[if IE 8]> <html class="no-js lt-ie9" lang="en" > <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <title>Famplify Survey</title> <link rel="stylesheet" href="stylesheets/app.css" /> <link rel="stylesheet" href="stylesheets/wufoo-survey/survey.css"/> <script src="javascripts/vendor/wufoo.js"></script> <script type="text/javascript" src="javascripts/vendor/jquery-1.10.1.min.js"></script> <script type="text/javascript" src="javascripts/vendor/custom.modernizr.js"></script> <script type="text/javascript" src="javascripts/vendor/jquery.localscroll-1.2.7-min.js"></script> <script type="text/javascript" src="javascripts/vendor/jquery.scrollTo-1.4.3.1-min.js"></script> <link rel="icon" type="image/ico" href="favicon.ico"/> <!--FONT AWESOME INCLUDES--> <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css"> <!--[if lt IE 10]> <script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body id="public"> <!-- <div class="row"> <div class="display-meter small-12 large-12 columns"> hey </div> </div> --> <section id="navigation"> <div class="row"> <div class="header-nav large-12 small-12 columns"> <div class="nav-trigger hide-for-large-up"></div> <a class="logo" href="index.html"><img src="images/famplify-logo.png" alt="Famplify" title="Famplify" /></a> <nav class="top-bar"> <ul> <li><a href="#series">Adventures</a></li> <li><a href="families.html">Families</a></li> <li><a href="churches.html">Churches/Groups</a></li> <li><a href="survey.html">Feedback</a></li> <li><a class="show-desktop-up" data-reveal-id="whatisfamplify">What is Famplify?</a></li> <li><a class="show-touch-down-block" href="http://vimeo.com/71525957">What is Famplify?</a></li> </ul> </nav> </div> </div> <div class="desktop-nav-bg"></div> </section> <!-- beginning of wufoo form --> <section class="famplify-wuffo-form"> <div id="container" class="ltr"> <form id="form1" name="form1" class="wufoo rightLabel page" autocomplete="off" enctype="multipart/form-data" method="post" novalidate action="https://famplify.wufoo.com/forms/z7x4m1/#public"> <header id="wufoo-header" class="info"> <h2>Famplify Survey</h2> <div>Famplify is just starting out and we're looking for your help in guiding our decisions on what works and what doesn't.<br /> <br /> Filling out the four questions below would greatly help us!<br /> <br /> Then, if you would like us to keep you updated with only the major changes and releases we put out, please enter your name and email at the end.<br /> <br /> God Bless!</div> </header> <ul class="famplify-survey"> <li id="foli10" class="notranslate"> <label class="desc" id="title10" for="Field10">What did you like best about the Famplify digital family Bible study concept?</label> <div> <textarea id="Field10" name="Field10" class="field textarea medium" spellcheck="true" rows="10" cols="50" tabindex="1" onkeyup=""></textarea> </div> </li> <li id="foli11" class="notranslate"> <label class="desc" id="title11" for="Field11">What did you NOT like about the Famplify digital family Bible study concept?</label> <div> <textarea id="Field11" name="Field11" class="field textarea medium" spellcheck="true" rows="10" cols="50" tabindex="2" onkeyup=""></textarea> </div> </li> <li id="foli116" class="notranslate"> <fieldset> <![if !IE | (gte IE 8)]> <legend id="title116" class="desc">Where would your family more likely employ a digital family Bible study?</legend> <![endif]> <!--[if lt IE 8]> <label id="title116" class="desc"> Where would your family more likely employ a digital family Bible study? </label> <![endif]--> <div> <span> <input id="Field116" name="Field116" type="checkbox" class="field checkbox" value="At home, just as a family" tabindex="3" /> <label class="choice" for="Field116">At home, just as a family</label> </span> <span> <input id="Field117" name="Field117" type="checkbox" class="field checkbox" value="In a group setting (ie. Home Group)" tabindex="4" /> <label class="choice" for="Field117">In a group setting (ie. Home Group)</label> </span> <span> <input id="Field118" name="Field118" type="checkbox" class="field checkbox" value="At a church provided event" tabindex="5" /> <label class="choice" for="Field118">At a church provided event</label> </span> <span> <input id="Field119" name="Field119" type="checkbox" class="field checkbox" value="All of the above" tabindex="6" /> <label class="choice" for="Field119">All of the above</label> </span> <span> <input id="Field120" name="Field120" type="checkbox" class="field checkbox" value="None of the above" tabindex="7" /> <label class="choice" for="Field120">None of the above</label> </span> </div> </fieldset> </li> <li id="foli216" class="notranslate"> <fieldset> <![if !IE | (gte IE 8)]> <legend id="title216" class="desc">What dollar amount would you pay to get a full season (12 episodes) of these digital family Bible studies?</legend> <![endif]> <!--[if lt IE 8]> <label id="title216" class="desc"> What dollar amount would you pay to get a full season (12 episodes) of these digital family Bible studies? </label> <![endif]--> <div> <input id="radioDefault_216" name="Field216" type="hidden" value="" /> <span> <input id="Field216_0" name="Field216" type="radio" class="field radio" value="$1.00 ($0.08 an episode)" tabindex="8" /> <label class="choice" for="Field216_0" > $1.00 ($0.08 an episode)</label> </span> <span> <input id="Field216_1" name="Field216" type="radio" class="field radio" value="$5.00 ($0.42 an episode)" tabindex="9" /> <label class="choice" for="Field216_1" > $5.00 ($0.42 an episode)</label> </span> <span> <input id="Field216_2" name="Field216" type="radio" class="field radio" value="$10.00 ($0.83 an episode)" tabindex="10" /> <label class="choice" for="Field216_2" > $10.00 ($0.83 an episode)</label> </span> <span> <input id="Field216_3" name="Field216" type="radio" class="field radio" value="$12.00 ($1.00 an episode)" tabindex="11" /> <label class="choice" for="Field216_3" > $12.00 ($1.00 an episode)</label> </span> <span> <input id="Field216_4" name="Field216" type="radio" class="field radio" value="$15.00 ($1.25 an episode)" tabindex="12" /> <label class="choice" for="Field216_4" > $15.00 ($1.25 an episode)</label> </span> <span> <input id="Field216_5" name="Field216" type="radio" class="field radio" value="$20.00 ($1.67 an episode)" tabindex="13" /> <label class="choice" for="Field216_5" > $20.00 ($1.67 an episode)</label> </span> <span> <input id="Field216_6" name="Field216" type="radio" class="field radio" value="More than $20.00" tabindex="14" /> <label class="choice" for="Field216_6" > More than $20.00</label> </span> </div> </fieldset> </li> <li id="foli8" class="notranslate"> <label class="desc" id="title8" for="Field8">Name</label> <span> <input id="Field8" name="Field8" type="text" class="field text fn" value="" size="8" tabindex="15" /> <label for="Field8">First</label> </span> <span> <input id="Field9" name="Field9" type="text" class="field text ln" value="" size="14" tabindex="16" /> <label for="Field9">Last</label> </span> </li> <li id="foli1" class="notranslate"> <label class="desc" id="title1" for="Field1">Email</label> <div> <input id="Field1" name="Field1" type="email" spellcheck="false" class="field text large" value=" [email protected]" maxlength="255" tabindex="17" /> </div> <p class="instruct" id="instruct1"><small>We will only use this email to keep you up-to-date with new releases. It will not be used for spam or sold to any other third party.</small></p> </li> <li class="buttons"> <div> <input id="saveForm" name="saveForm" class="white-btn button radius" type="submit" value="Submit"/> </div> </li> <li class="hide"> <label for="comment">Do Not Fill This Out</label> <textarea name="comment" id="comment" rows="1" cols="1"></textarea> <input type="hidden" id="idstamp" name="idstamp" value="XrgBKb0lyu8TaCGN9BqGddxg7rLszKUpcEFJJ8T/Xn4=" /> </li> </ul> </form> </div><!--container--> </section> <!-- End Wufoo form --> <!-- Section #4 --> <section id="footer"> <div class="row"> <div class="large-4 small-12 columns first-column"> <h3>Upcoming Events:</h3> <ul> <li> <div class="group-left"> <div class="content-wrap "> <div class="month">Aug</div> <div class="date">02</div> </div> </div> <div class="group-right"> <div class="content-wrap "> <h5>Adventure & Ice Cream</h5> <p>Special Pre-Screening event for the Journey Bible Series 'PILOT' episode!</p> <p>Calvary Community Church<br/> 12612 N. Black Canyon HWY. 85029<br/> 6:00pm Main Sanctuary</p> <a class="white-btn button tiny radius" href="http://goo.gl/maps/4z4kL" alt="Driving Directions"/>Driving Directions</a> </div> </div> </li> </ul> </div> <div class="large-4 small-12 columns second-column"> <h3>Churches:</h3> <div class="group-left hide-for-small"> <div class="content-wrap "> <img class="cross" src="images/church-cross.png" alt="cross"/> </div> </div> <div class="group-right"> <div class="content-wrap "> <h5>Is YOUR church using Famplify?</h5> <p>As a church or home group you can offer the families in your community some AWESOME benefits! Group rates, family fellowship, a great outreach platform & MORE!</p> <a class="white-btn button tiny radius" href="churches.html" alt="Find Out More">Find Out More</a> </div> </div> </div> <div class="large-4 small-12 columns third-column"> <ul class="social"> <li class="twitter"><img src="images/icon-twitter.png" alt="twitter"/></li> <li><a class="facebook" href="https://www.facebook.com/JourneyBibleSeries" target="_blank" alt="facebook"></a></li> <!--<li><a class="gplus" href="#" alt="google +"></a></li> <li><a class="pinterest" href="#" alt="pinterest"></a></li> <li><a class="vimeo" href="#" alt="vimeo"></a></li>--> </ul> <div class="tweet-box"> <div id="twitter_update_list"> <p>Adventure & Ice Cream Family Night is this Friday @6PM! Don't miss it! #gonnabeawesome</p> </div> <!--<script type=”text/javascript” src=”http://twitter.com/javascripts/blogger.js”></script> <script type=”text/javascript” src=”http://twitter.com/statuses/user_timeline/michaelsidler.json?callback=twitterCallback2&count=1″></script>--> </div> </div> </div> </section> <!--START SCRIPTS--> <script> document.write('<script src=' + ('__proto__' in {} ? 'javascripts/vendor/zepto' : 'javascripts/vendor/jquery') + '.js><\/script>') </script> <script src="javascripts/foundation/foundation.js"></script> <script src="javascripts/foundation/foundation.alerts.js"></script> <script src="javascripts/foundation/foundation.clearing.js"></script> <script src="javascripts/foundation/foundation.cookie.js"></script> <script src="javascripts/foundation/foundation.dropdown.js"></script> <script src="javascripts/foundation/foundation.forms.js"></script> <script src="javascripts/foundation/foundation.interchange.js"></script> <script src="javascripts/foundation/foundation.joyride.js"></script> <script src="javascripts/foundation/foundation.magellan.js"></script> <script src="javascripts/foundation/foundation.orbit.js"></script> <script src="javascripts/foundation/foundation.placeholder.js"></script> <script src="javascripts/foundation/foundation.reveal.js"></script> <script src="javascripts/foundation/foundation.section.js"></script> <script src="javascripts/foundation/foundation.tooltips.js"></script> <script src="javascripts/foundation/foundation.topbar.js"></script> <!--PERSONAL SCRIPTS--> <script type="text/javascript" src="javascripts/cta-hover.js"></script> <script type="text/javascript" src="javascripts/mobile-nav.js"></script> <script type="text/javascript" src="javascripts/parallax-scroll.js"></script> <script type="text/javascript" src="javascripts/scripts.js"></script> <script> $(document).foundation(); </script> <div id="icecreamsocial" class="reveal-modal large"> <div class="flex-video widescreen vimeo"> <iframe src="http://player.vimeo.com/video/67766624?title=0&amp;byline=0&amp;portrait=0" width="865" height="486" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> </div> <a class="close-reveal-modal">&#215;</a> </div> <div id="whatisfamplify" class="reveal-modal large"> <div class="flex-video widescreen vimeo"> <iframe src="http://player.vimeo.com/video/71525957?title=0&amp;byline=0&amp;portrait=0" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> </div> <a class="close-reveal-modal">&#215;</a> </div> <!--GOOGLE ANALYTICS CODE --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-42894468-1', 'famplify.com'); ga('send', 'pageview'); </script> <!-- CLOSE GOOGLE ANALYTICS CODE --> </body> </html>
{'content_hash': '0be001e20611b676fa102e0f9ead9316', 'timestamp': '', 'source': 'github', 'line_count': 326, 'max_line_length': 204, 'avg_line_length': 48.7760736196319, 'alnum_prop': 0.5732343877743538, 'repo_name': 'mwsidler/famplify', 'id': '43030fdf9b5081316577d8c9464a646fb6d3b9a2', 'size': '15917', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'survey.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '545875'}, {'name': 'JavaScript', 'bytes': '156518'}, {'name': 'Ruby', 'bytes': '888'}]}
class TemplateNotFound < Exception attr_reader :message def initialize(msg="Custom resource exception") @message = "Template not found: #{msg}" end end
{'content_hash': '26907cf31a6432a433a4b7b0ad48b955', 'timestamp': '', 'source': 'github', 'line_count': 7, 'max_line_length': 49, 'avg_line_length': 23.428571428571427, 'alnum_prop': 0.7195121951219512, 'repo_name': 'benburkert/poolparty', 'id': '552023d78be49944621a972f36861b2764743c4f', 'size': '164', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/poolparty/exceptions/TemplateNotFound.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Erlang', 'bytes': '686'}, {'name': 'JavaScript', 'bytes': '25082'}, {'name': 'Ruby', 'bytes': '276911'}]}