code
stringlengths
4
1.01M
language
stringclasses
2 values
function browserSupportsHtml5HistoryApi() { return !! (history && history.replaceState && history.pushState); } $(document).ready(function() { //_gaq.push(['_trackEvent', 'Citizen-Format-Smartanswer', 'Load']); if(browserSupportsHtml5HistoryApi()) { var formSelector = ".current form"; initializeHistory(); var getCurrentPosition = function () { var slugArray = document.URL.split('/'); return slugArray.splice(3, slugArray.length).join('/'); }; // events // get new questions on submit $(formSelector).live('submit', function(event) { $('input[type=submit]', this).attr('disabled', 'disabled'); var form = $(this); var postData = form.serializeArray(); reloadQuestions(form.attr('action'), postData); event.preventDefault(); return false; }); // Track when a user clicks on 'Start again' link $('.start-right').live('click', function() { window._gaq && window._gaq.push(['_trackEvent', 'MS_smart_answer', getCurrentPosition(), 'Start again']); reloadQuestions($(this).attr('href')); return false; }); // Track when a user clicks on a 'Change Answer' link $('.link-right a').live('click', function() { var href = $(this).attr('href'); window._gaq && window._gaq.push(['_trackEvent', 'MS_smart_answer', href, 'Change Answer']); reloadQuestions(href); return false; }); // manage next/back by tracking popstate event window.onpopstate = function (event) { if(event.state !== null) { updateContent(event.state['html_fragment']); } else { return false; } }; } $('#current-error').focus(); // helper functions function toJsonUrl(url) { var parts = url.split('?'); var json_url = parts[0].replace(/\/$/, "") + ".json"; if (parts[1]) { json_url += "?"; json_url += parts[1]; } return window.location.protocol + "//" + window.location.host + json_url; } function fromJsonUrl(url) { return url.replace(/\.json$/, ""); } function redirectToNonAjax(url) { window.location = url; } // replace all the questions currently in the page with whatever is returned for given url function reloadQuestions(url, params) { var url = toJsonUrl(url); addLoading('<p class="next-step">Loading next step&hellip;</p>'); $.ajax(url, { type: 'GET', dataType:'json', data: params, timeout: 10000, error: function(jqXHR, textStatus, errorStr) { var paramStr = $.param(params); redirectToNonAjax(url.replace('.json', '?' + paramStr).replace('??', '?')); }, success: function(data, textStatus, jqXHR) { addToHistory(data); updateContent(data['html_fragment']); } }); } // manage the URL function addToHistory(data) { history.pushState(data, data['title'], data['url']); window._gaq && window._gaq.push(['_trackPageview', data['url']]); } // add an indicator of loading function addLoading(fragment){ $('#content .step.current') .addClass('loading') .find('form .next-question') .append(fragment); $.event.trigger('smartanswerAnswer'); }; // update the content (i.e. plonk in the html fragment) function updateContent(fragment){ $('.smart_answer #js-replaceable').html(fragment); $.event.trigger('smartanswerAnswer'); if ($(".outcome").length !== 0) { $.event.trigger('smartanswerOutcome'); } } function initializeHistory(data) { if (! browserSupportsHtml5HistoryApi() && window.location.pathname.match(/\/.*\//) ) { addToHistory({url: window.location.pathname}); } data = { html_fragment: $('.smart_answer #js-replaceable').html(), title: "Question", url: window.location.toString() }; history.replaceState(data, data['title'], data['url']); } var contentPosition = { latestQuestionTop : 0, latestQuestionIsOffScreen: function($latestQuestion) { var top_of_view = $(window).scrollTop(); this.latestQuestionTop = $latestQuestion.offset().top; return (this.latestQuestionTop < top_of_view); }, correctOffscreen: function() { $latestQuestion = $('.smart_answer .done-questions li.done:last-child'); if (!$latestQuestion.length) { $latestQuestion = $('body'); } if(this.latestQuestionIsOffScreen($latestQuestion)) { $(window).scrollTop(this.latestQuestionTop); } }, init: function() { var self = this; $(document).bind('smartanswerAnswer', function() { self.correctOffscreen(); $('.meta-wrapper').show(); }); // Show feedback form in outcomes $(document).bind('smartanswerOutcome', function() { $('.report-a-problem-container form #url').val(window.location.href); $('.meta-wrapper').show(); }); } }; contentPosition.init(); });
Java
.crystal-tooltip { position: absolute; z-index: 1030; display: block; padding: 5px; font-size: 13px; opacity: 0; filter: alpha(opacity=0); visibility: visible; } .crystal-tooltip.shown { opacity: .8; } .crystal-tooltip.bottom { margin-bottom: -3px; padding-top: 9px; } .crystal-tooltip.top { margin-top: -3px; padding-bottom: 9px; } .tooltip-arrow { position: absolute; width: 0; height: 0; border-color: transparent; border-style: solid; } .crystal-tooltip.top .tooltip-arrow { border-top-color: #34495e; border-width: 9px 9px 0; bottom: 0; margin-left: -9px; left: 50%; } .crystal-tooltip.bottom .tooltip-arrow { border-bottom-color: #34495e; border-width: 0 9px 9px; bottom: 0; margin-left: -9px; left: 50%; top: 0; } .tooltip-inner { background-color: #34495e; line-height: 18px; padding: 12px 12px; text-align: center; width: 183px; border-radius: 6px; max-width: 200px; color: #ffffff; }
Java
<?php /* * This file is part of the Symfony package. * (c) Fabien Potencier <fabien.potencier@symfony-project.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Tests\Component\Security\User; use Symfony\Component\Security\User\AccountChecker; class AccountCheckerTest extends \PHPUnit_Framework_TestCase { public function testCheckPreAuthNotAdvancedAccountInterface() { $checker = new AccountChecker(); $this->assertNull($checker->checkPreAuth($this->getMock('Symfony\Component\Security\User\AccountInterface'))); } public function testCheckPreAuthPass() { $checker = new AccountChecker(); $account = $this->getMock('Symfony\Component\Security\User\AdvancedAccountInterface'); $account->expects($this->once())->method('isCredentialsNonExpired')->will($this->returnValue(true)); $this->assertNull($checker->checkPreAuth($account)); } /** * @expectedException Symfony\Component\Security\Exception\CredentialsExpiredException */ public function testCheckPreAuthCredentialsExpired() { $checker = new AccountChecker(); $account = $this->getMock('Symfony\Component\Security\User\AdvancedAccountInterface'); $account->expects($this->once())->method('isCredentialsNonExpired')->will($this->returnValue(false)); $checker->checkPreAuth($account); } public function testCheckPostAuthNotAdvancedAccountInterface() { $checker = new AccountChecker(); $this->assertNull($checker->checkPostAuth($this->getMock('Symfony\Component\Security\User\AccountInterface'))); } public function testCheckPostAuthPass() { $checker = new AccountChecker(); $account = $this->getMock('Symfony\Component\Security\User\AdvancedAccountInterface'); $account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(true)); $account->expects($this->once())->method('isEnabled')->will($this->returnValue(true)); $account->expects($this->once())->method('isAccountNonExpired')->will($this->returnValue(true)); $this->assertNull($checker->checkPostAuth($account)); } /** * @expectedException Symfony\Component\Security\Exception\LockedException */ public function testCheckPostAuthAccountLocked() { $checker = new AccountChecker(); $account = $this->getMock('Symfony\Component\Security\User\AdvancedAccountInterface'); $account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(false)); $checker->checkPostAuth($account); } /** * @expectedException Symfony\Component\Security\Exception\DisabledException */ public function testCheckPostAuthDisabled() { $checker = new AccountChecker(); $account = $this->getMock('Symfony\Component\Security\User\AdvancedAccountInterface'); $account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(true)); $account->expects($this->once())->method('isEnabled')->will($this->returnValue(false)); $checker->checkPostAuth($account); } /** * @expectedException Symfony\Component\Security\Exception\AccountExpiredException */ public function testCheckPostAuthAccountExpired() { $checker = new AccountChecker(); $account = $this->getMock('Symfony\Component\Security\User\AdvancedAccountInterface'); $account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(true)); $account->expects($this->once())->method('isEnabled')->will($this->returnValue(true)); $account->expects($this->once())->method('isAccountNonExpired')->will($this->returnValue(false)); $checker->checkPostAuth($account); } }
Java
Ext.define('CustomIcons.view.Main', { extend: 'Ext.tab.Panel', xtype: 'main', requires: [ 'Ext.TitleBar', 'Ext.Video' ], config: { tabBarPosition: 'bottom', items: [ { title: 'Welcome', iconCls: 'headphones', styleHtmlContent: true, scrollable: true, items: { docked: 'top', xtype: 'titlebar', title: 'Welcome to Sencha Touch 2' }, html: [ "You've just generated a new Sencha Touch 2 project. What you're looking at right now is the ", "contents of <a target='_blank' href=\"app/view/Main.js\">app/view/Main.js</a> - edit that file ", "and refresh to change what's rendered here." ].join("") }, { title: 'Get Started', iconCls: 'facebook2', items: [ { docked: 'top', xtype: 'titlebar', title: 'Getting Started' }, { xtype: 'video', url: 'http://av.vimeo.com/64284/137/87347327.mp4?token=1330978144_f9b698fea38cd408d52a2393240c896c', posterUrl: 'http://b.vimeocdn.com/ts/261/062/261062119_640.jpg' } ] } ] } });
Java
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _index = require('../../../_lib/setUTCDay/index.js'); var _index2 = _interopRequireDefault(_index); var _index3 = require('../../../_lib/setUTCISODay/index.js'); var _index4 = _interopRequireDefault(_index3); var _index5 = require('../../../_lib/setUTCISOWeek/index.js'); var _index6 = _interopRequireDefault(_index5); var _index7 = require('../../../_lib/setUTCISOWeekYear/index.js'); var _index8 = _interopRequireDefault(_index7); var _index9 = require('../../../_lib/startOfUTCISOWeek/index.js'); var _index10 = _interopRequireDefault(_index9); var _index11 = require('../../../_lib/startOfUTCISOWeekYear/index.js'); var _index12 = _interopRequireDefault(_index11); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var MILLISECONDS_IN_MINUTE = 60000; function setTimeOfDay(hours, timeOfDay) { var isAM = timeOfDay === 0; if (isAM) { if (hours === 12) { return 0; } } else { if (hours !== 12) { return 12 + hours; } } return hours; } var units = { twoDigitYear: { priority: 10, set: function set(dateValues, value) { var century = Math.floor(dateValues.date.getUTCFullYear() / 100); var year = century * 100 + value; dateValues.date.setUTCFullYear(year, 0, 1); dateValues.date.setUTCHours(0, 0, 0, 0); return dateValues; } }, year: { priority: 10, set: function set(dateValues, value) { dateValues.date.setUTCFullYear(value, 0, 1); dateValues.date.setUTCHours(0, 0, 0, 0); return dateValues; } }, isoYear: { priority: 10, set: function set(dateValues, value, options) { dateValues.date = (0, _index12.default)((0, _index8.default)(dateValues.date, value, options), options); return dateValues; } }, quarter: { priority: 20, set: function set(dateValues, value) { dateValues.date.setUTCMonth((value - 1) * 3, 1); dateValues.date.setUTCHours(0, 0, 0, 0); return dateValues; } }, month: { priority: 30, set: function set(dateValues, value) { dateValues.date.setUTCMonth(value, 1); dateValues.date.setUTCHours(0, 0, 0, 0); return dateValues; } }, isoWeek: { priority: 40, set: function set(dateValues, value, options) { dateValues.date = (0, _index10.default)((0, _index6.default)(dateValues.date, value, options), options); return dateValues; } }, dayOfWeek: { priority: 50, set: function set(dateValues, value, options) { dateValues.date = (0, _index2.default)(dateValues.date, value, options); dateValues.date.setUTCHours(0, 0, 0, 0); return dateValues; } }, dayOfISOWeek: { priority: 50, set: function set(dateValues, value, options) { dateValues.date = (0, _index4.default)(dateValues.date, value, options); dateValues.date.setUTCHours(0, 0, 0, 0); return dateValues; } }, dayOfMonth: { priority: 50, set: function set(dateValues, value) { dateValues.date.setUTCDate(value); dateValues.date.setUTCHours(0, 0, 0, 0); return dateValues; } }, dayOfYear: { priority: 50, set: function set(dateValues, value) { dateValues.date.setUTCMonth(0, value); dateValues.date.setUTCHours(0, 0, 0, 0); return dateValues; } }, timeOfDay: { priority: 60, set: function set(dateValues, value, options) { dateValues.timeOfDay = value; return dateValues; } }, hours: { priority: 70, set: function set(dateValues, value, options) { dateValues.date.setUTCHours(value, 0, 0, 0); return dateValues; } }, timeOfDayHours: { priority: 70, set: function set(dateValues, value, options) { var timeOfDay = dateValues.timeOfDay; if (timeOfDay != null) { value = setTimeOfDay(value, timeOfDay); } dateValues.date.setUTCHours(value, 0, 0, 0); return dateValues; } }, minutes: { priority: 80, set: function set(dateValues, value) { dateValues.date.setUTCMinutes(value, 0, 0); return dateValues; } }, seconds: { priority: 90, set: function set(dateValues, value) { dateValues.date.setUTCSeconds(value, 0); return dateValues; } }, milliseconds: { priority: 100, set: function set(dateValues, value) { dateValues.date.setUTCMilliseconds(value); return dateValues; } }, timezone: { priority: 110, set: function set(dateValues, value) { dateValues.date = new Date(dateValues.date.getTime() - value * MILLISECONDS_IN_MINUTE); return dateValues; } }, timestamp: { priority: 120, set: function set(dateValues, value) { dateValues.date = new Date(value); return dateValues; } } }; exports.default = units; module.exports = exports['default'];
Java
<script src='<?php echo base_url()?>assets/js/tinymce/tinymce.min.js'></script> <script> tinymce.init({ selector: '#myartikel' }); </script> <form action="<?php echo base_url('admin/Cartikel_g/proses_add_artikel') ?>" method="post" enctype="multipart/form-data"> <div class="col-md-8 whitebox"> <h3 class="container">Tambah Artikel</h3> <hr/> <input type="hidden" name="id_user" value=""> <div class="form-group bts-ats"> <label class="col-sm-2 control-label">Judul</label> <div class="col-sm-10"> <input type="text" name="judul_artikel" class="form-control" placeholder="judul"> </div> <div class="sambungfloat"></div> </div> <div class="col-md-12"> <textarea id="myartikel" name="isi_artikel" rows="15"></textarea> </div> <button type="submit" name="submit" value="submit" class="btn kanan bts-ats btn-primary">Publish</button> </div> <div class="col-md-4 whitebox"> <div class=" form-group artikelkat"> <div class="form-group bts-ats"> <label class="col-sm-3 control-label">Kategori</label> <div class="col-sm-8"> <select name="id_kategori" class="form-control"> <?php foreach ($getkategori as $kat): ?> <option value="<?php echo $kat->id_kategori; ?>"><?php echo $kat->judul_kategori; ?></option> <?php endforeach ?> </select> </div> <div class="sambungfloat"></div> </div> <div class="form-group bts-ats"> <label class="col-sm-3 control-label">Tanggal</label> <div class="col-sm-8"> <input type="date" name="tgl_artikel" class="form-control" value="<?php echo date('Y-m-d'); ?>"> </div> <div class="sambungfloat"></div> </div> <div class="form-group bts-ats"> <label class="col-sm-3 control-label">Gambar</label> <div class="col-sm-8"> <form> <img id="preview" class="imgbox" src="<?php echo base_url('assets/img/artikel/default.jpg') ?>" alt="preview gambar"> <input id="filedata" type="file" name="photo" accept="image/*" /> </form> </div> <div class="sambungfloat"></div> </div> </div> </div> </form> <script> function readURL(input) { if (input.files && input.files[0]) { var reader = new FileReader(); reader.onload = function (e) { $('#preview').attr('src', e.target.result); } reader.readAsDataURL(input.files[0]); } } $('#filedata').change(function(){ readURL(this); }); </script>
Java
// Copyright (c) 2018 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SPAN_H #define BITCOIN_SPAN_H #include <algorithm> #include <cassert> #include <cstddef> #include <cstdint> #include <type_traits> #ifdef DEBUG #define CONSTEXPR_IF_NOT_DEBUG #define ASSERT_IF_DEBUG(x) assert((x)) #else #define CONSTEXPR_IF_NOT_DEBUG constexpr #define ASSERT_IF_DEBUG(x) #endif #if defined(__clang__) #if __has_attribute(lifetimebound) #define SPAN_ATTR_LIFETIMEBOUND [[clang::lifetimebound]] #else #define SPAN_ATTR_LIFETIMEBOUND #endif #else #define SPAN_ATTR_LIFETIMEBOUND #endif /** * A Span is an object that can refer to a contiguous sequence of objects. * * It implements a subset of C++20's std::span. * * Things to be aware of when writing code that deals with Spans: * * - Similar to references themselves, Spans are subject to reference lifetime * issues. The user is responsible for making sure the objects pointed to by * a Span live as long as the Span is used. For example: * * std::vector<int> vec{1,2,3,4}; * Span<int> sp(vec); * vec.push_back(5); * printf("%i\n", sp.front()); // UB! * * may exhibit undefined behavior, as increasing the size of a vector may * invalidate references. * * - One particular pitfall is that Spans can be constructed from temporaries, * but this is unsafe when the Span is stored in a variable, outliving the * temporary. For example, this will compile, but exhibits undefined behavior: * * Span<const int> sp(std::vector<int>{1, 2, 3}); * printf("%i\n", sp.front()); // UB! * * The lifetime of the vector ends when the statement it is created in ends. * Thus the Span is left with a dangling reference, and using it is undefined. * * - Due to Span's automatic creation from range-like objects (arrays, and data * types that expose a data() and size() member function), functions that * accept a Span as input parameter can be called with any compatible * range-like object. For example, this works: * * void Foo(Span<const int> arg); * * Foo(std::vector<int>{1, 2, 3}); // Works * * This is very useful in cases where a function truly does not care about the * container, and only about having exactly a range of elements. However it * may also be surprising to see automatic conversions in this case. * * When a function accepts a Span with a mutable element type, it will not * accept temporaries; only variables or other references. For example: * * void FooMut(Span<int> arg); * * FooMut(std::vector<int>{1, 2, 3}); // Does not compile * std::vector<int> baz{1, 2, 3}; * FooMut(baz); // Works * * This is similar to how functions that take (non-const) lvalue references * as input cannot accept temporaries. This does not work either: * * void FooVec(std::vector<int>& arg); * FooVec(std::vector<int>{1, 2, 3}); // Does not compile * * The idea is that if a function accepts a mutable reference, a meaningful * result will be present in that variable after the call. Passing a temporary * is useless in that context. */ template <typename C> class Span { C *m_data; std::size_t m_size; template <class T> struct is_Span_int : public std::false_type {}; template <class T> struct is_Span_int<Span<T>> : public std::true_type {}; template <class T> struct is_Span : public is_Span_int<typename std::remove_cv<T>::type> {}; public: constexpr Span() noexcept : m_data(nullptr), m_size(0) {} /** * Construct a span from a begin pointer and a size. * * This implements a subset of the iterator-based std::span constructor in * C++20, which is hard to implement without std::address_of. */ template <typename T, typename std::enable_if< std::is_convertible<T (*)[], C (*)[]>::value, int>::type = 0> constexpr Span(T *begin, std::size_t size) noexcept : m_data(begin), m_size(size) {} /** * Construct a span from a begin and end pointer. * * This implements a subset of the iterator-based std::span constructor in * C++20, which is hard to implement without std::address_of. */ template <typename T, typename std::enable_if< std::is_convertible<T (*)[], C (*)[]>::value, int>::type = 0> CONSTEXPR_IF_NOT_DEBUG Span(T *begin, T *end) noexcept : m_data(begin), m_size(end - begin) { ASSERT_IF_DEBUG(end >= begin); } /** * Implicit conversion of spans between compatible types. * * Specifically, if a pointer to an array of type O can be implicitly * converted to a pointer to an array of type C, then permit implicit * conversion of Span<O> to Span<C>. This matches the behavior of the * corresponding C++20 std::span constructor. * * For example this means that a Span<T> can be converted into a Span<const * T>. */ template <typename O, typename std::enable_if< std::is_convertible<O (*)[], C (*)[]>::value, int>::type = 0> constexpr Span(const Span<O> &other) noexcept : m_data(other.m_data), m_size(other.m_size) {} /** Default copy constructor. */ constexpr Span(const Span &) noexcept = default; /** Default assignment operator. */ Span &operator=(const Span &other) noexcept = default; /** Construct a Span from an array. This matches the corresponding C++20 * std::span constructor. */ template <int N> constexpr Span(C (&a)[N]) noexcept : m_data(a), m_size(N) {} /** * Construct a Span for objects with .data() and .size() (std::string, * std::array, std::vector, ...). * * This implements a subset of the functionality provided by the C++20 * std::span range-based constructor. * * To prevent surprises, only Spans for constant value types are supported * when passing in temporaries. Note that this restriction does not exist * when converting arrays or other Spans (see above). */ template <typename V> constexpr Span( V &other SPAN_ATTR_LIFETIMEBOUND, typename std::enable_if< !is_Span<V>::value && std::is_convertible< typename std::remove_pointer< decltype(std::declval<V &>().data())>::type (*)[], C (*)[]>::value && std::is_convertible<decltype(std::declval<V &>().size()), std::size_t>::value, std::nullptr_t>::type = nullptr) : m_data(other.data()), m_size(other.size()) {} template <typename V> constexpr Span( const V &other SPAN_ATTR_LIFETIMEBOUND, typename std::enable_if< !is_Span<V>::value && std::is_convertible< typename std::remove_pointer< decltype(std::declval<const V &>().data())>::type (*)[], C (*)[]>::value && std::is_convertible<decltype(std::declval<const V &>().size()), std::size_t>::value, std::nullptr_t>::type = nullptr) : m_data(other.data()), m_size(other.size()) {} constexpr C *data() const noexcept { return m_data; } constexpr C *begin() const noexcept { return m_data; } constexpr C *end() const noexcept { return m_data + m_size; } CONSTEXPR_IF_NOT_DEBUG C &front() const noexcept { ASSERT_IF_DEBUG(size() > 0); return m_data[0]; } CONSTEXPR_IF_NOT_DEBUG C &back() const noexcept { ASSERT_IF_DEBUG(size() > 0); return m_data[m_size - 1]; } constexpr std::size_t size() const noexcept { return m_size; } constexpr bool empty() const noexcept { return size() == 0; } CONSTEXPR_IF_NOT_DEBUG C &operator[](std::size_t pos) const noexcept { ASSERT_IF_DEBUG(size() > pos); return m_data[pos]; } CONSTEXPR_IF_NOT_DEBUG Span<C> subspan(std::size_t offset) const noexcept { ASSERT_IF_DEBUG(size() >= offset); return Span<C>(m_data + offset, m_size - offset); } CONSTEXPR_IF_NOT_DEBUG Span<C> subspan(std::size_t offset, std::size_t count) const noexcept { ASSERT_IF_DEBUG(size() >= offset + count); return Span<C>(m_data + offset, count); } CONSTEXPR_IF_NOT_DEBUG Span<C> first(std::size_t count) const noexcept { ASSERT_IF_DEBUG(size() >= count); return Span<C>(m_data, count); } CONSTEXPR_IF_NOT_DEBUG Span<C> last(std::size_t count) const noexcept { ASSERT_IF_DEBUG(size() >= count); return Span<C>(m_data + m_size - count, count); } friend constexpr bool operator==(const Span &a, const Span &b) noexcept { return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin()); } friend constexpr bool operator!=(const Span &a, const Span &b) noexcept { return !(a == b); } friend constexpr bool operator<(const Span &a, const Span &b) noexcept { return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end()); } friend constexpr bool operator<=(const Span &a, const Span &b) noexcept { return !(b < a); } friend constexpr bool operator>(const Span &a, const Span &b) noexcept { return (b < a); } friend constexpr bool operator>=(const Span &a, const Span &b) noexcept { return !(a < b); } template <typename O> friend class Span; }; // MakeSpan helps constructing a Span of the right type automatically. /** MakeSpan for arrays: */ template <typename A, int N> Span<A> constexpr MakeSpan(A (&a)[N]) { return Span<A>(a, N); } /** MakeSpan for temporaries / rvalue references, only supporting const output. */ template <typename V> constexpr auto MakeSpan(V &&v SPAN_ATTR_LIFETIMEBOUND) -> typename std::enable_if< !std::is_lvalue_reference<V>::value, Span<const typename std::remove_pointer<decltype(v.data())>::type>>::type { return std::forward<V>(v); } /** MakeSpan for (lvalue) references, supporting mutable output. */ template <typename V> constexpr auto MakeSpan(V &v SPAN_ATTR_LIFETIMEBOUND) -> Span<typename std::remove_pointer<decltype(v.data())>::type> { return v; } /** Pop the last element off a span, and return a reference to that element. */ template <typename T> T &SpanPopBack(Span<T> &span) { size_t size = span.size(); ASSERT_IF_DEBUG(size > 0); T &back = span[size - 1]; span = Span<T>(span.data(), size - 1); return back; } // Helper functions to safely cast to uint8_t pointers. inline uint8_t *UCharCast(char *c) { return (uint8_t *)c; } inline uint8_t *UCharCast(uint8_t *c) { return c; } inline const uint8_t *UCharCast(const char *c) { return (uint8_t *)c; } inline const uint8_t *UCharCast(const uint8_t *c) { return c; } // Helper function to safely convert a Span to a Span<[const] uint8_t>. template <typename T> constexpr auto UCharSpanCast(Span<T> s) -> Span<typename std::remove_pointer<decltype(UCharCast(s.data()))>::type> { return {UCharCast(s.data()), s.size()}; } /** Like MakeSpan, but for (const) uint8_t member types only. Only works * for (un)signed char containers. */ template <typename V> constexpr auto MakeUCharSpan(V &&v) -> decltype(UCharSpanCast(MakeSpan(std::forward<V>(v)))) { return UCharSpanCast(MakeSpan(std::forward<V>(v))); } #endif // BITCOIN_SPAN_H
Java
# frozen_string_literal: true module ArrayUtil def self.insert_before(array, new_element, element) idx = array.index(element) || -1 array.insert(idx, new_element) end def self.insert_after(array, new_element, element) idx = array.index(element) || -2 array.insert(idx + 1, new_element) end end
Java
<!DOCTYPE html> <html lang="en-gb" dir="ltr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>List component - UIkit documentation</title> <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"> <link rel="apple-touch-icon-precomposed" href="images/apple-touch-icon.png"> <link id="data-uikit-theme" rel="stylesheet" href="css/uikit.docs.min.css"> <link rel="stylesheet" href="css/docs.css"> <link rel="stylesheet" href="../vendor/highlight/highlight.css"> <script src="../vendor/jquery.js"></script> <script src="../dist/js/uikit.min.js"></script> <script src="../vendor/highlight/highlight.js"></script> <script src="js/docs.js"></script> </head> <body class="tm-background"> <nav class="tm-navbar uk-navbar uk-navbar-attached"> <div class="uk-container uk-container-center"> <a class="uk-navbar-brand uk-hidden-small" href="../index.html"><img class="uk-margin uk-margin-remove" src="images/logo_uikit.svg" width="90" height="30" title="UIkit" alt="UIkit"></a> <ul class="uk-navbar-nav uk-hidden-small"> <li><a href="documentation_get-started.html">Get Started</a></li> <li class="uk-active"><a href="components.html">Components</a></li> <li><a href="addons.html">Add-ons</a></li> <li><a href="customizer.html">Customizer</a></li> <li><a href="../showcase/index.html">Showcase</a></li> </ul> <a href="#tm-offcanvas" class="uk-navbar-toggle uk-visible-small" data-uk-offcanvas></a> <div class="uk-navbar-brand uk-navbar-center uk-visible-small"><img src="images/logo_uikit.svg" width="90" height="30" title="UIkit" alt="UIkit"></div> </div> </nav> <div class="tm-middle"> <div class="uk-container uk-container-center"> <div class="uk-grid" data-uk-grid-margin> <div class="tm-sidebar uk-width-medium-1-4 uk-hidden-small"> <ul class="tm-nav uk-nav" data-uk-nav> <li class="uk-nav-header">Defaults</li> <li><a href="base.html">Base</a></li> <li><a href="print.html">Print</a></li> <li class="uk-nav-header">Layout</li> <li><a href="grid.html">Grid</a></li> <li><a href="panel.html">Panel</a></li> <li><a href="article.html">Article</a></li> <li><a href="comment.html">Comment</a></li> <li><a href="utility.html">Utility</a></li> <li class="uk-nav-header">Navigations</li> <li><a href="nav.html">Nav</a></li> <li><a href="navbar.html">Navbar</a></li> <li><a href="subnav.html">Subnav</a></li> <li><a href="breadcrumb.html">Breadcrumb</a></li> <li><a href="pagination.html">Pagination</a></li> <li><a href="tab.html">Tab</a></li> <li class="uk-nav-header">Elements</li> <li class="uk-active"><a href="list.html">List</a></li> <li><a href="description-list.html">Description list</a></li> <li><a href="table.html">Table</a></li> <li><a href="form.html">Form</a></li> <li class="uk-nav-header">Common</li> <li><a href="button.html">Button</a></li> <li><a href="icon.html">Icon</a></li> <li><a href="close.html">Close</a></li> <li><a href="badge.html">Badge</a></li> <li><a href="alert.html">Alert</a></li> <li><a href="thumbnail.html">Thumbnail</a></li> <li><a href="overlay.html">Overlay</a></li> <li><a href="progress.html">Progress</a></li> <li><a href="text.html">Text</a></li> <li><a href="animation.html">Animation</a></li> <li class="uk-nav-header">JavaScript</li> <li><a href="dropdown.html">Dropdown</a></li> <li><a href="modal.html">Modal</a></li> <li><a href="offcanvas.html">Off-canvas</a></li> <li><a href="switcher.html">Switcher</a></li> <li><a href="toggle.html">Toggle</a></li> <li><a href="tooltip.html">Tooltip</a></li> <li><a href="scrollspy.html">Scrollspy</a></li> <li><a href="smooth-scroll.html">Smooth scroll</a></li> </ul> </div> <div class="tm-main uk-width-medium-3-4"> <article class="uk-article"> <h1 class="uk-article-title">List</h1> <p class="uk-article-lead">Easily create nicely looking lists, which come in different styles.</p> <h2 id="usage"><a href="#usage" class="uk-link-reset">Usage</a></h2> <p>To apply this component, add the <code>.uk-list</code> class to an unordered or ordered list. The list will now display without any spacing or list-style.</p> <h3 class="tm-article-subtitle">Example</h3> <ul class="uk-list"> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> </ul> <h3 class="tm-article-subtitle">Markup</h3> <pre><code>&lt;ul class="uk-list"&gt; &lt;li&gt;...&lt;/li&gt; &lt;li&gt;...&lt;/li&gt; &lt;li&gt;...&lt;/li&gt; &lt;/ul&gt;</code></pre> <hr class="uk-article-divider"> <h2 id="modifiers"><a href="#modifiers" class="uk-link-reset">Modifiers</a></h2> <p>To display the list in a different style, just add a modifier class to the the <code>.uk-list</code> class. The modifiers of the List component are <em>not</em> combinable with each other.</p> <h3>List line</h3> <p>Add the <code>.uk-list-line</code> class to separate list items with lines.</p> <h4 class="tm-article-subtitle">Example</h4> <ul class="uk-list uk-list-line uk-width-medium-1-3"> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> </ul> <h3 class="tm-article-subtitle">Markup</h3> <pre><code>&lt;ul class="uk-list uk-list-line"&gt;...&lt;/ul&gt;</code></pre> <hr class="uk-article-divider"> <h3>List striped</h3> <p>Add zebra-striping to a list using the <code>.uk-list-striped</code> class.</p> <h4 class="tm-article-subtitle">Example</h4> <ul class="uk-list uk-list-striped uk-width-medium-1-3"> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> </ul> <h3 class="tm-article-subtitle">Markup</h3> <pre><code>&lt;ul class="uk-list uk-list-striped"&gt;...&lt;/ul&gt;</code></pre> <hr class="uk-article-divider"> <h3>List space</h3> <p>Add the <code>.uk-list-space</code> class to increase the spacing between list items.</p> <h4 class="tm-article-subtitle">Example</h4> <ul class="uk-list uk-list-space uk-width-medium-1-3"> <li>This modifier may be useful for for list items with multiple lines of text.</li> <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</li> <li>Ut enim ad minim veniam, quis nostrud exercitation ullamco.</li> </ul> <h3 class="tm-article-subtitle">Markup</h3> <pre><code>&lt;ul class="uk-list uk-list-space"&gt;...&lt;/ul&gt;</code></pre> </article> </div> </div> </div> </div> <div class="tm-footer"> <div class="uk-container uk-container-center uk-text-center"> <ul class="uk-subnav uk-subnav-line"> <li><a href="http://github.com/uikit/uikit">GitHub</a></li> <li><a href="http://github.com/uikit/uikit/issues">Issues</a></li> <li><a href="http://github.com/uikit/uikit/blob/master/CHANGELOG.md">Changelog</a></li> <li><a href="https://twitter.com/getuikit">Twitter</a></li> </ul> <div class="uk-panel"> <p>Made by <a href="http://www.yootheme.com">YOOtheme</a> with love and caffeine.<br>Licensed under <a href="http://opensource.org/licenses/MIT">MIT license</a>.</p> <a href="../index.html"><img src="images/logo_uikit.svg" width="90" height="30" title="UIkit" alt="UIkit"></a> </div> </div> </div> <div id="tm-offcanvas" class="uk-offcanvas"> <div class="uk-offcanvas-bar"> <ul class="uk-nav uk-nav-offcanvas uk-nav-parent-icon" data-uk-nav="{multiple:true}"> <li class="uk-parent"><a href="#">Documentation</a> <ul class="uk-nav-sub"> <li><a href="documentation_get-started.html">Get started</a></li> <li><a href="documentation_how-to-customize.html">How to customize</a></li> <li><a href="documentation_layouts.html">Layout examples</a></li> <li><a href="components.html">Components</a></li> <li><a href="addons.html">Add-ons</a></li> <li><a href="documentation_project-structure.html">Project structure</a></li> <li><a href="documentation_create-a-theme.html">Create a theme</a></li> <li><a href="documentation_create-a-style.html">Create a style</a></li> <li><a href="documentation_customizer-json.html">Customizer.json</a></li> <li><a href="documentation_javascript.html">JavaScript</a></li> </ul> </li> <li class="uk-nav-header">Components</li> <li class="uk-parent"><a href="#"><i class="uk-icon-wrench"></i> Defaults</a> <ul class="uk-nav-sub"> <li><a href="base.html">Base</a></li> <li><a href="print.html">Print</a></li> </ul> </li> <li class="uk-parent"><a href="#"><i class="uk-icon-th-large"></i> Layout</a> <ul class="uk-nav-sub"> <li><a href="grid.html">Grid</a></li> <li><a href="panel.html">Panel</a></li> <li><a href="article.html">Article</a></li> <li><a href="comment.html">Comment</a></li> <li><a href="utility.html">Utility</a></li> </ul> </li> <li class="uk-parent"><a href="#"><i class="uk-icon-bars"></i> Navigations</a> <ul class="uk-nav-sub"> <li><a href="nav.html">Nav</a></li> <li><a href="navbar.html">Navbar</a></li> <li><a href="subnav.html">Subnav</a></li> <li><a href="breadcrumb.html">Breadcrumb</a></li> <li><a href="pagination.html">Pagination</a></li> <li><a href="tab.html">Tab</a></li> </ul> </li> <li class="uk-parent uk-active"><a href="#"><i class="uk-icon-check"></i> Elements</a> <ul class="uk-nav-sub"> <li><a href="list.html">List</a></li> <li><a href="description-list.html">Description list</a></li> <li><a href="table.html">Table</a></li> <li><a href="form.html">Form</a></li> </ul> </li> <li class="uk-parent"><a href="#"><i class="uk-icon-folder-open"></i> Common</a> <ul class="uk-nav-sub"> <li><a href="button.html">Button</a></li> <li><a href="icon.html">Icon</a></li> <li><a href="close.html">Close</a></li> <li><a href="badge.html">Badge</a></li> <li><a href="alert.html">Alert</a></li> <li><a href="thumbnail.html">Thumbnail</a></li> <li><a href="overlay.html">Overlay</a></li> <li><a href="progress.html">Progress</a></li> <li><a href="text.html">Text</a></li> <li><a href="animation.html">Animation</a></li> </ul> </li> <li class="uk-parent"><a href="#"><i class="uk-icon-magic"></i> JavaScript</a> <ul class="uk-nav-sub"> <li><a href="dropdown.html">Dropdown</a></li> <li><a href="modal.html">Modal</a></li> <li><a href="offcanvas.html">Off-canvas</a></li> <li><a href="switcher.html">Switcher</a></li> <li><a href="toggle.html">Toggle</a></li> <li><a href="tooltip.html">Tooltip</a></li> <li><a href="scrollspy.html">Scrollspy</a></li> <li><a href="smooth-scroll.html">Smooth scroll</a></li> </ul> </li> <li class="uk-nav-header">Add-ons</li> <li class="uk-parent"><a href="#"><i class="uk-icon-th-large"></i> Layout</a> <ul class="uk-nav-sub"> <li><a href="addons_flex.html">Flex</a></li> <li><a href="addons_cover.html">Cover</a></li> </ul> </li> <li class="uk-parent"><a href="#"><i class="uk-icon-bars"></i> Navigations</a> <ul class="uk-nav-sub"> <li><a href="addons_dotnav.html">Dotnav</a></li> <li><a href="addons_slidenav.html">Slidenav</a></li> <li><a href="addons_pagination.html">Pagination</a></li> </ul> </li> <li class="uk-parent"><a href="#"><i class="uk-icon-folder-open"></i> Common</a> <ul class="uk-nav-sub"> <li><a href="addons_form-advanced.html">Form advanced</a></li> <li><a href="addons_form-file.html">Form file</a></li> <li><a href="addons_form-password.html">Form password</a></li> <li><a href="addons_form-select.html">Form select</a></li> <li><a href="addons_placeholder.html">Placeholder</a></li> </ul> </li> <li class="uk-parent"><a href="#"><i class="uk-icon-magic"></i> JavaScript</a> <ul class="uk-nav-sub"> <li><a href="addons_autocomplete.html">Autocomplete</a></li> <li><a href="addons_datepicker.html">Datepicker</a></li> <li><a href="addons_htmleditor.html">HTML editor</a></li> <li><a href="addons_notify.html">Notify</a></li> <li><a href="addons_search.html">Search</a></li> <li><a href="addons_nestable.html">Nestable</a></li> <li><a href="addons_sortable.html">Sortable</a></li> <li><a href="addons_sticky.html">Sticky</a></li> <li><a href="addons_timepicker.html">Timepicker</a></li> <li><a href="addons_upload.html">Upload</a></li> </ul> </li> <li class="uk-nav-divider"></li> <li><a href="../showcase/index.html">Showcase</a></li> </ul> </div> </div> </body> </html>
Java
// get params function getParams() { var params = { initial_amount: parseInt($('#initial_amount').val(), 10) || 0, interest_rate_per_annum: parseFloat($('#interest_rate_per_annum').val()) / 100 || 0, monthly_amount: parseFloat($('#monthly_amount').val()), num_months: parseInt($('#num_months').val(), 10) }; params.method = $('#by_monthly_amount').is(':checked') ? 'by_monthly_amount' : 'by_num_months'; return params; } function updateUI() { var params = getParams(); var data = computeLoanData(params); updatePaymentTable(data); console.log(data); } function computeLoanData(params) { var total_paid = 0, num_months = 0, remainder = Math.floor(params.initial_amount * 100), monthly_interest_rate = params.interest_rate_per_annum / 12, monthly_amount, months = []; if (params.method == 'by_num_months') { var pow = Math.pow(1 + monthly_interest_rate, params.num_months); monthly_amount = remainder * monthly_interest_rate * pow / (pow - 1); } else { monthly_amount = params.monthly_amount * 100; } monthly_amount = Math.ceil(monthly_amount); // compute by amount first while (remainder > 0) { var interest = Math.floor(remainder * monthly_interest_rate); remainder += interest; var to_pay = remainder > monthly_amount ? monthly_amount : remainder; total_paid += to_pay; remainder -= to_pay; months.push({ interest: interest / 100, repayment: to_pay / 100, remainder: remainder / 100 }); } $('#monthly_amount').val((monthly_amount / 100).toFixed(2)); $('#num_months').val(months.length); return { total_paid: total_paid / 100, interest_paid: (total_paid - params.initial_amount * 100) / 100, months: months }; } function updatePaymentTable(data) { $('#total_repayment').text(data.total_paid.toFixed(2)); $('#total_interested_paid').text(data.interest_paid.toFixed(2)); var rows = $('#monthly_breakdown').empty(); for (var idx=0; idx < data.months.length; idx++) { var month_num = idx+1; var is_new_year = (idx % 12) === 0; var tr = $('<tr />') .append($('<td />').text(month_num)) .append($('<td />').text(data.months[idx].interest.toFixed(2))) .append($('<td />').text(data.months[idx].repayment.toFixed(2))) .append($('<td />').text(data.months[idx].remainder.toFixed(2))) .addClass(is_new_year ? 'jan' : '') .appendTo(rows); } } // initiatilize listeners $('#initial_amount').on('change', updateUI); $('#interest_rate_per_annum').on('change', updateUI); $('#monthly_amount').on('change', updateUI); $('#num_months').on('change', updateUI); $('#by_monthly_amount').on('change', updateUI); $('#by_num_months').on('change', updateUI);
Java
using Lidgren.Network; namespace Gem.Network.Handlers { public class DummyHandler : IMessageHandler { public void Handle(NetConnection sender, object args) { } } }
Java
define([ "dojo/_base/declare", "dojo/_base/fx", "dojo/_base/lang", "dojo/dom-style", "dojo/mouse", "dojo/on", "dijit/_WidgetBase", "dijit/_TemplatedMixin", "dojo/text!./templates/TGPrdItem.html", "dijit/_OnDijitClickMixin", "dijit/_WidgetsInTemplateMixin", "dijit/form/Button" ], function(declare, baseFx, lang, domStyle, mouse, on, _WidgetBase, _TemplatedMixin, template,_OnDijitClickMixin,_WidgetsInTemplateMixin,Button){ return declare([_WidgetBase, _OnDijitClickMixin,_TemplatedMixin,_WidgetsInTemplateMixin], { // Some default values for our author // These typically map to whatever you're passing to the constructor // 产品名称 rtzzhmc: "No Name", // Using require.toUrl, we can get a path to our AuthorWidget's space // and we want to have a default avatar, just in case // 产品默认图片 rimg: require.toUrl("./images/defaultAvatar.png"), // //起点金额 // code5:"", // //投资风格 // code7: "", // //收益率 // code8:"", // //产品经理 // code3:"", // //产品ID // rprid:"", // Our template - important! templateString: template, // A class to be applied to the root node in our template baseClass: "TGPrdWidget", // A reference to our background animation mouseAnim: null, // Colors for our background animation baseBackgroundColor: "#fff", // mouseBackgroundColor: "#def", postCreate: function(){ // Get a DOM node reference for the root of our widget var domNode = this.domNode; // Run any parent postCreate processes - can be done at any point this.inherited(arguments); // Set our DOM node's background color to white - // smoothes out the mouseenter/leave event animations domStyle.set(domNode, "backgroundColor", this.baseBackgroundColor); }, //设置属性 _setRimgAttr: function(imagePath) { // We only want to set it if it's a non-empty string if (imagePath != "") { // Save it on our widget instance - note that // we're using _set, to support anyone using // our widget's Watch functionality, to watch values change // this._set("avatar", imagePath); // Using our avatarNode attach point, set its src value this.imgNode.src = HTTP+imagePath; } } }); });
Java
<?php /** * PHPUnit * * Copyright (c) 2002-2009, Sebastian Bergmann <sb@sebastian-bergmann.de>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of Sebastian Bergmann nor the names of his * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * @category Testing * @package PHPUnit * @author Sebastian Bergmann <sb@sebastian-bergmann.de> * @copyright 2002-2009 Sebastian Bergmann <sb@sebastian-bergmann.de> * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version SVN: $Id: PerformanceTestCase.php 4701 2009-03-01 15:29:08Z sb $ * @link http://www.phpunit.de/ * @since File available since Release 2.1.0 */ require_once 'PHPUnit/Framework.php'; require_once 'PHPUnit/Util/Filter.php'; require_once 'PHPUnit/Util/Timer.php'; PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT'); /** * A TestCase that expects a TestCase to be executed * meeting a given time limit. * * @category Testing * @package PHPUnit * @author Sebastian Bergmann <sb@sebastian-bergmann.de> * @copyright 2002-2009 Sebastian Bergmann <sb@sebastian-bergmann.de> * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version Release: 3.4.0RC3 * @link http://www.phpunit.de/ * @since Class available since Release 2.1.0 */ abstract class PHPUnit_Extensions_PerformanceTestCase extends PHPUnit_Framework_TestCase { /** * @var integer */ protected $maxRunningTime = 0; /** * @return mixed * @throws RuntimeException */ protected function runTest() { PHPUnit_Util_Timer::start(); $testResult = parent::runTest(); $time = PHPUnit_Util_Timer::stop(); if ($this->maxRunningTime != 0 && $time > $this->maxRunningTime) { $this->fail( sprintf( 'expected running time: <= %s but was: %s', $this->maxRunningTime, $time ) ); } return $testResult; } /** * @param integer $maxRunningTime * @throws InvalidArgumentException * @since Method available since Release 2.3.0 */ public function setMaxRunningTime($maxRunningTime) { if (is_integer($maxRunningTime) && $maxRunningTime >= 0) { $this->maxRunningTime = $maxRunningTime; } else { throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'positive integer'); } } /** * @return integer * @since Method available since Release 2.3.0 */ public function getMaxRunningTime() { return $this->maxRunningTime; } } ?>
Java
const { ipcRenderer, remote } = require('electron'); const mainProcess = remote.require('./main'); const currentWindow = remote.getCurrentWindow(); const $name = $('.name-input'); const $servings = $('.servings-input'); const $time = $('.time-input'); const $ingredients = $('.ingredients-input'); const $directions = $('.directions-input'); const $notes = $('.notes-input'); const $saveButton = $('.save-recipe-button'); const $seeAllButton = $('.see-all-button'); const $homeButton = $('.home-button'); const $addRecipeButton = $('.add-button'); let pageNav = (page) => { currentWindow.loadURL(`file://${__dirname}/${page}`); }; $saveButton.on('click', () => { let name = $name.val(); let servings = $servings.val(); let time = $time.val(); let ingredients = $ingredients.val(); let directions = $directions.val(); let notes = $notes.val(); let recipe = { name, servings, time, ingredients, directions, notes}; mainProcess.saveRecipe(recipe); pageNav('full-recipe.html'); }); $seeAllButton.on('click', () => { mainProcess.getRecipes(); pageNav('all-recipes.html'); }); $homeButton.on('click', () => { pageNav('index.html'); }); $addRecipeButton.on('click', () => { pageNav('add-recipe.html'); });
Java
require 'spec_helper' module Sexpr::Matcher describe Rule, "eat" do let(:rule){ Rule.new :hello, self } def eat(seen) @seen = seen end it 'delegates to the defn' do rule.eat([:foo]) @seen.should eq([:foo]) end end end
Java
/* * Store drawing on server */ function saveDrawing() { var drawing = $('#imagePaint').wPaint('image'); var imageid = $('#imageTarget').data('imageid'); var creatormail = $('input[name=creatorMail]').val(); //Add spinning wheel var spin = $(document.createElement('div')); spin.addClass('spin'); $('#dialog-content').html(spin); $.ajax({ type: 'POST', url: 'savedrawing', dataType: 'json', data: {drawing: drawing, imageid: imageid, creatormail: creatormail}, success: function (resp) { if (resp.kind == 'success') popup("<p>Die Zeichnung wurde erfolgreich gespeichert.</p><p>Sie wird jedoch zuerst überprüft bevor sie in der Galerie zu sehen ist.</p>"); if (resp.kind == 'error') popup("<p>Die Zeichnung konnte leider nicht gespeichert werden.</p><p>Der Fehler wird untersucht.</p>"); }, fail: function() { popup("<p>Die Zeichnung konnte leider nicht gespeichert werden.</p><p>Der Fehler wird untersucht.</p>"); } }); } function saveDrawingLocal() { var imageid = $('img#imageTarget').data('imageid'); var drawingid = $('img#drawingTarget').data('drawingid'); window.location.href = 'getfile?drawingid=' + drawingid + '&imageid=' + imageid; } /* * Popup message */ function popup(message) { // get the screen height and width var maskHeight = $(document).height(); var maskWidth = $(window).width(); // calculate the values for center alignment var dialogTop = (maskHeight/2) - ($('#dialog-box').height()/2); var dialogLeft = (maskWidth/2) - ($('#dialog-box').width()/2); // assign values to the overlay and dialog box $('#dialog-overlay').css({height:maskHeight, width:maskWidth}).show(); $('#dialog-box').css({top:dialogTop, left:dialogLeft}).show(); // display the message $('#dialog-content').html(message); } $(document).ready(function() { /*********************************************** * Encrypt Email script- Please keep notice intact * Tool URL: http://www.dynamicdrive.com/emailriddler/ * **********************************************/ var emailriddlerarray=[104,111,115,116,109,97,115,116,101,114,64,109,97,99,104,100,105,101,115,116,114,97,115,115,101,98,117,110,116,46,99,111,109] var encryptedemail_id65='' //variable to contain encrypted email for (var i=0; i<emailriddlerarray.length; i++) encryptedemail_id65+=String.fromCharCode(emailriddlerarray[i]) $('#mailMaster').attr('href', 'mailto:' + encryptedemail_id65 ); var emailriddlerarray=[105,110,102,111,64,109,97,99,104,100,105,101,115,116,114,97,115,115,101,98,117,110,116,46,99,111,109] var encryptedemail_id23='' //variable to contain encrypted email for (var i=0; i<emailriddlerarray.length; i++) encryptedemail_id23+=String.fromCharCode(emailriddlerarray[i]) $('#mailInfo').attr('href', 'mailto:' + encryptedemail_id23 ); /* * Change image */ $(".imageSmallContainer").click(function(evt){ var imageid = $(this).data('imageid'); var drawingid = $(this).data('drawingid'); var ids = {imageid : imageid, drawingid : drawingid}; $.get('changeimage', ids) .done(function(data){ var imageContainer = $('#imageContainer'); //Hide all images in container imageContainer.children('.imageRegular').hide(); //Add spinning wheel var spin = $(document.createElement('div')); spin.addClass('spin'); imageContainer.prepend(spin); //Remove hidden old image $('#imageTarget').remove(); //Create new hidden image var imageNew = $(document.createElement('img')); imageNew.attr('id', 'imageTarget'); imageNew.addClass('imageRegular'); imageNew.attr('data-imageid', imageid); imageNew.data('imageid', imageid); imageNew.attr('src', data.imagefile); imageNew.css('display', 'none'); //Prepend new Image to container imageContainer.prepend(imageNew); //For Admin and Gallery also change Drawing if (typeof drawingid != 'undefined') { var drawing = $('#drawingTarget'); drawing.attr('src', data.drawingfile); drawing.attr('data-drawingid', drawingid); drawing.data('drawingid', drawingid); drawing.attr('drawingid', drawingid); } // If newImage src is loaded, remove spin and fade all imgs // Fires too early in FF imageContainer.imagesLoaded(function() { spin.remove(); imageContainer.children('.imageRegular').fadeIn(); }); }); }); /* * Change the class of moderated images */ $('.imageSmallContainerOuter input').change(function(evt){ var container = $(this).parent(); var initial = container.data('initialstate'); var checked = $(this).prop('checked'); container.removeClass('notApproved'); container.removeClass('approved'); container.removeClass('changed'); if (checked && initial == 'approved') container.addClass('approved'); else if ((checked && initial == 'notApproved') || (!checked && initial == 'approved')) container.addClass('changed'); else if (!checked && initial == 'notApproved') container.addClass('notApproved') }); $('#dialog-box .close, #dialog-overlay').click(function () { $('#dialog-overlay, #dialog-box').hide(); return false; }); $('#drawingDialogBtn').click(function(evt){ popup("<p>Aus den besten eingeschickten Zeichnungen werden Freecards gedruckt.</p> \ <p>Mit dem Klick auf den Speicherbutton erklärst du dich dafür bereit, dass dein Bild vielleicht veröffentlicht wird.</p> \ <p>Wenn du deine Email-Adresse angibst können wir dich informieren falls wir deine Zeichnung ausgewählt haben.</p> \ <input type='text' name='creatorMail' placeholder='Email Adresse'> \ <a id='drawingSaveBtn' href='javascript:saveDrawing();' class='btn'>Speichern</a>"); }); });
Java
'use strict' //Globals will be the stage which is the parrent of all graphics, canvas object for resizing and the renderer which is pixi.js framebuffer. var stage = new PIXI.Container(); var canvas = document.getElementById("game");; var renderer = PIXI.autoDetectRenderer(1024, 570, {view:document.getElementById("game")}); var graphics = new PIXI.Graphics(); // Create or grab the application var app = app || {}; function init(){ resize(); renderer = PIXI.autoDetectRenderer(1024, 570, {view:document.getElementById("game")} ); renderer.backgroundColor = 0x50503E; //level(); canvas.focus(); app.Game.init(renderer, window, canvas, stage); } function resize(){ var gameWidth = window.innerWidth; var gameHeight = window.innerHeight; var scaleToFitX = gameWidth / 1000; var scaleToFitY = gameHeight / 500; // Scaling statement belongs to: https://www.davrous.com/2012/04/06/modernizing-your-html5-canvas-games-part-1-hardware-scaling-css3/ var optimalRatio = Math.min(scaleToFitX, scaleToFitY); var currentScreenRatio = gameWidth / gameHeight; if(currentScreenRatio >= 1.77 && currentScreenRatio <= 1.79) { canvas.style.width = gameWidth + "px"; canvas.style.height = gameHeight + "px"; }else{ canvas.style.width = 1000 * optimalRatio + "px"; canvas.style.height = 500 * optimalRatio + "px"; } } //do not REMOVE /* //takes two arrays // the w_array is an array of column width values [w1, w2, w3, ...], y_array is //3d array setup as such [[row 1], [row 2], [row3]] and the rows are arrays // that contain pairs of y,l values where y is the fixed corner of the //rectangle and L is the height of the rectangle. function level(){ // drawRect( xstart, ystart, x size side, y size side) app.levelData = { w_array: [102 * 2, 102 * 2, 102 * 2, 102 * 2, 102 * 2], y_array: [ [ [0 * 2, 90 * 2], [0 * 2, 90 * 2], [0 * 2, 90 * 2], [0 * 2, 90 * 2], [0 * 2, 90 * 2], ], [ [90 * 2, 90 * 2], [90 * 2, 90 * 2], [90 * 2, 90 * 2], [90 * 2, 90 * 2], [90 * 2, 90 * 2], ], [ [180 * 2, 90 * 2], [180 * 2, 90 * 2], [180 * 2, 90 * 2], [180 * 2, 90 * 2], [180 * 2, 90 * 2], ], [ [270 * 2, 90 * 2], [270 * 2, 90 * 2], [270 * 2, 90 * 2], [270 * 2, 90 * 2], [270 * 2, 90 * 2], ] ], p_array: [ [50,50,50,50], [50,450,50,50], [920,50,50,50], [920,450,50,50], ] }; // set a fill and a line style again and draw a rectangle graphics.lineStyle(2, 0x995702, 1); graphics.beginFill(0x71FF33, 1); var x = 0; //reset the x x = 0; //post fence post for(var h = 0, hlen = app.levelData.y_array.length; h < hlen; h++){ for( var i = 0, len = app.levelData.w_array.length; i < len; i++){ //setup the y value graphics.drawRect(x, app.levelData.y_array[h][i][0], app.levelData.w_array[i], app.levelData.y_array[h][i][1]); x += app.levelData.w_array[i]; } //reset the x x = 0; } graphics.lineStyle(2, 0x3472D8, 1); graphics.beginFill(0x3472D8, 1); for(var i = 0, len = app.levelData.p_array.length; i < len; i++){ graphics.drawRect(app.levelData.p_array[i][0], app.levelData.p_array[i][1], app.levelData.p_array[i][2], app.levelData.p_array[i][3]); } stage.addChild(graphics); } // Reads in a JSON object with data function readJSONFile( filePath ){ $.getJSON( filePath, function(){} ) .done( function( data ){ console.log( "SUCCESS: File read from " + filePath ); app.levelData = data; } ) .fail( function( ){ console.log( "FAILED: File at " + filePath ); } ); } */ window.addEventListener('resize', resize, false); window.addEventListener('orientationchange', resize, false);
Java
import React, {Component} from 'react'; import {connect} from 'react-redux'; class MapFull extends Component { constructor() { super(); this.state = { htmlContent: null }; } componentDidMount() { this.getMapHtml(); } componentDidUpdate(prevProps, prevState) { if (!this.props.map || this.props.map.filehash !== prevProps.map.filehash) { this.getMapHtml(); } } getMapHtml() { const path = this.props.settings.html_url + this.props.map.filehash; fetch(path).then(response => { return response.text(); }).then(response => { this.setState({ htmlContent: response }); }); } getMarkup() { return {__html: this.state.htmlContent} } render() { return ( <div className="MapFull layoutbox"> <h3>{this.props.map.titlecache}</h3> <div id="overDiv" style={{position: 'fixed', visibility: 'hide', zIndex: 1}}></div> <div> {this.state.htmlContent ? <div> <div dangerouslySetInnerHTML={this.getMarkup()}></div> </div> : null} </div> </div> ) } } function mapStateToProps(state) { return {settings: state.settings} } export default connect(mapStateToProps)(MapFull);
Java
// Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html module.exports = function (config) { config.set({ basePath: '', frameworks: ['jasmine', '@angular-devkit/build-angular'], plugins: [ require('karma-jasmine'), require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('@angular-devkit/build-angular/plugins/karma') ], client: { clearContext: false // leave Jasmine Spec Runner output visible in browser }, reporters: ['progress', 'kjhtml'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false, restartOnFileChange: true }); };
Java
# AsylumJam2016 Projet VR sur mobile.
Java
--- description: An example using the Auth0 Quickstart for a SPA implementation with Auth0 Universal Login. classes: video-page --- # Authenticate: SPA Example See an example using the Auth0 Quickstart for a single-page application (SPA) implementation and learn how Auth0's Universal Login feature does most of the authentication work for you. Understand how security and user experience work with the authentication process to determine how to plan your application integration to Auth0. See how Single-Sign On (SSO) works between applications when you use Universal Login. <div class="video-wrapper" data-video="ayvvah2ov1"></div> ## Video transcript <details> <summary>Introduction</summary> In part 1, we described a few of the ways that you can provide services to your users through your applications using user authentication. You can authenticate users via their social media accounts or with their usernames and passwords. You can add an additional level of certainty about their identities with Multi-factor Authentication (MFA). In this video, we will look at how the Quickstart single page application or SPA implementation uses Universal Login&mdash;which is the preferred method for authentication workflow in Auth0. </details> <details> <summary>Quickstart: SPA with Backend</summary> You can find the quickstarts at https://auth0.com/docs/quickstarts. It is a good idea to login to a specific tenant. Here I am using the **product-training** tenant. This will make the user experience better later on. Next, we need to select the type of application we want to use. We can start with single page application. Then select the vanilla javascript quickstart. Here we are offered two options; the first is a detailed step-by-step guide to implementing authentication in an existing javascript application, and the second is to download a fully functional sample application. Let’s download the sample application. Because we are authenticated, the quickstart download gives us an option to select an existing application from our tenant. The downloaded sample application will be configured to use this applications credentials for authentication. We are also instructed to add our localhost development url to the **Callback URL** and **Allowed Web Origins** lists. Finally, assuming that `node.js` is installed we can install our dependences and start the application. Now we can test the authentication by clicking the **Login** button. </details> <details> <summary>Universal Login</summary> Now that we have an application connected, let’s take a look at Universal Login. You can choose from Classic or New to create your own login pages that will authenticate your users. Later in another video, we will show you how to provide more extensive branding for these pages and more. The buttons that appear on the login page depend on a number of factors including the connections that have been enabled and the current state of a session the user may already have. These settings are dynamic and adjustable in real-time&mdash;no coding changes are required&mdash;since the functionality is driven by the web pages served by the Auth0 Authentication Server. If you have **Enable seamless SSO** enabled or if you have a new tenant, where this option is enabled by default and can’t be turned off, Auth0 will show the login UI only if the user doesn’t have a session. There may or may not be other prompts as well like MFA or consent, but if no user interaction is required then the application will get the results immediately. Therefore, in most cases, applications don’t really check if the user is logged in into the identity provider: they just request an authentication. Universal Login works by effectively delegating the authentication of a user; the user is redirected to the Authorization Service, your Auth0 tenant, and that service authenticates the user and then redirects them back to your application. In most cases, when your application needs to authenticate the user, it will request authentication from the OIDC provider, Auth0, via an `/authorize` request. As you can see from the quickstart, the best approach to implementing this is to use one of the language-specific Auth0 SDKs or some third-party middleware applicable to your technology stack. How to actually do this depends on the SDK and application type used. Once authenticated, and when using an OIDC authentication workflow, Auth0 will redirect the user back to your callback URL with an ID token or a code to fetch the ID token. For OIDC, Auth0 returns profile information in the ID token in a structured claim format as defined by the OIDC specification. This means that custom claims added to ID Tokens must conform to a namespaced format to avoid possible collisions with standard OIDC claims. For example, if you choose the namespace `https://foo.com/` and you want to add a custom claim named myclaim, you would name the claim `https://foo.com/myclaim`, instead of `myclaim`. By choosing Universal Login, you don't have to do any integration work to handle the various flavors of authentication. You can start off using a simple username and password, and with a simple toggle switch, you can add new features such as social login and multi-factor authentication. </details> <details> <summary>Integrate a second application</summary> Next, we’ll see how easy it is to integrate Auth0 in your second application. If you run another quickstart, for example, to integrate a web application, you don’t have to do anything else. Running the second quickstart against the same tenant will configure SSO between your applications automatically. Let’s download another quickstart and see this in action. This time around, I will select the Regular Web App application type and `asp.net core` sample. `Asp.net core` is a typical enterprise server side rendered web application framework. The steps are the same as before: Select the application, set local developement urls, download and run the sample. After authenticating the user and redirecting them to an identity provider, you can check for active SSO sessions. </details> ## Up next <ul class="up-next"> <li> <span class="video-time"><i class="icon icon-budicon-494"></i>3:18</span> <i class="video-icon icon icon-budicon-676"></i> <a href="/videos/get-started/05_01-authorize-id-tokens-access-control">Authorize: ID Tokens and Access Control</a> <p>What an ID Token is and how you can add custom claims to make access control decisions for your users. </p> </li> <li> <span class="video-time"><i class="icon icon-budicon-494"></i>6:02</span> <i class="video-icon icon icon-budicon-676"></i> <a href="/videos/get-started/05_02-authorize-get-validate-id-tokens">Authorize: Get and Validate ID Tokens</a> <p>How to get and validate ID Tokens before storing and using them. </p> </li> <li> <span class="video-time"><i class="icon icon-budicon-494"></i>8:59</span> <i class="video-icon icon icon-budicon-676"></i> <a href="/videos/get-started/06-user-profiles">User Profiles</a> <p>What user profiles are, what they contain, and how you can use them to manage users. </p> </li> <li> <span class="video-time"><i class="icon icon-budicon-494"></i>4:00</span> <i class="video-icon icon icon-budicon-676"></i> <a href="/videos/get-started/07_01-brand-how-it-works">Brand: How It Works</a> <p>Why your branding is important for your users and how it works with Auth0. </p> </li> <li> <span class="video-time"><i class="icon icon-budicon-494"></i>2:20</span> <i class="video-icon icon icon-budicon-676"></i> <a href="/videos/get-started/07_02-brand-signup-login-pages">Brand: Sign Up and Login Pages</a> <p>How to use Universal Login to customize your sign up and login pages. </p> </li> <li> <span class="video-time"><i class="icon icon-budicon-494"></i>5:42</span> <i class="video-icon icon icon-budicon-676"></i> <a href="/videos/get-started/08-brand-emails-error-pages">Brand: Emails and Error Pages</a> <p>How to use email templates and customize error pages. </p> </li> <li> <span class="video-time"><i class="icon icon-budicon-494"></i>8:12</span> <i class="video-icon icon icon-budicon-676"></i> <a href="/videos/get-started/10-logout">Logout</a> <p>How to configure different kinds of user logout behavior using callback URLs. </p> </li> </ul> ## Previous videos <ul class="up-next"> <li> <span class="video-time"><i class="icon icon-budicon-494"></i>8:33</span> <i class="video-icon icon icon-budicon-676"></i> <a href="/videos/get-started/01-architecture-your-tenant">Architect: Your Tenant</a> <p>What an Auth0 tenant is and how to configure it in the Auth0 Dashboard.</p> </li> <li> <span class="video-time"><i class="icon icon-budicon-494"></i>2:14</span> <i class="video-icon icon icon-budicon-676"></i> <a href="/videos/get-started/02-provision-user-stores">Provision: User Stores</a> <p>How user profiles are provisioned within an Auth0 tenant.</p> </li> <li> <span class="video-time"><i class="icon icon-budicon-494"></i>10:00</span> <i class="video-icon icon icon-budicon-676"></i> <a href="/videos/get-started/03-provision-import-users">Provision: Import Users</a> <p>How to move existing users to an Auth0 user store using automatic migration, bulk migration, or both.</p> </li> <li> <span class="video-time"><i class="icon icon-budicon-494"></i>5:57</span> <i class="video-icon icon icon-budicon-676"></i> <a href="/videos/get-started/04_01-authenticate-how-it-works">Authenticate: How It Works</a> <p>How user authentication works and various ways to accomplish it with Auth0.</p> </li> </ul>
Java
<div class="container"> <div class="row"> <sd-toolbar></sd-toolbar> </div> <div class="row"> <sd-navbar></sd-navbar> </div> <div class="row"> <router-outlet></router-outlet> </div> </div>
Java
from ab_tool.tests.common import (SessionTestCase, TEST_COURSE_ID, TEST_OTHER_COURSE_ID, NONEXISTENT_TRACK_ID, NONEXISTENT_EXPERIMENT_ID, APIReturn, LIST_MODULES) from django.core.urlresolvers import reverse from ab_tool.models import (Experiment, InterventionPointUrl) from ab_tool.exceptions import (EXPERIMENT_TRACKS_ALREADY_FINALIZED, NO_TRACKS_FOR_EXPERIMENT, UNAUTHORIZED_ACCESS, INTERVENTION_POINTS_ARE_INSTALLED) import json from mock import patch class TestExperimentPages(SessionTestCase): """ Tests related to Experiment and Experiment pages and methods """ def test_create_experiment_view(self): """ Tests edit_experiment template renders for url 'create_experiment' """ response = self.client.get(reverse("ab_testing_tool_create_experiment")) self.assertOkay(response) self.assertTemplateUsed(response, "ab_tool/edit_experiment.html") def test_create_experiment_view_unauthorized(self): """ Tests edit_experiment template does not render for url 'create_experiment' when unauthorized """ self.set_roles([]) response = self.client.get(reverse("ab_testing_tool_create_experiment"), follow=True) self.assertTemplateNotUsed(response, "ab_tool/create_experiment.html") self.assertTemplateUsed(response, "ab_tool/not_authorized.html") def test_edit_experiment_view(self): """ Tests edit_experiment template renders when authenticated """ experiment = self.create_test_experiment() response = self.client.get(reverse("ab_testing_tool_edit_experiment", args=(experiment.id,))) self.assertTemplateUsed(response, "ab_tool/edit_experiment.html") def test_edit_experiment_view_started_experiment(self): """ Tests edit_experiment template renders when experiment has started """ experiment = self.create_test_experiment() experiment.tracks_finalized = True experiment.save() response = self.client.get(reverse("ab_testing_tool_edit_experiment", args=(experiment.id,))) self.assertTemplateUsed(response, "ab_tool/edit_experiment.html") def test_edit_experiment_view_with_tracks_weights(self): """ Tests edit_experiment template renders properly with track weights """ experiment = self.create_test_experiment() experiment.assignment_method = Experiment.WEIGHTED_PROBABILITY_RANDOM track1 = self.create_test_track(name="track1", experiment=experiment) track2 = self.create_test_track(name="track2", experiment=experiment) self.create_test_track_weight(experiment=experiment, track=track1) self.create_test_track_weight(experiment=experiment, track=track2) response = self.client.get(reverse("ab_testing_tool_edit_experiment", args=(experiment.id,))) self.assertTemplateUsed(response, "ab_tool/edit_experiment.html") def test_edit_experiment_view_unauthorized(self): """ Tests edit_experiment template doesn't render when unauthorized """ self.set_roles([]) experiment = self.create_test_experiment(course_id=TEST_OTHER_COURSE_ID) response = self.client.get(reverse("ab_testing_tool_edit_experiment", args=(experiment.id,)), follow=True) self.assertTemplateNotUsed(response, "ab_tool/edit_experiment.html") self.assertTemplateUsed(response, "ab_tool/not_authorized.html") def test_edit_experiment_view_nonexistent(self): """Tests edit_experiment when experiment does not exist""" e_id = NONEXISTENT_EXPERIMENT_ID response = self.client.get(reverse("ab_testing_tool_edit_experiment", args=(e_id,))) self.assertTemplateNotUsed(response, "ab_tool/edit_experiment.html") self.assertEquals(response.status_code, 404) def test_edit_experiment_view_wrong_course(self): """ Tests edit_experiment when attempting to access a experiment from a different course """ experiment = self.create_test_experiment(course_id=TEST_OTHER_COURSE_ID) response = self.client.get(reverse("ab_testing_tool_edit_experiment", args=(experiment.id,))) self.assertError(response, UNAUTHORIZED_ACCESS) def test_edit_experiment_view_last_modified_updated(self): """ Tests edit_experiment to confirm that the last updated timestamp changes """ experiment = self.create_test_experiment() experiment.name += " (updated)" response = self.client.post(reverse("ab_testing_tool_submit_edit_experiment", args=(experiment.id,)), content_type="application/json", data=experiment.to_json()) self.assertEquals(response.content, "success") updated_experiment = Experiment.objects.get(id=experiment.id) self.assertLess(experiment.updated_on, updated_experiment.updated_on, response) def test_submit_create_experiment(self): """ Tests that create_experiment creates a Experiment object verified by DB count when uniformRandom is true""" Experiment.get_placeholder_course_experiment(TEST_COURSE_ID) num_experiments = Experiment.objects.count() experiment = { "name": "experiment", "notes": "hi", "uniformRandom": True, "csvUpload": False, "tracks": [{"id": None, "weighting": None, "name": "A"}] } response = self.client.post( reverse("ab_testing_tool_submit_create_experiment"), follow=True, content_type="application/json", data=json.dumps(experiment) ) self.assertEquals(num_experiments + 1, Experiment.objects.count(), response) def test_submit_create_experiment_csv_upload(self): """ Tests that create_experiment creates a Experiment object verified by DB count when csvUpload is True and no track weights are specified""" Experiment.get_placeholder_course_experiment(TEST_COURSE_ID) num_experiments = Experiment.objects.count() experiment = { "name": "experiment", "notes": "hi", "uniformRandom": False, "csvUpload": True, "tracks": [{"id": None, "name": "A"}] } response = self.client.post( reverse("ab_testing_tool_submit_create_experiment"), follow=True, content_type="application/json", data=json.dumps(experiment) ) self.assertEquals(num_experiments + 1, Experiment.objects.count(), response) def test_submit_create_experiment_with_weights_as_assignment_method(self): """ Tests that create_experiment creates a Experiment object verified by DB count when uniformRandom is false and the tracks have weightings """ Experiment.get_placeholder_course_experiment(TEST_COURSE_ID) num_experiments = Experiment.objects.count() experiment = { "name": "experiment", "notes": "hi", "uniformRandom": False, "csvUpload": False, "tracks": [{"id": None, "weighting": 100, "name": "A"}] } response = self.client.post( reverse("ab_testing_tool_submit_create_experiment"), follow=True, content_type="application/json", data=json.dumps(experiment) ) self.assertEquals(num_experiments + 1, Experiment.objects.count(), response) def test_submit_create_experiment_unauthorized(self): """Tests that create_experiment creates a Experiment object verified by DB count""" self.set_roles([]) Experiment.get_placeholder_course_experiment(TEST_COURSE_ID) num_experiments = Experiment.objects.count() experiment = {"name": "experiment", "notes": "hi"} response = self.client.post( reverse("ab_testing_tool_submit_create_experiment"), follow=True, content_type="application/json", data=json.dumps(experiment) ) self.assertEquals(num_experiments, Experiment.objects.count()) self.assertTemplateUsed(response, "ab_tool/not_authorized.html") def test_submit_edit_experiment(self): """ Tests that submit_edit_experiment does not change DB count but does change Experiment attribute""" experiment = self.create_test_experiment(name="old_name") experiment_id = experiment.id num_experiments = Experiment.objects.count() experiment = { "name": "new_name", "notes": "hi", "uniformRandom": True, "csvUpload": False, "tracks": [{"id": None, "weighting": None, "name": "A"}] } response = self.client.post( reverse("ab_testing_tool_submit_edit_experiment", args=(experiment_id,)), follow=True, content_type="application/json", data=json.dumps(experiment) ) self.assertOkay(response) self.assertEquals(num_experiments, Experiment.objects.count()) experiment = Experiment.objects.get(id=experiment_id) self.assertEquals(experiment.name, "new_name") def test_submit_edit_experiment_changes_assignment_method_to_weighted(self): """ Tests that submit_edit_experiment changes an Experiment's assignment method from uniform (default) to weighted""" experiment = self.create_test_experiment(name="old_name") experiment_id = experiment.id num_experiments = Experiment.objects.count() no_track_weights = experiment.track_probabilites.count() experiment = { "name": "new_name", "notes": "hi", "uniformRandom": False, "csvUpload": False, "tracks": [{"id": None, "weighting": 20, "name": "A"}, {"id": None, "weighting": 80, "name": "B"}] } response = self.client.post( reverse("ab_testing_tool_submit_edit_experiment", args=(experiment_id,)), follow=True, content_type="application/json", data=json.dumps(experiment) ) self.assertOkay(response) self.assertEquals(num_experiments, Experiment.objects.count()) experiment = Experiment.objects.get(id=experiment_id) self.assertEquals(experiment.assignment_method, Experiment.WEIGHTED_PROBABILITY_RANDOM) self.assertEquals(experiment.track_probabilites.count(), no_track_weights + 2) def test_submit_edit_experiment_changes_assignment_method_to_uniform(self): """ Tests that submit_edit_experiment changes an Experiment's assignment method from weighted uniform """ experiment = self.create_test_experiment( name="old_name", assignment_method=Experiment.WEIGHTED_PROBABILITY_RANDOM) experiment_id = experiment.id num_experiments = Experiment.objects.count() no_tracks = experiment.tracks.count() experiment = { "name": "new_name", "notes": "hi", "uniformRandom": True, "csvUpload": False, "tracks": [{"id": None, "weighting": None, "name": "A"}, {"id": None, "weighting": None, "name": "B"}, {"id": None, "weighting": None, "name": "C"}] } response = self.client.post( reverse("ab_testing_tool_submit_edit_experiment", args=(experiment_id,)), follow=True, content_type="application/json", data=json.dumps(experiment) ) self.assertOkay(response) self.assertEquals(num_experiments, Experiment.objects.count()) experiment = Experiment.objects.get(id=experiment_id) self.assertEquals(experiment.assignment_method, Experiment.UNIFORM_RANDOM) self.assertEquals(experiment.tracks.count(), no_tracks + 3) def test_submit_edit_experiment_unauthorized(self): """ Tests submit_edit_experiment when unauthorized""" self.set_roles([]) experiment = self.create_test_experiment(name="old_name") experiment_id = experiment.id experiment = {"name": "new_name", "notes": ""} response = self.client.post( reverse("ab_testing_tool_submit_edit_experiment", args=(experiment_id,)), content_type="application/json", data=json.dumps(experiment), follow=True ) self.assertTemplateUsed(response, "ab_tool/not_authorized.html") def test_submit_edit_experiment_nonexistent(self): """ Tests that submit_edit_experiment method raises error for non-existent Experiment """ experiment_id = NONEXISTENT_EXPERIMENT_ID experiment = {"name": "new_name", "notes": ""} response = self.client.post( reverse("ab_testing_tool_submit_edit_experiment", args=(experiment_id,)), content_type="application/json", data=json.dumps(experiment) ) self.assertEquals(response.status_code, 404) def test_submit_edit_experiment_wrong_course(self): """ Tests that submit_edit_experiment method raises error for existent Experiment but for wrong course""" experiment = self.create_test_experiment(name="old_name", course_id=TEST_OTHER_COURSE_ID) data = {"name": "new_name", "notes": ""} response = self.client.post( reverse("ab_testing_tool_submit_edit_experiment", args=(experiment.id,)), content_type="application/json", data=json.dumps(data) ) self.assertError(response, UNAUTHORIZED_ACCESS) def test_submit_edit_started_experiment_changes_name_and_notes(self): """ Tests that submit_edit_experiment changes an Experiment's name and notes and track names only if the experiment has already been started """ experiment = self.create_test_experiment(name="old_name", notes="old_notes", tracks_finalized=True) experiment_id = experiment.id num_experiments = Experiment.objects.count() old_track = self.create_test_track(experiment=experiment, name="old_name_track") experiment_json = { "name": "new_name", "notes": "new_notes", "tracks": [{"id": old_track.id, "name": "new_track_name"}], } response = self.client.post( reverse("ab_testing_tool_submit_edit_experiment", args=(experiment_id,)), follow=True, content_type="application/json", data=json.dumps(experiment_json) ) self.assertOkay(response) self.assertEquals(num_experiments, Experiment.objects.count()) experiment = Experiment.objects.get(id=experiment_id) self.assertEquals(experiment.name, "new_name") self.assertEquals(experiment.notes, "new_notes") self.assertEquals(experiment.tracks.all()[0].name, "new_track_name") def test_submit_edit_started_experiment_does_not_change_tracks(self): """ Tests that submit_edit_experiment doesn't change tracks for an experiment that has already been started """ experiment = self.create_test_experiment(name="old_name", tracks_finalized=True, assignment_method=Experiment.WEIGHTED_PROBABILITY_RANDOM) experiment_id = experiment.id num_experiments = Experiment.objects.count() no_tracks = experiment.tracks.count() experiment = { "name": "new_name", "notes": "hi", "uniformRandom": True, "csvUpload": False, "tracks": [{"id": None, "weighting": None, "name": "A"}, {"id": None, "weighting": None, "name": "B"}, {"id": None, "weighting": None, "name": "C"}] } response = self.client.post( reverse("ab_testing_tool_submit_edit_experiment", args=(experiment_id,)), follow=True, content_type="application/json", data=json.dumps(experiment) ) self.assertOkay(response) self.assertEquals(num_experiments, Experiment.objects.count()) experiment = Experiment.objects.get(id=experiment_id) self.assertEquals(experiment.assignment_method, Experiment.WEIGHTED_PROBABILITY_RANDOM) self.assertEquals(experiment.tracks.count(), no_tracks) def test_submit_edit_started_experiment_changes_existing_tracks(self): """ Tests that submit_edit_experiment does change track objects for an experiment that has not yet been started """ experiment = self.create_test_experiment(name="old_name", tracks_finalized=False, assignment_method=Experiment.WEIGHTED_PROBABILITY_RANDOM) track1 = self.create_test_track(experiment=experiment, name="A") track2 = self.create_test_track(experiment=experiment, name="B") self.create_test_track_weight(experiment=experiment, track=track1) self.create_test_track_weight(experiment=experiment, track=track2) track_count = experiment.tracks.count() experiment_json = { "name": "new_name", "notes": "hi", "uniformRandom": False, "csvUpload": False, "tracks": [{"id": track1.id, "weighting": 30, "name": "C"}, {"id": track2.id, "weighting": 70, "name": "D"}] } response = self.client.post( reverse("ab_testing_tool_submit_edit_experiment", args=(experiment.id,)), follow=True, content_type="application/json", data=json.dumps(experiment_json) ) self.assertOkay(response) experiment = Experiment.objects.get(id=experiment.id) self.assertEquals(experiment.assignment_method, Experiment.WEIGHTED_PROBABILITY_RANDOM) self.assertEquals(experiment.tracks.count(), track_count) track1 = experiment.tracks.get(id=track1.id) track2 = experiment.tracks.get(id=track2.id) self.assertEquals(track1.name, "C") #Checks name has changed self.assertEquals(track2.name, "D") self.assertEquals(track1.weight.weighting, 30) #Checks weighting has changed self.assertEquals(track2.weight.weighting, 70) def test_delete_experiment(self): """ Tests that delete_experiment method properly deletes a experiment when authorized""" first_num_experiments = Experiment.objects.count() experiment = self.create_test_experiment() self.assertEqual(first_num_experiments + 1, Experiment.objects.count()) response = self.client.post(reverse("ab_testing_tool_delete_experiment", args=(experiment.id,)), follow=True) second_num_experiments = Experiment.objects.count() self.assertOkay(response) self.assertEqual(first_num_experiments, second_num_experiments) def test_delete_experiment_already_finalized(self): """ Tests that delete experiment doesn't work when experiments are finalized """ experiment = self.create_test_experiment() experiment.update(tracks_finalized=True) first_num_experiments = Experiment.objects.count() response = self.client.post(reverse("ab_testing_tool_delete_experiment", args=(experiment.id,)), follow=True) second_num_experiments = Experiment.objects.count() self.assertError(response, EXPERIMENT_TRACKS_ALREADY_FINALIZED) self.assertEqual(first_num_experiments, second_num_experiments) @patch(LIST_MODULES, return_value=APIReturn([{"id": 0}])) def test_delete_experiment_has_installed_intervention_point(self, _mock1): """ Tests that delete experiment doesn't work when there is an associated intervention point is installed """ experiment = self.create_test_experiment() first_num_experiments = Experiment.objects.count() ret_val = [True] with patch("ab_tool.canvas.CanvasModules.experiment_has_installed_intervention", return_value=ret_val): response = self.client.post(reverse("ab_testing_tool_delete_experiment", args=(experiment.id,)), follow=True) second_num_experiments = Experiment.objects.count() self.assertError(response, INTERVENTION_POINTS_ARE_INSTALLED) self.assertEqual(first_num_experiments, second_num_experiments) def test_delete_experiment_unauthorized(self): """ Tests that delete_experiment method raises error when unauthorized """ self.set_roles([]) experiment = self.create_test_experiment() first_num_experiments = Experiment.objects.count() response = self.client.post(reverse("ab_testing_tool_delete_experiment", args=(experiment.id,)), follow=True) second_num_experiments = Experiment.objects.count() self.assertTemplateUsed(response, "ab_tool/not_authorized.html") self.assertEqual(first_num_experiments, second_num_experiments) def test_delete_experiment_nonexistent(self): """ Tests that delete_experiment method raises successfully redirects despite non-existent Experiment. This is by design, as the Http404 is caught since multiple users may be editing the A/B dashboard on in the same course """ self.create_test_experiment() t_id = NONEXISTENT_EXPERIMENT_ID first_num_experiments = Experiment.objects.count() response = self.client.post(reverse("ab_testing_tool_delete_experiment", args=(t_id,)), follow=True) second_num_experiments = Experiment.objects.count() self.assertEqual(first_num_experiments, second_num_experiments) self.assertOkay(response) def test_delete_experiment_wrong_course(self): """ Tests that delete_experiment method raises error for existent Experiment but for wrong course """ experiment = self.create_test_experiment(course_id=TEST_OTHER_COURSE_ID) first_num_experiments = Experiment.objects.count() response = self.client.post(reverse("ab_testing_tool_delete_experiment", args=(experiment.id,)), follow=True) second_num_experiments = Experiment.objects.count() self.assertEqual(first_num_experiments, second_num_experiments) self.assertError(response, UNAUTHORIZED_ACCESS) def test_delete_experiment_deletes_intervention_point_urls(self): """ Tests that intervention_point_urls of a experiment are deleted when the experiment is """ experiment = self.create_test_experiment() track1 = self.create_test_track(name="track1", experiment=experiment) track2 = self.create_test_track(name="track2", experiment=experiment) intervention_point = self.create_test_intervention_point() InterventionPointUrl.objects.create(intervention_point=intervention_point, track=track1, url="example.com") InterventionPointUrl.objects.create(intervention_point=intervention_point, track=track2, url="example.com") first_num_intervention_point_urls = InterventionPointUrl.objects.count() response = self.client.post(reverse("ab_testing_tool_delete_experiment", args=(experiment.id,)), follow=True) second_num_intervention_point_urls = InterventionPointUrl.objects.count() self.assertOkay(response) self.assertEqual(first_num_intervention_point_urls - 2, second_num_intervention_point_urls) def test_finalize_tracks(self): """ Tests that the finalize tracks page sets the appropriate course """ experiment = Experiment.get_placeholder_course_experiment(TEST_COURSE_ID) self.assertFalse(experiment.tracks_finalized) self.create_test_track() response = self.client.post(reverse("ab_testing_tool_finalize_tracks", args=(experiment.id,)), follow=True) self.assertOkay(response) experiment = Experiment.get_placeholder_course_experiment(TEST_COURSE_ID) self.assertTrue(experiment.tracks_finalized) def test_finalize_tracks_missing_urls(self): """ Tests that finalize fails if there are missing urls """ experiment = Experiment.get_placeholder_course_experiment(TEST_COURSE_ID) self.assertFalse(experiment.tracks_finalized) track1 = self.create_test_track(name="track1", experiment=experiment) self.create_test_track(name="track2", experiment=experiment) intervention_point = self.create_test_intervention_point() InterventionPointUrl.objects.create(intervention_point=intervention_point, track=track1, url="example.com") response = self.client.post(reverse("ab_testing_tool_finalize_tracks", args=(experiment.id,)), follow=True) self.assertOkay(response) experiment = Experiment.get_placeholder_course_experiment(TEST_COURSE_ID) self.assertFalse(experiment.tracks_finalized) def test_finalize_tracks_no_tracks(self): """ Tests that finalize fails if there are no tracks for an experiment """ experiment = Experiment.get_placeholder_course_experiment(TEST_COURSE_ID) response = self.client.post(reverse("ab_testing_tool_finalize_tracks", args=(experiment.id,)), follow=True) self.assertError(response, NO_TRACKS_FOR_EXPERIMENT) def test_finalize_tracks_missing_track_weights(self): """ Tests that finalize fails if there are no track weights for an weighted probability experiment """ experiment = self.create_test_experiment(assignment_method=Experiment.WEIGHTED_PROBABILITY_RANDOM) self.create_test_track(name="track1", experiment=experiment) response = self.client.post(reverse("ab_testing_tool_finalize_tracks", args=(experiment.id,)), follow=True) self.assertOkay(response) self.assertFalse(experiment.tracks_finalized) def test_copy_experiment(self): """ Tests that copy_experiment creates a new experiment """ experiment = self.create_test_experiment() num_experiments = Experiment.objects.count() url = reverse("ab_testing_tool_copy_experiment", args=(experiment.id,)) response = self.client.post(url, follow=True) self.assertOkay(response) self.assertEqual(Experiment.objects.count(), num_experiments + 1) def test_copy_experiment_unauthorized(self): """ Tests that copy_experiment fails when unauthorized """ self.set_roles([]) experiment = self.create_test_experiment() url = reverse("ab_testing_tool_copy_experiment", args=(experiment.id,)) response = self.client.post(url, follow=True) self.assertTemplateUsed(response, "ab_tool/not_authorized.html") def test_copy_experiment_inavlid_id(self): """ Tests that copy_experiment fails with bad experiment_id """ url = reverse("ab_testing_tool_copy_experiment", args=(12345,)) response = self.client.post(url, follow=True) self.assertEquals(response.status_code, 404) def test_copy_experiment_wrong_course(self): """ Tests that copy_experiment fails if experiment is different coruse """ experiment = self.create_test_experiment(course_id=TEST_OTHER_COURSE_ID) url = reverse("ab_testing_tool_copy_experiment", args=(experiment.id,)) response = self.client.post(url, follow=True) self.assertError(response, UNAUTHORIZED_ACCESS) def test_delete_track(self): """ Tests that delete_track method properly deletes a track of an experiment when authorized""" experiment = self.create_test_experiment() track = self.create_test_track(experiment=experiment) self.assertEqual(experiment.tracks.count(), 1) response = self.client.post(reverse("ab_testing_tool_delete_track", args=(track.id,)), follow=True) self.assertEqual(experiment.tracks.count(), 0) self.assertOkay(response) def test_delete_nonexistent_track(self): """ Tests that delete_track method succeeds, by design, when deleting a nonexistent track""" experiment = self.create_test_experiment() self.assertEqual(experiment.tracks.count(), 0) response = self.client.post(reverse("ab_testing_tool_delete_track", args=(NONEXISTENT_TRACK_ID,)), follow=True) self.assertEqual(experiment.tracks.count(), 0) self.assertOkay(response)
Java
#-*- coding: utf-8 -*- from flask import current_app, flash, url_for, request from flask_admin import expose, BaseView from logpot.admin.base import AuthenticateView, flash_errors from logpot.admin.forms import SettingForm from logpot.utils import ImageUtil, getDirectoryPath, loadSiteConfig, saveSiteConfig import os from PIL import Image class SettingView(AuthenticateView, BaseView): def saveProfileImage(self, filestorage): buffer = filestorage.stream buffer.seek(0) image = Image.open(buffer) image = ImageUtil.crop_image(image, 64) current_app.logger.info(image) dirpath = getDirectoryPath(current_app, '_settings') filepath = os.path.join(dirpath, "profile.png") image.save(filepath, optimize=True) @expose('/', methods=('GET','POST')) def index(self): form = SettingForm() if form.validate_on_submit(): if form.profile_img.data: file = form.profile_img.data self.saveProfileImage(file) data = {} data['site_title'] = form.title.data data['site_subtitle'] = form.subtitle.data data['site_author'] = form.author.data data['site_author_profile'] = form.author_profile.data data['enable_link_github'] = form.enable_link_github.data data['enable_profile_img'] = form.enable_profile_img.data data["ogp_app_id"] = form.ogp_app_id.data data["ga_tracking_id"] = form.ga_tracking_id.data data["enable_twittercard"] = form.enable_twittercard.data data["twitter_username"] = form.twitter_username.data data['display_poweredby'] = form.display_poweredby.data if saveSiteConfig(current_app, data): flash('Successfully saved.') else: flash_errors('Oops. Save error.') else: flash_errors(form) data = loadSiteConfig(current_app) form.title.data = data['site_title'] form.subtitle.data = data['site_subtitle'] form.author.data = data['site_author'] form.author_profile.data = data['site_author_profile'] form.enable_link_github.data = data['enable_link_github'] form.enable_profile_img.data = data['enable_profile_img'] form.ogp_app_id.data = data["ogp_app_id"] form.ga_tracking_id.data = data["ga_tracking_id"] form.enable_twittercard.data = data["enable_twittercard"] form.twitter_username.data = data["twitter_username"] form.display_poweredby.data = data['display_poweredby'] return self.render('admin/setting.html', form=form)
Java
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Queues extends CI_Controller { public function __construct() { parent::__construct(); date_default_timezone_set('Asia/Kolkata'); $this->is_logged_in(); } public function index() { $data['pageName']='Queues'; $data['pageLink']='queues'; $data['username']=$this->session->userdata('username'); $this->load->view('header',$data); $this->load->view('menu',$data); $this->load->view('breadcrump_view',$data); $this->load->model('Queue_model'); $data['queryresult'] = $this->Queue_model->getAllCustomerAppointments(); $data['checkedin']= array(); $data['inservice']= array(); $data['paymentdue']= array(); $data['complete']= array(); $data['appointments'] = array(); foreach ($data['queryresult'] as $row) { if($row['maxstatus']!=NULL) { if($row['maxstatus'] == 100) { array_push($data['checkedin'],$row); } else if($row['maxstatus'] == 200) { array_push($data['inservice'],$row); } else if($row['maxstatus'] == 300) { array_push($data['paymentdue'],$row); } else if($row['maxstatus'] == 400) { array_push($data['complete'],$row); } else { array_push($data['appointments'],$row); } } else { array_push($data['appointments'],$row); } } $this->load->view('queues_view',$data); $this->load->view('footer',$data); } public function updateAppointments() { $appntId = $_POST['appointmentId']; $status = $_POST['status']; $this->load->model('Queue_model'); $data = array( 'appointment_id' => $appntId , 'status' => $status ); $this->Queue_model->updateQueueDetails($data); if($status == 100){ $this->session->set_flashdata('flashSuccess', 'Customer moved to Check-In Q successfully !'); } if($status == 200){ $this->session->set_flashdata('flashSuccess', 'Customer moved to Service Q successfully !'); } if($status == 300){ $this->session->set_flashdata('flashSuccess', 'Customer moved to Payment Q successfully !'); } if($status == 400){ $this->session->set_flashdata('flashSuccess', 'All services done !!!'); } } function is_logged_in(){ $is_logged_in = $this->session->userdata('is_logged_in'); if(!isset($is_logged_in) || $is_logged_in!= true){ redirect ('/login', 'refresh'); } } public function add(){ $this->_validate(); $data = array( 'title' => $this->input->post('customer_name'), 'start' => $this->input->post('start_time'), 'end' => $this->input->post('end_time'), 'allDay' => 'false', ); $insert = $this->appointments->add_appointments($data); $insert2 = $this->queues->add($data); echo json_encode(array("status" => TRUE)); } private function _validate() { $data = array(); $data['error_string'] = array(); $data['inputerror'] = array(); $data['status'] = TRUE; if($this->input->post('customer_name') == '') { $data['inputerror'][] = 'customer_name'; $data['error_string'][] = 'Customer Name is required'; $data['status'] = FALSE; } if($this->input->post('start_time') == '') { $data['inputerror'][] = 'start_time'; $data['error_string'][] = 'Start Time is required'; $data['status'] = FALSE; } if($this->input->post('end_time') == '') { $data['inputerror'][] = 'end_time'; $data['error_string'][] = 'End Time is required'; $data['status'] = FALSE; } if($data['status'] === FALSE) { echo json_encode($data); exit(); } } }
Java
SOURCES=$(shell find notebooks -name *.Rmd) TARGETS=$(SOURCES:%.Rmd=%.pdf) %.html: %.Rmd @echo "$< -> $@" @Rscript -e "rmarkdown::render('$<')" %.pdf: %.Rmd @echo "$< -> $@" @Rscript -e "rmarkdown::render('$<')" default: $(TARGETS) clean: rm -rf $(TARGETS)
Java
--- header: meta example: Collection.meta --- The `meta` attribute is a special attribute on a Collection which allows you to store additional information about the Collection instance. For example, you can save pagination data in `meta`. The meta information is part of the information that is stored in the object when you call [Collection.toJSON](http://backbonejs.org/#Collection-toJSON).
Java
use std::ops::{Add, Mul}; use std::iter::Sum; #[derive(Copy, Clone, Serialize, Deserialize)] pub struct Color(pub f64, pub f64, pub f64); pub const RED: Color = Color(1.0, 0.0, 0.0); pub const GREEN: Color = Color(0.0, 1.0, 0.0); pub const BLUE: Color = Color(0.0, 0.0, 1.0); pub const WHITE: Color = Color(1.0, 1.0, 1.0); pub const BLACK: Color = Color(0.0, 0.0, 0.0); impl Add for Color { type Output = Color; fn add(self, other: Color) -> Color { Color(self.0 + other.0, self.1 + other.1, self.2 + other.2) } } impl Mul for Color { type Output = Color; fn mul(self, other: Color) -> Color { Color(self.0 * other.0, self.1 * other.1, self.2 * other.2) } } impl Mul<f64> for Color { type Output = Color; fn mul(self, other: f64) -> Color { Color(self.0 * other, self.1 * other, self.2 * other) } } impl Into<(u8, u8, u8)> for Color { fn into(mut self) -> (u8, u8, u8) { if self.0 > 1.0 { self.0 = 1.0; } if self.1 > 1.0 { self.1 = 1.0; } if self.2 > 1.0 { self.2 = 1.0; } ( (255.0 * self.0) as u8, (255.0 * self.1) as u8, (255.0 * self.2) as u8, ) } } impl Sum for Color { fn sum<I>(iter: I) -> Self where I: Iterator<Item = Self>, { iter.fold(Color(0.0, 0.0, 0.0), |s, c| s + c) } }
Java
<?php namespace Todohelpist\Console\Commands; use Illuminate\Console\Command; use Illuminate\Foundation\Inspiring; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputArgument; class Inspire extends Command { /** * The console command name. * * @var string */ protected $name = 'inspire'; /** * The console command description. * * @var string */ protected $description = 'Display an inspiring quote'; /** * Execute the console command. * * @return mixed */ public function handle() { $this->comment(PHP_EOL.Inspiring::quote().PHP_EOL); } }
Java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2015.10.21 at 02:36:24 PM CEST // package nl.wetten.bwbng.toestand; import java.util.ArrayList; import java.util.List; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementRefs; import javax.xml.bind.annotation.XmlMixed; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;choice maxOccurs="unbounded" minOccurs="0"> * &lt;group ref="{}tekst.minimaal"/> * &lt;element ref="{}nootref"/> * &lt;element ref="{}noot"/> * &lt;/choice> * &lt;element ref="{}meta-data" minOccurs="0"/> * &lt;/sequence> * &lt;attGroup ref="{}attlist.intitule"/> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) @XmlRootElement(name = "intitule") public class Intitule { @XmlElementRefs({ @XmlElementRef(name = "nadruk", type = Nadruk.class, required = false), @XmlElementRef(name = "omissie", type = Omissie.class, required = false), @XmlElementRef(name = "sup", type = JAXBElement.class, required = false), @XmlElementRef(name = "noot", type = Noot.class, required = false), @XmlElementRef(name = "unl", type = JAXBElement.class, required = false), @XmlElementRef(name = "meta-data", type = MetaData.class, required = false), @XmlElementRef(name = "nootref", type = Nootref.class, required = false), @XmlElementRef(name = "ovl", type = JAXBElement.class, required = false), @XmlElementRef(name = "inf", type = JAXBElement.class, required = false) }) @XmlMixed protected List<Object> content; @XmlAttribute(name = "id") @XmlSchemaType(name = "anySimpleType") protected String id; @XmlAttribute(name = "status") protected String status; @XmlAttribute(name = "terugwerking") @XmlSchemaType(name = "anySimpleType") protected String terugwerking; @XmlAttribute(name = "label-id") @XmlSchemaType(name = "anySimpleType") protected String labelId; @XmlAttribute(name = "stam-id") @XmlSchemaType(name = "anySimpleType") protected String stamId; @XmlAttribute(name = "versie-id") @XmlSchemaType(name = "anySimpleType") protected String versieId; @XmlAttribute(name = "publicatie") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String publicatie; /** * Gets the value of the content property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the content property. * * <p> * For example, to add a new item, do as follows: * <pre> * getContent().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Nadruk } * {@link Omissie } * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link Noot } * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link MetaData } * {@link Nootref } * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link String } * * */ public List<Object> getContent() { if (content == null) { content = new ArrayList<Object>(); } return this.content; } /** * Gets the value of the id property. * * @return * possible object is * {@link String } * */ public String getId() { return id; } /** * Sets the value of the id property. * * @param value * allowed object is * {@link String } * */ public void setId(String value) { this.id = value; } /** * Gets the value of the status property. * * @return * possible object is * {@link String } * */ public String getStatus() { return status; } /** * Sets the value of the status property. * * @param value * allowed object is * {@link String } * */ public void setStatus(String value) { this.status = value; } /** * Gets the value of the terugwerking property. * * @return * possible object is * {@link String } * */ public String getTerugwerking() { return terugwerking; } /** * Sets the value of the terugwerking property. * * @param value * allowed object is * {@link String } * */ public void setTerugwerking(String value) { this.terugwerking = value; } /** * Gets the value of the labelId property. * * @return * possible object is * {@link String } * */ public String getLabelId() { return labelId; } /** * Sets the value of the labelId property. * * @param value * allowed object is * {@link String } * */ public void setLabelId(String value) { this.labelId = value; } /** * Gets the value of the stamId property. * * @return * possible object is * {@link String } * */ public String getStamId() { return stamId; } /** * Sets the value of the stamId property. * * @param value * allowed object is * {@link String } * */ public void setStamId(String value) { this.stamId = value; } /** * Gets the value of the versieId property. * * @return * possible object is * {@link String } * */ public String getVersieId() { return versieId; } /** * Sets the value of the versieId property. * * @param value * allowed object is * {@link String } * */ public void setVersieId(String value) { this.versieId = value; } /** * Gets the value of the publicatie property. * * @return * possible object is * {@link String } * */ public String getPublicatie() { return publicatie; } /** * Sets the value of the publicatie property. * * @param value * allowed object is * {@link String } * */ public void setPublicatie(String value) { this.publicatie = value; } }
Java
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("DnDGen.Web.Tests.Integration")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DnDGen.Web.Tests.Integration")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("722de08a-3185-48fd-b1c7-78eb3a1cde4d")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
Java
var f = require('fs'); var _ = require('underscore'); var r = {}; var cr = require('../config.json').resources; var k = require('../config.json').plugins; var b = require('../config.json').APIVARS.PLUGINS; var n = __dirname.replace('/autoform', b.DIR); var w = ['tokens', 'settings']; var s = ['actions', 'login', 'recover', 'register' ]; var p = './views/index/forms'; var c = function (n) { return n.replace('.jade',''); }; var j = function (props) { for (var p in props) { if(props.hasOwnProperty(p)){ if(!props[p].exclude){ r[p] = props[p]; } } } }; var init = function() { for(var i in k){ if(k.hasOwnProperty(i)){ var e = k[i]; var g = '/' + e; var a = require(n + g + b.CONFIG); j(a.resources); } } }; init(); j(r); var generator = function (cb) { var t; var x; var v; var u = _.union(Object.keys(r), Object.keys(cr)); var m = _.difference(u, w); for(var idx in r) { if (r.hasOwnProperty(idx)) { rc[idx] = r[idx]; } } if(f.existsSync(p)){ t = f.readdirSync(p); t = _.map(t, c); t = _.difference(t,s); x = _.intersection(m,t); v = _.difference(m,t); } cb({ models: m, valid: x, missing: v, resources: u, schemas: cr }); }; module.exports = generator;
Java
SET DEFINE OFF; ALTER TABLE AFW_13_PAGE_ITEM ADD ( CONSTRAINT AFW_13_PAGE_ITEM_FK2 FOREIGN KEY (REF_MESG_AIDE) REFERENCES AFW_01_MESG (SEQNC) ENABLE VALIDATE) /
Java
// Copyright © 2014-2016 Ryan Leckey, All Rights Reserved. // Distributed under the MIT License // See accompanying file LICENSE #ifndef ARROW_PASS_H #define ARROW_PASS_H #include <memory> #include <string> #include "arrow/generator.hpp" namespace arrow { class Pass { public: explicit Pass(GContext& ctx) : _ctx(ctx) { } Pass(const Pass& other) = delete; Pass(Pass&& other) = delete; Pass& operator=(const Pass& other) = delete; Pass& operator=(Pass&& other) = delete; protected: GContext& _ctx; }; } // namespace arrow #endif // ARROW_PASS_H
Java
<?php defined('BASEPATH') OR exit('No direct script access allowed'); require_once("Auth.php"); class GameQuestion extends Auth { public function __construct(){ parent::__construct(); $this->load->model("game_md"); $this->load->model("question_md"); } public function index($game_id) { $data = array(); if(!$this->game_md->isOwner($this->mem_id,$game_id)&&$game_id>0){ echo "ไม่พบเกมส์ที่คุณเลือก"; exit; } $data["question_no"] = $this->question_md->checkQuestionNo($game_id); if($post = $this->input->post()){ $d["question"] = $post["question"]; $d["no"] = $data["question_no"]; $d["game_id"] = $game_id; $this->question_md->save($d); if(isset($post["next"])){ }else if(isset($post["finish"])){ } } $data["game_id"] = $game_id; $content["content"] = $this->load->view("gamequestion/index_tpl",$data,true); $this->load->view("layout_tpl",$content); } private function do_upload($game_id ,$filename) { $config['file_name'] = $filename; $config['upload_path'] = "./uploads/$game_id/"; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = 1024; $config['max_width'] = 1024; $config['max_height'] = 768; if (!file_exists($config['upload_path'])) { mkdir($config['upload_path'], 0777); echo "The directory was successfully created."; } $this->load->library('upload', $config); if ( ! $this->upload->do_upload('userfile')) { $error = array('error' => $this->upload->display_errors()); //echo $this->upload->display_errors(); //$this->load->view('upload_form', $error); } else { $data = array('upload_data' => $this->upload->data()); //print_r( $this->upload->data()); //$this->load->view('upload_success', $data); } } }
Java
--- date: 2015-05-09T16:59:30+02:00 title: "Exporting Your Mockups" menu: "menugoogledrive3" product: "Balsamiq Mockups 3 for Google Drive" weight: 160 tags: - "Exporting" - "PDF" - "PNG" - "Printing" - "Image" include: "exporting" editorversion: 3 aliases: /google-drive/exporting/ ---
Java
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: gmange <gmange@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2013/12/02 16:03:39 by gmange #+# #+# */ /* Updated: 2016/09/27 10:53:59 by gmange ### ########.fr */ /* */ /* ************************************************************************** */ #include <unistd.h> #include "libft.h" #include "get_next_line.h" /* ** returns 0 when reading 0 and, leaves line == NULL ** ONLY if there is an empty end of line at the end of file... */ /* ** structures with the same fd are set in a row */ /* ** 3 reasons to come in: ** 1. chck, remaining struct with corresponding fd from previous read ** 2. chck buf after reading ** 3. read last bits. */ /* ** EOF == -1 in C or read == 0 */ /* ** I check I have no new line already in memory ** would I have I fill line and send it already ** else ** I create a new structure to read in it ** I check it and read again until I find a line or finishes reading */ static int del_cur(t_read **root, t_read *cur, int continu) { t_read *tmp; if (cur == *root) *root = GNL_NXT; else { tmp = *root; while (tmp->nxt != cur) tmp = tmp->nxt; tmp->nxt = GNL_NXT; } ft_memdel((void**)&GNL_BUF); ft_memdel((void**)&cur); return (continu); } static int line_from_lst(char **line, t_read **root, int const fd) { t_read *cur; t_read *tmp; size_t i; cur = *root; while (GNL_FD != fd) cur = GNL_NXT; i = 0; while (cur && GNL_FD == fd) { while (GNL_IDX < GNL_SZE && GNL_BUF[GNL_IDX] != CHAR) (*line)[i++] = GNL_BUF[GNL_IDX++]; if (GNL_BUF[GNL_IDX] == CHAR && ++GNL_IDX >= GNL_SZE) return (del_cur(root, cur, 1)); if (GNL_IDX < GNL_SZE) return (1); tmp = GNL_NXT; if (GNL_IDX >= GNL_SZE) del_cur(root, cur, 1); cur = tmp; } return (0); } static int find_endl(char **line, t_read **root, t_read *cur, int continu) { t_read *tmp; size_t len; len = GNL_IDX; while (len < GNL_SZE && (unsigned char)GNL_BUF[len] != (unsigned char)CHAR) len++; if (!continu || (unsigned char)GNL_BUF[len] == (unsigned char)CHAR) { len -= GNL_IDX; tmp = *root; while (tmp->fd != GNL_FD) tmp = tmp->nxt; while (tmp != cur && (len += tmp->sze)) tmp = tmp->nxt; if (!continu && len == 0) return (del_cur(root, cur, continu)); if (!(*line = (char*)ft_memalloc(sizeof(char) * (len + 1)))) return (-1); return (line_from_lst(line, root, GNL_FD)); } return (0); } static t_read *new_read(t_read **root, int const fd) { t_read *cur; if (!(cur = (t_read*)ft_memalloc(sizeof(*cur)))) return (NULL); GNL_FD = fd; if (!(GNL_BUF = (char*)ft_memalloc(sizeof(*GNL_BUF) * GNL_BUF_SZE))) { ft_memdel((void**)&cur); return (NULL); } if ((int)(GNL_SZE = read(GNL_FD, GNL_BUF, GNL_BUF_SZE)) < 0) { ft_memdel((void**)&GNL_BUF); ft_memdel((void**)&cur); return (NULL); } GNL_IDX = 0; GNL_NXT = NULL; if (*root) GNL_NXT = (*root)->nxt; if (*root) (*root)->nxt = cur; else *root = cur; return (cur); } int get_next_line(int const fd, char **line) { size_t ret; static t_read *root = NULL; t_read *cur; if (!line || (*line = NULL)) return (-1); cur = root; while (cur && GNL_FD != fd) cur = GNL_NXT; if (cur && GNL_FD == fd && (ret = find_endl(line, &root, cur, 1))) return (ret); while (cur && GNL_FD == fd && GNL_NXT) cur = GNL_NXT; while (1) { if (root && !(cur = new_read(&cur, fd))) return (-1); if (!root && !(cur = new_read(&root, fd))) return (-1); if (!GNL_SZE) return (find_endl(line, &root, cur, 0)); if ((ret = find_endl(line, &root, cur, 1))) return (ret); } }
Java
/* =========================================================== * bootstrap-modal.js v2.1 * =========================================================== * Copyright 2012 Jordan Schroter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* MODAL CLASS DEFINITION * ====================== */ var Modal = function (element, options) { this.init(element, options); }; Modal.prototype = { constructor: Modal, init: function (element, options) { this.options = options; this.$element = $(element) .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)); this.options.remote && this.$element.find('.modal-body').load(this.options.remote); var manager = typeof this.options.manager === 'function' ? this.options.manager.call(this) : this.options.manager; manager = manager.appendModal ? manager : $(manager).modalmanager().data('modalmanager'); manager.appendModal(this); }, toggle: function () { return this[!this.isShown ? 'show' : 'hide'](); }, show: function () { var e = $.Event('show'); if (this.isShown) return; this.$element.triggerHandler(e); if (e.isDefaultPrevented()) return; this.escape(); this.tab(); this.options.loading && this.loading(); }, hide: function (e) { e && e.preventDefault(); e = $.Event('hide'); this.$element.triggerHandler(e); if (!this.isShown || e.isDefaultPrevented()) return (this.isShown = false); this.isShown = false; this.escape(); this.tab(); this.isLoading && this.loading(); $(document).off('focusin.modal'); this.$element .removeClass('in') .removeClass('animated') .removeClass(this.options.attentionAnimation) .removeClass('modal-overflow') .attr('aria-hidden', true); $.support.transition && this.$element.hasClass('fade') ? this.hideWithTransition() : this.hideModal(); }, layout: function () { var prop = this.options.height ? 'height' : 'max-height', value = this.options.height || this.options.maxHeight; if (this.options.width){ this.$element.css('width', this.options.width); var that = this; this.$element.css('margin-left', function () { if (/%/ig.test(that.options.width)){ return -(parseInt(that.options.width) / 2) + '%'; } else { return -($(this).width() / 2) + 'px'; } }); } else { this.$element.css('width', ''); this.$element.css('margin-left', ''); } this.$element.find('.modal-body') .css('overflow', '') .css(prop, ''); var modalOverflow = $(window).height() - 10 < this.$element.height(); if (value){ this.$element.find('.modal-body') .css('overflow', 'auto') .css(prop, value); } if (modalOverflow || this.options.modalOverflow) { this.$element .css('margin-top', 0) .addClass('modal-overflow'); } else { this.$element .css('margin-top', 0 - this.$element.height() / 2) .removeClass('modal-overflow'); } }, tab: function () { var that = this; if (this.isShown && this.options.consumeTab) { this.$element.on('keydown.tabindex.modal', '[data-tabindex]', function (e) { if (e.keyCode && e.keyCode == 9){ var $next = $(this), $rollover = $(this); that.$element.find('[data-tabindex]:enabled:not([readonly])').each(function (e) { if (!e.shiftKey){ $next = $next.data('tabindex') < $(this).data('tabindex') ? $next = $(this) : $rollover = $(this); } else { $next = $next.data('tabindex') > $(this).data('tabindex') ? $next = $(this) : $rollover = $(this); } }); $next[0] !== $(this)[0] ? $next.focus() : $rollover.focus(); e.preventDefault(); } }); } else if (!this.isShown) { this.$element.off('keydown.tabindex.modal'); } }, escape: function () { var that = this; if (this.isShown && this.options.keyboard) { if (!this.$element.attr('tabindex')) this.$element.attr('tabindex', -1); this.$element.on('keyup.dismiss.modal', function (e) { e.which == 27 && that.hide(); }); } else if (!this.isShown) { this.$element.off('keyup.dismiss.modal') } }, hideWithTransition: function () { var that = this , timeout = setTimeout(function () { that.$element.off($.support.transition.end); that.hideModal(); }, 500); this.$element.one($.support.transition.end, function () { clearTimeout(timeout); that.hideModal(); }); }, hideModal: function () { this.$element .hide() .triggerHandler('hidden'); var prop = this.options.height ? 'height' : 'max-height'; var value = this.options.height || this.options.maxHeight; if (value){ this.$element.find('.modal-body') .css('overflow', '') .css(prop, ''); } }, removeLoading: function () { this.$loading.remove(); this.$loading = null; this.isLoading = false; }, loading: function (callback) { callback = callback || function () {}; var animate = this.$element.hasClass('fade') ? 'fade' : ''; if (!this.isLoading) { var doAnimate = $.support.transition && animate; this.$loading = $('<div class="loading-mask ' + animate + '">') .append(this.options.spinner) .appendTo(this.$element); if (doAnimate) this.$loading[0].offsetWidth; // force reflow this.$loading.addClass('in'); this.isLoading = true; doAnimate ? this.$loading.one($.support.transition.end, callback) : callback(); } else if (this.isLoading && this.$loading) { this.$loading.removeClass('in'); var that = this; $.support.transition && this.$element.hasClass('fade')? this.$loading.one($.support.transition.end, function () { that.removeLoading() }) : that.removeLoading(); } else if (callback) { callback(this.isLoading); } }, focus: function () { var $focusElem = this.$element.find(this.options.focusOn); $focusElem = $focusElem.length ? $focusElem : this.$element; $focusElem.focus(); }, attention: function (){ // NOTE: transitionEnd with keyframes causes odd behaviour if (this.options.attentionAnimation){ this.$element .removeClass('animated') .removeClass(this.options.attentionAnimation); var that = this; setTimeout(function () { that.$element .addClass('animated') .addClass(that.options.attentionAnimation); }, 0); } this.focus(); }, destroy: function () { var e = $.Event('destroy'); this.$element.triggerHandler(e); if (e.isDefaultPrevented()) return; this.teardown(); }, teardown: function () { if (!this.$parent.length){ this.$element.remove(); this.$element = null; return; } if (this.$parent !== this.$element.parent()){ this.$element.appendTo(this.$parent); } this.$element.off('.modal'); this.$element.removeData('modal'); this.$element .removeClass('in') .attr('aria-hidden', true); } }; /* MODAL PLUGIN DEFINITION * ======================= */ $.fn.modal = function (option, args) { return this.each(function () { var $this = $(this), data = $this.data('modal'), options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option); if (!data) $this.data('modal', (data = new Modal(this, options))); if (typeof option == 'string') data[option].apply(data, [].concat(args)); else if (options.show) data.show() }) }; $.fn.modal.defaults = { keyboard: true, backdrop: true, loading: false, show: true, width: null, height: null, maxHeight: null, modalOverflow: false, consumeTab: true, focusOn: null, replace: false, resize: false, attentionAnimation: 'shake', manager: 'body', spinner: '<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="bar" style="width: 100%;"></div></div></div>' }; $.fn.modal.Constructor = Modal; /* MODAL DATA-API * ============== */ $(function () { $(document).off('.modal').on('click.modal.data-api', '[data-toggle="modal"]', function (e) { var $this = $(this), href = $this.attr('href'), $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))), //strip for ie7 option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()); e.preventDefault(); $target .modal(option) .one('hide', function () { $this.focus(); }) }); }); }(window.jQuery);
Java
using System.Collections.Generic; using System.Data.Common; using System.Linq; namespace Affixx.Core.Database.Generator { internal class SqlServerSchemaReader : SchemaReader { private DbConnection _connection; public override Tables ReadSchema(DbConnection connection) { var result = new Tables(); _connection = connection; using (var command = _connection.CreateCommand()) { command.CommandText = TABLE_SQL; using (var reader = command.ExecuteReader()) { while (reader.Read()) { var table = new Table(); table.Name = reader["TABLE_NAME"].ToString(); table.Schema = reader["TABLE_SCHEMA"].ToString(); table.IsView = string.Compare(reader["TABLE_TYPE"].ToString(), "View", true) == 0; table.CleanName = CleanUp(table.Name); table.ClassName = Inflector.MakeSingular(table.CleanName); result.Add(table); } } } //pull the tables in a reader foreach (var table in result) { table.Columns = LoadColumns(table); // Mark the primary key string primaryKey = GetPK(table.Name); var pkColumn = table.Columns.SingleOrDefault(x => x.Name.ToLower().Trim() == primaryKey.ToLower().Trim()); if (pkColumn != null) { pkColumn.IsPK = true; } } return result; } private List<Column> LoadColumns(Table tbl) { using (var command = _connection.CreateCommand()) { command.Connection = _connection; command.CommandText = COLUMN_SQL; var p = command.CreateParameter(); p.ParameterName = "@tableName"; p.Value = tbl.Name; command.Parameters.Add(p); p = command.CreateParameter(); p.ParameterName = "@schemaName"; p.Value = tbl.Schema; command.Parameters.Add(p); var result = new List<Column>(); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var column = new Column(); column.Name = reader["ColumnName"].ToString(); column.PropertyName = CleanUp(column.Name); column.PropertyType = GetPropertyType(reader["DataType"].ToString()); column.IsNullable = reader["IsNullable"].ToString() == "YES"; column.IsAutoIncrement = ((int)reader["IsIdentity"]) == 1; result.Add(column); } } return result; } } string GetPK(string table) { string sql = @" SELECT c.name AS ColumnName FROM sys.indexes AS i INNER JOIN sys.index_columns AS ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id INNER JOIN sys.objects AS o ON i.object_id = o.object_id LEFT OUTER JOIN sys.columns AS c ON ic.object_id = c.object_id AND c.column_id = ic.column_id WHERE (i.type = 1) AND (o.name = @tableName) "; using (var command = _connection.CreateCommand()) { command.CommandText = sql; var p = command.CreateParameter(); p.ParameterName = "@tableName"; p.Value = table; command.Parameters.Add(p); var result = command.ExecuteScalar(); if (result != null) return result.ToString(); } return ""; } string GetPropertyType(string sqlType) { string sysType = "string"; switch (sqlType) { case "bigint": sysType = "long"; break; case "smallint": sysType = "short"; break; case "int": sysType = "int"; break; case "uniqueidentifier": sysType = "Guid"; break; case "smalldatetime": case "datetime": case "date": case "time": sysType = "DateTime"; break; case "float": sysType = "double"; break; case "real": sysType = "float"; break; case "numeric": case "smallmoney": case "decimal": case "money": sysType = "decimal"; break; case "tinyint": sysType = "byte"; break; case "bit": sysType = "bool"; break; case "image": case "binary": case "varbinary": case "timestamp": sysType = "byte[]"; break; case "geography": sysType = "Microsoft.SqlServer.Types.SqlGeography"; break; case "geometry": sysType = "Microsoft.SqlServer.Types.SqlGeometry"; break; } return sysType; } const string TABLE_SQL = @" SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' OR TABLE_TYPE='VIEW' "; const string COLUMN_SQL = @" SELECT TABLE_CATALOG AS [Database], TABLE_SCHEMA AS Owner, TABLE_NAME AS TableName, COLUMN_NAME AS ColumnName, ORDINAL_POSITION AS OrdinalPosition, COLUMN_DEFAULT AS DefaultSetting, IS_NULLABLE AS IsNullable, DATA_TYPE AS DataType, CHARACTER_MAXIMUM_LENGTH AS MaxLength, DATETIME_PRECISION AS DatePrecision, COLUMNPROPERTY(object_id('[' + TABLE_SCHEMA + '].[' + TABLE_NAME + ']'), COLUMN_NAME, 'IsIdentity') AS IsIdentity, COLUMNPROPERTY(object_id('[' + TABLE_SCHEMA + '].[' + TABLE_NAME + ']'), COLUMN_NAME, 'IsComputed') as IsComputed FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME=@tableName AND TABLE_SCHEMA=@schemaName ORDER BY OrdinalPosition ASC "; } }
Java
<p align="center"><a href="https://godoc.org/github.com/volatile/response"><img src="http://volatile.whitedevops.com/images/repositories/response/logo.png" alt="response" title="response"></a><br><br></p> Package [response](https://godoc.org/github.com/volatile/response) is a helper for the [core](https://godoc.org/github.com/volatile/core). It provides syntactic sugar that lets you easily write responses on the context. [![GoDoc](https://godoc.org/github.com/volatile/response?status.svg)](https://godoc.org/github.com/volatile/response)
Java
<div class="row"> <div class="col-xs-4 form-group" validity-coordinator> <label for="petname{{ctrl.index}}">Pet name</label> <input validate ng-model="ctrl.pet.name" type="text" class="form-control" id="petname{{ctrl.index}}" /> <validity-indicator></validity-indicator> </div> <div class="col-xs-4 form-group"> <label for="type{{ctrl.index}}">Type</label> <input ng-model="ctrl.pet.type" type="text" class="form-control" id="type{{ctrl.index}}" /> </div> <div class="col-xs-4 form-group"> <label for="gender{{ctrl.index}}">Gender</label> <div class="input-group"> <select ng-model="ctrl.pet.gender" ng-options="g.code as g.display for g in ctrl.genders" id="gender{{ctrl.index}}" class="form-control"> <option value=""></option> </select> <span class="input-group-btn"> <button class="btn btn-primary" type="button" ng-click="ctrl.addItem()">+</button> <button class="btn btn-danger" type="button" ng-click="ctrl.removeItem()">-</button> </span> </div> </div> <div class="col-xs-12"> <panel-collection-editor ng-model="ctrl.pet.vaccinations" var-name="item" add-item="ctrl.addVaccination(index)" remove-item="ctrl.removeVaccination(item)"> <header><h4>Vaccinations</h4></header> <vaccination-editor ng-model="item" index="$index" remove-item="removeItem({item:item})"></vaccination-editor> </panel-collection-editor> </div> </div>
Java
<p><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="bc.css"> <script src="run_prettify.js" type="text/javascript"></script> <!--- <script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js" type="text/javascript"></script> --> </head></p> <!--- - 11556999 [Export to DWF / PrintSetup] - delete print setup: http://forums.autodesk.com/t5/revit-api/delete-printsetup-and-viewsheetsettings/m-p/6063449 - reload dll for debugging without restart http://stackoverflow.com/questions/33525908/revit-api-load-command-auto-reload - draw a curve: http://forums.autodesk.com/t5/revit-api/draw-curve-in-activeuidocument-document-using-ilist-lt-xyz-gt/td-p/6063446 - distance from family instance to floor or elevation http://forums.autodesk.com/t5/revit-api/elevation-of-family-instance-from-floor-or-level-below-it/m-p/6058148 #dotnet #csharp #fsharp #python #grevit #responsivedesign #typepad #ah8 #augi #dotnet #stingray #rendering #3dweb #3dviewAPI #html5 #threejs #webgl #3d #mobile #vr #ecommerce #Markdown #Fusion360 #Fusion360Hackathon #javascript #RestSharp #restAPI #mongoosejs #mongodb #nodejs #rtceur #xaml #3dweb #a360 #3dwebaccel #webgl @adskForge @AutodeskReCap @Adsk3dsMax #revitAPI #bim #aec #3dwebcoder #adsk #adskdevnetwrk @jimquanci @keanw #au2015 #rtceur #eraofconnection #RMS @researchdigisus @adskForge #3dwebaccel #a360 @github Revit API, Jeremy Tammik, akn_include Index, Debug, Curves, Distance, Deleting PrintSetup #revitAPI #3dwebcoder @AutodeskRevit #bim #aec #adsk #adskdevnetwrk Here is another bunch of issues addressed in the Revit API discussion forum and elsewhere in the past day or two &ndash; The Building Coder blog source text and index &ndash; Reloading add-in DLL for debugging without restart &ndash; Drawing curves from a list of points &ndash; Determining the distance of a family instance to the floor or elevation &ndash; Deleting a PrintSetup or ViewSheetSetting... --> <h3>Index, Debug, Curves, Distance, Deleting PrintSetup</h3> <p>Here is another bunch of issues addressed in the <a href="http://forums.autodesk.com/t5/revit-api/bd-p/160">Revit API discussion forum</a> and elsewhere in the past day or two:</p> <ul> <li><a href="#2">The Building Coder blog source text and index</a></li> <li><a href="#3">Reloading add-in DLL for debugging without restart</a></li> <li><a href="#4">Drawing curves from a list of points</a></li> <li><a href="#5">Determining the distance of a family instance to the floor or elevation</a></li> <li><a href="#6">Deleting a PrintSetup or ViewSheetSetting</a></li> </ul> <h4><a name="2"></a>The Building Coder Blog Source Text and Index</h4> <p>As you may have noticed, I published <a href="http://thebuildingcoder.typepad.com/blog/2016/02/tbc-the-building-coder-source-and-index-on-github.html">The Building Coder entire source text and complete index on GitHub</a> last week.</p> <p>If you look now at the right hand side bar or the navigation bar at the bottom, you will see the two new entries <a href="https://jeremytammik.github.io/tbc/a">index</a> and <a href="https://github.com/jeremytammik/tbc">source</a> that take you straight there.</p> <p><center> <img src="img/index_finger.jpg" alt="Index finger" width="360"> </center></p> <p>I hope you find the complete index and full source text access useful!</p> <h4><a name="3"></a>Reloading Add-in DLL for Debugging Without Restart</h4> <p>We have often dealt here with topics around <a href="http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.49">edit and continue, debug without restart and 'live development'</a>.</p> <p>This note is just to point out another contribution to that series, a StackOverflow question on <a href="http://stackoverflow.com/questions/33525908/revit-api-load-command-auto-reload">Revit API load command &ndash; auto reload</a>, in case you are interested in this too.</p> <h4><a name="4"></a>Drawing Curves from a List of Points</h4> <p>This is a very common need, brought up again by Dirk Neethling in the thread on <a href="http://forums.autodesk.com/t5/revit-api/draw-curve-in-activeuidocument-document-using-ilist-lt-xyz-gt/td-p/6063446">drawing a curve in ActiveUIDocument.Document using IList&lt;XYZ&gt;</a>:</p> <p><strong>Question:</strong> I'm trying to draw a contiguous curve in an ActiveUIDocument.Document, using a List of <code>XYZ</code> objects. Most examples draw a curve in a FamilyDocument, and I could not adapt it for an ActiveUIDocument.Document. Is it necessary to create a plane for such a curve?</p> <p><strong>Answer:</strong> Yes, it is.</p> <p>You can create a model curve or a detail curve, and both reside on a sketch plane.</p> <p>If you care about efficiency, you might care to reuse the sketch planes as much as possible.</p> <p>Note that some existing samples create a new sketch plane for each individual curve, which is not a nice thing to do.</p> <p>The Building Coder provides a number of samples, e.g.:</p> <ul> <li><a href="http://thebuildingcoder.typepad.com/blog/2010/01/model-and-detail-curve-colour.html">Model and Detail Curve Colour</a></li> <li><a href="http://thebuildingcoder.typepad.com/blog/2010/05/detail-curve-must-indeed-lie-in-plane.html">Detail Curve Must Indeed lie in Plane</a></li> <li><a href="http://thebuildingcoder.typepad.com/blog/2010/05/model-curve-creator.html">Model Curve Creator</a></li> <li><a href="http://thebuildingcoder.typepad.com/blog/2013/08/generating-a-midcurve-between-two-curve-elements.html">Generating a MidCurve Between Two Curve Elements</a></li> </ul> <p>A <code>Creator</code> model curve helper class is also included in <a href="https://github.com/jeremytammik/the_building_coder_samples">The Building Coder samples</a>, in the module <a href="https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/Creator.cs">Creator.cs</a>.</p> <p>Furthermore, the <code>CmdDetailCurves</code> sample command shows how to create detail lines, in the module <a href="https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdDetailCurves.cs">CmdDetailCurves.cs</a>.</p> <p>The GitHub repository master branch is always up to date, and previous versions of the Revit API are supported by different <a href="https://github.com/jeremytammik/the_building_coder_samples/releases">releases</a>.</p> <p>As you should probably know if you are reading this, detail lines can only be created and viewed in a plan view.</p> <p>Also, it is useful to know that the view graphics and visibility settings enable you to control the model line appearance, e.g. colour and line type.</p> <h4><a name="5"></a>Determining the Distance of a Family Instance to the Floor or Elevation</h4> <p>Here is another common need, to determine the <a href="http://forums.autodesk.com/t5/revit-api/elevation-of-family-instance-from-floor-or-level-below-it/m-p/6058148">distance from family instance to the floor or elevation below</a>, raised by Kailash Kute:</p> <p><strong>Question:</strong> I want to calculate the elevation (distance) of a selected family instance with respect to the Floor or Level below it.</p> <p>How to get the floor or level which is below the selected family instance?</p> <p>How to get the elevation of the instance with respect to that level?</p> <p>Later:</p> <p>The help text on <a href="http://help.autodesk.com/view/RVT/2016/ENU/?guid=GUID-B3EE488D-2287-49A2-A772-C7164B84A648">finding geometry by ray projection</a> (<a href="http://forums.autodesk.com/t5/revit-api/elevation-of-family-instance-from-floor-or-level-below-it/m-p/6057571">Revit 2014 Czech</a>, <a href="http://help.autodesk.com/view/RVT/2014/CSY/?guid=GUID-B3EE488D-2287-49A2-A772-C7164B84A648">Revit 2015 English</a>) provides part of the answer, but is valid only if there is a Floor below the family instance.</p> <p>If I only have a Level below it, the ray passing through does not return any distance (proximity).</p> <p>Now my question gets filtered down to: How to find Intersection with Level?</p> <p><strong>Answer:</strong> If all you need is the distance between the family instance and the level, I see a possibility for a MUCH easier approach:</p> <p>Ask the family instance for its bounding box and determine its bottom Z coordinate <code>Z1</code>.</p> <p>Determine the elevation <code>Z0</code> of the level.</p> <p>The distance you seek is <code>Z1 - Z0</code>.</p> <p><strong>Response:</strong> A little bit of work around with points got from bounding box and done.</p> <p>Wow, really a MUCH easier approach.</p> <h4><a name="6"></a>Deleting a PrintSetup or ViewSheetSetting</h4> <p>Eirik Aasved Holst yesterday brought up and solved the question that regularly comes up on how to <a href="http://forums.autodesk.com/t5/revit-api/delete-printsetup-and-viewsheetsettings/m-p/6063449">delete PrintSetup and ViewSheetSettings</a>:</p> <p><strong>Question:</strong> <a href="https://en.wikipedia.org/wiki/TL;DR">TL;DR</a>: Is there a way of deleting a specific PrintSetup and ViewSheetSetting programmatically if I know its name?</p> <p>Long version:</p> <p>I'm writing a function that can print a large set of sheets in various paper sizes to separate/combined PDFs.</p> <p>To be able to apply the PrintSetup, it needs to be set in an "in-session" state and saved using <code>SaveAs()</code> (to my knowledge).</p> <p>But after saving an "in-session"-PrintSetup to a new PrintSetup, I cannot find a way of deleting said new PrintSetup.</p> <p>After the PrintManager has printed the sheets, I'm stuck with lots of temporary PrintSetups. The same goes for ViewSheetSettings.</p> <pre class="code"> try { pMgr.PrintSetup.Delete(); pMgr.ViewSheetSetting.Delete(); } catch (Exception ex) { //Shows 'The <in-session> print setup cannot be deleted' TaskDialog.Show("REVIT", ex.Message); } </pre> <p>So the problem is: I'm not able to apply the PrintSetup and ViewSheetSettings unless I'm using them "in-session" and saving them using SaveAs, and I'm not able to delete the PrintSetup and ViewSheetSettings afterwards.</p> <p>Has anyone experienced similar issues, or found a way to solve it?</p> <p><strong>Answer:</strong> This discussion on <a href="http://stackoverflow.com/questions/14946217/setting-viewsheetsetting-insession-views-property">setting the ViewSheetSetting.InSession.Views property</a> makes one brief mention of deleting a print setting, afaik can tell.</p> <p>This other one on <a href="http://forums.autodesk.com/t5/revit-api/printermanager-printsetup-do-not-apply-settings/td-p/3676618">PrinterManager PrintSetup not applying settings</a> appears to suggest a similar approach.</p> <p><strong>Response:</strong> These links unfortunately do not help much.</p> <p>It would be nice if it was possible to loop through the saved PrintSetup's, or at least get a PrintSetup if you knew it's name, so that you can delete it.</p> <p>In the thread on <a href="http://forums.autodesk.com/t5/revit-api/printermanager-printsetup-do-not-apply-settings/td-p/3676618">PrinterManager PrintSetup not applying settings</a>, the user aricke mentions:</p> <blockquote> <p>Note that once you have done the SaveAs, you can then delete the newly saved PrintSetup.</p> </blockquote> <p>I cannot seem to get that to work; even the following code raises an exception:</p> <pre class="code"> pSetup.SaveAs("tmp"); pSetup.Delete(); </pre> <p><strong>Solution:</strong> I finally managed to create a CleanUp-method that works. If others are interested, here it goes:</p> <pre class="code"> &nbsp; <span class="blue">private</span> <span class="blue">void</span> CleanUp( <span class="teal">Document</span> doc ) &nbsp; { &nbsp; &nbsp; <span class="blue">var</span> pMgr = doc.PrintManager; &nbsp; &nbsp; <span class="blue">using</span>( <span class="blue">var</span> trans = <span class="blue">new</span> <span class="teal">Transaction</span>( doc ) ) &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; trans.Start( <span class="maroon">&quot;CleanUp&quot;</span> ); &nbsp; &nbsp; &nbsp; CleanUpTemporaryViewSheets( doc, pMgr ); &nbsp; &nbsp; &nbsp; CleanUpTemporaryPrintSettings( doc, pMgr ); &nbsp; &nbsp; &nbsp; trans.Commit(); &nbsp; &nbsp; } &nbsp; } &nbsp; &nbsp; <span class="blue">private</span> <span class="blue">void</span> CleanUpTemporaryPrintSettings( &nbsp; &nbsp; <span class="teal">Document</span> doc, <span class="teal">PrintManager</span> pMgr ) &nbsp; { &nbsp; &nbsp; <span class="blue">var</span> printSetup = pMgr.PrintSetup; &nbsp; &nbsp; <span class="blue">foreach</span>( <span class="blue">var</span> printSettingsToDelete &nbsp; &nbsp; &nbsp; <span class="blue">in</span> ( <span class="blue">from</span> element &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="blue">in</span> <span class="blue">new</span> <span class="teal">FilteredElementCollector</span>( doc ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .OfClass( <span class="blue">typeof</span>( <span class="teal">PrintSetting</span> ) ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ToElements() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="blue">where</span> element.Name.Contains( _tmpName ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp;&amp; element.IsValidObject &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="blue">select</span> element <span class="blue">as</span> <span class="teal">PrintSetting</span> ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ToList() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Distinct( <span class="blue">new</span> EqualElementId() ) ) &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; printSetup.CurrentPrintSetting &nbsp; &nbsp; &nbsp; &nbsp; = pMgr.PrintSetup.InSession; &nbsp; &nbsp; &nbsp; &nbsp; printSetup.CurrentPrintSetting &nbsp; &nbsp; &nbsp; &nbsp; = printSettingsToDelete <span class="blue">as</span> <span class="teal">PrintSetting</span>; &nbsp; &nbsp; &nbsp; &nbsp; pMgr.PrintSetup.Delete(); &nbsp; &nbsp; } &nbsp; } &nbsp; &nbsp; <span class="blue">private</span> <span class="blue">void</span> CleanUpTemporaryViewSheets( &nbsp; &nbsp; <span class="teal">Document</span> doc, <span class="teal">PrintManager</span> pMgr ) &nbsp; { &nbsp; &nbsp; <span class="blue">var</span> viewSheetSettings = pMgr.ViewSheetSetting; &nbsp; &nbsp; <span class="blue">foreach</span>( <span class="blue">var</span> viewSheetSetToDelete &nbsp; &nbsp; &nbsp; <span class="blue">in</span> ( <span class="blue">from</span> element &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="blue">in</span> <span class="blue">new</span> <span class="teal">FilteredElementCollector</span>( doc ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .OfClass( <span class="blue">typeof</span>( <span class="teal">ViewSheetSet</span> ) ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ToElements() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="blue">where</span> element.Name.Contains( _tmpName ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp;&amp; element.IsValidObject &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="blue">select</span> element <span class="blue">as</span> <span class="teal">ViewSheetSet</span> ) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .ToList() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Distinct( <span class="blue">new</span> EqualElementId() ) ) &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; viewSheetSettings.CurrentViewSheetSet &nbsp; &nbsp; &nbsp; &nbsp; = pMgr.ViewSheetSetting.InSession; &nbsp; &nbsp; &nbsp; &nbsp; viewSheetSettings.CurrentViewSheetSet &nbsp; &nbsp; &nbsp; &nbsp; = viewSheetSetToDelete <span class="blue">as</span> <span class="teal">ViewSheetSet</span>; &nbsp; &nbsp; &nbsp; &nbsp; pMgr.ViewSheetSetting.Delete(); &nbsp; &nbsp; } &nbsp; } </pre> <p>Many thanks to Eirik for discovering and sharing this solution!</p>
Java
use SEPSLoader go -- Statement for schema creation DECLARE @sql NVARCHAR(MAX) SET @sql ='CREATE SCHEMA StackExchange AUTHORIZATION [dbo]' IF NOT EXISTS(SELECT name FROM sys.schemas WHERE name = 'StackExchange') begin EXEC sp_executesql @sql; end -- NOTE: StackExchange is replaced by the name of the site IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'StackExchange.[Badges]') AND type in (N'U')) DROP TABLE StackExchange.[Badges] IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'StackExchange.[Comments]') AND type in (N'U')) DROP TABLE StackExchange.[Comments] IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'StackExchange.[Posts]') AND type in (N'U')) DROP TABLE StackExchange.[Posts] IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'StackExchange.[PostTags]') AND type in (N'U')) DROP TABLE StackExchange.[PostTags] IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'StackExchange.[PostTypes]') AND type in (N'U')) DROP TABLE StackExchange.[PostTypes] IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'StackExchange.[Users]') AND type in (N'U')) DROP TABLE StackExchange.[Users] IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'StackExchange.[Votes]') AND type in (N'U')) DROP TABLE StackExchange.[Votes] IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'StackExchange.[VoteTypes]') AND type in (N'U')) DROP TABLE StackExchange.[VoteTypes] IF EXISTS (SELECT * FROM sys.objects WHERE OBJECT_ID = OBJECT_ID(N'StackExchange.[PostLinks]') AND type IN (N'U')) DROP TABLE StackExchange.[PostLinks] IF EXISTS (SELECT * FROM sys.objects WHERE OBJECT_ID = OBJECT_ID(N'StackExchange.[LinkTypes]') AND type IN (N'U')) DROP TABLE StackExchange.[LinkTypes] SET ansi_nulls ON SET quoted_identifier ON SET ansi_padding ON CREATE TABLE StackExchange.[LinkTypes] ( Id INT NOT NULL, [Type] VARCHAR(40) NOT NULL, CONSTRAINT PK_LinkTypes PRIMARY KEY CLUSTERED (Id ASC) ); CREATE TABLE StackExchange.[VoteTypes] ( [Id] [INT] NOT NULL, [Name] [VARCHAR](40) NOT NULL , CONSTRAINT [PK__VoteType] PRIMARY KEY CLUSTERED ( [Id] ASC ) ON [PRIMARY] )ON [PRIMARY] SET ansi_nulls ON SET quoted_identifier ON CREATE TABLE StackExchange.[PostTypes] ( [Id] [INT] NOT NULL, [Type] [NVARCHAR](10) NOT NULL , CONSTRAINT [PK_PostTypes] PRIMARY KEY CLUSTERED ( [Id] ASC ) ON [PRIMARY] ) ON [PRIMARY] IF 0 = 1--SPLIT BEGIN SET ansi_nulls ON SET quoted_identifier ON CREATE TABLE StackExchange.[PostTags] ( [PostId] [INT] NOT NULL, [Tag] [NVARCHAR](50) NOT NULL , CONSTRAINT [PK_PostTags_1] PRIMARY KEY CLUSTERED ( [PostId] ASC,[Tag] ASC ) ON [PRIMARY] ) ON [PRIMARY] END INSERT StackExchange.[VoteTypes] ([Id], [Name]) VALUES(1, N'AcceptedByOriginator') INSERT StackExchange.[VoteTypes] ([Id], [Name]) VALUES(2, N'UpMod') INSERT StackExchange.[VoteTypes] ([Id], [Name]) VALUES(3, N'DownMod') INSERT StackExchange.[VoteTypes] ([Id], [Name]) VALUES(4, N'Offensive') INSERT StackExchange.[VoteTypes] ([Id], [Name]) VALUES(5, N'Favorite') INSERT StackExchange.[VoteTypes] ([Id], [Name]) VALUES(6, N'Close') INSERT StackExchange.[VoteTypes] ([Id], [Name]) VALUES(7, N'Reopen') INSERT StackExchange.[VoteTypes] ([Id], [Name]) VALUES(8, N'BountyStart') INSERT StackExchange.[VoteTypes] ([Id], [Name]) VALUES(9, N'BountyClose') INSERT StackExchange.[VoteTypes] ([Id], [Name]) VALUES(10,N'Deletion') INSERT StackExchange.[VoteTypes] ([Id], [Name]) VALUES(11,N'Undeletion') INSERT StackExchange.[VoteTypes] ([Id], [Name]) VALUES(12,N'Spam') INSERT StackExchange.[VoteTypes] ([Id], [Name]) VALUES(13,N'InformModerator') INSERT StackExchange.[PostTypes] ([Id], [Type]) VALUES(1, N'Question') INSERT StackExchange.[PostTypes] ([Id], [Type]) VALUES(2, N'Answer') INSERT StackExchange.[LinkTypes] ([Id], [Type]) VALUES(1, N'Linked') INSERT StackExchange.[LinkTypes] ([Id], [Type]) VALUES(3, N'Duplicate') IF 0 = 1--FULLTEXT BEGIN IF EXISTS (SELECT * FROM sys.fulltext_indexes fti WHERE fti.object_id = OBJECT_ID(N'StackExchange.[Posts]')) ALTER FULLTEXT INDEX ON StackExchange.[Posts] DISABLE IF EXISTS (SELECT * FROM sys.fulltext_indexes fti WHERE fti.object_id = OBJECT_ID(N'StackExchange.[Posts]')) DROP FULLTEXT INDEX ON StackExchange.[Posts] IF EXISTS (SELECT * FROM sysfulltextcatalogs ftc WHERE ftc.name = N'PostFullText') DROP FULLTEXT CATALOG [PostFullText] CREATE FULLTEXT CATALOG [PostFullText]WITH ACCENT_SENSITIVITY = ON AUTHORIZATION dbo END SET ansi_padding OFF SET ansi_nulls ON SET quoted_identifier ON CREATE TABLE StackExchange.[Votes] ( [Id] [INT] NOT NULL, [PostId] [INT] NOT NULL, [UserId] [INT] NULL, [BountyAmount] [INT] NULL, [VoteTypeId] [INT] NOT NULL, [CreationDate] [DATETIME] NOT NULL , CONSTRAINT [PK_Votes] PRIMARY KEY CLUSTERED ( [Id] ASC ) ON [PRIMARY] ) ON [PRIMARY] IF 0 = 1-- INDICES BEGIN CREATE NONCLUSTERED INDEX [IX_Votes_Id_PostId] ON StackExchange.[Votes] ( [Id] ASC, [PostId] ASC) ON [PRIMARY] CREATE NONCLUSTERED INDEX [IX_Votes_VoteTypeId] ON StackExchange.[Votes] ( [VoteTypeId] ASC) ON [PRIMARY] END SET ansi_nulls ON SET quoted_identifier ON CREATE TABLE StackExchange.[Users] ( [Id] [INT] NOT NULL, [AboutMe] [NVARCHAR](MAX) NULL, [Age] [INT] NULL, [CreationDate] [DATETIME] NOT NULL, [DisplayName] [NVARCHAR](40) NOT NULL, [DownVotes] [INT] NOT NULL, [EmailHash] [NVARCHAR](40) NULL, [LastAccessDate] [DATETIME] NOT NULL, [Location] [NVARCHAR](100) NULL, [Reputation] [INT] NOT NULL, [UpVotes] [INT] NOT NULL, [Views] [INT] NOT NULL, [WebsiteUrl] [NVARCHAR](200) NULL, [AccountId] [INT] NULL , CONSTRAINT [PK_Users] PRIMARY KEY CLUSTERED ( [Id] ASC ) ON [PRIMARY] ) ON [PRIMARY] IF 0 = 1-- INDICES BEGIN CREATE NONCLUSTERED INDEX [IX_Users_DisplayName] ON StackExchange.[Users] ( [DisplayName] ASC) ON [PRIMARY] END SET ansi_nulls ON SET quoted_identifier ON CREATE TABLE StackExchange.[Posts] ( [Id] [INT] NOT NULL, [AcceptedAnswerId] [INT] NULL, [AnswerCount] [INT] NULL, [Body] [NTEXT] NOT NULL, [ClosedDate] [DATETIME] NULL, [CommentCount] [INT] NULL, [CommunityOwnedDate] [DATETIME] NULL, [CreationDate] [DATETIME] NOT NULL, [FavoriteCount] [INT] NULL, [LastActivityDate] [DATETIME] NOT NULL, [LastEditDate] [DATETIME] NULL, [LastEditorDisplayName] [NVARCHAR](40) NULL, [LastEditorUserId] [INT] NULL, [OwnerUserId] [INT] NULL, [ParentId] [INT] NULL, [PostTypeId] [INT] NOT NULL, [Score] [INT] NOT NULL, [Tags] [NVARCHAR](150) NULL, [Title] [NVARCHAR](250) NULL, [ViewCount] [INT] NOT NULL , CONSTRAINT [PK_Posts] PRIMARY KEY CLUSTERED ( [Id] ASC ) ON [PRIMARY] -- INDICES ,CONSTRAINT [IX_Posts_Id_AcceptedAnswerId] UNIQUE NONCLUSTERED ([Id] ASC,[AcceptedAnswerId] ASC ) ON [PRIMARY], -- INDICES CONSTRAINT [IX_Posts_Id_OwnerUserId] UNIQUE NONCLUSTERED ([Id] ASC,[OwnerUserId] ASC ) ON [PRIMARY], -- INDICES CONSTRAINT [IX_Posts_Id_ParentId] UNIQUE NONCLUSTERED ([Id] ASC,[ParentId] ASC ) ON [PRIMARY] )ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] IF 0 = 1-- INDICES BEGIN CREATE NONCLUSTERED INDEX [IX_Posts_Id_PostTypeId] ON StackExchange.[Posts] ( [Id] ASC, [PostTypeId] ASC) ON [PRIMARY] CREATE NONCLUSTERED INDEX [IX_Posts_PostType] ON StackExchange.[Posts] ( [PostTypeId] ASC) ON [PRIMARY] END IF 0 = 1--FULLTEXT BEGIN EXEC dbo.Sp_fulltext_table @tabname = N'StackExchange.[Posts]' , @action = N'create' , @keyname = N'PK_Posts' , @ftcat = N'PostFullText' DECLARE @lcid INT SELECT @lcid = lcid FROM MASTER.dbo.syslanguages WHERE alias = N'English' EXEC dbo.Sp_fulltext_column @tabname = N'StackExchange.[Posts]' , @colname = N'Body' , @action = N'add' , @language = @lcid SELECT @lcid = lcid FROM MASTER.dbo.syslanguages WHERE alias = N'English' EXEC dbo.Sp_fulltext_column @tabname = N'StackExchange.[Posts]' , @colname = N'Title' , @action = N'add' , @language = @lcid EXEC dbo.Sp_fulltext_table @tabname = N'StackExchange.[Posts]' , @action = N'start_change_tracking' EXEC dbo.Sp_fulltext_table @tabname = N'StackExchange.[Posts]' , @action = N'start_background_updateindex' END SET ansi_nulls ON SET quoted_identifier ON CREATE TABLE StackExchange.[Comments] ( [Id] [INT] NOT NULL, [CreationDate] [DATETIME] NOT NULL, [PostId] [INT] NOT NULL, [Score] [INT] NULL, [Text] [NVARCHAR](700) NOT NULL, [UserId] [INT] NULL , CONSTRAINT [PK_Comments] PRIMARY KEY CLUSTERED ( [Id] ASC ) ON [PRIMARY] ) ON [PRIMARY] IF 0 = 1-- INDICES BEGIN CREATE NONCLUSTERED INDEX [IX_Comments_Id_PostId] ON StackExchange.[Comments] ( [Id] ASC, [PostId] ASC) ON [PRIMARY] CREATE NONCLUSTERED INDEX [IX_Comments_Id_UserId] ON StackExchange.[Comments] ( [Id] ASC, [UserId] ASC) ON [PRIMARY] END SET ansi_nulls ON SET quoted_identifier ON CREATE TABLE StackExchange.[Badges] ( [Id] [INT] NOT NULL, [Name] [NVARCHAR](40) NOT NULL, [UserId] [INT] NOT NULL, [Date] [DATETIME] NOT NULL , CONSTRAINT [PK_Badges] PRIMARY KEY CLUSTERED ( [Id] ASC ) ON [PRIMARY] ) ON [PRIMARY] CREATE TABLE StackExchange.[PostLinks] ( Id INT NOT NULL, CreationDate DATETIME NOT NULL, PostId INT NOT NULL, RelatedPostId INT NOT NULL, LinkTypeId TINYINT NOT NULL, CONSTRAINT [PK_PostLinks] PRIMARY KEY CLUSTERED ([Id] ASC) ) IF 0 = 1-- INDICES BEGIN CREATE NONCLUSTERED INDEX [IX_Badges_Id_UserId] ON StackExchange.[Badges] ( [Id] ASC, [UserId] ASC) ON [PRIMARY] END
Java
var AWS = require('aws-sdk'); var Policy = require("./s3post").Policy; var helpers = require("./helpers"); var POLICY_FILE = "policy.json"; var schedule = require('node-schedule'); var Worker = function(sqsCommnad, s3Object, simpleData){ var queue = sqsCommnad; var s3 = s3Object; var simpleDataAuth = simpleData; var policyData = helpers.readJSONFile(POLICY_FILE); var policy = new Policy(policyData); var bucket_name = policy.getConditionValueByKey("bucket"); Worker.prototype.job = function(){ var run = schedule.scheduleJob('*/4 * * * * *', function(){ queue.recv(function(err, data){ if (err) { console.log(err); return; } console.log({Body : data.Body, MD5OfBody : data.MD5OfBody}); params = { Bucket: bucket_name, Key: data.Body } s3.getObject(params, function(err, data) { if (err) { console.log(err, err.stack); } else { var request = require('request'); var mime = require('mime'); var gm = require('gm').subClass({ imageMagick: true }); var src = 'http://s3-us-west-2.amazonaws.com/'+params.Bucket+'/'+params.Key; gm(request(src, params.Key)) .rotate('black', 15) .stream(function(err, stdout, stderr) { var buf = new Buffer(''); stdout.on('data', function(res) { buf = Buffer.concat([buf, res]); }); stdout.on('end', function(data) { var atr = { Bucket: params.Bucket, Key: params.Key, Body: buf, ACL: 'public-read', Metadata: { "username" : "Szymon Glowacki", "ip" : "192.168.1.10" } }; s3.putObject(atr, function(err, res) { console.log("done"); }); }); }); } }); }); }); } } module.exports = Worker;
Java
# TODO When raising an exception pass a lambda function, the function being the module/path/name thing ERROR = {'default': "Unknown engine error ({0})", 400: "Bad request sent to search API ({0})", 401: "Incorrect API Key ({0})", 403: "Correct API but request refused ({0})", 404: "Bad request sent to search API ({0})"} class SearchException(Exception): """ Abstract class representing an ifind search exception. """ def __init__(self, module, message): """ SearchException constructor. Args: module (str): name of module/class that's raising exception message (str): exception message to be displayed Usage: raise SearchException("Test", "this is an error") """ message = "{0} - {1}".format(module, message) Exception.__init__(self, message) class EngineConnectionException(SearchException): """ Thrown when an Engine connectivity error occurs. Returns specific response message if status code specified. """ def __init__(self, engine, message, code=None): """ EngineException constructor. Args: engine (str): name of engine that's raising exception message (str): exception message to be displayed (ignored usually here) Kwargs: code (int): response status code of issued request Usage: raise EngineException("Bing", "", code=200) """ self.message = message self.code = code if code: self.message = ERROR.get(code, ERROR['default']).format(self.code) SearchException.__init__(self, engine, self.message) class EngineLoadException(SearchException): """ Thrown when an Engine can't be dynamically loaded. """ pass class EngineAPIKeyException(SearchException): """ Thrown when an Engine's API key hasn't been provided. """ pass class QueryParamException(SearchException): """ Thrown when a query parameters incompatible or missing. """ pass class CacheConnectionException(SearchException): """ Thrown when cache connectivity error occurs. """ pass class InvalidQueryException(SearchException): """ Thrown when an invalid query is passed to engine's search method. """ pass class RateLimitException(SearchException): """ Thrown when an engine's request rate limit has been exceeded. """ pass
Java
import React, { Component } from 'react' import { Form, Grid, Image, Transition } from 'shengnian-ui-react' const transitions = [ 'scale', 'fade', 'fade up', 'fade down', 'fade left', 'fade right', 'horizontal flip', 'vertical flip', 'drop', 'fly left', 'fly right', 'fly up', 'fly down', 'swing left', 'swing right', 'swing up', 'swing down', 'browse', 'browse right', 'slide down', 'slide up', 'slide right', ] const options = transitions.map(name => ({ key: name, text: name, value: name })) export default class TransitionExampleSingleExplorer extends Component { state = { animation: transitions[0], duration: 500, visible: true } handleChange = (e, { name, value }) => this.setState({ [name]: value }) handleVisibility = () => this.setState({ visible: !this.state.visible }) render() { const { animation, duration, visible } = this.state return ( <Grid columns={2}> <Grid.Column as={Form}> <Form.Select label='Choose transition' name='animation' onChange={this.handleChange} options={options} value={animation} /> <Form.Input label={`Duration: ${duration}ms `} min={100} max={2000} name='duration' onChange={this.handleChange} step={100} type='range' value={duration} /> <Form.Button content={visible ? 'Unmount' : 'Mount'} onClick={this.handleVisibility} /> </Grid.Column> <Grid.Column> <Transition.Group animation={animation} duration={duration}> {visible && <Image centered size='small' src='/assets/images/leaves/4.png' />} </Transition.Group> </Grid.Column> </Grid> ) } }
Java
#!/bin/bash QBIN=$(which qdyn5_r8) OK="(\033[0;32m OK \033[0m)" FAILED="(\033[0;31m FAILED \033[0m)" steps=( $(ls -1v *inp | sed 's/.inp//') ) for step in ${steps[@]} do echo "Running step ${step}" if ${QBIN} ${step}.inp > ${step}.log then echo -e "$OK" cp ${step}.re ${step}.re.rest else echo -e "$FAILED" echo "Check output (${step}.log) for more info." exit 1 fi done
Java
# s-vertical-rhythm-class Return the vertical-rhythm setting scope class Return **{ [String](http://www.sass-lang.com/documentation/file.SASS_REFERENCE.html#sass-script-strings) }** The vertical-rhythm scope class from settings.vertical-rhythm.scope-class Author : Olivier Bossel [olivier.bossel@gmail.com](mailto:olivier.bossel@gmail.com) [https://olivierbossel.com](https://olivierbossel.com)
Java
export class Guest { constructor(public name: String, public quantity: number){ } }
Java
FROM sameersbn/ubuntu:14.04.20150805 MAINTAINER sameer@damagehead.com ENV REDMINE_VERSION=3.1.0 \ REDMINE_USER="redmine" \ REDMINE_HOME="/home/redmine" \ REDMINE_LOG_DIR="/var/log/redmine" \ SETUP_DIR="/var/cache/redmine" \ RAILS_ENV=production ENV REDMINE_INSTALL_DIR="${REDMINE_HOME}/redmine" \ REDMINE_DATA_DIR="${REDMINE_HOME}/data" RUN apt-key adv --keyserver keyserver.ubuntu.com --recv E1DD270288B4E6030699E45FA1715D88E1DF1F24 \ && echo "deb http://ppa.launchpad.net/git-core/ppa/ubuntu trusty main" >> /etc/apt/sources.list \ && apt-key adv --keyserver keyserver.ubuntu.com --recv 80F70E11F0F0D5F10CB20E62F5DA5F09C3173AA6 \ && echo "deb http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu trusty main" >> /etc/apt/sources.list \ && apt-key adv --keyserver keyserver.ubuntu.com --recv 8B3981E7A6852F782CC4951600A6F0A3C300EE8C \ && echo "deb http://ppa.launchpad.net/nginx/stable/ubuntu trusty main" >> /etc/apt/sources.list \ && wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ && echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list \ && apt-get update \ && apt-get install -y supervisor logrotate nginx mysql-client postgresql-client \ imagemagick subversion git cvs bzr mercurial rsync ruby2.1 locales openssh-client \ gcc g++ make patch pkg-config ruby2.1-dev libc6-dev zlib1g-dev libxml2-dev \ libmysqlclient18 libpq5 libyaml-0-2 libcurl3 libssl1.0.0 \ libxslt1.1 libffi6 zlib1g gsfonts \ && update-locale LANG=C.UTF-8 LC_MESSAGES=POSIX \ && gem install --no-document bundler \ && rm -rf /var/lib/apt/lists/* COPY assets/setup/ ${SETUP_DIR}/ RUN bash ${SETUP_DIR}/install.sh COPY assets/config/ ${SETUP_DIR}/config/ COPY entrypoint.sh /sbin/entrypoint.sh RUN chmod 755 /sbin/entrypoint.sh COPY plugins/ ${SETUP_DIR}/plugins/ COPY themes/ ${SETUP_DIR}/themes/ EXPOSE 80/tcp 443/tcp VOLUME ["${REDMINE_DATA_DIR}", "${REDMINE_LOG_DIR}"] WORKDIR ${REDMINE_INSTALL_DIR} ENTRYPOINT ["/sbin/entrypoint.sh"] CMD ["app:start"]
Java
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Dosen extends MY_Controller { public $data = array( 'breadcrumb' => 'Dosen', 'pesan' => '', 'subtitle' => '', 'main_view' => 'viewDosen', ); public function __construct(){ parent::__construct(); $this->load->model('Dosen_model','dosen',TRUE); $this->load->model('Prodi_model','prodi',TRUE); } public function index(){ $this->data['prodi'] = $this->prodi->get_datatables(); $this->load->view('template',$this->data); } public function ajax_list() { $list = $this->dosen->get_datatables(); $data = array(); $no = $_POST['start']; foreach ($list as $dosen) { $no++; $row = array( "id_dosen" => $dosen['id_dosen'], "nama_dosen" => $dosen['nama_dosen'], "nama_prodi" => $dosen['nama_prodi'] ); $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->dosen->count_all(), "recordsFiltered" => $this->dosen->count_filtered(), "data" => $data, ); //output to json format echo json_encode($output); } public function ajax_edit($id) { $data = $this->dosen->get_by_id($id); echo json_encode($data); } public function ajax_add() { $this->_validate(); $data = array( 'id_dosen' => $this->input->post('id'), 'nama_dosen' => $this->input->post('nama_dosen'), 'id_prodi' => $this->input->post('id_prodi') ); $insert = $this->dosen->save($data); echo json_encode(array("status" => TRUE)); } public function ajax_update() { $this->_validate(); $data = array( 'id_dosen' => $this->input->post('id'), 'nama_dosen' => $this->input->post('nama_dosen'), 'id_prodi' => $this->input->post('id_prodi') ); $this->dosen->update($data); echo json_encode(array("status" => TRUE)); } public function ajax_delete($id) { $this->dosen->delete_by_id($id); echo json_encode(array("status" => TRUE)); } private function _validate() { $data = array(); $data['error_string'] = array(); $data['inputerror'] = array(); $data['status'] = TRUE; if($this->input->post('nama_dosen') == '') { $data['inputerror'][] = 'nama_dosen'; $data['error_string'][] = 'Nama Dosen Belum Diisi'; $data['status'] = FALSE; } if($this->input->post('id_prodi') == '') { $data['inputerror'][] = 'id_prodi'; $data['error_string'][] = 'Program Studi Belum Dipilih'; $data['status'] = FALSE; } if($data['status'] === FALSE) { echo json_encode($data); exit(); } } } ?>
Java
import {server} from './initializers' module.exports = function startServer(){ server.listen(8080) }
Java
## Estrutura de diretórios para projetos AngularJS * app/ -> arquivos da aplicação + css/ -> arquivos css + js/ -> componentes javascript da aplicação + controllers/ -> diretório para os controllers + directives/ -> diretório para os directives + filters/ -> diretório para os filters + services/ -> diretório para os services + scripts/ -> diretório para os scrips js + app.js -> principal script da aplicação + lib/ -> bibliotecas javascript + views/ -> diretório para as views + index.html -> principal arquivo html * public/ -> diretório para arquivos estáticos + css/ -> arquivos css + fonts/ -> arquivos de fontes + images/ -> arquivos de imagens + js/ -> arquivos js
Java
# totem-enquete-ru Versão Arduino para dar sua opinião sobre o cardápio do Restaurante Universitário da UFRN
Java
--- layout: page title: Maddox - Oconnell Wedding date: 2016-05-24 author: Emma Mcfarland tags: weekly links, java status: published summary: Etiam eu accumsan lorem. Morbi faucibus velit nec. banner: images/banner/meeting-01.jpg booking: startDate: 10/18/2017 endDate: 10/20/2017 ctyhocn: WINWVHX groupCode: MOW published: true --- Etiam aliquam eros nec nunc faucibus, nec auctor libero faucibus. Nunc nisi sem, congue quis nulla sit amet, porttitor ullamcorper ante. In elementum lacus magna, sed rutrum nunc consectetur dictum. Donec finibus ac nisi vitae consequat. Ut et semper nibh, ac condimentum nisi. Etiam ornare varius massa, nec commodo sapien. Proin aliquet aliquam pulvinar. Proin commodo mauris gravida finibus iaculis. Vestibulum a turpis neque. Etiam varius, neque quis tincidunt lobortis, lectus lacus lobortis magna, vitae egestas metus nibh vitae turpis. Vestibulum ac fringilla quam, id mollis nulla. Fusce a ipsum neque. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas laoreet justo id auctor venenatis. Curabitur rutrum eget erat eget rhoncus. Praesent non orci id nisl rhoncus pulvinar. Suspendisse egestas nulla erat, id suscipit nisi semper vitae. Mauris metus neque, dignissim vitae pulvinar et, euismod ac massa. Cras malesuada pretium erat, eget rhoncus lacus rutrum nec. Vestibulum sed mauris sit amet ligula scelerisque interdum. Phasellus lacinia condimentum enim. Mauris id tortor hendrerit, mollis ex et, egestas libero. Aliquam erat volutpat. 1 Sed tincidunt augue vel orci porttitor feugiat 1 Vestibulum porta odio eget elit volutpat, ut blandit quam efficitur 1 Nunc interdum dolor sit amet elit viverra, et fermentum leo gravida 1 Cras ut massa eu ex varius porttitor vel ut odio. In nec leo et quam tincidunt vestibulum non at lectus. Vivamus pharetra aliquam vulputate. Sed eget rhoncus mi. Curabitur venenatis dolor sit amet finibus vulputate. Nunc eleifend malesuada ipsum, ac suscipit eros hendrerit eget. Ut et egestas mauris. Suspendisse ac ligula velit. Sed pulvinar purus eu dolor scelerisque, commodo efficitur eros dictum. Aenean suscipit sit amet nisi a tincidunt. Nulla cursus vel augue vitae viverra. Aliquam sodales hendrerit enim, imperdiet mattis urna. Suspendisse vitae ipsum dui. Nunc facilisis iaculis ex, et ornare massa. Etiam eget dapibus lorem. Aenean vehicula venenatis erat. Suspendisse ultrices sed dolor elementum luctus. Curabitur convallis gravida lobortis. Aenean sed mauris tortor.
Java
using System; using System.ServiceModel; namespace SoapCore.Tests.Wsdl.Services { [ServiceContract] public interface INullableEnumService { [OperationContract] NulEnum? GetEnum(string text); } public class NullableEnumService : INullableEnumService { public NulEnum? GetEnum(string text) { throw new NotImplementedException(); } } }
Java
var Game = { map: { width: 980, height: 62 * 12 }, tiles: { size: 62, count: [100, 12] }, sprite: { 8: 'LAND_LEFT', 2: 'LAND_MID', 10: 'LAND_RIGHT', 9: 'LAND', 5: 'WATER_TOP', 12: 'WATER', 4: 'STONE_WITH_MONEY', 11: 'STONE', 6: 'CACTUS', 13: 'GRASS', 7: 'START', 1: 'END' } }; Crafty.init(Game.map.width, Game.map.height, document.getElementById('game')); Crafty.background('url(./assets/images/bg.png)'); Crafty.scene('Loading');
Java
# Demo mode Smart meter has a demo mode that is intended to make demonstrating the product and system-level testing easier. Demo mode allows creating situations that would be hard to create otherwise (e.g. connection to cloud is lost between price request and parking event registering). Demo mode is to be used in development only. This document instructs how to configure, enable and use demo mode. ## Enable demo mode To enable demo mode, add line **demoMode;1** to smart meter configuration (config/global.txt). To disable demo mode, change this to **demoMode;0** or remove the line. ## Configure demo mode Demomode has it's own configuration file, that will be installed to **config/demoConfig.txt** in deploy directory after successful build. Edit this file to change demo mode settings. The configuration file consists of following lines: - Empty lines, which are ignored. - Comments starting with '#', which are ignored. - Price specification. - Key-value pairs separated with semicolon. Price specification sets a predefined value for parking price information. Give price information in format **price;price per hour (EUR):time limit (min):resolution (min)**, e.g. **price;1.2:120:1**. If price information is left unspecified, price is fetched from firebase like normally. Every other key-value pair will specify the number of parking event registering request and it's demonstrated value. The key represents the number of parking registering request. The first parking event reqistering request is indexed as '0', and each request after that will increase the index by one. Not all requests need to be defined. If an index is missing from configuration, smart meter will handle requests as in normal mode. The second part (value) is an integer representing the situation to be demonstrated on request specified by the key. The possible values are listed in the table below. Value | Explanation ---|--- 0 | Replace the actual payment token in request with a valid test token. Request is then forwarded to the cloud, and handled as normally. 1 | Request to the cloud times out. The request is not actually sent to the cloud, but smart meter will write a timeout error message to BLENode's response fifo. 2 | Payment token is invalid. The request is not actually sent to the cloud, but smart meter will write invalid token error message to BLENode's response fifo. 3 | Other error in the cloud. The request is not actually sent to the cloud, but smart meter will write error message to BLENode's response fifo. 4 | Forced Ok response. The request is not actually sent to the cloud, but smart meter will write OK message to BLENode's response fifo. any other | Unknown command. Smart meter responds with error message about unknown command. Example configuration: ``` # My demo config (config/demoConfig.txt) # Price is not fetched from cloud. price;1.2:120:1 # First request's payment token will be replaced with a valid test token 0;0 # Second request will time out. 1;1 # Third request is not defined, and is therefore handled normally. # Fourh request will have an invalid payment token, even if the actual token was valid. 3;2 # End of configuration. All requests after 4th are handled as normally. ``` ## Using demo mode Other than separate configuration, demo mode needs no user guidance. Use smart meter as normally. Requests defined in configuration will be handled according to specified action, and others are handled normally.
Java
<!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>uncss.io</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="css/main.min.css"/> <!--[if lt IE 9]> <script src="js/vendor/html5-3.6-respond-1.1.0.min.js"></script> <![endif]--> </head> <body> <!--[if lt IE 7]> <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p> <![endif]--> <div class="jumbotron"> <div class="container"> <h1>U<span class="title-capitalize">n</span>CSS<span class="title-capitalize">.io</span></h1> <h2>Automatically remove unused CSS rules to speed up your site load time</h2> <ol> <li>Enter the URL of your page</li> <li>We will detect all the CSS files that you are loading and we will remove all the unused CSS rules</li> <li>Copy paste that new consolidated CSS file. That's the only rules you will need for that page.</li> <li>See the documentation on <a href="https://github.com/giakki/uncss">GitHub</a></li> </ol> <hr> <div class="row"> <form class="col-lg-8 col-lg-offset-2"> <div class="input-group"> <input type="text" class="form-control" placeholder="Insert your URL here" id="url-input" name="url-input"> <span class="input-group-btn"> <button class="btn btn-default" id="get-css" type="submit">Get CSS!</button> </span> </div> </form> </div> </div> </div> <div class="container"> <div class="row"> <div class="col-lg-6 testimonial"> <div class="col-lg-10"> <p>"The fastest rule is the one that doesn’t exist. There’s a common strategy to combine stylesheet “modules” into one file for production. This makes for one big collection of rules, where some (lots) of them are likely not used by particular part of the site/application. Getting rid of unused rules is one of the best things your can do to optimize CSS performance"</p> <p>Source: <a href="http://perfectionkills.com/profiling-css-for-fun-and-profit-optimization-notes/">@kangax - perfectionkills.com</a></p> </div> <div class="col-lg-2"> <a href="https://twitter.com/kangax"> <img class="img-circle" alt="@kangax" src="img/kangax.png"> </a> </div> </div> <div class="col-lg-6 testimonial"> <div class="col-lg-10"> <p> "make sure that you get all your css as early as possible. Concatenate css files, minify them, remove redundant rules. Anything you can do to accelerate css, fetching of css, will help you get faster user experience"</p> <p>Ilya Grigorik (@igrigorik) is a web performance engineer and developer advocate at Google, where his focus is on making the web fast and driving adoption of performance best practices at Google and beyond.</p> <p><a href="http://parleys.com/play/5148922b0364bc17fc56ca0e/chapter45/about">Source</a></p> </div> <div class="col-lg-2"> <a href="https://twitter.com/igrigorik"> <img class="img-circle" alt="@igrigorik" src="img/igrigorik.png"> </a> </div> </div> </div> <div class="modal fade" id="results-modal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header" id="results-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title">Your Results!</h4> </div> <div class="modal-body" id="results-body"> <div id="spinner">Fetching results...</div> </div> <div class="modal-footer hidden" id="modal-footer"> <a href="" class="btn btn-primary" id="view-button">View stylesheet</a> <button type="button" class="btn btn-primary" id="copy-button">Copy to clipboard</button> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <hr> <footer> <p>&copy; Giacomo Martino, Xavier Damman, 2014</p> </footer> </div> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="js/scripts.min.js"></script> </body> </html>
Java
#!/usr/bin/python import os import re from lxml import etree as et import pcbmode.config as config from . import messages as msg # pcbmode modules from . import utils from .point import Point def makeExcellon(manufacturer='default'): """ """ ns = {'pcbmode':config.cfg['ns']['pcbmode'], 'svg':config.cfg['ns']['svg']} # Open the board's SVG svg_in = utils.openBoardSVG() drills_layer = svg_in.find("//svg:g[@pcbmode:sheet='drills']", namespaces=ns) excellon = Excellon(drills_layer) # Save to file base_dir = os.path.join(config.cfg['base-dir'], config.cfg['locations']['build'], 'production') base_name = "%s_rev_%s" % (config.brd['config']['name'], config.brd['config']['rev']) filename_info = config.cfg['manufacturers'][manufacturer]['filenames']['drills'] add = '_%s.%s' % ('drills', filename_info['plated'].get('ext') or 'txt') filename = os.path.join(base_dir, base_name + add) with open(filename, "wb") as f: for line in excellon.getExcellon(): f.write(line) class Excellon(): """ """ def __init__(self, svg): """ """ self._svg = svg self._ns = {'pcbmode':config.cfg['ns']['pcbmode'], 'svg':config.cfg['ns']['svg']} # Get all drill paths except for the ones used in the # drill-index drill_paths = self._svg.findall(".//svg:g[@pcbmode:type='component-shapes']//svg:path", namespaces=self._ns) drills_dict = {} for drill_path in drill_paths: diameter = drill_path.get('{'+config.cfg['ns']['pcbmode']+'}diameter') location = self._getLocation(drill_path) if diameter not in drills_dict: drills_dict[diameter] = {} drills_dict[diameter]['locations'] = [] drills_dict[diameter]['locations'].append(location) self._preamble = self._createPreamble() self._content = self._createContent(drills_dict) self._postamble = self._createPostamble() def getExcellon(self): return (self._preamble+ self._content+ self._postamble) def _createContent(self, drills): """ """ ex = [] for i, diameter in enumerate(drills): # This is probably not necessary, but I'm not 100% certain # that if the item order of a dict is gurenteed. If not # the result can be quite devastating where drill # diameters are wrong! # Drill index must be greater than 0 drills[diameter]['index'] = i+1 ex.append("T%dC%s\n" % (i+1, diameter)) ex.append('M95\n') # End of a part program header for diameter in drills: ex.append("T%s\n" % drills[diameter]['index']) for coord in drills[diameter]['locations']: ex.append(self._getPoint(coord)) return ex def _createPreamble(self): """ """ ex = [] ex.append('M48\n') # Beginning of a part program header ex.append('METRIC,TZ\n') # Metric, trailing zeros ex.append('G90\n') # Absolute mode ex.append('M71\n') # Metric measuring mode return ex def _createPostamble(self): """ """ ex = [] ex.append('M30\n') # End of Program, rewind return ex def _getLocation(self, path): """ Returns the location of a path, factoring in all the transforms of its ancestors, and its own transform """ location = Point() # We need to get the transforms of all ancestors that have # one in order to get the location correctly ancestors = path.xpath("ancestor::*[@transform]") for ancestor in ancestors: transform = ancestor.get('transform') transform_data = utils.parseTransform(transform) # Add them up location += transform_data['location'] # Add the transform of the path itself transform = path.get('transform') if transform != None: transform_data = utils.parseTransform(transform) location += transform_data['location'] return location def _getPoint(self, point): """ Converts a Point type into an Excellon coordinate """ return "X%.6fY%.6f\n" % (point.x, -point.y)
Java
'use strict'; import _ from 'lodash'; import bluebird from 'bluebird'; import fs from 'fs'; import requireDir from 'require-dir'; import Logger from '../../logger'; bluebird.promisifyAll(fs); function main() { const imports = _.chain(requireDir('./importers')) .map('default') .map((importer) => importer.run()) .value(); return Promise.all(imports); } Logger.info('base.data.imports.imports: Running...'); main() .then(() => { Logger.info('base.data.imports.imports: Done!'); process.exit(0); }) .catch((error) => { Logger.error('base.data.imports.imports:', error); process.exit(1); });
Java
// FriendlyNameAttribute.cs created with MonoDevelop // User: ben at 1:31 P 19/03/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // using System; namespace EmergeTk.Model { public class FriendlyNameAttribute : Attribute { string name; public string Name { get { return name; } set { name = value; } } public string[] FieldNames { get { return fieldNames; } set { fieldNames = value; } } //field names are used for generating friendly names for vector types, such as enums. string[] fieldNames; public FriendlyNameAttribute() { } public FriendlyNameAttribute( string name ) { this.name = name; } } }
Java
Ext.define('Category.view.GenericList', { extend: 'Ext.grid.Panel', alias: 'widget.genericlist', store: 'Generic', title: Raptor.getTag('category_header'), iconCls:'', initComponent: function() { this.columns = [{ header:Raptor.getTag('category_name'), dataIndex: 'name', flex: 1 }]; this.dockedItems = [{ dock: 'top', xtype: 'toolbar', items: [{ xtype: 'button', text: Raptor.getTag('add'), privilegeName:'insert', action:'addAction', iconCls:'icon-add' },{ xtype: 'button', text: Raptor.getTag('edit'), disabled:true, privilegeName:'edit/:id', action:'editAction', iconCls:'icon-edit' },{ xtype: 'button', text: Raptor.getTag('delete'), disabled:true, privilegeName:'delete/:id', action:'deleteAction', iconCls:'icon-del' }] }]; this.callParent(); } });
Java
using System; using static LanguageExt.Prelude; namespace LanguageExt.UnitsOfMeasure { /// <summary> /// Numeric VelocitySquared value /// Handles unit conversions automatically /// </summary> public struct VelocitySq : IComparable<VelocitySq>, IEquatable<VelocitySq> { readonly double Value; internal VelocitySq(double length) { Value = length; } public override string ToString() => Value + " m/s²"; public bool Equals(VelocitySq other) => Value.Equals(other.Value); public bool Equals(VelocitySq other, double epsilon) => Math.Abs(other.Value - Value) < epsilon; public override bool Equals(object obj) => obj == null ? false : obj is Length ? Equals((Length)obj) : false; public override int GetHashCode() => Value.GetHashCode(); public int CompareTo(VelocitySq other) => Value.CompareTo(other.Value); public VelocitySq Append(VelocitySq rhs) => new VelocitySq(Value + rhs.Value); public VelocitySq Subtract(VelocitySq rhs) => new VelocitySq(Value - rhs.Value); public VelocitySq Multiply(double rhs) => new VelocitySq(Value * rhs); public VelocitySq Divide(double rhs) => new VelocitySq(Value / rhs); public static VelocitySq operator *(VelocitySq lhs, double rhs) => lhs.Multiply(rhs); public static VelocitySq operator *(double lhs, VelocitySq rhs) => rhs.Multiply(lhs); public static VelocitySq operator +(VelocitySq lhs, VelocitySq rhs) => lhs.Append(rhs); public static VelocitySq operator -(VelocitySq lhs, VelocitySq rhs) => lhs.Subtract(rhs); public static VelocitySq operator /(VelocitySq lhs, double rhs) => lhs.Divide(rhs); public static double operator /(VelocitySq lhs, VelocitySq rhs) => lhs.Value / rhs.Value; public static bool operator ==(VelocitySq lhs, VelocitySq rhs) => lhs.Equals(rhs); public static bool operator !=(VelocitySq lhs, VelocitySq rhs) => !lhs.Equals(rhs); public static bool operator >(VelocitySq lhs, VelocitySq rhs) => lhs.Value > rhs.Value; public static bool operator <(VelocitySq lhs, VelocitySq rhs) => lhs.Value < rhs.Value; public static bool operator >=(VelocitySq lhs, VelocitySq rhs) => lhs.Value >= rhs.Value; public static bool operator <=(VelocitySq lhs, VelocitySq rhs) => lhs.Value <= rhs.Value; public Velocity Sqrt() => new Velocity(Math.Sqrt(Value)); public VelocitySq Round() => new VelocitySq(Math.Round(Value)); public VelocitySq Abs() => new VelocitySq(Math.Abs(Value)); public VelocitySq Min(VelocitySq rhs) => new VelocitySq(Math.Min(Value, rhs.Value)); public VelocitySq Max(VelocitySq rhs) => new VelocitySq(Math.Max(Value, rhs.Value)); public double MetresPerSecond2 => Value; } }
Java
// // Lexer.cpp // lut-lang // // Created by Mehdi Kitane on 13/03/2015. // Copyright (c) 2015 H4314. All rights reserved. // #include "Lexer.h" #include <string> #include <regex> #include <iostream> #include "TokenType.h" #include "ErrorHandler.h" using std::cout; using std::endl; using std::smatch; using std::string; using std::regex_search; using std ::smatch; // Regexs const char keyword_str[] = "^(const |var |ecrire |lire )"; const char identifier_str[] = "^([a-zA-Z][a-zA-Z0-9]*)"; const char number_str[] = "^([0-9]*\\.?[0-9]+)"; const char single_operators_str[] = "^(\\+|-|\\*|\\/|\\(|\\)|;|=|,)"; const char affectation_str[] = "^(:=)"; const std::regex keyword(keyword_str); const std::regex identifier(identifier_str); const std::regex number(number_str); const std::regex single_operators(single_operators_str); const std::regex affectation(affectation_str); int Lexer::find_first_not_of(string str) { string::iterator it; int index = 0; for (it = str.begin(); it < str.end(); it++, index++) { switch ( str.at(index) ) { case ' ': this->column++; break; case '\t': break; case '\n': this->line++; this->column = 0; break; case '\r': break; case '\f': break; case '\v': default: return index; break; } } return -1; } string& Lexer::ltrim(string& s) { s.erase(0, find_first_not_of(s)); return s; } Lexer::Lexer(string inString) : inputString(inString) { this->currentToken = new ASTTokenNode(TokenType::INVALID_SYMBOL); this->line = 0; this->column = 0; this->column_next_incrementation = 0; } bool Lexer::has_next() { // remove spaces before analyzing // we remove left spaces and not right to handle cases like "const " ltrim(inputString); if ( inputString.length() <= 0 ) { currentToken = new ASTTokenNode(TokenType::ENDOFFILE); return false; } return true; } ASTTokenNode* Lexer::top() { return currentToken; } void Lexer::shift() { if ( !has_next() ) return; this->column += this->column_next_incrementation; std::smatch m; if ( !analyze(inputString, m) ) { ErrorHandler::getInstance().LexicalError(this->getLine(), this->getColumn(), inputString.at(0)); ErrorHandler::getInstance().outputErrors(); currentToken = new ASTTokenNode(TokenType::INVALID_SYMBOL); inputString.erase(0, 1); // not sure return; } this->column_next_incrementation = (int)m.length(); inputString = m.suffix().str(); } bool Lexer::analyze(string s, smatch &m) { if ( std::regex_search(inputString, m, keyword) ) { std::string currentTokenValue = m.str(); switch (currentTokenValue[0]) { case 'c': currentToken = new ASTTokenNode(TokenType::CONST); break; case 'v': currentToken = new ASTTokenNode(TokenType::VAR); break; case 'e': currentToken = new ASTTokenNode(TokenType::WRITE); break; case 'l': currentToken = new ASTTokenNode(TokenType::READ); break; default: #warning "symbole non reconnu" return false; } } else if ( std::regex_search(inputString, m, identifier) ) { std::string currentTokenValue = m.str(); currentToken = new ASTTokenNode(TokenType::ID, currentTokenValue); } else if ( std::regex_search(inputString, m, number) ) { std::string currentTokenValue = m.str(); currentToken = new ASTTokenNode(TokenType::VAL, currentTokenValue); } else if ( std::regex_search(inputString, m, single_operators) ) { std::string currentTokenValue = m.str(); switch (currentTokenValue[0]) { case '+': currentToken = new ASTTokenNode(TokenType::ADD, "+"); break; case '-': currentToken = new ASTTokenNode(TokenType::SUB, "-"); break; case '*': currentToken = new ASTTokenNode(TokenType::MUL, "*"); break; case '/': currentToken = new ASTTokenNode(TokenType::DIV, "/"); break; case '(': currentToken = new ASTTokenNode(TokenType::PO); break; case ')': currentToken = new ASTTokenNode(TokenType::PF); break; case ';': currentToken = new ASTTokenNode(TokenType::PV); break; case '=': currentToken = new ASTTokenNode(TokenType::EQ); break; case ',': currentToken = new ASTTokenNode(TokenType::V); break; default: #warning "symbole non reconnu" return false; } } else if ( std::regex_search(inputString, m, affectation) ) { currentToken = new ASTTokenNode(TokenType::AFF); } else { #warning "symbole non reconnu" return false; } return true; } int Lexer::getLine() { return this->line+1; } int Lexer::getColumn() { return this->column+1; }
Java
#define NC0_As 0x0E #define NC0_B 0x0D #define NC1_C 0x15 #define NC1_Cs 0x1E #define NC1_D 0x1D #define NC1_Ds 0x26 #define NC1_E 0x24 #define NC1_F 0x2D #define NC1_Fs 0x2E #define NC1_G 0x2C #define NC1_Gs 0x36 #define NC1_A 0x35 #define NC1_As 0x3D #define NC1_B 0x3C #define NC2_C 0x43 #define NC2_Cs 0x46 #define NC2_D 0x44 #define NC2_Ds 0x45 #define NC2_E 0x4D #define NC2_F 0x54 #define NC2_Fs 0x55 #define NC2_G 0x5B #define NC2_Gs 0x5D #define NC2_A 0x12 #define NC2_As 0x58 #define NC2_B 0x1A #define NC_OCTAVEUP 0x05 #define NC_OCTAVEDOWN 0x06 #define NC_INSTRUP 0x04 #define NC_INSTRDOWN 0x0C #define NC_TABLEUP 0x03 #define NC_TABLEDOWN 0x0B #define NC_PULSETOGGLE 0x0A #define NC_TABLERUN 0x29 #define NC_NOP 0x00
Java
<?php /** * This file is part of the Redsys package. * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @license MIT License */ namespace Redsys\Tests\Api; use Redsys\Api\Titular; class TitularTest extends \PHPUnit_Framework_TestCase { public function testGetValueShouldReturnValue() { $titular = new Titular("Lorem ipsum"); $this->assertEquals("Lorem ipsum", $titular->getValue()); } public function testToStringShouldReturnString() { $titular = new Titular("Lorem ipsum"); $this->assertEquals("Lorem ipsum", (string)$titular); } /** * @expectedException \LengthException */ public function testTooLongValueShouldThrowException() { new Titular(str_repeat("abcdefghij", 6) . "z"); } }
Java
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("KnowledgeCenter.Domain")] [assembly: AssemblyDescription("")] [assembly: Guid("34163851-767a-42f4-9f09-7d1c6af2bd11")]
Java
repo_the_first ==============
Java
--- layout: page title: Copeland King Trade Executive Retreat date: 2016-05-24 author: Dennis David tags: weekly links, java status: published summary: Vivamus facilisis sem a turpis volutpat. banner: images/banner/leisure-05.jpg booking: startDate: 08/16/2017 endDate: 08/20/2017 ctyhocn: SFOCCHX groupCode: CKTER published: true --- Vivamus lacus orci, malesuada vel accumsan a, ornare non neque. Vestibulum imperdiet erat eu dictum venenatis. Pellentesque leo arcu, ornare a varius at, lacinia vel magna. Quisque scelerisque feugiat nisl id tempus. Mauris iaculis eros nulla, eget feugiat justo posuere eget. Etiam tincidunt diam nibh, porttitor consectetur orci ornare sit amet. Nullam sollicitudin velit ipsum, vel porta metus fringilla nec. Proin eu suscipit lectus. Suspendisse fermentum a lectus ac cursus. Sed finibus tincidunt risus, sit amet ullamcorper ante porta sit amet. In vestibulum iaculis nulla, a pharetra elit molestie in. Nunc mollis velit ac dolor venenatis volutpat. Nunc dictum vestibulum ex quis efficitur. Aenean nisl dolor, tempor nec tortor vel, interdum ullamcorper felis. Phasellus sit amet venenatis arcu. Curabitur suscipit luctus tellus, nec consectetur massa consectetur ut. Nunc consectetur, ex at finibus ultrices, ipsum lorem elementum mauris, non posuere mauris risus ac tortor. Nam egestas lacus eu euismod vestibulum. Sed eget sodales augue. Aliquam consectetur condimentum odio non euismod. Nam fermentum, sapien sit amet fringilla malesuada, nisl neque finibus lorem, at efficitur tortor purus quis velit. Mauris aliquet dignissim libero in ornare. Etiam auctor nulla nec ipsum porttitor, sed pulvinar quam elementum. Pellentesque egestas pellentesque velit, nec consectetur quam. Nullam blandit interdum nisi. Fusce ullamcorper non tortor vitae sollicitudin. Morbi ullamcorper aliquam nulla at sagittis. * Sed at nisi sit amet est consequat vulputate * Quisque varius mauris scelerisque pretium porttitor * Nulla tempor tellus et sapien tincidunt pellentesque eu in orci * Integer tempor urna aliquam, fermentum sem vel, facilisis ante * Nulla eget ante nec justo luctus pharetra et vitae metus * Nulla sed neque in orci feugiat ultrices quis a lacus. Duis quis magna nunc. Aliquam quis tincidunt nunc. Nunc eleifend, nibh eget mollis tincidunt, lacus lorem commodo nulla, nec vulputate libero ante vel lectus. Suspendisse eu elit odio. Aenean feugiat sapien et diam tempor finibus vitae eu justo. Nam faucibus libero eu volutpat tincidunt. Sed eu elit leo. Praesent tempor arcu erat, a porta massa porta sed. Proin dolor erat, varius in enim a, euismod vulputate enim. Cras mattis mi id ex dictum fermentum. Proin ut eleifend orci. Curabitur quis eros eu tellus dapibus varius eu ut risus. Phasellus non mollis lectus.
Java
<!DOCTYPE html> <html xmlns:msxsl="urn:schemas-microsoft-com:xslt"> <head> <meta content="en-us" http-equiv="Content-Language" /> <meta content="text/html; charset=utf-16" http-equiv="Content-Type" /> <title _locid="PortabilityAnalysis0">.NET Portability Report</title> <style> /* Body style, for the entire document */ body { background: #F3F3F4; color: #1E1E1F; font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; padding: 0; margin: 0; } /* Header1 style, used for the main title */ h1 { padding: 10px 0px 10px 10px; font-size: 21pt; background-color: #E2E2E2; border-bottom: 1px #C1C1C2 solid; color: #201F20; margin: 0; font-weight: normal; } /* Header2 style, used for "Overview" and other sections */ h2 { font-size: 18pt; font-weight: normal; padding: 15px 0 5px 0; margin: 0; } /* Header3 style, used for sub-sections, such as project name */ h3 { font-weight: normal; font-size: 15pt; margin: 0; padding: 15px 0 5px 0; background-color: transparent; } h4 { font-weight: normal; font-size: 12pt; margin: 0; padding: 0 0 0 0; background-color: transparent; } /* Color all hyperlinks one color */ a { color: #1382CE; } /* Paragraph text (for longer informational messages) */ p { font-size: 10pt; } /* Table styles */ table { border-spacing: 0 0; border-collapse: collapse; font-size: 10pt; } table th { background: #E7E7E8; text-align: left; text-decoration: none; font-weight: normal; padding: 3px 6px 3px 6px; } table td { vertical-align: top; padding: 3px 6px 5px 5px; margin: 0px; border: 1px solid #E7E7E8; background: #F7F7F8; } .NoBreakingChanges { color: darkgreen; font-weight:bold; } .FewBreakingChanges { color: orange; font-weight:bold; } .ManyBreakingChanges { color: red; font-weight:bold; } .BreakDetails { margin-left: 30px; } .CompatMessage { font-style: italic; font-size: 10pt; } .GoodMessage { color: darkgreen; } /* Local link is a style for hyperlinks that link to file:/// content, there are lots so color them as 'normal' text until the user mouse overs */ .localLink { color: #1E1E1F; background: #EEEEED; text-decoration: none; } .localLink:hover { color: #1382CE; background: #FFFF99; text-decoration: none; } /* Center text, used in the over views cells that contain message level counts */ .textCentered { text-align: center; } /* The message cells in message tables should take up all avaliable space */ .messageCell { width: 100%; } /* Padding around the content after the h1 */ #content { padding: 0px 12px 12px 12px; } /* The overview table expands to width, with a max width of 97% */ #overview table { width: auto; max-width: 75%; } /* The messages tables are always 97% width */ #messages table { width: 97%; } /* All Icons */ .IconSuccessEncoded, .IconInfoEncoded, .IconWarningEncoded, .IconErrorEncoded { min-width: 18px; min-height: 18px; background-repeat: no-repeat; background-position: center; } /* Success icon encoded */ .IconSuccessEncoded { /* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */ /* [---XsltValidateInternal-Base64EncodedImage:IconSuccess#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABPElEQVR4Xp1Tv0vDUBi8FqeA4NpBcBLcWnQSApncOnTo4FSnjP0DsnXpH5CxiwbHDg4Zuj4oOEXiJgiC4FDcCkLWmIMc1Pfw+eMgQ77v3Xf3Pe51YKGqqisAEwCR1TIAsiAIblSo6xrdHeJR85Xle3mdmCQKb0PsfqyxxzM8K15HZADl/H5+sHpZwYfxyRjTs+kWwKBx8yoHd2mRiuzF8mkJniWH/13u3Fjrs/EdhsdDFHGB/DLXEJBDLh1MWPAhPo1BLB4WX5yQywHR+m3tVe/t97D52CB/ziG0nIgD/qDuYg8WuCcVZ2YGwlJ3YDugkpR/VNcAEx6GEKhERSr71FuO4YCM4XBdwKvecjIlkSnsO0Hyp/GxSeJAdzBKzpOtnPwyyiPdAZhpZptT04tU+zk7s8czeges//s5C5+CwqrR4/gw+AAAAABJRU5ErkJggg==); } /* Information icon encoded */ .IconInfoEncoded { /* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */ /* [---XsltValidateInternal-Base64EncodedImage:IconInformation#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABHElEQVR4Xs2TsUoDQRRF7wwoziokjZUKadInhdhukR9YP8DMX1hYW+QvdsXa/QHBbcXC7W0CamWTQnclFutceIQJwwaWNLlwm5k5d94M76mmaeCrrmsLYOocY12FcxZFUeozCqKqqgYA8uevv1H6VuPxcwlfk5N92KHBxfFeCSAxxswlYAW/Xr989x/mv9gkhtyMDhcAxgzRsp7flj8B/HF1RsMXq+NZMkopaHe7lbKxQUEIGbKsYNoGn969060hZBkQex/W8oRQwsQaW2o3Ago2SVcJUzAgY3N0lTCZZm+zPS8HB51gMmS1DEYyOz9acKO1D8JWTlafKIMxdhvlfdyT94Vv5h7P8Ky7nQzACmhvKq3zk3PjW9asz9D/1oigecsioooAAAAASUVORK5CYII=); } /* Warning icon encoded */ .IconWarningEncoded { /* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */ /* [---XsltValidateInternal-Base64EncodedImage:IconWarning#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAx0lEQVR4XpWSMQ7CMAxFf4xAyBMLCxMrO8dhaBcuwdCJS3RJBw7SA/QGTCxdWJgiQYWKXJWKIXHIlyw5lqr34tQgEOdcBsCOx5yZK3hCCKdYXneQkh4pEfqzLfu+wVDSyyzFoJjfz9NB+pAF+eizx2Vruts0k15mPgvS6GYvpVtQhB61IB/dk6AF6fS4Ben0uIX5odtFe8Q/eW1KvFeH4e8khT6+gm5B+t3juyDt7n0jpe+CANTd+oTUjN/U3yVaABnSUjFz/gFq44JaVSCXeQAAAABJRU5ErkJggg==); } /* Error icon encoded */ .IconErrorEncoded { /* Note: Do not delete the comment below. It is used to verify the correctness of the encoded image resource below before the product is released */ /* [---XsltValidateInternal-Base64EncodedImage:IconError#Begin#background-image: url(data:image/png;base64,#Separator#);#End#] */ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABQElEQVR4XqWTvUoEQRCE6wYPZUA80AfwAQz23uCMjA7MDRQEIzPBVEyNTQUFIw00vcQTTMzuAh/AxEQQT8HF/3G/oGGnEUGuoNnd6qoZuqltyKEsyzVJq5I6rnUp6SjGeGhESikzzlc1eL7opfuVbrqbU1Zw9NCgtQMaZpY0eNnaaL2fHusvTK5vKu7sjSS1Y4y3QUA6K3e3Mau5UFDyMP7tYF9o8cAHZv68vipoIJg971PZIZ5HiwdvYGGvFVFHmGmZ2MxwmQYPXubPl9Up0tfoMQGetXd6mRbvhBw+boZ6WF7Mbv1+GsHRk0fQmPAH1GfmZirbCfDJ61tw3Px8/8pZsPAG4jlVhcPgZ7adwNWBB68lkRQWFiTgFlbnLY3DGGM7izIJIyT/jjIvEJw6fdJTc6krDzh6aMwMP9bvDH4ADSsa9uSWVJkAAAAASUVORK5CYII=); } </style> </head> <body> <h1 _locid="PortabilityReport">.NET Portability Report</h1> <div id="content"> <div id="submissionId" style="font-size:8pt;"> <p> <i> Submission Id&nbsp; 9773579b-2139-46de-a809-2f30cf25a4c8 </i> </p> </div> <h2 _locid="SummaryTitle"> <a name="Portability Summary"></a>Portability Summary </h2> <div id="summary"> <table> <tbody> <tr> <th>Assembly</th> <th>ASP.NET 5,Version=v1.0</th> <th>Windows,Version=v8.1</th> <th>.NET Framework,Version=v4.6</th> <th>Windows Phone,Version=v8.1</th> </tr> <tr> <td><strong><a href="#Hazzik.Owin.Security.TradeMe">Hazzik.Owin.Security.TradeMe</a></strong></td> <td class="text-center">98.92 %</td> <td class="text-center">92.99 %</td> <td class="text-center">100.00 %</td> <td class="text-center">92.99 %</td> </tr> </tbody> </table> </div> <div id="details"> <a name="Hazzik.Owin.Security.TradeMe"><h3>Hazzik.Owin.Security.TradeMe</h3></a> <table> <tbody> <tr> <th>Target type</th> <th>ASP.NET 5,Version=v1.0</th> <th>Windows,Version=v8.1</th> <th>.NET Framework,Version=v4.6</th> <th>Windows Phone,Version=v8.1</th> <th>Recommended changes</th> </tr> <tr> <td>System.Net.Http.WebRequestHandler</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">#ctor</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">set_ServerCertificateValidationCallback(System.Net.Security.RemoteCertificateValidationCallback)</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Net.Security.RemoteCertificateValidationCallback</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Not supported for HTTP - use new Handler and ignorable server certificate errors instead</td> </tr> <tr> <td style="padding-left:2em">#ctor(System.Object,System.IntPtr)</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Not supported for HTTP - use new Handler and ignorable server certificate errors instead</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Net.Security.SslPolicyErrors</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Not supported for HTTP - use new Handler and ignorable server certificate errors instead</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Security.Claims.Claim</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">#ctor(System.String,System.String,System.String,System.String)</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Security.Claims.ClaimsIdentity</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">#ctor(System.Collections.Generic.IEnumerable{System.Security.Claims.Claim},System.String,System.String,System.String)</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">#ctor(System.String,System.String,System.String)</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">AddClaim(System.Security.Claims.Claim)</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">get_AuthenticationType</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">get_Claims</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">get_NameClaimType</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">get_RoleClaimType</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Security.Cryptography.HashAlgorithm</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">ComputeHash(System.Byte[])</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Security.Cryptography.HMACSHA1</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Currently there is no workaround, but we are working on it. Please check back.</td> </tr> <tr> <td style="padding-left:2em">#ctor</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>Currently there is no workaround, but we are working on it. Please check back.</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Security.Cryptography.KeyedHashAlgorithm</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">set_Key(System.Byte[])</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Security.Cryptography.X509Certificates.X509Certificate</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Security.Cryptography.X509Certificates.X509Chain</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Text.Encoding</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td style="padding-left:2em">get_ASCII</td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>System.Type</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>.GetTypeInfo().Assembly</td> </tr> <tr> <td style="padding-left:2em">get_Assembly</td> <td class="IconErrorEncoded"></td> <td class="IconErrorEncoded"></td> <td class="IconSuccessEncoded"></td> <td class="IconErrorEncoded"></td> <td>.GetTypeInfo().Assembly</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </tbody> </table> <p> <a href="#Portability Summary">Back to Summary</a> </p> </div> </div> </body> </html>
Java
# Update for Chrome 71 Due to abuse of users with the Speech Synthesis API (ADS, Fake system warnings), Google decided to remove the usage of the API in the browser when it's not triggered by an user gesture (click, touch etc.). This means that calling for example <code>artyom.say("Hello")</code> if it's not wrapped inside an user event won't work. So on every page load, the user will need to click at least once time per page to allow the usage of the API in the website, otherwise the following exception will be raised: "[Deprecation] speechSynthesis.speak() without user activation is no longer allowed since M71, around December 2018. See https://www.chromestatus.com/feature/5687444770914304 for more details" For more information, visit the bug or [this entry in the forum](https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/WsnBm53M4Pc). To bypass this error, the user will need to interact manually with the website at least once, for example with a click: ```html <button id="btn">Allow Voice Synthesis</button> <script src="artyom.window.js"></script> <script> var Jarvis = new Artyom(); // Needed user interaction at least once in the website to make // it work automatically without user interaction later... thanks google .i. document.getElementById("btn").addEventListener("click", function(){ Jarvis.say("Hello World !"); }, false); </script> ``` <p align="center"> <img src="https://raw.githubusercontent.com/sdkcarlos/artyom.js/master/public/images/artyomjs-logo.png" width="256" title="Artyom logo"> </p> # Table of Contents - [About Artyom](#about-artyom) * [Speech Recognition](#speech-recognition) * [Voice Synthesis](#voice-synthesis) - [Installation](#installation) * [NPM](#npm) * [Bower](#bower) - [How to use](#how-to-use) - [Basic usage](#basic-usage) - [All you need to know about Artyom](#all-you-need-to-know-about-artyom) - [Development](#development) * [Building Artyom from source](#building-artyom-from-source) * [Testing](#testing) - [Languages](#languages) - [Demonstrations](#demonstrations) - [Thanks](#thanks) # About Artyom Artyom.js is a robust and useful wrapper of the webkitSpeechRecognition and speechSynthesis APIs. Besides, artyom allows you to add dynamic commands to your web app (website). Artyom is constantly updated with new gadgets and awesome features, so be sure to star and watch this repository to be aware of any update. The main features of Artyom are: ### Speech Recognition - Quick recognition of voice commands. - Add commands easily. - Smart commands (usage of wildcards and regular expressions). - Create a dictation object to convert voice to text easily. - Simulate commands without microphone. - Execution keyword to execute a command immediately after the use of the keyword. - Pause and resume command recognition. - Artyom has available the soundex algorithm to increase the accuracy of the recognition of commands (disabled by default). - Use a remote command processor service instead of local processing with Javascript. - Works both in desktop browser and mobile device. ### Voice Synthesis - Synthesize extreme huge blocks of text (+20K words according to the last test). - onStart and onEnd callbacks **will be always executed independently of the text length**. - Works both in desktop browser and mobile device. Read [the changelog to be informed about changes and additions in Artyom.js](http://docs.ourcodeworld.com/projects/artyom-js/documentation/getting-started/official-changelog) # Installation #### NPM ```batch npm install artyom.js ``` #### Bower ```batch bower install artyom.js ``` Or just download a .zip package with the source code, minified file and commands examples : [download .zip file](https://github.com/sdkcarlos/artyom.js/raw/master/public/artyom-source.zip) # How to use Artyom is totally written in TypeScript, but it's transpiled on every version to JavaScript. 2 files are built namely `artyom.js` (used with Bundlers like Webpack, Browserify etc.) and `artyom.window.js` (only for the web browser). As everyone seems to use a bundler nowadays, for the module loader used is CommonJS: ```javascript // Using the /build/artyom.js file import Artyom from './artyom.js'; const Jarvis = new Artyom(); Jarvis.say("Hello World !"); ``` Alternatively, if you are of the old school and just want to use it with a script tag, you will need to use the `artyom.window.js` file instead: ```html <script src="artyom.window.js"></script> <script> var Jarvis = new Artyom(); Jarvis.say("Hello World !"); </script> ``` The source code of artyom handles a single TypeScript file `/source/artyom.ts`. # Basic usage Writing code with artyom is very simple: ```javascript // With ES6,TypeScript etc import Artyom from './artyom.js'; // Create a variable that stores your instance const artyom = new Artyom(); // Or if you are using it in the browser // var artyom = new Artyom();// or `new window.Artyom()` // Add command (Short code artisan way) artyom.on(['Good morning','Good afternoon']).then((i) => { switch (i) { case 0: artyom.say("Good morning, how are you?"); break; case 1: artyom.say("Good afternoon, how are you?"); break; } }); // Smart command (Short code artisan way), set the second parameter of .on to true artyom.on(['Repeat after me *'] , true).then((i,wildcard) => { artyom.say("You've said : " + wildcard); }); // or add some commandsDemostrations in the normal way artyom.addCommands([ { indexes: ['Hello','Hi','is someone there'], action: (i) => { artyom.say("Hello, it's me"); } }, { indexes: ['Repeat after me *'], smart:true, action: (i,wildcard) => { artyom.say("You've said : "+ wildcard); } }, // The smart commands support regular expressions { indexes: [/Good Morning/i], smart:true, action: (i,wildcard) => { artyom.say("You've said : "+ wildcard); } }, { indexes: ['shut down yourself'], action: (i,wildcard) => { artyom.fatality().then(() => { console.log("Artyom succesfully stopped"); }); } }, ]); // Start the commands ! artyom.initialize({ lang: "en-GB", // GreatBritain english continuous: true, // Listen forever soundex: true,// Use the soundex algorithm to increase accuracy debug: true, // Show messages in the console executionKeyword: "and do it now", listen: true, // Start to listen commands ! // If providen, you can only trigger a command if you say its name // e.g to trigger Good Morning, you need to say "Jarvis Good Morning" name: "Jarvis" }).then(() => { console.log("Artyom has been succesfully initialized"); }).catch((err) => { console.error("Artyom couldn't be initialized: ", err); }); /** * To speech text */ artyom.say("Hello, this is a demo text. The next text will be spoken in Spanish",{ onStart: () => { console.log("Reading ..."); }, onEnd: () => { console.log("No more text to talk"); // Force the language of a single speechSynthesis artyom.say("Hola, esto está en Español", { lang:"es-ES" }); } }); ``` # All you need to know about Artyom - [Documentation and FAQ](http://docs.ourcodeworld.com/projects/artyom-js) Do not hesitate to create a ticket on the issues area of the Github repository for any question, problem or inconvenient that you may have about artyom. # Development ## Building Artyom from source On every update, we build the latest version that can be retrieved from `/build` (for the browser and module). However, if you are willing to create your own version of Artyom, you would just need to modify the source file `/source/artyom.ts` and generate the build files using the following commands. If you want to create the Browser version, you will need as first remove the `export default` keywords at the beginning of the class and run then the following command: ```bash npm run build-artyom-window ``` If you want to create the Module version with CommonJS (for webpack, browserify etc) just run: ```bash npm run build-artyom-module ``` ## Testing If you're interested in modifying or working with Artyom, or *you just simply want to test it quickly in your environment*, we recommend you to use the little Sandbox utility of Artyom. Using Webpack, the Artyom Sandbox creates an HTTPS server accessible at https://localhost:3000, here Artyom will be accesible in Continuous mode too. Start by cloning the repository of artyom: ```bash git clone https://github.com/sdkcarlos/artyom.js/ cd artyom.js ``` Switch to the sandbox directory: ```bash cd sandbox ``` Then install the dependencies: ```bash npm install ``` And start the Webpack dev server using: ```bash npm start ``` and finally access to the [https://localhost:3000](https://localhost:3000) address from your browser and you will see a little UI interface to interact with Artyom. This is only meant to work on Artyom, so it still in development. # Languages Artyom provides **complete** support for the following languages. Every language needs an initialization code that needs to be provided in the lang property at the initialization. | |Description |Code for initialization| ------------- | ------------- | ------------- | |<img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/flag-usa.png" alt="Supported language"/>| English (USA)<br/>English (Great Britain) Great Britain| en-US<br/>en-GB | |<img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/flag-spanish.png" alt="Supported language"/>| Español | es-ES | |<img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/flag-german.png" alt="Supported language"/>| Deutsch (German) | de-DE | | <img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/flag-italy.png" alt="Supported language"/> | Italiano |it-IT | | <img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/flag-france.png" alt="Supported language"/> | Français |fr-FR | | <img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/flag-japan.png" alt="Supported language"/> | Japanese 日本人 | ja-JP | | <img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/flag-russia.png" alt="Supported language"/> | Russian | ru-RU | | <img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/flag-brasil.png" alt="Supported language"/> | Brazil | pt-PT | | <img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/flag-netherlands.png" alt="Supported language"/> | Dutch (netherlands)| nl-NL | | <img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/flag-poland.png" alt="Supported language"/> | Polski (polonia)| pl-PL | | <img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/flag-indonesia.png" alt="Supported language"/> | Indonesian (Indonesia)| id-ID | | <img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/flag-china.png" alt="Supported language"/> | Chinese (Cantonese[ 粤語(香港)] <br/> Mandarin[普通话(中国大陆)])| Cantonese<br/>zh-HK<br/> Mandarin<br />zh-CN| |<img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/flag-hindi.png" alt="Supported language" />| Hindi (India) | hi-IN | # Demonstrations - [Homepage](https://sdkcarlos.github.io/sites/artyom.html) - [Continuous mode J.A.R.V.I.S](https://sdkcarlos.github.io/jarvis.html) - [Sticky Notes](https://sdkcarlos.github.io/demo-sites/artyom/artyom_sticky_notes.html) # Thanks Working with artyom is cool and easy, read the documentation to discover more awesome features. Thanks for visiting the repository ! <p align="center"> <img src="https://raw.githubusercontent.com/sdkcarlos/sdkcarlos.github.io/master/sites/artyom-resources/images/artyom_make_sandwich.jpg" alt="Artyom example use" width="256"/> </p>
Java
#include "src/math/float/log10f.c" #include "log.h" int main(void) { test(log10f, log10); }
Java
<?php namespace XeroPHP\Reports; class AgedReceivablesByContact { /** * @var string[] */ private $headers; /** * @var mixed[] */ private $rows; /** * @param string[] $headers * @param mixed[] $rows */ public function __construct(array $headers, array $rows = []) { $this->headers = $headers; $this->rows = $rows; } /** * @return string[] */ public function getHeaders() { return $this->headers; } /** * @return mixed[] */ public function getRows() { return $this->rows; } }
Java
# mrb\_manager [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/rrreeeyyy/mrb_manager?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) mruby binary manager having a affinity for mgem ## Installation Install it yourself as: $ gem install mrb_manager Afterwards you will still need to add ```eval "$(mrbm init)"``` to your profile. You'll only ever have to do this once. ## Usage ### Install mruby with current active mgems You should be able to: $ mgem add mruby-redis $ mrbm install If ```-t tag_name``` specified, you can install tagged mruby $ mgem add mryby-redis $ mgem add mruby-http2 $ mrbm install -t redis-and-http2 ### Uninstall mruby You should be able to: # list all available mruby $ mrbm list ID CREATED VERSION TAG cfb43c1811c5 1 month ago 1.1.0 $ mrbm uninstall cfb43c1811c5 If you tagged: $ mrbm list ID CREATED VERSION TAG cf3889727b2a 1 month ago 1.0.0 redis-and-http2 $ mrbm uninstall -t redis-and-http2 ## Contributing 1. Fork it ( https://github.com/rrreeeyyy/mrb_manager/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request
Java
var searchData= [ ['nalloc',['NALLOC',['../dwarfDbgInt_8h.html#a30e913ccf93d7ea095a144407af0f9a5',1,'dwarfDbgInt.h']]], ['name',['name',['../structattrValues.html#ac7cb0154aaced069f3b1d24a4b40bf26',1,'attrValues']]], ['nextcompileunitoffset',['nextCompileUnitOffset',['../structcompileUnit.html#a1f5c469b922f6fcfe3abe6b5dd983495',1,'compileUnit']]], ['numaddchild',['numAddChild',['../dwarfDbgGetDbgInfo_8c.html#a6620daa01bc49c37e1850f9101cd240b',1,'dwarfDbgGetDbgInfo.c']]], ['numaddsibling',['numAddSibling',['../dwarfDbgGetDbgInfo_8c.html#a5f08554c0dc92b8611b48e024e84c7d5',1,'dwarfDbgGetDbgInfo.c']]], ['numattr',['numAttr',['../structdieInfo.html#aa7815765cabb001eff45e8d908b733ff',1,'dieInfo']]], ['numattrstr',['numAttrStr',['../structdwarfDbgCompileUnitInfo.html#a3f9747b4bf3a3c420e2b9658f1e3face',1,'dwarfDbgCompileUnitInfo']]], ['numchildren',['numChildren',['../structdieAndChildrenInfo.html#a280ccfdcd796e9b7bd7fb365a02ac281',1,'dieAndChildrenInfo']]], ['numciefde',['numCieFde',['../structframeInfo.html#a9bc9dfa7dfbe5161b9454c22803336ec',1,'frameInfo']]], ['numcompileunit',['numCompileUnit',['../structdwarfDbgCompileUnitInfo.html#a24a90186d262c29e8f3aec7816eb0692',1,'dwarfDbgCompileUnitInfo']]], ['numdieandchildren',['numDieAndChildren',['../structcompileUnit.html#a2d3ebcbf3cef4a2a1b777411fa12ad1e',1,'compileUnit']]], ['numdies',['numDies',['../dwarfDbgGetDbgInfo_8c.html#acc7b29b6d4c897948ace423095d48374',1,'dwarfDbgGetDbgInfo.c']]], ['numdirname',['numDirName',['../structdirNamesInfo.html#a36bc650195a2492fdc4ce208ee2fc9b1',1,'dirNamesInfo']]], ['numdwarraytype',['numDwArrayType',['../structdwarfDbgTypeInfo.html#a4731409d5947b1ace3cb0e6d22c82085',1,'dwarfDbgTypeInfo']]], ['numdwbasetype',['numDwBaseType',['../structdwarfDbgTypeInfo.html#a99d053257682ec963ca7ba41febee943',1,'dwarfDbgTypeInfo']]], ['numdwconsttype',['numDwConstType',['../structdwarfDbgTypeInfo.html#a9073033a9af6498d353d3074fcd6e776',1,'dwarfDbgTypeInfo']]], ['numdwenumerationtype',['numDwEnumerationType',['../structdwarfDbgTypeInfo.html#a0c3c6e13970688bc030fcc0ab03be937',1,'dwarfDbgTypeInfo']]], ['numdwenumeratortype',['numDwEnumeratorType',['../structdwarfDbgTypeInfo.html#a131bebca9296b13ae01bee9091a47e87',1,'dwarfDbgTypeInfo']]], ['numdwmember',['numDwMember',['../structdwarfDbgTypeInfo.html#a0c32301131e1174173a6687c7643ee25',1,'dwarfDbgTypeInfo']]], ['numdwpointertype',['numDwPointerType',['../structdwarfDbgTypeInfo.html#a317ed6269cb72dd3b7027e75de016d41',1,'dwarfDbgTypeInfo']]], ['numdwstructuretype',['numDwStructureType',['../structdwarfDbgTypeInfo.html#a225af72daa609f73f608df45c7690a6b',1,'dwarfDbgTypeInfo']]], ['numdwsubroutinetype',['numDwSubroutineType',['../structdwarfDbgTypeInfo.html#a2ba56760d9d3697582e6fb77abbb38e3',1,'dwarfDbgTypeInfo']]], ['numdwtypedef',['numDwTypeDef',['../structdwarfDbgTypeInfo.html#a1b78f04c8216ec36e16296c78d35abdb',1,'dwarfDbgTypeInfo']]], ['numdwuniontype',['numDwUnionType',['../structdwarfDbgTypeInfo.html#a3c34aae02d2c0125e9e1eee64247f6c9',1,'dwarfDbgTypeInfo']]], ['numdwvolatiletype',['numDwVolatileType',['../structdwarfDbgTypeInfo.html#a4c92bb8ff7f43382caa3651465ea9d61',1,'dwarfDbgTypeInfo']]], ['numfde',['numFde',['../structcieFde.html#a080816ba7436820c85f5327f1b5f59aa',1,'cieFde::numFde()'],['../structframeInfo.html#a1dabaf73bfd8ec4e746dd8032396b3a5',1,'frameInfo::numFde()']]], ['numfileinfo',['numFileInfo',['../structcompileUnit.html#a6fb20bccb16ae86ef9b4f87dd0ed1327',1,'compileUnit']]], ['numfileline',['numFileLine',['../structfileInfo.html#a1931d7c00f70afbf960c6c4521bdcd84',1,'fileInfo']]], ['numformalparameterinfo',['numFormalParameterInfo',['../structsubProgramInfo.html#a2ccc0b535ec89eefbc9b1c8fc8fd61d0',1,'subProgramInfo']]], ['numframeregcol',['numFrameRegCol',['../structframeDataEntry.html#ad5a00c5ef02350b1e388ab26a774fa48',1,'frameDataEntry']]], ['numlocentry',['numLocEntry',['../structlocationInfo.html#a72a38f9b38b05c2278bfcb6cee811015',1,'locationInfo']]], ['numpathname',['numPathName',['../structpathNamesInfo.html#a57a942792bec3a1198db069eff6158e5',1,'pathNamesInfo']]], ['numrangeinfo',['numRangeInfo',['../structcompileUnit.html#aabfa5a93c0791354cf2357eee5e9c259',1,'compileUnit']]], ['numsiblings',['numSiblings',['../structdieAndChildrenInfo.html#a594643b40a2e2c26d4f99c990250b67b',1,'dieAndChildrenInfo::numSiblings()'],['../dwarfDbgGetDbgInfo_8c.html#ab34dbb2cc194c304000747b02081d960',1,'numSiblings():&#160;dwarfDbgGetDbgInfo.c']]], ['numsourcefile',['numSourceFile',['../structcompileUnit.html#a004d068e8e8ea12f5f5f04bea1860860',1,'compileUnit']]], ['numsubprograminfo',['numSubProgramInfo',['../structcompileUnit.html#a61551a73c12d2c6a7e2bd35037940a21',1,'compileUnit']]], ['numtypestr',['numTypeStr',['../structdwarfDbgTypeInfo.html#a954ab297265cb3b7e36f3ce5d74367c9',1,'dwarfDbgTypeInfo']]], ['numvariableinfo',['numVariableInfo',['../structsubProgramInfo.html#aee427adb0c32497900dd9eb0a00b1ac5',1,'subProgramInfo']]] ];
Java
<?php namespace Mastercel\ChartBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Solicitudespagos * * @ORM\Table(name="SolicitudesPagos", indexes={@ORM\Index(name="Indice_1", columns={"DteSolicitud", "TmeSolicitud"}), @ORM\Index(name="Indice_2", columns={"DteActualizacion"}), @ORM\Index(name="Indice_3", columns={"NumEstadoComunicacion"})}) * @ORM\Entity */ class Solicitudespagos { /** * @var integer * * @ORM\Column(name="NumSolicitud_id", type="integer", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="NONE") */ private $numsolicitudId = '0'; /** * @var integer * * @ORM\Column(name="NumAlmacenSolicitud_id", type="integer", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="NONE") */ private $numalmacensolicitudId = '0'; /** * @var \DateTime * * @ORM\Column(name="DteSolicitud", type="datetime", nullable=true) */ private $dtesolicitud; /** * @var \DateTime * * @ORM\Column(name="TmeSolicitud", type="datetime", nullable=true) */ private $tmesolicitud; /** * @var \DateTime * * @ORM\Column(name="DteVencimiento", type="datetime", nullable=true) */ private $dtevencimiento; /** * @var integer * * @ORM\Column(name="NumEmpresa_id", type="integer", nullable=true) */ private $numempresaId = '0'; /** * @var integer * * @ORM\Column(name="NumMoneda_id", type="integer", nullable=true) */ private $nummonedaId = '0'; /** * @var integer * * @ORM\Column(name="NumEjecutivo_id", type="integer", nullable=true) */ private $numejecutivoId = '0'; /** * @var integer * * @ORM\Column(name="NumProveedor_id", type="integer", nullable=true) */ private $numproveedorId = '0'; /** * @var integer * * @ORM\Column(name="NumCategoria_id", type="integer", nullable=true) */ private $numcategoriaId = '0'; /** * @var integer * * @ORM\Column(name="NumAutorizador_id", type="integer", nullable=true) */ private $numautorizadorId = '0'; /** * @var integer * * @ORM\Column(name="NumCreadoPor_id", type="integer", nullable=true) */ private $numcreadoporId = '0'; /** * @var \DateTime * * @ORM\Column(name="DteCreacion", type="datetime", nullable=true) */ private $dtecreacion; /** * @var integer * * @ORM\Column(name="NumActualizadoPor_id", type="integer", nullable=true) */ private $numactualizadoporId = '0'; /** * @var \DateTime * * @ORM\Column(name="DteActualizacion", type="datetime", nullable=true) */ private $dteactualizacion; /** * @var integer * * @ORM\Column(name="NumTipoEstado", type="integer", nullable=true) */ private $numtipoestado = '0'; /** * @var integer * * @ORM\Column(name="NumEstadoComunicacion", type="integer", nullable=true) */ private $numestadocomunicacion = '0'; /** * Set numsolicitudId * * @param integer $numsolicitudId * @return Solicitudespagos */ public function setNumsolicitudId($numsolicitudId) { $this->numsolicitudId = $numsolicitudId; return $this; } /** * Get numsolicitudId * * @return integer */ public function getNumsolicitudId() { return $this->numsolicitudId; } /** * Set numalmacensolicitudId * * @param integer $numalmacensolicitudId * @return Solicitudespagos */ public function setNumalmacensolicitudId($numalmacensolicitudId) { $this->numalmacensolicitudId = $numalmacensolicitudId; return $this; } /** * Get numalmacensolicitudId * * @return integer */ public function getNumalmacensolicitudId() { return $this->numalmacensolicitudId; } /** * Set dtesolicitud * * @param \DateTime $dtesolicitud * @return Solicitudespagos */ public function setDtesolicitud($dtesolicitud) { $this->dtesolicitud = $dtesolicitud; return $this; } /** * Get dtesolicitud * * @return \DateTime */ public function getDtesolicitud() { return $this->dtesolicitud; } /** * Set tmesolicitud * * @param \DateTime $tmesolicitud * @return Solicitudespagos */ public function setTmesolicitud($tmesolicitud) { $this->tmesolicitud = $tmesolicitud; return $this; } /** * Get tmesolicitud * * @return \DateTime */ public function getTmesolicitud() { return $this->tmesolicitud; } /** * Set dtevencimiento * * @param \DateTime $dtevencimiento * @return Solicitudespagos */ public function setDtevencimiento($dtevencimiento) { $this->dtevencimiento = $dtevencimiento; return $this; } /** * Get dtevencimiento * * @return \DateTime */ public function getDtevencimiento() { return $this->dtevencimiento; } /** * Set numempresaId * * @param integer $numempresaId * @return Solicitudespagos */ public function setNumempresaId($numempresaId) { $this->numempresaId = $numempresaId; return $this; } /** * Get numempresaId * * @return integer */ public function getNumempresaId() { return $this->numempresaId; } /** * Set nummonedaId * * @param integer $nummonedaId * @return Solicitudespagos */ public function setNummonedaId($nummonedaId) { $this->nummonedaId = $nummonedaId; return $this; } /** * Get nummonedaId * * @return integer */ public function getNummonedaId() { return $this->nummonedaId; } /** * Set numejecutivoId * * @param integer $numejecutivoId * @return Solicitudespagos */ public function setNumejecutivoId($numejecutivoId) { $this->numejecutivoId = $numejecutivoId; return $this; } /** * Get numejecutivoId * * @return integer */ public function getNumejecutivoId() { return $this->numejecutivoId; } /** * Set numproveedorId * * @param integer $numproveedorId * @return Solicitudespagos */ public function setNumproveedorId($numproveedorId) { $this->numproveedorId = $numproveedorId; return $this; } /** * Get numproveedorId * * @return integer */ public function getNumproveedorId() { return $this->numproveedorId; } /** * Set numcategoriaId * * @param integer $numcategoriaId * @return Solicitudespagos */ public function setNumcategoriaId($numcategoriaId) { $this->numcategoriaId = $numcategoriaId; return $this; } /** * Get numcategoriaId * * @return integer */ public function getNumcategoriaId() { return $this->numcategoriaId; } /** * Set numautorizadorId * * @param integer $numautorizadorId * @return Solicitudespagos */ public function setNumautorizadorId($numautorizadorId) { $this->numautorizadorId = $numautorizadorId; return $this; } /** * Get numautorizadorId * * @return integer */ public function getNumautorizadorId() { return $this->numautorizadorId; } /** * Set numcreadoporId * * @param integer $numcreadoporId * @return Solicitudespagos */ public function setNumcreadoporId($numcreadoporId) { $this->numcreadoporId = $numcreadoporId; return $this; } /** * Get numcreadoporId * * @return integer */ public function getNumcreadoporId() { return $this->numcreadoporId; } /** * Set dtecreacion * * @param \DateTime $dtecreacion * @return Solicitudespagos */ public function setDtecreacion($dtecreacion) { $this->dtecreacion = $dtecreacion; return $this; } /** * Get dtecreacion * * @return \DateTime */ public function getDtecreacion() { return $this->dtecreacion; } /** * Set numactualizadoporId * * @param integer $numactualizadoporId * @return Solicitudespagos */ public function setNumactualizadoporId($numactualizadoporId) { $this->numactualizadoporId = $numactualizadoporId; return $this; } /** * Get numactualizadoporId * * @return integer */ public function getNumactualizadoporId() { return $this->numactualizadoporId; } /** * Set dteactualizacion * * @param \DateTime $dteactualizacion * @return Solicitudespagos */ public function setDteactualizacion($dteactualizacion) { $this->dteactualizacion = $dteactualizacion; return $this; } /** * Get dteactualizacion * * @return \DateTime */ public function getDteactualizacion() { return $this->dteactualizacion; } /** * Set numtipoestado * * @param integer $numtipoestado * @return Solicitudespagos */ public function setNumtipoestado($numtipoestado) { $this->numtipoestado = $numtipoestado; return $this; } /** * Get numtipoestado * * @return integer */ public function getNumtipoestado() { return $this->numtipoestado; } /** * Set numestadocomunicacion * * @param integer $numestadocomunicacion * @return Solicitudespagos */ public function setNumestadocomunicacion($numestadocomunicacion) { $this->numestadocomunicacion = $numestadocomunicacion; return $this; } /** * Get numestadocomunicacion * * @return integer */ public function getNumestadocomunicacion() { return $this->numestadocomunicacion; } }
Java
const moment = require('moment') const expect = require('chai').expect const sinon = require('sinon') const proxyquire = require('proxyquire') const breadcrumbHelper = require('../../helpers/breadcrumb-helper') const orgUnitConstant = require('../../../app/constants/organisation-unit.js') const activeStartDate = moment('25-12-2017', 'DD-MM-YYYY').toDate() // 2017-12-25T00:00:00.000Z const activeEndDate = moment('25-12-2018', 'DD-MM-YYYY').toDate() // 2018-12-25T00:00:00.000Z const breadcrumbs = breadcrumbHelper.TEAM_BREADCRUMBS const expectedReductionExport = [ { offenderManager: 'Test_Forename Test_Surname', reason: 'Disability', amount: 5, startDate: activeStartDate, endDate: activeEndDate, status: 'ACTIVE', additionalNotes: 'New Test Note' }] let getReductionsData let exportReductionService let getBreadcrumbsStub beforeEach(function () { getReductionsData = sinon.stub() getBreadcrumbsStub = sinon.stub().resolves(breadcrumbs) exportReductionService = proxyquire('../../../app/services/get-reductions-export', { './data/get-reduction-notes-export': getReductionsData, './get-breadcrumbs': getBreadcrumbsStub }) }) describe('services/get-reductions-export', function () { it('should return the expected reductions exports for team level', function () { getReductionsData.resolves(expectedReductionExport) return exportReductionService(1, orgUnitConstant.TEAM.name) .then(function (result) { expect(getReductionsData.calledWith(1, orgUnitConstant.TEAM.name)).to.be.eql(true) expect(getBreadcrumbsStub.calledWith(1, orgUnitConstant.TEAM.name)).to.be.eql(true) expect(result.reductionNotes[0].offenderManager).to.be.eql(expectedReductionExport[0].offenderManager) expect(result.reductionNotes[0].reason).to.be.eql(expectedReductionExport[0].reason) expect(result.reductionNotes[0].amount).to.be.eql(expectedReductionExport[0].amount) expect(result.reductionNotes[0].startDate).to.be.eql('25 12 2017, 00:00') expect(result.reductionNotes[0].endDate).to.be.eql('25 12 2018, 00:00') expect(result.reductionNotes[0].status).to.be.eql(expectedReductionExport[0].status) expect(result.reductionNotes[0].additionalNotes).to.be.eql(expectedReductionExport[0].additionalNotes) }) }) })
Java
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using ProjectData; using Tools; using ProjectBLL; using System.Data; using Approve.RuleCenter; using System.Text; using System.Collections; using Approve.RuleApp; public partial class JSDW_DesignDoc_Report : Page { ProjectDB db = new ProjectDB(); RCenter rc = new RCenter(); protected void Page_Load(object sender, EventArgs e) { pageTool tool = new pageTool(this.Page); tool.ExecuteScript("tab();"); if (Session["FIsApprove"] != null && Session["FIsApprove"].ToString() == "1") { this.RegisterStartupScript(Guid.NewGuid().ToString(), "<script>FIsApprove();</script>"); } if (!IsPostBack) { btnSave.Attributes["onclick"] = "return checkInfo();"; BindControl(); showInfo(); } } //绑定 private void BindControl() { //备案部门 string deptId = ComFunction.GetDefaultDept(); StringBuilder sb = new StringBuilder(); sb.Append("select case FLevel when 1 then FFullName when 2 then FName when 3 then FName end FName,"); sb.Append("FNumber from cf_Sys_ManageDept "); sb.Append("where fnumber like '" + deptId + "%' "); sb.Append("and fname<>'市辖区' "); sb.Append("order by left(FNumber,4),flevel"); DataTable dt = rc.GetTable(sb.ToString()); p_FManageDeptId.DataSource = dt; p_FManageDeptId.DataSource = dt; p_FManageDeptId.DataTextField = "FName"; p_FManageDeptId.DataValueField = "FNumber"; p_FManageDeptId.DataBind(); } //显示 private void showInfo() { string FAppId = EConvert.ToString(Session["FAppId"]); var app = (from t in db.CF_App_List where t.FId == FAppId select new { t.FName, t.FYear, t.FLinkId, t.FBaseName, t.FPrjId, t.FState, }).FirstOrDefault(); pageTool tool = new pageTool(this.Page, "p_"); if (app != null) { t_FName.Text = app.FName; //已提交不能修改 if (app.FState == 1 || app.FState == 6) { tool.ExecuteScript("btnEnable();"); } //显示工程信息 CF_Prj_BaseInfo prj = db.CF_Prj_BaseInfo.Where(t => t.FId == app.FPrjId).FirstOrDefault(); if (prj != null) { tool.fillPageControl(prj); } } } /// <summary> /// 验证附件是否上传 /// </summary> /// <returns></returns> bool IsUploadFile(int? FMTypeId, string FAppId) { CF_Prj_BaseInfo prj = (from p in db.CF_Prj_BaseInfo join a in db.CF_App_List on p.FId equals a.FPrjId where a.FId == FAppId select p).FirstOrDefault(); var v =false ; if (prj != null) { v = db.CF_Sys_PrjList.Count(t => t.FIsMust == 1 && t.FManageType == FMTypeId && t.FIsPrjType.Contains(prj.FType.ToString()) && db.CF_AppPrj_FileOther.Count(o => o.FPrjFileId == t.FId && o.FAppId == FAppId) < 1) > 0; } return v; } public void Report() { RCenter rc = new RCenter(); pageTool tool = new pageTool(this.Page); string fDeptNumber = ComFunction.GetDefaultDept(); if (fDeptNumber == null || fDeptNumber == "") { tool.showMessage("系统出错,请配置默认管理部门"); return; } string FAppId = EConvert.ToString(Session["FAppId"]); var app = (from t in db.CF_App_List where t.FId == FAppId select t).FirstOrDefault(); SortedList[] sl = new SortedList[1]; if (app != null) { //验证必需的附件是否上传 if (IsUploadFile(app.FManageTypeId, FAppId)) { tool.showMessage("“上传行政批文、上传设计文件”菜单中存在未上传的附件(必需上传的),请先上传!"); return; } CF_Prj_BaseInfo prj = db.CF_Prj_BaseInfo.Where(t => t.FId == app.FPrjId).FirstOrDefault(); if (prj != null) { sl[0] = new SortedList(); sl[0].Add("FID", app.FId); sl[0].Add("FAppId", app.FId); sl[0].Add("FBaseInfoId", app.FBaseinfoId); sl[0].Add("FManageTypeId", app.FManageTypeId); sl[0].Add("FListId", "19301"); sl[0].Add("FTypeId", "1930100"); sl[0].Add("FLevelId", "1930100"); sl[0].Add("FIsPrime", 0); //sl.Add("FAppDeptId", row["FAppDeptId"].ToString()); //sl.Add("FAppDeptName", row["FAppDeptName"].ToString()); sl[0].Add("FAppTime", DateTime.Now); sl[0].Add("FIsNew", 0); sl[0].Add("FIsBase", 0); sl[0].Add("FIsTemp", 0); sl[0].Add("FUpDept", p_FManageDeptId.SelectedValue); sl[0].Add("FEmpId", prj.FId); sl[0].Add("FEmpName", prj.FPrjName); //存设计单位 var s = (from t in db.CF_Prj_Ent join a in db.CF_App_List on t.FAppId equals a.FId where a.FPrjId == app.FPrjId && a.FManageTypeId == 291 && t.FEntType == 155 && a.FState == 6 select new { t.FId, t.FBaseInfoId, t.FName, t.FLevelName, t.FCertiNo, t.FMoney, t.FPlanDate, t.FAppId }).FirstOrDefault(); if (s != null) { sl[0].Add("FLeadId", s.FBaseInfoId); sl[0].Add("FLeadName", s.FName); } StringBuilder sb = new StringBuilder(); sb.Append("update CF_App_List set FUpDeptId=" + p_FManageDeptId.SelectedValue + ","); sb.Append("ftime=getdate() where fid = '" + FAppId + "'"); rc.PExcute(sb.ToString()); string fsystemid = CurrentEntUser.SystemId; RApp ra = new RApp(); if (ra.EntStartProcessKCSJ(app.FBaseinfoId, FAppId, app.FYear.ToString(), DateTime.Now.Month.ToString(), fsystemid, fDeptNumber, p_FManageDeptId.SelectedValue, sl)) { sb.Remove(0, sb.Length); this.Session["FIsApprove"] = 1; tool.showMessageAndRunFunction("上报成功!", "location.href=location.href"); } } } } //保存按钮 protected void btnSave_Click(object sender, EventArgs e) { Report(); } }
Java
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information. using System.Threading.Tasks; using Test.Utilities; using Xunit; using VerifyCS = Test.Utilities.CSharpCodeFixVerifier< Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.EnumsShouldHaveZeroValueAnalyzer, Microsoft.CodeQuality.CSharp.Analyzers.ApiDesignGuidelines.CSharpEnumsShouldHaveZeroValueFixer>; using VerifyVB = Test.Utilities.VisualBasicCodeFixVerifier< Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.EnumsShouldHaveZeroValueAnalyzer, Microsoft.CodeQuality.VisualBasic.Analyzers.ApiDesignGuidelines.BasicEnumsShouldHaveZeroValueFixer>; namespace Microsoft.CodeQuality.Analyzers.ApiDesignGuidelines.UnitTests { public class EnumsShouldHaveZeroValueFixerTests { [Fact] public async Task CSharp_EnumsShouldZeroValueFlagsRenameAsync() { var code = @" public class Outer { [System.Flags] public enum E { A = 0, B = 3 } } [System.Flags] public enum E2 { A2 = 0, B2 = 1 } [System.Flags] public enum E3 { A3 = (ushort)0, B3 = (ushort)1 } [System.Flags] public enum E4 { A4 = 0, B4 = (int)2 // Sample comment } [System.Flags] public enum NoZeroValuedField { A5 = 1, B5 = 2 }"; var expectedFixedCode = @" public class Outer { [System.Flags] public enum E { None = 0, B = 3 } } [System.Flags] public enum E2 { None = 0, B2 = 1 } [System.Flags] public enum E3 { None = (ushort)0, B3 = (ushort)1 } [System.Flags] public enum E4 { None = 0, B4 = (int)2 // Sample comment } [System.Flags] public enum NoZeroValuedField { A5 = 1, B5 = 2 }"; await VerifyCS.VerifyCodeFixAsync( code, new[] { VerifyCS.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleRename).WithSpan(7, 9, 7, 10).WithArguments("E", "A"), VerifyCS.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleRename).WithSpan(15, 5, 15, 7).WithArguments("E2", "A2"), VerifyCS.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleRename).WithSpan(22, 5, 22, 7).WithArguments("E3", "A3"), VerifyCS.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleRename).WithSpan(29, 5, 29, 7).WithArguments("E4", "A4"), }, expectedFixedCode); } [Fact] public async Task CSharp_EnumsShouldZeroValueFlagsMultipleZeroAsync() { var code = @"// Some comment public class Outer { [System.Flags] public enum E { None = 0, A = 0 } } // Some comment [System.Flags] public enum E2 { None = 0, A = None }"; var expectedFixedCode = @"// Some comment public class Outer { [System.Flags] public enum E { None = 0 } } // Some comment [System.Flags] public enum E2 { None = 0 }"; await VerifyCS.VerifyCodeFixAsync( code, new[] { VerifyCS.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleMultipleZero).WithSpan(5, 17, 5, 18).WithArguments("E"), VerifyCS.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleMultipleZero).WithSpan(13, 13, 13, 15).WithArguments("E2"), }, expectedFixedCode); } [Fact] public async Task CSharp_EnumsShouldZeroValueNotFlagsNoZeroValueAsync() { var code = @" public class Outer { public enum E { A = 1 } public enum E2 { None = 1, A = 2 } } public enum E3 { None = 0, A = 1 } public enum E4 { None = 0, A = 0 } "; var expectedFixedCode = @" public class Outer { public enum E { None, A = 1 } public enum E2 { None, A = 2 } } public enum E3 { None = 0, A = 1 } public enum E4 { None = 0, A = 0 } "; await VerifyCS.VerifyCodeFixAsync( code, new[] { VerifyCS.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleNoZero).WithSpan(4, 17, 4, 18).WithArguments("E"), VerifyCS.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleNoZero).WithSpan(9, 17, 9, 19).WithArguments("E2"), }, expectedFixedCode); } [Fact] public async Task VisualBasic_EnumsShouldZeroValueFlagsRenameAsync() { var code = @" Public Class Outer <System.Flags> Public Enum E A = 0 B = 1 End Enum End Class <System.Flags> Public Enum E2 A2 = 0 B2 = 1 End Enum <System.Flags> Public Enum E3 A3 = CUShort(0) B3 = CUShort(1) End Enum <System.Flags> Public Enum NoZeroValuedField A5 = 1 B5 = 2 End Enum "; var expectedFixedCode = @" Public Class Outer <System.Flags> Public Enum E None = 0 B = 1 End Enum End Class <System.Flags> Public Enum E2 None = 0 B2 = 1 End Enum <System.Flags> Public Enum E3 None = CUShort(0) B3 = CUShort(1) End Enum <System.Flags> Public Enum NoZeroValuedField A5 = 1 B5 = 2 End Enum "; await VerifyVB.VerifyCodeFixAsync( code, new[] { VerifyVB.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleRename).WithSpan(5, 9, 5, 10).WithArguments("E", "A"), VerifyVB.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleRename).WithSpan(12, 5, 12, 7).WithArguments("E2", "A2"), VerifyVB.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleRename).WithSpan(18, 5, 18, 7).WithArguments("E3", "A3"), }, expectedFixedCode); } [WorkItem(836193, "DevDiv")] [Fact] public async Task VisualBasic_EnumsShouldZeroValueFlagsRename_AttributeListHasTriviaAsync() { var code = @" Public Class Outer <System.Flags> _ Public Enum E A = 0 B = 1 End Enum End Class <System.Flags> _ Public Enum E2 A2 = 0 B2 = 1 End Enum <System.Flags> _ Public Enum E3 A3 = CUShort(0) B3 = CUShort(1) End Enum <System.Flags> _ Public Enum NoZeroValuedField A5 = 1 B5 = 2 End Enum "; var expectedFixedCode = @" Public Class Outer <System.Flags> _ Public Enum E None = 0 B = 1 End Enum End Class <System.Flags> _ Public Enum E2 None = 0 B2 = 1 End Enum <System.Flags> _ Public Enum E3 None = CUShort(0) B3 = CUShort(1) End Enum <System.Flags> _ Public Enum NoZeroValuedField A5 = 1 B5 = 2 End Enum "; await VerifyVB.VerifyCodeFixAsync( code, new[] { VerifyVB.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleRename).WithSpan(5, 9, 5, 10).WithArguments("E", "A"), VerifyVB.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleRename).WithSpan(12, 5, 12, 7).WithArguments("E2", "A2"), VerifyVB.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleRename).WithSpan(18, 5, 18, 7).WithArguments("E3", "A3"), }, expectedFixedCode); } [Fact] public async Task VisualBasic_EnumsShouldZeroValueFlagsMultipleZeroAsync() { var code = @" Public Class Outer <System.Flags> Public Enum E None = 0 A = 0 End Enum End Class <System.Flags> Public Enum E2 None = 0 A = None End Enum <System.Flags> Public Enum E3 A3 = 0 B3 = CUInt(0) ' Not a constant End Enum"; var expectedFixedCode = @" Public Class Outer <System.Flags> Public Enum E None = 0 End Enum End Class <System.Flags> Public Enum E2 None = 0 End Enum <System.Flags> Public Enum E3 None End Enum"; await VerifyVB.VerifyCodeFixAsync( code, new[] { VerifyVB.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleMultipleZero).WithSpan(4, 17, 4, 18).WithArguments("E"), VerifyVB.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleMultipleZero).WithSpan(11, 13, 11, 15).WithArguments("E2"), VerifyVB.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleMultipleZero).WithSpan(17, 13, 17, 15).WithArguments("E3"), }, expectedFixedCode); } [Fact] public async Task VisualBasic_EnumsShouldZeroValueNotFlagsNoZeroValueAsync() { var code = @" Public Class C Public Enum E A = 1 End Enum Public Enum E2 None = 1 A = 2 End Enum End Class Public Enum E3 None = 0 A = 1 End Enum Public Enum E4 None = 0 A = 0 End Enum "; var expectedFixedCode = @" Public Class C Public Enum E None A = 1 End Enum Public Enum E2 None A = 2 End Enum End Class Public Enum E3 None = 0 A = 1 End Enum Public Enum E4 None = 0 A = 0 End Enum "; await VerifyVB.VerifyCodeFixAsync( code, new[] { VerifyVB.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleNoZero).WithSpan(3, 17, 3, 18).WithArguments("E"), VerifyVB.Diagnostic(EnumsShouldHaveZeroValueAnalyzer.RuleNoZero).WithSpan(7, 17, 7, 19).WithArguments("E2"), }, expectedFixedCode); } } }
Java
/** * Conversion: * All dynamic tweaked dom id or class names are prefixed with 't-'. */ /** * Config */ var PRIVATE_TOKEN = 'xYDh7cpVX8BS2unon1hp'; /** * Globals. */ var autocompleteOpts, projectOpts, currentProjectID, currentProjectPath; $(function () { initGlobals(); handleAll(); mapUrlHandler(location.pathname, [ { pattern: /^\/[^\/]+\/[^\/]+$/, handle: handleProjectDashboard }, { pattern: /^.+\/tree\/.+/, handle: handleTreeView }, { pattern: /^.+\/blob\/[^\/]+\/.+\.md$/, handle: handleMdBlobView } ]); }); $(document).ajaxSuccess(function (event, xhr, settings) { mapUrlHandler(settings.url, [ { pattern: /.+\?limit=20/, handle: handleDashboardActivities }, { pattern: /.+\/refs\/.+\/logs_tree\/.+/, handle: handleLogsTree }, { pattern: /.+notes\.js\?target_type=issue.+/, handle: handleIssueComments } ]); }); /** * Parse useful data from dom elements and assign them to globals for later use. */ function initGlobals () { autocompleteOpts = JSON.parse($('.search-autocomplete-json').attr('data-autocomplete-opts')); projectOpts = _.where(autocompleteOpts, function (opt) { if (opt.label.indexOf('project:') !== -1) { return true; } }); currentUser = $('.profile-pic').attr('href').slice(3); currentProjectID = $(document.body).attr('data-project-id'); currentProjectPath = '/'; if ($('h1.project_name span').length) { currentProjectPath += $('h1.project_name span').text() .replace(/\s/, '').replace(/\s/, '').replace(' ', '-').toLowerCase(); } else { currentProjectPath += currentUser + '/' + $('h1.project_name').text().replace(' ', '-').toLowerCase(); } currentBranch = $('.project-refs-select').val(); console.log(currentUser, currentProjectID, currentProjectPath, currentBranch); } /** * Document loaded url handlers. */ /** * Handle tweak tasks for all pages. */ function handleAll() { $('.home a').attr('href', $('.home a').attr('href') + '#'); addProjectSelect(); } /** * Handle tweak tasks for project dashboard page. */ function handleProjectDashboard() { // Nothing to do. } /** * Handle tweak tasks for files tree view. */ function handleTreeView() { genMdFileTOCAndAdjustHyperlink(); } /** * Handle tweak tasks for markdown file blob view. */ function handleMdBlobView() { var slideLink = $('<a class="btn btn-tiny" target="_blank">slide</a>') .attr('href', '/reveal/md.html?p=' + location.pathname.replace('blob', 'raw')); $('.file-title .options .btn-group a:nth-child(2)').after(slideLink); genMdFileTOCAndAdjustHyperlink(); } /** * Add project select on the top bar. */ function addProjectSelect() { var projectSelectForm = $('<form class="navbar-form pull-left">' + '<select id="t-project-list"></select>' + '</form>'); $('.navbar .container .nav li:nth-child(2)').after(projectSelectForm); var options = projectOpts.map(function (project) { return $('<option />').val(project.url.toLowerCase()).text(project.label.slice(9)); }); if (!$('h1.project_name span').length) { options.unshift('<option>Go to Project</option>'); } $('#t-project-list').append(options) .val(currentProjectPath) .change(function () { location.href = $(this).val(); }); } /** * Generate TOC for markdown file. */ function genMdFileTOCAndAdjustHyperlink() { // Assume there is only one .file-holder. var fileHolder = $('.file-holder'); if (fileHolder.length !== 1) { return; } var fileTitle = fileHolder.find('.file-title'), fileContent = fileHolder.find('.file-content'); fileTitle.wrapInner('<div class="t-file-title-header" />') .scrollToFixed(); var fileTitleFooter = $('<div class="t-file-title-footer"><div class="t-file-title-toc navbar-inner" /></div>') .appendTo(fileTitle) .hide(); var fileTitleToc = fileTitleFooter.find('.t-file-title-toc') .tocify({ context: fileContent, selectors: 'h1,h2,h3,h4,h5,h6', showAndHide: false, hashGenerator: 'pretty', scrollTo: 38 }); // Some special characters will cause tocify hash error, replace them with empty string. fileHolder.find('[data-unique]').each(function () { $(this).attr('data-unique', $(this).attr('data-unique').replace(/\./g, '')); }); $('<span class="t-file-title-toc-toggler options">' + '<div class="btn-group tree-btn-group">' + '<a class="btn btn-tiny" title="Table of Content, \'m\' for shortcut.">TOC</a>' + '</div>' + '</span>') .click(function () { fileTitleFooter.toggle(); }) .appendTo(fileTitle.find('.t-file-title-header')); $(document).keyup(function(e) { switch (e.which) { case 27: fileTitleFooter.hide(); break; case 77: fileTitleFooter.toggle(); break; } }); // Jumpt to ahchor if has one. if (location.hash) { var anchor = location.hash.slice(1); fileTitleToc.find('li[data-unique="' + anchor + '"] a').click(); } // Adjust hyperlink. fileContent.find('a').each(function () { var href = $(this).attr('href'); // Sine 6-2-stable, gitlab will handle relative links when rendering markdown, // but it didn't work, all relative links fallback to wikis path, // I didn't have much time to figure out why, so I did this quick fix. var gitlabPrefixedWikisPath = currentProjectPath + '/wikis/'; var gitlabPrefixedWikisPathIndex = href.indexOf(gitlabPrefixedWikisPath); if (gitlabPrefixedWikisPathIndex != -1) { href = href.slice(gitlabPrefixedWikisPath.length); } // If not start with '/' and doesn't have '//', consider it as a relative path. if (/^[^\/]/.test(href) && !/.*\/\/.*/.test(href)) { var middlePath; // If end with .ext, this is a file path, otherwise is a directory path. if (/.*\.[^\/]+$/.test(href)) { middlePath = '/blob/'; } else { middlePath = '/tree/'; } $(this).attr('href', currentProjectPath + middlePath + currentBranch + '/' + href); } }); } /** * Ajax success url handlers. */ /** * Handle tweak tasks for dashboard activities. */ function handleDashboardActivities() { // Nothing to do. } /** * Handle tweak tasks for issue comments. */ function handleIssueComments() { $('.note-image-attach').each(function () { var img = $(this); var wrapper = $('<a class="t-fancybox-note-image-attach" rel="gallery-note-image-attach" />') .attr('href', img.attr('src')) .attr('title', img.attr('alt')); img.wrap(wrapper); wrapper.commonFancybox(); }); $('.t-fancybox-note-image-attach').commonFancybox(); } /** * Handle tweak tasks for git logs tree. */ function handleLogsTree() { // Nothing to do. } /** * Helpers. */ function mapUrlHandler(url, handlers) { handlers.forEach(function (handler) { if (handler.pattern.test(url)) { handler.handle(); } }); } function mySetInterval(fn, interval) { setTimeout(function () { fn(function () { mySetInterval(fn, interval); }); }, interval); } function myGitLabAPIGet(url, data, cb) { $.get('/api/v3/' + url + '?private_token=' + PRIVATE_TOKEN, data, function (data) { cb(data); }); } /** * Extensions */ if (typeof String.prototype.endsWith !== 'function') { String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; } (function ($) { $.fn.extend({ commonFancybox: function () { $(this).fancybox({ closeBtn: false, helpers: { title: { type : 'inside' }, buttons: {} } }); } }); })(jQuery);
Java
import axios from 'axios' import pipelineApi from './api' import { addMessage } from '../../../client/utils/flash-messages' import { transformValueForAPI } from '../../../client/utils/date' function transformValuesForApi(values, oldValues = {}) { const data = { name: values.name, status: values.category, } function addValue(key, value) { const existingValue = oldValues[key] const hasExistingValue = Array.isArray(existingValue) ? !!existingValue.length : !!existingValue if (hasExistingValue || (Array.isArray(value) ? value.length : value)) { data[key] = value || null } } addValue('likelihood_to_win', parseInt(values.likelihood, 10)) addValue('sector', values.sector?.value) addValue( 'contacts', values.contacts ? values.contacts.map(({ value }) => value) : [] ) addValue('potential_value', values.export_value) addValue('expected_win_date', transformValueForAPI(values.expected_win_date)) return data } export async function getPipelineByCompany({ companyId }) { const { data } = await pipelineApi.list({ company_id: companyId }) return { companyId, count: data.count, results: data.results, } } export async function addCompanyToPipeline({ values, companyId }) { const { data } = await pipelineApi.create({ company: companyId, ...transformValuesForApi(values), }) addMessage('success', `You added ${values.name} to your pipeline`) return data } export async function getPipelineItem({ pipelineItemId }) { const { data } = await pipelineApi.get(pipelineItemId) return data } export async function getCompanyContacts({ companyId, features }) { const contactEndpointVersion = features['address-area-contact-required-field'] ? 'v4' : 'v3' const { data } = await axios.get( `/api-proxy/${contactEndpointVersion}/contact`, { params: { company_id: companyId, limit: 500 }, } ) return data.results } export async function editPipelineItem({ values, pipelineItemId, currentPipelineItem, }) { const { data } = await pipelineApi.update( pipelineItemId, transformValuesForApi(values, currentPipelineItem) ) addMessage('success', `You saved changes to ${values.name}`) return data } export async function archivePipelineItem({ values, pipelineItemId, projectName, }) { const { data } = await pipelineApi.archive(pipelineItemId, { reason: values.reason, }) addMessage('success', `You archived ${projectName}`) return data } export async function unarchivePipelineItem({ projectName, pipelineItemId }) { const { data } = await pipelineApi.unarchive(pipelineItemId) addMessage('success', `You unarchived ${projectName}`) return data } export async function deletePipelineItem({ projectName, pipelineItemId }) { const { status } = await pipelineApi.delete(pipelineItemId) addMessage('success', `You deleted ${projectName} from your pipeline`) return status }
Java
var global = require('../../global'); module.exports = function (data, offset) { var items = data.items.map(invoiceNote => { var invoiceItem = invoiceNote.items.map(dataItem => { var _items = dataItem.items.map(item => { dueDate = new Date(dataItem.deliveryOrderSupplierDoDate); dueDate.setDate(dueDate.getDate() + item.paymentDueDays); return { deliveryOrderNo: dataItem.deliveryOrderNo, date: dataItem.deliveryOrderDate, purchaseRequestRefNo: item.purchaseRequestRefNo, product: item.product.name, productDesc: item.product.description, quantity: item.deliveredQuantity, uom: item.purchaseOrderUom.unit, unit: item.unit, price: item.pricePerDealUnit, priceTotal: item.pricePerDealUnit * item.deliveredQuantity, correction: item.correction, dueDate: dueDate, paymentMethod: item.paymentMethod, currRate: item.kursRate, } }); _items = [].concat.apply([], _items); return _items; }) invoiceItem = [].concat.apply([], invoiceItem); return invoiceItem; }); items = [].concat.apply([], items); var dueDate, paymentMethod; var dueDates = items.map(item => { return item.dueDate }) dueDate = Math.max.apply(null, dueDates); paymentMethod = items[0].paymentMethod; var useIncomeTax = data.items .map((item) => item.useIncomeTax) .reduce((prev, curr, index) => { return prev && curr }, true); var useVat = data.items .map((item) => item.useVat) .reduce((prev, curr, index) => { return prev && curr }, true); var vatRate = 0; if (useVat) { vatRate = data.items[0].vat.rate; } var sumByUnit = []; items.reduce(function (res, value) { if (!res[value.unit]) { res[value.unit] = { priceTotal: 0, unit: value.unit }; sumByUnit.push(res[value.unit]) } res[value.unit].priceTotal += value.priceTotal return res; }, {}); var locale = global.config.locale; var moment = require('moment'); moment.locale(locale.name); var header = [ { stack: [ 'PT. DAN LIRIS', 'Head Office : ', 'Kelurahan Banaran, Kecamatan Grogol', 'Sukoharjo 57193 - INDONESIA', 'PO.BOX 166 Solo 57100', 'Telp. (0271) 740888, 714400', 'Fax. (0271) 735222, 740777' ], alignment: "left", style: ['size06', 'bold'] }, { alignment: "center", text: 'NOTA INTERN', style: ['size08', 'bold'] }, '\n' ]; var subHeader = [ { columns: [ { width: '50%', stack: [ { columns: [{ width: '25%', text: 'No. Nota Intern', style: ['size06'] }, { width: '2%', text: ':', style: ['size06'] }, { width: '*', text: data.no, style: ['size06'] }] }, { columns: [{ width: '25%', text: 'Kode Supplier', style: ['size06'] }, { width: '2%', text: ':', style: ['size06'] }, { width: '*', text: data.supplier.code, style: ['size06'] }] }, { columns: [{ width: '25%', text: 'Nama Supplier', style: ['size06'] }, { width: '2%', text: ':', style: ['size06'] }, { width: '*', text: data.supplier.name, style: ['size06'] }] } ] }, { width: '50%', stack: [ { columns: [{ width: '28%', text: 'Tgl. Nota Intern', style: ['size06'] }, { width: '2%', text: ':', style: ['size06'] }, { width: '*', text: `${moment(data.date).add(offset, 'h').format("DD MMM YYYY")}`, style: ['size06'] }] }, { columns: [{ width: '28%', text: 'Tgl. Jatuh Tempo', style: ['size06'] }, { width: '2%', text: ':', style: ['size06'] }, { width: '*', text: `${moment(dueDate).add(offset, 'h').format("DD MMM YYYY")}`, style: ['size06'] }] },{ columns: [{ width: '28%', text: 'Term Pembayaran', style: ['size06'] }, { width: '2%', text: ':', style: ['size06'] }, { width: '*', text: paymentMethod, style: ['size06'] }] }, ] } ] }, { text: '\n', style: ['size06'] } ]; var thead = [ { text: 'No. Surat Jalan', style: ['size06', 'bold', 'center'] }, { text: 'Tgl. Surat Jalan', style: ['size06', 'bold', 'center'] }, { text: 'Nomor referensi PR', style: ['size06', 'bold', 'center'] }, { text: 'Keterangan Barang', style: ['size06', 'bold', 'center'] }, { text: 'Jumlah', style: ['size06', 'bold', 'center'] }, { text: 'Satuan', style: ['size06', 'bold', 'center'] }, { text: 'Harga Satuan', style: ['size06', 'bold', 'center'] }, { text: 'Harga Total', style: ['size06', 'bold', 'center'] } ]; var tbody = items.map(function (item, index) { return [{ text: item.deliveryOrderNo, style: ['size06', 'left'] }, { text: `${moment(item.date).add(offset, 'h').format("DD MMM YYYY")}`, style: ['size06', 'left'] }, { text: item.purchaseRequestRefNo, style: ['size06', 'left'] }, { text: `${item.product};${item.productDesc}`, style: ['size06', 'left'] }, { text: item.quantity, style: ['size06', 'right'] }, { text: item.uom, style: ['size06', 'left'] }, { text: parseFloat(item.price).toLocaleString(locale, locale.currency), style: ['size06', 'right'] }, { text: parseFloat(item.priceTotal).toLocaleString(locale, locale.currency), style: ['size06', 'right'] }]; }); tbody = tbody.length > 0 ? tbody : [ [{ text: "tidak ada barang", style: ['size06', 'center'], colSpan: 8 }, "", "", "", "", "", "", ""] ]; var table = [{ table: { widths: ['12%', '12%', '10%', '25%', '7%', '7%', '12%', '15%'], headerRows: 1, body: [].concat([thead], tbody) } }]; var unitK1 = sumByUnit.find((item) => item.unit.toUpperCase() == "C2A"); var unitK2 = sumByUnit.find((item) => item.unit.toUpperCase() == "C2B"); var unitK3 = sumByUnit.find((item) => item.unit.toUpperCase() == "C2C"); var unitK4 = sumByUnit.find((item) => item.unit.toUpperCase() == "C1A"); var unit2D = sumByUnit.find((item) => item.unit.toUpperCase() == "C1B"); var sum = sumByUnit.map(item => item.priceTotal) .reduce(function (prev, curr, index, arr) { return prev + curr; }, 0); var sumKoreksi = items.map(item => item.correction) .reduce(function (prev, curr, index, arr) { return prev + curr; }, 0); var sumByCurrency = items.map(item => item.priceTotal * item.currRate) .reduce(function (prev, curr, index, arr) { return prev + curr; }, 0); var incomeTaxTotal = useIncomeTax ? sumByCurrency * 0.1 : 0; var vatTotal = useVat ? sumByCurrency * vatRate / 100 : 0; var sumTotal = sumByCurrency - vatTotal + incomeTaxTotal + sumKoreksi; var subFooter = [ { text: '\n', style: ['size06'] }, { columns: [ { stack: [ { columns: [ { width: '25%', text: 'Total K1 (2A)' }, { width: '2%', text: ':' }, { width: '*', text: unitK1 ? parseFloat(unitK1.priceTotal).toLocaleString(locale, locale.currency) : "" } ] }, { columns: [ { width: '25%', text: 'Total K2 (2B)' }, { width: '2%', text: ':' }, { width: '*', text: unitK2 ? parseFloat(unitK2.priceTotal).toLocaleString(locale, locale.currency) : "" } ] }, { columns: [ { width: '25%', text: 'Total K3 (2C)' }, { width: '2%', text: ':' }, { width: '*', text: unitK3 ? parseFloat(unitK3.priceTotal).toLocaleString(locale, locale.currency) : "" } ] }, { columns: [ { width: '25%', text: 'Total K4 (1)' }, { width: '2%', text: ':' }, { width: '*', text: unitK4 ? parseFloat(unitK4.priceTotal).toLocaleString(locale, locale.currency) : "" } ] }, { columns: [ { width: '25%', text: 'Total 2D' }, { width: '2%', text: ':' }, { width: '*', text: unit2D ? parseFloat(unit2D.priceTotal).toLocaleString(locale, locale.currency) : "" } ] }, ] }, { stack: [ { columns: [ { width: '45%', text: 'Total Harga Pokok (DPP)' }, { width: '2%', text: ':' }, { width: '*', text: parseFloat(sum).toLocaleString(locale, locale.currency) } ] }, { columns: [ { width: '45%', text: 'Mata Uang' }, { width: '2%', text: ':' }, { width: '*', text: data.currency.code } ] }, { columns: [ { width: '45%', text: 'Total Harga Pokok (Rp)' }, { width: '2%', text: ':' }, { width: '*', text: parseFloat(sum * data.currency.rate).toLocaleString(locale, locale.currency) } ] }, { columns: [ { width: '45%', text: 'Total Nota Koreksi' }, { width: '2%', text: ':' }, { width: '*', text: parseFloat(sumKoreksi).toLocaleString(locale, locale.currency) } ] }, { columns: [ { width: '45%', text: 'Total Nota PPN' }, { width: '2%', text: ':' }, { width: '*', text: parseFloat(incomeTaxTotal).toLocaleString(locale, locale.currency) } ] }, { columns: [ { width: '45%', text: 'Total Nota PPH' }, { width: '2%', text: ':' }, { width: '*', text: parseFloat(vatTotal).toLocaleString(locale, locale.currency) } ] }, { columns: [ { width: '45%', text: 'Total yang harus dibayar' }, { width: '2%', text: ':' }, { width: '*', text: parseFloat(sumTotal).toLocaleString(locale, locale.currency) } ] }, ] } ], style: ['size07'] }]; var footer = ['\n\n', { alignment: "center", table: { widths: ['33%', '33%', '33%'], body: [ [ { text: 'Administrasi', style: ['size06', 'bold', 'center'] }, { text: 'Staff Pembelian', style: ['size06', 'bold', 'center'] }, { text: 'Verifikasi', style: ['size06', 'bold', 'center'] } ], [ { stack: ['\n\n\n\n', { text: '(Nama & Tanggal)', style: ['size06', 'center'] } ] }, { stack: ['\n\n\n\n', { text: '(Nama & Tanggal)', style: ['size06', 'center'] } ] }, { stack: ['\n\n\n\n', { text: '(Nama & Tanggal)', style: ['size06', 'center'] } ] } ] ] } }]; var dd = { pageSize: 'A5', pageOrientation: 'portrait', pageMargins: 20, content: [].concat(header, subHeader, table, subFooter, footer), styles: { size06: { fontSize: 6 }, size07: { fontSize: 7 }, size08: { fontSize: 8 }, size09: { fontSize: 9 }, size10: { fontSize: 10 }, bold: { bold: true }, center: { alignment: 'center' }, left: { alignment: 'left' }, right: { alignment: 'right' }, justify: { alignment: 'justify' } } }; return dd; };
Java
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>coqffi: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.8.1 / coqffi - 1.0.0~beta7</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> coqffi <small> 1.0.0~beta7 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2021-12-20 02:39:21 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-12-20 02:39:21 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base camlp5 7.14 Preprocessor-pretty-printer of OCaml conf-findutils 1 Virtual package relying on findutils conf-perl 1 Virtual package relying on perl coq 8.8.1 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.03.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.03.0 Official 4.03.0 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;lthms@soap.coffee&quot; homepage: &quot;https://github.com/coq-community/coqffi&quot; dev-repo: &quot;git+https://github.com/coq-community/coqffi.git&quot; bug-reports: &quot;https://github.com/coq-community/coqffi/issues&quot; license: &quot;MIT&quot; synopsis: &quot;Tool for generating Coq FFI bindings to OCaml libraries&quot; description: &quot;&quot;&quot; `coqffi` generates the necessary Coq boilerplate to use OCaml functions in a Coq development, and configures the Coq extraction mechanism accordingly.&quot;&quot;&quot; build: [ [&quot;./src-prepare.sh&quot;] [&quot;dune&quot; &quot;build&quot; &quot;-p&quot; name &quot;-j&quot; jobs] ] depends: [ &quot;ocaml&quot; {&gt;= &quot;4.08&quot; &amp; &lt; &quot;4.13~&quot; } &quot;dune&quot; {&gt;= &quot;2.5&quot;} &quot;coq&quot; {(&gt;= &quot;8.12&quot; &amp; &lt; &quot;8.14~&quot;) | = &quot;dev&quot;} &quot;cmdliner&quot; {&gt;= &quot;1.0.4&quot;} &quot;sexplib&quot; {&gt;= &quot;0.14&quot;} ] tags: [ &quot;category:Miscellaneous/Coq Extensions&quot; &quot;keyword:foreign function interface&quot; &quot;keyword:extraction&quot; &quot;keyword:OCaml&quot; &quot;logpath:CoqFFI&quot; ] authors: [ &quot;Thomas Letan&quot; &quot;Li-yao Xia&quot; &quot;Yann Régis-Gianas&quot; &quot;Yannick Zakowski&quot; ] url { src: &quot;https://github.com/coq-community/coqffi/archive/1.0.0-beta7.tar.gz&quot; checksum: &quot;sha512=0f9d2893f59f8d09caec83f8476a2e7a511a7044516d639e4283b4187a86cf1563e60f1647cd12ae06e7e395bbc5dfedf5d798af3eb6baf81c0c2e482e14507b&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-coqffi.1.0.0~beta7 coq.8.8.1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.8.1). The following dependencies couldn&#39;t be met: - coq-coqffi -&gt; ocaml &gt;= 4.08 base of this switch (use `--unlock-base&#39; to force) No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-coqffi.1.0.0~beta7</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
Java
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>bignums: 3 m 34 s 🏆</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.7.1+2 / bignums - 8.7.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> bignums <small> 8.7.0 <span class="label label-success">3 m 34 s 🏆</span> </small> </h1> <p>📅 <em><script>document.write(moment("2021-11-14 19:55:30 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-11-14 19:55:30 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base camlp5 7.14 Preprocessor-pretty-printer of OCaml conf-findutils 1 Virtual package relying on findutils conf-perl 1 Virtual package relying on perl coq 8.7.1+2 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.09.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.09.1 Official release 4.09.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;pierre.letouzey@inria.fr&quot; homepage: &quot;https://github.com/coq/bignums&quot; dev-repo: &quot;git+https://github.com/coq/bignums.git&quot; bug-reports: &quot;https://github.com/coq/bignums/issues&quot; authors: [ &quot;Laurent Théry&quot; &quot;Benjamin Grégoire&quot; &quot;Arnaud Spiwack&quot; &quot;Evgeny Makarov&quot; &quot;Pierre Letouzey&quot; ] license: &quot;LGPL-2.1-only&quot; build: [ [make &quot;-j%{jobs}%&quot; {ocaml:version &gt;= &quot;4.06&quot;}] ] install: [ [make &quot;install&quot;] ] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.7&quot; &amp; &lt; &quot;8.8~&quot;} ] tags: [ &quot;keyword:integer numbers&quot; &quot;keyword:rational numbers&quot; &quot;keyword:arithmetic&quot; &quot;keyword:arbitrary-precision&quot; &quot;category:Miscellaneous/Coq Extensions&quot; &quot;category:Mathematics/Arithmetic and Number Theory/Number theory&quot; &quot;category:Mathematics/Arithmetic and Number Theory/Rational numbers&quot; &quot;date:2017-06-15&quot; &quot;logpath:Bignums&quot; ] synopsis: &quot;Bignums, the Coq library of arbitrary large numbers&quot; description: &quot;Provides BigN, BigZ, BigQ that used to be part of Coq standard library &lt; 8.7.&quot; url { src: &quot;https://github.com/coq/bignums/archive/V8.7.0.tar.gz&quot; checksum: &quot;md5=1d5f18f15675cfac64df59b3405e64d3&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-bignums.8.7.0 coq.8.7.1+2</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-bignums.8.7.0 coq.8.7.1+2</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>13 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-bignums.8.7.0 coq.8.7.1+2</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>3 m 34 s</dd> </dl> <h2>Installation size</h2> <p>Total: 10 M</p> <ul> <li>1 M <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigN/BigN.vo</code></li> <li>777 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleDiv.vo</code></li> <li>712 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleSqrt.vo</code></li> <li>641 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigZ/BigZ.vo</code></li> <li>610 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigN/NMake.vo</code></li> <li>549 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleDiv.glob</code></li> <li>366 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleMul.vo</code></li> <li>344 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleSqrt.glob</code></li> <li>306 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigQ/QMake.vo</code></li> <li>295 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleDivn1.vo</code></li> <li>290 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigN/NMake_gen.vo</code></li> <li>274 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleCyclic.vo</code></li> <li>265 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleLift.vo</code></li> <li>263 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigN/NMake.glob</code></li> <li>211 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaZ/ZSigZAxioms.vo</code></li> <li>209 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaZ/NSigNAxioms.vo</code></li> <li>200 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleDivn1.glob</code></li> <li>197 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleCyclic.glob</code></li> <li>197 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigN/NMake_gen.glob</code></li> <li>189 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigQ/BigQ.vo</code></li> <li>181 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleMul.glob</code></li> <li>177 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigZ/ZMake.vo</code></li> <li>151 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleLift.glob</code></li> <li>145 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigQ/QMake.glob</code></li> <li>138 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaQ/QSig.vo</code></li> <li>116 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigNumPrelude.vo</code></li> <li>116 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigZ/ZMake.glob</code></li> <li>101 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigN/Nbasic.vo</code></li> <li>96 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleSub.vo</code></li> <li>92 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleBase.vo</code></li> <li>87 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleSub.glob</code></li> <li>80 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleAdd.vo</code></li> <li>74 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleBase.glob</code></li> <li>72 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleAdd.glob</code></li> <li>69 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigN/Nbasic.glob</code></li> <li>69 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/bignums_syntax_plugin.cmxs</code></li> <li>68 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigNumPrelude.glob</code></li> <li>62 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaZ/NSigNAxioms.glob</code></li> <li>61 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaZ/ZSigZAxioms.glob</code></li> <li>60 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaZ/ZSig.vo</code></li> <li>56 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaZ/NSig.vo</code></li> <li>55 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleDiv.v</code></li> <li>52 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigN/NMake.v</code></li> <li>48 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleSqrt.v</code></li> <li>37 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaQ/QSig.glob</code></li> <li>35 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigQ/QMake.v</code></li> <li>35 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaZ/ZSig.glob</code></li> <li>33 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigN/NMake_gen.v</code></li> <li>31 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaZ/NSig.glob</code></li> <li>28 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleCyclic.v</code></li> <li>24 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleMul.v</code></li> <li>21 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigZ/ZMake.v</code></li> <li>20 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleDivn1.v</code></li> <li>19 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleLift.v</code></li> <li>16 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigN/Nbasic.v</code></li> <li>16 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigZ/BigZ.glob</code></li> <li>13 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigN/BigN.glob</code></li> <li>13 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleBase.v</code></li> <li>13 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigNumPrelude.v</code></li> <li>12 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleSub.v</code></li> <li>12 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaZ/ZSigZAxioms.v</code></li> <li>12 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigQ/BigQ.glob</code></li> <li>12 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaZ/NSigNAxioms.v</code></li> <li>11 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/CyclicDouble/DoubleAdd.v</code></li> <li>9 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/bignums_syntax_plugin.cmi</code></li> <li>9 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/bignums_syntax_plugin.cmx</code></li> <li>7 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaQ/QSig.v</code></li> <li>6 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigZ/BigZ.v</code></li> <li>6 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigN/BigN.v</code></li> <li>5 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaZ/ZSig.v</code></li> <li>5 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/BigQ/BigQ.v</code></li> <li>5 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/SpecViaZ/NSig.v</code></li> <li>4 K <code>../ocaml-base-compiler.4.09.1/lib/coq/user-contrib/Bignums/bignums_syntax_plugin.cmxa</code></li> </ul> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq-bignums.8.7.0</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
Java
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>persistent-union-find: Not compatible</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.11.1 / persistent-union-find - 8.10.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> persistent-union-find <small> 8.10.0 <span class="label label-info">Not compatible</span> </small> </h1> <p><em><script>document.write(moment("2021-04-06 21:49:33 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-04-06 21:49:33 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.11.1 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.11.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.11.1 Official release 4.11.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Hugo.Herbelin@inria.fr&quot; homepage: &quot;http://www.lri.fr/~filliatr/puf/&quot; license: &quot;Unknown&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/PersistentUnionFind&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.10&quot; &amp; &lt; &quot;8.11~&quot;} ] tags: [ &quot;keyword: program verification&quot; &quot;keyword: union-find&quot; &quot;keyword: data structures&quot; &quot;keyword: Tarjan&quot; &quot;category: Computer Science/Decision Procedures and Certified Algorithms/Correctness proofs of algorithms&quot; ] authors: [ &quot;Jean-Christophe Filliâtre&quot; ] bug-reports: &quot;https://github.com/coq-contribs/persistent-union-find/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/persistent-union-find.git&quot; synopsis: &quot;Persistent Union Find&quot; description: &quot;&quot;&quot; Correctness proof of the Ocaml implementation of a persistent union-find data structure. See http://www.lri.fr/~filliatr/puf/ for more details.&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/persistent-union-find/archive/v8.10.0.tar.gz&quot; checksum: &quot;md5=9d860c3649cb724e3f5e513d1b1ff60b&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-persistent-union-find.8.10.0 coq.8.11.1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.11.1). The following dependencies couldn&#39;t be met: - coq-persistent-union-find -&gt; coq &lt; 8.11~ -&gt; ocaml &lt; 4.10 base of this switch (use `--unlock-base&#39; to force) No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-persistent-union-find.8.10.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> <small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small> </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
Java
// // StoreAppleReceiptParser.hpp // Pods // // Created by eps on 7/3/20. // #ifndef EE_X_STORE_APPLE_RECEIPT_PARSER_HPP #define EE_X_STORE_APPLE_RECEIPT_PARSER_HPP #include <string> #include "ee/store/StoreFwd.hpp" namespace ee { namespace store { class AppleReceiptParser { public: AppleReceiptParser(); std::shared_ptr<AppleReceipt> parse(const std::string& receiptData); private: IMessageBridge& bridge_; }; } // namespace store } // namespace ee #endif /* EE_X_STORE_APPLE_RECEIPT_PARSER_HPP */
Java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package com.azure.resourcemanager.network; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.network.models.DdosProtectionPlan; import com.azure.resourcemanager.test.utils.TestUtilities; import com.azure.core.management.Region; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; public class DdosProtectionPlanTests extends NetworkManagementTest { @Test public void canCRUDDdosProtectionPlan() throws Exception { String ppName = generateRandomResourceName("ddosplan", 15); DdosProtectionPlan pPlan = networkManager .ddosProtectionPlans() .define(ppName) .withRegion(locationOrDefault(Region.US_SOUTH_CENTRAL)) .withNewResourceGroup(rgName) .withTag("tag1", "value1") .create(); Assertions.assertEquals("value1", pPlan.tags().get("tag1")); PagedIterable<DdosProtectionPlan> ppList = networkManager.ddosProtectionPlans().list(); Assertions.assertTrue(TestUtilities.getSize(ppList) > 0); ppList = networkManager.ddosProtectionPlans().listByResourceGroup(rgName); Assertions.assertTrue(TestUtilities.getSize(ppList) > 0); networkManager.ddosProtectionPlans().deleteById(pPlan.id()); ppList = networkManager.ddosProtectionPlans().listByResourceGroup(rgName); Assertions.assertTrue(TestUtilities.isEmpty(ppList)); } }
Java
"""Run tests for the kmeans portion of the kmeans module""" import kmeans.kmeans.kmeans as kmeans import numpy as np import random def test_1dim_distance(): """See if this contraption works in 1 dimension""" num1 = random.random() num2 = random.random() assert kmeans.ndim_euclidean_distance(num1, num2) == abs(num1-num2) def test_ndim_distance(): """Test to see if changing val by 1 does what it ought to do convert to float to integer because floating arithmetic makes testing analytic functions a mess""" rand = random.random point1 = [rand(), rand(), rand(), rand(), rand(), rand()] point2 = [point1[0]+1] + point1[1:] # just shift x to the right by 1 assert int(round(kmeans.ndim_euclidean_distance(point1, point2))) == 1 def test_maxiters(): """ensure the iteration ceiling works""" # assert kmeans.should_iter([], [], iterations=29) == True assert kmeans.should_iter([], [], iterations=30) == False assert kmeans.should_iter([], [], iterations=31) == False def test_random_centroid_dimensions(): """ensure the correct number of dimensions""" dimensions = random.randrange(1, 100) k = random.randrange(1, 100) centroids = kmeans.random_centroids(k, dimensions) for centroid in centroids: assert len(centroid) == dimensions def test_iterated_centroid(): """ensure that the average across each dimension is returned""" new_centroid = kmeans.iterated_centroid([[1, 1, 1], [2, 2, 2]],\ [[100, 200, 300]], [(0, 0), (1, 0)]) np.testing.assert_allclose(new_centroid, np.array([[1.5, 1.5, 1.5]]),\ rtol=1e-5)
Java
const multiples = '(hundred|thousand|million|billion|trillion|quadrillion|quintillion|sextillion|septillion)' const here = 'fraction-tagger' // plural-ordinals like 'hundredths' are already tagged as Fraction by compromise const tagFractions = function (doc) { // hundred doc.match(multiples).tag('#Multiple', here) // half a penny doc.match('[(half|quarter)] of? (a|an)', 0).tag('Fraction', 'millionth') // nearly half doc.match('#Adverb [half]', 0).tag('Fraction', 'nearly-half') // half the doc.match('[half] the', 0).tag('Fraction', 'half-the') // two-halves doc.match('#Value (halves|halfs|quarters)').tag('Fraction', 'two-halves') // ---ordinals as fractions--- // a fifth doc.match('a #Ordinal').tag('Fraction', 'a-quarter') // seven fifths doc.match('(#Fraction && /s$/)').lookBefore('#Cardinal+$').tag('Fraction') // one third of .. doc.match('[#Cardinal+ #Ordinal] of .', 0).tag('Fraction', 'ordinal-of') // 100th of doc.match('[(#NumericValue && #Ordinal)] of .', 0).tag('Fraction', 'num-ordinal-of') // a twenty fifth doc.match('(a|one) #Cardinal?+ #Ordinal').tag('Fraction', 'a-ordinal') // doc.match('(a|one) [#Ordinal]', 0).tag('Fraction', 'a-ordinal') // values.if('#Ordinal$').tag('Fraction', '4-fifths') // seven quarters // values.tag('Fraction', '4-quarters') // doc.match('(#Value && !#Ordinal)+ (#Ordinal|#Fraction)').tag('Fraction', '4-fifths') // 12 and seven fifths // doc.match('#Value+ and #Value+ (#Ordinal|half|quarter|#Fraction)').tag('Fraction', 'val-and-ord') // fixups // doc.match('#Cardinal+? (second|seconds)').unTag('Fraction', '3 seconds') // doc.match('#Ordinal (half|quarter)').unTag('Fraction', '2nd quarter') // doc.match('#Ordinal #Ordinal+').unTag('Fraction') // doc.match('[#Cardinal+? (second|seconds)] of (a|an)', 0).tag('Fraction', here) // doc.match(multiples).tag('#Multiple', here) // // '3 out of 5' doc.match('#Cardinal+ out? of every? #Cardinal').tag('Fraction', here) // // one and a half // doc.match('#Cardinal and a (#Fraction && #Value)').tag('Fraction', here) // fraction - 'a third of a slice' // TODO:fixme // m = doc.match(`[(#Cardinal|a) ${ordinals}] of (a|an|the)`, 0).tag('Fraction', 'ord-of') // tag 'thirds' as a ordinal // m.match('.$').tag('Ordinal', 'plural-ordinal') return doc } module.exports = tagFractions
Java
window._skel_config = { prefix: 'css/style', preloadStyleSheets: true, resetCSS: true, boxModel: 'border', grid: { gutters: 30 }, breakpoints: { wide: { range: '1200-', containers: 1140, grid: { gutters: 50 } }, narrow: { range: '481-1199', containers: 960 }, mobile: { range: '-480', containers: 'fluid', lockViewport: true, grid: { collapse: true } } } }; $(document).ready(function () { $("#calculate").click(function () { var opOne = $("#opOneID").val(); var opTwo = $("#opTwoID").val(); var selected = $('#mathFunction :selected').val(); if (opOne.length != 0) { $("#resultID").val(process(selected, opOne, opTwo)); // puts the result into the correct dom element resultID on the page. } else if (opTwo.length != 0) { $("#resultID").val(process(selected, opOne, opTwo)); // puts the result into the correct dom element resultID on the page. } }); $("#clear").click(function () { $("#opOneID").val(''); $("#opTwoID").val(''); $("#resultID").val(''); }); $("#pnlRemove").click(function () { /* this function remove the fron panelof the cube so you can see inside and changes the bottom image which is the manchester United chrest with the image that ] was the front panel image] this only shows the panels being changed by using code*/ var imageName = 'img/v8liv.PNG'; var changepnl = $('#btmpnl'); var pnlID = $('#v8front'); $(pnlID).hide(); // hide the front panel $('#btmpnl').attr('src', imageName); // change the bottom image to v8rear.PNG }); $('#mathFunction :selected').val(); $('#mathFunction').change(function () { /* this fucntion calls the calucate funtion with the number to be converted with the conversion type which comes from the select tag, eg pk is pounds to kilo's this function fires when the select dropdown box changes */ var opOne = $("#opOneID").val(); var opTwo = $("#opTwoID").val(); var selected = $('#mathFunction :selected').val(); // console.log($('#conversion :selected').val()); //write it out to the console to verify what was $("#resultID").val(process(selected, opOne,opTwo)); // puts the convertion into the correct dom element on the page. }).change(); }); function process(selected, opOne,opTwo) { switch (selected) { case "+": return Calc.AddNo(opOne,opTwo); break; case "-": return Calc.SubNo(opOne, opTwo); break; case "/": return Calc.DivideNo(opOne, opTwo); break; case "*": return Calc.MultplyNo(opOne, opTwo); break; default: return "Error ! "; // code to be executed if n is different from case 1 and 2 } }
Java
# phase-0-gps-1 GPS 1.1(pair with Tom Goldenberg)
Java
(function(app, undefined) { 'use strict'; if(!app) throw new Error('Application "app" namespace not found.'); //---------------------------------------------------------------------------- console.log( 'hello world' ); console.log( 'Application Running...' ); //---------------------------------------------------------------------------- // @begin: renders app.render.jquery(); app.render.vanilla(); // @end: renders //---------------------------------------------------------------------------- // @begin: to_jquery app.to_jquery.run(); // @end: to_jquery //---------------------------------------------------------------------------- // @begin: mustache app.menu.render(); app.menu.option.reset(); // @begin: mustache //---------------------------------------------------------------------------- })(window.app);
Java
{-# LANGUAGE CPP #-} module Database.Orville.PostgreSQL.Plan.Explanation ( Explanation , noExplanation , explainStep , explanationSteps ) where newtype Explanation = Explanation ([String] -> [String]) #if MIN_VERSION_base(4,11,0) instance Semigroup Explanation where (<>) = appendExplanation #endif instance Monoid Explanation where mempty = noExplanation mappend = appendExplanation appendExplanation :: Explanation -> Explanation -> Explanation appendExplanation (Explanation front) (Explanation back) = Explanation (front . back) noExplanation :: Explanation noExplanation = Explanation id explainStep :: String -> Explanation explainStep str = Explanation (str:) explanationSteps :: Explanation -> [String] explanationSteps (Explanation prependTo) = prependTo []
Java
using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace KUI.Controls { public class FlatAccentButton : FlatButton { protected override void OnPaintBackground(PaintEventArgs pevent) { pevent.Graphics.FillRectangle( MouseOver ? Theme.ForeBrush : Theme.AccentBrush, ClientRectangle); } public override void DrawShadow(Graphics g) { if (HasShadow) { for (int i = 0; i < ShadowLevel; i++) { g.DrawRectangle( new Pen(Theme.AccentColor.Shade(Theme.ShadowSize, i)), ShadeRect(i)); } } } } }
Java
// crm114_config.h -- Configuration for CRM114 library. // Copyright 2001-2010 William S. Yerazunis. // // This file is part of the CRM114 Library. // // The CRM114 Library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // The CRM114 Library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with the CRM114 Library. If not, see <http://www.gnu.org/licenses/>. // // Derived from engine version of crm114_config.h. /////////////////////////////////////////////////////////////////// // Some things here you can change with relative impunity. // Other things, not so much. Where there are limiting factors // noted, please obey them or you may break something important. // And, of course, realize that this is LGPLed software with // NO WARRANTY - make any changes and that goes double. /////////////////////////////////////////////////////////////////// #ifndef __CRM114_CONFIG_H__ #define __CRM114_CONFIG_H__ // Do you want all the classifiers? Or just the "production // ready ones"? Comment the next line out if you want everything. //#define PRODUCTION_CLASSIFIERS_ONLY // // // As used in the library: #define STATISTICS_FILE_IDENT_STRING_MAX 1024 #define CLASSNAME_LENGTH 31 #define DEFAULT_HOW_MANY_CLASSES 2 #define DEFAULT_CLASS_SIZE (1<<23) // 8 megabytes // Markov family config // do we use Sparse Binary Polynomial Hashing (sensitive to both // sequence and spacing of individual words), Token Grab Bag, or // Token Sequence Sensitive? Testing against the SpamAssassin // "hard" database shows that SBPH, TGB, and TGB2, are somewhat // more accurate than TSS, and about 50% more accurate than First // Order Only. However, that's for English, and other natural // languages may show a different statistical distribution. // // Choose ONE of the following: // SBPH, TGB2, TGB, TSS, or ARBITRARY_WINDOW_LEN: // // *** DANGER, WILL ROBINSON *** You MUST rebuild your .css files from // samples of text if you change this. // // // Sparse Binary Polynomial Hashing #define SBPH // // Token Grab Bag, noaliasing //#define TGB2 // // Token Grab Bag, aliasing //#define TGB // // Token Sequence Sensitive //#define TSS // // First Order Only (i.e. single words, like SpamBayes) // Note- if you use FOO, you must turn off weights!! //#define FOO // // Generalized format for the window length. // // DO NOT SET THIS TO MORE THAN 10 WITHOUT LENGTHENING hctable // the classifier modules !!!!!! "hctable" contains the pipeline // hashing coefficients and needs to be extended to 2 * WINDOW_LEN // // Generic window length code //#define ARBITRARY_WINDOW_LENGTH // #define MARKOVIAN_WINDOW_LEN 5 // #define OSB_BAYES_WINDOW_LEN 5 // // DO NOT set this to more than 5 without lengthening the // htup1 and htup2 tables in crm_unified_bayes.c // #define UNIFIED_BAYES_WINDOW_LEN 5 // // Unified tokenization pipeline length. // maximum window length _ever_. #define UNIFIED_WINDOW_MAX 32 // // maximum number of iterations or phases of a pipeline, // maximum number of rows in a matrix of coefficients #define UNIFIED_ITERS_MAX 64 // // Now, choose whether we want to use the "old" or the "new" local // probability calculation. The "old" one works slightly better // for SBPH and much better for TSS, the "new" one works slightly // better for TGB and TGB2, and _much_ better for FOO // // The current default (not necessarily optimal) // is Markovian SBPH, STATIC_LOCAL_PROBABILITIES, // LOCAL_PROB_DENOM = 16, and SUPER_MARKOV // //#define LOCAL_PROB_DENOM 2.0 #define LOCAL_PROB_DENOM 16.0 //#define LOCAL_PROB_DENOM 256.0 #define STATIC_LOCAL_PROBABILITIES //#define LENGTHBASED_LOCAL_PROBABILITIES // //#define ENTROPIC_WEIGHTS //#define MARKOV_WEIGHTS #define SUPER_MARKOV_WEIGHTS //#define BREYER_CHHABRA_SIEFKES_WEIGHTS //#define BREYER_CHHABRA_SIEFKES_BASE7_WEIGHTS //#define BCS_MWS_WEIGHTS //#define BCS_EXP_WEIGHTS // // // Do we take only the maximum probability feature? // //#define USE_PEAK // // // Should we use stochastic microgrooming, or weight-distance microgrooming- // Make sure ONE of these is turned on. //#define STOCHASTIC_AMNESIA #define WEIGHT_DISTANCE_AMNESIA #if (! defined (STOCHASTIC_AMNESIA) && ! defined (WEIGHT_DISTANCE_AMNESIA)) #error Neither STOCHASTIC_AMNESIA nor WEIGHT_DISTANCE_AMNESIA defined #elif (defined (STOCHASTIC_AMNESIA) && defined (WEIGHT_DISTANCE_AMNESIA)) #error Both STOCHASTIC_AMNESIA and WEIGHT_DISTANCE_AMNESIA defined #endif // // define the default max chain length in a .css file that triggers // autogrooming, the rescale factor when we rescale, and how often // we rescale, and what chance (mask and key) for any particular // slot to get rescaled when a rescale is triggered for that slot chain. //#define MARKOV_MICROGROOM_CHAIN_LENGTH 1024 #define MARKOV_MICROGROOM_CHAIN_LENGTH 256 //#define MARKOV_MICROGROOM_CHAIN_LENGTH 64 #define MARKOV_MICROGROOM_RESCALE_FACTOR .75 #define MARKOV_MICROGROOM_STOCHASTIC_MASK 0x0000000F #define MARKOV_MICROGROOM_STOCHASTIC_KEY 0x00000001 #define MARKOV_MICROGROOM_STOP_AFTER 32 // maximum number of buckets groom-zeroed // define the default number of buckets in a learning file hash table // (note that this should be a prime number, or at least one with a // lot of big factors) // // this value (2097153) is one more than 2 megs, for a .css of 24 megs //#define DEFAULT_SPARSE_SPECTRUM_FILE_LENGTH 2097153 // // this value (1048577) is one more than a meg, for a .css of 12 megs // for the Markovian, and half that for OSB classifiers #define DEFAULT_SPARSE_SPECTRUM_FILE_LENGTH 1048577 #define DEFAULT_MARKOVIAN_SPARSE_SPECTRUM_FILE_LENGTH 1048577 #define DEFAULT_OSB_BAYES_SPARSE_SPECTRUM_FILE_LENGTH 524287 // Mersenne prime // How big is a feature bucket? Is it a byte, a short, a long, // a float, whatever. :) //#define MARKOV_FEATUREBUCKET_VALUE_MAX 32767 #define MARKOV_FEATUREBUCKET_VALUE_MAX 1000000000 #define MARKOV_FEATUREBUCKET_HISTOGRAM_MAX 4096 // end Markov family config // define default internal debug level #define DEFAULT_INTERNAL_TRACE_LEVEL 0 // define default user debug level #define DEFAULT_USER_TRACE_LEVEL 0 //// // Winnow algorithm parameters here... // #define OSB_WINNOW_WINDOW_LEN 5 #define OSB_WINNOW_PROMOTION 1.23 #define OSB_WINNOW_DEMOTION 0.83 #define DEFAULT_WINNOW_SPARSE_SPECTRUM_FILE_LENGTH 1048577 // For the hyperspace matcher, we need to define a few things. //#define DEFAULT_HYPERSPACE_BUCKETCOUNT 1000000 #define DEFAULT_HYPERSPACE_BUCKETCOUNT 100 // Stuff for bit-entropic configuration // Define the size of our alphabet, and how many bits per alph. #define ENTROPY_ALPHABET_SIZE 2 #define ENTROPY_CHAR_SIZE 1 #define ENTROPY_CHAR_BITMASK 0x1 // What fraction of the nodes in a bit-entropic file should be // referenceable from the FIR prior arithmetical encoding // lookaside table? 0.01 is 1% == average of 100 steps to find // the best node. 0.2 is 20% or 5 steps to find the best node. #define BIT_ENTROPIC_FIR_LOOKASIDE_FRACTION 0.1 #define BIT_ENTROPIC_FIR_LOOKASIDE_STEP_LIMIT 128 #define BIT_ENTROPIC_FIR_PRIOR_BIT_WEIGHT 0.5 #define BIT_ENTROPIC_SHUFFLE_HEIGHT 1024 // was 256 #define BIT_ENTROPIC_SHUFFLE_WIDTH 1024 // was 256 #define BIT_ENTROPIC_PROBABILITY_NERF 0.0000000000000000001 //#define DEFAULT_BIT_ENTROPY_FILE_LENGTH 2000000 #define DEFAULT_BIT_ENTROPY_FILE_LENGTH 1000000 // Defines for the svm classifier // All defines you should want to use without getting into // the nitty details of the SVM are here. For nitty detail // defines, see crm114_matrix_util.h, crm114_svm_quad_prog.h, // crm114_matrix.h, and crm114_svm_lib_fncts.h #define MAX_SVM_FEATURES 100000 //per example #define SVM_INTERNAL_TRACE_LEVEL 3 //the debug level when crm114__internal_trace is //on #define SVM_ACCURACY 1e-3 //The accuracy to which to run the solver //This is the average margin violation NOT //accounted for by the slack variable. #define SV_TOLERANCE 0.01 //An example is a support vector if //theta*y*x <= 1 + SV_TOLERANCE. //The smaller SV_TOLERANCE, the fewer //examples will be tagged as support //vectors. This will make it faster to //learn new examples, but possibly less //accurate. #define SVM_ADD_CONSTANT 1 //Define this to be 1 if you want a //constant offset in the classification //ie h(x) = theta*x + b where b is //the offset. If you don't want //a constant offset (just h(x) = theta*x), //define this to be 0. #define SVM_HOLE_FRAC 0.25 //Size of the "hole" left at the end of //the file to allow for quick appends //without having to forcibly unmap the //file. This is as a fraction of the //size of the file without the hole. So //setting it to 1 doubles the file size. //If you don't want a hole left, set //this to 0. #define SVM_MAX_SOLVER_ITERATIONS 200 //absolute maximum number of loops the //solver is allowed #define SVM_CHECK 100 //every SVM_CHECK we look to see if //the accuracy is better than //SVM_CHECK_FACTOR*SVM_ACCURACY. //If it is, we exit the solver loop. #define SVM_CHECK_FACTOR 2 //every SVM_CHECK we look to see if //the accuracy is better than //SVM_CHECK_FACTOR*SVM_ACCURACY. //If it is, we exit the solver loop. //defines for SVM microgrooming #define SVM_GROOM_OLD 10000 //we groom only if there are this many //examples (or more) not being used in //solving #define SVM_GROOM_FRAC 0.9 //we keep this fraction of examples after //grooming //defines for svm_smart_mode #define SVM_BASE_EXAMPLES 1000 //the number of examples we need to see //before we train #define SVM_INCR_FRAC 0.1 //if more than this fraction of examples //are appended, we do a fromstart rather //than use the incremental method. // Defines for the PCA classifier // All defines you should want to use without getting into // the nitty details of the PCA are here. For nitty detail // defines, see crm114_matrix_util.h and crm114_pca_lib_fncts.h #define PCA_INTERNAL_TRACE_LEVEL 3 //the debug level when crm114__internal_trace is on #define PCA_ACCURACY 1e-8 //accuracy to which to run the solver #define MAX_PCA_ITERATIONS 1000 //maximum number of solver iterations #define PCA_CLASS_MAG 50 //the starting class magnitudes. if this //is too small, the solver will double it //and resolve. if it is too large, the //solver will be less accurate. #define PCA_REDO_FRAC 0.001 //if we get this fraction of training //examples wrong with class mag enabled, we //retrain with class mag doubled. #define PCA_MAX_REDOS 20 //The maximum number of redos allowed when //trying to find the correct class mag. #define PCA_HOLE_FRAC 0.25 //Size of the "hole" left at the end of //the file to allow for quick appends //without having to forcibly unmap the file. //This is as a fraction of the size of the //file without the hole. So setting it to //1 doubles the file size. If you don't //want a hole left, set this to 0. //defines for PCA microgrooming #define PCA_GROOM_OLD 10000 //we groom only if there are this many //examples (or more) present #define PCA_GROOM_FRAC 0.9 //we keep this fraction of examples after //grooming // DANGER DANGER DANGER DANGER DANGER // CHANGE THESE AT YOUR PERIL- YOUR .CSS FILES WILL NOT BE // FORWARD COMPATIBLE WITH ANYONE ELSES IF YOU CHANGE THESE. // how many classes per datablock can the library support? #define CRM114_MAX_CLASSES 128 // FSCM uses two blocks / class #define CRM114_MAX_BLOCKS (2 * CRM114_MAX_CLASSES) // Maximum length of a stored regex (ugly! But we need a max length // in the mapping. GROT GROT GROT ) #define MAX_REGEX 4096 // /// END OF DANGER DANGER DANGER DANGER ///////////////////////////////////////////////////////////////////// //////////////////////////////////////////// // // Improved FSCM-specific parameters // ///////////////////////////////////////////// // this is 2^18 + 1 // This determines the tradeoff in memory vs. speed/accuracy. //define FSCM_DEFAULT_PREFIX_TABLE_CELLS 262145 // // This is 1 meg + 1 #define FSCM_DEFAULT_PREFIX_TABLE_CELLS 1048577 // How long are our prefixes? Original prefix was 3 but that's // rather suboptimal for best speed. 6 looks pretty good for speed and // accuracy. // prefix length 6 and thickness 10 (200 multiplier) yields 29 / 4147 // //#define FSCM_DEFAULT_CODE_PREFIX_LEN 3 #define FSCM_DEFAULT_CODE_PREFIX_LEN 6 // The chain cache is a speedup for the FSCM match // It's indexed modulo the chainstart, with associativity 1.0 #define FSCM_CHAIN_CACHE_SIZE FSCM_DEFAULT_PREFIX_TABLE_CELLS // How much space to start out initially for the forwarding index area #define FSCM_DEFAULT_FORWARD_CHAIN_CELLS 1048577 //////////////////////////////////////////// // // Neural Net parameters // //////////////////////////////////////////// #define NN_RETINA_SIZE 8192 #define NN_FIRST_LAYER_SIZE 8 #define NN_HIDDEN_LAYER_SIZE 8 // Neural Net training setups // // Note- convergence seems to work well at // alpha 0.2 init_noise 0.5 stoch_noise 0.1 gain_noise 0.00000001 // alpha 0.2 init_noise 0.2 stoch_noise 0.1 gain_noise 0.00000001 // alpha 0.2 init_noise 0.2 stoch_noise 0.05 gain_noise 0.00000001 // alpha 0.2 init_noise 0.2 stoch_noise 0.05 gain_noise 0.00000001 // alpha 0.2 init_noise 0.2 stoch_noise 0.05 gain_noise 2.0 // alpha 0.2 init_noise 0.2 stoch_noise 0.05 gain_noise 2.0 zerotr 0.9999 #define NN_DEFAULT_ALPHA 0.2 // Initialization noise magnitude #define NN_INITIALIZATION_NOISE_MAGNITUDE 0.2 // Stochastic noise magnitude #define NN_DEFAULT_STOCH_NOISE 0.05 // Gain noise magnitude #define NN_DEFAULT_GAIN_NOISE 2.0 // Zero-tracking factor - factor the weights move toward zero every epoch #define NN_ZERO_TRACKING 0.9999 // Threshold for back propagation #define NN_INTERNAL_TRAINING_THRESHOLD 0.1 // Just use 1 neuron excitation per token coming in. #define NN_N_PUMPS 1 // How many training cycles before we punt out #define NN_MAX_TRAINING_CYCLES 500 // When doing a "nuke and retry", allow this many training cycles. #define NN_MAX_TRAINING_CYCLES_FROMSTART 5000 // How often do we cause a punt (we punt every 0th epoch modulo this number) #define NN_FROMSTART_PUNTING 10000000 // After how many "not needed" cycles do we microgroom this doc away? #define NN_MICROGROOM_THRESHOLD 1000000 // use the sparse retina design? No, it's not good. #define NN_SPARSE_RETINA 0 // End of configurable parameters. #endif // !__CRM114_CONFIG_H__
Java
using MortgageCalc.Models; using System; using System.Collections.Generic; namespace MortgageCalc.Calculators { public class InterestOnlyScheduleBuilder { private RateCalc _calc = new RateCalc(6); // initialize with 6 decimal places private decimal _monthlyPayment; private decimal _principal; private decimal _rate; private int _term; public InterestOnlyScheduleBuilder(decimal principal, decimal rate, int term) { this._principal = principal; this._rate = rate; this._term = term; this._monthlyPayment = this._calc.Interest(principal, rate); } public Schedule Schedule() { return new Schedule { MonthlyPayment = Math.Round(this._monthlyPayment, 2), CostOfCredit = Math.Round(this._monthlyPayment * this._term, 2) }; } } }
Java
<!doctype html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> <title>grapp-core-ajax tests</title> <script src="../lib/web-component-tester/browser.js"></script> </head> <body> <script> WCT.loadSuites([ 'basic.html', ]); </script> <script src="//localhost:35729/livereload.js"></script> </body> </html>
Java
import Ember from 'ember'; import CheckboxMixin from '../mixins/checkbox-mixin'; export default Ember.Component.extend(CheckboxMixin, { type: 'checkbox', checked: false, onChange: function() { this.set('checked', this.$('input').prop('checked')); this.sendAction("action", { checked: this.get('checked'), value: this.get('value') }); } });
Java
@ParametersAreNonnullByDefault package org.zalando.problem.spring.web.advice; import javax.annotation.ParametersAreNonnullByDefault;
Java