code
stringlengths
5
1.01M
repo_name
stringlengths
5
84
path
stringlengths
4
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
5
1.01M
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
import time import pytest import logging from repair_tests.repair_test import BaseRepairTest since = pytest.mark.since logger = logging.getLogger(__name__) LEGACY_SSTABLES_JVM_ARGS = ["-Dcassandra.streamdes.initial_mem_buffer_size=1", "-Dcassandra.streamdes.max_mem_buffer_size=5", "-Dcassandra.streamdes.max_spill_file_size=16"] # We don't support directly upgrading from 2.2 to 4.0 so disabling this on 4.0. # TODO: we should probably not hardcode versions? @pytest.mark.upgrade_test @since('3.0', max_version='3.99') class TestUpgradeRepair(BaseRepairTest): @since('3.0', max_version='3.99') def test_repair_after_upgrade(self): """ @jira_ticket CASSANDRA-10990 """ default_install_dir = self.cluster.get_install_dir() cluster = self.cluster logger.debug("Setting version to 2.2.5") cluster.set_install_dir(version="2.2.5") self._populate_cluster() self._do_upgrade(default_install_dir) self._repair_and_verify(True) def _do_upgrade(self, default_install_dir): cluster = self.cluster for node in cluster.nodelist(): logger.debug("Upgrading %s to current version" % node.name) if node.is_running(): node.flush() time.sleep(1) node.stop(wait_other_notice=True) node.set_install_dir(install_dir=default_install_dir) node.start(wait_other_notice=True, wait_for_binary_proto=True) cursor = self.patient_cql_connection(node) cluster.set_install_dir(default_install_dir)
aweisberg/cassandra-dtest
upgrade_tests/repair_test.py
Python
apache-2.0
1,656
[ 30522, 12324, 2051, 12324, 1052, 17250, 3367, 12324, 15899, 2013, 7192, 1035, 5852, 1012, 7192, 1035, 3231, 12324, 2918, 2890, 4502, 4313, 22199, 2144, 1027, 1052, 17250, 3367, 1012, 2928, 1012, 2144, 8833, 4590, 1027, 15899, 1012, 2131, 21...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# 关于微信公众号运营 ## 目标 推进 Go 在国内的发展,将 GCTT 翻译的文章让更多人看到,同时增强 Go 中文网的知名度。 ## 发布内容 公众号:Go 语言中文网 是一个订阅号,每天可以发布一篇消息。主要发布 GCTT 的译文,目前从 https://studygolang.com/subject/1 获取文章,发布顺序按照从旧到新,避免发重复。后续看情况可以一次发多篇图文。 因为涉及到排版问题,而 GCTT 的原始译文都是 Markdown 格式,所以,推荐大家使用 https://mdnice.com/ 排版公众号文章,之后复制粘贴到公众号中。 说一下我的发布流程: 1. 确定这次需要发布的文章:查看上次发布的是哪篇,然后确定这次应该发布哪篇,记得一定从后往前选择,避免发重复; 2. 因为 studygolang.com 上面看到的是解析为 html 了的,为了方便处理,在 https://github.com/studygolang/GCTT/tree/master/published/tech 中找到原始 markdown 格式文章。(这块我考虑下怎么更方便的找到原始 markdown 文章); 3. 微信中,~~标题以 `GCTT 出品 |` 开始(当然得是 GCTT 的文章),接上网站上发布时的文章标题,比如:`GCTT 出品 | 测试 Go 语言 Web 应用`~~;标题启动吸引阅读的重要因素,因此建议取一个有吸引力的标题,可以参考这两篇文章:[5大套路让你轻松写出爆款标题! ](https://www.jianshu.com/p/4d8ee322c91a)、[连载九:5大爆款标题套路,让你头条文章每篇100000+](https://www.jianshu.com/p/9decf3a59cab) 4. 复制原始 markdown 文章,粘贴到 https://mdnice.com/;会提示微信链接,点击确认即可,链接会在底部引用的方式显示; 5. ~~推荐显示代码行号,~~代码主题推荐 monokai,主题选择**橙心**;确认无误后,点击复制,粘贴到微信公众号中; 6. 文章最后勾上 ”原始链接“,把在 studygolang.com 上文章对应的链接放上(可以一定程度为主站导流); 7. 点击原创声明(对于 GCTT 译文,都可以加上原创声明),文章类别选择:科技互联网;开启打赏,搜索:Go中文网 8. 设置封面:文章有图片,可以选择文中的图片做封面,没有的话,可以从图库中选择一张; 9. 复制文章开始的一些文本当做摘要; 10. 按照 https://mp.weixin.qq.com/s/hJ7YywSN8ideMiEteCsKEw 样子,在正文头尾加上关注公众号的文字和图片; 11. 保存,可以预览看看。没问题,保存并群发。 ## 发布时间 时间一般在早上 8 点 到 10 点。可以头天晚上编辑好,第二天定时发布。 ## 发布完后 可以转发朋友圈、微信群、qq 群,做推广。 ## 目前参与人员 微信公众号发文安排: - 周一:黄秀娇 - 周二:雷发强 - 周三:胡松贵 - 周四:李川 - 周五:谢春辉 - 周六:孟跃平 - 周日:徐新华
studygolang/studygolang
docs/wechat.md
Markdown
bsd-3-clause
2,962
[ 30522, 1001, 100, 100, 100, 1767, 1772, 100, 100, 100, 100, 1001, 1001, 1918, 100, 100, 100, 2175, 100, 1799, 1773, 1916, 100, 100, 1989, 100, 1043, 6593, 2102, 100, 100, 1916, 1861, 1932, 100, 100, 100, 1756, 100, 100, 1989, 1794, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
(function() { var Application, PubSub, Request, Router, Spineless; Application = (function() { function Application() { return { controllers: {}, helpers: { _default: function(locals) { return $.extend(true, {}, locals); } } }; } return Application; })(); Request = (function() { function Request(controller, action, params) { var p; p = params != null ? params : {}; return { controller: $(".controller[data-controller=" + controller + "]"), view: $(".controller[data-controller=" + controller + "] .view[data-action=" + action + "]"), params: $.extend(true, p, { controller: controller, action: action }) }; } return Request; })(); Router = (function() { function Router() { return { parseRoute: function(route) { var hsh, str; str = route + ""; hsh = $.extend(true, {}, { controller: 'application', action: 'index' }); while (str.charAt(0) === '/') { str = str.substr(1); } if (str.length > 0) { $.each(str.split('/'), function(i, e) { if (i === 0) { hsh.controller = e; } if (i === 1) { return hsh.action = e; } }); } return hsh; }, route: function(element) { var route, url; url = element.attr('href') || $(element).attr('data-href'); route = this.parseRoute(url); return this.get(route.controller, route.action, route.params); } }; } return Router; })(); PubSub = (function() { function PubSub() { var o; o = $({}); return { subscribe: function() { return o.on.apply(o, arguments); }, unsubscribe: function() { return o.off.apply(o, arguments); }, publish: function() { return o.trigger.apply(o, arguments); } }; } return PubSub; })(); Spineless = (function() { function Spineless(options) { var controllerActionAvailable, get, init, parseLocals, postRender, prepareRender, render, renderTemplate, root, templates; root = this; templates = function(method, locals) { if (root.app.helpers.hasOwnProperty(method)) { return root.app.helpers[method].apply(root.app, [locals]); } else { return root.app.helpers._default(locals); } }; parseLocals = function(view) { var locals; locals = $(view).attr('data-locals'); if (locals != null) { return $.parseJSON(locals); } else { return {}; } }; prepareRender = function() { if (root.request.controller && root.request.view) { $('.view.active').removeClass('active'); $('.controller.active').removeClass('active'); root.request.view.addClass('active'); root.request.controller.addClass("active"); return root.request.view.find("*[data-template]"); } return []; }; renderTemplate = function(view) { var locals, name, template; name = $(view).attr('data-template'); if (name != null) { locals = parseLocals($(view)); template = $('.templates *[data-template-name=' + name + ']').html(); return view.html($.mustache(template, templates(name, locals))); } }; render = function(elements) { return $.each(elements, function(i, e) { return renderTemplate($(e)); }); }; controllerActionAvailable = function() { return root.app.controllers.hasOwnProperty(root.request.params.controller) && root.app.controllers[root.request.params.controller].hasOwnProperty(root.request.params.action); }; postRender = function() { $('body').attr('data-controller', root.request.params.controller); $('body').attr('data-action', root.request.params.action); $('body').addClass('rendered'); return root.app.publish("afterRender", root.app); }; get = function(controller, action, params) { var itemsToRender; root.request = new Request(controller, action, params); root.app.request = root.request; $('body').removeClass('rendered'); $('html,body').animate({ scrollTop: 0 }, 1); itemsToRender = prepareRender(); if (controllerActionAvailable()) { root.app.controllers[root.request.params.controller][root.request.params.action].apply(root.app, [itemsToRender, root.request]); } else { render(itemsToRender); } return postRender(); }; init = function(options) { $(document).on('click', '.route', function(event) { event.preventDefault(); return root.app.route($(this)); }); return $.extend(true, root.app, options); }; this.app = new Application(); $.extend(true, this.app, new Router()); $.extend(true, this.app, new PubSub()); this.app.get = get; this.app.render = render; init(options); return this.app; } return Spineless; })(); $.spineless = function(options) { return new Spineless(options); }; }).call(this);
heavysixer/spineless
spineless.js
JavaScript
mit
5,542
[ 30522, 1006, 3853, 1006, 1007, 1063, 13075, 4646, 1010, 23598, 12083, 1010, 5227, 1010, 2799, 2099, 1010, 8560, 3238, 1025, 4646, 1027, 1006, 3853, 1006, 1007, 1063, 3853, 4646, 1006, 1007, 1063, 2709, 1063, 21257, 1024, 1063, 1065, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Sunlite.cpp * The synchronous and asynchronous Sunlite widgets. * Copyright (C) 2014 Simon Newton */ #include "plugins/usbdmx/Sunlite.h" #include <string.h> #include "ola/Constants.h" #include "ola/Logging.h" #include "plugins/usbdmx/AsyncUsbSender.h" #include "plugins/usbdmx/LibUsbAdaptor.h" #include "plugins/usbdmx/ThreadedUsbSender.h" namespace ola { namespace plugin { namespace usbdmx { namespace { static const unsigned int CHUNKS_PER_PACKET = 26; static const unsigned int CHANNELS_PER_CHUNK = 20; static const unsigned int CHUNK_SIZE = 32; static const uint8_t ENDPOINT = 1; static const unsigned int TIMEOUT = 50; // 50ms is ok enum {SUNLITE_PACKET_SIZE = 0x340}; /* * Initialize a USBDMX2 packet */ void InitPacket(uint8_t packet[SUNLITE_PACKET_SIZE]) { memset(packet, 0, SUNLITE_PACKET_SIZE); // The packet is divided into 26 chunks of 32 bytes each. Each chunk contains // the data for 20 channels (except the last one which has 12 channels of // data). for (unsigned int chunk = 0; chunk < CHUNKS_PER_PACKET; ++chunk) { unsigned int i = chunk * CHUNK_SIZE; // index into the packet unsigned int channel = chunk * CHANNELS_PER_CHUNK; packet[i] = 0x80; packet[i + 1] = channel / 2; packet[i + 2] = 0x84; packet[i + 7] = channel / 2 + 2; packet[i + 8] = 0x84; packet[i + 13] = channel / 2 + 4; if (chunk < CHUNKS_PER_PACKET - 1) { packet[i + 14] = 0x84; packet[i + 19] = channel / 2 + 6; packet[i + 20] = 0x84; packet[i + 25] = channel / 2 + 8; packet[i + 26] = 0x04; packet[i + 31] = 0x00; } else { // the last chunk is short packet[i + 14] = 0x04; } } } /* * Update a USBDMX2 packet to match the supplied DmxBuffer. */ void UpdatePacket(const DmxBuffer &buffer, uint8_t packet[SUNLITE_PACKET_SIZE]) { for (unsigned int i = 0; i < buffer.Size(); i++) { int index = ((i / CHANNELS_PER_CHUNK) * CHUNK_SIZE) + (((i / 4) % 5) * 6) + 3 + (i % 4); packet[index] = buffer.Get(i); } } } // namespace // SunliteThreadedSender // ----------------------------------------------------------------------------- /* * Sends messages to a Sunlite device in a separate thread. */ class SunliteThreadedSender: public ThreadedUsbSender { public: SunliteThreadedSender(LibUsbAdaptor *adaptor, libusb_device *usb_device, libusb_device_handle *handle); private: LibUsbAdaptor* const m_adaptor; uint8_t m_packet[SUNLITE_PACKET_SIZE]; bool TransmitBuffer(libusb_device_handle *handle, const DmxBuffer &buffer); }; SunliteThreadedSender::SunliteThreadedSender( LibUsbAdaptor *adaptor, libusb_device *usb_device, libusb_device_handle *usb_handle) : ThreadedUsbSender(usb_device, usb_handle), m_adaptor(adaptor) { InitPacket(m_packet); } bool SunliteThreadedSender::TransmitBuffer(libusb_device_handle *handle, const DmxBuffer &buffer) { UpdatePacket(buffer, m_packet); int transferred; int r = m_adaptor->BulkTransfer(handle, ENDPOINT, (unsigned char*) m_packet, SUNLITE_PACKET_SIZE, &transferred, TIMEOUT); if (transferred != SUNLITE_PACKET_SIZE) { // not sure if this is fatal or not OLA_WARN << "Sunlite driver failed to transfer all data"; } return r == 0; } // SynchronousSunlite // ----------------------------------------------------------------------------- SynchronousSunlite::SynchronousSunlite(LibUsbAdaptor *adaptor, libusb_device *usb_device) : Sunlite(adaptor), m_usb_device(usb_device) { } bool SynchronousSunlite::Init() { libusb_device_handle *usb_handle; bool ok = m_adaptor->OpenDeviceAndClaimInterface( m_usb_device, 0, &usb_handle); if (!ok) { return false; } std::auto_ptr<SunliteThreadedSender> sender( new SunliteThreadedSender(m_adaptor, m_usb_device, usb_handle)); if (!sender->Start()) { return false; } m_sender.reset(sender.release()); return true; } bool SynchronousSunlite::SendDMX(const DmxBuffer &buffer) { return m_sender.get() ? m_sender->SendDMX(buffer) : false; } // SunliteAsyncUsbSender // ----------------------------------------------------------------------------- class SunliteAsyncUsbSender : public AsyncUsbSender { public: SunliteAsyncUsbSender(LibUsbAdaptor *adaptor, libusb_device *usb_device) : AsyncUsbSender(adaptor, usb_device) { InitPacket(m_packet); } ~SunliteAsyncUsbSender() { CancelTransfer(); } libusb_device_handle* SetupHandle() { libusb_device_handle *usb_handle; bool ok = m_adaptor->OpenDeviceAndClaimInterface( m_usb_device, 0, &usb_handle); return ok ? usb_handle : NULL; } bool PerformTransfer(const DmxBuffer &buffer) { UpdatePacket(buffer, m_packet); FillBulkTransfer(ENDPOINT, m_packet, SUNLITE_PACKET_SIZE, TIMEOUT); return (SubmitTransfer() == 0); } private: uint8_t m_packet[SUNLITE_PACKET_SIZE]; DISALLOW_COPY_AND_ASSIGN(SunliteAsyncUsbSender); }; // AsynchronousSunlite // ----------------------------------------------------------------------------- AsynchronousSunlite::AsynchronousSunlite( LibUsbAdaptor *adaptor, libusb_device *usb_device) : Sunlite(adaptor) { m_sender.reset(new SunliteAsyncUsbSender(m_adaptor, usb_device)); } bool AsynchronousSunlite::Init() { return m_sender->Init(); } bool AsynchronousSunlite::SendDMX(const DmxBuffer &buffer) { return m_sender->SendDMX(buffer); } } // namespace usbdmx } // namespace plugin } // namespace ola
nightrune/ola
plugins/usbdmx/Sunlite.cpp
C++
lgpl-2.1
6,460
[ 30522, 1013, 1008, 1008, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19933, 1008, 2009, 2104, 1996, 3408, 1997, 1996, 27004, 2236, 2270, 6105, 2004, 2405, 2011, 1008, 1996, 2489, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# AUTOGENERATED FILE FROM balenalib/vab820-quad-fedora:33-run # http://bugs.python.org/issue19846 # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 RUN dnf install -y \ python3-pip \ python3-dbus \ && dnf clean all # install "virtualenv", since the vast majority of users of this image will want it RUN pip3 install -U --no-cache-dir --ignore-installed pip setuptools \ && pip3 install --no-cache-dir virtualenv RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'As of January 1st, 2020, Python 2 was end-of-life, we will change the latest tag for Balenalib Python base image to Python 3.x and drop support for Python 2 soon. So after 1st July, 2020, all the balenalib Python latest tag will point to the latest Python 3 version and no changes, or fixes will be made to balenalib Python 2 base image. If you are using Python 2 for your application, please upgrade to Python 3 before 1st July.' > /.balena/messages/python-deprecation-warnin CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \ && echo "Running test-stack@python" \ && chmod +x test-stack@python.sh \ && bash test-stack@python.sh \ && rm -rf test-stack@python.sh RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Fedora 33 \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.9.7, Pip v21.2.4, Setuptools v58.0.0 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo $'#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
resin-io-library/base-images
balena-base-images/python/vab820-quad/fedora/33/3.9.7/run/Dockerfile
Dockerfile
apache-2.0
2,433
[ 30522, 1001, 8285, 6914, 16848, 5371, 2013, 28352, 8189, 29521, 1013, 12436, 2497, 2620, 11387, 1011, 17718, 1011, 7349, 6525, 1024, 3943, 1011, 2448, 1001, 8299, 1024, 1013, 1013, 12883, 1012, 18750, 1012, 8917, 1013, 3277, 16147, 2620, 21...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * grunt/pipeline.js * * The order in which your css, javascript, and template files should be * compiled and linked from your views and static HTML files. * * (Note that you can take advantage of Grunt-style wildcard/glob/splat expressions * for matching multiple files, and the ! prefix for excluding files.) */ // Path to public folder var tmpPath = '.tmp/public/'; // CSS files to inject in order // // (if you're using LESS with the built-in default config, you'll want // to change `assets/styles/importer.less` instead.) var cssFilesToInject = [ 'styles/bootstrap.min.css', 'styles/bootstrap-theme.css' ]; // Client-side javascript files to inject in order // (uses Grunt-style wildcard/glob/splat expressions) var jsFilesToInject = [ // Load sails.io before everything else 'js/dependencies/sails.io.js', 'js/dependencies/angular.js', 'js/dependencies/angular-translate.min.js', 'js/dependencies/jquery.min.js', 'js/dependencies/bootstrap.min.js', 'js/dependencies/ui-bootstrap.min.js', 'js/dependencies/ui-bootstrap-tpls.min.js', 'js/dependencies/angular-translate.min.js', 'js/dependencies/smart-table.min.js', 'js/app.js' // Dependencies like jQuery, or Angular are brought in here // All of the rest of your client-side js files // will be injected here in no particular order. // Use the "exclude" operator to ignore files // '!js/ignore/these/files/*.js' ]; // Client-side HTML templates are injected using the sources below // The ordering of these templates shouldn't matter. // (uses Grunt-style wildcard/glob/splat expressions) // // By default, Sails uses JST templates and precompiles them into // functions for you. If you want to use jade, handlebars, dust, etc., // with the linker, no problem-- you'll just want to make sure the precompiled // templates get spit out to the same file. Be sure and check out `tasks/README.md` // for information on customizing and installing new tasks. var templateFilesToInject = [ 'templates/**/*.html' ]; // Prefix relative paths to source files so they point to the proper locations // (i.e. where the other Grunt tasks spit them out, or in some cases, where // they reside in the first place) module.exports.cssFilesToInject = cssFilesToInject.map(transformPath); module.exports.jsFilesToInject = jsFilesToInject.map(transformPath); module.exports.templateFilesToInject = templateFilesToInject.map(transformPath); // Transform paths relative to the "assets" folder to be relative to the public // folder, preserving "exclude" operators. function transformPath(path) { return (path.substring(0,1) == '!') ? ('!' + tmpPath + path.substring(1)) : (tmpPath + path); }
libteiwm/FedShare
tasks/pipeline.js
JavaScript
gpl-2.0
2,692
[ 30522, 1013, 1008, 1008, 1008, 20696, 1013, 13117, 1012, 1046, 2015, 1008, 1008, 1996, 2344, 1999, 2029, 2115, 20116, 2015, 1010, 9262, 22483, 1010, 1998, 23561, 6764, 2323, 2022, 1008, 9227, 1998, 5799, 2013, 2115, 5328, 1998, 10763, 16129...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #ifndef RUBBERBANDSELECTIONMANIPULATOR_H #define RUBBERBANDSELECTIONMANIPULATOR_H #include "liveselectionrectangle.h" #include <QPointF> QT_FORWARD_DECLARE_CLASS(QGraphicsItem) namespace QmlJSDebugger { class QDeclarativeViewInspector; class LiveRubberBandSelectionManipulator { public: enum SelectionType { ReplaceSelection, AddToSelection, RemoveFromSelection }; LiveRubberBandSelectionManipulator(QGraphicsObject *layerItem, QDeclarativeViewInspector *editorView); void setItems(const QList<QGraphicsItem*> &itemList); void begin(const QPointF& beginPoint); void update(const QPointF& updatePoint); void end(); void clear(); void select(SelectionType selectionType); QPointF beginPoint() const; bool isActive() const; protected: QGraphicsItem *topFormEditorItem(const QList<QGraphicsItem*> &itemList); private: QList<QGraphicsItem*> m_itemList; QList<QGraphicsItem*> m_oldSelectionList; LiveSelectionRectangle m_selectionRectangleElement; QPointF m_beginPoint; QDeclarativeViewInspector *m_editorView; QGraphicsItem *m_beginFormEditorItem; bool m_isActive; }; } #endif // RUBBERBANDSELECTIONMANIPULATOR_H
forio/julia-studio
share/julia-studio/qml/qmljsdebugger/editor/liverubberbandselectionmanipulator.h
C
gpl-3.0
2,719
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package org.emdev.ui.uimanager; import android.annotation.TargetApi; import android.app.Activity; import android.app.ActivityManager; import android.app.ActivityManager.RunningServiceInfo; import android.content.ComponentName; import android.content.Context; import android.view.View; import android.view.Window; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.StringWriter; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; import org.emdev.BaseDroidApp; @TargetApi(11) public class UIManager3x implements IUIManager { private static final String SYS_UI_CLS = "com.android.systemui.SystemUIService"; private static final String SYS_UI_PKG = "com.android.systemui"; private static final ComponentName SYS_UI = new ComponentName(SYS_UI_PKG, SYS_UI_CLS); private static final String SU_PATH1 = "/system/bin/su"; private static final String SU_PATH2 = "/system/xbin/su"; private static final String AM_PATH = "/system/bin/am"; private static final Map<ComponentName, Data> data = new HashMap<ComponentName, Data>() { /** * */ private static final long serialVersionUID = -6627308913610357179L; @Override public Data get(final Object key) { Data existing = super.get(key); if (existing == null) { existing = new Data(); put((ComponentName) key, existing); } return existing; } }; @Override public void setTitleVisible(final Activity activity, final boolean visible, final boolean firstTime) { if (firstTime) { try { final Window window = activity.getWindow(); window.requestFeature(Window.FEATURE_ACTION_BAR); window.requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS); activity.setProgressBarIndeterminate(true); activity.setProgressBarIndeterminateVisibility(true); window.setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS, 1); } catch (final Throwable th) { LCTX.e("Error on requestFeature call: " + th.getMessage()); } } try { if (visible) { activity.getActionBar().show(); } else { activity.getActionBar().hide(); } data.get(activity.getComponentName()).titleVisible = visible; } catch (final Throwable th) { LCTX.e("Error on requestFeature call: " + th.getMessage()); } } @Override public boolean isTitleVisible(final Activity activity) { return data.get(activity.getComponentName()).titleVisible; } @Override public void setProgressSpinnerVisible(Activity activity, boolean visible) { activity.setProgressBarIndeterminateVisibility(visible); activity.getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS, visible ? 1 : 0); } @Override public void setFullScreenMode(final Activity activity, final View view, final boolean fullScreen) { data.get(activity.getComponentName()).fullScreen = fullScreen; if (fullScreen) { stopSystemUI(activity); } else { startSystemUI(activity); } } @Override public void openOptionsMenu(final Activity activity, final View view) { activity.openOptionsMenu(); } @Override public void invalidateOptionsMenu(final Activity activity) { activity.invalidateOptionsMenu(); } @Override public void onMenuOpened(final Activity activity) { if (data.get(activity.getComponentName()).fullScreen && data.get(activity.getComponentName()).fullScreenState.get()) { startSystemUI(activity); } } @Override public void onMenuClosed(final Activity activity) { if (data.get(activity.getComponentName()).fullScreen && !data.get(activity.getComponentName()).fullScreenState.get()) { stopSystemUI(activity); } } @Override public void onPause(final Activity activity) { if (data.get(activity.getComponentName()).fullScreen && data.get(activity.getComponentName()).fullScreenState.get()) { startSystemUI(activity); } } @Override public void onResume(final Activity activity) { if (data.get(activity.getComponentName()).fullScreen && !data.get(activity.getComponentName()).fullScreenState.get()) { stopSystemUI(activity); } } @Override public void onDestroy(final Activity activity) { if (data.get(activity.getComponentName()).fullScreen && data.get(activity.getComponentName()).fullScreenState.get()) { startSystemUI(activity); } } @Override public boolean isTabletUi(final Activity activity) { return true; } protected void startSystemUI(final Activity activity) { if (isSystemUIRunning()) { data.get(activity.getComponentName()).fullScreenState.set(false); return; } exec(false, activity, AM_PATH, "startservice", "-n", SYS_UI.flattenToString()); } protected void stopSystemUI(final Activity activity) { if (!isSystemUIRunning()) { data.get(activity.getComponentName()).fullScreenState.set(true); return; } final String su = getSuPath(); if (su == null) { data.get(activity.getComponentName()).fullScreenState.set(false); return; } exec(true, activity, su, "-c", "service call activity 79 s16 " + SYS_UI_PKG); } protected boolean isSystemUIRunning() { final Context ctx = BaseDroidApp.context; final ActivityManager am = (ActivityManager) ctx.getSystemService(Context.ACTIVITY_SERVICE); final List<RunningServiceInfo> rsiList = am.getRunningServices(1000); for (final RunningServiceInfo rsi : rsiList) { LCTX.d("Service: " + rsi.service); if (SYS_UI.equals(rsi.service)) { LCTX.e("System UI service found"); return true; } } return false; } protected void exec(final boolean expected, final Activity activity, final String... as) { (new Thread(new Runnable() { @Override public void run() { try { final boolean result = execImpl(as); data.get(activity.getComponentName()).fullScreenState.set(result ? expected : !expected); } catch (final Throwable th) { LCTX.e("Changing full screen mode failed: " + th.getCause()); data.get(activity.getComponentName()).fullScreenState.set(!expected); } } })).start(); } private boolean execImpl(final String... as) { try { LCTX.d("Execute: " + Arrays.toString(as)); final Process process = Runtime.getRuntime().exec(as); final InputStreamReader r = new InputStreamReader(process.getInputStream()); final StringWriter w = new StringWriter(); final char ac[] = new char[8192]; int i = 0; do { i = r.read(ac); if (i > 0) { w.write(ac, 0, i); } } while (i != -1); r.close(); process.waitFor(); final int exitValue = process.exitValue(); final String text = w.toString(); LCTX.d("Result code: " + exitValue); LCTX.d("Output:\n" + text); return 0 == exitValue; } catch (final IOException e) { throw new IllegalStateException(e); } catch (final InterruptedException e) { throw new IllegalStateException(e); } } private static String getSuPath() { final File su1 = new File(SU_PATH1); if (su1.exists() && su1.isFile() && su1.canExecute()) { return SU_PATH1; } final File su2 = new File(SU_PATH2); if (su2.exists() && su2.isFile() && su2.canExecute()) { return SU_PATH2; } return null; } private static class Data { boolean fullScreen = false; boolean titleVisible = true; final AtomicBoolean fullScreenState = new AtomicBoolean(); } }
bonisamber/bookreader
Application/src/main/java/org/emdev/ui/uimanager/UIManager3x.java
Java
gpl-3.0
8,692
[ 30522, 7427, 8917, 1012, 7861, 24844, 1012, 21318, 1012, 21318, 24805, 4590, 1025, 12324, 11924, 1012, 5754, 17287, 3508, 1012, 4539, 9331, 2072, 1025, 12324, 11924, 1012, 10439, 1012, 4023, 1025, 12324, 11924, 1012, 10439, 1012, 4023, 24805,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# RoomManagerAutomation This is a project to automate Room Manager App, developed by Team 2 of QADEV-04, using Selenium, java, Cucumber-JVM for validate with MongoDB to Data Base and rest-assured to API.
PenielDVP/RoomManagerAutomation
README.md
Markdown
mit
204
[ 30522, 1001, 2282, 24805, 4590, 4887, 20389, 3370, 2023, 2003, 1037, 2622, 2000, 8285, 8585, 2282, 3208, 10439, 1010, 2764, 2011, 2136, 1016, 1997, 1053, 9648, 2615, 1011, 5840, 1010, 2478, 7367, 7770, 5007, 1010, 9262, 1010, 12731, 24894, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import os import unittest from vsg.rules import package from vsg import vhdlFile from vsg.tests import utils sTestDir = os.path.dirname(__file__) lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_001_test_input.vhd')) dIndentMap = utils.read_indent_file() lExpected = [] lExpected.append('') utils.read_file(os.path.join(sTestDir, 'rule_001_test_input.fixed.vhd'), lExpected) class test_package_rule(unittest.TestCase): def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError) self.oFile.set_indent_map(dIndentMap) def test_rule_001(self): oRule = package.rule_001() self.assertTrue(oRule) self.assertEqual(oRule.name, 'package') self.assertEqual(oRule.identifier, '001') lExpected = [6] oRule.analyze(self.oFile) self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations)) def test_fix_rule_001(self): oRule = package.rule_001() oRule.fix(self.oFile) lActual = self.oFile.get_lines() self.assertEqual(lExpected, lActual) oRule.analyze(self.oFile) self.assertEqual(oRule.violations, [])
jeremiah-c-leary/vhdl-style-guide
vsg/tests/package/test_rule_001.py
Python
gpl-3.0
1,229
[ 30522, 12324, 9808, 12324, 3131, 22199, 2013, 5443, 2290, 1012, 3513, 12324, 7427, 2013, 5443, 2290, 12324, 1058, 14945, 10270, 9463, 2013, 5443, 2290, 1012, 5852, 12324, 21183, 12146, 26261, 3367, 4305, 2099, 1027, 9808, 1012, 4130, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package it.giuggi.iotremote.ui.adapter; /** * Created by Federico Giuggioloni on 05/05/16. * Se aggiungo questa riga magari * AndroidStudio smette di lamentarsi... */ public class DrawerItem { protected String name; public DrawerItem(String name) { this.name = name; } }
LuigiPower/iotremote
app/src/main/java/it/giuggi/iotremote/ui/adapter/DrawerItem.java
Java
mit
301
[ 30522, 7427, 2009, 1012, 21025, 15916, 5856, 1012, 22834, 7913, 18938, 2063, 1012, 21318, 1012, 15581, 2121, 1025, 1013, 1008, 1008, 1008, 2580, 2011, 20493, 21025, 15916, 11411, 7811, 2072, 2006, 5709, 1013, 5709, 1013, 2385, 1012, 1008, 7...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# ------------------------------------------------------------------ # Logs CGI script makefile # ------------------------------------------------------------------ # Author: nlv10677 # Copyright: NXP B.V. 2014. All rights reserved # ------------------------------------------------------------------ TARGET = iot_logs.cgi INCLUDES = -I../../../IotCommon OBJECTS = cgi_logs.o \ ../../../IotCommon/atoi.o \ ../../../IotCommon/gateway.o \ ../../../IotCommon/iotSemaphore.o \ ../../../IotCommon/newLog.o %.o: %.c $(HEADERS) $(CC) $(CFLAGS) $(INCLUDES) -Wall -g -c $< -o $@ all: clean build build: $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $(TARGET) -lc cp $(TARGET) ../../../swupdate/images/www/cgi-bin clean: -rm -f $(OBJECTS) -rm -f $(TARGET) -rm -f ../../../swupdate/images/www/cgi-bin/$(TARGET)
taidalab/openwrt_widora
package/iot_gw_nxp/src/www/cgi-bin/logs/Makefile
Makefile
gpl-2.0
869
[ 30522, 1001, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#include <linux/init.h> #include <linux/kthread.h> #include <linux/hrtimer.h> #include <linux/fs.h> #include <linux/debugfs.h> #include <linux/export.h> #include <linux/spinlock.h> static int ss_get(void *data, u64 *val) { ktime_t start, finish; int loops; int cont; DEFINE_RAW_SPINLOCK(ss_spin); loops = 1000000; cont = 1; start = ktime_get(); while (cont) { raw_spin_lock(&ss_spin); loops--; if (loops == 0) cont = 0; raw_spin_unlock(&ss_spin); } finish = ktime_get(); *val = ktime_us_delta(finish, start); return 0; } DEFINE_SIMPLE_ATTRIBUTE(fops_ss, ss_get, NULL, "%llu\n"); struct spin_multi_state { raw_spinlock_t lock; atomic_t start_wait; atomic_t enter_wait; atomic_t exit_wait; int loops; }; struct spin_multi_per_thread { struct spin_multi_state *state; ktime_t start; }; static int multi_other(void *data) { int loops; int cont; struct spin_multi_per_thread *pt = data; struct spin_multi_state *s = pt->state; loops = s->loops; cont = 1; atomic_dec(&s->enter_wait); while (atomic_read(&s->enter_wait)) ; /* spin */ pt->start = ktime_get(); atomic_dec(&s->start_wait); while (atomic_read(&s->start_wait)) ; /* spin */ while (cont) { raw_spin_lock(&s->lock); loops--; if (loops == 0) cont = 0; raw_spin_unlock(&s->lock); } atomic_dec(&s->exit_wait); while (atomic_read(&s->exit_wait)) ; /* spin */ return 0; } static int multi_get(void *data, u64 *val) { ktime_t finish; struct spin_multi_state ms; struct spin_multi_per_thread t1, t2; ms.lock = __RAW_SPIN_LOCK_UNLOCKED("multi_get"); ms.loops = 1000000; atomic_set(&ms.start_wait, 2); atomic_set(&ms.enter_wait, 2); atomic_set(&ms.exit_wait, 2); t1.state = &ms; t2.state = &ms; kthread_run(multi_other, &t2, "multi_get"); multi_other(&t1); finish = ktime_get(); *val = ktime_us_delta(finish, t1.start); return 0; } DEFINE_SIMPLE_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n"); extern struct dentry *mips_debugfs_dir; static int __init spinlock_test(void) { struct dentry *d; if (!mips_debugfs_dir) return -ENODEV; d = debugfs_create_file("spin_single", S_IRUGO, mips_debugfs_dir, NULL, &fops_ss); if (!d) return -ENOMEM; d = debugfs_create_file("spin_multi", S_IRUGO, mips_debugfs_dir, NULL, &fops_multi); if (!d) return -ENOMEM; return 0; } device_initcall(spinlock_test);
talnoah/android_kernel_htc_dlx
virt/arch/mips/kernel/spinlock_test.c
C
gpl-2.0
2,381
[ 30522, 1001, 2421, 1026, 11603, 1013, 1999, 4183, 1012, 1044, 1028, 1001, 2421, 1026, 11603, 1013, 1047, 2705, 16416, 2094, 1012, 1044, 1028, 1001, 2421, 1026, 11603, 1013, 17850, 7292, 2099, 1012, 1044, 1028, 1001, 2421, 1026, 11603, 1013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.teamunify.i18n.com.teamunify.i18n.webapp; import com.teamunify.i18n.I; import com.teamunify.i18n.webapp.AbstractLocaleFilter; import org.junit.Before; import org.junit.Test; import static junit.framework.Assert.*; import static org.mockito.Mockito.*; import javax.servlet.*; import java.io.IOException; import java.util.Locale; public class ServletLocaleFilterTests { private static Locale computedLocale; private static Locale defaultLocale; Filter f = new AbstractLocaleFilter() { @Override public Locale getLocale(ServletRequest req) { return computedLocale; } @Override public Locale getDefaultLocale() { return defaultLocale; } }; private ServletRequest req; private FilterChain chain; private ServletResponse resp; @Before public void setup() { computedLocale = Locale.US; defaultLocale = Locale.US; req = mock(ServletRequest.class); resp = mock(ServletResponse.class); chain = mock(FilterChain.class); } @Test public void chains_the_filters() throws IOException, ServletException { f.doFilter(req, resp, chain); verify(chain).doFilter(eq(req), eq(resp)); } @Test public void uses_the_computed_locale_if_available() throws IOException, ServletException { computedLocale = Locale.CHINA; f.doFilter(req, resp, chain); assertEquals(I.getCurrentLanguage().locale, computedLocale); } @Test public void uses_the_filter_default_locale_if_compute_fails() throws IOException, ServletException { computedLocale = null; defaultLocale = Locale.KOREA; f.doFilter(req, resp, chain); assertEquals(I.getCurrentLanguage().locale, defaultLocale); } @Test public void uses_the_system_locale_if_no_computed_or_default_available() throws IOException, ServletException { computedLocale = null; defaultLocale = null; f.doFilter(req, resp, chain); assertEquals(I.getCurrentLanguage().locale, Locale.getDefault()); } }
awkay/easy-i18n
src/test/java/com/teamunify/i18n/com/teamunify/i18n/webapp/ServletLocaleFilterTests.java
Java
mit
1,982
[ 30522, 7427, 4012, 1012, 2136, 19496, 12031, 1012, 1045, 15136, 2078, 1012, 4012, 1012, 2136, 19496, 12031, 1012, 1045, 15136, 2078, 1012, 4773, 29098, 1025, 12324, 4012, 1012, 2136, 19496, 12031, 1012, 1045, 15136, 2078, 1012, 1045, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#include "ibex.h" #include <sstream> using namespace std; using namespace ibex; double convert(const char* argname, const char* arg) { char* endptr; double val = strtod(arg,&endptr); if (endptr!=arg+strlen(arg)*sizeof(char)) { stringstream s; s << "\"" << argname << "\" must be a real number"; ibex_error(s.str().c_str()); } return val; } int main(int argc, char** argv) { try { // check the number of arguments if (argc<5) { ibex_error("usage: defaultoptimizer filename prec goal_prec timelimit"); } // Load a system of equations System sys(argv[1]); cout << "load file " << argv[1] << "." << endl; double prec = convert("prec",argv[2]); double goal_prec = convert("goal_prec",argv[3]); // the required precision for the objective double time_limit = convert("timelimit",argv[4]); if (!sys.goal) { ibex_error(" input file has not goal (it is not an optimization problem)."); } // Build the default optimizer DefaultOptimizer o(sys,prec,goal_prec); // This option limits the search time o.timeout=time_limit; // This option prints each better feasible point when it is found o.trace=0; // display solutions with up to 12 decimals cout.precision(12); // Search for the optimum o.optimize(sys.box); // Report some information (computation time, etc.) o.report(); return 0; } catch(ibex::SyntaxError& e) { cout << e << endl; } }
benEnsta/ibex-lib
plugins/optim/examples/defaultoptimizer.cpp
C++
lgpl-3.0
1,423
[ 30522, 1001, 2421, 1000, 21307, 10288, 1012, 1044, 1000, 1001, 2421, 1026, 7020, 25379, 1028, 2478, 3415, 15327, 2358, 2094, 1025, 2478, 3415, 15327, 21307, 10288, 1025, 3313, 10463, 1006, 9530, 3367, 25869, 1008, 12098, 16989, 4168, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Media; using Microsoft.Xna.Framework.Net; using Microsoft.Xna.Framework.Storage; using AODGameLibrary.GamePlay; using AODGameLibrary.Weapons; using AODGameLibrary.AODObjects; using AODGameLibrary.Gamehelpers; using AODGameLibrary.Effects; using AODGameLibrary.Units; using AODGameLibrary.Effects.ParticleShapes; using AODGameLibrary.CollisionChecking; namespace CombatLibrary.Spells { /// <summary> /// 空间炸弹,造成范围伤害并炸飞,大地无敌-范若余于2010年6月6日从Skill类中移出 /// </summary> public class SpaceBomb : Skill { /// <summary> /// 判断是否符合施放条件 /// </summary> /// <returns></returns> public override bool ConditionCheck() { if (true) { return true; } else return false; } /// <summary> /// 技能行为发生时的动作 /// </summary> public override void SkillAction() { List<VioableUnit> dn = GameWorld.GameItemManager.ItemInRange(MargedUnit.Position, FloatValues[1]); foreach (VioableUnit u in dn) { if (u.UnitState == UnitState.alive && u.Group != MargedUnit.Group && u.Heavy == false) { u.GetDamage(Damage); if (u.Position != MargedUnit.Position) { u.GetImpulse(FloatValues[0] * Vector3.Normalize(u.Position - MargedUnit.Position));//造成冲量,弹飞 } else u.GetImpulse(FloatValues[0] * Vector3.Up); } } GameWorld.ScreenEffectManager.Blink(); } /// <summary> /// Update时的动作 /// </summary> public override void UpdateAction(GameTime gameTime) { } /// <summary> /// 被中断时的动作 /// </summary> public override void InterruptAction() { } /// <summary> /// 开始准备施放的动作 /// </summary> public override void StartCastingAction() { } /// <summary> /// 开始通道施放的动作 /// </summary> public override void StartChannellingAction() { } } }
WindyDarian/Art-of-Destiny
CombatLibrary/Spells/SpaceBomb.cs
C#
apache-2.0
2,681
[ 30522, 2478, 2291, 1025, 2478, 2291, 1012, 6407, 1012, 12391, 1025, 2478, 7513, 1012, 1060, 2532, 30524, 1060, 2532, 1012, 7705, 1012, 4180, 1025, 2478, 7513, 1012, 1060, 2532, 1012, 7705, 1012, 27911, 8043, 7903, 2229, 1025, 2478, 7513, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
class AddDayToScores < ActiveRecord::Migration def change add_column :scores, :day, :date end end
TransmediaLab/KsuQuest
db/migrate/20130826150205_add_day_to_scores.rb
Ruby
mit
107
[ 30522, 2465, 5587, 10259, 13122, 17345, 2015, 1026, 3161, 2890, 27108, 2094, 1024, 1024, 9230, 13366, 2689, 5587, 1035, 5930, 1024, 7644, 1010, 1024, 2154, 1010, 1024, 3058, 2203, 2203, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* eslint-disable no-self-assign */ import Game from '../../../../gui/html/js/game'; import { Plugin } from '../../../../gui/html/js/plugin'; import Translator from '../../../../gui/html/js/translator'; jest.mock('../../../../gui/html/js/dom'); jest.mock('../../../../gui/html/js/filters'); describe('Game', () => { const l10n = new Translator(); const defaultDerivedPluginMetadata = { name: 'test', isActive: false, isDirty: false, isEmpty: false, isMaster: false, isLightPlugin: false, loadsArchive: false, messages: [], suggestedTags: [], currentTags: [] }; const gameData = { folder: 'test', generalMessages: [ { type: 'say', text: 'test', language: 'en', condition: '' } ], masterlist: { revision: '0', date: '' }, groups: { masterlist: [], userlist: [] }, plugins: [defaultDerivedPluginMetadata], bashTags: [] }; describe('#constructor()', () => { test("should set folder to the object's value", () => { const game = new Game(gameData, l10n); expect(game.folder).toBe('test'); }); test("should set generalMessages to the object's value", () => { const game = new Game(gameData, l10n); expect(game.generalMessages).toEqual([ { type: 'say', text: 'test', language: 'en', condition: '' } ]); }); test("should set masterlist to the object's value", () => { const game = new Game(gameData, l10n); expect(game.masterlist).toEqual({ revision: '0', date: '' }); }); test("should construct plugins from the object's plugins value", () => { const game = new Game(gameData, l10n); expect(game.plugins.length).toBe(1); expect(game.plugins[0]).toHaveProperty('update'); expect(game.plugins[0].name).toBe('test'); expect(game.plugins[0].cardZIndex).toBe(1); }); test("should set oldLoadOrder to an empty array even if the object's value if defined", () => { const game = new Game(gameData, l10n); expect(game.oldLoadOrder).toEqual([]); }); }); describe('#folder', () => { let game: Game; // It's not worth the hassle of defining and checking the event type in test // code. // eslint-disable-next-line @typescript-eslint/no-explicit-any let handleEvent: (evt: any) => void; beforeEach(() => { game = new Game(gameData, l10n); }); afterEach(() => { document.removeEventListener('loot-game-folder-change', handleEvent); }); test('setting value should not dispatch an event if the new value is equal to the old one', done => { handleEvent = () => { done(new Error('Should not have fired an event')); }; document.addEventListener('loot-game-folder-change', handleEvent); game.folder = game.folder; setTimeout(done, 100); }); test('setting value should dispatch an event if the new value differs from the old one', done => { handleEvent = evt => { expect(evt.detail.folder).toBe('other test'); done(); }; document.addEventListener('loot-game-folder-change', handleEvent); game.folder = 'other test'; }); }); describe('#generalMessages', () => { let game: Game; // It's not worth the hassle of defining and checking the event type in test // code. // eslint-disable-next-line @typescript-eslint/no-explicit-any let handleEvent: (evt: any) => void; beforeEach(() => { game = new Game(gameData, l10n); }); afterEach(() => { document.removeEventListener( 'loot-game-global-messages-change', handleEvent ); }); test('setting value should not dispatch an event if the new value is equal to the old one', done => { handleEvent = () => { done(new Error('Should not have fired an event')); }; document.addEventListener( 'loot-game-global-messages-change', handleEvent ); game.generalMessages = game.generalMessages; setTimeout(done, 100); }); test('setting value should dispatch an event if the new and old message strings differ', done => { const newMessages = [ { type: 'say', text: 'bar', language: 'en', condition: '' } ]; handleEvent = evt => { expect(evt.detail.messages).toEqual(newMessages); expect(evt.detail.totalDiff).toBe(0); expect(evt.detail.errorDiff).toBe(0); expect(evt.detail.warningDiff).toBe(0); done(); }; document.addEventListener( 'loot-game-global-messages-change', handleEvent ); game.generalMessages = newMessages; }); test('setting value should dispatch an event if the new and old message type counts differ', done => { const newMessages = [ { type: 'warn', text: 'foo', language: 'en', condition: '' }, { type: 'error', text: 'bar', language: 'en', condition: '' } ]; game.generalMessages = []; handleEvent = evt => { expect(evt.detail.messages).toEqual(newMessages); expect(evt.detail.totalDiff).toBe(2); expect(evt.detail.errorDiff).toBe(1); expect(evt.detail.warningDiff).toBe(1); done(); }; document.addEventListener( 'loot-game-global-messages-change', handleEvent ); game.generalMessages = newMessages; }); }); describe('#masterlist', () => { let game: Game; // It's not worth the hassle of defining and checking the event type in test // code. // eslint-disable-next-line @typescript-eslint/no-explicit-any let handleEvent: (evt: any) => void; beforeEach(() => { game = new Game(gameData, l10n); }); afterEach(() => { document.removeEventListener('loot-game-masterlist-change', handleEvent); }); test('setting value should not dispatch an event if the new value is equal to the old one', done => { handleEvent = () => { done(new Error('Should not have fired an event')); }; document.addEventListener('loot-game-masterlist-change', handleEvent); game.masterlist = game.masterlist; setTimeout(done, 100); }); test('setting value should dispatch an event if the new value differs from the old one', done => { const newMasterlist = { revision: 'foo', date: 'bar' }; handleEvent = evt => { expect(evt.detail).toEqual(newMasterlist); done(); }; document.addEventListener('loot-game-masterlist-change', handleEvent); game.masterlist = newMasterlist; }); }); describe('#plugins', () => { let game: Game; // It's not worth the hassle of defining and checking the event type in test // code. // eslint-disable-next-line @typescript-eslint/no-explicit-any let handleEvent: (evt: any) => void; beforeEach(() => { game = new Game(gameData, l10n); }); afterEach(() => { document.removeEventListener('loot-game-plugins-change', handleEvent); }); test('setting value should dispatch an event if the new value is equal to the old one', done => { handleEvent = () => { done(); }; document.addEventListener('loot-game-plugins-change', handleEvent); game.plugins = game.plugins; }); test('setting value should dispatch an event if the new value differs from the old one', done => { const newMessages = [ { type: 'warn', text: 'foo', language: 'en', condition: '' }, { type: 'error', text: 'bar', language: 'en', condition: '' } ]; const newPlugins = [ new Plugin({ ...defaultDerivedPluginMetadata, name: 'a', isActive: true, messages: [newMessages[0]] }), new Plugin({ ...defaultDerivedPluginMetadata, name: 'b', isDirty: true, messages: [{ ...newMessages[0], type: 'say' }] }) ]; handleEvent = evt => { expect(evt.detail.valuesAreTotals).toBe(true); expect(evt.detail.totalMessageNo).toBe(4); expect(evt.detail.warnMessageNo).toBe(2); expect(evt.detail.errorMessageNo).toBe(1); expect(evt.detail.totalPluginNo).toBe(2); expect(evt.detail.activePluginNo).toBe(1); expect(evt.detail.dirtyPluginNo).toBe(1); done(); }; document.addEventListener('loot-game-plugins-change', handleEvent); game.generalMessages = newMessages; game.plugins = newPlugins; }); }); describe('groups', () => { test("get should return the game's groups", () => { const groups = { masterlist: [{ name: 'a', after: [] }], userlist: [{ name: 'b', after: [] }] }; const game = new Game({ ...gameData, groups }, l10n); expect(game.groups).toStrictEqual([ { name: 'a', after: [], isUserAdded: false }, { name: 'b', after: [], isUserAdded: true } ]); }); }); describe('#setGroups()', () => { // It's not worth the hassle of defining and checking the event type in test // code. // eslint-disable-next-line @typescript-eslint/no-explicit-any let handleEvent: (evt: any) => void; afterEach(() => { document.removeEventListener('loot-game-groups-change', handleEvent); }); test('should merge the given masterlist and userlist groups arrays', () => { const game = new Game(gameData, l10n); const groups = { masterlist: [{ name: 'a', after: [] }], userlist: [{ name: 'b', after: [] }] }; game.setGroups(groups); expect(game.groups).toStrictEqual([ { name: 'a', after: [], isUserAdded: false }, { name: 'b', after: [], isUserAdded: true } ]); }); test('should dispatch an event', done => { handleEvent = () => { done(); }; document.addEventListener('loot-game-groups-change', handleEvent); const game = new Game(gameData, l10n); const groups = { masterlist: [{ name: 'a', after: [] }], userlist: [{ name: 'b', after: [] }] }; game.setGroups(groups); }); }); describe('#getContent()', () => { let game: Game; beforeEach(() => { game = new Game(gameData, l10n); }); test('should return an object of two empty arrays if there is no game data', () => { game.plugins = []; game.generalMessages = []; expect(game.getContent()).toEqual({ messages: [], plugins: [] }); }); test('should return a structure containing converted plugin and message structures', () => { game.generalMessages = [ { type: 'say', condition: 'file("foo.esp")', language: 'fr', text: 'Bonjour le monde' } ]; game.plugins = [ new Plugin({ name: 'foo', crc: 0xdeadbeef, version: '1.0', isActive: true, isEmpty: true, isMaster: false, isLightPlugin: false, loadsArchive: true, group: 'group1', messages: [ { type: 'warn', condition: 'file("bar.esp")', language: 'en', text: 'Hello world' } ], currentTags: [ { name: 'Relev', isAddition: true, condition: '' } ], suggestedTags: [ { name: 'Delev', isAddition: true, condition: '' } ], isDirty: true }) ]; expect(game.getContent()).toEqual({ messages: game.generalMessages, plugins: [ { name: game.plugins[0].name, crc: game.plugins[0].crc, version: game.plugins[0].version, isActive: game.plugins[0].isActive, isEmpty: game.plugins[0].isEmpty, loadsArchive: game.plugins[0].loadsArchive, group: game.plugins[0].group, messages: game.plugins[0].messages, currentTags: game.plugins[0].currentTags, suggestedTags: game.plugins[0].suggestedTags, isDirty: game.plugins[0].isDirty } ] }); }); }); describe('#getPluginNames()', () => { let game: Game; beforeEach(() => { game = new Game(gameData, l10n); }); test('should return an empty array if there are no plugins', () => { game.plugins = []; expect(game.getPluginNames().length).toBe(0); }); test('should return an array of plugin filenames if there are plugins', () => { game.plugins = [ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo', isActive: true, messages: [{ type: 'warn', text: '', language: 'en', condition: '' }] }) ]; expect(game.getPluginNames()).toEqual(['foo']); }); }); describe('#getGroupPluginNames()', () => { let game: Game; beforeEach(() => { const plugins = [ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo', group: 'test group' }), new Plugin({ ...defaultDerivedPluginMetadata, name: 'bar', group: 'other group' }), new Plugin({ ...defaultDerivedPluginMetadata, name: 'foobar', group: 'test group' }) ]; game = new Game({ ...gameData, plugins }, l10n); }); test('should return an empty array if there are no plugins in the given group', () => { expect(game.getGroupPluginNames('empty group').length).toBe(0); }); test('should return an array of filenames of plugins in the given group', () => { expect(game.getGroupPluginNames('test group')).toEqual(['foo', 'foobar']); }); }); describe('#setSortedPlugins', () => { let game: Game; // It's not worth the hassle of defining and checking the event type in test // code. // eslint-disable-next-line @typescript-eslint/no-explicit-any let handleEvent: (evt: any) => void; beforeEach(() => { game = new Game(gameData, l10n); }); afterEach(() => { document.removeEventListener('loot-game-plugins-change', handleEvent); }); test('should append new plugins to the plugins array', () => { game.setSortedPlugins([ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo' }) ]); expect(game.plugins[0].name).toBe('foo'); }); test('should update existing plugins with new data', () => { game.plugins = [ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo', isActive: true, messages: [{ type: 'warn', text: '', language: 'en', condition: '' }] }) ]; game.setSortedPlugins([ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo', crc: 0xdeadbeef }) ]); expect(game.plugins[0].crc).toBe(0xdeadbeef); expect(game.plugins[0].isActive).toBe(false); }); test('should reorder plugins to given order', () => { game.plugins = [ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo' }), new Plugin({ ...defaultDerivedPluginMetadata, name: 'bar' }) ]; game.setSortedPlugins([ new Plugin({ ...defaultDerivedPluginMetadata, name: 'bar' }), new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo' }) ]); expect(game.plugins[0].name).toBe('bar'); expect(game.plugins[1].name).toBe('foo'); }); test('should store old load order', () => { game.plugins = [ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo' }), new Plugin({ ...defaultDerivedPluginMetadata, name: 'bar' }) ]; game.setSortedPlugins([ new Plugin({ ...defaultDerivedPluginMetadata, name: 'bar' }), new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo' }) ]); expect(game.oldLoadOrder[0].name).toBe('foo'); expect(game.oldLoadOrder[1].name).toBe('bar'); }); test('should dispatch an event', done => { handleEvent = () => { done(); }; document.addEventListener('loot-game-plugins-change', handleEvent); game.setSortedPlugins([ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo' }) ]); }); }); describe('#applySort', () => { let game: Game; beforeEach(() => { game = new Game(gameData, l10n); }); test('should delete the stored old load order', () => { game.oldLoadOrder = gameData.plugins.map(p => new Plugin(p)); game.applySort(); expect(game.oldLoadOrder).toEqual([]); }); }); describe('#cancelSort', () => { let game: Game; beforeEach(() => { game = new Game(gameData, l10n); }); test('should set the current load order to the given plugins', () => { const oldLoadOrder = [ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo' }), new Plugin({ ...defaultDerivedPluginMetadata, name: 'bar' }), new Plugin({ ...defaultDerivedPluginMetadata, name: 'baz' }) ]; game.oldLoadOrder = oldLoadOrder; game.plugins = [oldLoadOrder[2], oldLoadOrder[1], oldLoadOrder[0]]; game.cancelSort( [{ name: 'baz', loadOrderIndex: 0 }, { name: 'foo' }], [] ); expect(game.plugins).toEqual([oldLoadOrder[2], oldLoadOrder[0]]); }); test('should delete the stored old load order', () => { game.oldLoadOrder = [ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo' }), new Plugin({ ...defaultDerivedPluginMetadata, name: 'bar' }) ]; game.cancelSort([], []); expect(game.oldLoadOrder).toEqual([]); }); test('should set plugin load order indices using the array passed as the first parameter', () => { game.oldLoadOrder = [ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo', loadOrderIndex: 1 }), new Plugin({ ...defaultDerivedPluginMetadata, name: 'bar', loadOrderIndex: 0 }) ]; game.cancelSort( [ { name: 'bar', loadOrderIndex: 0 }, { name: 'foo', loadOrderIndex: 2 } ], [] ); expect(game.plugins[0].name).toBe('bar'); expect(game.plugins[0].loadOrderIndex).toBe(0); expect(game.plugins[1].name).toBe('foo'); expect(game.plugins[1].loadOrderIndex).toBe(2); }); test('should set the general messages to the second passed parameter', () => { game.oldLoadOrder = [ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo', loadOrderIndex: 1 }), new Plugin({ ...defaultDerivedPluginMetadata, name: 'bar', loadOrderIndex: 0 }) ]; const messages = [ { type: 'say', text: 'foo', language: 'en', condition: '' } ]; game.cancelSort([], messages); expect(game.generalMessages).toEqual(messages); }); }); describe('#clearMetadata', () => { let game: Game; beforeEach(() => { game = new Game(gameData, l10n); }); test('should delete stored userlist data for existing plugins', () => { game.plugins = [ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo', userlist: { name: '', after: [], req: [], inc: [], msg: [], tag: [], dirty: [], clean: [], url: [] } }) ]; game.clearMetadata([ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo' }) ]); expect(game.plugins[0].userlist).toBe(undefined); }); test('should update existing plugin data', () => { game.plugins = [ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo', isActive: true }) ]; game.clearMetadata([ new Plugin({ ...defaultDerivedPluginMetadata, name: 'foo', crc: 0xdeadbeef }) ]); expect(game.plugins[0].crc).toBe(0xdeadbeef); expect(game.plugins[0].isActive).toBe(false); }); }); });
silentdark/loot
src/tests/gui/html/js/test_game.ts
TypeScript
gpl-3.0
21,385
[ 30522, 1013, 1008, 9686, 4115, 2102, 1011, 4487, 19150, 2053, 1011, 2969, 1011, 23911, 1008, 1013, 12324, 2208, 2013, 1005, 1012, 1012, 1013, 1012, 1012, 1013, 1012, 1012, 1013, 1012, 1012, 1013, 26458, 1013, 16129, 1013, 1046, 2015, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); const scope_manager_1 = require("@typescript-eslint/scope-manager"); const util = __importStar(require("../util")); const SENTINEL_TYPE = /^(?:(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|CatchClause|ImportDeclaration|ExportNamedDeclaration)$/; /** * Parses a given value as options. */ function parseOptions(options) { let functions = true; let classes = true; let enums = true; let variables = true; let typedefs = true; let ignoreTypeReferences = true; if (typeof options === 'string') { functions = options !== 'nofunc'; } else if (typeof options === 'object' && options !== null) { functions = options.functions !== false; classes = options.classes !== false; enums = options.enums !== false; variables = options.variables !== false; typedefs = options.typedefs !== false; ignoreTypeReferences = options.ignoreTypeReferences !== false; } return { functions, classes, enums, variables, typedefs, ignoreTypeReferences, }; } /** * Checks whether or not a given variable is a function declaration. */ function isFunction(variable) { return variable.defs[0].type === scope_manager_1.DefinitionType.FunctionName; } /** * Checks whether or not a given variable is a type declaration. */ function isTypedef(variable) { return variable.defs[0].type === scope_manager_1.DefinitionType.Type; } /** * Checks whether or not a given variable is a enum declaration. */ function isOuterEnum(variable, reference) { return (variable.defs[0].type == scope_manager_1.DefinitionType.TSEnumName && variable.scope.variableScope !== reference.from.variableScope); } /** * Checks whether or not a given variable is a class declaration in an upper function scope. */ function isOuterClass(variable, reference) { return (variable.defs[0].type === scope_manager_1.DefinitionType.ClassName && variable.scope.variableScope !== reference.from.variableScope); } /** * Checks whether or not a given variable is a variable declaration in an upper function scope. */ function isOuterVariable(variable, reference) { return (variable.defs[0].type === scope_manager_1.DefinitionType.Variable && variable.scope.variableScope !== reference.from.variableScope); } /** * Recursively checks whether or not a given reference has a type query declaration among it's parents */ function referenceContainsTypeQuery(node) { switch (node.type) { case experimental_utils_1.AST_NODE_TYPES.TSTypeQuery: return true; case experimental_utils_1.AST_NODE_TYPES.TSQualifiedName: case experimental_utils_1.AST_NODE_TYPES.Identifier: if (!node.parent) { return false; } return referenceContainsTypeQuery(node.parent); default: // if we find a different node, there's no chance that we're in a TSTypeQuery return false; } } /** * Checks whether or not a given reference is a type reference. */ function isTypeReference(reference) { return (reference.isTypeReference || referenceContainsTypeQuery(reference.identifier)); } /** * Checks whether or not a given location is inside of the range of a given node. */ function isInRange(node, location) { return !!node && node.range[0] <= location && location <= node.range[1]; } /** * Decorators are transpiled such that the decorator is placed after the class declaration * So it is considered safe */ function isClassRefInClassDecorator(variable, reference) { if (variable.defs[0].type !== scope_manager_1.DefinitionType.ClassName) { return false; } if (!variable.defs[0].node.decorators || variable.defs[0].node.decorators.length === 0) { return false; } for (const deco of variable.defs[0].node.decorators) { if (reference.identifier.range[0] >= deco.range[0] && reference.identifier.range[1] <= deco.range[1]) { return true; } } return false; } /** * Checks whether or not a given reference is inside of the initializers of a given variable. * * @returns `true` in the following cases: * - var a = a * - var [a = a] = list * - var {a = a} = obj * - for (var a in a) {} * - for (var a of a) {} */ function isInInitializer(variable, reference) { var _a; if (variable.scope !== reference.from) { return false; } let node = variable.identifiers[0].parent; const location = reference.identifier.range[1]; while (node) { if (node.type === experimental_utils_1.AST_NODE_TYPES.VariableDeclarator) { if (isInRange(node.init, location)) { return true; } if (((_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) && (node.parent.parent.type === experimental_utils_1.AST_NODE_TYPES.ForInStatement || node.parent.parent.type === experimental_utils_1.AST_NODE_TYPES.ForOfStatement) && isInRange(node.parent.parent.right, location)) { return true; } break; } else if (node.type === experimental_utils_1.AST_NODE_TYPES.AssignmentPattern) { if (isInRange(node.right, location)) { return true; } } else if (SENTINEL_TYPE.test(node.type)) { break; } node = node.parent; } return false; } exports.default = util.createRule({ name: 'no-use-before-define', meta: { type: 'problem', docs: { description: 'Disallow the use of variables before they are defined', recommended: false, extendsBaseRule: true, }, messages: { noUseBeforeDefine: "'{{name}}' was used before it was defined.", }, schema: [ { oneOf: [ { enum: ['nofunc'], }, { type: 'object', properties: { functions: { type: 'boolean' }, classes: { type: 'boolean' }, enums: { type: 'boolean' }, variables: { type: 'boolean' }, typedefs: { type: 'boolean' }, ignoreTypeReferences: { type: 'boolean' }, }, additionalProperties: false, }, ], }, ], }, defaultOptions: [ { functions: true, classes: true, enums: true, variables: true, typedefs: true, ignoreTypeReferences: true, }, ], create(context, optionsWithDefault) { const options = parseOptions(optionsWithDefault[0]); /** * Determines whether a given use-before-define case should be reported according to the options. * @param variable The variable that gets used before being defined * @param reference The reference to the variable */ function isForbidden(variable, reference) { if (options.ignoreTypeReferences && isTypeReference(reference)) { return false; } if (isFunction(variable)) { return options.functions; } if (isOuterClass(variable, reference)) { return options.classes; } if (isOuterVariable(variable, reference)) { return options.variables; } if (isOuterEnum(variable, reference)) { return options.enums; } if (isTypedef(variable)) { return options.typedefs; } return true; } /** * Finds and validates all variables in a given scope. */ function findVariablesInScope(scope) { scope.references.forEach(reference => { const variable = reference.resolved; // Skips when the reference is: // - initializations. // - referring to an undefined variable. // - referring to a global environment variable (there're no identifiers). // - located preceded by the variable (except in initializers). // - allowed by options. if (reference.init || !variable || variable.identifiers.length === 0 || (variable.identifiers[0].range[1] <= reference.identifier.range[1] && !isInInitializer(variable, reference)) || !isForbidden(variable, reference) || isClassRefInClassDecorator(variable, reference) || reference.from.type === experimental_utils_1.TSESLint.Scope.ScopeType.functionType) { return; } // Reports. context.report({ node: reference.identifier, messageId: 'noUseBeforeDefine', data: { name: reference.identifier.name, }, }); }); scope.childScopes.forEach(findVariablesInScope); } return { Program() { findVariablesInScope(context.getScope()); }, }; }, }); //# sourceMappingURL=no-use-before-define.js.map
ChromeDevTools/devtools-frontend
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-use-before-define.js
JavaScript
bsd-3-clause
10,758
[ 30522, 1000, 2224, 9384, 1000, 1025, 13075, 1035, 1035, 3443, 8428, 4667, 1027, 1006, 2023, 1004, 1004, 2023, 1012, 1035, 1035, 3443, 8428, 4667, 1007, 1064, 1064, 1006, 4874, 1012, 3443, 1029, 1006, 3853, 1006, 1051, 1010, 1049, 1010, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
## 1.13.0 (2021-02-16) As part of this release we had [20 issues](https://github.com/codecov/codecov-exe/milestone/27?closed=1) closed. __Bugs__ - [__#170__](https://github.com/codecov/codecov-exe/issues/170) Running on azure fails due to question mark not being escaped in the `build_url` parameter - [__#146__](https://github.com/codecov/codecov-exe/issues/146) Execution broken with AppVeyor starting from codecov-exe v1.12.0 __Features__ - [__#172__](https://github.com/codecov/codecov-exe/issues/172) Add support for .NET 5.0 - [__#135__](https://github.com/codecov/codecov-exe/pull/135) Add new Codecov.MSBuild package providing a `Codecov`MSBuild task __Improvements__ - [__#154__](https://github.com/codecov/codecov-exe/pull/154) Bump JetBrains.Annotations from 2020.1.0 to 2020.3.0 in /Source - [__#133__](https://github.com/codecov/codecov-exe/pull/133) Bump Serilog from 2.9.0 to 2.10.0 in /Source ## 1.12.3 (2020-09-07) As part of this release we had [26 commits](https://github.com/codecov/codecov-exe/compare/1.12.2...1.12.3) which resulted in [4 issues](https://github.com/codecov/codecov-exe/milestone/26?closed=1) being closed. __Improvement__ - [__#129__](https://github.com/codecov/codecov-exe/pull/129) Bump Glob from 1.1.6 to 1.1.8 in /Source ## 1.12.2 (2020-08-17) As part of this release we had [2 commits](https://github.com/codecov/codecov-exe/compare/1.12.1...1.12.2) which resulted in [1 issue](https://github.com/codecov/codecov-exe/milestone/25?closed=1) being closed. __Bug__ - [__#122__](https://github.com/codecov/codecov-exe/issues/122) Incorrect Build Url is created when running on appveyor ## 1.12.1 (2020-07-10) As part of this release we had [2 commits](https://github.com/codecov/codecov-exe/compare/1.12.0...1.12.1) which resulted in [1 issue](https://github.com/codecov/codecov-exe/milestone/24?closed=1) being closed. __Bug__ - [__#120__](https://github.com/codecov/codecov-exe/issues/120) Codecov package have not been packaged as a standalone executable ## 1.12.0 (2020-06-23) As part of this release we had [16 commits](https://github.com/codecov/codecov-exe/compare/1.11.2...1.12.0) which resulted in [5 issues](https://github.com/codecov/codecov-exe/milestone/22?closed=1) being closed. __Bug__ - [__#117__](https://github.com/codecov/codecov/issues/117) Upload URL is reported twice when running with verbose debugging __Improvements__ - [__#118__](https://github.com/codecov/codecov-exe/issues/118) Remove time and date from logging - [__#115__](https://github.com/codecov/codecov-exe/issues/115) Load supported VCS providers using reflection - [__#114__](https://github.com/codecov/codecov-exe/issues/114) Load CI parsers using reflection ## 1.11.2 (2020-06-21) As part of this release we had [2 commits](https://github.com/codecov/codecov-exe/compare/1.11.1...1.11.2) which resulted in [1 issue](https://github.com/codecov/codecov-exe/milestone/23?closed=1) being closed. __Bug__ - [__#71__](https://github.com/codecov/codecov-exe/issues/71) --file cannot handle paths with spaces ## 1.11.1 (2020-06-10) As part of this release we had [15 commits](https://github.com/codecov/codecov-exe/compare/1.11.0...1.11.1) which resulted in [3 issues](https://github.com/codecov/codecov-exe/milestone/21?closed=1) being closed. __Bugs__ - [__#112__](https://github.com/codecov/codecov-exe/issues/112) Chocolatey package includes invalid "Where to get it" section - [__#111__](https://github.com/codecov/codecov-exe/issues/111) Release Notes in codecov chocolatey package contains invalid links - [__#110__](https://github.com/codecov/codecov-exe/issues/110) Symbols for Codecov.Tool and nuget Codecov package do not match ## 1.11.0 (2020-06-10) As part of this release we had [41 commits](https://github.com/codecov/codecov-exe/compare/1.10.0...1.11.0) which resulted in [7 issues](https://github.com/codecov/codecov-exe/milestone/20?closed=1) being closed. __Bugs__ - [__#108__](https://github.com/codecov/codecov-exe/issues/108) Github action CI detector is not added to pipeline check - [__#100__](https://github.com/codecov/codecov-exe/issues/100) GitHub Actions is not detected in 1.10 __Documentation__ - [__#98__](https://github.com/codecov/codecov-exe/issues/98) Add an example of using globbing patterns with the file argument __Feature__ - [__#103__](https://github.com/codecov/codecov-exe/issues/103) Support disabling default uploader via command line __Improvements__ - [__#105__](https://github.com/codecov/codecov-exe/pull/105) Remove Public Read header from presigned PUT - [__#102__](https://github.com/codecov/codecov-exe/issues/102) Add ability to detect pull requests when running on github actions - [__#101__](https://github.com/codecov/codecov-exe/issues/101) Add support for setting build id and build url on github actions ## 1.10.0 (2020-02-01) As part of this release we had [11 commits](https://github.com/codecov/codecov-exe/compare/1.9.0...1.10.0) which resulted in [2 issues](https://github.com/codecov/codecov-exe/milestone/19?closed=1) being closed. __Improvements__ - [__#97__](https://github.com/codecov/codecov-exe/issues/97) Warn users when total upload is larger than 20 MB in size - [__#95__](https://github.com/codecov/codecov-exe/issues/95) Support .NET Core 3.x for Codecov.Tool __Dependencies__ - Update CommandLineParser to 2.7.82 - Update Glob dependency to 1.1.4 ## 1.9.0 (2019-11-14) As part of this release we had [14 commits](https://github.com/codecov/codecov-exe/compare/1.8.0...1.9.0) which resulted in [2 issues](https://github.com/codecov/codecov-exe/milestone/18?closed=1) being closed. __Documentation__ - [__#93__](https://github.com/codecov/codecov-exe/issues/93) Azure pipelines no longer needs a token __Improvement__ - [__#92__](https://github.com/codecov/codecov-exe/pull/92) Set all properties for Azure Pipelines uploads (Thanks to @sharwell for providing this) This includes changes to allow Azure Pipelines to upload coverage reports without the use of a Codecov Token (*public repositories only*). __Dependencies__ - Updated [CommandLineParser](https://www.nuget.org/packages/CommandLineParser) to version `2.6.0` - Updated [Glob](https://www.nuget.org/packages/Glob) to version `1.1.4` - Updated [Serilog](https://www.nuget.org/packages/Serilog) to version `2.9.0` ## 1.8.0 (2019-10-31) As part of this release we had [13 commits](https://github.com/codecov/codecov-exe/compare/1.7.2...1.8.0) which resulted in [4 issues](https://github.com/codecov/codecov-exe/milestone/17?closed=1) being closed. __Documentation__ - [__#88__](https://github.com/codecov/codecov-exe/issues/88) Documentation Request: There is a "dotnet tool" and this is how to use it! __Features__ - [__#90__](https://github.com/codecov/codecov-exe/issues/90) Add support for github actions - [__#31__](https://github.com/codecov/codecov-exe/issues/31) Jenkins CI Detection (thanks to @mikebro for adding this support) __Improvement__ - [__#91__](https://github.com/codecov/codecov-exe/issues/91) Azure pipeline service detector uses incorrect service name ## 1.7.2 (2019-08-16) As part of this release we had [14 commits](https://github.com/codecov/codecov-exe/compare/1.7.1...1.7.2) which resulted in [3 issues](https://github.com/codecov/codecov-exe/milestone/16?closed=1) being closed. __Bugs__ - [__#87__](https://github.com/codecov/codecov-exe/issues/87) Travis CI service parser does not set the tag name from travis environment variables - [__#86__](https://github.com/codecov/codecov-exe/issues/86) invalid build url generated for travis-ci when repository slug have been overridden - [__#81__](https://github.com/codecov/codecov-exe/issues/81) Invalid build url generated for appveyor when account name is not same as repository account ## 1.7.1 (2019-08-02) As part of this release we had [6 commits](https://github.com/codecov/codecov-exe/compare/1.7.0...1.7.1) which resulted in [3 issues](https://github.com/codecov/codecov-exe/milestone/15?closed=1) being closed. __Bugs__ - [__#84__](https://github.com/codecov/codecov-exe/issues/84) Branch name do not properly encode slashes - [__#83__](https://github.com/codecov/codecov-exe/issues/83) nuget package places Linux and OSX binaries in incorrect directory __Documentation__ - [__#85__](https://github.com/codecov/codecov-exe/issues/85) Codecov nuget package incorrectly says it only supports windows ## 1.7.0 (2019-07-28) As part of this release we had [9 commits](https://github.com/codecov/codecov-exe/compare/1.6.1...1.7.0) which resulted in [2 issues](https://github.com/codecov/codecov-exe/milestone/14?closed=1) being closed. __Bug__ - [__#79__](https://github.com/codecov/codecov-exe/issues/79) Slug generation is incorrect when using username and password in url. __Improvement__ - [__#78__](https://github.com/codecov/codecov-exe/issues/78) Improve logging by including response content when an error happens ## 1.6.1 (2019-07-16) As part of this release we had [1 commit](https://github.com/codecov/codecov-exe/compare/1.6.0...1.6.1) which resulted in [1 issue](https://github.com/codecov/codecov-exe/milestone/13?closed=1) being closed. __Bug__ - [__#77__](https://github.com/codecov/codecov-exe/issues/77) Running on Unix returns a permission denied error ## 1.6.0 (2019-07-15) As part of this release we had [28 commits](https://github.com/codecov/codecov-exe/compare/1.5.0...1.6.0) which resulted in [7 issues](https://github.com/codecov/codecov-exe/milestone/12?closed=1) being closed. This release is expected to be the last release that will include any new features until the eventual release of 2.0. __Bug__ - [__#52__](https://github.com/codecov/codecov-exe/issues/52) codecov.exe returns success on invalid arguments __Features__ - [__#68__](https://github.com/codecov/codecov-exe/issues/68) Support glob expression for file paths (Thanks to @hanabi1224 for providing this support) - [__#66__](https://github.com/codecov/codecov-exe/issues/66) Embedd resulting build output in self-contained native binary using warp - [__#65__](https://github.com/codecov/codecov-exe/issues/65) Add support for Travis CI - [__#38__](https://github.com/codecov/codecov-exe/issues/38) Support uploading to v2 endpoint __Improvements__ - [__#70__](https://github.com/codecov/codecov-exe/issues/70) Change from using Webclient to using HttpClient - [__#67__](https://github.com/codecov/codecov-exe/issues/67) Include linux and Mac OSX binaries in Codecov package along with Windows binaries ## 1.5.0 (2019-05-05) As part of this release we had [6 issues](https://github.com/codecov/codecov-exe/milestone/9?closed=1) closed. This release finally provides official support for Linux and OS X platforms. This allows Codecov-exe to be used on either Linux or OS X. The recommended way is by installing the .NET Core tool ([Codecov.Tool](https://nuget.org/packages/Codecov.Tool/1.5.0)), or by downloading one of the platform specific archives provided with this release. __Bugs__ - [__#62__](https://github.com/codecov/codecov-exe/issues/62) SourceCode files are do not correctly ignore files on unix platform - [__#59__](https://github.com/codecov/codecov-exe/issues/59) codecov yaml not located __Feature__ - [__#64__](https://github.com/codecov/codecov-exe/issues/64) Provide pre-built archives for linux and OS X platforms __Improvements__ - [__#58__](https://github.com/codecov/codecov-exe/issues/58) FileSystem class should normalize path when directory separator is using a / - [__#57__](https://github.com/codecov/codecov-exe/issues/57) AppVeyor CI Service check should do case-insensitive comparison ## 1.4.0 (2019-04-07) As part of this release we had [5 commits](https://github.com/codecov/codecov-exe/compare/1.3.0...1.4.0) which resulted in [2 issues](https://github.com/codecov/codecov-exe/milestone/8?closed=1) being closed. __Bug__ - [__#55__](https://github.com/codecov/codecov-exe/issues/55) azure pipeline is broken __Improvement__ - [__#54__](https://github.com/codecov/codecov-exe/pull/54) Make the HttpWebRequest provide more details for Put failures ## 1.3.0 (2019-02-28) As part of this release we had [14 commits](https://github.com/codecov/codecov-exe/compare/1.2.0...1.3.0) which resulted in [2 issues](https://github.com/codecov/codecov-exe/milestone/6?closed=1) being closed. __Bug__ - [__#49__](https://github.com/codecov/codecov-exe/pull/49) Fix terminal filter __Feature__ - [__#50__](https://github.com/codecov/codecov-exe/issues/50) Add support for Azure Pipelines ## 1.2.0 (2019-02-06) As part of this release we had [9 commits](https://github.com/codecov/codecov-exe/compare/1.1.1...1.2.0) which resulted in [2 issues](https://github.com/codecov/codecov-exe/milestone/4?closed=1) being closed. __Feature__ - [__#44__](https://github.com/codecov/codecov-exe/issues/44) Add a dotnet tool for codecov exe (thanks to @ViktorHofer for providing this) __Improvement__ - [__#48__](https://github.com/codecov/codecov-exe/issues/48) Use .NET Core 2.1 WebClient instead of using PowerShell ## 1.1.1 (2019-01-10) As part of this release we had [4 commits](https://github.com/codecov/codecov-exe/compare/1.1.0...1.1.1) which resulted in [1 issue](https://github.com/codecov/codecov-exe/milestone/5?closed=1) being closed. __Bug__ - [__#46__](https://github.com/codecov/codecov-exe/pull/46) -f and -e command line arguments don't accept multiple values as the docs suggest ## 1.1.0 (2018-09-12) As part of this release we had [8 commits](https://github.com/codecov/codecov-exe/compare/1.0.5...1.1.0) which resulted in [2 issues](https://github.com/codecov/codecov-exe/issues?milestone=2&state=closed) being closed. __Improvements__ - [__#42__](https://github.com/codecov/codecov-exe/pull/42) GZip compress content for uploading - [__#39__](https://github.com/codecov/codecov-exe/issues/39) Warn the user when a coverage file can't be found. ## 1.0.5 (2018-07-01) As part of this release we had [3 commits](https://github.com/codecov/codecov-exe/compare/1.0.4...1.0.5) which resulted in [2 issues](https://github.com/codecov/codecov-exe/issues?milestone=3&state=closed) being closed. __Bugs__ - [__#37__](https://github.com/codecov/codecov-exe/issues/37) Codecov returns (404) Not Found - [__#36__](https://github.com/codecov/codecov-exe/issues/36) Report uploads fails on certain branches and/or job IDs ## 1.0.4 (2018-06-17) As part of this release we had [2 issues](https://github.com/codecov/codecov-exe/issues?milestone=1&state=closed) closed. __Bugs__ - [__#36__](https://github.com/codecov/codecov-exe/issues/36) Report uploads fails on certain branches and/or job IDs - [__#32__](https://github.com/codecov/codecov-exe/issues/32) Bad request (400) with non-standard branch name ## 1.0.3 (2017-08-11) ### Bug * (GH-26) Version 1.0.2 is freezing on appveyor. ## 1.0.2 (2017-08-07) ### Bug #20 Upload timed out for large files. #22 Git service fails if project located at path with spaces. ~ Dmitry Popov ### Improvement #19 Cleaned up Chocolatey package code. ## 1.0.1 (2017-06-03) ### Bug * #17 - `Required` commandline arg bug. ~ Kim J. Nordmo ## v1.0.0 (2017-05-25) * Added support for yaml file. * Implemented must have CLI options. * Bug fixes and code clean up. * Added unit tests. ## 0.4.0-Beta (2017-04-10) - Added ability to manually discover the source code files without using git. Also, fixed how git is detected. - Bug fixes for TeamCity service and added documentation for it. *TeamCity is officially supported now*. - Added command line option to disable including source code files in upload (network). ## 0.3.0-Beta (2017-03-30) * Ported to .NET Core standalone app. We now support win7 (x64) and above. ## 0.2.0-beta (2017-03-07) - Added support for Travis Ci, AppVeyor, TeamCity (not tested), and Git. - Added a lot of the CLI options. ## 0.1.0-beta (2017-02-21) Initial Beta Release - Added command line option to disable including source code files in upload (network). ## 0.3.0-Beta (2017-03-30) - Ported to .NET Core standalone app. We now support win7 (x64) and above. ## 0.2.0-beta (2017-03-07) - Added support for Travis Ci, AppVeyor, TeamCity (not tested), and Git. - Added a lot of the CLI options.
codecov/codecov-exe
Changelog.md
Markdown
mit
16,330
[ 30522, 1001, 1001, 1015, 1012, 2410, 1012, 1014, 1006, 25682, 1011, 6185, 1011, 2385, 1007, 2004, 2112, 1997, 2023, 2713, 2057, 2018, 1031, 2322, 3314, 1033, 1006, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 3642, 3597, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/env python """ ================ sMRI: FreeSurfer ================ This script, smri_freesurfer.py, demonstrates the ability to call reconall on a set of subjects and then make an average subject. python smri_freesurfer.py Import necessary modules from nipype. """ import os import nipype.pipeline.engine as pe import nipype.interfaces.io as nio from nipype.interfaces.freesurfer.preprocess import ReconAll from nipype.interfaces.freesurfer.utils import MakeAverageSubject subject_list = ['s1', 's3'] data_dir = os.path.abspath('data') subjects_dir = os.path.abspath('amri_freesurfer_tutorial/subjects_dir') wf = pe.Workflow(name="l1workflow") wf.base_dir = os.path.abspath('amri_freesurfer_tutorial/workdir') """ Grab data """ datasource = pe.MapNode(interface=nio.DataGrabber(infields=['subject_id'], outfields=['struct']), name='datasource', iterfield=['subject_id']) datasource.inputs.base_directory = data_dir datasource.inputs.template = '%s/%s.nii' datasource.inputs.template_args = dict(struct=[['subject_id', 'struct']]) datasource.inputs.subject_id = subject_list """ Run recon-all """ recon_all = pe.MapNode(interface=ReconAll(), name='recon_all', iterfield=['subject_id', 'T1_files']) recon_all.inputs.subject_id = subject_list if not os.path.exists(subjects_dir): os.mkdir(subjects_dir) recon_all.inputs.subjects_dir = subjects_dir wf.connect(datasource, 'struct', recon_all, 'T1_files') """ Make average subject """ average = pe.Node(interface=MakeAverageSubject(), name="average") average.inputs.subjects_dir = subjects_dir wf.connect(recon_all, 'subject_id', average, 'subjects_ids') wf.run("MultiProc", plugin_args={'n_procs': 4})
FredLoney/nipype
examples/smri_freesurfer.py
Python
bsd-3-clause
1,804
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 18750, 1000, 1000, 1000, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 15488, 3089, 1024, 2489, 26210, 7512, 1027, 1027, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.baidu.disconf.client.core.processor.impl; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.baidu.disconf.client.common.model.DisConfCommonModel; import com.baidu.disconf.client.common.model.DisconfCenterItem; import com.baidu.disconf.client.config.DisClientConfig; import com.baidu.disconf.client.core.processor.DisconfCoreProcessor; import com.baidu.disconf.client.fetcher.FetcherMgr; import com.baidu.disconf.client.store.DisconfStoreProcessor; import com.baidu.disconf.client.store.DisconfStoreProcessorFactory; import com.baidu.disconf.client.store.processor.model.DisconfValue; import com.baidu.disconf.client.watch.WatchMgr; import com.baidu.disconf.core.common.constants.DisConfigTypeEnum; /** * 配置项处理器实现 * * @author liaoqiqi * @version 2014-8-4 */ public class DisconfItemCoreProcessorImpl implements DisconfCoreProcessor { protected static final Logger LOGGER = LoggerFactory.getLogger(DisconfItemCoreProcessorImpl.class); // 监控器 private WatchMgr watchMgr = null; // 抓取器 private FetcherMgr fetcherMgr = null; // 仓库算子 private DisconfStoreProcessor disconfStoreProcessor = DisconfStoreProcessorFactory.getDisconfStoreItemProcessor(); public DisconfItemCoreProcessorImpl(WatchMgr watchMgr, FetcherMgr fetcherMgr) { this.fetcherMgr = fetcherMgr; this.watchMgr = watchMgr; } /** * */ @Override public void processAllItems() { /** * 配置ITEM列表处理 */ for (String key : disconfStoreProcessor.getConfKeySet()) { processOneItem(key); } } @Override public void processOneItem(String key) { LOGGER.debug("==============\tstart to process disconf item: " + key + "\t============================="); DisconfCenterItem disconfCenterItem = (DisconfCenterItem) disconfStoreProcessor.getConfData(key); if (disconfCenterItem != null) { try { updateOneConfItem(key, disconfCenterItem); } catch (Exception e) { LOGGER.error(e.toString(), e); } } } /** * 更新 一个配置 */ private void updateOneConf(String keyName) throws Exception { DisconfCenterItem disconfCenterItem = (DisconfCenterItem) disconfStoreProcessor.getConfData(keyName); if (disconfCenterItem != null) { // 更新仓库 updateOneConfItem(keyName, disconfCenterItem); // 更新实例 inject2OneConf(keyName, disconfCenterItem); } } /** * 更新一个配置 */ private void updateOneConfItem(String keyName, DisconfCenterItem disconfCenterItem) throws Exception { if (disconfCenterItem == null) { throw new Exception("cannot find disconfCenterItem " + keyName); } String value = null; // // 开启disconf才需要远程下载, 否则就用默认值 // if (DisClientConfig.getInstance().ENABLE_DISCONF) { // // 下载配置 // try { String url = disconfCenterItem.getRemoteServerUrl(); value = fetcherMgr.getValueFromServer(url); if (value != null) { LOGGER.debug("value: " + value); } } catch (Exception e) { LOGGER.error("cannot use remote configuration: " + keyName, e); LOGGER.info("using local variable: " + keyName); } LOGGER.debug("download ok."); } // // 注入到仓库中 // disconfStoreProcessor.inject2Store(keyName, new DisconfValue(value, null)); LOGGER.debug("inject ok."); // // Watch // if (DisClientConfig.getInstance().ENABLE_DISCONF) { if (watchMgr != null) { DisConfCommonModel disConfCommonModel = disconfStoreProcessor.getCommonModel(keyName); watchMgr.watchPath(this, disConfCommonModel, keyName, DisConfigTypeEnum.ITEM, value); LOGGER.debug("watch ok."); } else { LOGGER.warn("cannot monitor {} because watch mgr is null", keyName); } } } /** * 更新消息: */ @Override public void updateOneConfAndCallback(String key) throws Exception { // 更新 配置 updateOneConf(key); // 回调 DisconfCoreProcessUtils.callOneConf(disconfStoreProcessor, key); } /** * 某个配置项:注入到实例中 */ private void inject2OneConf(String key, DisconfCenterItem disconfCenterItem) { if (disconfCenterItem == null) { return; } try { Object object = null; Field field = disconfCenterItem.getField(); // // 静态 // if (!Modifier.isStatic(field.getModifiers())) { object = DisconfCoreProcessUtils.getSpringBean(field.getDeclaringClass()); } disconfStoreProcessor.inject2Instance(object, key); } catch (Exception e) { LOGGER.warn(e.toString(), e); } } /** * */ @Override public void inject2Conf() { /** * 配置ITEM列表处理 */ for (String key : disconfStoreProcessor.getConfKeySet()) { LOGGER.debug("==============\tstart to inject value to disconf item instance: " + key + "\t============================="); DisconfCenterItem disconfCenterItem = (DisconfCenterItem) disconfStoreProcessor.getConfData(key); inject2OneConf(key, disconfCenterItem); } } }
fengshao0907/disconf
disconf-client/src/main/java/com/baidu/disconf/client/core/processor/impl/DisconfItemCoreProcessorImpl.java
Java
gpl-2.0
5,926
[ 30522, 7427, 4012, 1012, 21790, 8566, 1012, 12532, 2078, 2546, 1012, 7396, 1012, 4563, 1012, 13151, 1012, 17727, 2140, 1025, 12324, 9262, 1012, 11374, 1012, 8339, 1012, 2492, 1025, 12324, 9262, 1012, 11374, 1012, 8339, 1012, 16913, 18095, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
//>>built define( "dojox/editor/plugins/nls/hr/CollapsibleToolbar", ({ "collapse": "Spusti traku s alatima editora", "expand": "Proširi traku s alatima editora" }) );
cfxram/grails-dojo
web-app/js/dojo/1.7.2/dojox/editor/plugins/nls/hr/CollapsibleToolbar.js
JavaScript
apache-2.0
170
[ 30522, 1013, 1013, 1028, 1028, 2328, 9375, 1006, 1000, 2079, 5558, 2595, 1013, 3559, 1013, 13354, 7076, 1013, 17953, 2015, 1013, 17850, 1013, 8902, 2721, 4523, 7028, 3406, 4747, 8237, 1000, 1010, 1006, 1063, 1000, 7859, 1000, 1024, 1000, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
namespace UnityEditor.ShaderGraph { interface IPropertyFromNode { AbstractShaderProperty AsShaderProperty(); int outputSlotId { get; } } }
Unity-Technologies/ScriptableRenderLoop
com.unity.shadergraph/Editor/Data/Nodes/IPropertyFromNode.cs
C#
mit
167
[ 30522, 3415, 15327, 8499, 2098, 15660, 1012, 8703, 10623, 24342, 1063, 8278, 12997, 18981, 15010, 19699, 5358, 3630, 3207, 1063, 29474, 16102, 2121, 21572, 4842, 3723, 4632, 16102, 2121, 21572, 4842, 3723, 1006, 1007, 1025, 20014, 27852, 1099...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#ifndef __CCB_KEYFRAME_H__ #define __CCB_KEYFRAME_H__ #include "cocos2d.h" #include "ExtensionMacros.h" NS_CC_EXT_BEGIN class CCBKeyframe : public CCObject { private: CCObject *mValue; float mTime; int mEasingType; float mEasingOpt; public: CCBKeyframe(); ~CCBKeyframe(); CCObject* getValue(); void setValue(CCObject *pValue); // retain float getTime(); void setTime(float fTime); int getEasingType(); void setEasingType(int nEasingType); float getEasingOpt(); void setEasingOpt(float fEasingOpt); }; NS_CC_EXT_END #endif // __CCB_KEYFRAME_H__
TukekeSoft/jacos2d-x
src/extensions/CCBReader/CCBKeyframe.h
C
mit
630
[ 30522, 1001, 2065, 13629, 2546, 1035, 1035, 10507, 2497, 1035, 3145, 15643, 1035, 1044, 1035, 1035, 1001, 9375, 1035, 1035, 10507, 2497, 1035, 3145, 15643, 1035, 1044, 1035, 1035, 1001, 2421, 1000, 25033, 2015, 2475, 2094, 1012, 1044, 1000,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="ro"> <head> <!-- Generated by javadoc (version 1.7.0_80) on Mon Jun 20 18:37:22 EEST 2016 --> <title>Uses of Class net.sf.jasperreports.repo.PersistenceUtil (JasperReports 6.3.0 API)</title> <meta name="date" content="2016-06-20"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class net.sf.jasperreports.repo.PersistenceUtil (JasperReports 6.3.0 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../net/sf/jasperreports/repo/PersistenceUtil.html" title="class in net.sf.jasperreports.repo">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?net/sf/jasperreports/repo/class-use/PersistenceUtil.html" target="_top">Frames</a></li> <li><a href="PersistenceUtil.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class net.sf.jasperreports.repo.PersistenceUtil" class="title">Uses of Class<br>net.sf.jasperreports.repo.PersistenceUtil</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../net/sf/jasperreports/repo/PersistenceUtil.html" title="class in net.sf.jasperreports.repo">PersistenceUtil</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#net.sf.jasperreports.repo">net.sf.jasperreports.repo</a></td> <td class="colLast"> <div class="block">Provides support for JasperReports repository.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="net.sf.jasperreports.repo"> <!-- --> </a> <h3>Uses of <a href="../../../../../net/sf/jasperreports/repo/PersistenceUtil.html" title="class in net.sf.jasperreports.repo">PersistenceUtil</a> in <a href="../../../../../net/sf/jasperreports/repo/package-summary.html">net.sf.jasperreports.repo</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../net/sf/jasperreports/repo/package-summary.html">net.sf.jasperreports.repo</a> that return <a href="../../../../../net/sf/jasperreports/repo/PersistenceUtil.html" title="class in net.sf.jasperreports.repo">PersistenceUtil</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>static <a href="../../../../../net/sf/jasperreports/repo/PersistenceUtil.html" title="class in net.sf.jasperreports.repo">PersistenceUtil</a></code></td> <td class="colLast"><span class="strong">PersistenceUtil.</span><code><strong><a href="../../../../../net/sf/jasperreports/repo/PersistenceUtil.html#getInstance(net.sf.jasperreports.engine.JasperReportsContext)">getInstance</a></strong>(<a href="../../../../../net/sf/jasperreports/engine/JasperReportsContext.html" title="interface in net.sf.jasperreports.engine">JasperReportsContext</a>&nbsp;jasperReportsContext)</code>&nbsp;</td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../net/sf/jasperreports/repo/PersistenceUtil.html" title="class in net.sf.jasperreports.repo">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?net/sf/jasperreports/repo/class-use/PersistenceUtil.html" target="_top">Frames</a></li> <li><a href="PersistenceUtil.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small> <span style="font-decoration:none;font-family:Arial,Helvetica,sans-serif;font-size:8pt;font-style:normal;color:#000000;">&copy; 2001 - 2016 TIBCO Software Inc. <a href="http://www.jaspersoft.com" target="_blank" style="color:#000000;">www.jaspersoft.com</a></span> </small></p> </body> </html>
MHTaleb/Encologim
lib/JasperReport/docs/api/net/sf/jasperreports/repo/class-use/PersistenceUtil.html
HTML
gpl-3.0
6,854
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 16129, 1018, 1012, 5890, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, 8917, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
"""Provides device automations for ZHA devices that emit events.""" import voluptuous as vol import homeassistant.components.automation.event as event from homeassistant.components.device_automation import TRIGGER_BASE_SCHEMA from homeassistant.components.device_automation.exceptions import ( InvalidDeviceAutomationConfig, ) from homeassistant.const import CONF_DEVICE_ID, CONF_DOMAIN, CONF_PLATFORM, CONF_TYPE from . import DOMAIN from .core.helpers import async_get_zha_device CONF_SUBTYPE = "subtype" DEVICE = "device" DEVICE_IEEE = "device_ieee" ZHA_EVENT = "zha_event" TRIGGER_SCHEMA = TRIGGER_BASE_SCHEMA.extend( {vol.Required(CONF_TYPE): str, vol.Required(CONF_SUBTYPE): str} ) async def async_validate_trigger_config(hass, config): """Validate config.""" config = TRIGGER_SCHEMA(config) if "zha" in hass.config.components: trigger = (config[CONF_TYPE], config[CONF_SUBTYPE]) try: zha_device = await async_get_zha_device(hass, config[CONF_DEVICE_ID]) except (KeyError, AttributeError): raise InvalidDeviceAutomationConfig if ( zha_device.device_automation_triggers is None or trigger not in zha_device.device_automation_triggers ): raise InvalidDeviceAutomationConfig return config async def async_attach_trigger(hass, config, action, automation_info): """Listen for state changes based on configuration.""" trigger = (config[CONF_TYPE], config[CONF_SUBTYPE]) try: zha_device = await async_get_zha_device(hass, config[CONF_DEVICE_ID]) except (KeyError, AttributeError): return None if trigger not in zha_device.device_automation_triggers: return None trigger = zha_device.device_automation_triggers[trigger] event_config = { event.CONF_PLATFORM: "event", event.CONF_EVENT_TYPE: ZHA_EVENT, event.CONF_EVENT_DATA: {DEVICE_IEEE: str(zha_device.ieee), **trigger}, } event_config = event.TRIGGER_SCHEMA(event_config) return await event.async_attach_trigger( hass, event_config, action, automation_info, platform_type="device" ) async def async_get_triggers(hass, device_id): """List device triggers. Make sure the device supports device automations and if it does return the trigger list. """ zha_device = await async_get_zha_device(hass, device_id) if not zha_device.device_automation_triggers: return triggers = [] for trigger, subtype in zha_device.device_automation_triggers.keys(): triggers.append( { CONF_DEVICE_ID: device_id, CONF_DOMAIN: DOMAIN, CONF_PLATFORM: DEVICE, CONF_TYPE: trigger, CONF_SUBTYPE: subtype, } ) return triggers
pschmitt/home-assistant
homeassistant/components/zha/device_trigger.py
Python
apache-2.0
2,852
[ 30522, 1000, 1000, 1000, 3640, 5080, 19309, 2015, 2005, 1062, 3270, 5733, 2008, 12495, 2102, 2824, 1012, 1000, 1000, 1000, 12324, 5285, 29441, 8918, 2004, 5285, 12324, 2188, 12054, 23137, 2102, 1012, 6177, 1012, 19309, 1012, 2724, 2004, 272...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.twitter.algebird import org.scalatest.FunSuite /** * This is just a compilation test that we can resolve * algebird types from implicit algebra instances. */ class AlgebraResolutionTest extends FunSuite { // A type with no built in algebird algebras trait Empty {} test("algebra.Semigroup") { implicit def fakeSemigroup[T]: algebra.Semigroup[T] = null implicitly[Semigroup[Empty]] } test("algebra.ring.AdditiveSemigroup") { implicit def fakeAdditiveSemigroup[T]: algebra.ring.AdditiveSemigroup[T] = Semigroup.from[T] { (a, b) => a } implicitly[Semigroup[Empty]] } test("algebra.Monoid") { implicit def fakeMonoid[T]: algebra.Monoid[T] = null implicitly[Monoid[Empty]] } test("algebra.ring.AdditiveMonoid") { implicit def fakeAdditiveMonoid[T]: algebra.ring.AdditiveMonoid[T] = Monoid.from[T](null.asInstanceOf[T]) { (a, b) => a } implicitly[Monoid[Empty]] } test("algebra.Group") { implicit def fakeGroup[T]: algebra.Group[T] = null implicitly[Group[Empty]] } test("algebra.ring.AdditiveGroup") { implicit def fakeAdditiveGroup[T]: algebra.ring.AdditiveGroup[T] = implicitly[Group[Null]].asInstanceOf[Group[T]] implicitly[Group[Empty]] } test("algebra.ring.Ring") { implicit def fakeRing[T]: algebra.ring.Ring[T] = null implicitly[Ring[Empty]] } }
nevillelyh/algebird
algebird-core/src/test/scala/com/twitter/algebird/AlgebraResolutionTest.scala
Scala
apache-2.0
1,402
[ 30522, 7427, 4012, 1012, 10474, 1012, 2632, 3351, 9001, 12324, 8917, 1012, 26743, 22199, 1012, 4569, 28880, 2063, 1013, 1008, 1008, 1008, 2023, 2003, 2074, 1037, 6268, 3231, 2008, 2057, 2064, 10663, 1008, 2632, 3351, 9001, 4127, 2013, 24655...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2005-2013 Alfresco Software Limited. * This file is part of Alfresco * Alfresco 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. * Alfresco 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 Alfresco. If not, see <http://www.gnu.org/licenses/>. */ package org.alfresco.po.share.enums; import java.util.NoSuchElementException; /** * This enums used to describe the user roles. * * @author cbairaajoni * @since v1.0 */ public enum UserRole { ALL("All"), MANAGER("Manager"), EDITOR("Editor"), CONSUMER("Consumer"), COLLABORATOR("Collaborator"), COORDINATOR("Coordinator"), CONTRIBUTOR("Contributor"), SITECONSUMER("Site Consumer"), SITECONTRIBUTOR("Site Contributor"), SITEMANAGER("Site Manager"), SITECOLLABORATOR("Site Collaborator"); private String roleName; private UserRole(String role) { roleName = role; } public String getRoleName() { return roleName; } public static UserRole getUserRoleforName(String name) { for (UserRole role : UserRole.values()) { if (role.getRoleName().equalsIgnoreCase(name)) { return role; } } throw new NoSuchElementException("No Role for value - " + name); } }
loftuxab/community-edition-old
projects/share-po/src/main/java/org/alfresco/po/share/enums/UserRole.java
Java
lgpl-3.0
1,846
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2384, 1011, 2286, 24493, 6072, 3597, 4007, 3132, 1012, 1008, 2023, 5371, 2003, 2112, 1997, 24493, 6072, 3597, 1008, 24493, 6072, 3597, 2003, 2489, 4007, 1024, 2017, 2064, 2417, 2923, 3089, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
html, body { margin: 0; padding: 0; font-size: 14px; } body { min-height: 100%; font-family: Roboto; background: #f1f1f1; } a { color: #333333; } article hr { margin: 10px 14px; float: none; width: initial; } .is-logo { float: left; margin-left: 18px; } .logo { margin-left: 15px; font-size: 30px; font-weight: bold; float: left; } .logo:hover { text-decoration: none; } .logo i { margin-left: 5px; color: #e91d00; } header { background: #ffffff; padding: 10px; border-bottom: 1px solid #e8e8e8; position: relative; left: 0; right: 0; z-index: 2; } .searchbox-container { margin-left: 240px; max-width: 400px; } .searchbox-container .input-group { margin-top: 5px; } .searchbox-container .form-control:focus { outline: none; box-shadow: none; } .searchbox-container button { padding-left: 20px; padding-right: 20px; background: #f8f8f8; border-radius: 0; } section { background: #f1f1f1; min-height: 100%; z-index: 1; } section aside { position: absolute; top: 67px; left: 0; bottom: 0; width: 230px; background: #ffffff; border-right: 1px solid #e8e8e8; } .nav { margin: 0 20px; } .nav li a { display: block; padding: 2px 10px; margin: 10px 0; } .nav li a:hover { color: #ffffff; background: #333333; } .nav li.separator { height: 1px; background: #e8e8e8; } section aside h5 { color: #ce1312; margin-left: 30px; text-transform: uppercase; font-size: 10px; margin-top: 20px; } section aside .badge { font-size: 0.8em; background: #bbbbbb; position: relative; top: 1px; } #genres .item { display: block; cursor: pointer; padding: 4px 4px 4px 8px; font-weight: normal; font-size: 0.9em; margin: 0 0 -1px; } #genres .item:hover { background: #333333; color: #ffffff; text-decoration: none; } #genres .active .item { border: 1px solid #ce1312; margin-top: -1px; } #genres .active .badge { background: #333333; } section article { margin-top: 7px; margin-bottom: 10px; margin-left: 237px; margin-right: 10px; padding: 10px 0; max-width: 100%; background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); } .ais-Stats-text { padding-right: 14px; font-size: 0.8em; line-height: 24px; } #hits { padding: 0 15px; } .ais-Pagination { box-shadow: none; border: none; border-radius: initial; padding: 0px; } .ais-Pagination-item { display: inline-block; padding: 0px; } .ais-Pagination-item + .ais-Pagination-item { margin-left: 4px; } .ais-Pagination-item--disabled { display: none; } .ais-Pagination-link { display: block; background: #f8f8f8; padding: 3px 8px; color: #333333; } .ais-Pagination-item--selected .ais-Pagination-link { border-color: #b5b5b5; background: #e8e8e8; } .ais-Pagination-link:hover { text-decoration: none; border-color: #cfcfcf; background: #ebebeb; color: #333333; } .ais-Hits-list { margin: 0; } .ais-Hits-item { margin: 0; padding: 0; border: none; box-shadow: none; width: 100%; } .hit { margin-bottom: 10px; height: 130px; border: 1px solid #f3f3f3; } .hit em { font-style: normal; background: #ffffd4; text-decoration: underline; } .hit .media-object { height: 130px; width: 130px; overflow: hidden; background-size: contain; background-repeat: no-repeat; background-position: center center; } .hit .media-heading { color: #167ac6; font-weight: normal; font-size: 18px; } .hit .media-body { padding: 10px; } .thank-you { font-size: 0.8em; margin-top: 18px; margin-left: 30px; } .thank-you a { color: #ce1312; } .stars { margin-left: 5px; } .star { /* item star */ display: inline-block; width: 1em; height: 1em; } .star:before { content: '\2605'; color: #fbae00; } .star__empty { /* empty star */ display: inline-block; width: 1em; height: 1em; } .star__empty:before { content: '\2606'; color: #fbae00; } .genre, .year { margin: 12px 0; } .genre .badge + .badge { margin-left: 4px; } .year { font-weight: bold; } .genre .badge { background: #bbbbbb; } .ais-RatingMenu { margin: 0 24px 0 28px; }
algolia/react-instantsearch
examples/media/App.css
CSS
mit
4,169
[ 30522, 16129, 1010, 2303, 1063, 7785, 1024, 1014, 1025, 11687, 4667, 1024, 1014, 1025, 15489, 1011, 2946, 1024, 2403, 2361, 2595, 1025, 1065, 2303, 1063, 8117, 1011, 30524, 1001, 20069, 2546, 2487, 2546, 2487, 1025, 1065, 1037, 1063, 3609, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# -*- coding: utf-8 -*- # Dioptas - GUI program for fast processing of 2D X-ray diffraction data # Principal author: Clemens Prescher (clemens.prescher@gmail.com) # Copyright (C) 2014-2019 GSECARS, University of Chicago, USA # Copyright (C) 2015-2018 Institute for Geology and Mineralogy, University of Cologne, Germany # Copyright (C) 2019-2020 DESY, Hamburg, Germany # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import os import numpy as np from copy import deepcopy import h5py from .util import Signal from .util.ImgCorrection import CbnCorrection, ObliqueAngleDetectorAbsorptionCorrection from .util import Pattern from .util.calc import convert_units from . import ImgModel, CalibrationModel, MaskModel, PatternModel, BatchModel from .CalibrationModel import DetectorModes class Configuration(object): """ The configuration class contains a working combination of an ImgModel, PatternModel, MaskModel and CalibrationModel. It does handles the core data manipulation of Dioptas. The management of multiple Configurations is done by the DioptasModel. """ def __init__(self, working_directories=None): super(Configuration, self).__init__() self.img_model = ImgModel() self.mask_model = MaskModel() self.calibration_model = CalibrationModel(self.img_model) self.batch_model = BatchModel(self.calibration_model, self.mask_model) self.pattern_model = PatternModel() if working_directories is None: self.working_directories = {'calibration': '', 'mask': '', 'image': os.path.expanduser("~"), 'pattern': '', 'overlay': '', 'phase': '', 'batch': os.path.expanduser("~")} else: self.working_directories = working_directories self.use_mask = False self.transparent_mask = False self._integration_rad_points = None self._integration_unit = '2th_deg' self._oned_azimuth_range = None self._cake_azimuth_points = 360 self._cake_azimuth_range = None self._auto_integrate_pattern = True self._auto_integrate_cake = False self.auto_save_integrated_pattern = False self.integrated_patterns_file_formats = ['.xy'] self.cake_changed = Signal() self._connect_signals() def _connect_signals(self): """ Connects the img_changed signal to responding functions. """ self.img_model.img_changed.connect(self.update_mask_dimension) self.img_model.img_changed.connect(self.integrate_image_1d) def integrate_image_1d(self): """ Integrates the image in the ImageModel to a Pattern. Will also automatically save the integrated pattern, if auto_save_integrated is True. """ if self.calibration_model.is_calibrated: if self.use_mask: mask = self.mask_model.get_mask() elif self.mask_model.roi is not None: mask = self.mask_model.roi_mask else: mask = None x, y = self.calibration_model.integrate_1d(azi_range=self.oned_azimuth_range, mask=mask, unit=self.integration_unit, num_points=self.integration_rad_points) self.pattern_model.set_pattern(x, y, self.img_model.filename, unit=self.integration_unit) # if self.auto_save_integrated_pattern: self._auto_save_patterns() def integrate_image_2d(self): """ Integrates the image in the ImageModel to a Cake. """ if self.use_mask: mask = self.mask_model.get_mask() elif self.mask_model.roi is not None: mask = self.mask_model.roi_mask else: mask = None self.calibration_model.integrate_2d(mask=mask, rad_points=self._integration_rad_points, azimuth_points=self._cake_azimuth_points, azimuth_range=self._cake_azimuth_range) self.cake_changed.emit() def save_pattern(self, filename=None, subtract_background=False): """ Saves the current integrated pattern. The format depends on the file ending. Possible file formats: [*.xy, *.chi, *.dat, *.fxye] :param filename: where to save the file :param subtract_background: flat whether the pattern should be saved with or without subtracted background """ if filename is None: filename = self.img_model.filename if filename.endswith('.xy'): self.pattern_model.save_pattern(filename, header=self._create_xy_header(), subtract_background=subtract_background) elif filename.endswith('.fxye'): self.pattern_model.save_pattern(filename, header=self._create_fxye_header(filename), subtract_background=subtract_background) else: self.pattern_model.save_pattern(filename, subtract_background=subtract_background) def save_background_pattern(self, filename=None): """ Saves the current fit background as a pattern. The format depends on the file ending. Possible file formats: [*.xy, *.chi, *.dat, *.fxye] """ if filename is None: filename = self.img_model.filename if filename.endswith('.xy'): self.pattern_model.save_auto_background_as_pattern(filename, header=self._create_xy_header()) elif filename.endswith('.fxye'): self.pattern_model.save_auto_background_as_pattern(filename, header=self._create_fxye_header(filename)) else: self.pattern_model.save_pattern(filename) def _create_xy_header(self): """ Creates the header for the xy file format (contains information about calibration parameters). :return: header string """ header = self.calibration_model.create_file_header() header = header.replace('\r\n', '\n') header = header + '\n#\n# ' + self._integration_unit + '\t I' return header def _create_fxye_header(self, filename): """ Creates the header for the fxye file format (used by GSAS and GSAS-II) containing the calibration information :return: header string """ header = 'Generated file ' + filename + ' using DIOPTAS\n' header = header + self.calibration_model.create_file_header() unit = self._integration_unit lam = self.calibration_model.wavelength if unit == 'q_A^-1': con = 'CONQ' else: con = 'CONS' header = header + '\nBANK\t1\tNUM_POINTS\tNUM_POINTS ' + con + '\tMIN_X_VAL\tSTEP_X_VAL ' + \ '{0:.5g}'.format(lam * 1e10) + ' 0.0 FXYE' return header def _auto_save_patterns(self): """ Saves the current pattern in the pattern working directory (specified in self.working_directories['pattern']. When background subtraction is enabled in the pattern model the pattern will be saved with background subtraction and without in another sub-folder. ('bkg_subtracted') """ for file_ending in self.integrated_patterns_file_formats: filename = os.path.join( self.working_directories['pattern'], os.path.basename(str(self.img_model.filename)).split('.')[:-1][0] + file_ending) filename = filename.replace('\\', '/') self.save_pattern(filename) if self.pattern_model.pattern.has_background(): for file_ending in self.integrated_patterns_file_formats: directory = os.path.join(self.working_directories['pattern'], 'bkg_subtracted') if not os.path.exists(directory): os.mkdir(directory) filename = os.path.join(directory, self.pattern_model.pattern.name + file_ending) filename = filename.replace('\\', '/') self.save_pattern(filename, subtract_background=True) def update_mask_dimension(self): """ Updates the shape of the mask in the MaskModel to the shape of the image in the ImageModel. """ self.mask_model.set_dimension(self.img_model._img_data.shape) @property def integration_rad_points(self): return self._integration_rad_points @integration_rad_points.setter def integration_rad_points(self, new_value): self._integration_rad_points = new_value self.integrate_image_1d() if self.auto_integrate_cake: self.integrate_image_2d() @property def cake_azimuth_points(self): return self._cake_azimuth_points @cake_azimuth_points.setter def cake_azimuth_points(self, new_value): self._cake_azimuth_points = new_value if self.auto_integrate_cake: self.integrate_image_2d() @property def cake_azimuth_range(self): return self._cake_azimuth_range @cake_azimuth_range.setter def cake_azimuth_range(self, new_value): self._cake_azimuth_range = new_value if self.auto_integrate_cake: self.integrate_image_2d() @property def oned_azimuth_range(self): return self._oned_azimuth_range @oned_azimuth_range.setter def oned_azimuth_range(self, new_value): self._oned_azimuth_range = new_value if self.auto_integrate_pattern: self.integrate_image_1d() @property def integration_unit(self): return self._integration_unit @integration_unit.setter def integration_unit(self, new_unit): old_unit = self.integration_unit self._integration_unit = new_unit auto_bg_subtraction = self.pattern_model.pattern.auto_background_subtraction if auto_bg_subtraction: self.pattern_model.pattern.auto_background_subtraction = False self.integrate_image_1d() self.update_auto_background_parameters_unit(old_unit, new_unit) if auto_bg_subtraction: self.pattern_model.pattern.auto_background_subtraction = True self.pattern_model.pattern.recalculate_pattern() self.pattern_model.pattern_changed.emit() @property def correct_solid_angle(self): return self.calibration_model.correct_solid_angle @correct_solid_angle.setter def correct_solid_angle(self, new_val): self.calibration_model.correct_solid_angle = new_val if self.auto_integrate_pattern: self.integrate_image_1d() if self._auto_integrate_cake: self.integrate_image_2d() def update_auto_background_parameters_unit(self, old_unit, new_unit): """ This handles the changes for the auto background subtraction parameters in the PatternModel when the integration unit is changed. :param old_unit: possible values are '2th_deg', 'q_A^-1', 'd_A' :param new_unit: possible values are '2th_deg', 'q_A^-1', 'd_A' """ par_0 = convert_units(self.pattern_model.pattern.auto_background_subtraction_parameters[0], self.calibration_model.wavelength, old_unit, new_unit) # Value of 0.1 let background subtraction algorithm work without crash. if np.isnan(par_0): par_0 = 0.1 self.pattern_model.pattern.auto_background_subtraction_parameters = \ par_0, \ self.pattern_model.pattern.auto_background_subtraction_parameters[1], \ self.pattern_model.pattern.auto_background_subtraction_parameters[2] if self.pattern_model.pattern.auto_background_subtraction_roi is not None: self.pattern_model.pattern.auto_background_subtraction_roi = \ convert_units(self.pattern_model.pattern.auto_background_subtraction_roi[0], self.calibration_model.wavelength, old_unit, new_unit), \ convert_units(self.pattern_model.pattern.auto_background_subtraction_roi[1], self.calibration_model.wavelength, old_unit, new_unit) @property def auto_integrate_cake(self): return self._auto_integrate_cake @auto_integrate_cake.setter def auto_integrate_cake(self, new_value): if self._auto_integrate_cake == new_value: return self._auto_integrate_cake = new_value if new_value: self.img_model.img_changed.connect(self.integrate_image_2d) else: self.img_model.img_changed.disconnect(self.integrate_image_2d) @property def auto_integrate_pattern(self): return self._auto_integrate_pattern @auto_integrate_pattern.setter def auto_integrate_pattern(self, new_value): if self._auto_integrate_pattern == new_value: return self._auto_integrate_pattern = new_value if new_value: self.img_model.img_changed.connect(self.integrate_image_1d) else: self.img_model.img_changed.disconnect(self.integrate_image_1d) @property def cake_img(self): return self.calibration_model.cake_img @property def roi(self): return self.mask_model.roi @roi.setter def roi(self, new_val): self.mask_model.roi = new_val self.integrate_image_1d() def copy(self): """ Creates a copy of the current working directory :return: copied configuration :rtype: Configuration """ new_configuration = Configuration(self.working_directories) new_configuration.img_model._img_data = self.img_model._img_data new_configuration.img_model.img_transformations = deepcopy(self.img_model.img_transformations) new_configuration.calibration_model.set_pyFAI(self.calibration_model.get_calibration_parameter()[0]) new_configuration.integrate_image_1d() return new_configuration def save_in_hdf5(self, hdf5_group): """ Saves the configuration group in the given hdf5_group. :type hdf5_group: h5py.Group """ f = hdf5_group # save general information general_information = f.create_group('general_information') # integration parameters: general_information.attrs['integration_unit'] = self.integration_unit if self.integration_rad_points: general_information.attrs['integration_num_points'] = self.integration_rad_points else: general_information.attrs['integration_num_points'] = 0 # cake parameters: general_information.attrs['auto_integrate_cake'] = self.auto_integrate_cake general_information.attrs['cake_azimuth_points'] = self.cake_azimuth_points if self.cake_azimuth_range is None: general_information.attrs['cake_azimuth_range'] = "None" else: general_information.attrs['cake_azimuth_range'] = self.cake_azimuth_range # mask parameters general_information.attrs['use_mask'] = self.use_mask general_information.attrs['transparent_mask'] = self.transparent_mask # auto save parameters general_information.attrs['auto_save_integrated_pattern'] = self.auto_save_integrated_pattern formats = [n.encode('ascii', 'ignore') for n in self.integrated_patterns_file_formats] general_information.create_dataset('integrated_patterns_file_formats', (len(formats), 1), 'S10', formats) # save working directories working_directories_gp = f.create_group('working_directories') try: for key in self.working_directories: working_directories_gp.attrs[key] = self.working_directories[key] except TypeError: self.working_directories = {'calibration': '', 'mask': '', 'image': '', 'pattern': '', 'overlay': '', 'phase': '', 'batch': ''} for key in self.working_directories: working_directories_gp.attrs[key] = self.working_directories[key] # save image model image_group = f.create_group('image_model') image_group.attrs['auto_process'] = self.img_model.autoprocess image_group.attrs['factor'] = self.img_model.factor image_group.attrs['has_background'] = self.img_model.has_background() image_group.attrs['background_filename'] = self.img_model.background_filename image_group.attrs['background_offset'] = self.img_model.background_offset image_group.attrs['background_scaling'] = self.img_model.background_scaling if self.img_model.has_background(): background_data = self.img_model.untransformed_background_data image_group.create_dataset('background_data', background_data.shape, 'f', background_data) image_group.attrs['series_max'] = self.img_model.series_max image_group.attrs['series_pos'] = self.img_model.series_pos # image corrections corrections_group = image_group.create_group('corrections') corrections_group.attrs['has_corrections'] = self.img_model.has_corrections() for correction, correction_object in self.img_model.img_corrections.corrections.items(): if correction in ['cbn', 'oiadac']: correction_data = correction_object.get_data() imcd = corrections_group.create_dataset(correction, correction_data.shape, 'f', correction_data) for param, value in correction_object.get_params().items(): imcd.attrs[param] = value elif correction == 'transfer': params = correction_object.get_params() transfer_group = corrections_group.create_group('transfer') original_data = params['original_data'] response_data = params['response_data'] original_ds = transfer_group.create_dataset('original_data', original_data.shape, 'f', original_data) original_ds.attrs['filename'] = params['original_filename'] response_ds = transfer_group.create_dataset('response_data', response_data.shape, 'f', response_data) response_ds.attrs['filename'] = params['response_filename'] # the actual image image_group.attrs['filename'] = self.img_model.filename current_raw_image = self.img_model.untransformed_raw_img_data raw_image_data = image_group.create_dataset('raw_image_data', current_raw_image.shape, dtype='f') raw_image_data[...] = current_raw_image # image transformations transformations_group = image_group.create_group('image_transformations') for ind, transformation in enumerate(self.img_model.get_transformations_string_list()): transformations_group.attrs[str(ind)] = transformation # save roi data if self.roi is not None: image_group.attrs['has_roi'] = True image_group.create_dataset('roi', (4,), 'i8', tuple(self.roi)) else: image_group.attrs['has_roi'] = False # save mask model mask_group = f.create_group('mask') current_mask = self.mask_model.get_mask() mask_data = mask_group.create_dataset('data', current_mask.shape, dtype=bool) mask_data[...] = current_mask # save detector information detector_group = f.create_group('detector') detector_mode = self.calibration_model.detector_mode detector_group.attrs['detector_mode'] = detector_mode.value if detector_mode == DetectorModes.PREDEFINED: detector_group.attrs['detector_name'] = self.calibration_model.detector.name elif detector_mode == DetectorModes.NEXUS: detector_group.attrs['nexus_filename'] =self.calibration_model.detector.filename # save calibration model calibration_group = f.create_group('calibration_model') calibration_filename = self.calibration_model.filename if calibration_filename.endswith('.poni'): base_filename, ext = self.calibration_model.filename.rsplit('.', 1) else: base_filename = self.calibration_model.filename ext = 'poni' calibration_group.attrs['calibration_filename'] = base_filename + '.' + ext pyfai_param, fit2d_param = self.calibration_model.get_calibration_parameter() pfp = calibration_group.create_group('pyfai_parameters') for key in pyfai_param: try: pfp.attrs[key] = pyfai_param[key] except TypeError: pfp.attrs[key] = '' calibration_group.attrs['correct_solid_angle'] = self.correct_solid_angle if self.calibration_model.distortion_spline_filename is not None: calibration_group.attrs['distortion_spline_filename'] = self.calibration_model.distortion_spline_filename # save background pattern and pattern model background_pattern_group = f.create_group('background_pattern') try: background_pattern_x = self.pattern_model.background_pattern.original_x background_pattern_y = self.pattern_model.background_pattern.original_y except (TypeError, AttributeError): background_pattern_x = None background_pattern_y = None if background_pattern_x is not None and background_pattern_y is not None: background_pattern_group.attrs['has_background_pattern'] = True bgx = background_pattern_group.create_dataset('x', background_pattern_x.shape, dtype='f') bgy = background_pattern_group.create_dataset('y', background_pattern_y.shape, dtype='f') bgx[...] = background_pattern_x bgy[...] = background_pattern_y else: background_pattern_group.attrs['has_background_pattern'] = False pattern_group = f.create_group('pattern') try: pattern_x = self.pattern_model.pattern.original_x pattern_y = self.pattern_model.pattern.original_y except (TypeError, AttributeError): pattern_x = None pattern_y = None if pattern_x is not None and pattern_y is not None: px = pattern_group.create_dataset('x', pattern_x.shape, dtype='f') py = pattern_group.create_dataset('y', pattern_y.shape, dtype='f') px[...] = pattern_x py[...] = pattern_y pattern_group.attrs['pattern_filename'] = self.pattern_model.pattern_filename pattern_group.attrs['unit'] = self.pattern_model.unit pattern_group.attrs['file_iteration_mode'] = self.pattern_model.file_iteration_mode if self.pattern_model.pattern.auto_background_subtraction: pattern_group.attrs['auto_background_subtraction'] = True auto_background_group = pattern_group.create_group('auto_background_settings') auto_background_group.attrs['smoothing'] = \ self.pattern_model.pattern.auto_background_subtraction_parameters[0] auto_background_group.attrs['iterations'] = \ self.pattern_model.pattern.auto_background_subtraction_parameters[1] auto_background_group.attrs['poly_order'] = \ self.pattern_model.pattern.auto_background_subtraction_parameters[2] auto_background_group.attrs['x_start'] = self.pattern_model.pattern.auto_background_subtraction_roi[0] auto_background_group.attrs['x_end'] = self.pattern_model.pattern.auto_background_subtraction_roi[1] else: pattern_group.attrs['auto_background_subtraction'] = False def load_from_hdf5(self, hdf5_group): """ Loads a configuration from the specified hdf5_group. :type hdf5_group: h5py.Group """ f = hdf5_group # disable all automatic functions self.auto_integrate_pattern = False self.auto_integrate_cake = False self.auto_save_integrated_pattern = False # get working directories working_directories = {} for key, value in f.get('working_directories').attrs.items(): if os.path.isdir(value): working_directories[key] = value else: working_directories[key] = '' self.working_directories = working_directories # load pyFAI parameters pyfai_parameters = {} for key, value in f.get('calibration_model').get('pyfai_parameters').attrs.items(): pyfai_parameters[key] = value try: self.calibration_model.set_pyFAI(pyfai_parameters) filename = f.get('calibration_model').attrs['calibration_filename'] (file_path, base_name) = os.path.split(filename) self.calibration_model.filename = filename self.calibration_model.calibration_name = base_name except (KeyError, ValueError): print('Problem with saved pyFAI calibration parameters') pass try: self.correct_solid_angle = f.get('calibration_model').attrs['correct_solid_angle'] except KeyError: pass try: distortion_spline_filename = f.get('calibration_model').attrs['distortion_spline_filename'] self.calibration_model.load_distortion(distortion_spline_filename) except KeyError: pass # load detector definition try: detector_mode = f.get('detector').attrs['detector_mode'] if detector_mode == DetectorModes.PREDEFINED.value: detector_name = f.get('detector').attrs['detector_name'] self.calibration_model.load_detector(detector_name) elif detector_mode == DetectorModes.NEXUS.value: nexus_filename = f.get('detector').attrs['nexus_filename'] self.calibration_model.load_detector_from_file(nexus_filename) except AttributeError: # to ensure backwards compatibility pass # load img_model self.img_model._img_data = np.copy(f.get('image_model').get('raw_image_data')[...]) filename = f.get('image_model').attrs['filename'] self.img_model.filename = filename try: self.img_model.file_name_iterator.update_filename(filename) self.img_model._directory_watcher.path = os.path.dirname(filename) except EnvironmentError: pass self.img_model.autoprocess = f.get('image_model').attrs['auto_process'] self.img_model.autoprocess_changed.emit() self.img_model.factor = f.get('image_model').attrs['factor'] try: self.img_model.series_max = f.get('image_model').attrs['series_max'] self.img_model.series_pos = f.get('image_model').attrs['series_pos'] except KeyError: pass if f.get('image_model').attrs['has_background']: self.img_model.background_data = np.copy(f.get('image_model').get('background_data')[...]) self.img_model.background_filename = f.get('image_model').attrs['background_filename'] self.img_model.background_scaling = f.get('image_model').attrs['background_scaling'] self.img_model.background_offset = f.get('image_model').attrs['background_offset'] # load image transformations transformation_group = f.get('image_model').get('image_transformations') transformation_list = [] for key, transformation in transformation_group.attrs.items(): transformation_list.append(transformation) self.calibration_model.load_transformations_string_list(transformation_list) self.img_model.load_transformations_string_list(transformation_list) # load roi data if f.get('image_model').attrs['has_roi']: self.roi = tuple(f.get('image_model').get('roi')[...]) # load mask model self.mask_model.set_mask(np.copy(f.get('mask').get('data')[...])) # load pattern model if f.get('pattern').get('x') and f.get('pattern').get('y'): self.pattern_model.set_pattern(f.get('pattern').get('x')[...], f.get('pattern').get('y')[...], f.get('pattern').attrs['pattern_filename'], f.get('pattern').attrs['unit']) self.pattern_model.file_iteration_mode = f.get('pattern').attrs['file_iteration_mode'] self.integration_unit = f.get('general_information').attrs['integration_unit'] if f.get('background_pattern').attrs['has_background_pattern']: self.pattern_model.background_pattern = Pattern(f.get('background_pattern').get('x')[...], f.get('background_pattern').get('y')[...], 'background_pattern') if f.get('pattern').attrs['auto_background_subtraction']: bg_params = [] bg_roi = [] bg_params.append(f.get('pattern').get('auto_background_settings').attrs['smoothing']) bg_params.append(f.get('pattern').get('auto_background_settings').attrs['iterations']) bg_params.append(f.get('pattern').get('auto_background_settings').attrs['poly_order']) bg_roi.append(f.get('pattern').get('auto_background_settings').attrs['x_start']) bg_roi.append(f.get('pattern').get('auto_background_settings').attrs['x_end']) self.pattern_model.pattern.set_auto_background_subtraction(bg_params, bg_roi, recalc_pattern=False) # load general configuration if f.get('general_information').attrs['integration_num_points']: self.integration_rad_points = f.get('general_information').attrs['integration_num_points'] # cake parameters: self.auto_integrate_cake = f.get('general_information').attrs['auto_integrate_cake'] try: self.cake_azimuth_points = f.get('general_information').attrs['cake_azimuth_points'] except KeyError as e: pass try: if f.get('general_information').attrs['cake_azimuth_range'] == "None": self.cake_azimuth_range = None else: self.cake_azimuth_range = f.get('general_information').attrs['cake_azimuth_range'] except KeyError as e: pass # mask parameters self.use_mask = f.get('general_information').attrs['use_mask'] self.transparent_mask = f.get('general_information').attrs['transparent_mask'] # corrections if f.get('image_model').get('corrections').attrs['has_corrections']: for name, correction_group in f.get('image_model').get('corrections').items(): params = {} for param, val in correction_group.attrs.items(): params[param] = val if name == 'cbn': tth_array = 180.0 / np.pi * self.calibration_model.pattern_geometry.ttha azi_array = 180.0 / np.pi * self.calibration_model.pattern_geometry.chia cbn_correction = CbnCorrection(tth_array=tth_array, azi_array=azi_array) cbn_correction.set_params(params) cbn_correction.update() self.img_model.add_img_correction(cbn_correction, name) elif name == 'oiadac': tth_array = 180.0 / np.pi * self.calibration_model.pattern_geometry.ttha azi_array = 180.0 / np.pi * self.calibration_model.pattern_geometry.chia oiadac = ObliqueAngleDetectorAbsorptionCorrection(tth_array=tth_array, azi_array=azi_array) oiadac.set_params(params) oiadac.update() self.img_model.add_img_correction(oiadac, name) elif name == 'transfer': params = { 'original_data': correction_group.get('original_data')[...], 'original_filename': correction_group.get('original_data').attrs['filename'], 'response_data': correction_group.get('response_data')[...], 'response_filename': correction_group.get('response_data').attrs['filename'] } self.img_model.transfer_correction.set_params(params) self.img_model.enable_transfer_function() # autosave parameters self.auto_save_integrated_pattern = f.get('general_information').attrs['auto_save_integrated_pattern'] self.integrated_patterns_file_formats = [] for file_format in f.get('general_information').get('integrated_patterns_file_formats'): self.integrated_patterns_file_formats.append(file_format[0].decode('utf-8')) if self.calibration_model.is_calibrated: self.integrate_image_1d() else: self.pattern_model.pattern.recalculate_pattern()
Dioptas/Dioptas
dioptas/model/Configuration.py
Python
gpl-3.0
34,175
[ 30522, 1001, 1011, 1008, 1011, 16861, 1024, 21183, 30524, 1001, 4487, 7361, 10230, 1011, 26458, 2565, 2005, 3435, 6364, 1997, 14134, 1060, 1011, 4097, 4487, 4246, 25533, 2951, 1001, 4054, 3166, 1024, 27277, 3653, 22842, 2099, 1006, 27277, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace Core\Entity; use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Event\LifecycleEventArgs; /** * Agenda * * @ORM\Table(name="saa.agenda") * @ORM\Entity(repositoryClass="Core\Repository\AgendaRepository") * @ORM\HasLifecycleCallbacks */ class Agenda { /** * @var integer * * @ORM\Column(name="id", type="bigint", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="SEQUENCE") * @ORM\SequenceGenerator(sequenceName="saa.agenda_id_seq", allocationSize=1, initialValue=1) */ private $id; /** * @var \DateTime * * @ORM\Column(name="data", type="date", nullable=false) */ private $data; /** * @var boolean * * @ORM\Column(name="fl_ocorreu", type="boolean", nullable=false) */ private $flOcorreu; /** * @var \DateTime * * @ORM\Column(name="hora_inicio", type="time", nullable=true) */ private $horaInicio; /** * @var \DateTime * * @ORM\Column(name="hora_fim", type="time", nullable=true) */ private $horaFim; /** * @var \Doctrine\Common\Collections\Collection * * @ORM\ManyToMany(targetEntity="Core\Entity\Acompanhamento", mappedBy="idAgenda") */ private $idAcompanhamento; /** * Constructor */ public function __construct() { $this->idAcompanhamento = new \Doctrine\Common\Collections\ArrayCollection(); } /** * @ORM\PostLoad */ public function postLoad( LifecycleEventArgs $event ) { $obj = $event->getObject(); if( $obj instanceof \Core\Entity\Agenda ) { $this->data = $obj->data->format( "d/m/Y" ); $this->horaInicio = $obj->horaInicio->format( "H:i" ); $this->horaFim = $obj->horaFim->format( "H:i" ); } } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set data * * @param \DateTime $data * @return Agenda */ public function setData($data) { $this->data = $data; return $this; } /** * Get data * * @return \DateTime */ public function getData() { return $this->data; } /** * Set flOcorreu * * @param boolean $flOcorreu * @return Agenda */ public function setFlOcorreu($flOcorreu) { $this->flOcorreu = $flOcorreu; return $this; } /** * Get flOcorreu * * @return boolean */ public function getFlOcorreu() { return $this->flOcorreu; } /** * Set horaInicio * * @param \DateTime $horaInicio * @return Agenda */ public function setHoraInicio($horaInicio) { $this->horaInicio = $horaInicio; return $this; } /** * Get horaInicio * * @return \DateTime */ public function getHoraInicio() { return $this->horaInicio; } /** * Set horaFim * * @param \DateTime $horaFim * @return Agenda */ public function setHoraFim($horaFim) { $this->horaFim = $horaFim; return $this; } /** * Get horaFim * * @return \DateTime */ public function getHoraFim() { return $this->horaFim; } /** * Add idAcompanhamento * * @param \Core\Entity\Acompanhamento $idAcompanhamento * @return Agenda */ public function addIdAcompanhamento(\Core\Entity\Acompanhamento $idAcompanhamento) { $this->idAcompanhamento[] = $idAcompanhamento; return $this; } /** * Remove idAcompanhamento * * @param \Core\Entity\Acompanhamento $idAcompanhamento */ public function removeIdAcompanhamento(\Core\Entity\Acompanhamento $idAcompanhamento) { $this->idAcompanhamento->removeElement($idAcompanhamento); } /** * Get idAcompanhamento * * @return \Doctrine\Common\Collections\Collection */ public function getIdAcompanhamento() { return $this->idAcompanhamento; } public function exchangeArray($data) { $this->id = (!empty($data['id'])) ? $data['id'] : null; $this->data = (!empty($data['data'])) ? \DateTime::createFromFormat('d/m/Y', $data['data']) : null; $this->flOcorreu = (!empty($data['fl_ocorreu'])) ? $data['fl_ocorreu'] : false; $this->horaInicio = (!empty($data['horaInicio'])) ? \DateTime::createFromFormat('H:i', $data['horaInicio']) : null; $this->horaFim = (!empty($data['horaFim'])) ? \DateTime::createFromFormat('H:i', $data['horaFim']) : null; } public function getArrayCopy() { return get_object_vars($this); } }
ifce-gp-20151/saa
module/Core/src/Core/Entity/Agenda.php
PHP
mit
4,827
[ 30522, 1026, 1029, 25718, 3415, 15327, 4563, 1032, 9178, 1025, 2224, 8998, 1032, 2030, 2213, 1032, 12375, 2004, 2030, 2213, 1025, 2224, 8998, 1032, 2030, 2213, 1032, 2724, 1032, 2166, 23490, 18697, 12380, 10623, 2015, 1025, 1013, 1008, 1008...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#ifndef IMAGECONVERTER_HPP #define IMAGECONVERTER_HPP #include <QImage> #include <QDebug> #include <opencv2/core.hpp> #include <opencv2/imgproc.hpp> #include "Logger.hpp" class ImageConverter { public: ImageConverter() = default; static QImage Mat2QImage(const cv::Mat &cvImage); static cv::Mat QImage2Mat(const QImage& image); }; #endif // IMAGECONVERTER_HPP
czimbortibor/Large-annotated-image-collection-management
utils/ImageConverter.hpp
C++
gpl-3.0
378
[ 30522, 1001, 2065, 13629, 2546, 3746, 8663, 16874, 2121, 1035, 6522, 2361, 1001, 9375, 3746, 8663, 16874, 2121, 1035, 6522, 2361, 1001, 2421, 1026, 18816, 26860, 1028, 1001, 2421, 1026, 1053, 3207, 8569, 2290, 1028, 1001, 2421, 1026, 2330, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * * @author Krios Mane * @version 0.1 * @license https://opensource.org/licenses/GPL-3.0 * */ defined('BASEPATH') OR exit('No direct script access allowed'); class Shop extends CI_Controller { /** * */ function __construct() { parent::__construct(); $this->load->library("session"); session_write_close(); //avoid freezing page $this->config->load('fabtotum'); $this->load->helper('shop_helper'); } /** * */ public function filaments() { $filaments = loadShopFilaments(); $this->output->set_content_type('application/json')->set_output(json_encode($filaments)); } /** * */ public function homepage() { $homepage = loadHomePageProducts(); $this->output->set_content_type('application/json')->set_output(json_encode($homepage)); } } ?>
FABtotum/colibri-fabui
fabui/application/controllers/Shop.php
PHP
gpl-2.0
804
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1008, 1030, 3166, 1047, 9488, 2015, 23055, 1008, 1030, 2544, 1014, 1012, 1015, 1008, 1030, 6105, 16770, 1024, 1013, 1013, 7480, 8162, 3401, 1012, 8917, 1013, 15943, 1013, 14246, 2140, 1011, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
extern alias SSmDsClient; using System; using System.Collections.Generic; using System.Linq; using OpenRiaServices.DomainServices.Client; using Cities; using Microsoft.Silverlight.Testing; using Microsoft.VisualStudio.TestTools.UnitTesting; using DataTests.Northwind.LTS; using System.ComponentModel.DataAnnotations; using OpenRiaServices.Silverlight.Testing; namespace OpenRiaServices.DomainServices.Client.Test { using Resource = SSmDsClient::OpenRiaServices.DomainServices.Client.Resource; using Resources = SSmDsClient::OpenRiaServices.DomainServices.Client.Resources; #region Test Classes public class TestOperation : OperationBase { private Action<TestOperation> _completeAction; public TestOperation(Action<TestOperation> completeAction, object userState) : base(userState) { this._completeAction = completeAction; } protected override bool SupportsCancellation { get { return true; } } protected override void CancelCore() { base.CancelCore(); } public new void Complete(Exception error) { base.Complete(error); } public new void Complete(object result) { base.Complete(result); } public new void Cancel() { base.Cancel(); } /// <summary> /// Invoke the completion callback. /// </summary> protected override void InvokeCompleteAction() { if (this._completeAction != null) { this._completeAction(this); } } } #endregion /// <summary> /// Targeted tests for OperationBase and derived classes /// </summary> [TestClass] public class OperationTests : UnitTestBase { public void Operation_MarkAsHandled() { TestDataContext ctxt = new TestDataContext(new Uri(TestURIs.RootURI, "TestDomainServices-TestCatalog1.svc")); var query = ctxt.CreateQuery<Product>("ThrowGeneralException", null, false, true); LoadOperation lo = new LoadOperation<Product>(query, LoadBehavior.KeepCurrent, null, null, null); EventHandler action = (o, e) => { LoadOperation loadOperation = (LoadOperation)o; if (loadOperation.HasError) { loadOperation.MarkErrorAsHandled(); } }; lo.Completed += action; DomainOperationException ex = new DomainOperationException("Operation Failed!", OperationErrorStatus.ServerError, 42, "StackTrace"); lo.Complete(ex); // verify that calling MarkAsHandled again is a noop lo.MarkErrorAsHandled(); lo.MarkErrorAsHandled(); // verify that calling MarkAsHandled on an operation not in error // results in an exception lo = new LoadOperation<Product>(query, LoadBehavior.KeepCurrent, null, null, null); Assert.IsFalse(lo.HasError); Assert.IsTrue(lo.IsErrorHandled); ExceptionHelper.ExpectInvalidOperationException(delegate { lo.MarkErrorAsHandled(); }, Resource.Operation_HasErrorMustBeTrue); } /// <summary> /// Verify that Load operations that don't specify a callback to handle /// errors and don't specify throwOnError = false result in an exception. /// </summary> [TestMethod] public void UnhandledLoadOperationError() { TestDataContext ctxt = new TestDataContext(new Uri(TestURIs.RootURI, "TestDomainServices-TestCatalog1.svc")); var query = ctxt.CreateQuery<Product>("ThrowGeneralException", null, false, true); LoadOperation lo = new LoadOperation<Product>(query, LoadBehavior.KeepCurrent, null, null, null); DomainOperationException expectedException = null; DomainOperationException ex = new DomainOperationException("Operation Failed!", OperationErrorStatus.ServerError, 42, "StackTrace"); try { lo.Complete(ex); } catch (DomainOperationException e) { expectedException = e; } // verify the exception properties Assert.IsNotNull(expectedException); Assert.AreEqual(string.Format(Resource.DomainContext_LoadOperationFailed, "ThrowGeneralException", ex.Message), expectedException.Message); Assert.AreEqual(ex.StackTrace, expectedException.StackTrace); Assert.AreEqual(ex.Status, expectedException.Status); Assert.AreEqual(ex.ErrorCode, expectedException.ErrorCode); Assert.AreEqual(false, lo.IsErrorHandled); // now test again with validation errors expectedException = null; ValidationResult[] validationErrors = new ValidationResult[] { new ValidationResult("Foo", new string[] { "Bar" }) }; lo = new LoadOperation<Product>(query, LoadBehavior.KeepCurrent, null, null, null); try { lo.Complete(validationErrors); } catch (DomainOperationException e) { expectedException = e; } // verify the exception properties Assert.IsNotNull(expectedException); Assert.AreEqual(string.Format(Resource.DomainContext_LoadOperationFailed_Validation, "ThrowGeneralException"), expectedException.Message); } /// <summary> /// Verify that Load operations that don't specify a callback to handle /// errors and don't specify throwOnError = false result in an exception. /// </summary> [TestMethod] public void UnhandledInvokeOperationError() { CityDomainContext cities = new CityDomainContext(TestURIs.Cities); InvokeOperation invoke = new InvokeOperation("Echo", null, null, null, null); DomainOperationException expectedException = null; DomainOperationException ex = new DomainOperationException("Operation Failed!", OperationErrorStatus.ServerError, 42, "StackTrace"); try { invoke.Complete(ex); } catch (DomainOperationException e) { expectedException = e; } // verify the exception properties Assert.IsNotNull(expectedException); Assert.AreEqual(string.Format(Resource.DomainContext_InvokeOperationFailed, "Echo", ex.Message), expectedException.Message); Assert.AreEqual(ex.StackTrace, expectedException.StackTrace); Assert.AreEqual(ex.Status, expectedException.Status); Assert.AreEqual(ex.ErrorCode, expectedException.ErrorCode); Assert.AreEqual(false, invoke.IsErrorHandled); // now test again with validation errors expectedException = null; ValidationResult[] validationErrors = new ValidationResult[] { new ValidationResult("Foo", new string[] { "Bar" }) }; invoke = new InvokeOperation("Echo", null, null, null, null); try { invoke.Complete(validationErrors); } catch (DomainOperationException e) { expectedException = e; } // verify the exception properties Assert.IsNotNull(expectedException); Assert.AreEqual(string.Format(Resource.DomainContext_InvokeOperationFailed_Validation, "Echo"), expectedException.Message); } /// <summary> /// Verify that Load operations that don't specify a callback to handle /// errors and don't specify throwOnError = false result in an exception. /// </summary> [TestMethod] public void UnhandledSubmitOperationError() { CityDomainContext cities = new CityDomainContext(TestURIs.Cities); CityData data = new CityData(); cities.Cities.LoadEntities(data.Cities.ToArray()); City city = cities.Cities.First(); city.ZoneID = 1; Assert.IsTrue(cities.EntityContainer.HasChanges); SubmitOperation submit = new SubmitOperation(cities.EntityContainer.GetChanges(), null, null, null); DomainOperationException expectedException = null; DomainOperationException ex = new DomainOperationException("Submit Failed!", OperationErrorStatus.ServerError, 42, "StackTrace"); try { submit.Complete(ex); } catch (DomainOperationException e) { expectedException = e; } // verify the exception properties Assert.IsNotNull(expectedException); Assert.AreEqual(string.Format(Resource.DomainContext_SubmitOperationFailed, ex.Message), expectedException.Message); Assert.AreEqual(ex.StackTrace, expectedException.StackTrace); Assert.AreEqual(ex.Status, expectedException.Status); Assert.AreEqual(ex.ErrorCode, expectedException.ErrorCode); Assert.AreEqual(false, submit.IsErrorHandled); // now test again with conflicts expectedException = null; IEnumerable<ChangeSetEntry> entries = ChangeSetBuilder.Build(cities.EntityContainer.GetChanges()); ChangeSetEntry entry = entries.First(); entry.ValidationErrors = new ValidationResultInfo[] { new ValidationResultInfo("Foo", new string[] { "Bar" }) }; submit = new SubmitOperation(cities.EntityContainer.GetChanges(), null, null, null); try { submit.Complete(OperationErrorStatus.Conflicts); } catch (DomainOperationException e) { expectedException = e; } // verify the exception properties Assert.IsNotNull(expectedException); Assert.AreEqual(string.Format(Resource.DomainContext_SubmitOperationFailed_Conflicts), expectedException.Message); // now test again with validation errors expectedException = null; entries = ChangeSetBuilder.Build(cities.EntityContainer.GetChanges()); entry = entries.First(); entry.ConflictMembers = new string[] { "ZoneID" }; submit = new SubmitOperation(cities.EntityContainer.GetChanges(), null, null, null); try { submit.Complete(OperationErrorStatus.ValidationFailed); } catch (DomainOperationException e) { expectedException = e; } // verify the exception properties Assert.IsNotNull(expectedException); Assert.AreEqual(string.Format(Resource.DomainContext_SubmitOperationFailed_Validation, ex.Message), expectedException.Message); } [TestMethod] [Asynchronous] [Description("Verifies that cached LoadOperation Entity results are valid when accessed from the complete callback.")] public void Bug706034_AccessCachedEntityResultsInCallback() { Cities.CityDomainContext cities = new CityDomainContext(TestURIs.Cities); bool callbackCalled = false; Exception callbackException = null; Action<LoadOperation<City>> callback = (op) => { if (op.HasError) { op.MarkErrorAsHandled(); } try { Assert.AreEqual(11, op.AllEntities.Count()); Assert.AreEqual(11, op.Entities.Count()); } catch (Exception e) { callbackException = e; } finally { callbackCalled = true; } }; var q = cities.GetCitiesQuery(); LoadOperation<City> lo = cities.Load(q, callback, null); // KEY to bug : access Entity collections to force them to cache IEnumerable<City> entities = lo.Entities; IEnumerable<Entity> allEntities = lo.AllEntities; EnqueueConditional(() => lo.IsComplete && callbackCalled); EnqueueCallback(delegate { Assert.IsNull(callbackException); Assert.IsNull(lo.Error); Assert.AreEqual(11, lo.AllEntities.Count()); Assert.AreEqual(11, lo.Entities.Count()); }); EnqueueTestComplete(); } [TestMethod] [Description("Verifies that exceptions are thrown and callstacks are preserved.")] public void Exceptions() { Cities.CityDomainContext cities = new CityDomainContext(TestURIs.Cities); Action<LoadOperation<City>> loCallback = (op) => { if (op.HasError) { op.MarkErrorAsHandled(); } throw new InvalidOperationException("Fnord!"); }; Action<SubmitOperation> soCallback = (op) => { if (op.HasError) { op.MarkErrorAsHandled(); } throw new InvalidOperationException("Fnord!"); }; Action<InvokeOperation> ioCallback = (op) => { if (op.HasError) { op.MarkErrorAsHandled(); } throw new InvalidOperationException("Fnord!"); }; LoadOperation lo = new LoadOperation<City>(cities.GetCitiesQuery(), LoadBehavior.MergeIntoCurrent, loCallback, null, loCallback); // verify completion callbacks that throw ExceptionHelper.ExpectInvalidOperationException(delegate { try { lo.Complete(DomainClientResult.CreateQueryResult(new Entity[0], new Entity[0], 0, new ValidationResult[0])); } catch (Exception ex) { Assert.IsTrue(ex.StackTrace.Contains("at OpenRiaServices.DomainServices.Client.Test.OperationTests"), "Stacktrace not preserved."); throw; } }, "Fnord!"); // verify cancellation callbacks for all fx operation types lo = new LoadOperation<City>(cities.GetCitiesQuery(), LoadBehavior.MergeIntoCurrent, null, null, loCallback); ExceptionHelper.ExpectInvalidOperationException(delegate { lo.Cancel(); }, "Fnord!"); SubmitOperation so = new SubmitOperation(cities.EntityContainer.GetChanges(), soCallback, null, soCallback); ExceptionHelper.ExpectInvalidOperationException(delegate { so.Cancel(); }, "Fnord!"); InvokeOperation io = new InvokeOperation("Fnord", null, null, null, ioCallback); ExceptionHelper.ExpectInvalidOperationException(delegate { io.Cancel(); }, "Fnord!"); } /// <summary> /// Attempt to call cancel from the completion callback. Expect /// an exception since the operation is already complete. /// </summary> [TestMethod] [Asynchronous] public void Bug706066_CancelInCallback() { Cities.CityDomainContext cities = new CityDomainContext(TestURIs.Cities); bool callbackCalled = false; InvalidOperationException expectedException = null; Action<LoadOperation<City>> callback = (op) => { if (op.HasError) { op.MarkErrorAsHandled(); } // verify that CanCancel is false even though we'll // ignore this and try below Assert.IsFalse(op.CanCancel); try { op.Cancel(); } catch (InvalidOperationException io) { expectedException = io; } callbackCalled = true; }; var q = cities.GetCitiesQuery().Take(1); LoadOperation lo = cities.Load(q, callback, null); EnqueueConditional(() => lo.IsComplete && callbackCalled); EnqueueCallback(delegate { Assert.IsFalse(lo.IsCanceled); Assert.AreEqual(Resources.AsyncOperation_AlreadyCompleted, expectedException.Message); }); EnqueueTestComplete(); } } }
jeffhandley/OpenRiaServices
OpenRiaServices.DomainServices.Client/Test/Silverlight/Data/OperationTests.cs
C#
apache-2.0
17,162
[ 30522, 4654, 16451, 14593, 7020, 26876, 11020, 8751, 3372, 1025, 2478, 2291, 1025, 2478, 2291, 1012, 6407, 1012, 12391, 1025, 2478, 2291, 1012, 11409, 4160, 1025, 2478, 2330, 4360, 8043, 7903, 2229, 1012, 13100, 2121, 7903, 2229, 1012, 7396...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.13"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>fh-dotnet-sdk: FHSDK/API/FHCloudRequest.cs File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">fh-dotnet-sdk &#160;<span id="projectnumber">1.3.9</span> </div> <div id="projectbrief">FeedHenry C#/.Net Native SDK (WP and Xamarin)</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.13 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('_f_h_cloud_request_8cs.html','');}); </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> &#124; <a href="#namespaces">Namespaces</a> </div> <div class="headertitle"> <div class="title">FHCloudRequest.cs File Reference</div> </div> </div><!--header--> <div class="contents"> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> Classes</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_f_h_s_d_k_1_1_a_p_i_1_1_f_h_cloud_request.html">FHSDK.API.FHCloudRequest</a></td></tr> <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Class represents cloud requests. <a href="class_f_h_s_d_k_1_1_a_p_i_1_1_f_h_cloud_request.html#details">More...</a><br /></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a> Namespaces</h2></td></tr> <tr class="memitem:namespace_f_h_s_d_k_1_1_a_p_i"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_f_h_s_d_k_1_1_a_p_i.html">FHSDK.API</a></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> </div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="dir_62894b74a7fb75891ba900def47f0d7a.html">FHSDK</a></li><li class="navelem"><a class="el" href="dir_9a5d28c5a22bb020b5048d5af04cc036.html">API</a></li><li class="navelem"><a class="el" href="_f_h_cloud_request_8cs.html">FHCloudRequest.cs</a></li> <li class="footer">Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li> </ul> </div> </body> </html>
feedhenry/fh-dotnet-sdk
Documentations/html/_f_h_cloud_request_8cs.html
HTML
apache-2.0
5,150
[ 30522, 1026, 999, 9986, 13874, 30524, 1060, 11039, 19968, 2487, 1013, 26718, 2094, 1013, 1060, 11039, 19968, 2487, 1011, 17459, 1012, 26718, 2094, 1000, 1028, 1026, 16129, 20950, 3619, 1027, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE194_Unexpected_Sign_Extension__fgets_malloc_03.c Label Definition File: CWE194_Unexpected_Sign_Extension.label.xml Template File: sources-sink-03.tmpl.c */ /* * @description * CWE: 194 Unexpected Sign Extension * BadSource: fgets Read data from the console using fgets() * GoodSource: Positive integer * Sink: malloc * BadSink : Allocate memory using malloc() with the size of data * Flow Variant: 03 Control flow: if(5==5) and if(5!=5) * * */ #include "std_testcase.h" /* Must be at least 8 for atoi() to work properly */ #define CHAR_ARRAY_SIZE 8 #ifndef OMITBAD void CWE194_Unexpected_Sign_Extension__fgets_malloc_03_bad() { short data; /* Initialize data */ data = 0; if(5==5) { { char inputBuffer[CHAR_ARRAY_SIZE] = ""; /* FLAW: Use a value input from the console using fgets() */ if (fgets(inputBuffer, CHAR_ARRAY_SIZE, stdin) != NULL) { /* Convert to short */ data = (short)atoi(inputBuffer); } else { printLine("fgets() failed."); } } } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); if (dataBuffer == NULL) {exit(-1);} /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B1() - use goodsource and badsink by changing the 5==5 to 5!=5 */ static void goodG2B1() { short data; /* Initialize data */ data = 0; if(5!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ printLine("Benign, fixed string"); } else { /* FIX: Use a positive integer less than &InitialDataSize&*/ data = 100-1; } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); if (dataBuffer == NULL) {exit(-1);} /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } /* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */ static void goodG2B2() { short data; /* Initialize data */ data = 0; if(5==5) { /* FIX: Use a positive integer less than &InitialDataSize&*/ data = 100-1; } /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); if (dataBuffer == NULL) {exit(-1);} /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } void CWE194_Unexpected_Sign_Extension__fgets_malloc_03_good() { goodG2B1(); goodG2B2(); } #endif /* OMITGOOD */ /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ #ifdef INCLUDEMAIN int main(int argc, char * argv[]) { /* seed randomness */ srand( (unsigned)time(NULL) ); #ifndef OMITGOOD printLine("Calling good()..."); CWE194_Unexpected_Sign_Extension__fgets_malloc_03_good(); printLine("Finished good()"); #endif /* OMITGOOD */ #ifndef OMITBAD printLine("Calling bad()..."); CWE194_Unexpected_Sign_Extension__fgets_malloc_03_bad(); printLine("Finished bad()"); #endif /* OMITBAD */ return 0; } #endif
JianpingZeng/xcc
xcc/test/juliet/testcases/CWE194_Unexpected_Sign_Extension/s01/CWE194_Unexpected_Sign_Extension__fgets_malloc_03.c
C
bsd-3-clause
4,693
[ 30522, 1013, 1008, 23561, 7013, 3231, 18382, 5371, 5371, 18442, 1024, 19296, 2063, 16147, 2549, 1035, 9223, 1035, 3696, 1035, 5331, 1035, 1035, 1042, 18150, 2015, 1035, 6670, 10085, 1035, 6021, 1012, 1039, 3830, 6210, 5371, 1024, 19296, 206...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html id="htmlId"> <head> <title>Coverage Report :: DuplicateCheck</title> <style type="text/css"> @import "../../.css/coverage.css"; </style> </head> <body> <div class="header"></div> <div class="content"> <div class="breadCrumbs"> [ <a href="../../index.html">all classes</a> ] [ <a href="../index.html">net.sf.jabref.model</a> ] </div> <h1>Coverage Summary for Class: DuplicateCheck (net.sf.jabref.model)</h1> <table class="coverageStats"> <tr> <th class="name">Class</th> <th class="coverageStat "> Class, % </th> <th class="coverageStat "> Method, % </th> <th class="coverageStat "> Line, % </th> </tr> <tr> <td class="name">DuplicateCheck</td> <td class="coverageStat"> <span class="percent"> 0% </span> <span class="absValue"> (0/ 1) </span> </td> <td class="coverageStat"> <span class="percent"> 0% </span> <span class="absValue"> (0/ 10) </span> </td> <td class="coverageStat"> <span class="percent"> 0% </span> <span class="absValue"> (0/ 133) </span> </td> </tr> </table> <br/> <br/> <div class="sourceCode"><i>1</i>&nbsp;package net.sf.jabref.model; <i>2</i>&nbsp; <i>3</i>&nbsp;import java.util.HashMap; <i>4</i>&nbsp;import java.util.HashSet; <i>5</i>&nbsp;import java.util.List; <i>6</i>&nbsp;import java.util.Map; <i>7</i>&nbsp;import java.util.Optional; <i>8</i>&nbsp;import java.util.Set; <i>9</i>&nbsp; <i>10</i>&nbsp;import net.sf.jabref.model.database.BibDatabase; <i>11</i>&nbsp;import net.sf.jabref.model.database.BibDatabaseMode; <i>12</i>&nbsp;import net.sf.jabref.model.entry.AuthorList; <i>13</i>&nbsp;import net.sf.jabref.model.entry.BibEntry; <i>14</i>&nbsp;import net.sf.jabref.model.entry.EntryType; <i>15</i>&nbsp;import net.sf.jabref.model.entry.FieldName; <i>16</i>&nbsp;import net.sf.jabref.model.entry.FieldProperty; <i>17</i>&nbsp;import net.sf.jabref.model.entry.InternalBibtexFields; <i>18</i>&nbsp; <i>19</i>&nbsp;import org.apache.commons.logging.Log; <i>20</i>&nbsp;import org.apache.commons.logging.LogFactory; <i>21</i>&nbsp; <i>22</i>&nbsp;/** <i>23</i>&nbsp; * This class contains utility method for duplicate checking of entries. <i>24</i>&nbsp; */ <b class="nc"><i>25</i>&nbsp;public class DuplicateCheck {</b> <i>26</i>&nbsp; <b class="nc"><i>27</i>&nbsp; private static final Log LOGGER = LogFactory.getLog(DuplicateCheck.class);</b> <i>28</i>&nbsp; <i>29</i>&nbsp; /* <i>30</i>&nbsp; * Integer values for indicating result of duplicate check (for entries): <i>31</i>&nbsp; * <i>32</i>&nbsp; */ <i>33</i>&nbsp; private static final int NOT_EQUAL = 0; <i>34</i>&nbsp; private static final int EQUAL = 1; <i>35</i>&nbsp; private static final int EMPTY_IN_ONE = 2; <i>36</i>&nbsp; private static final int EMPTY_IN_TWO = 3; <i>37</i>&nbsp; private static final int EMPTY_IN_BOTH = 4; <i>38</i>&nbsp; <b class="nc"><i>39</i>&nbsp; public static double duplicateThreshold = 0.75; // The overall threshold to signal a duplicate pair</b> <i>40</i>&nbsp; // Non-required fields are investigated only if the required fields give a value within <i>41</i>&nbsp; // the doubt range of the threshold: <i>42</i>&nbsp; private static final double DOUBT_RANGE = 0.05; <i>43</i>&nbsp; <i>44</i>&nbsp; private static final double REQUIRED_WEIGHT = 3; // Weighting of all required fields <i>45</i>&nbsp; <i>46</i>&nbsp; // Extra weighting of those fields that are most likely to provide correct duplicate detection: <b class="nc"><i>47</i>&nbsp; private static final Map&lt;String, Double&gt; FIELD_WEIGHTS = new HashMap&lt;&gt;();</b> <i>48</i>&nbsp; <i>49</i>&nbsp; <i>50</i>&nbsp; static { <b class="nc"><i>51</i>&nbsp; DuplicateCheck.FIELD_WEIGHTS.put(FieldName.AUTHOR, 2.5);</b> <b class="nc"><i>52</i>&nbsp; DuplicateCheck.FIELD_WEIGHTS.put(FieldName.EDITOR, 2.5);</b> <b class="nc"><i>53</i>&nbsp; DuplicateCheck.FIELD_WEIGHTS.put(FieldName.TITLE, 3.);</b> <b class="nc"><i>54</i>&nbsp; DuplicateCheck.FIELD_WEIGHTS.put(FieldName.JOURNAL, 2.);</b> <b class="nc"><i>55</i>&nbsp; }</b> <i>56</i>&nbsp; <i>57</i>&nbsp; <i>58</i>&nbsp; /** <i>59</i>&nbsp; * Checks if the two entries represent the same publication. <i>60</i>&nbsp; * <i>61</i>&nbsp; * @param one BibEntry <i>62</i>&nbsp; * @param two BibEntry <i>63</i>&nbsp; * @return boolean <i>64</i>&nbsp; */ <i>65</i>&nbsp; public static boolean isDuplicate(BibEntry one, BibEntry two, BibDatabaseMode bibDatabaseMode) { <i>66</i>&nbsp; <i>67</i>&nbsp; // First check if they are of the same type - a necessary condition: <b class="nc"><i>68</i>&nbsp; if (!one.getType().equals(two.getType())) {</b> <b class="nc"><i>69</i>&nbsp; return false;</b> <i>70</i>&nbsp; } <b class="nc"><i>71</i>&nbsp; EntryType type = EntryTypes.getTypeOrDefault(one.getType(), bibDatabaseMode);</b> <i>72</i>&nbsp; <i>73</i>&nbsp; // The check if they have the same required fields: <b class="nc"><i>74</i>&nbsp; List&lt;String&gt; var = type.getRequiredFieldsFlat();</b> <i>75</i>&nbsp; double[] req; <b class="nc"><i>76</i>&nbsp; if (var == null) {</b> <b class="nc"><i>77</i>&nbsp; req = new double[]{0., 0.};</b> <i>78</i>&nbsp; } else { <b class="nc"><i>79</i>&nbsp; req = DuplicateCheck.compareFieldSet(var, one, two);</b> <i>80</i>&nbsp; } <i>81</i>&nbsp; <b class="nc"><i>82</i>&nbsp; if (Math.abs(req[0] - DuplicateCheck.duplicateThreshold) &gt; DuplicateCheck.DOUBT_RANGE) {</b> <i>83</i>&nbsp; // Far from the threshold value, so we base our decision on the req. fields only <b class="nc"><i>84</i>&nbsp; return req[0] &gt;= DuplicateCheck.duplicateThreshold;</b> <i>85</i>&nbsp; } <i>86</i>&nbsp; // Close to the threshold value, so we take a look at the optional fields, if any: <b class="nc"><i>87</i>&nbsp; List&lt;String&gt; optionalFields = type.getOptionalFields();</b> <b class="nc"><i>88</i>&nbsp; if (optionalFields != null) {</b> <b class="nc"><i>89</i>&nbsp; double[] opt = DuplicateCheck.compareFieldSet(optionalFields, one, two);</b> <b class="nc"><i>90</i>&nbsp; double totValue = ((DuplicateCheck.REQUIRED_WEIGHT * req[0] * req[1]) + (opt[0] * opt[1])) / ((req[1] * DuplicateCheck.REQUIRED_WEIGHT) + opt[1]);</b> <b class="nc"><i>91</i>&nbsp; return totValue &gt;= DuplicateCheck.duplicateThreshold;</b> <i>92</i>&nbsp; } <b class="nc"><i>93</i>&nbsp; return req[0] &gt;= DuplicateCheck.duplicateThreshold;</b> <i>94</i>&nbsp; } <i>95</i>&nbsp; <i>96</i>&nbsp; private static double[] compareFieldSet(List&lt;String&gt; fields, BibEntry one, BibEntry two) { <b class="nc"><i>97</i>&nbsp; double res = 0;</b> <b class="nc"><i>98</i>&nbsp; double totWeights = 0.;</b> <b class="nc"><i>99</i>&nbsp; for (String field : fields) {</b> <i>100</i>&nbsp; double weight; <b class="nc"><i>101</i>&nbsp; if (DuplicateCheck.FIELD_WEIGHTS.containsKey(field)) {</b> <b class="nc"><i>102</i>&nbsp; weight = DuplicateCheck.FIELD_WEIGHTS.get(field);</b> <i>103</i>&nbsp; } else { <b class="nc"><i>104</i>&nbsp; weight = 1.0;</b> <i>105</i>&nbsp; } <b class="nc"><i>106</i>&nbsp; totWeights += weight;</b> <b class="nc"><i>107</i>&nbsp; int result = DuplicateCheck.compareSingleField(field, one, two);</b> <b class="nc"><i>108</i>&nbsp; if (result == EQUAL) {</b> <b class="nc"><i>109</i>&nbsp; res += weight;</b> <b class="nc"><i>110</i>&nbsp; } else if (result == EMPTY_IN_BOTH) {</b> <b class="nc"><i>111</i>&nbsp; totWeights -= weight;</b> <i>112</i>&nbsp; } <b class="nc"><i>113</i>&nbsp; }</b> <b class="nc"><i>114</i>&nbsp; if (totWeights &gt; 0) {</b> <b class="nc"><i>115</i>&nbsp; return new double[]{res / totWeights, totWeights};</b> <i>116</i>&nbsp; } <b class="nc"><i>117</i>&nbsp; return new double[] {0.5, 0.0};</b> <i>118</i>&nbsp; } <i>119</i>&nbsp; <i>120</i>&nbsp; private static int compareSingleField(String field, BibEntry one, BibEntry two) { <b class="nc"><i>121</i>&nbsp; Optional&lt;String&gt; optionalStringOne = one.getField(field);</b> <b class="nc"><i>122</i>&nbsp; Optional&lt;String&gt; optionalStringTwo = two.getField(field);</b> <b class="nc"><i>123</i>&nbsp; if (!optionalStringOne.isPresent()) {</b> <b class="nc"><i>124</i>&nbsp; if (!optionalStringTwo.isPresent()) {</b> <b class="nc"><i>125</i>&nbsp; return EMPTY_IN_BOTH;</b> <i>126</i>&nbsp; } <b class="nc"><i>127</i>&nbsp; return EMPTY_IN_ONE;</b> <b class="nc"><i>128</i>&nbsp; } else if (!optionalStringTwo.isPresent()) {</b> <b class="nc"><i>129</i>&nbsp; return EMPTY_IN_TWO;</b> <i>130</i>&nbsp; } <i>131</i>&nbsp; <i>132</i>&nbsp; // Both strings present <b class="nc"><i>133</i>&nbsp; String stringOne = optionalStringOne.get();</b> <b class="nc"><i>134</i>&nbsp; String stringTwo = optionalStringTwo.get();</b> <i>135</i>&nbsp; <b class="nc"><i>136</i>&nbsp; if (InternalBibtexFields.getFieldProperties(field).contains(FieldProperty.PERSON_NAMES)) {</b> <i>137</i>&nbsp; // Specific for name fields. <i>138</i>&nbsp; // Harmonise case: <b class="nc"><i>139</i>&nbsp; String authorOne = AuthorList.fixAuthorLastNameOnlyCommas(stringOne, false).replace(&quot; and &quot;, &quot; &quot;).toLowerCase();</b> <b class="nc"><i>140</i>&nbsp; String authorTwo = AuthorList.fixAuthorLastNameOnlyCommas(stringTwo, false).replace(&quot; and &quot;, &quot; &quot;).toLowerCase();</b> <b class="nc"><i>141</i>&nbsp; double similarity = DuplicateCheck.correlateByWords(authorOne, authorTwo);</b> <b class="nc"><i>142</i>&nbsp; if (similarity &gt; 0.8) {</b> <b class="nc"><i>143</i>&nbsp; return EQUAL;</b> <i>144</i>&nbsp; } <b class="nc"><i>145</i>&nbsp; return NOT_EQUAL;</b> <b class="nc"><i>146</i>&nbsp; } else if (FieldName.PAGES.equals(field)) {</b> <i>147</i>&nbsp; // Pages can be given with a variety of delimiters, &quot;-&quot;, &quot;--&quot;, &quot; - &quot;, &quot; -- &quot;. <i>148</i>&nbsp; // We do a replace to harmonize these to a simple &quot;-&quot;: <i>149</i>&nbsp; // After this, a simple test for equality should be enough: <b class="nc"><i>150</i>&nbsp; stringOne = stringOne.replaceAll(&quot;[- ]+&quot;, &quot;-&quot;);</b> <b class="nc"><i>151</i>&nbsp; stringTwo = stringTwo.replaceAll(&quot;[- ]+&quot;, &quot;-&quot;);</b> <b class="nc"><i>152</i>&nbsp; if (stringOne.equals(stringTwo)) {</b> <b class="nc"><i>153</i>&nbsp; return EQUAL;</b> <i>154</i>&nbsp; } <b class="nc"><i>155</i>&nbsp; return NOT_EQUAL;</b> <b class="nc"><i>156</i>&nbsp; } else if (FieldName.JOURNAL.equals(field)) {</b> <i>157</i>&nbsp; // We do not attempt to harmonize abbreviation state of the journal names, <i>158</i>&nbsp; // but we remove periods from the names in case they are abbreviated with <i>159</i>&nbsp; // and without dots: <b class="nc"><i>160</i>&nbsp; stringOne = stringOne.replace(&quot;.&quot;, &quot;&quot;).toLowerCase();</b> <b class="nc"><i>161</i>&nbsp; stringTwo = stringTwo.replace(&quot;.&quot;, &quot;&quot;).toLowerCase();</b> <b class="nc"><i>162</i>&nbsp; double similarity = DuplicateCheck.correlateByWords(stringOne, stringTwo);</b> <b class="nc"><i>163</i>&nbsp; if (similarity &gt; 0.8) {</b> <b class="nc"><i>164</i>&nbsp; return EQUAL;</b> <i>165</i>&nbsp; } <b class="nc"><i>166</i>&nbsp; return NOT_EQUAL;</b> <i>167</i>&nbsp; } else { <b class="nc"><i>168</i>&nbsp; stringOne = stringOne.toLowerCase();</b> <b class="nc"><i>169</i>&nbsp; stringTwo = stringTwo.toLowerCase();</b> <b class="nc"><i>170</i>&nbsp; double similarity = DuplicateCheck.correlateByWords(stringOne, stringTwo);</b> <b class="nc"><i>171</i>&nbsp; if (similarity &gt; 0.8) {</b> <b class="nc"><i>172</i>&nbsp; return EQUAL;</b> <i>173</i>&nbsp; } <b class="nc"><i>174</i>&nbsp; return NOT_EQUAL;</b> <i>175</i>&nbsp; } <i>176</i>&nbsp; } <i>177</i>&nbsp; <i>178</i>&nbsp; public static double compareEntriesStrictly(BibEntry one, BibEntry two) { <b class="nc"><i>179</i>&nbsp; Set&lt;String&gt; allFields = new HashSet&lt;&gt;();</b> <b class="nc"><i>180</i>&nbsp; allFields.addAll(one.getFieldNames());</b> <b class="nc"><i>181</i>&nbsp; allFields.addAll(two.getFieldNames());</b> <i>182</i>&nbsp; <b class="nc"><i>183</i>&nbsp; int score = 0;</b> <b class="nc"><i>184</i>&nbsp; for (String field : allFields) {</b> <b class="nc"><i>185</i>&nbsp; Optional&lt;String&gt; stringOne = one.getField(field);</b> <b class="nc"><i>186</i>&nbsp; Optional&lt;String&gt; stringTwo = two.getField(field);</b> <b class="nc"><i>187</i>&nbsp; if (stringOne.equals(stringTwo)) {</b> <b class="nc"><i>188</i>&nbsp; score++;</b> <i>189</i>&nbsp; } <b class="nc"><i>190</i>&nbsp; }</b> <b class="nc"><i>191</i>&nbsp; if (score == allFields.size()) {</b> <b class="nc"><i>192</i>&nbsp; return 1.01; // Just to make sure we can</b> <i>193</i>&nbsp; // use score&gt;1 without <i>194</i>&nbsp; // trouble. <i>195</i>&nbsp; } <b class="nc"><i>196</i>&nbsp; return (double) score / allFields.size();</b> <i>197</i>&nbsp; } <i>198</i>&nbsp; <i>199</i>&nbsp; /** <i>200</i>&nbsp; * Goes through all entries in the given database, and if at least one of <i>201</i>&nbsp; * them is a duplicate of the given entry, as per <i>202</i>&nbsp; * Util.isDuplicate(BibEntry, BibEntry), the duplicate is returned. <i>203</i>&nbsp; * The search is terminated when the first duplicate is found. <i>204</i>&nbsp; * <i>205</i>&nbsp; * @param database The database to search. <i>206</i>&nbsp; * @param entry The entry of which we are looking for duplicates. <i>207</i>&nbsp; * @return The first duplicate entry found. null if no duplicates are found. <i>208</i>&nbsp; */ <i>209</i>&nbsp; public static Optional&lt;BibEntry&gt; containsDuplicate(BibDatabase database, BibEntry entry, BibDatabaseMode bibDatabaseMode) { <b class="nc"><i>210</i>&nbsp; for (BibEntry other : database.getEntries()) {</b> <b class="nc"><i>211</i>&nbsp; if (DuplicateCheck.isDuplicate(entry, other, bibDatabaseMode)) {</b> <b class="nc"><i>212</i>&nbsp; return Optional.of(other); // Duplicate found.</b> <i>213</i>&nbsp; } <b class="nc"><i>214</i>&nbsp; }</b> <b class="nc"><i>215</i>&nbsp; return Optional.empty(); // No duplicate found.</b> <i>216</i>&nbsp; } <i>217</i>&nbsp; <i>218</i>&nbsp; /** <i>219</i>&nbsp; * Compare two strings on the basis of word-by-word correlation analysis. <i>220</i>&nbsp; * <i>221</i>&nbsp; * @param s1 The first string <i>222</i>&nbsp; * @param s2 The second string <i>223</i>&nbsp; * @return a value in the interval [0, 1] indicating the degree of match. <i>224</i>&nbsp; */ <i>225</i>&nbsp; public static double correlateByWords(String s1, String s2) { <b class="nc"><i>226</i>&nbsp; String[] w1 = s1.split(&quot;\\s&quot;);</b> <b class="nc"><i>227</i>&nbsp; String[] w2 = s2.split(&quot;\\s&quot;);</b> <b class="nc"><i>228</i>&nbsp; int n = Math.min(w1.length, w2.length);</b> <b class="nc"><i>229</i>&nbsp; int misses = 0;</b> <b class="nc"><i>230</i>&nbsp; for (int i = 0; i &lt; n; i++) {</b> <b class="nc"><i>231</i>&nbsp; double corr = similarity(w1[i], w2[i]);</b> <b class="nc"><i>232</i>&nbsp; if (corr &lt; 0.75) {</b> <b class="nc"><i>233</i>&nbsp; misses++;</b> <i>234</i>&nbsp; } <i>235</i>&nbsp; } <b class="nc"><i>236</i>&nbsp; double missRate = (double) misses / (double) n;</b> <b class="nc"><i>237</i>&nbsp; return 1 - missRate;</b> <i>238</i>&nbsp; } <i>239</i>&nbsp; <i>240</i>&nbsp; <i>241</i>&nbsp; /** <i>242</i>&nbsp; * Calculates the similarity (a number within 0 and 1) between two strings. <i>243</i>&nbsp; * http://stackoverflow.com/questions/955110/similarity-string-comparison-in-java <i>244</i>&nbsp; */ <i>245</i>&nbsp; private static double similarity(String s1, String s2) { <b class="nc"><i>246</i>&nbsp; String longer = s1;</b> <b class="nc"><i>247</i>&nbsp; String shorter = s2;</b> <i>248</i>&nbsp; <b class="nc"><i>249</i>&nbsp; if (s1.length() &lt; s2.length()) { // longer should always have greater length</b> <b class="nc"><i>250</i>&nbsp; longer = s2;</b> <b class="nc"><i>251</i>&nbsp; shorter = s1;</b> <i>252</i>&nbsp; } <b class="nc"><i>253</i>&nbsp; int longerLength = longer.length();</b> <b class="nc"><i>254</i>&nbsp; if (longerLength == 0) {</b> <b class="nc"><i>255</i>&nbsp; return 1.0;</b> <i>256</i>&nbsp; /* both strings are zero length */ } <b class="nc"><i>257</i>&nbsp; double sim = (longerLength - editDistance(longer, shorter)) / (double) longerLength;</b> <b class="nc"><i>258</i>&nbsp; LOGGER.debug(&quot;Longer string: &quot; + longer + &quot; Shorter string: &quot; + shorter + &quot; Similarity: &quot; + sim);</b> <b class="nc"><i>259</i>&nbsp; return sim;</b> <i>260</i>&nbsp; <i>261</i>&nbsp; } <i>262</i>&nbsp; <i>263</i>&nbsp; /* <i>264</i>&nbsp; * Levenshtein Edit Distance <i>265</i>&nbsp; * http://stackoverflow.com/questions/955110/similarity-string-comparison-in-java <i>266</i>&nbsp; */ <i>267</i>&nbsp; private static int editDistance(String s1, String s2) { <b class="nc"><i>268</i>&nbsp; String s1LowerCase = s1.toLowerCase();</b> <b class="nc"><i>269</i>&nbsp; String s2LowerCase = s2.toLowerCase();</b> <i>270</i>&nbsp; <b class="nc"><i>271</i>&nbsp; int[] costs = new int[s2LowerCase.length() + 1];</b> <b class="nc"><i>272</i>&nbsp; for (int i = 0; i &lt;= s1LowerCase.length(); i++) {</b> <b class="nc"><i>273</i>&nbsp; int lastValue = i;</b> <b class="nc"><i>274</i>&nbsp; for (int j = 0; j &lt;= s2LowerCase.length(); j++) {</b> <b class="nc"><i>275</i>&nbsp; if (i == 0) {</b> <b class="nc"><i>276</i>&nbsp; costs[j] = j;</b> <b class="nc"><i>277</i>&nbsp; } else if (j &gt; 0) {</b> <b class="nc"><i>278</i>&nbsp; int newValue = costs[j - 1];</b> <b class="nc"><i>279</i>&nbsp; if (s1LowerCase.charAt(i - 1) != s2LowerCase.charAt(j - 1)) {</b> <b class="nc"><i>280</i>&nbsp; newValue = Math.min(Math.min(newValue, lastValue), costs[j]) + 1;</b> <i>281</i>&nbsp; } <b class="nc"><i>282</i>&nbsp; costs[j - 1] = lastValue;</b> <b class="nc"><i>283</i>&nbsp; lastValue = newValue;</b> <i>284</i>&nbsp; <i>285</i>&nbsp; } <i>286</i>&nbsp; } <b class="nc"><i>287</i>&nbsp; if (i &gt; 0) {</b> <b class="nc"><i>288</i>&nbsp; costs[s2LowerCase.length()] = lastValue;</b> <i>289</i>&nbsp; } <i>290</i>&nbsp; } <b class="nc"><i>291</i>&nbsp; LOGGER.debug(&quot;String 1: &quot; + s1LowerCase + &quot; String 2: &quot; + s2LowerCase + &quot; Distance: &quot; + costs[s2LowerCase.length()]);</b> <b class="nc"><i>292</i>&nbsp; return costs[s2LowerCase.length()];</b> <i>293</i>&nbsp; } <i>294</i>&nbsp; <i>295</i>&nbsp; <i>296</i>&nbsp;} </div> </div> <div class="footer"> <div style="float:right;">generated on 2017-07-15 00:44</div> </div> </body> </html>
JessicaDias/JabRef_ES2
ReportImportTests/net.sf.jabref.model/.classes/DuplicateCheck.html
HTML
mit
20,403
[ 30522, 1026, 999, 9986, 13874, 16129, 2270, 1000, 1011, 1013, 1013, 1059, 2509, 2278, 1013, 1013, 26718, 2094, 1060, 11039, 19968, 1015, 1012, 1014, 17459, 1013, 1013, 4372, 1000, 1000, 8299, 1024, 1013, 1013, 7479, 1012, 1059, 2509, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * * Copyright 2015 Florian Schmaus * * 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. */ /** * Providers for XEP-0033: Extended Stanza Addressing. */ package org.jivesoftware.smackx.address.provider;
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/address/provider/package-info.java
Java
apache-2.0
717
[ 30522, 1013, 1008, 1008, 1008, 1008, 9385, 2325, 29517, 8040, 22444, 2271, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 3272, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Multisim: a microprocessor architecture exploration framework * Copyright (C) 2014 Tommy Thorn * * This 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 2.1 of the License, or (at your option) any later version. * * This 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 this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ int SZ(loadelf,)(memory_t *m, char *name, FILE *f, elf_info_t *elf_info) { memset(elf_info, 0, sizeof *elf_info); SZ(Elf,_Ehdr) ehdr; SZ(Elf,_Phdr) *ph; if (fread(&ehdr, sizeof ehdr, 1, f) != 1) { fprintf(stderr, "%s: short header read, file corrupted?\n", name); return 10; } if (ehdr.e_ident[EI_DATA] != ELFDATA2MSB && ehdr.e_ident[EI_DATA] != ELFDATA2LSB) { fprintf(stderr, "%s: Unsupported endian (%d)\n", name, ehdr.e_ident[EI_DATA]); return 11; } elf_info->endian_is_big = ehdr.e_ident[EI_DATA] == ELFDATA2MSB; memory_set_endian(m, elf_info->endian_is_big); if (NATIVE(ehdr.e_type) != ET_EXEC) { fprintf(stderr, "%s: Need a fully linked ELF executable, not type %d\n", name, NATIVE(ehdr.e_type)); return 12; } elf_info->machine = NATIVE(ehdr.e_machine); if (elf_info->machine != EM_ALPHA && elf_info->machine != EM_RISCV && elf_info->machine != EM_LM32 && elf_info->machine != EM_LM32_ALT) { fprintf(stderr, "%s: Unsupported machine architecture %d\n", name, NATIVE(ehdr.e_machine)); return 13; } if (enable_verb_prog_sec) { printf("%s:\n", name); printf("%sendian\n", elf_info->endian_is_big ? "big" : "little"); printf("Entry: %016"PRIx64"\n", (uint64_t) NATIVE(ehdr.e_entry)); /* Entry point virtual address */ printf("Proc Flags: %08x\n", NATIVE(ehdr.e_flags)); /* Processor-specific flags */ printf("Phdr.tbl entry cnt % 8d\n", NATIVE(ehdr.e_phnum)); /*Program header table entry count */ printf("Shdr.tbl entry cnt % 8d\n", NATIVE(ehdr.e_shnum)); /*Section header table entry count */ printf("Shdr.str tbl idx % 8d\n", NATIVE(ehdr.e_shstrndx)); /*Section header string table index */ } elf_info->program_entry = NATIVE(ehdr.e_entry); if (NATIVE(ehdr.e_ehsize) != sizeof ehdr) { return 14; } if (NATIVE(ehdr.e_shentsize) != sizeof(SZ(Elf,_Shdr))) { return 15; } // Allocate program headers ph = alloca(sizeof *ph * NATIVE(ehdr.e_phnum)); int phnum = NATIVE(ehdr.e_phnum); for (int i = 0; i < phnum; ++i) { fseek(f, NATIVE(ehdr.e_phoff) + i * NATIVE(ehdr.e_phentsize), SEEK_SET); if (fread(ph + i, sizeof *ph, 1, f) != 1) return 16; if (enable_verb_prog_sec) { printf("\nProgram header #%d (%lx)\n", i, ftell(f)); printf(" type %08x\n", NATIVE(ph[i].p_type)); printf(" filesz %016"PRIx64"\n", (uint64_t)NATIVE(ph[i].p_filesz)); printf(" offset %016"PRIx64"\n", (uint64_t)NATIVE(ph[i].p_offset)); printf(" vaddr %016"PRIx64"\n", (uint64_t)NATIVE(ph[i].p_vaddr)); printf(" paddr %016"PRIx64"\n", (uint64_t)NATIVE(ph[i].p_paddr)); printf(" memsz %016"PRIx64"\n", (uint64_t)NATIVE(ph[i].p_memsz)); printf(" flags %08x\n", NATIVE(ph[i].p_flags)); printf(" align %016"PRIx64"\n", (uint64_t)NATIVE(ph[i].p_align)); } if (NATIVE(ph[i].p_type) == PT_LOAD && NATIVE(ph[i].p_filesz)) { if (enable_verb_prog_sec) fprintf(stderr, "Loading section [%016"PRIx64"; %016"PRIx64"]\n", (uint64_t)NATIVE(ph[i].p_vaddr), (uint64_t)NATIVE(ph[i].p_vaddr) + NATIVE(ph[i].p_memsz) - 1); loadsection(f, (unsigned)NATIVE(ph[i].p_offset), (unsigned)NATIVE(ph[i].p_filesz), m, NATIVE(ph[i].p_vaddr), NATIVE(ph[i].p_memsz), elf_info); } if (ph[i].p_flags & 1) { elf_info->text_segments++; elf_info->text_start = NATIVE(ph[i].p_vaddr); elf_info->text_size = NATIVE(ph[i].p_memsz); } } if (enable_verb_elf) { printf("\n"); fseek(f, NATIVE(ehdr.e_shoff), SEEK_SET); int shnum = NATIVE(ehdr.e_shnum); for (int i = 0; i < shnum; ++i) { SZ(Elf,_Shdr) sh; if (fread(&sh, sizeof sh, 1, f) != 1) return 17; printf("\nSection header #%d (%lx)\n", i, ftell(f)); printf(" name %08x\n", NATIVE(sh.sh_name)); printf(" type %08x\n", NATIVE(sh.sh_type)); printf(" flags %016"PRIx64"\n", (uint64_t)NATIVE(sh.sh_flags)); printf(" addr %016"PRIx64"\n", (uint64_t)NATIVE(sh.sh_addr)); printf(" offset %016"PRIx64"\n", (uint64_t)NATIVE(sh.sh_offset)); printf(" size %016"PRIx64"\n", (uint64_t)NATIVE(sh.sh_size)); printf(" link %08x\n", NATIVE(sh.sh_link)); printf(" info %08x\n", NATIVE(sh.sh_info)); printf(" addralign %016"PRIx64"\n", (uint64_t)NATIVE(sh.sh_addralign)); printf(" entsize %016"PRIx64"\n", (uint64_t)NATIVE(sh.sh_entsize)); } printf(" (now at %lx)\n", ftell(f)); } return 0; } // Local Variables: // mode: C // c-style-variables-are-local-p: t // c-file-style: "stroustrup" // End:
tommythorn/multisim
loadelf_temp.c
C
lgpl-2.1
6,328
[ 30522, 1013, 1008, 1008, 4800, 5332, 2213, 1024, 1037, 12702, 21572, 9623, 21748, 4294, 8993, 7705, 1008, 9385, 1006, 1039, 1007, 2297, 6838, 16337, 1008, 1008, 2023, 3075, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * Automatically generated file. Please do not edit. * @author Highcharts Config Generator by Karasiq * @see [[http://api.highcharts.com/highmaps]] */ package com.highmaps.config import scalajs.js, js.`|` import com.highcharts.CleanJsObject import com.highcharts.HighchartsUtils._ /** * @note JavaScript name: <code>series&lt;funnel&gt;-data-dragDrop-guideBox-default</code> */ @js.annotation.ScalaJSDefined class SeriesFunnelDataDragDropGuideBoxDefault extends com.highcharts.HighchartsGenericObject { /** * <p>CSS class name of the guide box in this state. Defaults to * <code>highcharts-drag-box-default</code>.</p> * @since 6.2.0 */ val className: js.UndefOr[String] = js.undefined /** * <p>Width of the line around the guide box.</p> * @since 6.2.0 */ val lineWidth: js.UndefOr[Double] = js.undefined /** * <p>Color of the border around the guide box.</p> * @since 6.2.0 */ val lineColor: js.UndefOr[String | js.Object] = js.undefined /** * <p>Guide box fill color.</p> * @since 6.2.0 */ val color: js.UndefOr[String | js.Object] = js.undefined /** * <p>Guide box cursor.</p> * @since 6.2.0 */ val cursor: js.UndefOr[String] = js.undefined /** * <p>Guide box zIndex.</p> * @since 6.2.0 */ val zIndex: js.UndefOr[Double] = js.undefined } object SeriesFunnelDataDragDropGuideBoxDefault { /** * @param className <p>CSS class name of the guide box in this state. Defaults to. <code>highcharts-drag-box-default</code>.</p> * @param lineWidth <p>Width of the line around the guide box.</p> * @param lineColor <p>Color of the border around the guide box.</p> * @param color <p>Guide box fill color.</p> * @param cursor <p>Guide box cursor.</p> * @param zIndex <p>Guide box zIndex.</p> */ def apply(className: js.UndefOr[String] = js.undefined, lineWidth: js.UndefOr[Double] = js.undefined, lineColor: js.UndefOr[String | js.Object] = js.undefined, color: js.UndefOr[String | js.Object] = js.undefined, cursor: js.UndefOr[String] = js.undefined, zIndex: js.UndefOr[Double] = js.undefined): SeriesFunnelDataDragDropGuideBoxDefault = { val classNameOuter: js.UndefOr[String] = className val lineWidthOuter: js.UndefOr[Double] = lineWidth val lineColorOuter: js.UndefOr[String | js.Object] = lineColor val colorOuter: js.UndefOr[String | js.Object] = color val cursorOuter: js.UndefOr[String] = cursor val zIndexOuter: js.UndefOr[Double] = zIndex com.highcharts.HighchartsGenericObject.toCleanObject(new SeriesFunnelDataDragDropGuideBoxDefault { override val className: js.UndefOr[String] = classNameOuter override val lineWidth: js.UndefOr[Double] = lineWidthOuter override val lineColor: js.UndefOr[String | js.Object] = lineColorOuter override val color: js.UndefOr[String | js.Object] = colorOuter override val cursor: js.UndefOr[String] = cursorOuter override val zIndex: js.UndefOr[Double] = zIndexOuter }) } }
Karasiq/scalajs-highcharts
src/main/scala/com/highmaps/config/SeriesFunnelDataDragDropGuideBoxDefault.scala
Scala
mit
3,037
[ 30522, 1013, 1008, 1008, 1008, 8073, 7013, 5371, 1012, 3531, 2079, 2025, 10086, 1012, 1008, 1030, 3166, 2152, 7507, 21217, 9530, 8873, 2290, 13103, 2011, 13173, 5332, 4160, 1008, 1030, 2156, 1031, 1031, 8299, 1024, 1013, 1013, 17928, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * HMM_multiForwardBackward.c * ========================================================================= * * Copyright (C) 2014 Martin Lindén, E-mail: bmelinden@gmail.com * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or any later * version. * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * Additional permission under GNU GPL version 3 section 7 * * If you modify this Program, or any covered work, by linking or combining it * with Matlab or any Matlab toolbox, the licensors of this Program grant you * additional permission to convey the resulting work. * * You should have received a copy of the GNU General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ /* [lnZ,wA,pst]=VB_multiForwardBackward(Q,H,iEnd) * * M.L. 2013-05-24 * */ #include <math.h> #include <stdio.h> #include "mex.h" #include "matrix.h" /* Input Arguments */ #define Q_IN prhs[0] #define H_IN prhs[1] #define IEND_IN prhs[2] /* output arguments */ #define LNZ_OUT plhs[0] #define WA_OUT plhs[1] #define PST_OUT plhs[2] void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]){ /* input parameters */ double *H,*Q; double *iEnd; /* output parameters */ double *lnZ,*wA,*pst; /* temporary variables */ int Nends,Mends; int N,T,tStart,tEnd,n,t,j,k; double Za,Zb,ZW; mxArray *mx_alpha,*mx_beta,*mx_P; double *alpha,*beta,*P; unsigned int doBackward,doOccProb; /* check number of input/output arguments */ if (nlhs > 3 ) mexErrMsgTxt("At most three output arguments can be handled."); if (nlhs == 1){ doBackward=0;doOccProb=0;} if (nlhs == 2){ doBackward=1;doOccProb=0;} if (nlhs == 3){ doBackward=1;doOccProb=1;} if (nrhs != 3) mexErrMsgTxt("Three input arguments required."); /* size of input variables */ T = mxGetM(H_IN); /* number of rows */ N = mxGetN(H_IN); /* number of columns */ /* printf("input H is [ %d %d ] \n",T,N); */ /* require iEnd to be a 1 x N matrix */ Mends = mxGetM(IEND_IN); /* number of rows */ Nends = mxGetN(IEND_IN); /* number of rows */ /* printf("input iEnds is [ %d %d ] \n",Mends,Nends); */ if( (Mends==1) && (Nends >=1) ){ /* then do nothing */ }else if( (Nends == 1) && (Mends >=1) ){ /* a N x 1 is also OK */ Nends=Mends; Mends=1; }else{ /*something weird going on */ mexErrMsgTxt("iEnds must be a 1-by-N or N-by-1 matrix."); } /* retrieve input data */ H=mxGetPr(H_IN); Q=mxGetPr(Q_IN); iEnd=mxGetPr(IEND_IN); /* check H and Q have consistent sizes */ if ( mxGetM(Q_IN) != N || mxGetN(Q_IN) != N) mexErrMsgTxt("Q is not an N by N matrix."); if( iEnd[Nends-1] > T) mexErrMsgTxt("iEnds outside range of data."); /* Create an mxArray for the output data */ LNZ_OUT = mxCreateDoubleMatrix(1, 1, mxREAL); lnZ=mxGetPr(LNZ_OUT); /* create pointer to real data in output */ lnZ[0]=0.0; if(doBackward>0){ WA_OUT = mxCreateDoubleMatrix(N, N, mxREAL); wA=mxGetPr(WA_OUT); } if (doOccProb>0){ PST_OUT=mxCreateDoubleMatrix(T, N, mxREAL); pst=mxGetPr(PST_OUT); } /* create temporary matrices */ mx_alpha=mxCreateDoubleMatrix(T, N, mxREAL); alpha=mxGetPr(mx_alpha); mx_beta=mxCreateDoubleMatrix(T, N, mxREAL); beta=mxGetPr(mx_beta); mx_P=mxCreateDoubleMatrix(N, N, mxREAL); P=mxGetPr(mx_P); /* actual forward-backward sweeps */ tStart=0; for(n=0;n<Nends;n++){ tEnd=(int)(iEnd[n]); /* forward sweep */ /*Za=sum(H(tStart,:));*/ /*alpha(tStart,:)=H(tStart,:)/Za;*/ Za=0.0; for(j=0;j<N;j++){ Za=Za+H[tStart+T*j];} for(j=0;j<N;j++){ alpha[tStart+T*j]=H[tStart+T*j]/Za;} lnZ[0]=lnZ[0]+log(Za); for(t=tStart+1;t<tEnd;t++){ /* alpha(t,:)=(alpha(t-1,:)*Q).*qst(t,:);*/ /* Za=sum(alpha(t,:));*/ Za=0; for(j=0;j<N;j++){ for(k=0;k<N;k++){ alpha[t+j*T]=alpha[t+j*T]+alpha[t-1+k*T]*Q[k+j*N]*H[t+j*T]; } Za=Za+alpha[t+j*T]; } /* alpha(t,:)=alpha(t,:)/Za(t); */ for(j=0;j<N;j++){ alpha[t+j*T]=alpha[t+j*T]/Za;} /* lnZ=lnZ+log(Za);*/ lnZ[0]=lnZ[0]+log(Za); } /* backward sweep */ if(doBackward>0){ /*beta(tEnd,:)=ones(1,N)/N;*/ for(j=0;j<N;j++){ beta[tEnd-1+j*T]=1.0/N; } for (t=tEnd-2;t>=tStart;t--){ /* beta(t,:)=(beta(t+1,:).*H(t+1,:))*QT; */ /* Zb=sum(beta(t,:)); */ /* beta(t,:)=beta(t,:)/Zb;*/ Zb=0; for(j=0;j<N;j++){ for(k=0;k<N;k++){ beta[t+j*T]=beta[t+j*T]+beta[t+1+k*T]*H[t+1+k*T]*Q[j+k*N]; } Zb=Zb+beta[t+j*T]; } for(j=0;j<N;j++){ beta[t+j*T]=beta[t+j*T]/Zb; } } /* transition counts */ for(t=tStart+1;t<tEnd;t++){ ZW=0.0; for(j=0;j<N;j++){ for(k=0;k<N;k++){ P[j+k*N]=alpha[(t-1)+j*T]*Q[j+k*N]*H[t+k*T]*beta[t+k*T]; ZW=ZW+P[j+k*N]; } } for(j=0;j<N;j++){ for(k=0;k<N;k++){ wA[j+k*N]=wA[j+k*N]+P[j+k*N]/ZW; } } } } tStart=tEnd; } /* do occupation probability if asked for */ if(doOccProb>0){ /* pst = rowNormalize(alpha.*beta);*/ for(t=0;t<T*N;t++){ pst[t]=alpha[t]*beta[t]; } for(t=0;t<T;t++){ ZW=0.0; for(j=0;j<N;j++){ ZW=ZW+pst[t+j*T]; } for(j=0;j<N;j++){ pst[t+j*T]=pst[t+j*T]/ZW; } } } /* destroy temporary vriables */ mxDestroyArray(mx_alpha); mxDestroyArray(mx_beta); mxDestroyArray(mx_P); }
bmelinden/vbSPT
HMMcore/HMM_multiForwardBackward.c
C
gpl-3.0
6,735
[ 30522, 1013, 1008, 1008, 17012, 1035, 4800, 29278, 7652, 5963, 7652, 1012, 1039, 1008, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
module ArrayNamedAccess def second self[1] end def third self[2] end end
jimjames99/group_by_summary
lib/array_named_access.rb
Ruby
mit
91
[ 30522, 11336, 9140, 18442, 2850, 9468, 7971, 13366, 2117, 2969, 1031, 1015, 1033, 2203, 13366, 2353, 2969, 1031, 1016, 1033, 2203, 2203, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# Festuca paniculata subsp. multispiculata SUBSPECIES #### Status SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
mdoering/backbone
life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Festuca/Festuca paniculata/ Syn. Festuca paniculata multispiculata/README.md
Markdown
apache-2.0
200
[ 30522, 1001, 17037, 18100, 6634, 18060, 24807, 1012, 4800, 13102, 2594, 18060, 11056, 1001, 1001, 1001, 1001, 3570, 10675, 1001, 1001, 1001, 1001, 2429, 2000, 1996, 10161, 1997, 2166, 1010, 3822, 2254, 2249, 1001, 1001, 1001, 1001, 2405, 19...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* 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); } }
gmange/RT
src/get_next_line.c
C
mit
4,184
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>type-infer: 1 m 9 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.8.2 / type-infer - 0.1.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> type-infer <small> 0.1.0 <span class="label label-success">1 m 9 s 🏆</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-01-01 19:32:40 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-01-01 19:32:40 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.2 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.04.2 The OCaml compiler (virtual package) ocaml-base-compiler 4.04.2 Official 4.04.2 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.1 A library manager for OCaml # opam file: # This file is generated by dune, edit dune-project instead opam-version: &quot;2.0&quot; synopsis: &quot;A formal verification of algorithm W&quot; maintainer: [&quot;Masayuki Mizuno &lt;mizuno@wantedly.com&gt;&quot;] authors: [&quot;Masayuki Mizuno &lt;mizuno@wantedly.com&gt;&quot;] license: &quot;MIT&quot; homepage: &quot;https://github.com/fetburner/type-infer&quot; bug-reports: &quot;https://github.com/fetburner/type-infer/issues&quot; depends: [ &quot;dune&quot; {&gt;= &quot;2.5&quot;} &quot;coq&quot; {&gt;= &quot;8.8&quot;} &quot;coq-mathcomp-ssreflect&quot; {&gt;= &quot;1.11&quot;} ] build: [ [&quot;dune&quot; &quot;subst&quot;] {pinned} [ &quot;dune&quot; &quot;build&quot; &quot;-p&quot; name &quot;-j&quot; jobs &quot;@install&quot; &quot;@runtest&quot; {with-test} &quot;@doc&quot; {with-doc} ] ] dev-repo: &quot;git+https://github.com/fetburner/type-infer.git&quot; url { src: &quot;https://github.com/fetburner/type-infer/archive/0.1.0.tar.gz&quot; checksum: &quot;md5=c4d970724196eb181cc51ee7718de3c6&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-type-infer.0.1.0 coq.8.8.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-type-infer.0.1.0 coq.8.8.2</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>17 m 38 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-type-infer.0.1.0 coq.8.8.2</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>1 m 9 s</dd> </dl> <h2>Installation size</h2> <p>Total: 1 M</p> <ul> <li>369 K <code>../ocaml-base-compiler.4.04.2/lib/coq/user-contrib/TypeInfer/Typing.vo</code></li> <li>254 K <code>../ocaml-base-compiler.4.04.2/lib/coq/user-contrib/TypeInfer/Types.vo</code></li> <li>204 K <code>../ocaml-base-compiler.4.04.2/lib/coq/user-contrib/TypeInfer/TypeSafety.vo</code></li> <li>149 K <code>../ocaml-base-compiler.4.04.2/lib/coq/user-contrib/TypeInfer/Term.vo</code></li> <li>89 K <code>../ocaml-base-compiler.4.04.2/lib/coq/user-contrib/TypeInfer/Util.vo</code></li> <li>28 K <code>../ocaml-base-compiler.4.04.2/lib/coq/user-contrib/TypeInfer/Typing.v</code></li> <li>27 K <code>../ocaml-base-compiler.4.04.2/lib/coq/user-contrib/TypeInfer/Types.v</code></li> <li>8 K <code>../ocaml-base-compiler.4.04.2/lib/coq/user-contrib/TypeInfer/Util.v</code></li> <li>7 K <code>../ocaml-base-compiler.4.04.2/lib/coq/user-contrib/TypeInfer/TypeSafety.v</code></li> <li>5 K <code>../ocaml-base-compiler.4.04.2/lib/coq/user-contrib/TypeInfer/Term.v</code></li> <li>1 K <code>../ocaml-base-compiler.4.04.2/doc/coq-type-infer/LICENSE</code></li> <li>1 K <code>../ocaml-base-compiler.4.04.2/lib/coq-type-infer/opam</code></li> <li>1 K <code>../ocaml-base-compiler.4.04.2/lib/coq-type-infer/dune-package</code></li> <li>0 K <code>../ocaml-base-compiler.4.04.2/lib/coq-type-infer/META</code></li> </ul> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq-type-infer.0.1.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>
coq-bench/coq-bench.github.io
clean/Linux-x86_64-4.04.2-2.0.5/released/8.8.2/type-infer/0.1.0.html
HTML
mit
8,187
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 18804, 2171, 1027, 1000, 3193, 6442, 1000, 418...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * System call names. * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD: src/sys/compat/svr4/svr4_syscallnames.c,v 1.10 2001/09/12 08:36:58 julian Exp $ * created from FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.11 2000/08/31 22:54:05 obrien Exp */ char *svr4_syscallnames[] = { "#0", /* 0 = unused */ "exit", /* 1 = exit */ "fork", /* 2 = fork */ "read", /* 3 = read */ "write", /* 4 = write */ "svr4_sys_open", /* 5 = svr4_sys_open */ "close", /* 6 = close */ "svr4_sys_wait", /* 7 = svr4_sys_wait */ "svr4_sys_creat", /* 8 = svr4_sys_creat */ "link", /* 9 = link */ "unlink", /* 10 = unlink */ "svr4_sys_execv", /* 11 = svr4_sys_execv */ "chdir", /* 12 = chdir */ "svr4_sys_time", /* 13 = svr4_sys_time */ "svr4_sys_mknod", /* 14 = svr4_sys_mknod */ "chmod", /* 15 = chmod */ "chown", /* 16 = chown */ "svr4_sys_break", /* 17 = svr4_sys_break */ "svr4_sys_stat", /* 18 = svr4_sys_stat */ "lseek", /* 19 = lseek */ "getpid", /* 20 = getpid */ "#21", /* 21 = old_mount */ "#22", /* 22 = sysv_umount */ "setuid", /* 23 = setuid */ "getuid", /* 24 = getuid */ "#25", /* 25 = stime */ "#26", /* 26 = ptrace */ "svr4_sys_alarm", /* 27 = svr4_sys_alarm */ "svr4_sys_fstat", /* 28 = svr4_sys_fstat */ "svr4_sys_pause", /* 29 = svr4_sys_pause */ "svr4_sys_utime", /* 30 = svr4_sys_utime */ "#31", /* 31 = stty */ "#32", /* 32 = gtty */ "svr4_sys_access", /* 33 = svr4_sys_access */ "svr4_sys_nice", /* 34 = svr4_sys_nice */ "#35", /* 35 = statfs */ "sync", /* 36 = sync */ "svr4_sys_kill", /* 37 = svr4_sys_kill */ "#38", /* 38 = fstatfs */ "svr4_sys_pgrpsys", /* 39 = svr4_sys_pgrpsys */ "#40", /* 40 = xenix */ "dup", /* 41 = dup */ "pipe", /* 42 = pipe */ "svr4_sys_times", /* 43 = svr4_sys_times */ "#44", /* 44 = profil */ "#45", /* 45 = plock */ "setgid", /* 46 = setgid */ "getgid", /* 47 = getgid */ "svr4_sys_signal", /* 48 = svr4_sys_signal */ #if defined(NOTYET) "svr4_sys_msgsys", /* 49 = svr4_sys_msgsys */ #else "#49", /* 49 = msgsys */ #endif "svr4_sys_sysarch", /* 50 = svr4_sys_sysarch */ "#51", /* 51 = acct */ "#52", /* 52 = shmsys */ "#53", /* 53 = semsys */ "svr4_sys_ioctl", /* 54 = svr4_sys_ioctl */ "#55", /* 55 = uadmin */ "#56", /* 56 = exch */ "svr4_sys_utssys", /* 57 = svr4_sys_utssys */ "fsync", /* 58 = fsync */ "svr4_sys_execve", /* 59 = svr4_sys_execve */ "umask", /* 60 = umask */ "chroot", /* 61 = chroot */ "svr4_sys_fcntl", /* 62 = svr4_sys_fcntl */ "svr4_sys_ulimit", /* 63 = svr4_sys_ulimit */ "#64", /* 64 = reserved */ "#65", /* 65 = reserved */ "#66", /* 66 = reserved */ "#67", /* 67 = reserved */ "#68", /* 68 = reserved */ "#69", /* 69 = reserved */ "#70", /* 70 = advfs */ "#71", /* 71 = unadvfs */ "#72", /* 72 = rmount */ "#73", /* 73 = rumount */ "#74", /* 74 = rfstart */ "#75", /* 75 = sigret */ "#76", /* 76 = rdebug */ "#77", /* 77 = rfstop */ "#78", /* 78 = rfsys */ "rmdir", /* 79 = rmdir */ "mkdir", /* 80 = mkdir */ "svr4_sys_getdents", /* 81 = svr4_sys_getdents */ "#82", /* 82 = libattach */ "#83", /* 83 = libdetach */ "#84", /* 84 = sysfs */ "svr4_sys_getmsg", /* 85 = svr4_sys_getmsg */ "svr4_sys_putmsg", /* 86 = svr4_sys_putmsg */ "svr4_sys_poll", /* 87 = svr4_sys_poll */ "svr4_sys_lstat", /* 88 = svr4_sys_lstat */ "symlink", /* 89 = symlink */ "readlink", /* 90 = readlink */ "getgroups", /* 91 = getgroups */ "setgroups", /* 92 = setgroups */ "fchmod", /* 93 = fchmod */ "fchown", /* 94 = fchown */ "svr4_sys_sigprocmask", /* 95 = svr4_sys_sigprocmask */ "svr4_sys_sigsuspend", /* 96 = svr4_sys_sigsuspend */ "svr4_sys_sigaltstack", /* 97 = svr4_sys_sigaltstack */ "svr4_sys_sigaction", /* 98 = svr4_sys_sigaction */ "svr4_sys_sigpending", /* 99 = svr4_sys_sigpending */ "svr4_sys_context", /* 100 = svr4_sys_context */ "#101", /* 101 = evsys */ "#102", /* 102 = evtrapret */ "svr4_sys_statvfs", /* 103 = svr4_sys_statvfs */ "svr4_sys_fstatvfs", /* 104 = svr4_sys_fstatvfs */ "#105", /* 105 = whoknows */ "#106", /* 106 = nfssvc */ "svr4_sys_waitsys", /* 107 = svr4_sys_waitsys */ "#108", /* 108 = sigsendsys */ "svr4_sys_hrtsys", /* 109 = svr4_sys_hrtsys */ "#110", /* 110 = acancel */ "#111", /* 111 = async */ "#112", /* 112 = priocntlsys */ "svr4_sys_pathconf", /* 113 = svr4_sys_pathconf */ "#114", /* 114 = mincore */ "svr4_sys_mmap", /* 115 = svr4_sys_mmap */ "mprotect", /* 116 = mprotect */ "munmap", /* 117 = munmap */ "svr4_sys_fpathconf", /* 118 = svr4_sys_fpathconf */ "vfork", /* 119 = vfork */ "fchdir", /* 120 = fchdir */ "readv", /* 121 = readv */ "writev", /* 122 = writev */ "svr4_sys_xstat", /* 123 = svr4_sys_xstat */ "svr4_sys_lxstat", /* 124 = svr4_sys_lxstat */ "svr4_sys_fxstat", /* 125 = svr4_sys_fxstat */ "svr4_sys_xmknod", /* 126 = svr4_sys_xmknod */ "#127", /* 127 = clocal */ "svr4_sys_setrlimit", /* 128 = svr4_sys_setrlimit */ "svr4_sys_getrlimit", /* 129 = svr4_sys_getrlimit */ "lchown", /* 130 = lchown */ "svr4_sys_memcntl", /* 131 = svr4_sys_memcntl */ "#132", /* 132 = getpmsg */ "#133", /* 133 = putpmsg */ "rename", /* 134 = rename */ "svr4_sys_uname", /* 135 = svr4_sys_uname */ "setegid", /* 136 = setegid */ "svr4_sys_sysconfig", /* 137 = svr4_sys_sysconfig */ "adjtime", /* 138 = adjtime */ "svr4_sys_systeminfo", /* 139 = svr4_sys_systeminfo */ "#140", /* 140 = notused */ "seteuid", /* 141 = seteuid */ "#142", /* 142 = vtrace */ "#143", /* 143 = { */ "#144", /* 144 = sigtimedwait */ "#145", /* 145 = lwp_info */ "#146", /* 146 = yield */ "#147", /* 147 = lwp_sema_wait */ "#148", /* 148 = lwp_sema_post */ "#149", /* 149 = lwp_sema_trywait */ "#150", /* 150 = notused */ "#151", /* 151 = notused */ "#152", /* 152 = modctl */ "svr4_sys_fchroot", /* 153 = svr4_sys_fchroot */ "svr4_sys_utimes", /* 154 = svr4_sys_utimes */ "svr4_sys_vhangup", /* 155 = svr4_sys_vhangup */ "svr4_sys_gettimeofday", /* 156 = svr4_sys_gettimeofday */ "getitimer", /* 157 = getitimer */ "setitimer", /* 158 = setitimer */ "#159", /* 159 = lwp_create */ "#160", /* 160 = lwp_exit */ "#161", /* 161 = lwp_suspend */ "#162", /* 162 = lwp_continue */ "#163", /* 163 = lwp_kill */ "#164", /* 164 = lwp_self */ "#165", /* 165 = lwp_getprivate */ "#166", /* 166 = lwp_setprivate */ "#167", /* 167 = lwp_wait */ "#168", /* 168 = lwp_mutex_unlock */ "#169", /* 169 = lwp_mutex_lock */ "#170", /* 170 = lwp_cond_wait */ "#171", /* 171 = lwp_cond_signal */ "#172", /* 172 = lwp_cond_broadcast */ "#173", /* 173 = { */ "#174", /* 174 = { */ "svr4_sys_llseek", /* 175 = svr4_sys_llseek */ "#176", /* 176 = inst_sync */ "#177", /* 177 = whoknows */ "#178", /* 178 = kaio */ "#179", /* 179 = whoknows */ "#180", /* 180 = whoknows */ "#181", /* 181 = whoknows */ "#182", /* 182 = whoknows */ "#183", /* 183 = whoknows */ "#184", /* 184 = tsolsys */ "svr4_sys_acl", /* 185 = svr4_sys_acl */ "svr4_sys_auditsys", /* 186 = svr4_sys_auditsys */ "#187", /* 187 = processor_bind */ "#188", /* 188 = processor_info */ "#189", /* 189 = p_online */ "#190", /* 190 = sigqueue */ "#191", /* 191 = clock_gettime */ "#192", /* 192 = clock_settime */ "#193", /* 193 = clock_getres */ "#194", /* 194 = timer_create */ "#195", /* 195 = timer_delete */ "#196", /* 196 = timer_settime */ "#197", /* 197 = timer_gettime */ "#198", /* 198 = timer_overrun */ "nanosleep", /* 199 = nanosleep */ "svr4_sys_facl", /* 200 = svr4_sys_facl */ "#201", /* 201 = door */ "setreuid", /* 202 = setreuid */ "setregid", /* 203 = setregid */ "#204", /* 204 = install_utrap */ "#205", /* 205 = signotify */ "#206", /* 206 = schedctl */ "#207", /* 207 = pset */ "#208", /* 208 = whoknows */ "svr4_sys_resolvepath", /* 209 = svr4_sys_resolvepath */ "#210", /* 210 = signotifywait */ "#211", /* 211 = lwp_sigredirect */ "#212", /* 212 = lwp_alarm */ "svr4_sys_getdents64", /* 213 = svr4_sys_getdents64 */ "svr4_sys_mmap64", /* 214 = svr4_sys_mmap64 */ "svr4_sys_stat64", /* 215 = svr4_sys_stat64 */ "svr4_sys_lstat64", /* 216 = svr4_sys_lstat64 */ "svr4_sys_fstat64", /* 217 = svr4_sys_fstat64 */ "svr4_sys_statvfs64", /* 218 = svr4_sys_statvfs64 */ "svr4_sys_fstatvfs64", /* 219 = svr4_sys_fstatvfs64 */ "svr4_sys_setrlimit64", /* 220 = svr4_sys_setrlimit64 */ "svr4_sys_getrlimit64", /* 221 = svr4_sys_getrlimit64 */ "#222", /* 222 = pread64 */ "#223", /* 223 = pwrite64 */ "svr4_sys_creat64", /* 224 = svr4_sys_creat64 */ "svr4_sys_open64", /* 225 = svr4_sys_open64 */ "#226", /* 226 = rpcsys */ "#227", /* 227 = whoknows */ "#228", /* 228 = whoknows */ "#229", /* 229 = whoknows */ "svr4_sys_socket", /* 230 = svr4_sys_socket */ "socketpair", /* 231 = socketpair */ "bind", /* 232 = bind */ "listen", /* 233 = listen */ "accept", /* 234 = accept */ "connect", /* 235 = connect */ "shutdown", /* 236 = shutdown */ "svr4_sys_recv", /* 237 = svr4_sys_recv */ "recvfrom", /* 238 = recvfrom */ "recvmsg", /* 239 = recvmsg */ "svr4_sys_send", /* 240 = svr4_sys_send */ "sendmsg", /* 241 = sendmsg */ "svr4_sys_sendto", /* 242 = svr4_sys_sendto */ "getpeername", /* 243 = getpeername */ "getsockname", /* 244 = getsockname */ "getsockopt", /* 245 = getsockopt */ "setsockopt", /* 246 = setsockopt */ "#247", /* 247 = sockconfig */ "#248", /* 248 = { */ "#249", /* 249 = { */ };
MarginC/kame
freebsd5/sys/compat/svr4/svr4_syscallnames.c
C
bsd-3-clause
9,794
[ 30522, 1013, 1008, 1008, 2291, 2655, 3415, 1012, 1008, 1008, 2079, 2025, 10086, 1011, 1011, 2023, 5371, 2003, 8073, 7013, 1012, 1008, 1002, 2489, 5910, 2094, 1024, 5034, 2278, 1013, 25353, 2015, 1013, 4012, 4502, 2102, 1013, 17917, 2099, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2011-2013 The Animo Project * http://animotron.org * * This file is part of Animotron. * * Animotron is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * Animotron 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 Affero General Public License for more details. * * You should have received a copy of * the GNU Affero General Public License along with Animotron. * If not, see <http://www.gnu.org/licenses/>. */ package org.animotron.cache; import java.io.IOException; import java.io.OutputStream; /** * @author <a href="mailto:shabanovd@gmail.com">Dmitriy Shabanov</a> * @author <a href="mailto:gazdovsky@gmail.com">Evgeny Gazdovsky</a> * */ public interface Cache { public boolean available(String key) throws IOException; public void get(String key, OutputStream out) throws IOException; public void get(String key, StringBuilder out) throws IOException; public String get(String key) throws IOException; public OutputStream stream(String key, OutputStream out) throws IOException; public OutputStream stream(String key, StringBuilder out) throws IOException; public void drop(String key) throws IOException; }
animotron/core
src/main/java/org/animotron/cache/Cache.java
Java
agpl-3.0
1,548
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2249, 1011, 2286, 1996, 2019, 16339, 2622, 1008, 8299, 1024, 1013, 1013, 2019, 16339, 15312, 1012, 8917, 1008, 1008, 2023, 5371, 2003, 2112, 1997, 2019, 16339, 15312, 1012, 1008, 1008, 2019, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
def load_and_extend_graph_from_file(filename) session = Tensorflow::Session.new() graph = Tensorflow::Graph.new() graph.read(File.join(File.dirname(__FILE__), '..', 'example_graphs', filename)) session.extend_graph(graph) session end
chrhansen/tensorflow.rb
spec/support/load_and_extend_graph_from_file.rb
Ruby
bsd-3-clause
244
[ 30522, 13366, 7170, 1035, 1998, 1035, 7949, 1035, 10629, 1035, 2013, 1035, 5371, 1006, 5371, 18442, 1007, 5219, 1027, 23435, 12314, 1024, 1024, 5219, 1012, 2047, 1006, 1007, 10629, 1027, 23435, 12314, 1024, 1024, 10629, 1012, 2047, 1006, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
var expect = require('chai').expect describe('Pane', function () { describe('# Show pane', function () { it('should show a lateral pane when requested (click on data feature)', function () { const pane = require('../src/pane') expect(pane.show).to.be.a('function') pane.show() expect(document.getElementById('pane')).not.to.be.null }) }) describe('# Close pane', function () { it('should empty lateral pane when requested (click on map or click on close button)', function () { const pane = require('../src/pane') expect(pane.close).to.be.a('function') pane.close() expect(document.getElementById('pane').hasChildNodes()).to.be.false }) }) describe('# Show feature in pane', function () { const pane = require('../src/pane') const parcelFeature = require('./fixtures').getGoogleMapsParcelFeature() it('should have a hero header section with an image button', function () { pane.show(parcelFeature) var sectionsHeroHeader = document.getElementById('pane').getElementsByClassName('section-hero-header') expect(sectionsHeroHeader).to.not.be.null expect(sectionsHeroHeader.length).to.be.equal(1, '1 and only 1 section hero header') var sectionHeroHeader = sectionsHeroHeader[0] expect(sectionHeroHeader.getElementsByTagName('button')).to.not.be.null expect(sectionHeroHeader.getElementsByTagName('button').length).to.be.least(1, 'Almost a button in section-hero-header') var imageButton = sectionHeroHeader.getElementsByTagName('button')[0] expect(imageButton.getElementsByTagName('img')).to.not.be.null expect(imageButton.getElementsByTagName('img').length).to.be.least(1, 'Almost an image in the button of section-hero-header') }) it('and with a description in the hero header section', function () { pane.show(parcelFeature) var sectionHeroHeader = document.getElementById('pane').getElementsByClassName('section-hero-header')[0] expect(sectionHeroHeader.getElementsByClassName('section-hero-header-description')).to.not.be.null expect(sectionHeroHeader.getElementsByClassName('section-hero-header-description').length).to.be.least(1, 'Almost a description in section-hero-header') var description = sectionHeroHeader.getElementsByClassName('section-hero-header-description')[0] expect(description.getElementsByClassName('section-hero-header-title')).to.not.be.null expect(description.getElementsByClassName('section-hero-header-title').length).to.be.least(1, 'Almost a title in section-hero-header') expect(description.getElementsByTagName('h1').length).to.be.least(1, 'Almost a title in section-hero-header') expect(description.getElementsByTagName('h1')[0].textContent).to.be.equal(parcelFeature.properties.nationalCadastralReference, 'Title with the national cadastral reference of the selected parcel') expect(description.getElementsByClassName('section-hero-header-container')).to.not.be.null expect(description.getElementsByClassName('section-hero-header-description-container').length).to.be.least(1, 'Almost a description container in section-hero-header') }) it('should have an action section', function () { pane.show(parcelFeature) var sectionsAction = document.getElementById('pane').getElementsByClassName('section-action') expect(sectionsAction).to.not.be.null expect(sectionsAction.length).to.be.equal(1, '1 and only 1 action section') var sectionAction = sectionsAction[0] var buttons = sectionAction.getElementsByTagName('button') expect(buttons).to.not.be.null expect(buttons.length).to.be.equal(4, 'Four action buttons in the action section') }) }) })
ilice/OSCWeb
test/pane.test.js
JavaScript
apache-2.0
3,763
[ 30522, 13075, 5987, 1027, 5478, 1006, 1005, 15775, 2072, 1005, 1007, 1012, 5987, 6235, 1006, 1005, 6090, 2063, 1005, 1010, 3853, 1006, 1007, 1063, 6235, 1006, 1005, 1001, 2265, 6090, 2063, 1005, 1010, 3853, 1006, 1007, 1063, 2009, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
__all__ = ['Counter', 'deque', 'defaultdict', 'namedtuple', 'OrderedDict'] # For bootstrapping reasons, the collection ABCs are defined in _abcoll.py. # They should however be considered an integral part of collections.py. from _abcoll import * import _abcoll __all__ += _abcoll.__all__ from _collections import deque, defaultdict from operator import itemgetter as _itemgetter from keyword import iskeyword as _iskeyword import sys as _sys import heapq as _heapq from itertools import repeat as _repeat, chain as _chain, starmap as _starmap try: from thread import get_ident as _get_ident except ImportError: from dummy_thread import get_ident as _get_ident ################################################################################ ### OrderedDict ################################################################################ class OrderedDict(dict): 'Dictionary that remembers insertion order' # An inherited dict maps keys to values. # The inherited dict provides __getitem__, __len__, __contains__, and get. # The remaining methods are order-aware. # Big-O running times for all methods are the same as regular dictionaries. # The internal self.__map dict maps keys to links in a doubly linked list. # The circular doubly linked list starts and ends with a sentinel element. # The sentinel element never gets deleted (this simplifies the algorithm). # Each link is stored as a list of length three: [PREV, NEXT, KEY]. def __init__(self, *args, **kwds): '''Initialize an ordered dictionary. The signature is the same as regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary. ''' if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) try: self.__root except AttributeError: self.__root = root = [] # sentinel node root[:] = [root, root, None] self.__map = {} self.__update(*args, **kwds) def __setitem__(self, key, value, PREV=0, NEXT=1, dict_setitem=dict.__setitem__): 'od.__setitem__(i, y) <==> od[i]=y' # Setting a new item creates a new link at the end of the linked list, # and the inherited dictionary is updated with the new key/value pair. if key not in self: root = self.__root last = root[PREV] last[NEXT] = root[PREV] = self.__map[key] = [last, root, key] dict_setitem(self, key, value) def __delitem__(self, key, PREV=0, NEXT=1, dict_delitem=dict.__delitem__): 'od.__delitem__(y) <==> del od[y]' # Deleting an existing item uses self.__map to find the link which gets # removed by updating the links in the predecessor and successor nodes. dict_delitem(self, key) link_prev, link_next, key = self.__map.pop(key) link_prev[NEXT] = link_next link_next[PREV] = link_prev def __iter__(self): 'od.__iter__() <==> iter(od)' # Traverse the linked list in order. NEXT, KEY = 1, 2 root = self.__root curr = root[NEXT] while curr is not root: yield curr[KEY] curr = curr[NEXT] def __reversed__(self): 'od.__reversed__() <==> reversed(od)' # Traverse the linked list in reverse order. PREV, KEY = 0, 2 root = self.__root curr = root[PREV] while curr is not root: yield curr[KEY] curr = curr[PREV] def clear(self): 'od.clear() -> None. Remove all items from od.' for node in self.__map.itervalues(): del node[:] root = self.__root root[:] = [root, root, None] self.__map.clear() dict.clear(self) # -- the following methods do not depend on the internal structure -- def keys(self): 'od.keys() -> list of keys in od' return list(self) def values(self): 'od.values() -> list of values in od' return [self[key] for key in self] def items(self): 'od.items() -> list of (key, value) pairs in od' return [(key, self[key]) for key in self] def iterkeys(self): 'od.iterkeys() -> an iterator over the keys in od' return iter(self) def itervalues(self): 'od.itervalues -> an iterator over the values in od' for k in self: yield self[k] def iteritems(self): 'od.iteritems -> an iterator over the (key, value) pairs in od' for k in self: yield (k, self[k]) update = MutableMapping.update __update = update # let subclasses override update without breaking __init__ __marker = object() def pop(self, key, default=__marker): '''od.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. ''' if key in self: result = self[key] del self[key] return result if default is self.__marker: raise KeyError(key) return default def setdefault(self, key, default=None): 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' if key in self: return self[key] self[key] = default return default def popitem(self, last=True): '''od.popitem() -> (k, v), return and remove a (key, value) pair. Pairs are returned in LIFO order if last is true or FIFO order if false. ''' if not self: raise KeyError('dictionary is empty') key = next(reversed(self) if last else iter(self)) value = self.pop(key) return key, value def __repr__(self, _repr_running={}): 'od.__repr__() <==> repr(od)' call_key = id(self), _get_ident() if call_key in _repr_running: return '...' _repr_running[call_key] = 1 try: if not self: return '%s()' % (self.__class__.__name__,) return '%s(%r)' % (self.__class__.__name__, self.items()) finally: del _repr_running[call_key] def __reduce__(self): 'Return state information for pickling' items = [[k, self[k]] for k in self] inst_dict = vars(self).copy() for k in vars(OrderedDict()): inst_dict.pop(k, None) if inst_dict: return (self.__class__, (items,), inst_dict) return self.__class__, (items,) def copy(self): 'od.copy() -> a shallow copy of od' return self.__class__(self) @classmethod def fromkeys(cls, iterable, value=None): '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. If not specified, the value defaults to None. ''' self = cls() for key in iterable: self[key] = value return self def __eq__(self, other): '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive while comparison to a regular mapping is order-insensitive. ''' if isinstance(other, OrderedDict): return len(self)==len(other) and self.items() == other.items() return dict.__eq__(self, other) def __ne__(self, other): 'od.__ne__(y) <==> od!=y' return not self == other # -- the following methods support python 3.x style dictionary views -- def viewkeys(self): "od.viewkeys() -> a set-like object providing a view on od's keys" return KeysView(self) def viewvalues(self): "od.viewvalues() -> an object providing a view on od's values" return ValuesView(self) def viewitems(self): "od.viewitems() -> a set-like object providing a view on od's items" return ItemsView(self) ################################################################################ ### namedtuple ################################################################################ def namedtuple(typename, field_names, verbose=False, rename=False): """Returns a new subclass of tuple with named fields. >>> Point = namedtuple('Point', 'x y') >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) # instantiate with positional args or keywords >>> p[0] + p[1] # indexable like a plain tuple 33 >>> x, y = p # unpack like a regular tuple >>> x, y (11, 22) >>> p.x + p.y # fields also accessable by name 33 >>> d = p._asdict() # convert to a dictionary >>> d['x'] 11 >>> Point(**d) # convert from a dictionary Point(x=11, y=22) >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields Point(x=100, y=22) """ # Parse and validate the field names. Validation serves two purposes, # generating informative error messages and preventing template injection attacks. if isinstance(field_names, basestring): field_names = field_names.replace(',', ' ').split() # names separated by whitespace and/or commas field_names = tuple(map(str, field_names)) if rename: names = list(field_names) seen = set() for i, name in enumerate(names): if (not all(c.isalnum() or c=='_' for c in name) or _iskeyword(name) or not name or name[0].isdigit() or name.startswith('_') or name in seen): names[i] = '_%d' % i seen.add(name) field_names = tuple(names) for name in (typename,) + field_names: if not all(c.isalnum() or c=='_' for c in name): raise ValueError('Type names and field names can only contain alphanumeric characters and underscores: %r' % name) if _iskeyword(name): raise ValueError('Type names and field names cannot be a keyword: %r' % name) if name[0].isdigit(): raise ValueError('Type names and field names cannot start with a number: %r' % name) seen_names = set() for name in field_names: if name.startswith('_') and not rename: raise ValueError('Field names cannot start with an underscore: %r' % name) if name in seen_names: raise ValueError('Encountered duplicate field name: %r' % name) seen_names.add(name) # Create and fill-in the class template numfields = len(field_names) argtxt = repr(field_names).replace("'", "")[1:-1] # tuple repr without parens or quotes reprtxt = ', '.join('%s=%%r' % name for name in field_names) template = '''class %(typename)s(tuple): '%(typename)s(%(argtxt)s)' \n __slots__ = () \n _fields = %(field_names)r \n def __new__(_cls, %(argtxt)s): 'Create new instance of %(typename)s(%(argtxt)s)' return _tuple.__new__(_cls, (%(argtxt)s)) \n @classmethod def _make(cls, iterable, new=tuple.__new__, len=len): 'Make a new %(typename)s object from a sequence or iterable' result = new(cls, iterable) if len(result) != %(numfields)d: raise TypeError('Expected %(numfields)d arguments, got %%d' %% len(result)) return result \n def __repr__(self): 'Return a nicely formatted representation string' return '%(typename)s(%(reprtxt)s)' %% self \n def _asdict(self): 'Return a new OrderedDict which maps field names to their values' return OrderedDict(zip(self._fields, self)) \n def _replace(_self, **kwds): 'Return a new %(typename)s object replacing specified fields with new values' result = _self._make(map(kwds.pop, %(field_names)r, _self)) if kwds: raise ValueError('Got unexpected field names: %%r' %% kwds.keys()) return result \n def __getnewargs__(self): 'Return self as a plain tuple. Used by copy and pickle.' return tuple(self) \n\n''' % locals() for i, name in enumerate(field_names): template += " %s = _property(_itemgetter(%d), doc='Alias for field number %d')\n" % (name, i, i) if verbose: print template # Execute the template string in a temporary namespace and # support tracing utilities by setting a value for frame.f_globals['__name__'] namespace = dict(_itemgetter=_itemgetter, __name__='namedtuple_%s' % typename, OrderedDict=OrderedDict, _property=property, _tuple=tuple) try: exec template in namespace except SyntaxError, e: raise SyntaxError(e.message + ':\n' + template) result = namespace[typename] # For pickling to work, the __module__ variable needs to be set to the frame # where the named tuple is created. Bypass this step in enviroments where # sys._getframe is not defined (Jython for example) or sys._getframe is not # defined for arguments greater than 0 (IronPython). try: result.__module__ = _sys._getframe(1).f_globals.get('__name__', '__main__') except (AttributeError, ValueError): pass return result ######################################################################## ### Counter ######################################################################## class Counter(dict): '''Dict subclass for counting hashable items. Sometimes called a bag or multiset. Elements are stored as dictionary keys and their counts are stored as dictionary values. >>> c = Counter('abcdeabcdabcaba') # count elements from a string >>> c.most_common(3) # three most common elements [('a', 5), ('b', 4), ('c', 3)] >>> sorted(c) # list all unique elements ['a', 'b', 'c', 'd', 'e'] >>> ''.join(sorted(c.elements())) # list elements with repetitions 'aaaaabbbbcccdde' >>> sum(c.values()) # total of all counts 15 >>> c['a'] # count of letter 'a' 5 >>> for elem in 'shazam': # update counts from an iterable ... c[elem] += 1 # by adding 1 to each element's count >>> c['a'] # now there are seven 'a' 7 >>> del c['b'] # remove all 'b' >>> c['b'] # now there are zero 'b' 0 >>> d = Counter('simsalabim') # make another counter >>> c.update(d) # add in the second counter >>> c['a'] # now there are nine 'a' 9 >>> c.clear() # empty the counter >>> c Counter() Note: If a count is set to zero or reduced to zero, it will remain in the counter until the entry is deleted or the counter is cleared: >>> c = Counter('aaabbc') >>> c['b'] -= 2 # reduce the count of 'b' by two >>> c.most_common() # 'b' is still in, but its count is zero [('a', 3), ('c', 1), ('b', 0)] ''' # References: # http://en.wikipedia.org/wiki/Multiset # http://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html # http://www.demo2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.htm # http://code.activestate.com/recipes/259174/ # Knuth, TAOCP Vol. II section 4.6.3 def __init__(self, iterable=None, **kwds): '''Create a new, empty Counter object. And if given, count elements from an input iterable. Or, initialize the count from another mapping of elements to their counts. >>> c = Counter() # a new, empty counter >>> c = Counter('gallahad') # a new counter from an iterable >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a mapping >>> c = Counter(a=4, b=2) # a new counter from keyword args ''' super(Counter, self).__init__() self.update(iterable, **kwds) def __missing__(self, key): 'The count of elements not in the Counter is zero.' # Needed so that self[missing_item] does not raise KeyError return 0 def most_common(self, n=None): '''List the n most common elements and their counts from the most common to the least. If n is None, then list all element counts. >>> Counter('abcdeabcdabcaba').most_common(3) [('a', 5), ('b', 4), ('c', 3)] ''' # Emulate Bag.sortedByCount from Smalltalk if n is None: return sorted(self.iteritems(), key=_itemgetter(1), reverse=True) return _heapq.nlargest(n, self.iteritems(), key=_itemgetter(1)) def elements(self): '''Iterator over elements repeating each as many times as its count. >>> c = Counter('ABCABC') >>> sorted(c.elements()) ['A', 'A', 'B', 'B', 'C', 'C'] # Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1 >>> prime_factors = Counter({2: 2, 3: 3, 17: 1}) >>> product = 1 >>> for factor in prime_factors.elements(): # loop over factors ... product *= factor # and multiply them >>> product 1836 Note, if an element's count has been set to zero or is a negative number, elements() will ignore it. ''' # Emulate Bag.do from Smalltalk and Multiset.begin from C++. return _chain.from_iterable(_starmap(_repeat, self.iteritems())) # Override dict methods where necessary @classmethod def fromkeys(cls, iterable, v=None): # There is no equivalent method for counters because setting v=1 # means that no element can have a count greater than one. raise NotImplementedError( 'Counter.fromkeys() is undefined. Use Counter(iterable) instead.') def update(self, iterable=None, **kwds): '''Like dict.update() but add counts instead of replacing them. Source can be an iterable, a dictionary, or another Counter instance. >>> c = Counter('which') >>> c.update('witch') # add elements from another iterable >>> d = Counter('watch') >>> c.update(d) # add elements from another counter >>> c['h'] # four 'h' in which, witch, and watch 4 ''' # The regular dict.update() operation makes no sense here because the # replace behavior results in the some of original untouched counts # being mixed-in with all of the other counts for a mismash that # doesn't have a straight-forward interpretation in most counting # contexts. Instead, we implement straight-addition. Both the inputs # and outputs are allowed to contain zero and negative counts. if iterable is not None: if isinstance(iterable, Mapping): if self: self_get = self.get for elem, count in iterable.iteritems(): self[elem] = self_get(elem, 0) + count else: super(Counter, self).update(iterable) # fast path when counter is empty else: self_get = self.get for elem in iterable: self[elem] = self_get(elem, 0) + 1 if kwds: self.update(kwds) def subtract(self, iterable=None, **kwds): '''Like dict.update() but subtracts counts instead of replacing them. Counts can be reduced below zero. Both the inputs and outputs are allowed to contain zero and negative counts. Source can be an iterable, a dictionary, or another Counter instance. >>> c = Counter('which') >>> c.subtract('witch') # subtract elements from another iterable >>> c.subtract(Counter('watch')) # subtract elements from another counter >>> c['h'] # 2 in which, minus 1 in witch, minus 1 in watch 0 >>> c['w'] # 1 in which, minus 1 in witch, minus 1 in watch -1 ''' if iterable is not None: self_get = self.get if isinstance(iterable, Mapping): for elem, count in iterable.items(): self[elem] = self_get(elem, 0) - count else: for elem in iterable: self[elem] = self_get(elem, 0) - 1 if kwds: self.subtract(kwds) def copy(self): 'Return a shallow copy.' return self.__class__(self) def __reduce__(self): return self.__class__, (dict(self),) def __delitem__(self, elem): 'Like dict.__delitem__() but does not raise KeyError for missing values.' if elem in self: super(Counter, self).__delitem__(elem) def __repr__(self): if not self: return '%s()' % self.__class__.__name__ items = ', '.join(map('%r: %r'.__mod__, self.most_common())) return '%s({%s})' % (self.__class__.__name__, items) # Multiset-style mathematical operations discussed in: # Knuth TAOCP Volume II section 4.6.3 exercise 19 # and at http://en.wikipedia.org/wiki/Multiset # # Outputs guaranteed to only include positive counts. # # To strip negative and zero counts, add-in an empty counter: # c += Counter() def __add__(self, other): '''Add counts from two counters. >>> Counter('abbb') + Counter('bcc') Counter({'b': 4, 'c': 2, 'a': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items(): newcount = count + other[elem] if newcount > 0: result[elem] = newcount for elem, count in other.items(): if elem not in self and count > 0: result[elem] = count return result def __sub__(self, other): ''' Subtract count, but keep only results with positive counts. >>> Counter('abbbc') - Counter('bccd') Counter({'b': 2, 'a': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items(): newcount = count - other[elem] if newcount > 0: result[elem] = newcount for elem, count in other.items(): if elem not in self and count < 0: result[elem] = 0 - count return result def __or__(self, other): '''Union is the maximum of value in either of the input counters. >>> Counter('abbb') | Counter('bcc') Counter({'b': 3, 'c': 2, 'a': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items(): other_count = other[elem] newcount = other_count if count < other_count else count if newcount > 0: result[elem] = newcount for elem, count in other.items(): if elem not in self and count > 0: result[elem] = count return result def __and__(self, other): ''' Intersection is the minimum of corresponding counts. >>> Counter('abbb') & Counter('bcc') Counter({'b': 1}) ''' if not isinstance(other, Counter): return NotImplemented result = Counter() for elem, count in self.items(): other_count = other[elem] newcount = count if count < other_count else other_count if newcount > 0: result[elem] = newcount return result if __name__ == '__main__': # verify that instances can be pickled from cPickle import loads, dumps Point = namedtuple('Point', 'x, y', True) p = Point(x=10, y=20) assert p == loads(dumps(p)) # test and demonstrate ability to override methods class Point(namedtuple('Point', 'x y')): __slots__ = () @property def hypot(self): return (self.x ** 2 + self.y ** 2) ** 0.5 def __str__(self): return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, self.hypot) for p in Point(3, 4), Point(14, 5/7.): print p class Point(namedtuple('Point', 'x y')): 'Point class with optimized _make() and _replace() without error-checking' __slots__ = () _make = classmethod(tuple.__new__) def _replace(self, _map=map, **kwds): return self._make(_map(kwds.get, ('x', 'y'), self)) print Point(11, 22)._replace(x=100) Point3D = namedtuple('Point3D', Point._fields + ('z',)) print Point3D.__doc__ import doctest TestResults = namedtuple('TestResults', 'failed attempted') print TestResults(*doctest.testmod())
Symmetry-Innovations-Pty-Ltd/Python-2.7-for-QNX6.5.0-x86
usr/pkg/lib/python2.7/collections.py
Python
mit
25,363
[ 30522, 1035, 1035, 2035, 1035, 1035, 1027, 1031, 1005, 4675, 1005, 1010, 1005, 2139, 4226, 1005, 1010, 1005, 12398, 29201, 1005, 1010, 1005, 2315, 8525, 10814, 1005, 1010, 1005, 3641, 29201, 1005, 1033, 1001, 2005, 6879, 6494, 30524, 12324,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
-- Saga is Licensed under Creative Commons Attribution-NonCommerial-ShareAlike 3.0 License -- http://creativecommons.org/licenses/by-nc-sa/3.0/ -- Generated By Quest Extractor on 2/8/2008 3:46:17 PM local QuestID = 335; local ReqClv = 12; local ReqJlv = 0; local NextQuest = 0; local RewZeny = 292; local RewCxp = 675; local RewJxp = 0; local RewWxp = 0; local RewItem1 = 1700113; local RewItem2 = 0; local RewItemCount1 = 5; local RewItemCount2 = 0; -- Modify steps below for gameplay function QUEST_VERIFY(cid) return 0; end function QUEST_START(cid) -- Initialize all quest steps -- Initialize all starting navigation points return 0; end function QUEST_FINISH(cid) Saga.GiveZeny(cid, RewZeny); Saga.GiveExp(cid, RewCxp, RewJxp, RewWxp); return 0; end function QUEST_CANCEL(cid) return 0; end function QUEST_CHECK(cid) -- Check all steps for progress local CurStepID = Saga.GetStepIndex(cid, QuestID); -- TODO: Add code to check all progress return -1; end
Darkin47/SagaRevised
Quests/335.lua
Lua
cc0-1.0
979
[ 30522, 1011, 1011, 12312, 2003, 7000, 2104, 5541, 7674, 2012, 18886, 29446, 1011, 2512, 9006, 5017, 4818, 1011, 3745, 11475, 3489, 1017, 1012, 1014, 6105, 1011, 1011, 8299, 1024, 1013, 1013, 5541, 9006, 16563, 1012, 8917, 1013, 15943, 1013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
module(..., package.seeall) local ffi = require("ffi") local proto_header = require("lib.protocol.header") local tlv = require("lib.protocol.icmp.nd.options.tlv") -- This header implements the common structure of IPv6 ND options. -- They are *not* of type lib.protocol.header. Instead, this is a -- hack to work around the fact that the current class.lua does not -- support multiple inheritance. Classes derived from here also derive -- from lib.protocol.header. local nd_header = subClass(proto_header) function nd_header:options (mem, size) local result = {} while size > 0 do local tlv = tlv:new_from_mem(mem, size) table.insert(result, tlv) local tlv_size = tlv:length()*8 mem = mem + tlv_size size = size - tlv_size end assert(size == 0, "corrupt ND options") return(result) end return nd_header
fhanik/snabbswitch
src/lib/protocol/icmp/nd/header.lua
Lua
apache-2.0
852
[ 30522, 11336, 1006, 1012, 1012, 1012, 1010, 7427, 1012, 2156, 8095, 1007, 2334, 21461, 2072, 1027, 5478, 1006, 1000, 21461, 2072, 1000, 1007, 2334, 15053, 1035, 20346, 1027, 5478, 1006, 1000, 5622, 2497, 1012, 8778, 1012, 20346, 1000, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
from django.db import models # Create your models here. class Profil(models.Model): awal = '' PILIHAN_JENJANG = ( (awal, '----'), ('Pertama', 'Perekayasa Pertama'), ('Muda', 'Perekayasa Muda'), ('Madya', 'Perekayasa Madya'), ('Utama', 'Perekayasa Utama'), ) nip = models.CharField(max_length=50, verbose_name='NIP') pendidikan = models.CharField(max_length=150, verbose_name='Pendidikan') instansi = models.TextField(verbose_name='Nama Lengkap Unit') instansi_kode = models.CharField(max_length=20, verbose_name='Singkatan Unit') satuan = models.TextField(verbose_name='Nama Lengkap Satuan kerja', blank=True) kantor = models.TextField(verbose_name='Nama Lengkap Kantor', blank=True) pangkat = models.TextField(verbose_name='Pangkat/Golongan Ruang/TMT') jabatan = models.CharField(max_length=150, verbose_name='Jabatan') jenjang = models.CharField(max_length=10, verbose_name='Jenjang Perekayasa', choices=PILIHAN_JENJANG, default=awal) user = models.ForeignKey('auth.User', verbose_name='Personil', on_delete=models.CASCADE) class Meta: verbose_name_plural = 'Profil' def __str__(self): return self.nip
akbarpn136/perek-dj
utiliti/models.py
Python
cc0-1.0
1,225
[ 30522, 2013, 6520, 23422, 1012, 16962, 12324, 4275, 1001, 3443, 2115, 4275, 2182, 1012, 2465, 11268, 4014, 1006, 4275, 1012, 2944, 1007, 1024, 22091, 2389, 1027, 1005, 1005, 14255, 3669, 4819, 1035, 15419, 8405, 2290, 1027, 1006, 1006, 2209...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * @package WPSEO\Main */ if ( ! function_exists( 'add_filter' ) ) { header( 'Status: 403 Forbidden' ); header( 'HTTP/1.1 403 Forbidden' ); exit(); } /** * @internal Nobody should be able to overrule the real version number as this can cause serious issues * with the options, so no if ( ! defined() ) */ define( 'WPSEO_VERSION', '4.3' ); if ( ! defined( 'WPSEO_PATH' ) ) { define( 'WPSEO_PATH', plugin_dir_path( WPSEO_FILE ) ); } if ( ! defined( 'WPSEO_BASENAME' ) ) { define( 'WPSEO_BASENAME', plugin_basename( WPSEO_FILE ) ); } /* ***************************** CLASS AUTOLOADING *************************** */ /** * Auto load our class files * * @param string $class Class name. * * @return void */ function wpseo_auto_load( $class ) { static $classes = null; if ( $classes === null ) { $classes = array( 'wp_list_table' => ABSPATH . 'wp-admin/includes/class-wp-list-table.php', 'walker_category' => ABSPATH . 'wp-includes/category-template.php', 'pclzip' => ABSPATH . 'wp-admin/includes/class-pclzip.php', ); } $cn = strtolower( $class ); if ( ! class_exists( $class ) && isset( $classes[ $cn ] ) ) { require_once( $classes[ $cn ] ); } } if ( file_exists( WPSEO_PATH . '/vendor/autoload_52.php' ) ) { require WPSEO_PATH . '/vendor/autoload_52.php'; } elseif ( ! class_exists( 'WPSEO_Options' ) ) { // Still checking since might be site-level autoload R. add_action( 'admin_init', 'yoast_wpseo_missing_autoload', 1 ); return; } if ( function_exists( 'spl_autoload_register' ) ) { spl_autoload_register( 'wpseo_auto_load' ); } /* ********************* DEFINES DEPENDING ON AUTOLOADED CODE ********************* */ /** * Defaults to production, for safety */ if ( ! defined( 'YOAST_ENVIRONMENT' ) ) { define( 'YOAST_ENVIRONMENT', 'production' ); } /** * Only use minified assets when we are in a production environment */ if ( ! defined( 'WPSEO_CSSJS_SUFFIX' ) ) { define( 'WPSEO_CSSJS_SUFFIX', ( 'development' !== YOAST_ENVIRONMENT ) ? '.min' : '' ); } /* ***************************** PLUGIN (DE-)ACTIVATION *************************** */ /** * Run single site / network-wide activation of the plugin. * * @param bool $networkwide Whether the plugin is being activated network-wide. */ function wpseo_activate( $networkwide = false ) { if ( ! is_multisite() || ! $networkwide ) { _wpseo_activate(); } else { /* Multi-site network activation - activate the plugin for all blogs */ wpseo_network_activate_deactivate( true ); } } /** * Run single site / network-wide de-activation of the plugin. * * @param bool $networkwide Whether the plugin is being de-activated network-wide. */ function wpseo_deactivate( $networkwide = false ) { if ( ! is_multisite() || ! $networkwide ) { _wpseo_deactivate(); } else { /* Multi-site network activation - de-activate the plugin for all blogs */ wpseo_network_activate_deactivate( false ); } } /** * Run network-wide (de-)activation of the plugin * * @param bool $activate True for plugin activation, false for de-activation. */ function wpseo_network_activate_deactivate( $activate = true ) { global $wpdb; $network_blogs = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE site_id = %d", $wpdb->siteid ) ); if ( is_array( $network_blogs ) && $network_blogs !== array() ) { foreach ( $network_blogs as $blog_id ) { switch_to_blog( $blog_id ); if ( $activate === true ) { _wpseo_activate(); } else { _wpseo_deactivate(); } restore_current_blog(); } } } /** * Runs on activation of the plugin. */ function _wpseo_activate() { require_once( WPSEO_PATH . 'inc/wpseo-functions.php' ); require_once( WPSEO_PATH . 'inc/class-wpseo-installation.php' ); wpseo_load_textdomain(); // Make sure we have our translations available for the defaults. new WPSEO_Installation(); WPSEO_Options::get_instance(); if ( ! is_multisite() ) { WPSEO_Options::initialize(); } else { WPSEO_Options::maybe_set_multisite_defaults( true ); } WPSEO_Options::ensure_options_exist(); if ( is_multisite() && ms_is_switched() ) { delete_option( 'rewrite_rules' ); } else { $wpseo_rewrite = new WPSEO_Rewrite(); $wpseo_rewrite->schedule_flush(); } wpseo_add_capabilities(); // Clear cache so the changes are obvious. WPSEO_Utils::clear_cache(); do_action( 'wpseo_activate' ); } /** * On deactivation, flush the rewrite rules so XML sitemaps stop working. */ function _wpseo_deactivate() { require_once( WPSEO_PATH . 'inc/wpseo-functions.php' ); if ( is_multisite() && ms_is_switched() ) { delete_option( 'rewrite_rules' ); } else { add_action( 'shutdown', 'flush_rewrite_rules' ); } wpseo_remove_capabilities(); // Clear cache so the changes are obvious. WPSEO_Utils::clear_cache(); do_action( 'wpseo_deactivate' ); } /** * Run wpseo activation routine on creation / activation of a multisite blog if WPSEO is activated * network-wide. * * Will only be called by multisite actions. * * @internal Unfortunately will fail if the plugin is in the must-use directory * @see https://core.trac.wordpress.org/ticket/24205 * * @param int $blog_id Blog ID. */ function wpseo_on_activate_blog( $blog_id ) { if ( ! function_exists( 'is_plugin_active_for_network' ) ) { require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); } if ( is_plugin_active_for_network( plugin_basename( WPSEO_FILE ) ) ) { switch_to_blog( $blog_id ); wpseo_activate( false ); restore_current_blog(); } } /* ***************************** PLUGIN LOADING *************************** */ /** * Load translations */ function wpseo_load_textdomain() { $wpseo_path = str_replace( '\\', '/', WPSEO_PATH ); $mu_path = str_replace( '\\', '/', WPMU_PLUGIN_DIR ); if ( false !== stripos( $wpseo_path, $mu_path ) ) { load_muplugin_textdomain( 'wordpress-seo', dirname( WPSEO_BASENAME ) . '/languages/' ); } else { load_plugin_textdomain( 'wordpress-seo', false, dirname( WPSEO_BASENAME ) . '/languages/' ); } } add_action( 'plugins_loaded', 'wpseo_load_textdomain' ); /** * On plugins_loaded: load the minimum amount of essential files for this plugin */ function wpseo_init() { require_once( WPSEO_PATH . 'inc/wpseo-functions.php' ); require_once( WPSEO_PATH . 'inc/wpseo-functions-deprecated.php' ); // Make sure our option and meta value validation routines and default values are always registered and available. WPSEO_Options::get_instance(); WPSEO_Meta::init(); $options = WPSEO_Options::get_options( array( 'wpseo', 'wpseo_permalinks', 'wpseo_xml' ) ); if ( version_compare( $options['version'], WPSEO_VERSION, '<' ) ) { new WPSEO_Upgrade(); // Get a cleaned up version of the $options. $options = WPSEO_Options::get_options( array( 'wpseo', 'wpseo_permalinks', 'wpseo_xml' ) ); } if ( $options['stripcategorybase'] === true ) { $GLOBALS['wpseo_rewrite'] = new WPSEO_Rewrite; } if ( $options['enablexmlsitemap'] === true ) { $GLOBALS['wpseo_sitemaps'] = new WPSEO_Sitemaps; } if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) { require_once( WPSEO_PATH . 'inc/wpseo-non-ajax-functions.php' ); } // Init it here because the filter must be present on the frontend as well or it won't work in the customizer. new WPSEO_Customizer(); } /** * Loads the rest api endpoints. */ function wpseo_init_rest_api() { // We can't do anything when requirements are not met. if ( WPSEO_Utils::is_api_available() ) { // Boot up REST API. $configuration_service = new WPSEO_Configuration_Service(); $configuration_service->initialize(); } } /** * Used to load the required files on the plugins_loaded hook, instead of immediately. */ function wpseo_frontend_init() { add_action( 'init', 'initialize_wpseo_front' ); $options = WPSEO_Options::get_option( 'wpseo_internallinks' ); if ( $options['breadcrumbs-enable'] === true ) { /** * If breadcrumbs are active (which they supposedly are if the users has enabled this settings, * there's no reason to have bbPress breadcrumbs as well. * * @internal The class itself is only loaded when the template tag is encountered via * the template tag function in the wpseo-functions.php file */ add_filter( 'bbp_get_breadcrumb', '__return_false' ); } add_action( 'template_redirect', 'wpseo_frontend_head_init', 999 ); } /** * Instantiate the different social classes on the frontend */ function wpseo_frontend_head_init() { $options = WPSEO_Options::get_option( 'wpseo_social' ); if ( $options['twitter'] === true ) { add_action( 'wpseo_head', array( 'WPSEO_Twitter', 'get_instance' ), 40 ); } if ( $options['opengraph'] === true ) { $GLOBALS['wpseo_og'] = new WPSEO_OpenGraph; } } /** * Used to load the required files on the plugins_loaded hook, instead of immediately. */ function wpseo_admin_init() { new WPSEO_Admin_Init(); } /* ***************************** BOOTSTRAP / HOOK INTO WP *************************** */ $spl_autoload_exists = function_exists( 'spl_autoload_register' ); $filter_exists = function_exists( 'filter_input' ); if ( ! $spl_autoload_exists ) { add_action( 'admin_init', 'yoast_wpseo_missing_spl', 1 ); } if ( ! $filter_exists ) { add_action( 'admin_init', 'yoast_wpseo_missing_filter', 1 ); } if ( ! function_exists( 'wp_installing' ) ) { /** * We need to define wp_installing in WordPress versions older than 4.4 * * @return bool */ function wp_installing() { return defined( 'WP_INSTALLING' ); } } if ( ! wp_installing() && ( $spl_autoload_exists && $filter_exists ) ) { add_action( 'plugins_loaded', 'wpseo_init', 14 ); add_action( 'rest_api_init', 'wpseo_init_rest_api' ); if ( is_admin() ) { new Yoast_Alerts(); if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { require_once( WPSEO_PATH . 'admin/ajax.php' ); // Plugin conflict ajax hooks. new Yoast_Plugin_Conflict_Ajax(); if ( filter_input( INPUT_POST, 'action' ) === 'inline-save' ) { add_action( 'plugins_loaded', 'wpseo_admin_init', 15 ); } } else { add_action( 'plugins_loaded', 'wpseo_admin_init', 15 ); } } else { add_action( 'plugins_loaded', 'wpseo_frontend_init', 15 ); } add_action( 'plugins_loaded', 'load_yoast_notifications' ); } // Activation and deactivation hook. register_activation_hook( WPSEO_FILE, 'wpseo_activate' ); register_deactivation_hook( WPSEO_FILE, 'wpseo_deactivate' ); add_action( 'wpmu_new_blog', 'wpseo_on_activate_blog' ); add_action( 'activate_blog', 'wpseo_on_activate_blog' ); // Loading OnPage integration. new WPSEO_OnPage(); /** * Wraps for notifications center class. */ function load_yoast_notifications() { // Init Yoast_Notification_Center class. Yoast_Notification_Center::get(); } /** * Throw an error if the PHP SPL extension is disabled (prevent white screens) and self-deactivate plugin * * @since 1.5.4 * * @return void */ function yoast_wpseo_missing_spl() { if ( is_admin() ) { add_action( 'admin_notices', 'yoast_wpseo_missing_spl_notice' ); yoast_wpseo_self_deactivate(); } } /** * Returns the notice in case of missing spl extension */ function yoast_wpseo_missing_spl_notice() { $message = esc_html__( 'The Standard PHP Library (SPL) extension seem to be unavailable. Please ask your web host to enable it.', 'wordpress-seo' ); yoast_wpseo_activation_failed_notice( $message ); } /** * Throw an error if the Composer autoload is missing and self-deactivate plugin * * @return void */ function yoast_wpseo_missing_autoload() { if ( is_admin() ) { add_action( 'admin_notices', 'yoast_wpseo_missing_autoload_notice' ); yoast_wpseo_self_deactivate(); } } /** * Returns the notice in case of missing Composer autoload */ function yoast_wpseo_missing_autoload_notice() { /* translators: %1$s expands to Yoast SEO, %2$s / %3$s: links to the installation manual in the Readme for the Yoast SEO code repository on GitHub */ $message = esc_html__( 'The %1$s plugin installation is incomplete. Please refer to %2$sinstallation instructions%3$s.', 'wordpress-seo' ); $message = sprintf( $message, 'Yoast SEO', '<a href="https://github.com/Yoast/wordpress-seo#installation">', '</a>' ); yoast_wpseo_activation_failed_notice( $message ); } /** * Throw an error if the filter extension is disabled (prevent white screens) and self-deactivate plugin * * @since 2.0 * * @return void */ function yoast_wpseo_missing_filter() { if ( is_admin() ) { add_action( 'admin_notices', 'yoast_wpseo_missing_filter_notice' ); yoast_wpseo_self_deactivate(); } } /** * Returns the notice in case of missing filter extension */ function yoast_wpseo_missing_filter_notice() { $message = esc_html__( 'The filter extension seem to be unavailable. Please ask your web host to enable it.', 'wordpress-seo' ); yoast_wpseo_activation_failed_notice( $message ); } /** * Echo's the Activation failed notice with any given message. * * @param string $message Message string. */ function yoast_wpseo_activation_failed_notice( $message ) { echo '<div class="error"><p>' . __( 'Activation failed:', 'wordpress-seo' ) . ' ' . $message . '</p></div>'; } /** * The method will deactivate the plugin, but only once, done by the static $is_deactivated */ function yoast_wpseo_self_deactivate() { static $is_deactivated; if ( $is_deactivated === null ) { $is_deactivated = true; deactivate_plugins( plugin_basename( WPSEO_FILE ) ); if ( isset( $_GET['activate'] ) ) { unset( $_GET['activate'] ); } } }
michaelbontyes/ekogito
wp-content/plugins/wordpress-seo/wp-seo-main.php
PHP
mit
13,520
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1030, 7427, 30524, 28203, 10386, 1005, 1007, 1025, 20346, 1006, 1005, 8299, 1013, 1015, 1012, 1015, 28203, 10386, 1005, 1007, 1025, 6164, 1006, 1007, 1025, 1065, 1013, 1008, 1008, 1008, 1030...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.kinesisfirehose.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.kinesisfirehose.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * ProcessingConfiguration JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ProcessingConfigurationJsonUnmarshaller implements Unmarshaller<ProcessingConfiguration, JsonUnmarshallerContext> { public ProcessingConfiguration unmarshall(JsonUnmarshallerContext context) throws Exception { ProcessingConfiguration processingConfiguration = new ProcessingConfiguration(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("Enabled", targetDepth)) { context.nextToken(); processingConfiguration.setEnabled(context.getUnmarshaller(Boolean.class).unmarshall(context)); } if (context.testExpression("Processors", targetDepth)) { context.nextToken(); processingConfiguration.setProcessors(new ListUnmarshaller<Processor>(ProcessorJsonUnmarshaller.getInstance()).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return processingConfiguration; } private static ProcessingConfigurationJsonUnmarshaller instance; public static ProcessingConfigurationJsonUnmarshaller getInstance() { if (instance == null) instance = new ProcessingConfigurationJsonUnmarshaller(); return instance; } }
dagnir/aws-sdk-java
aws-java-sdk-kinesis/src/main/java/com/amazonaws/services/kinesisfirehose/model/transform/ProcessingConfigurationJsonUnmarshaller.java
Java
apache-2.0
3,132
[ 30522, 1013, 1008, 1008, 9385, 2262, 1011, 2418, 9733, 1012, 4012, 1010, 4297, 1012, 2030, 2049, 18460, 1012, 2035, 2916, 9235, 1012, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# #!/usr/bin/env python # -*- coding: utf-8 -*- # <HTTPretty - HTTP client mock for Python> # Copyright (C) <2011-2018> Gabriel Falcão <gabriel@nacaolivre.org> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following # conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. import requests from unittest import skip from sure import expect from httpretty import HTTPretty @skip def test_http_passthrough(): url = 'http://httpbin.org/status/200' response1 = requests.get(url) response1 = requests.get(url, stream=True) HTTPretty.enable() HTTPretty.register_uri(HTTPretty.GET, 'http://google.com/', body="Not Google") response2 = requests.get('http://google.com/') expect(response2.content).to.equal(b'Not Google') response3 = requests.get(url, stream=True) (response3.content).should.equal(response1.content) HTTPretty.disable() response4 = requests.get(url, stream=True) (response4.content).should.equal(response1.content) @skip def test_https_passthrough(): url = 'https://raw.githubusercontent.com/gabrielfalcao/HTTPretty/master/COPYING' response1 = requests.get(url, stream=True) HTTPretty.enable() HTTPretty.register_uri(HTTPretty.GET, 'https://google.com/', body="Not Google") response2 = requests.get('https://google.com/') expect(response2.content).to.equal(b'Not Google') response3 = requests.get(url, stream=True) (response3.content).should.equal(response1.content) HTTPretty.disable() response4 = requests.get(url, stream=True) (response4.content).should.equal(response1.content)
andresriancho/HTTPretty
tests/functional/test_passthrough.py
Python
mit
2,551
[ 30522, 1001, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 18750, 1001, 1011, 1008, 1011, 16861, 1024, 21183, 2546, 1011, 1022, 1011, 1008, 1011, 1001, 1026, 8299, 13465, 3723, 1011, 8299, 7396, 12934, 2005, 18750, 1028, 1001, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* Unix SMB/CIFS implementation. Winbind status program. Copyright (C) Tim Potter 2000-2003 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2003-2004 Copyright (C) Francesco Chemolli <kinkie@kame.usr.dsi.unimi.it> 2000 Copyright (C) Robert O'Callahan 2006 (added cached credential code). Copyright (C) Kai Blin <kai@samba.org> 2008 Copyright (C) Simo Sorce 2010 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "includes.h" #include "lib/param/param.h" #include "popt_common.h" #include "utils/ntlm_auth.h" #include "../libcli/auth/libcli_auth.h" #include "../libcli/auth/spnego.h" #include "auth/ntlmssp/ntlmssp.h" #include "auth/gensec/gensec.h" #include "auth/gensec/gensec_internal.h" #include "auth/credentials/credentials.h" #include "librpc/crypto/gse.h" #include "smb_krb5.h" #include "lib/util/tiniparser.h" #include "../lib/crypto/arcfour.h" #include "libads/kerberos_proto.h" #include "nsswitch/winbind_client.h" #include "librpc/gen_ndr/krb5pac.h" #include "../lib/util/asn1.h" #include "auth/common_auth.h" #include "source3/include/auth.h" #include "source3/auth/proto.h" #include "nsswitch/libwbclient/wbclient.h" #include "lib/param/loadparm.h" #if HAVE_KRB5 #include "auth/kerberos/pac_utils.h" #endif #ifndef PAM_WINBIND_CONFIG_FILE #define PAM_WINBIND_CONFIG_FILE "/etc/security/pam_winbind.conf" #endif #define WINBIND_KRB5_AUTH 0x00000080 #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND #define INITIAL_BUFFER_SIZE 300 #define MAX_BUFFER_SIZE 630000 enum stdio_helper_mode { SQUID_2_4_BASIC, SQUID_2_5_BASIC, SQUID_2_5_NTLMSSP, NTLMSSP_CLIENT_1, GSS_SPNEGO_SERVER, GSS_SPNEGO_CLIENT, NTLM_SERVER_1, NTLM_CHANGE_PASSWORD_1, NUM_HELPER_MODES }; enum ntlm_auth_cli_state { CLIENT_INITIAL = 0, CLIENT_RESPONSE, CLIENT_FINISHED, CLIENT_ERROR }; struct ntlm_auth_state { TALLOC_CTX *mem_ctx; enum stdio_helper_mode helper_mode; enum ntlm_auth_cli_state cli_state; struct ntlmssp_state *ntlmssp_state; uint32_t neg_flags; char *want_feature_list; bool have_session_key; DATA_BLOB session_key; DATA_BLOB initial_message; void *gensec_private_1; }; typedef void (*stdio_helper_function)(enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2); static void manage_squid_request(enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, stdio_helper_function fn, void **private2); static void manage_squid_basic_request (enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2); static void manage_squid_ntlmssp_request (enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2); static void manage_client_ntlmssp_request (enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2); static void manage_gss_spnego_request (enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2); static void manage_gss_spnego_client_request (enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2); static void manage_ntlm_server_1_request (enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2); static void manage_ntlm_change_password_1_request(enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2); static const struct { enum stdio_helper_mode mode; const char *name; stdio_helper_function fn; } stdio_helper_protocols[] = { { SQUID_2_4_BASIC, "squid-2.4-basic", manage_squid_basic_request}, { SQUID_2_5_BASIC, "squid-2.5-basic", manage_squid_basic_request}, { SQUID_2_5_NTLMSSP, "squid-2.5-ntlmssp", manage_squid_ntlmssp_request}, { NTLMSSP_CLIENT_1, "ntlmssp-client-1", manage_client_ntlmssp_request}, { GSS_SPNEGO_SERVER, "gss-spnego", manage_gss_spnego_request}, { GSS_SPNEGO_CLIENT, "gss-spnego-client", manage_gss_spnego_client_request}, { NTLM_SERVER_1, "ntlm-server-1", manage_ntlm_server_1_request}, { NTLM_CHANGE_PASSWORD_1, "ntlm-change-password-1", manage_ntlm_change_password_1_request}, { NUM_HELPER_MODES, NULL, NULL} }; const char *opt_username; const char *opt_domain; const char *opt_workstation; const char *opt_password; static DATA_BLOB opt_challenge; static DATA_BLOB opt_lm_response; static DATA_BLOB opt_nt_response; static int request_lm_key; static int request_user_session_key; static int use_cached_creds; static const char *require_membership_of; static const char *require_membership_of_sid; static const char *opt_pam_winbind_conf; const char *opt_target_service; const char *opt_target_hostname; /* This is a bit hairy, but the basic idea is to do a password callback to the calling application. The callback comes from within gensec */ static void manage_gensec_get_pw_request(enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **password) { DATA_BLOB in; if (strlen(buf) < 2) { DEBUG(1, ("query [%s] invalid", buf)); x_fprintf(x_stdout, "BH Query invalid\n"); return; } if (strlen(buf) > 3) { in = base64_decode_data_blob(buf + 3); } else { in = data_blob(NULL, 0); } if (strncmp(buf, "PW ", 3) == 0) { *password = talloc_strndup(NULL, (const char *)in.data, in.length); if (*password == NULL) { DEBUG(1, ("Out of memory\n")); x_fprintf(x_stdout, "BH Out of memory\n"); data_blob_free(&in); return; } x_fprintf(x_stdout, "OK\n"); data_blob_free(&in); return; } DEBUG(1, ("Asked for (and expected) a password\n")); x_fprintf(x_stdout, "BH Expected a password\n"); data_blob_free(&in); } /** * Callback for password credentials. This is not async, and when * GENSEC and the credentials code is made async, it will look rather * different. */ static const char *get_password(struct cli_credentials *credentials) { char *password = NULL; /* Ask for a password */ x_fprintf(x_stdout, "PW\n"); manage_squid_request(NUM_HELPER_MODES /* bogus */, NULL, NULL, manage_gensec_get_pw_request, (void **)&password); talloc_steal(credentials, password); return password; } /** * A limited set of features are defined with text strings as needed * by ntlm_auth * */ static void gensec_want_feature_list(struct gensec_security *state, char* feature_list) { if (in_list("NTLMSSP_FEATURE_SESSION_KEY", feature_list, true)) { DEBUG(10, ("want GENSEC_FEATURE_SESSION_KEY\n")); gensec_want_feature(state, GENSEC_FEATURE_SESSION_KEY); } if (in_list("NTLMSSP_FEATURE_SIGN", feature_list, true)) { DEBUG(10, ("want GENSEC_FEATURE_SIGN\n")); gensec_want_feature(state, GENSEC_FEATURE_SIGN); } if (in_list("NTLMSSP_FEATURE_SEAL", feature_list, true)) { DEBUG(10, ("want GENSEC_FEATURE_SEAL\n")); gensec_want_feature(state, GENSEC_FEATURE_SEAL); } } static char winbind_separator(void) { struct winbindd_response response; static bool got_sep; static char sep; if (got_sep) return sep; ZERO_STRUCT(response); /* Send off request */ if (winbindd_request_response(NULL, WINBINDD_INFO, NULL, &response) != NSS_STATUS_SUCCESS) { d_printf("could not obtain winbind separator!\n"); return *lp_winbind_separator(); } sep = response.data.info.winbind_separator; got_sep = True; if (!sep) { d_printf("winbind separator was NULL!\n"); return *lp_winbind_separator(); } return sep; } const char *get_winbind_domain(void) { struct winbindd_response response; static fstring winbind_domain; if (*winbind_domain) { return winbind_domain; } ZERO_STRUCT(response); /* Send off request */ if (winbindd_request_response(NULL, WINBINDD_DOMAIN_NAME, NULL, &response) != NSS_STATUS_SUCCESS) { DEBUG(1, ("could not obtain winbind domain name!\n")); return lp_workgroup(); } fstrcpy(winbind_domain, response.data.domain_name); return winbind_domain; } const char *get_winbind_netbios_name(void) { struct winbindd_response response; static fstring winbind_netbios_name; if (*winbind_netbios_name) { return winbind_netbios_name; } ZERO_STRUCT(response); /* Send off request */ if (winbindd_request_response(NULL, WINBINDD_NETBIOS_NAME, NULL, &response) != NSS_STATUS_SUCCESS) { DEBUG(1, ("could not obtain winbind netbios name!\n")); return lp_netbios_name(); } fstrcpy(winbind_netbios_name, response.data.netbios_name); return winbind_netbios_name; } DATA_BLOB get_challenge(void) { static DATA_BLOB chal; if (opt_challenge.length) return opt_challenge; chal = data_blob(NULL, 8); generate_random_buffer(chal.data, chal.length); return chal; } /* Copy of parse_domain_user from winbindd_util.c. Parse a string of the form DOMAIN/user into a domain and a user */ static bool parse_ntlm_auth_domain_user(const char *domuser, fstring domain, fstring user) { char *p = strchr(domuser,winbind_separator()); if (!p) { return False; } fstrcpy(user, p+1); fstrcpy(domain, domuser); domain[PTR_DIFF(p, domuser)] = 0; return strupper_m(domain); } static bool get_require_membership_sid(void) { struct winbindd_request request; struct winbindd_response response; if (!require_membership_of) { return True; } if (require_membership_of_sid) { return True; } /* Otherwise, ask winbindd for the name->sid request */ ZERO_STRUCT(request); ZERO_STRUCT(response); if (!parse_ntlm_auth_domain_user(require_membership_of, request.data.name.dom_name, request.data.name.name)) { DEBUG(0, ("Could not parse %s into separate domain/name parts!\n", require_membership_of)); return False; } if (winbindd_request_response(NULL, WINBINDD_LOOKUPNAME, &request, &response) != NSS_STATUS_SUCCESS) { DEBUG(0, ("Winbindd lookupname failed to resolve %s into a SID!\n", require_membership_of)); return False; } require_membership_of_sid = SMB_STRDUP(response.data.sid.sid); if (require_membership_of_sid) return True; return False; } /* * Get some configuration from pam_winbind.conf to see if we * need to contact trusted domain */ int get_pam_winbind_config() { int ctrl = 0; struct tiniparser_dictionary *d = NULL; if (!opt_pam_winbind_conf || !*opt_pam_winbind_conf) { opt_pam_winbind_conf = PAM_WINBIND_CONFIG_FILE; } d = tiniparser_load(opt_pam_winbind_conf); if (!d) { return 0; } if (tiniparser_getboolean(d, "global:krb5_auth", false)) { ctrl |= WINBIND_KRB5_AUTH; } tiniparser_freedict(d); return ctrl; } /* Authenticate a user with a plaintext password */ static bool check_plaintext_auth(const char *user, const char *pass, bool stdout_diagnostics) { struct winbindd_request request; struct winbindd_response response; NSS_STATUS result; if (!get_require_membership_sid()) { return False; } /* Send off request */ ZERO_STRUCT(request); ZERO_STRUCT(response); fstrcpy(request.data.auth.user, user); fstrcpy(request.data.auth.pass, pass); if (require_membership_of_sid) { strlcpy(request.data.auth.require_membership_of_sid, require_membership_of_sid, sizeof(request.data.auth.require_membership_of_sid)); } result = winbindd_request_response(NULL, WINBINDD_PAM_AUTH, &request, &response); /* Display response */ if (stdout_diagnostics) { if ((result != NSS_STATUS_SUCCESS) && (response.data.auth.nt_status == 0)) { d_printf("Reading winbind reply failed! (0x01)\n"); } d_printf("%s: %s (0x%x)\n", response.data.auth.nt_status_string, response.data.auth.error_string, response.data.auth.nt_status); } else { if ((result != NSS_STATUS_SUCCESS) && (response.data.auth.nt_status == 0)) { DEBUG(1, ("Reading winbind reply failed! (0x01)\n")); } DEBUG(3, ("%s: %s (0x%x)\n", response.data.auth.nt_status_string, response.data.auth.error_string, response.data.auth.nt_status)); } return (result == NSS_STATUS_SUCCESS); } /* authenticate a user with an encrypted username/password */ NTSTATUS contact_winbind_auth_crap(const char *username, const char *domain, const char *workstation, const DATA_BLOB *challenge, const DATA_BLOB *lm_response, const DATA_BLOB *nt_response, uint32_t flags, uint32_t extra_logon_parameters, uint8_t lm_key[8], uint8_t user_session_key[16], char **error_string, char **unix_name) { NTSTATUS nt_status; NSS_STATUS result; struct winbindd_request request; struct winbindd_response response; if (!get_require_membership_sid()) { return NT_STATUS_INVALID_PARAMETER; } ZERO_STRUCT(request); ZERO_STRUCT(response); request.flags = flags; request.data.auth_crap.logon_parameters = extra_logon_parameters | MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT | MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT; if (require_membership_of_sid) fstrcpy(request.data.auth_crap.require_membership_of_sid, require_membership_of_sid); fstrcpy(request.data.auth_crap.user, username); fstrcpy(request.data.auth_crap.domain, domain); fstrcpy(request.data.auth_crap.workstation, workstation); memcpy(request.data.auth_crap.chal, challenge->data, MIN(challenge->length, 8)); if (lm_response && lm_response->length) { memcpy(request.data.auth_crap.lm_resp, lm_response->data, MIN(lm_response->length, sizeof(request.data.auth_crap.lm_resp))); request.data.auth_crap.lm_resp_len = lm_response->length; } if (nt_response && nt_response->length) { if (nt_response->length > sizeof(request.data.auth_crap.nt_resp)) { request.flags = request.flags | WBFLAG_BIG_NTLMV2_BLOB; request.extra_len = nt_response->length; request.extra_data.data = SMB_MALLOC_ARRAY(char, request.extra_len); if (request.extra_data.data == NULL) { return NT_STATUS_NO_MEMORY; } memcpy(request.extra_data.data, nt_response->data, nt_response->length); } else { memcpy(request.data.auth_crap.nt_resp, nt_response->data, nt_response->length); } request.data.auth_crap.nt_resp_len = nt_response->length; } result = winbindd_request_response(NULL, WINBINDD_PAM_AUTH_CRAP, &request, &response); SAFE_FREE(request.extra_data.data); /* Display response */ if ((result != NSS_STATUS_SUCCESS) && (response.data.auth.nt_status == 0)) { nt_status = NT_STATUS_UNSUCCESSFUL; if (error_string) *error_string = smb_xstrdup("Reading winbind reply failed!"); winbindd_free_response(&response); return nt_status; } nt_status = (NT_STATUS(response.data.auth.nt_status)); if (!NT_STATUS_IS_OK(nt_status)) { if (error_string) *error_string = smb_xstrdup(response.data.auth.error_string); winbindd_free_response(&response); return nt_status; } if ((flags & WBFLAG_PAM_LMKEY) && lm_key) { memcpy(lm_key, response.data.auth.first_8_lm_hash, sizeof(response.data.auth.first_8_lm_hash)); } if ((flags & WBFLAG_PAM_USER_SESSION_KEY) && user_session_key) { memcpy(user_session_key, response.data.auth.user_session_key, sizeof(response.data.auth.user_session_key)); } if (flags & WBFLAG_PAM_UNIX_NAME) { *unix_name = SMB_STRDUP(response.data.auth.unix_username); if (!*unix_name) { winbindd_free_response(&response); return NT_STATUS_NO_MEMORY; } } winbindd_free_response(&response); return nt_status; } /* contact server to change user password using auth crap */ static NTSTATUS contact_winbind_change_pswd_auth_crap(const char *username, const char *domain, const DATA_BLOB new_nt_pswd, const DATA_BLOB old_nt_hash_enc, const DATA_BLOB new_lm_pswd, const DATA_BLOB old_lm_hash_enc, char **error_string) { NTSTATUS nt_status; NSS_STATUS result; struct winbindd_request request; struct winbindd_response response; if (!get_require_membership_sid()) { if(error_string) *error_string = smb_xstrdup("Can't get membership sid."); return NT_STATUS_INVALID_PARAMETER; } ZERO_STRUCT(request); ZERO_STRUCT(response); if(username != NULL) fstrcpy(request.data.chng_pswd_auth_crap.user, username); if(domain != NULL) fstrcpy(request.data.chng_pswd_auth_crap.domain,domain); if(new_nt_pswd.length) { memcpy(request.data.chng_pswd_auth_crap.new_nt_pswd, new_nt_pswd.data, sizeof(request.data.chng_pswd_auth_crap.new_nt_pswd)); request.data.chng_pswd_auth_crap.new_nt_pswd_len = new_nt_pswd.length; } if(old_nt_hash_enc.length) { memcpy(request.data.chng_pswd_auth_crap.old_nt_hash_enc, old_nt_hash_enc.data, sizeof(request.data.chng_pswd_auth_crap.old_nt_hash_enc)); request.data.chng_pswd_auth_crap.old_nt_hash_enc_len = old_nt_hash_enc.length; } if(new_lm_pswd.length) { memcpy(request.data.chng_pswd_auth_crap.new_lm_pswd, new_lm_pswd.data, sizeof(request.data.chng_pswd_auth_crap.new_lm_pswd)); request.data.chng_pswd_auth_crap.new_lm_pswd_len = new_lm_pswd.length; } if(old_lm_hash_enc.length) { memcpy(request.data.chng_pswd_auth_crap.old_lm_hash_enc, old_lm_hash_enc.data, sizeof(request.data.chng_pswd_auth_crap.old_lm_hash_enc)); request.data.chng_pswd_auth_crap.old_lm_hash_enc_len = old_lm_hash_enc.length; } result = winbindd_request_response(NULL, WINBINDD_PAM_CHNG_PSWD_AUTH_CRAP, &request, &response); /* Display response */ if ((result != NSS_STATUS_SUCCESS) && (response.data.auth.nt_status == 0)) { nt_status = NT_STATUS_UNSUCCESSFUL; if (error_string) *error_string = smb_xstrdup("Reading winbind reply failed!"); winbindd_free_response(&response); return nt_status; } nt_status = (NT_STATUS(response.data.auth.nt_status)); if (!NT_STATUS_IS_OK(nt_status)) { if (error_string) *error_string = smb_xstrdup(response.data.auth.error_string); winbindd_free_response(&response); return nt_status; } winbindd_free_response(&response); return nt_status; } static NTSTATUS ntlm_auth_generate_session_info(struct auth4_context *auth_context, TALLOC_CTX *mem_ctx, void *server_returned_info, const char *original_user_name, uint32_t session_info_flags, struct auth_session_info **session_info_out) { char *unix_username = (char *)server_returned_info; struct auth_session_info *session_info = talloc_zero(mem_ctx, struct auth_session_info); if (!session_info) { return NT_STATUS_NO_MEMORY; } session_info->unix_info = talloc_zero(session_info, struct auth_user_info_unix); if (!session_info->unix_info) { TALLOC_FREE(session_info); return NT_STATUS_NO_MEMORY; } session_info->unix_info->unix_name = talloc_steal(session_info->unix_info, unix_username); *session_info_out = session_info; return NT_STATUS_OK; } static NTSTATUS ntlm_auth_generate_session_info_pac(struct auth4_context *auth_ctx, TALLOC_CTX *mem_ctx, struct smb_krb5_context *smb_krb5_context, DATA_BLOB *pac_blob, const char *princ_name, const struct tsocket_address *remote_address, uint32_t session_info_flags, struct auth_session_info **session_info) { TALLOC_CTX *tmp_ctx; struct PAC_LOGON_INFO *logon_info = NULL; char *unixuser; NTSTATUS status; char *domain = NULL; char *realm = NULL; char *user = NULL; char *p; tmp_ctx = talloc_new(mem_ctx); if (!tmp_ctx) { return NT_STATUS_NO_MEMORY; } if (pac_blob) { #ifdef HAVE_KRB5 status = kerberos_pac_logon_info(tmp_ctx, *pac_blob, NULL, NULL, NULL, NULL, 0, &logon_info); #else status = NT_STATUS_ACCESS_DENIED; #endif if (!NT_STATUS_IS_OK(status)) { goto done; } } DEBUG(3, ("Kerberos ticket principal name is [%s]\n", princ_name)); p = strchr_m(princ_name, '@'); if (!p) { DEBUG(3, ("[%s] Doesn't look like a valid principal\n", princ_name)); return NT_STATUS_LOGON_FAILURE; } user = talloc_strndup(mem_ctx, princ_name, p - princ_name); if (!user) { return NT_STATUS_NO_MEMORY; } realm = talloc_strdup(talloc_tos(), p + 1); if (!realm) { return NT_STATUS_NO_MEMORY; } if (!strequal(realm, lp_realm())) { DEBUG(3, ("Ticket for foreign realm %s@%s\n", user, realm)); if (!lp_allow_trusted_domains()) { return NT_STATUS_LOGON_FAILURE; } } if (logon_info && logon_info->info3.base.logon_domain.string) { domain = talloc_strdup(mem_ctx, logon_info->info3.base.logon_domain.string); if (!domain) { return NT_STATUS_NO_MEMORY; } DEBUG(10, ("Domain is [%s] (using PAC)\n", domain)); } else { /* If we have winbind running, we can (and must) shorten the username by using the short netbios name. Otherwise we will have inconsistent user names. With Kerberos, we get the fully qualified realm, with ntlmssp we get the short name. And even w2k3 does use ntlmssp if you for example connect to an ip address. */ wbcErr wbc_status; struct wbcDomainInfo *info = NULL; DEBUG(10, ("Mapping [%s] to short name using winbindd\n", realm)); wbc_status = wbcDomainInfo(realm, &info); if (WBC_ERROR_IS_OK(wbc_status)) { domain = talloc_strdup(mem_ctx, info->short_name); wbcFreeMemory(info); } else { DEBUG(3, ("Could not find short name: %s\n", wbcErrorString(wbc_status))); domain = talloc_strdup(mem_ctx, realm); } if (!domain) { return NT_STATUS_NO_MEMORY; } DEBUG(10, ("Domain is [%s] (using Winbind)\n", domain)); } unixuser = talloc_asprintf(tmp_ctx, "%s%c%s", domain, winbind_separator(), user); if (!unixuser) { status = NT_STATUS_NO_MEMORY; goto done; } status = ntlm_auth_generate_session_info(auth_ctx, mem_ctx, unixuser, NULL, session_info_flags, session_info); done: TALLOC_FREE(tmp_ctx); return status; } /** * Return the challenge as determined by the authentication subsystem * @return an 8 byte random challenge */ static NTSTATUS ntlm_auth_get_challenge(struct auth4_context *auth_ctx, uint8_t chal[8]) { if (auth_ctx->challenge.data.length == 8) { DEBUG(5, ("auth_get_challenge: returning previous challenge by module %s (normal)\n", auth_ctx->challenge.set_by)); memcpy(chal, auth_ctx->challenge.data.data, 8); return NT_STATUS_OK; } if (!auth_ctx->challenge.set_by) { generate_random_buffer(chal, 8); auth_ctx->challenge.data = data_blob_talloc(auth_ctx, chal, 8); NT_STATUS_HAVE_NO_MEMORY(auth_ctx->challenge.data.data); auth_ctx->challenge.set_by = "random"; } DEBUG(10,("auth_get_challenge: challenge set by %s\n", auth_ctx->challenge.set_by)); return NT_STATUS_OK; } /** * NTLM2 authentication modifies the effective challenge, * @param challenge The new challenge value */ static NTSTATUS ntlm_auth_set_challenge(struct auth4_context *auth_ctx, const uint8_t chal[8], const char *set_by) { auth_ctx->challenge.set_by = talloc_strdup(auth_ctx, set_by); NT_STATUS_HAVE_NO_MEMORY(auth_ctx->challenge.set_by); auth_ctx->challenge.data = data_blob_talloc(auth_ctx, chal, 8); NT_STATUS_HAVE_NO_MEMORY(auth_ctx->challenge.data.data); return NT_STATUS_OK; } /** * Check the password on an NTLMSSP login. * * Return the session keys used on the connection. */ static NTSTATUS winbind_pw_check(struct auth4_context *auth4_context, TALLOC_CTX *mem_ctx, const struct auth_usersupplied_info *user_info, void **server_returned_info, DATA_BLOB *session_key, DATA_BLOB *lm_session_key) { static const char zeros[16] = { 0, }; NTSTATUS nt_status; char *error_string = NULL; uint8_t lm_key[8]; uint8_t user_sess_key[16]; char *unix_name = NULL; nt_status = contact_winbind_auth_crap(user_info->client.account_name, user_info->client.domain_name, user_info->workstation_name, &auth4_context->challenge.data, &user_info->password.response.lanman, &user_info->password.response.nt, WBFLAG_PAM_LMKEY | WBFLAG_PAM_USER_SESSION_KEY | WBFLAG_PAM_UNIX_NAME, 0, lm_key, user_sess_key, &error_string, &unix_name); if (NT_STATUS_IS_OK(nt_status)) { if (memcmp(lm_key, zeros, 8) != 0) { *lm_session_key = data_blob_talloc(mem_ctx, NULL, 16); memcpy(lm_session_key->data, lm_key, 8); memset(lm_session_key->data+8, '\0', 8); } if (memcmp(user_sess_key, zeros, 16) != 0) { *session_key = data_blob_talloc(mem_ctx, user_sess_key, 16); } *server_returned_info = talloc_strdup(mem_ctx, unix_name); } else { DEBUG(NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCESS_DENIED) ? 0 : 3, ("Login for user [%s]\\[%s]@[%s] failed due to [%s]\n", user_info->client.domain_name, user_info->client.account_name, user_info->workstation_name, error_string ? error_string : "unknown error (NULL)")); } SAFE_FREE(error_string); SAFE_FREE(unix_name); return nt_status; } static NTSTATUS local_pw_check(struct auth4_context *auth4_context, TALLOC_CTX *mem_ctx, const struct auth_usersupplied_info *user_info, void **server_returned_info, DATA_BLOB *session_key, DATA_BLOB *lm_session_key) { NTSTATUS nt_status; struct samr_Password lm_pw, nt_pw; nt_lm_owf_gen (opt_password, nt_pw.hash, lm_pw.hash); nt_status = ntlm_password_check(mem_ctx, true, true, 0, &auth4_context->challenge.data, &user_info->password.response.lanman, &user_info->password.response.nt, user_info->client.account_name, user_info->client.account_name, user_info->client.domain_name, &lm_pw, &nt_pw, session_key, lm_session_key); if (NT_STATUS_IS_OK(nt_status)) { *server_returned_info = talloc_asprintf(mem_ctx, "%s%c%s", user_info->client.domain_name, *lp_winbind_separator(), user_info->client.account_name); } else { DEBUG(3, ("Login for user [%s]\\[%s]@[%s] failed due to [%s]\n", user_info->client.domain_name, user_info->client.account_name, user_info->workstation_name, nt_errstr(nt_status))); } return nt_status; } static NTSTATUS ntlm_auth_start_ntlmssp_client(struct ntlmssp_state **client_ntlmssp_state) { NTSTATUS status; if ( (opt_username == NULL) || (opt_domain == NULL) ) { status = NT_STATUS_UNSUCCESSFUL; DEBUG(1, ("Need username and domain for NTLMSSP\n")); return NT_STATUS_INVALID_PARAMETER; } status = ntlmssp_client_start(NULL, lp_netbios_name(), lp_workgroup(), lp_client_ntlmv2_auth(), client_ntlmssp_state); if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("Could not start NTLMSSP client: %s\n", nt_errstr(status))); TALLOC_FREE(*client_ntlmssp_state); return status; } status = ntlmssp_set_username(*client_ntlmssp_state, opt_username); if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("Could not set username: %s\n", nt_errstr(status))); TALLOC_FREE(*client_ntlmssp_state); return status; } status = ntlmssp_set_domain(*client_ntlmssp_state, opt_domain); if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("Could not set domain: %s\n", nt_errstr(status))); TALLOC_FREE(*client_ntlmssp_state); return status; } if (opt_password) { status = ntlmssp_set_password(*client_ntlmssp_state, opt_password); if (!NT_STATUS_IS_OK(status)) { DEBUG(1, ("Could not set password: %s\n", nt_errstr(status))); TALLOC_FREE(*client_ntlmssp_state); return status; } } return NT_STATUS_OK; } static struct auth4_context *make_auth4_context_ntlm_auth(TALLOC_CTX *mem_ctx, bool local_pw) { struct auth4_context *auth4_context = talloc_zero(mem_ctx, struct auth4_context); if (auth4_context == NULL) { DEBUG(10, ("failed to allocate auth4_context failed\n")); return NULL; } auth4_context->generate_session_info = ntlm_auth_generate_session_info; auth4_context->generate_session_info_pac = ntlm_auth_generate_session_info_pac; auth4_context->get_ntlm_challenge = ntlm_auth_get_challenge; auth4_context->set_ntlm_challenge = ntlm_auth_set_challenge; if (local_pw) { auth4_context->check_ntlm_password = local_pw_check; } else { auth4_context->check_ntlm_password = winbind_pw_check; } auth4_context->private_data = NULL; return auth4_context; } static NTSTATUS ntlm_auth_prepare_gensec_server(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, struct gensec_security **gensec_security_out) { struct gensec_security *gensec_security; NTSTATUS nt_status; TALLOC_CTX *tmp_ctx; const struct gensec_security_ops **backends; struct gensec_settings *gensec_settings; size_t idx = 0; struct cli_credentials *server_credentials; struct auth4_context *auth4_context; tmp_ctx = talloc_new(mem_ctx); NT_STATUS_HAVE_NO_MEMORY(tmp_ctx); auth4_context = make_auth4_context_ntlm_auth(tmp_ctx, opt_password); if (auth4_context == NULL) { TALLOC_FREE(tmp_ctx); return NT_STATUS_NO_MEMORY; } gensec_settings = lpcfg_gensec_settings(tmp_ctx, lp_ctx); if (lp_ctx == NULL) { DEBUG(10, ("lpcfg_gensec_settings failed\n")); TALLOC_FREE(tmp_ctx); return NT_STATUS_NO_MEMORY; } /* * This should be a 'netbios domain -> DNS domain' * mapping, and can currently validly return NULL on * poorly configured systems. * * This is used for the NTLMSSP server * */ if (opt_password) { gensec_settings->server_netbios_name = lp_netbios_name(); gensec_settings->server_netbios_domain = lp_workgroup(); } else { gensec_settings->server_netbios_name = get_winbind_netbios_name(); gensec_settings->server_netbios_domain = get_winbind_domain(); } gensec_settings->server_dns_domain = strlower_talloc(gensec_settings, get_mydnsdomname(talloc_tos())); gensec_settings->server_dns_name = strlower_talloc(gensec_settings, get_mydnsfullname()); backends = talloc_zero_array(gensec_settings, const struct gensec_security_ops *, 4); if (backends == NULL) { TALLOC_FREE(tmp_ctx); return NT_STATUS_NO_MEMORY; } gensec_settings->backends = backends; gensec_init(); /* These need to be in priority order, krb5 before NTLMSSP */ #if defined(HAVE_KRB5) backends[idx++] = &gensec_gse_krb5_security_ops; #endif backends[idx++] = gensec_security_by_oid(NULL, GENSEC_OID_NTLMSSP); backends[idx++] = gensec_security_by_oid(NULL, GENSEC_OID_SPNEGO); /* * This is anonymous for now, because we just use it * to set the kerberos state at the moment */ server_credentials = cli_credentials_init_anon(tmp_ctx); if (!server_credentials) { DEBUG(0, ("auth_generic_prepare: Failed to init server credentials\n")); return NT_STATUS_NO_MEMORY; } cli_credentials_set_conf(server_credentials, lp_ctx); if (lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC || lp_security() == SEC_ADS || USE_KERBEROS_KEYTAB) { cli_credentials_set_kerberos_state(server_credentials, CRED_AUTO_USE_KERBEROS); } else { cli_credentials_set_kerberos_state(server_credentials, CRED_DONT_USE_KERBEROS); } nt_status = gensec_server_start(tmp_ctx, gensec_settings, auth4_context, &gensec_security); if (!NT_STATUS_IS_OK(nt_status)) { TALLOC_FREE(tmp_ctx); return nt_status; } gensec_set_credentials(gensec_security, server_credentials); gensec_want_feature(gensec_security, GENSEC_FEATURE_SIGN); gensec_want_feature(gensec_security, GENSEC_FEATURE_SEAL); talloc_unlink(tmp_ctx, lp_ctx); talloc_unlink(tmp_ctx, server_credentials); talloc_unlink(tmp_ctx, gensec_settings); talloc_unlink(tmp_ctx, auth4_context); *gensec_security_out = talloc_steal(mem_ctx, gensec_security); TALLOC_FREE(tmp_ctx); return NT_STATUS_OK; } /******************************************************************* Used by firefox to drive NTLM auth to IIS servers. *******************************************************************/ static NTSTATUS do_ccache_ntlm_auth(DATA_BLOB initial_msg, DATA_BLOB challenge_msg, DATA_BLOB *reply) { struct winbindd_request wb_request; struct winbindd_response wb_response; int ctrl = 0; NSS_STATUS result; /* get winbindd to do the ntlmssp step on our behalf */ ZERO_STRUCT(wb_request); ZERO_STRUCT(wb_response); /* * This is tricky here. If we set krb5_auth in pam_winbind.conf * creds for users in trusted domain will be stored the winbindd * child of the trusted domain. If we ask the primary domain for * ntlm_ccache_auth, it will fail. So, we have to ask the trusted * domain's child for ccache_ntlm_auth. that is to say, we have to * set WBFLAG_PAM_CONTACT_TRUSTDOM in request.flags. */ ctrl = get_pam_winbind_config(); if (ctrl & WINBIND_KRB5_AUTH) { wb_request.flags |= WBFLAG_PAM_CONTACT_TRUSTDOM; } fstr_sprintf(wb_request.data.ccache_ntlm_auth.user, "%s%c%s", opt_domain, winbind_separator(), opt_username); wb_request.data.ccache_ntlm_auth.uid = geteuid(); wb_request.data.ccache_ntlm_auth.initial_blob_len = initial_msg.length; wb_request.data.ccache_ntlm_auth.challenge_blob_len = challenge_msg.length; wb_request.extra_len = initial_msg.length + challenge_msg.length; if (wb_request.extra_len > 0) { wb_request.extra_data.data = SMB_MALLOC_ARRAY(char, wb_request.extra_len); if (wb_request.extra_data.data == NULL) { return NT_STATUS_NO_MEMORY; } memcpy(wb_request.extra_data.data, initial_msg.data, initial_msg.length); memcpy(wb_request.extra_data.data + initial_msg.length, challenge_msg.data, challenge_msg.length); } result = winbindd_request_response(NULL, WINBINDD_CCACHE_NTLMAUTH, &wb_request, &wb_response); SAFE_FREE(wb_request.extra_data.data); if (result != NSS_STATUS_SUCCESS) { winbindd_free_response(&wb_response); return NT_STATUS_UNSUCCESSFUL; } if (reply) { *reply = data_blob(wb_response.extra_data.data, wb_response.data.ccache_ntlm_auth.auth_blob_len); if (wb_response.data.ccache_ntlm_auth.auth_blob_len > 0 && reply->data == NULL) { winbindd_free_response(&wb_response); return NT_STATUS_NO_MEMORY; } } winbindd_free_response(&wb_response); return NT_STATUS_MORE_PROCESSING_REQUIRED; } static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2) { DATA_BLOB request, reply; NTSTATUS nt_status; if (!opt_username || !*opt_username) { x_fprintf(x_stderr, "username must be specified!\n\n"); exit(1); } if (strlen(buf) < 2) { DEBUG(1, ("NTLMSSP query [%s] invalid\n", buf)); x_fprintf(x_stdout, "BH NTLMSSP query invalid\n"); return; } if (strlen(buf) > 3) { if(strncmp(buf, "SF ", 3) == 0) { DEBUG(10, ("Looking for flags to negotiate\n")); talloc_free(state->want_feature_list); state->want_feature_list = talloc_strdup(state->mem_ctx, buf+3); x_fprintf(x_stdout, "OK\n"); return; } request = base64_decode_data_blob(buf + 3); } else { request = data_blob_null; } if (strncmp(buf, "PW ", 3) == 0) { /* We asked for a password and obviously got it :-) */ opt_password = SMB_STRNDUP((const char *)request.data, request.length); if (opt_password == NULL) { DEBUG(1, ("Out of memory\n")); x_fprintf(x_stdout, "BH Out of memory\n"); data_blob_free(&request); return; } x_fprintf(x_stdout, "OK\n"); data_blob_free(&request); return; } if (!state->ntlmssp_state && use_cached_creds) { /* check whether cached credentials are usable. */ DATA_BLOB empty_blob = data_blob_null; nt_status = do_ccache_ntlm_auth(empty_blob, empty_blob, NULL); if (!NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { /* failed to use cached creds */ use_cached_creds = False; } } if (opt_password == NULL && !use_cached_creds) { /* Request a password from the calling process. After sending it, the calling process should retry asking for the negotiate. */ DEBUG(10, ("Requesting password\n")); x_fprintf(x_stdout, "PW\n"); return; } if (strncmp(buf, "YR", 2) == 0) { TALLOC_FREE(state->ntlmssp_state); state->cli_state = CLIENT_INITIAL; } else if (strncmp(buf, "TT", 2) == 0) { /* No special preprocessing required */ } else if (strncmp(buf, "GF", 2) == 0) { DEBUG(10, ("Requested negotiated NTLMSSP flags\n")); if(state->cli_state == CLIENT_FINISHED) { x_fprintf(x_stdout, "GF 0x%08x\n", state->neg_flags); } else { x_fprintf(x_stdout, "BH\n"); } data_blob_free(&request); return; } else if (strncmp(buf, "GK", 2) == 0 ) { DEBUG(10, ("Requested session key\n")); if(state->cli_state == CLIENT_FINISHED) { char *key64 = base64_encode_data_blob(state->mem_ctx, state->session_key); x_fprintf(x_stdout, "GK %s\n", key64?key64:"<NULL>"); TALLOC_FREE(key64); } else { x_fprintf(x_stdout, "BH\n"); } data_blob_free(&request); return; } else { DEBUG(1, ("NTLMSSP query [%s] invalid\n", buf)); x_fprintf(x_stdout, "BH NTLMSSP query invalid\n"); return; } if (!state->ntlmssp_state) { nt_status = ntlm_auth_start_ntlmssp_client( &state->ntlmssp_state); if (!NT_STATUS_IS_OK(nt_status)) { x_fprintf(x_stdout, "BH %s\n", nt_errstr(nt_status)); return; } ntlmssp_want_feature_list(state->ntlmssp_state, state->want_feature_list); state->initial_message = data_blob_null; } DEBUG(10, ("got NTLMSSP packet:\n")); dump_data(10, request.data, request.length); if (use_cached_creds && !opt_password && (state->cli_state == CLIENT_RESPONSE)) { nt_status = do_ccache_ntlm_auth(state->initial_message, request, &reply); } else { nt_status = ntlmssp_update(state->ntlmssp_state, request, &reply); } if (NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { char *reply_base64 = base64_encode_data_blob(state->mem_ctx, reply); if (state->cli_state == CLIENT_INITIAL) { x_fprintf(x_stdout, "YR %s\n", reply_base64); state->initial_message = reply; state->cli_state = CLIENT_RESPONSE; } else { x_fprintf(x_stdout, "KK %s\n", reply_base64); data_blob_free(&reply); } TALLOC_FREE(reply_base64); DEBUG(10, ("NTLMSSP challenge\n")); } else if (NT_STATUS_IS_OK(nt_status)) { char *reply_base64 = base64_encode_data_blob(talloc_tos(), reply); x_fprintf(x_stdout, "AF %s\n", reply_base64); TALLOC_FREE(reply_base64); if(state->have_session_key) data_blob_free(&state->session_key); state->session_key = data_blob( state->ntlmssp_state->session_key.data, state->ntlmssp_state->session_key.length); state->neg_flags = state->ntlmssp_state->neg_flags; state->have_session_key = true; DEBUG(10, ("NTLMSSP OK!\n")); state->cli_state = CLIENT_FINISHED; TALLOC_FREE(state->ntlmssp_state); } else { x_fprintf(x_stdout, "BH %s\n", nt_errstr(nt_status)); DEBUG(0, ("NTLMSSP BH: %s\n", nt_errstr(nt_status))); state->cli_state = CLIENT_ERROR; TALLOC_FREE(state->ntlmssp_state); } data_blob_free(&request); } static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2) { char *user, *pass; user=buf; pass=(char *)memchr(buf,' ',length); if (!pass) { DEBUG(2, ("Password not found. Denying access\n")); x_fprintf(x_stdout, "ERR\n"); return; } *pass='\0'; pass++; if (state->helper_mode == SQUID_2_5_BASIC) { rfc1738_unescape(user); rfc1738_unescape(pass); } if (check_plaintext_auth(user, pass, False)) { x_fprintf(x_stdout, "OK\n"); } else { x_fprintf(x_stdout, "ERR\n"); } } static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, char *buf, int length, void **private1) { DATA_BLOB in; DATA_BLOB out = data_blob(NULL, 0); char *out_base64 = NULL; const char *reply_arg = NULL; struct gensec_ntlm_state { struct gensec_security *gensec_state; const char *set_password; }; struct gensec_ntlm_state *state; NTSTATUS nt_status; bool first = false; const char *reply_code; struct cli_credentials *creds; static char *want_feature_list = NULL; static DATA_BLOB session_key; TALLOC_CTX *mem_ctx; if (*private1) { state = (struct gensec_ntlm_state *)*private1; } else { state = talloc_zero(NULL, struct gensec_ntlm_state); if (!state) { x_fprintf(x_stdout, "BH No Memory\n"); exit(1); } *private1 = state; if (opt_password) { state->set_password = opt_password; } } if (strlen(buf) < 2) { DEBUG(1, ("query [%s] invalid", buf)); x_fprintf(x_stdout, "BH Query invalid\n"); return; } if (strlen(buf) > 3) { if(strncmp(buf, "SF ", 3) == 0) { DEBUG(10, ("Setting flags to negotiate\n")); talloc_free(want_feature_list); want_feature_list = talloc_strndup(state, buf+3, strlen(buf)-3); x_fprintf(x_stdout, "OK\n"); return; } in = base64_decode_data_blob(buf + 3); } else { in = data_blob(NULL, 0); } if (strncmp(buf, "YR", 2) == 0) { if (state->gensec_state) { talloc_free(state->gensec_state); state->gensec_state = NULL; } } else if ( (strncmp(buf, "OK", 2) == 0)) { /* Just return BH, like ntlm_auth from Samba 3 does. */ x_fprintf(x_stdout, "BH Command expected\n"); data_blob_free(&in); return; } else if ( (strncmp(buf, "TT ", 3) != 0) && (strncmp(buf, "KK ", 3) != 0) && (strncmp(buf, "AF ", 3) != 0) && (strncmp(buf, "NA ", 3) != 0) && (strncmp(buf, "UG", 2) != 0) && (strncmp(buf, "PW ", 3) != 0) && (strncmp(buf, "GK", 2) != 0) && (strncmp(buf, "GF", 2) != 0)) { DEBUG(1, ("SPNEGO request [%s] invalid prefix\n", buf)); x_fprintf(x_stdout, "BH SPNEGO request invalid prefix\n"); data_blob_free(&in); return; } mem_ctx = talloc_named(NULL, 0, "manage_gensec_request internal mem_ctx"); /* setup gensec */ if (!(state->gensec_state)) { switch (stdio_helper_mode) { case GSS_SPNEGO_CLIENT: case NTLMSSP_CLIENT_1: /* setup the client side */ nt_status = gensec_client_start(NULL, &state->gensec_state, lpcfg_gensec_settings(NULL, lp_ctx)); if (!NT_STATUS_IS_OK(nt_status)) { x_fprintf(x_stdout, "BH GENSEC mech failed to start: %s\n", nt_errstr(nt_status)); talloc_free(mem_ctx); return; } creds = cli_credentials_init(state->gensec_state); cli_credentials_set_conf(creds, lp_ctx); if (opt_username) { cli_credentials_set_username(creds, opt_username, CRED_SPECIFIED); } if (opt_domain) { cli_credentials_set_domain(creds, opt_domain, CRED_SPECIFIED); } if (state->set_password) { cli_credentials_set_password(creds, state->set_password, CRED_SPECIFIED); } else { cli_credentials_set_password_callback(creds, get_password); } if (opt_workstation) { cli_credentials_set_workstation(creds, opt_workstation, CRED_SPECIFIED); } gensec_set_credentials(state->gensec_state, creds); break; case GSS_SPNEGO_SERVER: case SQUID_2_5_NTLMSSP: { nt_status = ntlm_auth_prepare_gensec_server(state, lp_ctx, &state->gensec_state); if (!NT_STATUS_IS_OK(nt_status)) { x_fprintf(x_stdout, "BH GENSEC mech failed to start: %s\n", nt_errstr(nt_status)); talloc_free(mem_ctx); return; } break; } default: talloc_free(mem_ctx); abort(); } gensec_want_feature_list(state->gensec_state, want_feature_list); switch (stdio_helper_mode) { case GSS_SPNEGO_CLIENT: case GSS_SPNEGO_SERVER: nt_status = gensec_start_mech_by_oid(state->gensec_state, GENSEC_OID_SPNEGO); if (!in.length) { first = true; } break; case NTLMSSP_CLIENT_1: if (!in.length) { first = true; } /* fall through */ case SQUID_2_5_NTLMSSP: nt_status = gensec_start_mech_by_oid(state->gensec_state, GENSEC_OID_NTLMSSP); break; default: talloc_free(mem_ctx); abort(); } if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(1, ("GENSEC mech failed to start: %s\n", nt_errstr(nt_status))); x_fprintf(x_stdout, "BH GENSEC mech failed to start\n"); talloc_free(mem_ctx); return; } } /* update */ if (strncmp(buf, "PW ", 3) == 0) { state->set_password = talloc_strndup(state, (const char *)in.data, in.length); cli_credentials_set_password(gensec_get_credentials(state->gensec_state), state->set_password, CRED_SPECIFIED); x_fprintf(x_stdout, "OK\n"); data_blob_free(&in); talloc_free(mem_ctx); return; } if (strncmp(buf, "GK", 2) == 0) { char *base64_key; DEBUG(10, ("Requested session key\n")); nt_status = gensec_session_key(state->gensec_state, mem_ctx, &session_key); if(!NT_STATUS_IS_OK(nt_status)) { DEBUG(1, ("gensec_session_key failed: %s\n", nt_errstr(nt_status))); x_fprintf(x_stdout, "BH No session key\n"); talloc_free(mem_ctx); return; } else { base64_key = base64_encode_data_blob(state, session_key); x_fprintf(x_stdout, "GK %s\n", base64_key); talloc_free(base64_key); } talloc_free(mem_ctx); return; } if (stdio_helper_mode == SQUID_2_5_NTLMSSP && strncmp(buf, "GF", 2) == 0) { uint32_t neg_flags; neg_flags = gensec_ntlmssp_neg_flags(state->gensec_state); DEBUG(10, ("Requested negotiated feature flags\n")); x_fprintf(x_stdout, "GF 0x%08x\n", neg_flags); return; } nt_status = gensec_update(state->gensec_state, mem_ctx, in, &out); /* don't leak 'bad password'/'no such user' info to the network client */ nt_status = nt_status_squash(nt_status); if (out.length) { out_base64 = base64_encode_data_blob(mem_ctx, out); } else { out_base64 = NULL; } if (NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { reply_arg = "*"; if (first && state->gensec_state->gensec_role == GENSEC_CLIENT) { reply_code = "YR"; } else if (state->gensec_state->gensec_role == GENSEC_CLIENT) { reply_code = "KK"; } else if (state->gensec_state->gensec_role == GENSEC_SERVER) { reply_code = "TT"; } else { abort(); } } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCESS_DENIED)) { reply_code = "BH NT_STATUS_ACCESS_DENIED"; reply_arg = nt_errstr(nt_status); DEBUG(1, ("GENSEC login failed: %s\n", nt_errstr(nt_status))); } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_UNSUCCESSFUL)) { reply_code = "BH NT_STATUS_UNSUCCESSFUL"; reply_arg = nt_errstr(nt_status); DEBUG(1, ("GENSEC login failed: %s\n", nt_errstr(nt_status))); } else if (!NT_STATUS_IS_OK(nt_status)) { reply_code = "NA"; reply_arg = nt_errstr(nt_status); DEBUG(1, ("GENSEC login failed: %s\n", nt_errstr(nt_status))); } else if /* OK */ (state->gensec_state->gensec_role == GENSEC_SERVER) { struct auth_session_info *session_info; nt_status = gensec_session_info(state->gensec_state, mem_ctx, &session_info); if (!NT_STATUS_IS_OK(nt_status)) { reply_code = "BH Failed to retrive session info"; reply_arg = nt_errstr(nt_status); DEBUG(1, ("GENSEC failed to retrieve the session info: %s\n", nt_errstr(nt_status))); } else { reply_code = "AF"; reply_arg = talloc_strdup(state->gensec_state, session_info->unix_info->unix_name); if (reply_arg == NULL) { reply_code = "BH out of memory"; reply_arg = nt_errstr(NT_STATUS_NO_MEMORY); } talloc_free(session_info); } } else if (state->gensec_state->gensec_role == GENSEC_CLIENT) { reply_code = "AF"; reply_arg = out_base64; } else { abort(); } switch (stdio_helper_mode) { case GSS_SPNEGO_SERVER: x_fprintf(x_stdout, "%s %s %s\n", reply_code, out_base64 ? out_base64 : "*", reply_arg ? reply_arg : "*"); break; default: if (out_base64) { x_fprintf(x_stdout, "%s %s\n", reply_code, out_base64); } else if (reply_arg) { x_fprintf(x_stdout, "%s %s\n", reply_code, reply_arg); } else { x_fprintf(x_stdout, "%s\n", reply_code); } } talloc_free(mem_ctx); return; } static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2) { manage_gensec_request(stdio_helper_mode, lp_ctx, buf, length, &state->gensec_private_1); return; } static void manage_squid_ntlmssp_request(enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2) { manage_gensec_request(stdio_helper_mode, lp_ctx, buf, length, &state->gensec_private_1); return; } static struct ntlmssp_state *client_ntlmssp_state = NULL; static bool manage_client_ntlmssp_init(struct spnego_data spnego) { NTSTATUS status; DATA_BLOB null_blob = data_blob_null; DATA_BLOB to_server; char *to_server_base64; const char *my_mechs[] = {OID_NTLMSSP, NULL}; TALLOC_CTX *ctx = talloc_tos(); DEBUG(10, ("Got spnego negTokenInit with NTLMSSP\n")); if (client_ntlmssp_state != NULL) { DEBUG(1, ("Request for initial SPNEGO request where " "we already have a state\n")); return False; } if (!client_ntlmssp_state) { if (!NT_STATUS_IS_OK(status = ntlm_auth_start_ntlmssp_client(&client_ntlmssp_state))) { x_fprintf(x_stdout, "BH %s\n", nt_errstr(status)); return False; } } if (opt_password == NULL) { /* Request a password from the calling process. After sending it, the calling process should retry with the negTokenInit. */ DEBUG(10, ("Requesting password\n")); x_fprintf(x_stdout, "PW\n"); return True; } spnego.type = SPNEGO_NEG_TOKEN_INIT; spnego.negTokenInit.mechTypes = my_mechs; spnego.negTokenInit.reqFlags = data_blob_null; spnego.negTokenInit.reqFlagsPadding = 0; spnego.negTokenInit.mechListMIC = null_blob; status = ntlmssp_update(client_ntlmssp_state, null_blob, &spnego.negTokenInit.mechToken); if ( !(NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED) || NT_STATUS_IS_OK(status)) ) { DEBUG(1, ("Expected OK or MORE_PROCESSING_REQUIRED, got: %s\n", nt_errstr(status))); TALLOC_FREE(client_ntlmssp_state); return False; } spnego_write_data(ctx, &to_server, &spnego); data_blob_free(&spnego.negTokenInit.mechToken); to_server_base64 = base64_encode_data_blob(talloc_tos(), to_server); data_blob_free(&to_server); x_fprintf(x_stdout, "KK %s\n", to_server_base64); TALLOC_FREE(to_server_base64); return True; } static void manage_client_ntlmssp_targ(struct spnego_data spnego) { NTSTATUS status; DATA_BLOB null_blob = data_blob_null; DATA_BLOB request; DATA_BLOB to_server; char *to_server_base64; TALLOC_CTX *ctx = talloc_tos(); DEBUG(10, ("Got spnego negTokenTarg with NTLMSSP\n")); if (client_ntlmssp_state == NULL) { DEBUG(1, ("Got NTLMSSP tArg without a client state\n")); x_fprintf(x_stdout, "BH Got NTLMSSP tArg without a client state\n"); return; } if (spnego.negTokenTarg.negResult == SPNEGO_REJECT) { x_fprintf(x_stdout, "NA\n"); TALLOC_FREE(client_ntlmssp_state); return; } if (spnego.negTokenTarg.negResult == SPNEGO_ACCEPT_COMPLETED) { x_fprintf(x_stdout, "AF\n"); TALLOC_FREE(client_ntlmssp_state); return; } status = ntlmssp_update(client_ntlmssp_state, spnego.negTokenTarg.responseToken, &request); if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED) && !NT_STATUS_IS_OK(status)) { DEBUG(1, ("Expected MORE_PROCESSING_REQUIRED or OK from " "ntlmssp_client_update, got: %s\n", nt_errstr(status))); x_fprintf(x_stdout, "BH Expected MORE_PROCESSING_REQUIRED from " "ntlmssp_client_update\n"); data_blob_free(&request); TALLOC_FREE(client_ntlmssp_state); return; } spnego.type = SPNEGO_NEG_TOKEN_TARG; spnego.negTokenTarg.negResult = SPNEGO_ACCEPT_INCOMPLETE; spnego.negTokenTarg.supportedMech = (const char *)OID_NTLMSSP; spnego.negTokenTarg.responseToken = request; spnego.negTokenTarg.mechListMIC = null_blob; spnego_write_data(ctx, &to_server, &spnego); data_blob_free(&request); to_server_base64 = base64_encode_data_blob(talloc_tos(), to_server); data_blob_free(&to_server); x_fprintf(x_stdout, "KK %s\n", to_server_base64); TALLOC_FREE(to_server_base64); return; } #ifdef HAVE_KRB5 static bool manage_client_krb5_init(struct spnego_data spnego) { char *principal; DATA_BLOB tkt, tkt_wrapped, to_server; DATA_BLOB session_key_krb5 = data_blob_null; struct spnego_data reply; char *reply_base64; int retval; const char *my_mechs[] = {OID_KERBEROS5_OLD, NULL}; ssize_t len; TALLOC_CTX *ctx = talloc_tos(); principal = spnego.negTokenInit.targetPrincipal; /* We may not be allowed to use the server-supplied SPNEGO principal, or it may not have been supplied to us */ if (!lp_client_use_spnego_principal() || strequal(principal, ADS_IGNORE_PRINCIPAL)) { principal = NULL; } if (principal == NULL && opt_target_service && opt_target_hostname && !is_ipaddress(opt_target_hostname)) { DEBUG(3,("manage_client_krb5_init: using target " "hostname not SPNEGO principal\n")); principal = kerberos_get_principal_from_service_hostname(talloc_tos(), opt_target_service, opt_target_hostname, lp_realm()); if (!principal) { return false; } DEBUG(3,("manage_client_krb5_init: guessed " "server principal=%s\n", principal ? principal : "<null>")); } if (principal == NULL) { DEBUG(3,("manage_client_krb5_init: could not guess server principal\n")); return false; } retval = cli_krb5_get_ticket(ctx, principal, 0, &tkt, &session_key_krb5, 0, NULL, NULL, NULL); if (retval) { char *user = NULL; /* Let's try to first get the TGT, for that we need a password. */ if (opt_password == NULL) { DEBUG(10, ("Requesting password\n")); x_fprintf(x_stdout, "PW\n"); return True; } user = talloc_asprintf(talloc_tos(), "%s@%s", opt_username, opt_domain); if (!user) { return false; } if ((retval = kerberos_kinit_password(user, opt_password, 0, NULL))) { DEBUG(10, ("Requesting TGT failed: %s\n", error_message(retval))); return False; } retval = cli_krb5_get_ticket(ctx, principal, 0, &tkt, &session_key_krb5, 0, NULL, NULL, NULL); if (retval) { DEBUG(10, ("Kinit suceeded, but getting a ticket failed: %s\n", error_message(retval))); return False; } } /* wrap that up in a nice GSS-API wrapping */ tkt_wrapped = spnego_gen_krb5_wrap(ctx, tkt, TOK_ID_KRB_AP_REQ); data_blob_free(&session_key_krb5); ZERO_STRUCT(reply); reply.type = SPNEGO_NEG_TOKEN_INIT; reply.negTokenInit.mechTypes = my_mechs; reply.negTokenInit.reqFlags = data_blob_null; reply.negTokenInit.reqFlagsPadding = 0; reply.negTokenInit.mechToken = tkt_wrapped; reply.negTokenInit.mechListMIC = data_blob_null; len = spnego_write_data(ctx, &to_server, &reply); data_blob_free(&tkt); if (len == -1) { DEBUG(1, ("Could not write SPNEGO data blob\n")); return False; } reply_base64 = base64_encode_data_blob(talloc_tos(), to_server); x_fprintf(x_stdout, "KK %s *\n", reply_base64); TALLOC_FREE(reply_base64); data_blob_free(&to_server); DEBUG(10, ("sent GSS-SPNEGO KERBEROS5 negTokenInit\n")); return True; } static void manage_client_krb5_targ(struct spnego_data spnego) { switch (spnego.negTokenTarg.negResult) { case SPNEGO_ACCEPT_INCOMPLETE: DEBUG(1, ("Got a Kerberos negTokenTarg with ACCEPT_INCOMPLETE\n")); x_fprintf(x_stdout, "BH Got a Kerberos negTokenTarg with " "ACCEPT_INCOMPLETE\n"); break; case SPNEGO_ACCEPT_COMPLETED: DEBUG(10, ("Accept completed\n")); x_fprintf(x_stdout, "AF\n"); break; case SPNEGO_REJECT: DEBUG(10, ("Rejected\n")); x_fprintf(x_stdout, "NA\n"); break; default: DEBUG(1, ("Got an invalid negTokenTarg\n")); x_fprintf(x_stdout, "AF\n"); } } #endif static void manage_gss_spnego_client_request(enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2) { DATA_BLOB request; struct spnego_data spnego; ssize_t len; TALLOC_CTX *ctx = talloc_tos(); if (!opt_username || !*opt_username) { x_fprintf(x_stderr, "username must be specified!\n\n"); exit(1); } if (strlen(buf) <= 3) { DEBUG(1, ("SPNEGO query [%s] too short\n", buf)); x_fprintf(x_stdout, "BH SPNEGO query too short\n"); return; } request = base64_decode_data_blob(buf+3); if (strncmp(buf, "PW ", 3) == 0) { /* We asked for a password and obviously got it :-) */ opt_password = SMB_STRNDUP((const char *)request.data, request.length); if (opt_password == NULL) { DEBUG(1, ("Out of memory\n")); x_fprintf(x_stdout, "BH Out of memory\n"); data_blob_free(&request); return; } x_fprintf(x_stdout, "OK\n"); data_blob_free(&request); return; } if ( (strncmp(buf, "TT ", 3) != 0) && (strncmp(buf, "AF ", 3) != 0) && (strncmp(buf, "NA ", 3) != 0) ) { DEBUG(1, ("SPNEGO request [%s] invalid\n", buf)); x_fprintf(x_stdout, "BH SPNEGO request invalid\n"); data_blob_free(&request); return; } /* So we got a server challenge to generate a SPNEGO client-to-server request... */ len = spnego_read_data(ctx, request, &spnego); data_blob_free(&request); if (len == -1) { DEBUG(1, ("Could not read SPNEGO data for [%s]\n", buf)); x_fprintf(x_stdout, "BH Could not read SPNEGO data\n"); return; } if (spnego.type == SPNEGO_NEG_TOKEN_INIT) { /* The server offers a list of mechanisms */ const char *const *mechType = spnego.negTokenInit.mechTypes; while (*mechType != NULL) { #ifdef HAVE_KRB5 if ( (strcmp(*mechType, OID_KERBEROS5_OLD) == 0) || (strcmp(*mechType, OID_KERBEROS5) == 0) ) { if (manage_client_krb5_init(spnego)) goto out; } #endif if (strcmp(*mechType, OID_NTLMSSP) == 0) { if (manage_client_ntlmssp_init(spnego)) goto out; } mechType++; } DEBUG(1, ("Server offered no compatible mechanism\n")); x_fprintf(x_stdout, "BH Server offered no compatible mechanism\n"); return; } if (spnego.type == SPNEGO_NEG_TOKEN_TARG) { if (spnego.negTokenTarg.supportedMech == NULL) { /* On accept/reject Windows does not send the mechanism anymore. Handle that here and shut down the mechanisms. */ switch (spnego.negTokenTarg.negResult) { case SPNEGO_ACCEPT_COMPLETED: x_fprintf(x_stdout, "AF\n"); break; case SPNEGO_REJECT: x_fprintf(x_stdout, "NA\n"); break; default: DEBUG(1, ("Got a negTokenTarg with no mech and an " "unknown negResult: %d\n", spnego.negTokenTarg.negResult)); x_fprintf(x_stdout, "BH Got a negTokenTarg with" " no mech and an unknown " "negResult\n"); } TALLOC_FREE(client_ntlmssp_state); goto out; } if (strcmp(spnego.negTokenTarg.supportedMech, OID_NTLMSSP) == 0) { manage_client_ntlmssp_targ(spnego); goto out; } #if HAVE_KRB5 if (strcmp(spnego.negTokenTarg.supportedMech, OID_KERBEROS5_OLD) == 0) { manage_client_krb5_targ(spnego); goto out; } #endif } DEBUG(1, ("Got an SPNEGO token I could not handle [%s]!\n", buf)); x_fprintf(x_stdout, "BH Got an SPNEGO token I could not handle\n"); return; out: spnego_free_data(&spnego); return; } static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2) { char *request, *parameter; static DATA_BLOB challenge; static DATA_BLOB lm_response; static DATA_BLOB nt_response; static char *full_username; static char *username; static char *domain; static char *plaintext_password; static bool ntlm_server_1_user_session_key; static bool ntlm_server_1_lm_session_key; if (strequal(buf, ".")) { if (!full_username && !username) { x_fprintf(x_stdout, "Error: No username supplied!\n"); } else if (plaintext_password) { /* handle this request as plaintext */ if (!full_username) { if (asprintf(&full_username, "%s%c%s", domain, winbind_separator(), username) == -1) { x_fprintf(x_stdout, "Error: Out of memory in asprintf!\n.\n"); return; } } if (check_plaintext_auth(full_username, plaintext_password, False)) { x_fprintf(x_stdout, "Authenticated: Yes\n"); } else { x_fprintf(x_stdout, "Authenticated: No\n"); } } else if (!lm_response.data && !nt_response.data) { x_fprintf(x_stdout, "Error: No password supplied!\n"); } else if (!challenge.data) { x_fprintf(x_stdout, "Error: No lanman-challenge supplied!\n"); } else { char *error_string = NULL; uchar lm_key[8]; uchar user_session_key[16]; uint32_t flags = 0; if (full_username && !username) { fstring fstr_user; fstring fstr_domain; if (!parse_ntlm_auth_domain_user(full_username, fstr_user, fstr_domain)) { /* username might be 'tainted', don't print into our new-line deleimianted stream */ x_fprintf(x_stdout, "Error: Could not parse into domain and username\n"); } SAFE_FREE(username); SAFE_FREE(domain); username = smb_xstrdup(fstr_user); domain = smb_xstrdup(fstr_domain); } if (!domain) { domain = smb_xstrdup(get_winbind_domain()); } if (ntlm_server_1_lm_session_key) flags |= WBFLAG_PAM_LMKEY; if (ntlm_server_1_user_session_key) flags |= WBFLAG_PAM_USER_SESSION_KEY; if (!NT_STATUS_IS_OK( contact_winbind_auth_crap(username, domain, lp_netbios_name(), &challenge, &lm_response, &nt_response, flags, 0, lm_key, user_session_key, &error_string, NULL))) { x_fprintf(x_stdout, "Authenticated: No\n"); x_fprintf(x_stdout, "Authentication-Error: %s\n.\n", error_string); } else { static char zeros[16]; char *hex_lm_key; char *hex_user_session_key; x_fprintf(x_stdout, "Authenticated: Yes\n"); if (ntlm_server_1_lm_session_key && (memcmp(zeros, lm_key, sizeof(lm_key)) != 0)) { hex_lm_key = hex_encode_talloc(NULL, (const unsigned char *)lm_key, sizeof(lm_key)); x_fprintf(x_stdout, "LANMAN-Session-Key: %s\n", hex_lm_key); TALLOC_FREE(hex_lm_key); } if (ntlm_server_1_user_session_key && (memcmp(zeros, user_session_key, sizeof(user_session_key)) != 0)) { hex_user_session_key = hex_encode_talloc(NULL, (const unsigned char *)user_session_key, sizeof(user_session_key)); x_fprintf(x_stdout, "User-Session-Key: %s\n", hex_user_session_key); TALLOC_FREE(hex_user_session_key); } } SAFE_FREE(error_string); } /* clear out the state */ challenge = data_blob_null; nt_response = data_blob_null; lm_response = data_blob_null; SAFE_FREE(full_username); SAFE_FREE(username); SAFE_FREE(domain); SAFE_FREE(plaintext_password); ntlm_server_1_user_session_key = False; ntlm_server_1_lm_session_key = False; x_fprintf(x_stdout, ".\n"); return; } request = buf; /* Indicates a base64 encoded structure */ parameter = strstr_m(request, ":: "); if (!parameter) { parameter = strstr_m(request, ": "); if (!parameter) { DEBUG(0, ("Parameter not found!\n")); x_fprintf(x_stdout, "Error: Parameter not found!\n.\n"); return; } parameter[0] ='\0'; parameter++; parameter[0] ='\0'; parameter++; } else { parameter[0] ='\0'; parameter++; parameter[0] ='\0'; parameter++; parameter[0] ='\0'; parameter++; base64_decode_inplace(parameter); } if (strequal(request, "LANMAN-Challenge")) { challenge = strhex_to_data_blob(NULL, parameter); if (challenge.length != 8) { x_fprintf(x_stdout, "Error: hex decode of %s failed! (got %d bytes, expected 8)\n.\n", parameter, (int)challenge.length); challenge = data_blob_null; } } else if (strequal(request, "NT-Response")) { nt_response = strhex_to_data_blob(NULL, parameter); if (nt_response.length < 24) { x_fprintf(x_stdout, "Error: hex decode of %s failed! (only got %d bytes, needed at least 24)\n.\n", parameter, (int)nt_response.length); nt_response = data_blob_null; } } else if (strequal(request, "LANMAN-Response")) { lm_response = strhex_to_data_blob(NULL, parameter); if (lm_response.length != 24) { x_fprintf(x_stdout, "Error: hex decode of %s failed! (got %d bytes, expected 24)\n.\n", parameter, (int)lm_response.length); lm_response = data_blob_null; } } else if (strequal(request, "Password")) { plaintext_password = smb_xstrdup(parameter); } else if (strequal(request, "NT-Domain")) { domain = smb_xstrdup(parameter); } else if (strequal(request, "Username")) { username = smb_xstrdup(parameter); } else if (strequal(request, "Full-Username")) { full_username = smb_xstrdup(parameter); } else if (strequal(request, "Request-User-Session-Key")) { ntlm_server_1_user_session_key = strequal(parameter, "Yes"); } else if (strequal(request, "Request-LanMan-Session-Key")) { ntlm_server_1_lm_session_key = strequal(parameter, "Yes"); } else { x_fprintf(x_stdout, "Error: Unknown request %s\n.\n", request); } } static void manage_ntlm_change_password_1_request(enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, char *buf, int length, void **private2) { char *request, *parameter; static DATA_BLOB new_nt_pswd; static DATA_BLOB old_nt_hash_enc; static DATA_BLOB new_lm_pswd; static DATA_BLOB old_lm_hash_enc; static char *full_username = NULL; static char *username = NULL; static char *domain = NULL; static char *newpswd = NULL; static char *oldpswd = NULL; if (strequal(buf, ".")) { if(newpswd && oldpswd) { uchar old_nt_hash[16]; uchar old_lm_hash[16]; uchar new_nt_hash[16]; uchar new_lm_hash[16]; new_nt_pswd = data_blob(NULL, 516); old_nt_hash_enc = data_blob(NULL, 16); /* Calculate the MD4 hash (NT compatible) of the * password */ E_md4hash(oldpswd, old_nt_hash); E_md4hash(newpswd, new_nt_hash); /* E_deshash returns false for 'long' passwords (> 14 DOS chars). Therefore, don't send a buffer encrypted with the truncated hash (it could allow an even easier attack on the password) Likewise, obey the admin's restriction */ if (lp_client_lanman_auth() && E_deshash(newpswd, new_lm_hash) && E_deshash(oldpswd, old_lm_hash)) { new_lm_pswd = data_blob(NULL, 516); old_lm_hash_enc = data_blob(NULL, 16); encode_pw_buffer(new_lm_pswd.data, newpswd, STR_UNICODE); arcfour_crypt(new_lm_pswd.data, old_nt_hash, 516); E_old_pw_hash(new_nt_hash, old_lm_hash, old_lm_hash_enc.data); } else { new_lm_pswd.data = NULL; new_lm_pswd.length = 0; old_lm_hash_enc.data = NULL; old_lm_hash_enc.length = 0; } encode_pw_buffer(new_nt_pswd.data, newpswd, STR_UNICODE); arcfour_crypt(new_nt_pswd.data, old_nt_hash, 516); E_old_pw_hash(new_nt_hash, old_nt_hash, old_nt_hash_enc.data); } if (!full_username && !username) { x_fprintf(x_stdout, "Error: No username supplied!\n"); } else if ((!new_nt_pswd.data || !old_nt_hash_enc.data) && (!new_lm_pswd.data || old_lm_hash_enc.data) ) { x_fprintf(x_stdout, "Error: No NT or LM password " "blobs supplied!\n"); } else { char *error_string = NULL; if (full_username && !username) { fstring fstr_user; fstring fstr_domain; if (!parse_ntlm_auth_domain_user(full_username, fstr_user, fstr_domain)) { /* username might be 'tainted', don't * print into our new-line * deleimianted stream */ x_fprintf(x_stdout, "Error: Could not " "parse into domain and " "username\n"); SAFE_FREE(username); username = smb_xstrdup(full_username); } else { SAFE_FREE(username); SAFE_FREE(domain); username = smb_xstrdup(fstr_user); domain = smb_xstrdup(fstr_domain); } } if(!NT_STATUS_IS_OK(contact_winbind_change_pswd_auth_crap( username, domain, new_nt_pswd, old_nt_hash_enc, new_lm_pswd, old_lm_hash_enc, &error_string))) { x_fprintf(x_stdout, "Password-Change: No\n"); x_fprintf(x_stdout, "Password-Change-Error: " "%s\n.\n", error_string); } else { x_fprintf(x_stdout, "Password-Change: Yes\n"); } SAFE_FREE(error_string); } /* clear out the state */ new_nt_pswd = data_blob_null; old_nt_hash_enc = data_blob_null; new_lm_pswd = data_blob_null; old_nt_hash_enc = data_blob_null; SAFE_FREE(full_username); SAFE_FREE(username); SAFE_FREE(domain); SAFE_FREE(newpswd); SAFE_FREE(oldpswd); x_fprintf(x_stdout, ".\n"); return; } request = buf; /* Indicates a base64 encoded structure */ parameter = strstr_m(request, ":: "); if (!parameter) { parameter = strstr_m(request, ": "); if (!parameter) { DEBUG(0, ("Parameter not found!\n")); x_fprintf(x_stdout, "Error: Parameter not found!\n.\n"); return; } parameter[0] ='\0'; parameter++; parameter[0] ='\0'; parameter++; } else { parameter[0] ='\0'; parameter++; parameter[0] ='\0'; parameter++; parameter[0] ='\0'; parameter++; base64_decode_inplace(parameter); } if (strequal(request, "new-nt-password-blob")) { new_nt_pswd = strhex_to_data_blob(NULL, parameter); if (new_nt_pswd.length != 516) { x_fprintf(x_stdout, "Error: hex decode of %s failed! " "(got %d bytes, expected 516)\n.\n", parameter, (int)new_nt_pswd.length); new_nt_pswd = data_blob_null; } } else if (strequal(request, "old-nt-hash-blob")) { old_nt_hash_enc = strhex_to_data_blob(NULL, parameter); if (old_nt_hash_enc.length != 16) { x_fprintf(x_stdout, "Error: hex decode of %s failed! " "(got %d bytes, expected 16)\n.\n", parameter, (int)old_nt_hash_enc.length); old_nt_hash_enc = data_blob_null; } } else if (strequal(request, "new-lm-password-blob")) { new_lm_pswd = strhex_to_data_blob(NULL, parameter); if (new_lm_pswd.length != 516) { x_fprintf(x_stdout, "Error: hex decode of %s failed! " "(got %d bytes, expected 516)\n.\n", parameter, (int)new_lm_pswd.length); new_lm_pswd = data_blob_null; } } else if (strequal(request, "old-lm-hash-blob")) { old_lm_hash_enc = strhex_to_data_blob(NULL, parameter); if (old_lm_hash_enc.length != 16) { x_fprintf(x_stdout, "Error: hex decode of %s failed! " "(got %d bytes, expected 16)\n.\n", parameter, (int)old_lm_hash_enc.length); old_lm_hash_enc = data_blob_null; } } else if (strequal(request, "nt-domain")) { domain = smb_xstrdup(parameter); } else if(strequal(request, "username")) { username = smb_xstrdup(parameter); } else if(strequal(request, "full-username")) { username = smb_xstrdup(parameter); } else if(strequal(request, "new-password")) { newpswd = smb_xstrdup(parameter); } else if (strequal(request, "old-password")) { oldpswd = smb_xstrdup(parameter); } else { x_fprintf(x_stdout, "Error: Unknown request %s\n.\n", request); } } static void manage_squid_request(enum stdio_helper_mode stdio_helper_mode, struct loadparm_context *lp_ctx, struct ntlm_auth_state *state, stdio_helper_function fn, void **private2) { char *buf; char tmp[INITIAL_BUFFER_SIZE+1]; int length, buf_size = 0; char *c; buf = talloc_strdup(state->mem_ctx, ""); if (!buf) { DEBUG(0, ("Failed to allocate input buffer.\n")); x_fprintf(x_stderr, "ERR\n"); exit(1); } do { /* this is not a typo - x_fgets doesn't work too well under * squid */ if (fgets(tmp, sizeof(tmp)-1, stdin) == NULL) { if (ferror(stdin)) { DEBUG(1, ("fgets() failed! dying..... errno=%d " "(%s)\n", ferror(stdin), strerror(ferror(stdin)))); exit(1); } exit(0); } buf = talloc_strdup_append_buffer(buf, tmp); buf_size += INITIAL_BUFFER_SIZE; if (buf_size > MAX_BUFFER_SIZE) { DEBUG(2, ("Oversized message\n")); x_fprintf(x_stderr, "ERR\n"); talloc_free(buf); return; } c = strchr(buf, '\n'); } while (c == NULL); *c = '\0'; length = c-buf; DEBUG(10, ("Got '%s' from squid (length: %d).\n",buf,length)); if (buf[0] == '\0') { DEBUG(2, ("Invalid Request\n")); x_fprintf(x_stderr, "ERR\n"); talloc_free(buf); return; } fn(stdio_helper_mode, lp_ctx, state, buf, length, private2); talloc_free(buf); } static void squid_stream(enum stdio_helper_mode stdio_mode, struct loadparm_context *lp_ctx, stdio_helper_function fn) { TALLOC_CTX *mem_ctx; struct ntlm_auth_state *state; /* initialize FDescs */ x_setbuf(x_stdout, NULL); x_setbuf(x_stderr, NULL); mem_ctx = talloc_init("ntlm_auth"); if (!mem_ctx) { DEBUG(0, ("squid_stream: Failed to create talloc context\n")); x_fprintf(x_stderr, "ERR\n"); exit(1); } state = talloc_zero(mem_ctx, struct ntlm_auth_state); if (!state) { DEBUG(0, ("squid_stream: Failed to talloc ntlm_auth_state\n")); x_fprintf(x_stderr, "ERR\n"); exit(1); } state->mem_ctx = mem_ctx; state->helper_mode = stdio_mode; while(1) { TALLOC_CTX *frame = talloc_stackframe(); manage_squid_request(stdio_mode, lp_ctx, state, fn, NULL); TALLOC_FREE(frame); } } /* Authenticate a user with a challenge/response */ static bool check_auth_crap(void) { NTSTATUS nt_status; uint32_t flags = 0; char lm_key[8]; char user_session_key[16]; char *hex_lm_key; char *hex_user_session_key; char *error_string; static uint8_t zeros[16]; x_setbuf(x_stdout, NULL); if (request_lm_key) flags |= WBFLAG_PAM_LMKEY; if (request_user_session_key) flags |= WBFLAG_PAM_USER_SESSION_KEY; flags |= WBFLAG_PAM_NT_STATUS_SQUASH; nt_status = contact_winbind_auth_crap(opt_username, opt_domain, opt_workstation, &opt_challenge, &opt_lm_response, &opt_nt_response, flags, 0, (unsigned char *)lm_key, (unsigned char *)user_session_key, &error_string, NULL); if (!NT_STATUS_IS_OK(nt_status)) { x_fprintf(x_stdout, "%s (0x%x)\n", error_string, NT_STATUS_V(nt_status)); SAFE_FREE(error_string); return False; } if (request_lm_key && (memcmp(zeros, lm_key, sizeof(lm_key)) != 0)) { hex_lm_key = hex_encode_talloc(talloc_tos(), (const unsigned char *)lm_key, sizeof(lm_key)); x_fprintf(x_stdout, "LM_KEY: %s\n", hex_lm_key); TALLOC_FREE(hex_lm_key); } if (request_user_session_key && (memcmp(zeros, user_session_key, sizeof(user_session_key)) != 0)) { hex_user_session_key = hex_encode_talloc(talloc_tos(), (const unsigned char *)user_session_key, sizeof(user_session_key)); x_fprintf(x_stdout, "NT_KEY: %s\n", hex_user_session_key); TALLOC_FREE(hex_user_session_key); } return True; } /* Main program */ enum { OPT_USERNAME = 1000, OPT_DOMAIN, OPT_WORKSTATION, OPT_CHALLENGE, OPT_RESPONSE, OPT_LM, OPT_NT, OPT_PASSWORD, OPT_LM_KEY, OPT_USER_SESSION_KEY, OPT_DIAGNOSTICS, OPT_REQUIRE_MEMBERSHIP, OPT_USE_CACHED_CREDS, OPT_PAM_WINBIND_CONF, OPT_TARGET_SERVICE, OPT_TARGET_HOSTNAME }; int main(int argc, const char **argv) { TALLOC_CTX *frame = talloc_stackframe(); int opt; static const char *helper_protocol; static int diagnostics; static const char *hex_challenge; static const char *hex_lm_response; static const char *hex_nt_response; struct loadparm_context *lp_ctx; poptContext pc; /* NOTE: DO NOT change this interface without considering the implications! This is an external interface, which other programs will use to interact with this helper. */ /* We do not use single-letter command abbreviations, because they harm future interface stability. */ struct poptOption long_options[] = { POPT_AUTOHELP { "helper-protocol", 0, POPT_ARG_STRING, &helper_protocol, OPT_DOMAIN, "operate as a stdio-based helper", "helper protocol to use"}, { "username", 0, POPT_ARG_STRING, &opt_username, OPT_USERNAME, "username"}, { "domain", 0, POPT_ARG_STRING, &opt_domain, OPT_DOMAIN, "domain name"}, { "workstation", 0, POPT_ARG_STRING, &opt_workstation, OPT_WORKSTATION, "workstation"}, { "challenge", 0, POPT_ARG_STRING, &hex_challenge, OPT_CHALLENGE, "challenge (HEX encoded)"}, { "lm-response", 0, POPT_ARG_STRING, &hex_lm_response, OPT_LM, "LM Response to the challenge (HEX encoded)"}, { "nt-response", 0, POPT_ARG_STRING, &hex_nt_response, OPT_NT, "NT or NTLMv2 Response to the challenge (HEX encoded)"}, { "password", 0, POPT_ARG_STRING, &opt_password, OPT_PASSWORD, "User's plaintext password"}, { "request-lm-key", 0, POPT_ARG_NONE, &request_lm_key, OPT_LM_KEY, "Retrieve LM session key"}, { "request-nt-key", 0, POPT_ARG_NONE, &request_user_session_key, OPT_USER_SESSION_KEY, "Retrieve User (NT) session key"}, { "use-cached-creds", 0, POPT_ARG_NONE, &use_cached_creds, OPT_USE_CACHED_CREDS, "Use cached credentials if no password is given"}, { "diagnostics", 0, POPT_ARG_NONE, &diagnostics, OPT_DIAGNOSTICS, "Perform diagnostics on the authentication chain"}, { "require-membership-of", 0, POPT_ARG_STRING, &require_membership_of, OPT_REQUIRE_MEMBERSHIP, "Require that a user be a member of this group (either name or SID) for authentication to succeed" }, { "pam-winbind-conf", 0, POPT_ARG_STRING, &opt_pam_winbind_conf, OPT_PAM_WINBIND_CONF, "Require that request must set WBFLAG_PAM_CONTACT_TRUSTDOM when krb5 auth is required" }, { "target-service", 0, POPT_ARG_STRING, &opt_target_service, OPT_TARGET_SERVICE, "Target service (eg http)" }, { "target-hostname", 0, POPT_ARG_STRING, &opt_target_hostname, OPT_TARGET_HOSTNAME, "Target hostname" }, POPT_COMMON_CONFIGFILE POPT_COMMON_VERSION POPT_COMMON_OPTION POPT_TABLEEND }; /* Samba client initialisation */ smb_init_locale(); setup_logging("ntlm_auth", DEBUG_STDERR); /* Parse options */ pc = poptGetContext("ntlm_auth", argc, argv, long_options, 0); /* Parse command line options */ if (argc == 1) { poptPrintHelp(pc, stderr, 0); return 1; } while((opt = poptGetNextOpt(pc)) != -1) { /* Get generic config options like --configfile */ } poptFreeContext(pc); if (!lp_load_global(get_dyn_CONFIGFILE())) { d_fprintf(stderr, "ntlm_auth: error opening config file %s. Error was %s\n", get_dyn_CONFIGFILE(), strerror(errno)); exit(1); } pc = poptGetContext(NULL, argc, (const char **)argv, long_options, POPT_CONTEXT_KEEP_FIRST); while((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { case OPT_CHALLENGE: opt_challenge = strhex_to_data_blob(NULL, hex_challenge); if (opt_challenge.length != 8) { x_fprintf(x_stderr, "hex decode of %s failed! (only got %d bytes)\n", hex_challenge, (int)opt_challenge.length); exit(1); } break; case OPT_LM: opt_lm_response = strhex_to_data_blob(NULL, hex_lm_response); if (opt_lm_response.length != 24) { x_fprintf(x_stderr, "hex decode of %s failed! (only got %d bytes)\n", hex_lm_response, (int)opt_lm_response.length); exit(1); } break; case OPT_NT: opt_nt_response = strhex_to_data_blob(NULL, hex_nt_response); if (opt_nt_response.length < 24) { x_fprintf(x_stderr, "hex decode of %s failed! (only got %d bytes)\n", hex_nt_response, (int)opt_nt_response.length); exit(1); } break; case OPT_REQUIRE_MEMBERSHIP: if (strncasecmp_m("S-", require_membership_of, 2) == 0) { require_membership_of_sid = require_membership_of; } break; } } if (opt_username) { char *domain = SMB_STRDUP(opt_username); char *p = strchr_m(domain, *lp_winbind_separator()); if (p) { opt_username = p+1; *p = '\0'; if (opt_domain && !strequal(opt_domain, domain)) { x_fprintf(x_stderr, "Domain specified in username (%s) " "doesn't match specified domain (%s)!\n\n", domain, opt_domain); poptPrintHelp(pc, stderr, 0); exit(1); } opt_domain = domain; } else { SAFE_FREE(domain); } } /* Note: if opt_domain is "" then send no domain */ if (opt_domain == NULL) { opt_domain = get_winbind_domain(); } if (opt_workstation == NULL) { opt_workstation = ""; } lp_ctx = loadparm_init_s3(NULL, loadparm_s3_helpers()); if (lp_ctx == NULL) { x_fprintf(x_stderr, "loadparm_init_s3() failed!\n"); exit(1); } if (helper_protocol) { int i; for (i=0; i<NUM_HELPER_MODES; i++) { if (strcmp(helper_protocol, stdio_helper_protocols[i].name) == 0) { squid_stream(stdio_helper_protocols[i].mode, lp_ctx, stdio_helper_protocols[i].fn); exit(0); } } x_fprintf(x_stderr, "unknown helper protocol [%s]\n\nValid helper protools:\n\n", helper_protocol); for (i=0; i<NUM_HELPER_MODES; i++) { x_fprintf(x_stderr, "%s\n", stdio_helper_protocols[i].name); } exit(1); } if (!opt_username || !*opt_username) { x_fprintf(x_stderr, "username must be specified!\n\n"); poptPrintHelp(pc, stderr, 0); exit(1); } if (opt_challenge.length) { if (!check_auth_crap()) { exit(1); } exit(0); } if (!opt_password) { char pwd[256] = {0}; int rc; rc = samba_getpass("Password: ", pwd, sizeof(pwd), false, false); if (rc == 0) { opt_password = SMB_STRDUP(pwd); } } if (diagnostics) { if (!diagnose_ntlm_auth()) { return 1; } } else { fstring user; fstr_sprintf(user, "%s%c%s", opt_domain, winbind_separator(), opt_username); if (!check_plaintext_auth(user, opt_password, True)) { return 1; } } /* Exit code */ poptFreeContext(pc); TALLOC_FREE(frame); return 0; }
QGuLL/samba
source3/utils/ntlm_auth.c
C
gpl-3.0
82,796
[ 30522, 1013, 1008, 19998, 15488, 2497, 1013, 25022, 10343, 7375, 1012, 2663, 8428, 2094, 3570, 2565, 1012, 9385, 1006, 1039, 1007, 5199, 10693, 2456, 1011, 2494, 9385, 1006, 1039, 1007, 4080, 20081, 1026, 19557, 5339, 7485, 1030, 29086, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#include "forms/transactioncontrol.h" #include "forms/graphicbutton.h" #include "forms/label.h" #include "forms/listbox.h" #include "forms/scrollbar.h" #include "forms/ui.h" #include "framework/data.h" #include "framework/framework.h" #include "framework/logger.h" #include "framework/renderer.h" #include "game/state/city/base.h" #include "game/state/city/building.h" #include "game/state/city/research.h" #include "game/state/city/vehicle.h" #include "game/state/city/vequipment.h" #include "game/state/gamestate.h" #include "game/state/rules/aequipmenttype.h" #include "game/state/rules/city/vammotype.h" #include "game/state/shared/organisation.h" #include "game/ui/general/messagebox.h" namespace OpenApoc { sp<Image> TransactionControl::bgLeft; sp<Image> TransactionControl::bgRight; sp<Image> TransactionControl::purchaseBoxIcon; sp<Image> TransactionControl::purchaseXComIcon; sp<Image> TransactionControl::purchaseArrow; sp<Image> TransactionControl::alienContainedDetain; sp<Image> TransactionControl::alienContainedKill; sp<Image> TransactionControl::scrollLeft; sp<Image> TransactionControl::scrollRight; sp<Image> TransactionControl::transactionShade; sp<BitmapFont> TransactionControl::labelFont; bool TransactionControl::resourcesInitialised = false; void TransactionControl::initResources() { bgLeft = fw().data->loadImage(format( "PCK:xcom3/ufodata/newbut.pck:xcom3/ufodata/newbut.tab:%d:xcom3/ufodata/research.pcx", 45)); bgRight = fw().data->loadImage(format( "PCK:xcom3/ufodata/newbut.pck:xcom3/ufodata/newbut.tab:%d:xcom3/ufodata/research.pcx", 46)); purchaseBoxIcon = fw().data->loadImage(format( "PCK:xcom3/ufodata/newbut.pck:xcom3/ufodata/newbut.tab:%d:xcom3/ufodata/research.pcx", 47)); purchaseXComIcon = fw().data->loadImage(format( "PCK:xcom3/ufodata/newbut.pck:xcom3/ufodata/newbut.tab:%d:xcom3/ufodata/research.pcx", 48)); purchaseArrow = fw().data->loadImage(format( "PCK:xcom3/ufodata/newbut.pck:xcom3/ufodata/newbut.tab:%d:xcom3/ufodata/research.pcx", 52)); alienContainedDetain = fw().data->loadImage(format( "PCK:xcom3/ufodata/newbut.pck:xcom3/ufodata/newbut.tab:%d:xcom3/ufodata/research.pcx", 75)); alienContainedKill = fw().data->loadImage(format( "PCK:xcom3/ufodata/newbut.pck:xcom3/ufodata/newbut.tab:%d:xcom3/ufodata/research.pcx", 76)); scrollLeft = fw().data->loadImage(format( "PCK:xcom3/ufodata/newbut.pck:xcom3/ufodata/newbut.tab:%d:xcom3/ufodata/research.pcx", 53)); scrollRight = fw().data->loadImage(format( "PCK:xcom3/ufodata/newbut.pck:xcom3/ufodata/newbut.tab:%d:xcom3/ufodata/research.pcx", 54)); transactionShade = fw().data->loadImage("city/transaction-shade.png"); labelFont = ui().getFont("smalfont"); resourcesInitialised = true; } void TransactionControl::setScrollbarValues() { if (tradeState.getLeftIndex() == tradeState.getRightIndex()) { scrollBar->setMinimum(0); scrollBar->setMaximum(0); scrollBar->setValue(0); } else { scrollBar->setMinimum(0); scrollBar->setMaximum(tradeState.getLeftStock() + tradeState.getRightStock()); scrollBar->setValue(tradeState.getBalance()); } updateValues(); } void TransactionControl::setIndexLeft(int index) { tradeState.setLeftIndex(index); setScrollbarValues(); } void TransactionControl::setIndexRight(int index) { tradeState.setRightIndex(index); setScrollbarValues(); } void TransactionControl::updateValues() { if (scrollBar->getMaximum() != 0) { if (manufacturerHostile || manufacturerUnavailable) { int defaultRightStock = tradeState.getRightStock(); if ((tradeState.getLeftIndex() == ECONOMY_IDX && scrollBar->getValue() > defaultRightStock) || (tradeState.getRightIndex() == ECONOMY_IDX && scrollBar->getValue() < defaultRightStock)) { tradeState.cancelOrder(); scrollBar->setValue(tradeState.getBalance()); auto message_box = mksp<MessageBox>( manufacturerName, manufacturerHostile ? tr("Order canceled by the hostile manufacturer.") : tr("Manufacturer has no intact buildings in this city to " "deliver goods from."), MessageBox::ButtonOptions::Ok); fw().stageQueueCommand({StageCmd::Command::PUSH, message_box}); return; } } // TODO: remove linked if (tradeState.getBalance() != scrollBar->getValue()) { tradeState.setBalance(scrollBar->getValue()); if (linked) { for (auto &c : *linked) { if (auto c_sp = c.lock()) { c_sp->suspendUpdates = true; c_sp->scrollBar->setValue(scrollBar->getValue()); c_sp->updateValues(); c_sp->suspendUpdates = false; } } } if (!suspendUpdates) { this->pushFormEvent(FormEventType::ScrollBarChange, nullptr); } } } int curDeltaRight = tradeState.getLROrder(); int curDeltaLeft = -curDeltaRight; stockLeft->setText(format("%d", tradeState.getLeftStock(true))); stockRight->setText(format("%d", tradeState.getRightStock(true))); deltaLeft->setText(format("%s%d", curDeltaLeft > 0 ? "+" : "", curDeltaLeft)); deltaRight->setText(format("%s%d", curDeltaRight > 0 ? "+" : "", curDeltaRight)); deltaLeft->setVisible(tradeState.getLeftIndex() != ECONOMY_IDX && curDeltaLeft != 0); deltaRight->setVisible(tradeState.getRightIndex() != ECONOMY_IDX && curDeltaRight != 0); setDirty(); } void TransactionControl::link(sp<TransactionControl> c1, sp<TransactionControl> c2) { if (c1->linked && c2->linked) { LogError("Cannot link two already linked transaction controls!"); return; } if (!c2->linked) { if (!c1->linked) { c1->linked = mksp<std::list<wp<TransactionControl>>>(); c1->linked->emplace_back(c1); } c1->linked->emplace_back(c2); c2->linked = c1->linked; } if (!c1->linked && c2->linked) { c2->linked->emplace_back(c1); c1->linked = c2->linked; } // we assume c1 is older than c2, so we update c2 to match c1 c2->scrollBar->setValue(c1->scrollBar->getValue()); c2->updateValues(); } const sp<std::list<wp<TransactionControl>>> &TransactionControl::getLinked() const { return linked; } sp<TransactionControl> TransactionControl::createControl(GameState &state, StateRef<Agent> agent, int indexLeft, int indexRight) { // The agent or agent's vehicle should be on a base auto currentBuilding = agent->currentVehicle ? agent->currentVehicle->currentBuilding : agent->currentBuilding; if (!currentBuilding || !currentBuilding->base) { return nullptr; } std::vector<int> initialStock; // Fill out stock { initialStock.resize(9); // Stock of agents always zero on all bases except where it belongs int baseIndex = 0; for (auto &b : state.player_bases) { if (b.first == agent->homeBuilding->base.id) { initialStock[baseIndex] = 1; break; } baseIndex++; } } Type type; switch (agent->type->role) { case AgentType::Role::BioChemist: type = Type::BioChemist; break; case AgentType::Role::Engineer: type = Type::Engineer; break; case AgentType::Role::Physicist: type = Type::Physicist; break; case AgentType::Role::Soldier: type = Type::Soldier; break; default: LogError("Unknown type of agent %s.", agent.id); } int price = 0; int storeSpace = 0; bool isAmmo = false; bool isBio = false; bool isPerson = true; bool researched = true; auto manufacturer = agent->owner; bool manufacturerHostile = false; bool manufacturerUnavailable = false; return createControl(agent.id, type, agent->name, manufacturer, isAmmo, isBio, isPerson, researched, manufacturerHostile, manufacturerUnavailable, price, storeSpace, initialStock, indexLeft, indexRight); } sp<TransactionControl> TransactionControl::createControl(GameState &state, StateRef<AEquipmentType> agentEquipmentType, int indexLeft, int indexRight) { bool isBio = agentEquipmentType->bioStorage; int price = 0; int storeSpace = agentEquipmentType->store_space; bool researched = isBio ? true : state.research.isComplete(agentEquipmentType); std::vector<int> initialStock; bool hasStock = false; // Fill out stock { initialStock.resize(9); int baseIndex = 0; for (auto &b : state.player_bases) { int divisor = (agentEquipmentType->type == AEquipmentType::Type::Ammo && !isBio) ? agentEquipmentType->max_ammo : 1; initialStock[baseIndex] = isBio ? b.second->inventoryBioEquipment[agentEquipmentType.id] : b.second->inventoryAgentEquipment[agentEquipmentType.id]; initialStock[baseIndex] = (initialStock[baseIndex] + divisor - 1) / divisor; if (initialStock[baseIndex] > 0) { hasStock = true; } baseIndex++; } } // Fill out economy data if (!agentEquipmentType->bioStorage) { bool economyUnavailable = true; if (state.economy.find(agentEquipmentType.id) != state.economy.end()) { auto &economy = state.economy[agentEquipmentType.id]; int week = state.gameTime.getWeek(); initialStock[ECONOMY_IDX] = economy.currentStock; price = economy.currentPrice; economyUnavailable = economy.weekAvailable == 0 || economy.weekAvailable > week || !researched; } if (!hasStock && economyUnavailable) { return nullptr; } } else if (!hasStock) { return nullptr; } auto manufacturer = agentEquipmentType->manufacturer; bool isAmmo = agentEquipmentType->type == AEquipmentType::Type::Ammo; bool isPerson = false; auto canBuy = isBio ? Organisation::PurchaseResult::OK : agentEquipmentType->manufacturer->canPurchaseFrom( state, state.current_base->building, false); bool manufacturerHostile = canBuy == Organisation::PurchaseResult::OrgHostile; bool manufacturerUnavailable = manufacturer != state.getPlayer() && canBuy == Organisation::PurchaseResult::OrgHasNoBuildings; return createControl(agentEquipmentType.id, isBio ? Type::AgentEquipmentBio : Type::AgentEquipmentCargo, agentEquipmentType->name, manufacturer, isAmmo, isBio, isPerson, researched, manufacturerHostile, manufacturerUnavailable, price, storeSpace, initialStock, indexLeft, indexRight); } sp<TransactionControl> TransactionControl::createControl(GameState &state, StateRef<VEquipmentType> vehicleEquipmentType, int indexLeft, int indexRight) { int price = 0; int storeSpace = vehicleEquipmentType->store_space; bool researched = state.research.isComplete(vehicleEquipmentType); std::vector<int> initialStock; bool hasStock = false; // Fill out stock { initialStock.resize(9); int baseIndex = 0; for (auto &b : state.player_bases) { initialStock[baseIndex] = b.second->inventoryVehicleEquipment[vehicleEquipmentType.id]; if (initialStock[baseIndex] > 0) { hasStock = true; } baseIndex++; } } // Fill out economy data { bool economyUnavailable = true; if (state.economy.find(vehicleEquipmentType.id) != state.economy.end()) { auto &economy = state.economy[vehicleEquipmentType.id]; int week = state.gameTime.getWeek(); initialStock[ECONOMY_IDX] = economy.currentStock; price = economy.currentPrice; economyUnavailable = economy.weekAvailable == 0 || economy.weekAvailable > week || !researched; } if (!hasStock && economyUnavailable) { return nullptr; } } auto manufacturer = vehicleEquipmentType->manufacturer; bool isAmmo = false; bool isBio = false; bool isPerson = false; // Expecting all bases to be in one city auto canBuy = vehicleEquipmentType->manufacturer->canPurchaseFrom( state, state.current_base->building, false); bool manufacturerHostile = canBuy == Organisation::PurchaseResult::OrgHostile; bool manufacturerUnavailable = manufacturer != state.getPlayer() && canBuy == Organisation::PurchaseResult::OrgHasNoBuildings; return createControl(vehicleEquipmentType.id, Type::VehicleEquipment, vehicleEquipmentType->name, manufacturer, isAmmo, isBio, isPerson, researched, manufacturerHostile, manufacturerUnavailable, price, storeSpace, initialStock, indexLeft, indexRight); } sp<TransactionControl> TransactionControl::createControl(GameState &state, StateRef<VAmmoType> vehicleAmmoType, int indexLeft, int indexRight) { int price = 0; int storeSpace = vehicleAmmoType->store_space; std::vector<int> initialStock; bool hasStock = false; // Fill out stock { initialStock.resize(9); int baseIndex = 0; for (auto &b : state.player_bases) { initialStock[baseIndex] = b.second->inventoryVehicleAmmo[vehicleAmmoType.id]; if (initialStock[baseIndex] > 0) { hasStock = true; } baseIndex++; } } // Fill out economy data { bool economyUnavailable = true; if (state.economy.find(vehicleAmmoType.id) != state.economy.end()) { auto &economy = state.economy[vehicleAmmoType.id]; int week = state.gameTime.getWeek(); initialStock[ECONOMY_IDX] = economy.currentStock; price = economy.currentPrice; economyUnavailable = economy.weekAvailable == 0 || economy.weekAvailable > week; } if (!hasStock && economyUnavailable) { return nullptr; } } auto manufacturer = vehicleAmmoType->manufacturer; bool isAmmo = true; bool isBio = false; bool isPerson = false; bool researched = true; // Expecting all bases to be in one city auto canBuy = vehicleAmmoType->manufacturer->canPurchaseFrom(state, state.current_base->building, false); bool manufacturerHostile = canBuy == Organisation::PurchaseResult::OrgHostile; bool manufacturerUnavailable = manufacturer != state.getPlayer() && canBuy == Organisation::PurchaseResult::OrgHasNoBuildings; return createControl(vehicleAmmoType.id, Type::VehicleAmmo, vehicleAmmoType->name, manufacturer, isAmmo, isBio, isPerson, researched, manufacturerHostile, manufacturerUnavailable, price, storeSpace, initialStock, indexLeft, indexRight); } sp<TransactionControl> TransactionControl::createControl(GameState &state, StateRef<VehicleType> vehicleType, int indexLeft, int indexRight) { // No sense in transfer if (indexLeft != ECONOMY_IDX && indexRight != ECONOMY_IDX) { return nullptr; } int price = 0; int storeSpace = 0; std::vector<int> initialStock; // Fill out stock { initialStock.resize(9); // Stock of vehicle types always zero } // Fill out economy data { bool economyUnavailable = true; if (state.economy.find(vehicleType.id) != state.economy.end()) { auto &economy = state.economy[vehicleType.id]; int week = state.gameTime.getWeek(); initialStock[ECONOMY_IDX] = economy.currentStock; price = economy.currentPrice; economyUnavailable = economy.weekAvailable == 0 || economy.weekAvailable > week; } if (economyUnavailable) { return nullptr; } } auto manufacturer = vehicleType->manufacturer; bool isAmmo = false; bool isBio = false; bool isPerson = false; bool researched = true; // Expecting all bases to be in one city auto canBuy = vehicleType->manufacturer->canPurchaseFrom(state, state.current_base->building, true); bool manufacturerHostile = canBuy == Organisation::PurchaseResult::OrgHostile; bool manufacturerUnavailable = manufacturer != state.getPlayer() && canBuy == Organisation::PurchaseResult::OrgHasNoBuildings; return createControl(vehicleType.id, Type::VehicleType, vehicleType->name, manufacturer, isAmmo, isBio, isPerson, researched, manufacturerHostile, manufacturerUnavailable, price, storeSpace, initialStock, indexLeft, indexRight); } sp<TransactionControl> TransactionControl::createControl(GameState &state, StateRef<Vehicle> vehicle, int indexLeft, int indexRight) { // Only parked on base vehicles can be sold if (!vehicle->currentBuilding || !vehicle->currentBuilding->base) { return nullptr; } int price = 0; int storeSpace = 0; std::vector<int> initialStock; // Fill out stock { initialStock.resize(9); // Stock of vehicle types always zero on all bases except where it belongs int baseIndex = 0; for (auto &b : state.player_bases) { if (b.first == vehicle->homeBuilding->base.id) { initialStock[baseIndex] = 1; break; } baseIndex++; } } // Fill out economy data { bool economyUnavailable = true; if (state.economy.find(vehicle->type.id) != state.economy.end()) { auto &economy = state.economy[vehicle->type.id]; int week = state.gameTime.getWeek(); price = economy.currentPrice; economyUnavailable = economy.weekAvailable == 0 || economy.weekAvailable > week; } if (economyUnavailable) { // Nothing, we can still sell it for parts or transfer! } } LogWarning("Vehicle type %s starting price %d", vehicle->type.id, price); // Add price of ammo and equipment for (auto &e : vehicle->equipment) { if (state.economy.find(e->type.id) != state.economy.end()) { price += state.economy[e->type.id].currentPrice; if (e->ammo > 0 && state.economy.find(e->type->ammo_type.id) != state.economy.end()) { price += e->ammo * state.economy[e->type->ammo_type.id].currentPrice; } LogWarning("Vehicle type %s price increased to %d after counting %s", vehicle->type.id, price, e->type.id); } } // Subtract price of default equipment for (auto &e : vehicle->type->initial_equipment_list) { if (state.economy.find(e.second.id) != state.economy.end()) { price -= state.economy[e.second.id].currentPrice; LogWarning("Vehicle type %s price decreased to %d after counting %s", vehicle->type.id, price, e.second.id); } } LogWarning("Vehicle type %s final price %d", vehicle->type.id, price); auto manufacturer = vehicle->type->manufacturer; bool isAmmo = false; bool isBio = false; bool isPerson = false; bool researched = true; bool manufacturerHostile = false; bool manufacturerUnavailable = false; return createControl(vehicle.id, Type::Vehicle, vehicle->name, manufacturer, isAmmo, isBio, isPerson, researched, manufacturerHostile, manufacturerUnavailable, price, storeSpace, initialStock, indexLeft, indexRight); } sp<TransactionControl> TransactionControl::createControl(const UString &id, Type type, const UString &name, StateRef<Organisation> manufacturer, bool isAmmo, bool isBio, bool isPerson, bool researched, bool manufacturerHostile, bool manufacturerUnavailable, int price, int storeSpace, std::vector<int> &initialStock, int indexLeft, int indexRight) { auto control = mksp<TransactionControl>(); control->itemId = id; control->itemType = type; control->manufacturer = manufacturer; control->isAmmo = isAmmo; control->isBio = isBio; control->isPerson = isPerson; control->researched = researched; control->manufacturerHostile = manufacturerHostile; control->manufacturerUnavailable = manufacturerUnavailable; control->storeSpace = storeSpace; control->tradeState.setInitialStock(std::forward<std::vector<int>>(initialStock)); control->tradeState.setLeftIndex(indexLeft); control->tradeState.setRightIndex(indexRight); // If we create a non-purchase control we never become one so clear the values if (isBio || !researched || (indexLeft != ECONOMY_IDX && indexRight != ECONOMY_IDX)) { control->manufacturerName = ""; control->price = 0; } else { control->manufacturerName = manufacturer->name; control->price = price; } // Setup vars control->Size = Vec2<int>{173 + 178 - 2, 47}; // Setup resources if (!resourcesInitialised) { initResources(); } // Add controls // Name const UString &labelName = researched ? tr(name) : tr("Alien Artifact"); if (labelName.length() > 0) { auto label = control->createChild<Label>(labelName, labelFont); label->Location = {isAmmo ? 32 : 11, 3}; label->Size = {256, 16}; label->TextHAlign = HorizontalAlignment::Left; label->TextVAlign = VerticalAlignment::Centre; } // Manufacturer if (control->manufacturerName.length() > 0) { auto label = control->createChild<Label>(tr(control->manufacturerName), labelFont); if (manufacturerHostile || manufacturerUnavailable) { label->Tint = {255, 50, 25}; } label->Location = {34, 3}; label->Size = {256, 16}; label->TextHAlign = HorizontalAlignment::Right; label->TextVAlign = VerticalAlignment::Centre; } // Price if (price != 0 && (indexLeft == ECONOMY_IDX || indexRight == ECONOMY_IDX)) { auto label = control->createChild<Label>(format("$%d", control->price), labelFont); label->Location = {290, 3}; label->Size = {47, 16}; label->TextHAlign = HorizontalAlignment::Right; label->TextVAlign = VerticalAlignment::Centre; } // Stock (values set in updateValues) control->stockLeft = control->createChild<Label>("", labelFont); control->stockLeft->Location = {11, 26}; control->stockLeft->Size = {32, 14}; control->stockLeft->TextHAlign = HorizontalAlignment::Right; control->stockLeft->TextVAlign = VerticalAlignment::Centre; control->stockRight = control->createChild<Label>("", labelFont); control->stockRight->Location = {303, 26}; control->stockRight->Size = {32, 14}; control->stockRight->TextHAlign = HorizontalAlignment::Right; control->stockRight->TextVAlign = VerticalAlignment::Centre; // Delta (values set in updateValues) control->deltaLeft = control->createChild<Label>("", labelFont); control->deltaLeft->Location = {50, 26}; control->deltaLeft->Size = {32, 14}; control->deltaLeft->TextHAlign = HorizontalAlignment::Right; control->deltaLeft->TextVAlign = VerticalAlignment::Centre; control->deltaRight = control->createChild<Label>("", labelFont); control->deltaRight->Location = {264, 26}; control->deltaRight->Size = {30, 14}; control->deltaRight->TextHAlign = HorizontalAlignment::Right; control->deltaRight->TextVAlign = VerticalAlignment::Centre; // ScrollBar control->scrollBar = control->createChild<ScrollBar>(); control->scrollBar->Location = {102, 24}; control->scrollBar->Size = {147, 20}; control->scrollBar->setMinimum(0); control->scrollBar->setMaximum(0); // ScrollBar buttons auto buttonScrollLeft = control->createChild<GraphicButton>(nullptr, scrollLeft); buttonScrollLeft->Size = scrollLeft->size; buttonScrollLeft->Location = {87, 24}; buttonScrollLeft->ScrollBarPrev = control->scrollBar; auto buttonScrollRight = control->createChild<GraphicButton>(nullptr, scrollRight); buttonScrollRight->Size = scrollRight->size; buttonScrollRight->Location = {247, 24}; buttonScrollRight->ScrollBarNext = control->scrollBar; // Callback control->setupCallbacks(); // Finally set the values control->setScrollbarValues(); return control; } void TransactionControl::setupCallbacks() { std::function<void(FormsEvent * e)> onScrollChange = [this](FormsEvent *) { if (!this->suspendUpdates) { this->updateValues(); } }; scrollBar->addCallback(FormEventType::ScrollBarChange, onScrollChange); } int TransactionControl::getCrewDelta(int index) const { return isPerson ? -tradeState.shipmentsTotal(index) : 0; } int TransactionControl::getCargoDelta(int index) const { return !isBio && !isPerson ? -tradeState.shipmentsTotal(index) * storeSpace : 0; } int TransactionControl::getBioDelta(int index) const { return isBio ? -tradeState.shipmentsTotal(index) * storeSpace : 0; } int TransactionControl::getPriceDelta() const { int delta = 0; for (int i = 0; i < 8; i++) { delta += tradeState.shipmentsTotal(i) * price; } return delta; } void TransactionControl::onRender() { Control::onRender(); static Vec2<int> bgLeftPos = {0, 2}; static Vec2<int> bgRightPos = {172, 2}; static Vec2<int> ammoPos = {4, 2}; static Vec2<int> iconLeftPos = {58, 24}; static Vec2<int> iconRightPos = {270, 24}; static Vec2<int> iconSize = {22, 20}; // Draw BG fw().renderer->draw(bgLeft, bgLeftPos); fw().renderer->draw(bgRight, bgRightPos); // Draw Ammo Arrow if (isAmmo) { fw().renderer->draw(purchaseArrow, ammoPos); } // Draw Icons if (!deltaLeft->isVisible()) { sp<Image> icon; if (isBio) { icon = tradeState.getLeftIndex() == ECONOMY_IDX ? alienContainedKill : alienContainedDetain; } else { icon = tradeState.getLeftIndex() == ECONOMY_IDX ? purchaseBoxIcon : purchaseXComIcon; } auto iconPos = iconLeftPos + (iconSize - (Vec2<int>)icon->size) / 2; fw().renderer->draw(icon, iconPos); } if (!deltaRight->isVisible()) { sp<Image> icon; if (isBio) { icon = tradeState.getRightIndex() == ECONOMY_IDX ? alienContainedKill : alienContainedDetain; } else { icon = tradeState.getRightIndex() == ECONOMY_IDX ? purchaseBoxIcon : purchaseXComIcon; } auto iconPos = iconRightPos + (iconSize - (Vec2<int>)icon->size) / 2; fw().renderer->draw(icon, iconPos); } } void TransactionControl::postRender() { Control::postRender(); // Draw shade if inactive static Vec2<int> shadePos = {0, 0}; if (tradeState.getLeftIndex() == tradeState.getRightIndex() || (tradeState.getLeftStock() == 0 && tradeState.getRightStock() == 0)) { fw().renderer->draw(transactionShade, shadePos); } } void TransactionControl::unloadResources() { bgLeft.reset(); bgRight.reset(); purchaseBoxIcon.reset(); purchaseXComIcon.reset(); purchaseArrow.reset(); alienContainedDetain.reset(); alienContainedKill.reset(); scrollLeft.reset(); scrollRight.reset(); transactionShade.reset(); Control::unloadResources(); } /** * Get the sum of shipment orders from the base (economy). * @param from - 0-7 for bases, 8 for economy * @param exclude - 0-7 for bases, 8 for economy, -1 don't exclude (by default) * @return - sum of shipment orders */ int TransactionControl::Trade::shipmentsFrom(const int from, const int exclude) const { int total = 0; if (shipments.find(from) != shipments.end()) { for (auto &s : shipments.at(from)) { if (s.first != exclude && s.second > 0) { total += s.second; } } } return total; } /** * Get total shipment orders from(+) and to(-) the base (economy). * @param baseIdx - 0-7 for bases, 8 for economy * @return - total sum of shipment orders */ int TransactionControl::Trade::shipmentsTotal(const int baseIdx) const { int total = 0; if (shipments.find(baseIdx) != shipments.end()) { for (auto &s : shipments.at(baseIdx)) { total += s.second; } } return total; } /** * Get shipment order. * @param from - 0-7 for bases, 8 for economy * @param to - 0-7 for bases, 8 for economy * @return - the shipment order */ int TransactionControl::Trade::getOrder(const int from, const int to) const { if (shipments.find(from) != shipments.end()) { auto &order = shipments.at(from); if (order.find(to) != order.end()) { return order.at(to); } } return 0; } /** * Cancel shipment order. * @param from - 0-7 for bases, 8 for economy * @param to - 0-7 for bases, 8 for economy */ void TransactionControl::Trade::cancelOrder(const int from, const int to) { if (shipments.find(from) != shipments.end()) { shipments.at(from).erase(to); if (shipments.at(from).empty()) shipments.erase(from); } if (shipments.find(to) != shipments.end()) { shipments.at(to).erase(from); if (shipments.at(to).empty()) shipments.erase(to); } } /** * Get current stock. * @param baseIdx - index of the base (economy) * @param oppositeIdx - index of the opposite base (economy) * @param currentStock - true for current, false for default (by default) * @return - the stock */ int TransactionControl::Trade::getStock(const int baseIdx, const int oppositeIdx, bool currentStock) const { return initialStock[baseIdx] - shipmentsFrom(baseIdx, oppositeIdx) - (currentStock ? getOrder(baseIdx, oppositeIdx) : 0); } /** * ScrollBar support. Set current value. * @param balance - scrollBar->getValue() * @return - order from left to right side */ int TransactionControl::Trade::setBalance(const int balance) { int orderLR = balance - getRightStock(); if (orderLR == 0) { cancelOrder(); } else { shipments[leftIdx][rightIdx] = orderLR; shipments[rightIdx][leftIdx] = -orderLR; } return orderLR; } }; // namespace OpenApoc
FranciscoDA/OpenApoc
forms/transactioncontrol.cpp
C++
mit
29,041
[ 30522, 1001, 2421, 1000, 3596, 1013, 12598, 8663, 13181, 2140, 1012, 1044, 1000, 1001, 2421, 1000, 3596, 1013, 8425, 8569, 15474, 1012, 1044, 1000, 1001, 2421, 1000, 3596, 1013, 3830, 1012, 1044, 1000, 1001, 2421, 1000, 3596, 1013, 2862, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package org.jeewx.api.coupon.qrcode.model; public class ActionInfo extends Card { }
zhangdaiscott/jeewx-api
src/main/java/org/jeewx/api/coupon/qrcode/model/ActionInfo.java
Java
apache-2.0
88
[ 30522, 7427, 8917, 1012, 15333, 7974, 2595, 1012, 17928, 1012, 8648, 2239, 1012, 1053, 29566, 3207, 1012, 2944, 1025, 2270, 2465, 2895, 2378, 14876, 8908, 4003, 1063, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import React from 'react'; import { string, node } from 'prop-types'; import classNames from 'classnames'; const TileAction = ({ children, className, ...rest }) => { return ( <div className={classNames('tile-action', className)} {...rest}> {children} </div> ); }; /** * TileAction property types. */ TileAction.propTypes = { className: string, children: node }; /** * TileAction default properties. */ TileAction.defaultProps = {}; export default TileAction;
Landish/react-spectre-css
src/components/TileAction/TileAction.js
JavaScript
mit
489
[ 30522, 12324, 10509, 2013, 1005, 10509, 1005, 1025, 12324, 1063, 5164, 1010, 13045, 1065, 2013, 1005, 17678, 1011, 4127, 1005, 1025, 12324, 2465, 18442, 2015, 2013, 1005, 2465, 18442, 2015, 1005, 1025, 9530, 3367, 14090, 18908, 3258, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import * as React from 'react'; import classNames from 'classnames'; import ResizeObserver from 'rc-resize-observer'; import { composeRef } from 'rc-util/lib/ref'; import { ConfigContext } from '../config-provider'; import devWarning from '../_util/devWarning'; import { Breakpoint, responsiveArray } from '../_util/responsiveObserve'; import useBreakpoint from '../grid/hooks/useBreakpoint'; import SizeContext, { AvatarSize } from './SizeContext'; export interface AvatarProps { /** Shape of avatar, options:`circle`, `square` */ shape?: 'circle' | 'square'; /* * Size of avatar, options: `large`, `small`, `default` * or a custom number size * */ size?: AvatarSize; gap?: number; /** Src of image avatar */ src?: React.ReactNode; /** Srcset of image avatar */ srcSet?: string; draggable?: boolean; /** Icon to be used in avatar */ icon?: React.ReactNode; style?: React.CSSProperties; prefixCls?: string; className?: string; children?: React.ReactNode; alt?: string; /* callback when img load error */ /* return false to prevent Avatar show default fallback behavior, then you can do fallback by your self */ onError?: () => boolean; } const InternalAvatar: React.ForwardRefRenderFunction<unknown, AvatarProps> = (props, ref) => { const groupSize = React.useContext(SizeContext); const [scale, setScale] = React.useState(1); const [mounted, setMounted] = React.useState(false); const [isImgExist, setIsImgExist] = React.useState(true); const avatarNodeRef = React.useRef<HTMLElement>(); const avatarChildrenRef = React.useRef<HTMLElement>(); const avatarNodeMergeRef = composeRef(ref, avatarNodeRef); const { getPrefixCls } = React.useContext(ConfigContext); const setScaleParam = () => { if (!avatarChildrenRef.current || !avatarNodeRef.current) { return; } const childrenWidth = avatarChildrenRef.current.offsetWidth; // offsetWidth avoid affecting be transform scale const nodeWidth = avatarNodeRef.current.offsetWidth; // denominator is 0 is no meaning if (childrenWidth !== 0 && nodeWidth !== 0) { const { gap = 4 } = props; if (gap * 2 < nodeWidth) { setScale(nodeWidth - gap * 2 < childrenWidth ? (nodeWidth - gap * 2) / childrenWidth : 1); } } }; React.useEffect(() => { setMounted(true); }, []); React.useEffect(() => { setIsImgExist(true); setScale(1); }, [props.src]); React.useEffect(() => { setScaleParam(); }, [props.gap]); const handleImgLoadError = () => { const { onError } = props; const errorFlag = onError ? onError() : undefined; if (errorFlag !== false) { setIsImgExist(false); } }; const { prefixCls: customizePrefixCls, shape, size: customSize, src, srcSet, icon, className, alt, draggable, children, ...others } = props; const size = customSize === 'default' ? groupSize : customSize; const screens = useBreakpoint(); const responsiveSizeStyle: React.CSSProperties = React.useMemo(() => { if (typeof size !== 'object') { return {}; } const currentBreakpoint: Breakpoint = responsiveArray.find(screen => screens[screen])!; const currentSize = size[currentBreakpoint]; return currentSize ? { width: currentSize, height: currentSize, lineHeight: `${currentSize}px`, fontSize: icon ? currentSize / 2 : 18, } : {}; }, [screens, size]); devWarning( !(typeof icon === 'string' && icon.length > 2), 'Avatar', `\`icon\` is using ReactNode instead of string naming in v4. Please check \`${icon}\` at https://ant.design/components/icon`, ); const prefixCls = getPrefixCls('avatar', customizePrefixCls); const sizeCls = classNames({ [`${prefixCls}-lg`]: size === 'large', [`${prefixCls}-sm`]: size === 'small', }); const hasImageElement = React.isValidElement(src); const classString = classNames( prefixCls, sizeCls, { [`${prefixCls}-${shape}`]: shape, [`${prefixCls}-image`]: hasImageElement || (src && isImgExist), [`${prefixCls}-icon`]: icon, }, className, ); const sizeStyle: React.CSSProperties = typeof size === 'number' ? { width: size, height: size, lineHeight: `${size}px`, fontSize: icon ? size / 2 : 18, } : {}; let childrenToRender; if (typeof src === 'string' && isImgExist) { childrenToRender = ( <img src={src} draggable={draggable} srcSet={srcSet} onError={handleImgLoadError} alt={alt} /> ); } else if (hasImageElement) { childrenToRender = src; } else if (icon) { childrenToRender = icon; } else if (mounted || scale !== 1) { const transformString = `scale(${scale}) translateX(-50%)`; const childrenStyle: React.CSSProperties = { msTransform: transformString, WebkitTransform: transformString, transform: transformString, }; const sizeChildrenStyle: React.CSSProperties = typeof size === 'number' ? { lineHeight: `${size}px`, } : {}; childrenToRender = ( <ResizeObserver onResize={setScaleParam}> <span className={`${prefixCls}-string`} ref={(node: HTMLElement) => { avatarChildrenRef.current = node; }} style={{ ...sizeChildrenStyle, ...childrenStyle }} > {children} </span> </ResizeObserver> ); } else { childrenToRender = ( <span className={`${prefixCls}-string`} style={{ opacity: 0 }} ref={(node: HTMLElement) => { avatarChildrenRef.current = node; }} > {children} </span> ); } // The event is triggered twice from bubbling up the DOM tree. // see https://codesandbox.io/s/kind-snow-9lidz delete others.onError; delete others.gap; return ( <span {...others} style={{ ...sizeStyle, ...responsiveSizeStyle, ...others.style }} className={classString} ref={avatarNodeMergeRef as any} > {childrenToRender} </span> ); }; const Avatar = React.forwardRef<unknown, AvatarProps>(InternalAvatar); Avatar.displayName = 'Avatar'; Avatar.defaultProps = { shape: 'circle' as AvatarProps['shape'], size: 'default' as AvatarProps['size'], }; export default Avatar;
icaife/ant-design
components/avatar/avatar.tsx
TypeScript
mit
6,437
[ 30522, 12324, 1008, 2004, 10509, 2013, 1005, 10509, 1005, 1025, 12324, 2465, 18442, 2015, 2013, 1005, 2465, 18442, 2015, 1005, 1025, 12324, 24501, 4697, 16429, 8043, 6299, 2013, 1005, 22110, 1011, 24501, 4697, 1011, 9718, 1005, 1025, 12324, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php namespace DeviceBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; class DeviceBundle extends Bundle { }
sstie/app2_repo
src/DeviceBundle/DeviceBundle.php
PHP
mit
119
[ 30522, 1026, 1029, 25718, 3415, 15327, 5080, 27265, 2571, 1025, 2224, 25353, 2213, 14876, 4890, 1032, 6922, 1032, 8299, 5484, 11877, 1032, 14012, 1032, 14012, 1025, 2465, 5080, 27265, 2571, 8908, 14012, 1063, 1065, 102, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*body { font-size: 62.5%; font-family: "Trebuchet MS", "Arial", "Helvetica", "Verdana", "sans-serif"; } body table { font-size: 0.5em; } */ .demo-description { clear: both; padding: 12px; font-size: 1.3em; line-height: 1.4em; } .ui-draggable, .ui-droppable { background-position: top; }
mingxin6/incu
inc2_tw2/WebContent/pkg/jquery/demos.css
CSS
apache-2.0
299
[ 30522, 1013, 1008, 2303, 1063, 15489, 1011, 2946, 1024, 5786, 1012, 1019, 1003, 1025, 15489, 1011, 2155, 1024, 1000, 29461, 25987, 3388, 5796, 1000, 1010, 1000, 9342, 2140, 1000, 1010, 1000, 2002, 2140, 19510, 5555, 1000, 1010, 1000, 2310, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using System; using System.Text; using System.Collections.Generic; using System.Linq; using NHibernate.Mapping.ByCode.Conformist; using NHibernate.Mapping.ByCode; using nHibernateSample.Domain; namespace nHibernateSample.Mapping { public class CDDAMap : ClassMapping<CDDA> { public CDDAMap() { Schema("dbo"); Lazy(true); Id(x => x.Primarykey, map => map.Generator(Generators.Guid)); Property(x => x.Totaltracks); Property(x => x.Name); ManyToOne( x => x.Publisher, map => { map.Column("Publisher"); map.Cascade(Cascade.None); }); } } }
Flexberry/FlexberryORM-DemoApp
nHibernate/nHibernateSample/Mapping/CDDAMap.cs
C#
mit
766
[ 30522, 2478, 2291, 1025, 2478, 2291, 1012, 3793, 1025, 2478, 2291, 1012, 6407, 1012, 12391, 1025, 2478, 2291, 1012, 11409, 4160, 1025, 2478, 18699, 20755, 12789, 2618, 1012, 12375, 1012, 2011, 16044, 1012, 23758, 2923, 1025, 2478, 18699, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<html> <head> <title>User agent detail - UCWEB/2.0 (Linux; U; Opera Mini/7.1.32052/30.3697; ru; Oysters_T72HRi_3G) U2/1.0.0 UCBrowser/9.5.1.494 Mobile</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> </head> <body> <div class="container"> <div class="section"> <h1 class="header center orange-text">User agent detail</h1> <div class="row center"> <h5 class="header light"> UCWEB/2.0 (Linux; U; Opera Mini/7.1.32052/30.3697; ru; Oysters_T72HRi_3G) U2/1.0.0 UCBrowser/9.5.1.494 Mobile </h5> </div> </div> <div class="section"> <table class="striped"><tr><th></th><th colspan="3">General</th><th colspan="5">Device</th><th colspan="3">Bot</th><th colspan="2"></th></tr><tr><th>Provider</th><th>Browser</th><th>Engine</th><th>OS</th><th>Brand</th><th>Model</th><th>Type</th><th>Is mobile</th><th>Is touch</th><th>Is bot</th><th>Name</th><th>Type</th><th>Parse time</th><th>Actions</th></tr><tr><th colspan="14" class="green lighten-3">Source result (test suite)</th></tr><tr><td>browscap/browscap<br /><small>/tests/fixtures/issues/issue-635.php</small></td><td>UC Browser 9.5</td><td>Android 4.0</td><td>unknown </td><td style="border-left: 1px solid #555">Oysters</td><td>T72HRi 3G</td><td>Tablet</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td></td><td></td><td></td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-test">Detail</a> <!-- Modal Structure --> <div id="modal-test" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Testsuite result detail</h4> <p><pre><code class="php">Array ( [Browser] => UC Browser [Browser_Type] => Browser [Browser_Bits] => 32 [Browser_Maker] => UC Web [Version] => 9.5 [MajorVer] => 9 [MinorVer] => 5 [Platform] => Android [Platform_Version] => 4.0 [Platform_Bits] => 32 [Platform_Maker] => Google Inc [isMobileDevice] => 1 [isTablet] => 1 [Crawler] => [JavaScript] => 1 [Cookies] => 1 [Frames] => 1 [IFrames] => 1 [Tables] => 1 [BackgroundSounds] => [VBScript] => [JavaApplets] => [ActiveXControls] => [Device_Name] => T72HRi 3G [Device_Maker] => Oysters [Device_Type] => Tablet [Device_Pointing_Method] => touchscreen [Device_Code_Name] => T72HRi 3G [Device_Brand_Name] => Oysters [RenderingEngine_Name] => U2 [RenderingEngine_Version] => unknown [RenderingEngine_Maker] => UC Web ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><th colspan="14" class="green lighten-3">Providers</th></tr><tr><td>BrowscapPhp<br /><small>6012</small></td><td>UC Browser 9.5</td><td>U2 </td><td>Android 4.0</td><td style="border-left: 1px solid #555">Oysters</td><td>T72HRi 3G</td><td>Tablet</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.006</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-215ac98d-ccf8-4615-916e-5a819d6a59c9">Detail</a> <!-- Modal Structure --> <div id="modal-215ac98d-ccf8-4615-916e-5a819d6a59c9" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>BrowscapPhp result detail</h4> <p><pre><code class="php">stdClass Object ( [browser_name_regex] => /^ucweb\/2\.0 \(linux; u; opera mini\/.*; oysters_t72hri_3g\) u2\/.* ucbrowser\/9\.5.* mobile.*$/ [browser_name_pattern] => ucweb/2.0 (linux; u; opera mini/*; oysters_t72hri_3g) u2/* ucbrowser/9.5* mobile* [parent] => UC Browser 9.5 [comment] => UC Browser 9.5 [browser] => UC Browser [browser_type] => Browser [browser_bits] => 32 [browser_maker] => UC Web [browser_modus] => unknown [version] => 9.5 [majorver] => 9 [minorver] => 5 [platform] => Android [platform_version] => 4.0 [platform_description] => Android OS [platform_bits] => 32 [platform_maker] => Google Inc [alpha] => [beta] => [win16] => [win32] => [win64] => [frames] => 1 [iframes] => 1 [tables] => 1 [cookies] => 1 [backgroundsounds] => [javascript] => 1 [vbscript] => [javaapplets] => [activexcontrols] => [ismobiledevice] => 1 [istablet] => 1 [issyndicationreader] => [crawler] => [cssversion] => 3 [aolversion] => 0 [device_name] => T72HRi 3G [device_maker] => Oysters [device_type] => Tablet [device_pointing_method] => touchscreen [device_code_name] => T72HRi 3G [device_brand_name] => Oysters [renderingengine_name] => U2 [renderingengine_version] => unknown [renderingengine_description] => a WebKit Fork by UC Web [renderingengine_maker] => UC Web ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>DonatjUAParser<br /><small>v0.5.0</small></td><td>Opera Mini</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-f1436016-fdf1-4aea-b4be-1d7c99ab0661">Detail</a> <!-- Modal Structure --> <div id="modal-f1436016-fdf1-4aea-b4be-1d7c99ab0661" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>DonatjUAParser result detail</h4> <p><pre><code class="php">Array ( [platform] => Linux [browser] => Opera [version] => Mini ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>NeutrinoApiCom<br /><small></small></td><td>UC Browser </td><td><i class="material-icons">close</i></td><td>Linux </td><td style="border-left: 1px solid #555"></td><td></td><td>mobile-browser</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.27003</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc">Detail</a> <!-- Modal Structure --> <div id="modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>NeutrinoApiCom result detail</h4> <p><pre><code class="php">stdClass Object ( [mobile_screen_height] => 90 [is_mobile] => 1 [type] => mobile-browser [mobile_brand] => [mobile_model] => [version] => [is_android] => [browser_name] => UC Browser [operating_system_family] => Linux [operating_system_version] => [is_ios] => [producer] => UCWEB Technology Ltd. [operating_system] => Linux [mobile_screen_width] => 90 [mobile_browser] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>PiwikDeviceDetector<br /><small>3.5.2</small></td><td>Opera Mini 7.1</td><td>Presto </td><td>GNU/Linux </td><td style="border-left: 1px solid #555">Oysters</td><td>GT-S7250D</td><td>tablet</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.006</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-21638055-738d-46ba-a1b1-f5114bc26475">Detail</a> <!-- Modal Structure --> <div id="modal-21638055-738d-46ba-a1b1-f5114bc26475" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>PiwikDeviceDetector result detail</h4> <p><pre><code class="php">Array ( [client] => Array ( [type] => browser [name] => Opera Mini [short_name] => OI [version] => 7.1 [engine] => Presto ) [operatingSystem] => Array ( [name] => GNU/Linux [short_name] => LIN [version] => [platform] => ) [device] => Array ( [brand] => OY [brandName] => Oysters [model] => GT-S7250D [device] => 2 [deviceName] => tablet ) [bot] => [extra] => Array ( [isBot] => [isBrowser] => 1 [isFeedReader] => [isMobileApp] => [isPIM] => [isLibrary] => [isMediaPlayer] => [isCamera] => [isCarBrowser] => [isConsole] => [isFeaturePhone] => [isPhablet] => [isPortableMediaPlayer] => [isSmartDisplay] => [isSmartphone] => [isTablet] => 1 [isTV] => [isDesktop] => 1 [isMobile] => 1 [isTouchEnabled] => ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>SinergiBrowserDetector<br /><small>6.0.0</small></td><td>Opera Mini 7.1.32052</td><td><i class="material-icons">close</i></td><td>Linux </td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.001</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-5415e7f2-ef7b-434c-abe0-b71ba9f6707c">Detail</a> <!-- Modal Structure --> <div id="modal-5415e7f2-ef7b-434c-abe0-b71ba9f6707c" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>SinergiBrowserDetector result detail</h4> <p><pre><code class="php">Array ( [browser] => Sinergi\BrowserDetector\Browser Object ( [userAgent:Sinergi\BrowserDetector\Browser:private] => Sinergi\BrowserDetector\UserAgent Object ( [userAgentString:Sinergi\BrowserDetector\UserAgent:private] => UCWEB/2.0 (Linux; U; Opera Mini/7.1.32052/30.3697; ru; Oysters_T72HRi_3G) U2/1.0.0 UCBrowser/9.5.1.494 Mobile ) [name:Sinergi\BrowserDetector\Browser:private] => Opera Mini [version:Sinergi\BrowserDetector\Browser:private] => 7.1.32052 [isRobot:Sinergi\BrowserDetector\Browser:private] => [isChromeFrame:Sinergi\BrowserDetector\Browser:private] => ) [operatingSystem] => Sinergi\BrowserDetector\Os Object ( [name:Sinergi\BrowserDetector\Os:private] => Linux [version:Sinergi\BrowserDetector\Os:private] => unknown [isMobile:Sinergi\BrowserDetector\Os:private] => 1 [userAgent:Sinergi\BrowserDetector\Os:private] => Sinergi\BrowserDetector\UserAgent Object ( [userAgentString:Sinergi\BrowserDetector\UserAgent:private] => UCWEB/2.0 (Linux; U; Opera Mini/7.1.32052/30.3697; ru; Oysters_T72HRi_3G) U2/1.0.0 UCBrowser/9.5.1.494 Mobile ) ) [device] => Sinergi\BrowserDetector\Device Object ( [name:Sinergi\BrowserDetector\Device:private] => unknown [userAgent:Sinergi\BrowserDetector\Device:private] => Sinergi\BrowserDetector\UserAgent Object ( [userAgentString:Sinergi\BrowserDetector\UserAgent:private] => UCWEB/2.0 (Linux; U; Opera Mini/7.1.32052/30.3697; ru; Oysters_T72HRi_3G) U2/1.0.0 UCBrowser/9.5.1.494 Mobile ) ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>UAParser<br /><small>v3.4.5</small></td><td>Opera Mini 7.1.32052</td><td><i class="material-icons">close</i></td><td>Linux </td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.003</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b">Detail</a> <!-- Modal Structure --> <div id="modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>UAParser result detail</h4> <p><pre><code class="php">UAParser\Result\Client Object ( [ua] => UAParser\Result\UserAgent Object ( [major] => 7 [minor] => 1 [patch] => 32052 [family] => Opera Mini ) [os] => UAParser\Result\OperatingSystem Object ( [major] => [minor] => [patch] => [patchMinor] => [family] => Linux ) [device] => UAParser\Result\Device Object ( [brand] => Generic [model] => Feature Phone [family] => Generic Feature Phone ) [originalUserAgent] => UCWEB/2.0 (Linux; U; Opera Mini/7.1.32052/30.3697; ru; Oysters_T72HRi_3G) U2/1.0.0 UCBrowser/9.5.1.494 Mobile ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>UserAgentStringCom<br /><small></small></td><td>Opera Mini 7.1.32052</td><td><i class="material-icons">close</i></td><td>Linux </td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.04601</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-9cdd8b45-a2eb-406b-bd27-7e48af38ffd4">Detail</a> <!-- Modal Structure --> <div id="modal-9cdd8b45-a2eb-406b-bd27-7e48af38ffd4" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>UserAgentStringCom result detail</h4> <p><pre><code class="php">stdClass Object ( [agent_type] => Browser [agent_name] => Opera Mini [agent_version] => 7.1.32052 [os_type] => Linux [os_name] => Linux [os_versionName] => [os_versionNumber] => [os_producer] => [os_producerURL] => [linux_distibution] => Null [agent_language] => Russian [agent_languageTag] => ru ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>WhatIsMyBrowserCom<br /><small></small></td><td>UC Browser 9.5.1.494</td><td> </td><td>Linux </td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.40104</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-9795f66f-7271-430e-973a-a5c0e14dc35a">Detail</a> <!-- Modal Structure --> <div id="modal-9795f66f-7271-430e-973a-a5c0e14dc35a" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>WhatIsMyBrowserCom result detail</h4> <p><pre><code class="php">stdClass Object ( [operating_system_name] => Linux [simple_sub_description_string] => [simple_browser_string] => UC Browser 9.5 on Linux [browser_version] => 9.5 [extra_info] => Array ( ) [operating_platform] => [extra_info_table] => Array ( ) [layout_engine_name] => [detected_addons] => Array ( ) [operating_system_flavour_code] => [hardware_architecture] => [operating_system_flavour] => [operating_system_frameworks] => Array ( ) [browser_name_code] => uc-browser [operating_system_version] => [simple_operating_platform_string] => [is_abusive] => [layout_engine_version] => [browser_capabilities] => Array ( ) [operating_platform_vendor_name] => [operating_system] => Linux [operating_system_version_full] => [operating_platform_code] => [browser_name] => UC Browser [operating_system_name_code] => linux [user_agent] => UCWEB/2.0 (Linux; U; Opera Mini/7.1.32052/30.3697; ru; Oysters_T72HRi_3G) U2/1.0.0 UCBrowser/9.5.1.494 Mobile [browser_version_full] => 9.5.1.494 [browser] => UC Browser 9.5 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>WhichBrowser<br /><small>2.0.10</small></td><td>UC Browser 9.5</td><td>Gecko </td><td> </td><td style="border-left: 1px solid #555"></td><td></td><td>mobile:feature</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.049</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4">Detail</a> <!-- Modal Structure --> <div id="modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>WhichBrowser result detail</h4> <p><pre><code class="php">Array ( [browser] => Array ( [name] => UC Browser [version] => 9.5 [type] => browser ) [engine] => Array ( [name] => Gecko ) [device] => Array ( [type] => mobile [subtype] => feature ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Woothee<br /><small>v1.2.0</small></td><td>Opera </td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>pc</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-3f285ff5-314b-4db4-9948-54572e92e7b6">Detail</a> <!-- Modal Structure --> <div id="modal-3f285ff5-314b-4db4-9948-54572e92e7b6" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Woothee result detail</h4> <p><pre><code class="php">Array ( [name] => Opera [vendor] => Opera [version] => UNKNOWN [category] => pc [os] => Linux [os_version] => UNKNOWN ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Wurfl<br /><small>1.6.4</small></td><td>UC Browser 8</td><td><i class="material-icons">close</i></td><td>Android 4.0</td><td style="border-left: 1px solid #555"></td><td></td><td>Feature Phone</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.01</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-1a1aee36-7ce7-4111-a391-8e2c501f1532">Detail</a> <!-- Modal Structure --> <div id="modal-1a1aee36-7ce7-4111-a391-8e2c501f1532" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Wurfl result detail</h4> <p><pre><code class="php">Array ( [virtual] => Array ( [is_android] => false [is_ios] => false [is_windows_phone] => false [is_app] => false [is_full_desktop] => false [is_largescreen] => false [is_mobile] => true [is_robot] => false [is_smartphone] => false [is_touchscreen] => false [is_wml_preferred] => false [is_xhtmlmp_preferred] => true [is_html_preferred] => false [advertised_device_os] => Android [advertised_device_os_version] => 4.0 [advertised_browser] => UC Browser [advertised_browser_version] => 8 [complete_device_name] => [form_factor] => Feature Phone [is_phone] => true [is_app_webview] => false ) [all] => Array ( [brand_name] => [model_name] => [unique] => true [ununiqueness_handler] => [is_wireless_device] => true [device_claims_web_support] => false [has_qwerty_keyboard] => false [can_skip_aligned_link_row] => true [uaprof] => [uaprof2] => [uaprof3] => [nokia_series] => 0 [nokia_edition] => 0 [device_os] => [mobile_browser] => UCWeb [mobile_browser_version] => browser_root_ucweb [device_os_version] => [pointing_method] => [release_date] => 2002_july [marketing_name] => [model_extra_info] => [nokia_feature_pack] => 0 [can_assign_phone_number] => true [is_tablet] => false [manufacturer_name] => [is_bot] => false [is_google_glass] => false [proportional_font] => false [built_in_back_button_support] => false [card_title_support] => true [softkey_support] => false [table_support] => true [numbered_menus] => false [menu_with_select_element_recommended] => false [menu_with_list_of_links_recommended] => true [icons_on_menu_items_support] => false [break_list_of_links_with_br_element_recommended] => true [access_key_support] => false [wrap_mode_support] => false [times_square_mode_support] => false [deck_prefetch_support] => false [elective_forms_recommended] => true [wizards_recommended] => false [image_as_link_support] => false [insert_br_element_after_widget_recommended] => false [wml_can_display_images_and_text_on_same_line] => false [wml_displays_image_in_center] => false [opwv_wml_extensions_support] => false [wml_make_phone_call_string] => wtai://wp/mc; [chtml_display_accesskey] => false [emoji] => false [chtml_can_display_images_and_text_on_same_line] => false [chtml_displays_image_in_center] => false [imode_region] => none [chtml_make_phone_call_string] => tel: [chtml_table_support] => false [xhtml_honors_bgcolor] => false [xhtml_supports_forms_in_table] => false [xhtml_support_wml2_namespace] => false [xhtml_autoexpand_select] => false [xhtml_select_as_dropdown] => false [xhtml_select_as_radiobutton] => false [xhtml_select_as_popup] => false [xhtml_display_accesskey] => false [xhtml_supports_invisible_text] => false [xhtml_supports_inline_input] => false [xhtml_supports_monospace_font] => false [xhtml_supports_table_for_layout] => false [xhtml_supports_css_cell_table_coloring] => false [xhtml_format_as_css_property] => false [xhtml_format_as_attribute] => false [xhtml_nowrap_mode] => false [xhtml_marquee_as_css_property] => false [xhtml_readable_background_color1] => #FFFFFF [xhtml_readable_background_color2] => #FFFFFF [xhtml_allows_disabled_form_elements] => false [xhtml_document_title_support] => true [xhtml_preferred_charset] => utf8 [opwv_xhtml_extensions_support] => false [xhtml_make_phone_call_string] => tel: [xhtmlmp_preferred_mime_type] => application/vnd.wap.xhtml+xml [xhtml_table_support] => true [xhtml_send_sms_string] => none [xhtml_send_mms_string] => none [xhtml_file_upload] => not_supported [cookie_support] => true [accept_third_party_cookie] => true [xhtml_supports_iframe] => none [xhtml_avoid_accesskeys] => false [xhtml_can_embed_video] => none [ajax_support_javascript] => false [ajax_manipulate_css] => false [ajax_support_getelementbyid] => false [ajax_support_inner_html] => false [ajax_xhr_type] => none [ajax_manipulate_dom] => false [ajax_support_events] => false [ajax_support_event_listener] => false [ajax_preferred_geoloc_api] => none [xhtml_support_level] => 1 [preferred_markup] => html_wi_oma_xhtmlmp_1_0 [wml_1_1] => true [wml_1_2] => false [wml_1_3] => false [html_wi_w3_xhtmlbasic] => true [html_wi_oma_xhtmlmp_1_0] => true [html_wi_imode_html_1] => false [html_wi_imode_html_2] => false [html_wi_imode_html_3] => false [html_wi_imode_html_4] => false [html_wi_imode_html_5] => false [html_wi_imode_htmlx_1] => false [html_wi_imode_htmlx_1_1] => false [html_wi_imode_compact_generic] => false [html_web_3_2] => false [html_web_4_0] => false [voicexml] => false [multipart_support] => false [total_cache_disable_support] => false [time_to_live_support] => false [resolution_width] => 128 [resolution_height] => 92 [columns] => 11 [max_image_width] => 120 [max_image_height] => 92 [rows] => 6 [physical_screen_width] => 27 [physical_screen_height] => 27 [dual_orientation] => false [density_class] => 1.0 [wbmp] => true [bmp] => false [epoc_bmp] => false [gif_animated] => true [jpg] => true [png] => true [tiff] => false [transparent_png_alpha] => false [transparent_png_index] => false [svgt_1_1] => false [svgt_1_1_plus] => false [greyscale] => false [gif] => true [colors] => 256 [webp_lossy_support] => false [webp_lossless_support] => false [post_method_support] => true [basic_authentication_support] => true [empty_option_value_support] => true [emptyok] => false [nokia_voice_call] => false [wta_voice_call] => false [wta_phonebook] => false [wta_misc] => false [wta_pdc] => false [https_support] => true [phone_id_provided] => false [max_data_rate] => 9 [wifi] => false [sdio] => false [vpn] => false [has_cellular_radio] => true [max_deck_size] => 10000 [max_url_length_in_requests] => 256 [max_url_length_homepage] => 0 [max_url_length_bookmark] => 0 [max_url_length_cached_page] => 0 [max_no_of_connection_settings] => 0 [max_no_of_bookmarks] => 0 [max_length_of_username] => 0 [max_length_of_password] => 0 [max_object_size] => 0 [downloadfun_support] => false [directdownload_support] => false [inline_support] => false [oma_support] => false [ringtone] => false [ringtone_3gpp] => false [ringtone_midi_monophonic] => false [ringtone_midi_polyphonic] => false [ringtone_imelody] => false [ringtone_digiplug] => false [ringtone_compactmidi] => false [ringtone_mmf] => false [ringtone_rmf] => false [ringtone_xmf] => false [ringtone_amr] => false [ringtone_awb] => false [ringtone_aac] => false [ringtone_wav] => false [ringtone_mp3] => false [ringtone_spmidi] => false [ringtone_qcelp] => false [ringtone_voices] => 1 [ringtone_df_size_limit] => 0 [ringtone_directdownload_size_limit] => 0 [ringtone_inline_size_limit] => 0 [ringtone_oma_size_limit] => 0 [wallpaper] => false [wallpaper_max_width] => 0 [wallpaper_max_height] => 0 [wallpaper_preferred_width] => 0 [wallpaper_preferred_height] => 0 [wallpaper_resize] => none [wallpaper_wbmp] => false [wallpaper_bmp] => false [wallpaper_gif] => false [wallpaper_jpg] => false [wallpaper_png] => false [wallpaper_tiff] => false [wallpaper_greyscale] => false [wallpaper_colors] => 2 [wallpaper_df_size_limit] => 0 [wallpaper_directdownload_size_limit] => 0 [wallpaper_inline_size_limit] => 0 [wallpaper_oma_size_limit] => 0 [screensaver] => false [screensaver_max_width] => 0 [screensaver_max_height] => 0 [screensaver_preferred_width] => 0 [screensaver_preferred_height] => 0 [screensaver_resize] => none [screensaver_wbmp] => false [screensaver_bmp] => false [screensaver_gif] => false [screensaver_jpg] => false [screensaver_png] => false [screensaver_greyscale] => false [screensaver_colors] => 2 [screensaver_df_size_limit] => 0 [screensaver_directdownload_size_limit] => 0 [screensaver_inline_size_limit] => 0 [screensaver_oma_size_limit] => 0 [picture] => false [picture_max_width] => 0 [picture_max_height] => 0 [picture_preferred_width] => 0 [picture_preferred_height] => 0 [picture_resize] => none [picture_wbmp] => false [picture_bmp] => false [picture_gif] => false [picture_jpg] => false [picture_png] => false [picture_greyscale] => false [picture_colors] => 2 [picture_df_size_limit] => 0 [picture_directdownload_size_limit] => 0 [picture_inline_size_limit] => 0 [picture_oma_size_limit] => 0 [video] => false [oma_v_1_0_forwardlock] => false [oma_v_1_0_combined_delivery] => false [oma_v_1_0_separate_delivery] => false [streaming_video] => false [streaming_3gpp] => false [streaming_mp4] => false [streaming_mov] => false [streaming_video_size_limit] => 0 [streaming_real_media] => none [streaming_flv] => false [streaming_3g2] => false [streaming_vcodec_h263_0] => -1 [streaming_vcodec_h263_3] => -1 [streaming_vcodec_mpeg4_sp] => -1 [streaming_vcodec_mpeg4_asp] => -1 [streaming_vcodec_h264_bp] => -1 [streaming_acodec_amr] => none [streaming_acodec_aac] => none [streaming_wmv] => none [streaming_preferred_protocol] => rtsp [streaming_preferred_http_protocol] => none [wap_push_support] => false [connectionless_service_indication] => false [connectionless_service_load] => false [connectionless_cache_operation] => false [connectionoriented_unconfirmed_service_indication] => false [connectionoriented_unconfirmed_service_load] => false [connectionoriented_unconfirmed_cache_operation] => false [connectionoriented_confirmed_service_indication] => false [connectionoriented_confirmed_service_load] => false [connectionoriented_confirmed_cache_operation] => false [utf8_support] => true [ascii_support] => false [iso8859_support] => false [expiration_date] => false [j2me_cldc_1_0] => false [j2me_cldc_1_1] => false [j2me_midp_1_0] => false [j2me_midp_2_0] => false [doja_1_0] => false [doja_1_5] => false [doja_2_0] => false [doja_2_1] => false [doja_2_2] => false [doja_3_0] => false [doja_3_5] => false [doja_4_0] => false [j2me_jtwi] => false [j2me_mmapi_1_0] => false [j2me_mmapi_1_1] => false [j2me_wmapi_1_0] => false [j2me_wmapi_1_1] => false [j2me_wmapi_2_0] => false [j2me_btapi] => false [j2me_3dapi] => false [j2me_locapi] => false [j2me_nokia_ui] => false [j2me_motorola_lwt] => false [j2me_siemens_color_game] => false [j2me_siemens_extension] => false [j2me_heap_size] => 0 [j2me_max_jar_size] => 0 [j2me_storage_size] => 0 [j2me_max_record_store_size] => 0 [j2me_screen_width] => 0 [j2me_screen_height] => 0 [j2me_canvas_width] => 0 [j2me_canvas_height] => 0 [j2me_bits_per_pixel] => 0 [j2me_audio_capture_enabled] => false [j2me_video_capture_enabled] => false [j2me_photo_capture_enabled] => false [j2me_capture_image_formats] => none [j2me_http] => false [j2me_https] => false [j2me_socket] => false [j2me_udp] => false [j2me_serial] => false [j2me_gif] => false [j2me_gif89a] => false [j2me_jpg] => false [j2me_png] => false [j2me_bmp] => false [j2me_bmp3] => false [j2me_wbmp] => false [j2me_midi] => false [j2me_wav] => false [j2me_amr] => false [j2me_mp3] => false [j2me_mp4] => false [j2me_imelody] => false [j2me_rmf] => false [j2me_au] => false [j2me_aac] => false [j2me_realaudio] => false [j2me_xmf] => false [j2me_wma] => false [j2me_3gpp] => false [j2me_h263] => false [j2me_svgt] => false [j2me_mpeg4] => false [j2me_realvideo] => false [j2me_real8] => false [j2me_realmedia] => false [j2me_left_softkey_code] => 0 [j2me_right_softkey_code] => 0 [j2me_middle_softkey_code] => 0 [j2me_select_key_code] => 0 [j2me_return_key_code] => 0 [j2me_clear_key_code] => 0 [j2me_datefield_no_accepts_null_date] => false [j2me_datefield_broken] => false [receiver] => false [sender] => false [mms_max_size] => 0 [mms_max_height] => 0 [mms_max_width] => 0 [built_in_recorder] => false [built_in_camera] => false [mms_jpeg_baseline] => false [mms_jpeg_progressive] => false [mms_gif_static] => false [mms_gif_animated] => false [mms_png] => false [mms_bmp] => false [mms_wbmp] => false [mms_amr] => false [mms_wav] => false [mms_midi_monophonic] => false [mms_midi_polyphonic] => false [mms_midi_polyphonic_voices] => 0 [mms_spmidi] => false [mms_mmf] => false [mms_mp3] => false [mms_evrc] => false [mms_qcelp] => false [mms_ota_bitmap] => false [mms_nokia_wallpaper] => false [mms_nokia_operatorlogo] => false [mms_nokia_3dscreensaver] => false [mms_nokia_ringingtone] => false [mms_rmf] => false [mms_xmf] => false [mms_symbian_install] => false [mms_jar] => false [mms_jad] => false [mms_vcard] => false [mms_vcalendar] => false [mms_wml] => false [mms_wbxml] => false [mms_wmlc] => false [mms_video] => false [mms_mp4] => false [mms_3gpp] => false [mms_3gpp2] => false [mms_max_frame_rate] => 0 [nokiaring] => false [picturemessage] => false [operatorlogo] => false [largeoperatorlogo] => false [callericon] => false [nokiavcard] => false [nokiavcal] => false [sckl_ringtone] => false [sckl_operatorlogo] => false [sckl_groupgraphic] => false [sckl_vcard] => false [sckl_vcalendar] => false [text_imelody] => false [ems] => false [ems_variablesizedpictures] => false [ems_imelody] => false [ems_odi] => false [ems_upi] => false [ems_version] => 0 [siemens_ota] => false [siemens_logo_width] => 101 [siemens_logo_height] => 29 [siemens_screensaver_width] => 101 [siemens_screensaver_height] => 50 [gprtf] => false [sagem_v1] => false [sagem_v2] => false [panasonic] => false [sms_enabled] => true [wav] => false [mmf] => false [smf] => false [mld] => false [midi_monophonic] => false [midi_polyphonic] => false [sp_midi] => false [rmf] => false [xmf] => false [compactmidi] => false [digiplug] => false [nokia_ringtone] => false [imelody] => false [au] => false [amr] => false [awb] => false [aac] => false [mp3] => false [voices] => 1 [qcelp] => false [evrc] => false [flash_lite_version] => [fl_wallpaper] => false [fl_screensaver] => false [fl_standalone] => false [fl_browser] => false [fl_sub_lcd] => false [full_flash_support] => false [css_supports_width_as_percentage] => true [css_border_image] => none [css_rounded_corners] => none [css_gradient] => none [css_spriting] => false [css_gradient_linear] => none [is_transcoder] => false [transcoder_ua_header] => user-agent [rss_support] => false [pdf_support] => false [progressive_download] => false [playback_vcodec_h263_0] => -1 [playback_vcodec_h263_3] => -1 [playback_vcodec_mpeg4_sp] => -1 [playback_vcodec_mpeg4_asp] => -1 [playback_vcodec_h264_bp] => -1 [playback_real_media] => none [playback_3gpp] => false [playback_3g2] => false [playback_mp4] => false [playback_mov] => false [playback_acodec_amr] => none [playback_acodec_aac] => none [playback_df_size_limit] => 0 [playback_directdownload_size_limit] => 0 [playback_inline_size_limit] => 0 [playback_oma_size_limit] => 0 [playback_acodec_qcelp] => false [playback_wmv] => none [hinted_progressive_download] => false [html_preferred_dtd] => xhtml_mp1 [viewport_supported] => false [viewport_width] => [viewport_userscalable] => [viewport_initial_scale] => [viewport_maximum_scale] => [viewport_minimum_scale] => [mobileoptimized] => false [handheldfriendly] => false [canvas_support] => none [image_inlining] => false [is_smarttv] => false [is_console] => false [nfc_support] => false [ux_full_desktop] => false [jqm_grade] => none [is_sencha_touch_ok] => false [controlcap_is_smartphone] => default [controlcap_is_ios] => default [controlcap_is_android] => default [controlcap_is_robot] => default [controlcap_is_app] => default [controlcap_advertised_device_os] => default [controlcap_advertised_device_os_version] => default [controlcap_advertised_browser] => default [controlcap_advertised_browser_version] => default [controlcap_is_windows_phone] => default [controlcap_is_full_desktop] => default [controlcap_is_largescreen] => default [controlcap_is_mobile] => default [controlcap_is_touchscreen] => default [controlcap_is_wml_preferred] => default [controlcap_is_xhtmlmp_preferred] => default [controlcap_is_html_preferred] => default [controlcap_form_factor] => default [controlcap_complete_device_name] => default ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr></table> </div> <div class="section"> <h1 class="header center orange-text">About this comparison</h1> <div class="row center"> <h5 class="header light"> The primary goal of this project is simple<br /> I wanted to know which user agent parser is the most accurate in each part - device detection, bot detection and so on...<br /> <br /> The secondary goal is to provide a source for all user agent parsers to improve their detection based on this results.<br /> <br /> You can also improve this further, by suggesting ideas at <a href="https://github.com/ThaDafinser/UserAgentParserComparison">ThaDafinser/UserAgentParserComparison</a><br /> <br /> The comparison is based on the abstraction by <a href="https://github.com/ThaDafinser/UserAgentParser">ThaDafinser/UserAgentParser</a> </h5> </div> </div> <div class="card"> <div class="card-content"> Comparison created <i>2016-02-13 13:33:35</i> | by <a href="https://github.com/ThaDafinser">ThaDafinser</a> </div> </div> </div> <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/list.js/1.1.1/list.min.js"></script> <script> $(document).ready(function(){ // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered $('.modal-trigger').leanModal(); }); </script> </body> </html>
ThaDafinser/UserAgentParserComparison
v4/user-agent-detail/77/57/77579e27-7cc8-442b-8675-74b78928301a.html
HTML
mit
46,143
[ 30522, 1026, 16129, 1028, 1026, 2132, 1028, 1026, 2516, 1028, 5310, 4005, 6987, 1011, 15384, 8545, 2497, 1013, 1016, 1012, 1014, 1006, 11603, 1025, 1057, 1025, 3850, 7163, 1013, 1021, 1012, 1015, 1012, 13710, 25746, 1013, 2382, 1012, 4029, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# # Copyright (C) 2011 - present Instructure, Inc. # # This file is part of Canvas. # # Canvas is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # Canvas 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 Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. require File.expand_path(File.dirname(__FILE__) + '/../../qti_helper') if Qti.migration_executable describe "Converting D2L QTI" do before do @opts = { :flavor => Qti::Flavors::D2L } end it "should convert multiple choice" do expect(get_question_hash(d2l_question_dir, 'multiple_choice', true, @opts)).to eq D2LExpected::MULTIPLE_CHOICE end it "should convert true false" do expect(get_question_hash(d2l_question_dir, 'true_false', true, @opts)).to eq D2LExpected::TRUE_FALSE end it "should convert short answer" do expect(get_question_hash(d2l_question_dir, 'short_answer', true, @opts)).to eq D2LExpected::SHORT_ANSWER end it "should convert multi select" do expect(get_question_hash(d2l_question_dir, 'multi_select', true, @opts)).to eq D2LExpected::MULTI_SELECT end it "should convert multiple short" do expect(get_question_hash(d2l_question_dir, 'multiple_short', true, @opts)).to eq D2LExpected::MULTIPLE_SHORT end it "should convert fill in the blank with multiple blanks" do expect(get_question_hash(d2l_question_dir, 'fib', true, @opts)).to eq D2LExpected::FIB end it "should convert matching" do #pp get_question_hash(d2l_question_dir, 'matching', false) hash = get_question_hash(d2l_question_dir, 'matching', false, @opts) matches = {} hash[:matches].each {|m| matches[m[:match_id]] = m[:text]} hash[:answers].each do |a| expect(matches[a[:match_id]]).to eq a[:right] end # compare everything else without the ids hash[:answers].each {|a|a.delete(:id); a.delete(:match_id)} hash[:matches].each {|m|m.delete(:match_id)} expect(hash).to eq D2LExpected::MATCHING end it "should flag ordering question as an error" do expect(get_question_hash(d2l_question_dir, 'ordering', true, @opts)).to eq D2LExpected::ORDERING end it "should convert math question" do expect(get_question_hash(d2l_question_dir, 'math', true, @opts)).to eq D2LExpected::MATH end it "should convert a simple math question to a numeric question" do expect(get_question_hash(d2l_question_dir, 'simple_math', true, @opts)).to eq D2LExpected::SIMPLE_MATH end it "should convert long answer" do expect(get_question_hash(d2l_question_dir, 'long_answer', true, @opts)).to eq D2LExpected::LONG_ANSWER end it "should convert an item with a response condition with no condition" do expect(get_question_hash(d2l_question_dir, 'no_condition', true, @opts)).to eq D2LExpected::NO_CONDITION end it "should convert the assessment into a quiz" do allow_any_instance_of(Qti::AssessmentTestConverter).to receive(:unique_local_id).and_return("random") expect(get_quiz_data(d2l_question_dir, 'assessment', @opts).last.first).to eq D2LExpected::ASSESSMENT end it "should convert the assessment references into a quiz" do expect(get_quiz_data(d2l_question_dir, 'assessment_references', @opts).last.first).to eq D2LExpected::ASSESSMENT_REFS end it "should convert text only questions" do expect(get_quiz_data(d2l_question_dir, 'text_only', @opts).first).to eq D2LExpected::TEXT_ONLY end end module D2LExpected MULTIPLE_CHOICE = { :incorrect_comments=>"", :question_bank_name=>"02gilback", :answers=> [ {:weight=>100, :text=>"alpha", :migration_id=>"QUES_516156_630296_A2899442", :comments=>""}, {:weight=>0, :text=>"beta", :migration_id=>"QUES_516156_630296_A2899443", :comments=>""}, {:weight=>0, :text=>"gamma", :migration_id=>"QUES_516156_630296_A2899444"}, {:weight=>0, :text=>"omega", :migration_id=>"QUES_516156_630296_A2899445"} ], :question_bank_id=>"SECT_3981973", :points_possible=>1, :migration_id=>"QUES_516156_630296", :question_text=>"The first letter of the Greek alphabet is?", :question_name=>"", :correct_comments=>"", :question_type=>"multiple_choice_question" } TRUE_FALSE = {:question_type=>"true_false_question", :incorrect_comments=>"", :points_possible=>5.0, :answers=> [{:text=>"True", :weight=>100, :migration_id=>"QUES_968903_1181388_A4710345", :comments=>"True is correct"}, {:text=>"False", :weight=>0, :migration_id=>"QUES_968903_1181388_A4710346", :comments=>"False is not correct", :comments_html=>"False is <strong>not</strong> correct"}], :question_text=> "<p>Is this <strong>true</strong> or false?</p><img src=\"quizzing/bunny_consumer.png\" alt=\"\">", :question_name=>"true false questions", :migration_id=>"QUES_968903_1181388", :neutral_comments => "False is not correct", :neutral_comments_html => "False is <strong>not</strong> correct", :correct_comments=>""} ASSESSMENT = {:migration_id=>"res_quiz_90521", :question_count=>2, :title=>"01 Early Bird Storybook Week 2", :quiz_name=>"01 Early Bird Storybook Week 2", :quiz_type=>nil, :questions=>[ {:migration_id=>"random", :question_text=>"<p>introduction</p>", :question_type=>"text_only_question"}, {:migration_id=>"QUES_443669_562987", :question_type=>"question_reference"}, {:migration_id=>"QUES_443669_123456", :question_type=>"question_reference"}], :time_limit => 15, :allowed_attempts=>-1, :assignment_migration_id=>'435646', :description => "<p>description</p>" } ASSESSMENT_REFS = {:title=>"Quiz 2", :allowed_attempts=>3, :quiz_name=>"Quiz 2", :migration_id=>"res_quiz_39018", :quiz_type=>nil, :questions=> [{:points_possible=>1, :migration_id=>"QUES_516156_630296", :question_type=>"question_reference"}, {:points_possible=>1, :migration_id=>"QUES_516157_630297", :question_type=>"question_reference"}, {:points_possible=>1, :migration_id=>"QUES_516158_630298", :question_type=>"question_reference"}], :question_count=>3, :time_limit=>15, :access_code=>"insecure", :assignment_migration_id=>'164842'} LONG_ANSWER = {:question_bank_name=>"02gilback", :points_possible=>5.0, :answers=>[], :question_text=>"Write an essay on writing essays", :question_name=>"", :migration_id=>"QUES_516158_630298", :correct_comments=>"", :question_type=>"essay_question", :incorrect_comments=>"", :question_bank_id=>"SECT_3981973"} SHORT_ANSWER = {:question_type=>"short_answer_question", :incorrect_comments=>"", :question_bank_id=>"SECT_3981973", :question_bank_name=>"02gilback", :points_possible=>1, :answers=>[{:weight=>100, :text=>"Nydam", :comments=>""}], :question_text=>"Who is winning the Tour of California today?", :question_name=>"", :migration_id=>"QUES_522317_638596", :correct_comments=>""} MULTI_SELECT = {:correct_comments=>"", :neutral_comments => "a", :question_type=>"multiple_answers_question", :incorrect_comments=>"", :question_bank_id=>"SECT_3981973", :question_bank_name=>"02gilback", :points_possible=>1, :answers=> [{:text=>"1", :weight=>0, :migration_id=>"QUES_968905_1181391_A4710353"}, {:text=>"2", :weight=>100, :migration_id=>"QUES_968905_1181391_A4710354"}, {:text=>"3", :weight=>0, :migration_id=>"QUES_968905_1181391_A4710355"}, {:text=>"4", :weight=>100, :migration_id=>"QUES_968905_1181391_A4710356"}], :question_text=>"<p>how about the even numbers?</p>", :question_name=>"multi select", :migration_id=>"QUES_968905_1181391"} MULTIPLE_SHORT = {:question_name=>"multiple short answer", :migration_id=>"QUES_968910_1181396", :correct_comments=>"", :question_type=>"short_answer_question", :incorrect_comments=>"", :question_bank_id=>"SECT_3981973", :question_bank_name=>"02gilback", :points_possible=>6.2, :answers=> [{:comments=>"", :text=>"answer 1", :weight=>100}, {:comments=>"", :text=>"answer 2", :weight=>100}, {:comments=>"", :text=>"answer 3", :weight=>100}], :question_text=>"<p>What is a multiple short answer?</p>"} MATCHING = {:question_text=>"<p>letter to number</p>", :question_name=>"matching", :migration_id=>"QUES_968912_1181398", :matches=> [{:html=>"<strong>1</strong>", :text=>'1'}, {:html=>"<span style=\"text-decoration: underline;\">2</span>", :text=>'2'}], :correct_comments=>"", :question_type=>"matching_question", :incorrect_comments=>"", :question_bank_id=>"SECT_3981973", :question_bank_name=>"02gilback", :points_possible=>5.0, :answers=> [{:right=>"1", :html=>"<em><strong>A</strong></em>", :left_html=>"<em><strong>A</strong></em>", :comments=>"", :text=>"A", :left=>"A"}, {:right=>"2", :comments=>"", :text=>"b", :left=>"b"}]} ORDERING = {:question_bank_id=>"SECT_3981973", :answers=>[], :incorrect_comments=>"", :qti_error=>"There was an error exporting an assessment question - No question type used when trying to parse a qti question", :points_possible=>1, :question_bank_name=>"02gilback", :question_text=>"<p>the alphabet, heard of it?</p>", :question_name=>"ordering question", :migration_id=>"QUES_968913_1181399", :correct_comments=>"", :question_type=>"Error"} MATH = {:answers=>[], :answer_tolerance => "2", :formula_decimal_places => 2, :question_type=>"calculated_question", :formulas=>[{:formula => "2 * x y - z"}], :question_bank_id=>"SECT_3981973", :incorrect_comments=>"", :imported_formula=>"2 * x y - z", :points_possible=>3.0, :question_bank_name=>"02gilback", :question_text=>"<p>Solve the formula:</p>", :question_name=>"multi variable math", :migration_id=>"QUES_979792_1194510", :variables=> [{:scale=>3, :min=>10, :max=>15, :name=>"x"}, {:scale=>1, :min=>0.1, :max=>0.9, :name=>"y"}, {:scale=>0, :min=>100, :max=>150, :name=>"z"}], :correct_comments=>""} SIMPLE_MATH = { :question_type=>"numerical_question", :question_bank_id=>"SECT_3981973", :incorrect_comments=>"", :points_possible=>3.0, :question_bank_name=>"02gilback", :question_text=>"whats 1 plus 1", :question_name=>"single variable math", :migration_id=>"QUES_979792_1194510", :answers=> [{:weight=>100, :text=>"answer_text", :numerical_answer_type=>"exact_answer", :exact=>10.0}], :correct_comments=>""} FIB = {:migration_id=>"QUES_979782_1194494", :answers=> [{:blank_id=>"QUES_979782_1194494_A4749142", :text=>"fill", :weight=>100}, {:blank_id=>"QUES_979782_1194494_A4749142", :text=>"guess", :weight=>100}, {:blank_id=>"QUES_979782_1194494_A4749144", :text=>"questions", :weight=>100}], :correct_comments=>"", :question_type=>"fill_in_multiple_blanks_question", :question_bank_id=>"SECT_3981973", :neutral_comments => "No feedback for you.", :incorrect_comments=>"", :points_possible=>1, :question_bank_name=>"02gilback", :question_text=> "This a weird way to do [QUES_979782_1194494_A4749142] in the blank [QUES_979782_1194494_A4749144] ", :question_name=>""} NO_CONDITION = {:question_name => "", :migration_id => "QUES_969100_1181698", :answers => [{:text => "Avoid pseudo-forgetting", :migration_id => "QUES_969100_1181698_A4711381", :weight => 100}, {:text => "Limit what you learn", :migration_id => "QUES_969100_1181698_A4711382", :weight => 100}, {:text => "Arrive at meaningful patterns", :migration_id => "QUES_969100_1181698_A4711383", :weight => 100}, {:text => "Study in long periods", :migration_id => "QUES_969100_1181698_A4711384", :weight => 0}, {:text => "Use positive self-talk", :migration_id => "QUES_969100_1181698_A4711385", :weight => 100}], :correct_comments => "", :question_type => "multiple_answers_question", :question_bank_id => "SECT_3981973", :incorrect_comments => "", :points_possible => 2.5, :question_bank_name => "02gilback", :question_text => "<p>According to the class handout Basic Principles to Enhance Memory which of the following are effective ways to remember?</p>"} TEXT_ONLY = [{:answers => [], :correct_comments => "", :incorrect_comments => "", :points_possible => 5.0, :question_text => "<p>Is this <strong>true</strong> or false?</p>", :question_name => "text only q 1", :migration_id => "QUES_968903_1181388", :question_type => "text_only_question"}, {:answers => [], :correct_comments => "", :incorrect_comments => "", :points_possible => 5.0, :question_text => "<img src=\"quizzing/bunny_consumer.png\" alt=\"\">", :question_name => "text only q 2", :migration_id => "QUES_968903_1181388b", :question_type => "text_only_question"}] end end
djbender/canvas-lms
gems/plugins/qti_exporter/spec_canvas/lib/qti/d2l_questions_spec.rb
Ruby
agpl-3.0
16,910
[ 30522, 1001, 1001, 9385, 1006, 1039, 1007, 2249, 1011, 2556, 16021, 18300, 5397, 1010, 4297, 1012, 1001, 1001, 2023, 5371, 2003, 2112, 1997, 10683, 1012, 1001, 1001, 10683, 2003, 2489, 4007, 1024, 2017, 2064, 2417, 2923, 3089, 8569, 2618, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
'use strict'; require('require-dir')('./tasks');
Appchord/servicenow-build
gulpfile.js
JavaScript
mit
51
[ 30522, 1005, 2224, 9384, 1005, 1025, 5478, 1006, 1005, 5478, 1011, 16101, 1005, 1007, 1006, 1005, 1012, 1013, 8518, 1005, 1007, 1025, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# coding: utf-8 """ Copyright 2015 SmartBear Software 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. Ref: https://github.com/swagger-api/swagger-codegen """ from pprint import pformat from six import iteritems class Thermal100Temperature(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ def __init__(self): """ Thermal100Temperature - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition. """ self.swagger_types = { 'member_id': 'str', 'oem': 'ResourceOem', 'physical_context': 'PhysicalContext100PhysicalContext', 'related_item': 'list[Odata400IdRef]', 'related_itemodata_count': 'Odata400Count', 'related_itemodata_navigation_link': 'Odata400IdRef', 'status': 'ResourceStatus' } self.attribute_map = { 'member_id': 'MemberId', 'oem': 'Oem', 'physical_context': 'PhysicalContext', 'related_item': 'RelatedItem', 'related_itemodata_count': 'RelatedItem@odata.count', 'related_itemodata_navigation_link': 'RelatedItem@odata.navigationLink', 'status': 'Status' } self._member_id = None self._oem = None self._physical_context = None self._related_item = None self._related_itemodata_count = None self._related_itemodata_navigation_link = None self._status = None @property def member_id(self): """ Gets the member_id of this Thermal100Temperature. This is the identifier for the member within the collection. :return: The member_id of this Thermal100Temperature. :rtype: str """ return self._member_id @member_id.setter def member_id(self, member_id): """ Sets the member_id of this Thermal100Temperature. This is the identifier for the member within the collection. :param member_id: The member_id of this Thermal100Temperature. :type: str """ self._member_id = member_id @property def oem(self): """ Gets the oem of this Thermal100Temperature. This is the manufacturer/provider specific extension moniker used to divide the Oem object into sections. :return: The oem of this Thermal100Temperature. :rtype: ResourceOem """ return self._oem @oem.setter def oem(self, oem): """ Sets the oem of this Thermal100Temperature. This is the manufacturer/provider specific extension moniker used to divide the Oem object into sections. :param oem: The oem of this Thermal100Temperature. :type: ResourceOem """ self._oem = oem @property def physical_context(self): """ Gets the physical_context of this Thermal100Temperature. Describes the area or device to which this temperature measurement applies. :return: The physical_context of this Thermal100Temperature. :rtype: PhysicalContext100PhysicalContext """ return self._physical_context @physical_context.setter def physical_context(self, physical_context): """ Sets the physical_context of this Thermal100Temperature. Describes the area or device to which this temperature measurement applies. :param physical_context: The physical_context of this Thermal100Temperature. :type: PhysicalContext100PhysicalContext """ self._physical_context = physical_context @property def related_item(self): """ Gets the related_item of this Thermal100Temperature. Describes the areas or devices to which this temperature measurement applies. :return: The related_item of this Thermal100Temperature. :rtype: list[Odata400IdRef] """ return self._related_item @related_item.setter def related_item(self, related_item): """ Sets the related_item of this Thermal100Temperature. Describes the areas or devices to which this temperature measurement applies. :param related_item: The related_item of this Thermal100Temperature. :type: list[Odata400IdRef] """ self._related_item = related_item @property def related_itemodata_count(self): """ Gets the related_itemodata_count of this Thermal100Temperature. :return: The related_itemodata_count of this Thermal100Temperature. :rtype: Odata400Count """ return self._related_itemodata_count @related_itemodata_count.setter def related_itemodata_count(self, related_itemodata_count): """ Sets the related_itemodata_count of this Thermal100Temperature. :param related_itemodata_count: The related_itemodata_count of this Thermal100Temperature. :type: Odata400Count """ self._related_itemodata_count = related_itemodata_count @property def related_itemodata_navigation_link(self): """ Gets the related_itemodata_navigation_link of this Thermal100Temperature. :return: The related_itemodata_navigation_link of this Thermal100Temperature. :rtype: Odata400IdRef """ return self._related_itemodata_navigation_link @related_itemodata_navigation_link.setter def related_itemodata_navigation_link(self, related_itemodata_navigation_link): """ Sets the related_itemodata_navigation_link of this Thermal100Temperature. :param related_itemodata_navigation_link: The related_itemodata_navigation_link of this Thermal100Temperature. :type: Odata400IdRef """ self._related_itemodata_navigation_link = related_itemodata_navigation_link @property def status(self): """ Gets the status of this Thermal100Temperature. :return: The status of this Thermal100Temperature. :rtype: ResourceStatus """ return self._status @status.setter def status(self, status): """ Sets the status of this Thermal100Temperature. :param status: The status of this Thermal100Temperature. :type: ResourceStatus """ self._status = status def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
jlongever/redfish-client-python
on_http_redfish_1_0/models/thermal_1_0_0_temperature.py
Python
apache-2.0
8,295
[ 30522, 1001, 16861, 1024, 21183, 2546, 1011, 1022, 1000, 1000, 1000, 9385, 2325, 6047, 4783, 2906, 4007, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 2017, 2089, 2025, 2224, 2023, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * NETJet mISDN driver * * Author Karsten Keil <keil@isdn4linux.de> * * Copyright 2009 by Karsten Keil <keil@isdn4linux.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include <linux/interrupt.h> #include <linux/module.h> #include <linux/pci.h> #include <linux/delay.h> #include <linux/mISDNhw.h> #include <linux/slab.h> #include "ipac.h" #include "iohelper.h" #include "netjet.h" #include <linux/isdn/hdlc.h> #define NETJET_REV "2.0" enum nj_types { NETJET_S_TJ300, NETJET_S_TJ320, ENTERNOW__TJ320, }; struct tiger_dma { size_t size; u32 *start; int idx; u32 dmastart; u32 dmairq; u32 dmaend; u32 dmacur; }; struct tiger_hw; struct tiger_ch { struct bchannel bch; struct tiger_hw *nj; int idx; int free; int lastrx; u16 rxstate; u16 txstate; struct isdnhdlc_vars hsend; struct isdnhdlc_vars hrecv; u8 *hsbuf; u8 *hrbuf; }; #define TX_INIT 0x0001 #define TX_IDLE 0x0002 #define TX_RUN 0x0004 #define TX_UNDERRUN 0x0100 #define RX_OVERRUN 0x0100 #define LOG_SIZE 64 struct tiger_hw { struct list_head list; struct pci_dev *pdev; char name[MISDN_MAX_IDLEN]; enum nj_types typ; int irq; u32 irqcnt; u32 base; size_t base_s; dma_addr_t dma; void *dma_p; spinlock_t lock; /* lock HW */ struct isac_hw isac; struct tiger_dma send; struct tiger_dma recv; struct tiger_ch bc[2]; u8 ctrlreg; u8 dmactrl; u8 auxd; u8 last_is0; u8 irqmask0; char log[LOG_SIZE]; }; static LIST_HEAD(Cards); static DEFINE_RWLOCK(card_lock); /* protect Cards */ static u32 debug; static int nj_cnt; static void _set_debug(struct tiger_hw *card) { card->isac.dch.debug = debug; card->bc[0].bch.debug = debug; card->bc[1].bch.debug = debug; } static int set_debug(const char *val, struct kernel_param *kp) { int ret; struct tiger_hw *card; ret = param_set_uint(val, kp); if (!ret) { read_lock(&card_lock); list_for_each_entry(card, &Cards, list) _set_debug(card); read_unlock(&card_lock); } return ret; } MODULE_AUTHOR("Karsten Keil"); MODULE_LICENSE("GPL v2"); MODULE_VERSION(NETJET_REV); module_param_call(debug, set_debug, param_get_uint, &debug, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "Netjet debug mask"); static void nj_disable_hwirq(struct tiger_hw *card) { outb(0, card->base + NJ_IRQMASK0); outb(0, card->base + NJ_IRQMASK1); } static u8 ReadISAC_nj(void *p, u8 offset) { struct tiger_hw *card = p; u8 ret; card->auxd &= 0xfc; card->auxd |= (offset >> 4) & 3; outb(card->auxd, card->base + NJ_AUXDATA); ret = inb(card->base + NJ_ISAC_OFF + ((offset & 0x0f) << 2)); return ret; } static void WriteISAC_nj(void *p, u8 offset, u8 value) { struct tiger_hw *card = p; card->auxd &= 0xfc; card->auxd |= (offset >> 4) & 3; outb(card->auxd, card->base + NJ_AUXDATA); outb(value, card->base + NJ_ISAC_OFF + ((offset & 0x0f) << 2)); } static void ReadFiFoISAC_nj(void *p, u8 offset, u8 *data, int size) { struct tiger_hw *card = p; card->auxd &= 0xfc; outb(card->auxd, card->base + NJ_AUXDATA); insb(card->base + NJ_ISAC_OFF, data, size); } static void WriteFiFoISAC_nj(void *p, u8 offset, u8 *data, int size) { struct tiger_hw *card = p; card->auxd &= 0xfc; outb(card->auxd, card->base + NJ_AUXDATA); outsb(card->base + NJ_ISAC_OFF, data, size); } static void fill_mem(struct tiger_ch *bc, u32 idx, u32 cnt, u32 fill) { struct tiger_hw *card = bc->bch.hw; u32 mask = 0xff, val; pr_debug("%s: B%1d fill %02x len %d idx %d/%d\n", card->name, bc->bch.nr, fill, cnt, idx, card->send.idx); if (bc->bch.nr & 2) { fill <<= 8; mask <<= 8; } mask ^= 0xffffffff; while (cnt--) { val = card->send.start[idx]; val &= mask; val |= fill; card->send.start[idx++] = val; if (idx >= card->send.size) idx = 0; } } static int mode_tiger(struct tiger_ch *bc, u32 protocol) { struct tiger_hw *card = bc->bch.hw; pr_debug("%s: B%1d protocol %x-->%x\n", card->name, bc->bch.nr, bc->bch.state, protocol); switch (protocol) { case ISDN_P_NONE: if (bc->bch.state == ISDN_P_NONE) break; fill_mem(bc, 0, card->send.size, 0xff); bc->bch.state = protocol; /* only stop dma and interrupts if both channels NULL */ if ((card->bc[0].bch.state == ISDN_P_NONE) && (card->bc[1].bch.state == ISDN_P_NONE)) { card->dmactrl = 0; outb(card->dmactrl, card->base + NJ_DMACTRL); outb(0, card->base + NJ_IRQMASK0); } test_and_clear_bit(FLG_HDLC, &bc->bch.Flags); test_and_clear_bit(FLG_TRANSPARENT, &bc->bch.Flags); bc->txstate = 0; bc->rxstate = 0; bc->lastrx = -1; break; case ISDN_P_B_RAW: test_and_set_bit(FLG_TRANSPARENT, &bc->bch.Flags); bc->bch.state = protocol; bc->idx = 0; bc->free = card->send.size / 2; bc->rxstate = 0; bc->txstate = TX_INIT | TX_IDLE; bc->lastrx = -1; if (!card->dmactrl) { card->dmactrl = 1; outb(card->dmactrl, card->base + NJ_DMACTRL); outb(0x0f, card->base + NJ_IRQMASK0); } break; case ISDN_P_B_HDLC: test_and_set_bit(FLG_HDLC, &bc->bch.Flags); bc->bch.state = protocol; bc->idx = 0; bc->free = card->send.size / 2; bc->rxstate = 0; bc->txstate = TX_INIT | TX_IDLE; isdnhdlc_rcv_init(&bc->hrecv, 0); isdnhdlc_out_init(&bc->hsend, 0); bc->lastrx = -1; if (!card->dmactrl) { card->dmactrl = 1; outb(card->dmactrl, card->base + NJ_DMACTRL); outb(0x0f, card->base + NJ_IRQMASK0); } break; default: pr_info("%s: %s protocol %x not handled\n", card->name, __func__, protocol); return -ENOPROTOOPT; } card->send.dmacur = inl(card->base + NJ_DMA_READ_ADR); card->recv.dmacur = inl(card->base + NJ_DMA_WRITE_ADR); card->send.idx = (card->send.dmacur - card->send.dmastart) >> 2; card->recv.idx = (card->recv.dmacur - card->recv.dmastart) >> 2; pr_debug("%s: %s ctrl %x irq %02x/%02x idx %d/%d\n", card->name, __func__, inb(card->base + NJ_DMACTRL), inb(card->base + NJ_IRQMASK0), inb(card->base + NJ_IRQSTAT0), card->send.idx, card->recv.idx); return 0; } static void nj_reset(struct tiger_hw *card) { outb(0xff, card->base + NJ_CTRL); /* Reset On */ mdelay(1); /* now edge triggered for TJ320 GE 13/07/00 */ /* see comment in IRQ function */ if (card->typ == NETJET_S_TJ320) /* TJ320 */ card->ctrlreg = 0x40; /* Reset Off and status read clear */ else card->ctrlreg = 0x00; /* Reset Off and status read clear */ outb(card->ctrlreg, card->base + NJ_CTRL); mdelay(10); /* configure AUX pins (all output except ISAC IRQ pin) */ card->auxd = 0; card->dmactrl = 0; outb(~NJ_ISACIRQ, card->base + NJ_AUXCTRL); outb(NJ_ISACIRQ, card->base + NJ_IRQMASK1); outb(card->auxd, card->base + NJ_AUXDATA); } static int inittiger(struct tiger_hw *card) { int i; card->dma_p = pci_alloc_consistent(card->pdev, NJ_DMA_SIZE, &card->dma); if (!card->dma_p) { pr_info("%s: No DMA memory\n", card->name); return -ENOMEM; } if ((u64)card->dma > 0xffffffff) { pr_info("%s: DMA outside 32 bit\n", card->name); return -ENOMEM; } for (i = 0; i < 2; i++) { card->bc[i].hsbuf = kmalloc(NJ_DMA_TXSIZE, GFP_ATOMIC); if (!card->bc[i].hsbuf) { pr_info("%s: no B%d send buffer\n", card->name, i + 1); return -ENOMEM; } card->bc[i].hrbuf = kmalloc(NJ_DMA_RXSIZE, GFP_ATOMIC); if (!card->bc[i].hrbuf) { pr_info("%s: no B%d recv buffer\n", card->name, i + 1); return -ENOMEM; } } memset(card->dma_p, 0xff, NJ_DMA_SIZE); card->send.start = card->dma_p; card->send.dmastart = (u32)card->dma; card->send.dmaend = card->send.dmastart + (4 * (NJ_DMA_TXSIZE - 1)); card->send.dmairq = card->send.dmastart + (4 * ((NJ_DMA_TXSIZE / 2) - 1)); card->send.size = NJ_DMA_TXSIZE; if (debug & DEBUG_HW) pr_notice("%s: send buffer phy %#x - %#x - %#x virt %p" " size %zu u32\n", card->name, card->send.dmastart, card->send.dmairq, card->send.dmaend, card->send.start, card->send.size); outl(card->send.dmastart, card->base + NJ_DMA_READ_START); outl(card->send.dmairq, card->base + NJ_DMA_READ_IRQ); outl(card->send.dmaend, card->base + NJ_DMA_READ_END); card->recv.start = card->dma_p + (NJ_DMA_SIZE / 2); card->recv.dmastart = (u32)card->dma + (NJ_DMA_SIZE / 2); card->recv.dmaend = card->recv.dmastart + (4 * (NJ_DMA_RXSIZE - 1)); card->recv.dmairq = card->recv.dmastart + (4 * ((NJ_DMA_RXSIZE / 2) - 1)); card->recv.size = NJ_DMA_RXSIZE; if (debug & DEBUG_HW) pr_notice("%s: recv buffer phy %#x - %#x - %#x virt %p" " size %zu u32\n", card->name, card->recv.dmastart, card->recv.dmairq, card->recv.dmaend, card->recv.start, card->recv.size); outl(card->recv.dmastart, card->base + NJ_DMA_WRITE_START); outl(card->recv.dmairq, card->base + NJ_DMA_WRITE_IRQ); outl(card->recv.dmaend, card->base + NJ_DMA_WRITE_END); return 0; } static void read_dma(struct tiger_ch *bc, u32 idx, int cnt) { struct tiger_hw *card = bc->bch.hw; int i, stat; u32 val; u8 *p, *pn; if (bc->lastrx == idx) { bc->rxstate |= RX_OVERRUN; pr_info("%s: B%1d overrun at idx %d\n", card->name, bc->bch.nr, idx); } bc->lastrx = idx; if (test_bit(FLG_RX_OFF, &bc->bch.Flags)) { bc->bch.dropcnt += cnt; return; } stat = bchannel_get_rxbuf(&bc->bch, cnt); /* only transparent use the count here, HDLC overun is detected later */ if (stat == ENOMEM) { pr_warning("%s.B%d: No memory for %d bytes\n", card->name, bc->bch.nr, cnt); return; } if (test_bit(FLG_TRANSPARENT, &bc->bch.Flags)) p = skb_put(bc->bch.rx_skb, cnt); else p = bc->hrbuf; for (i = 0; i < cnt; i++) { val = card->recv.start[idx++]; if (bc->bch.nr & 2) val >>= 8; if (idx >= card->recv.size) idx = 0; p[i] = val & 0xff; } if (test_bit(FLG_TRANSPARENT, &bc->bch.Flags)) { recv_Bchannel(&bc->bch, 0, false); return; } pn = bc->hrbuf; while (cnt > 0) { stat = isdnhdlc_decode(&bc->hrecv, pn, cnt, &i, bc->bch.rx_skb->data, bc->bch.maxlen); if (stat > 0) { /* valid frame received */ p = skb_put(bc->bch.rx_skb, stat); if (debug & DEBUG_HW_BFIFO) { snprintf(card->log, LOG_SIZE, "B%1d-recv %s %d ", bc->bch.nr, card->name, stat); print_hex_dump_bytes(card->log, DUMP_PREFIX_OFFSET, p, stat); } recv_Bchannel(&bc->bch, 0, false); stat = bchannel_get_rxbuf(&bc->bch, bc->bch.maxlen); if (stat < 0) { pr_warning("%s.B%d: No memory for %d bytes\n", card->name, bc->bch.nr, cnt); return; } } else if (stat == -HDLC_CRC_ERROR) { pr_info("%s: B%1d receive frame CRC error\n", card->name, bc->bch.nr); } else if (stat == -HDLC_FRAMING_ERROR) { pr_info("%s: B%1d receive framing error\n", card->name, bc->bch.nr); } else if (stat == -HDLC_LENGTH_ERROR) { pr_info("%s: B%1d receive frame too long (> %d)\n", card->name, bc->bch.nr, bc->bch.maxlen); } pn += i; cnt -= i; } } static void recv_tiger(struct tiger_hw *card, u8 irq_stat) { u32 idx; int cnt = card->recv.size / 2; /* Note receive is via the WRITE DMA channel */ card->last_is0 &= ~NJ_IRQM0_WR_MASK; card->last_is0 |= (irq_stat & NJ_IRQM0_WR_MASK); if (irq_stat & NJ_IRQM0_WR_END) idx = cnt - 1; else idx = card->recv.size - 1; if (test_bit(FLG_ACTIVE, &card->bc[0].bch.Flags)) read_dma(&card->bc[0], idx, cnt); if (test_bit(FLG_ACTIVE, &card->bc[1].bch.Flags)) read_dma(&card->bc[1], idx, cnt); } /* sync with current DMA address at start or after exception */ static void resync(struct tiger_ch *bc, struct tiger_hw *card) { card->send.dmacur = inl(card->base | NJ_DMA_READ_ADR); card->send.idx = (card->send.dmacur - card->send.dmastart) >> 2; if (bc->free > card->send.size / 2) bc->free = card->send.size / 2; /* currently we simple sync to the next complete free area * this hast the advantage that we have always maximum time to * handle TX irq */ if (card->send.idx < ((card->send.size / 2) - 1)) bc->idx = (card->recv.size / 2) - 1; else bc->idx = card->recv.size - 1; bc->txstate = TX_RUN; pr_debug("%s: %s B%1d free %d idx %d/%d\n", card->name, __func__, bc->bch.nr, bc->free, bc->idx, card->send.idx); } static int bc_next_frame(struct tiger_ch *); static void fill_hdlc_flag(struct tiger_ch *bc) { struct tiger_hw *card = bc->bch.hw; int count, i; u32 m, v; u8 *p; if (bc->free == 0) return; pr_debug("%s: %s B%1d %d state %x idx %d/%d\n", card->name, __func__, bc->bch.nr, bc->free, bc->txstate, bc->idx, card->send.idx); if (bc->txstate & (TX_IDLE | TX_INIT | TX_UNDERRUN)) resync(bc, card); count = isdnhdlc_encode(&bc->hsend, NULL, 0, &i, bc->hsbuf, bc->free); pr_debug("%s: B%1d hdlc encoded %d flags\n", card->name, bc->bch.nr, count); bc->free -= count; p = bc->hsbuf; m = (bc->bch.nr & 1) ? 0xffffff00 : 0xffff00ff; for (i = 0; i < count; i++) { if (bc->idx >= card->send.size) bc->idx = 0; v = card->send.start[bc->idx]; v &= m; v |= (bc->bch.nr & 1) ? (u32)(p[i]) : ((u32)(p[i])) << 8; card->send.start[bc->idx++] = v; } if (debug & DEBUG_HW_BFIFO) { snprintf(card->log, LOG_SIZE, "B%1d-send %s %d ", bc->bch.nr, card->name, count); print_hex_dump_bytes(card->log, DUMP_PREFIX_OFFSET, p, count); } } static void fill_dma(struct tiger_ch *bc) { struct tiger_hw *card = bc->bch.hw; int count, i, fillempty = 0; u32 m, v, n = 0; u8 *p; if (bc->free == 0) return; if (!bc->bch.tx_skb) { if (!test_bit(FLG_TX_EMPTY, &bc->bch.Flags)) return; fillempty = 1; count = card->send.size >> 1; p = bc->bch.fill; } else { count = bc->bch.tx_skb->len - bc->bch.tx_idx; if (count <= 0) return; pr_debug("%s: %s B%1d %d/%d/%d/%d state %x idx %d/%d\n", card->name, __func__, bc->bch.nr, count, bc->free, bc->bch.tx_idx, bc->bch.tx_skb->len, bc->txstate, bc->idx, card->send.idx); p = bc->bch.tx_skb->data + bc->bch.tx_idx; } if (bc->txstate & (TX_IDLE | TX_INIT | TX_UNDERRUN)) resync(bc, card); if (test_bit(FLG_HDLC, &bc->bch.Flags) && !fillempty) { count = isdnhdlc_encode(&bc->hsend, p, count, &i, bc->hsbuf, bc->free); pr_debug("%s: B%1d hdlc encoded %d in %d\n", card->name, bc->bch.nr, i, count); bc->bch.tx_idx += i; bc->free -= count; p = bc->hsbuf; } else { if (count > bc->free) count = bc->free; if (!fillempty) bc->bch.tx_idx += count; bc->free -= count; } m = (bc->bch.nr & 1) ? 0xffffff00 : 0xffff00ff; if (fillempty) { n = p[0]; if (!(bc->bch.nr & 1)) n <<= 8; for (i = 0; i < count; i++) { if (bc->idx >= card->send.size) bc->idx = 0; v = card->send.start[bc->idx]; v &= m; v |= n; card->send.start[bc->idx++] = v; } } else { for (i = 0; i < count; i++) { if (bc->idx >= card->send.size) bc->idx = 0; v = card->send.start[bc->idx]; v &= m; n = p[i]; v |= (bc->bch.nr & 1) ? n : n << 8; card->send.start[bc->idx++] = v; } } if (debug & DEBUG_HW_BFIFO) { snprintf(card->log, LOG_SIZE, "B%1d-send %s %d ", bc->bch.nr, card->name, count); print_hex_dump_bytes(card->log, DUMP_PREFIX_OFFSET, p, count); } if (bc->free) bc_next_frame(bc); } static int bc_next_frame(struct tiger_ch *bc) { int ret = 1; if (bc->bch.tx_skb && bc->bch.tx_idx < bc->bch.tx_skb->len) { fill_dma(bc); } else { if (bc->bch.tx_skb) dev_kfree_skb(bc->bch.tx_skb); if (get_next_bframe(&bc->bch)) { fill_dma(bc); test_and_clear_bit(FLG_TX_EMPTY, &bc->bch.Flags); } else if (test_bit(FLG_TX_EMPTY, &bc->bch.Flags)) { fill_dma(bc); } else if (test_bit(FLG_FILLEMPTY, &bc->bch.Flags)) { test_and_set_bit(FLG_TX_EMPTY, &bc->bch.Flags); ret = 0; } else { ret = 0; } } return ret; } static void send_tiger_bc(struct tiger_hw *card, struct tiger_ch *bc) { int ret; bc->free += card->send.size / 2; if (bc->free >= card->send.size) { if (!(bc->txstate & (TX_UNDERRUN | TX_INIT))) { pr_info("%s: B%1d TX underrun state %x\n", card->name, bc->bch.nr, bc->txstate); bc->txstate |= TX_UNDERRUN; } bc->free = card->send.size; } ret = bc_next_frame(bc); if (!ret) { if (test_bit(FLG_HDLC, &bc->bch.Flags)) { fill_hdlc_flag(bc); return; } pr_debug("%s: B%1d TX no data free %d idx %d/%d\n", card->name, bc->bch.nr, bc->free, bc->idx, card->send.idx); if (!(bc->txstate & (TX_IDLE | TX_INIT))) { fill_mem(bc, bc->idx, bc->free, 0xff); if (bc->free == card->send.size) bc->txstate |= TX_IDLE; } } } static void send_tiger(struct tiger_hw *card, u8 irq_stat) { int i; /* Note send is via the READ DMA channel */ if ((irq_stat & card->last_is0) & NJ_IRQM0_RD_MASK) { pr_info("%s: tiger warn write double dma %x/%x\n", card->name, irq_stat, card->last_is0); return; } else { card->last_is0 &= ~NJ_IRQM0_RD_MASK; card->last_is0 |= (irq_stat & NJ_IRQM0_RD_MASK); } for (i = 0; i < 2; i++) { if (test_bit(FLG_ACTIVE, &card->bc[i].bch.Flags)) send_tiger_bc(card, &card->bc[i]); } } static irqreturn_t nj_irq(int intno, void *dev_id) { struct tiger_hw *card = dev_id; u8 val, s1val, s0val; spin_lock(&card->lock); s0val = inb(card->base | NJ_IRQSTAT0); s1val = inb(card->base | NJ_IRQSTAT1); if ((s1val & NJ_ISACIRQ) && (s0val == 0)) { /* shared IRQ */ spin_unlock(&card->lock); return IRQ_NONE; } pr_debug("%s: IRQSTAT0 %02x IRQSTAT1 %02x\n", card->name, s0val, s1val); card->irqcnt++; if (!(s1val & NJ_ISACIRQ)) { val = ReadISAC_nj(card, ISAC_ISTA); if (val) mISDNisac_irq(&card->isac, val); } if (s0val) /* write to clear */ outb(s0val, card->base | NJ_IRQSTAT0); else goto end; s1val = s0val; /* set bits in sval to indicate which page is free */ card->recv.dmacur = inl(card->base | NJ_DMA_WRITE_ADR); card->recv.idx = (card->recv.dmacur - card->recv.dmastart) >> 2; if (card->recv.dmacur < card->recv.dmairq) s0val = 0x08; /* the 2nd write area is free */ else s0val = 0x04; /* the 1st write area is free */ card->send.dmacur = inl(card->base | NJ_DMA_READ_ADR); card->send.idx = (card->send.dmacur - card->send.dmastart) >> 2; if (card->send.dmacur < card->send.dmairq) s0val |= 0x02; /* the 2nd read area is free */ else s0val |= 0x01; /* the 1st read area is free */ pr_debug("%s: DMA Status %02x/%02x/%02x %d/%d\n", card->name, s1val, s0val, card->last_is0, card->recv.idx, card->send.idx); /* test if we have a DMA interrupt */ if (s0val != card->last_is0) { if ((s0val & NJ_IRQM0_RD_MASK) != (card->last_is0 & NJ_IRQM0_RD_MASK)) /* got a write dma int */ send_tiger(card, s0val); if ((s0val & NJ_IRQM0_WR_MASK) != (card->last_is0 & NJ_IRQM0_WR_MASK)) /* got a read dma int */ recv_tiger(card, s0val); } end: spin_unlock(&card->lock); return IRQ_HANDLED; } static int nj_l2l1B(struct mISDNchannel *ch, struct sk_buff *skb) { int ret = -EINVAL; struct bchannel *bch = container_of(ch, struct bchannel, ch); struct tiger_ch *bc = container_of(bch, struct tiger_ch, bch); struct tiger_hw *card = bch->hw; struct mISDNhead *hh = mISDN_HEAD_P(skb); unsigned long flags; switch (hh->prim) { case PH_DATA_REQ: spin_lock_irqsave(&card->lock, flags); ret = bchannel_senddata(bch, skb); if (ret > 0) { /* direct TX */ fill_dma(bc); ret = 0; } spin_unlock_irqrestore(&card->lock, flags); return ret; case PH_ACTIVATE_REQ: spin_lock_irqsave(&card->lock, flags); if (!test_and_set_bit(FLG_ACTIVE, &bch->Flags)) ret = mode_tiger(bc, ch->protocol); else ret = 0; spin_unlock_irqrestore(&card->lock, flags); if (!ret) _queue_data(ch, PH_ACTIVATE_IND, MISDN_ID_ANY, 0, NULL, GFP_KERNEL); break; case PH_DEACTIVATE_REQ: spin_lock_irqsave(&card->lock, flags); mISDN_clear_bchannel(bch); mode_tiger(bc, ISDN_P_NONE); spin_unlock_irqrestore(&card->lock, flags); _queue_data(ch, PH_DEACTIVATE_IND, MISDN_ID_ANY, 0, NULL, GFP_KERNEL); ret = 0; break; } if (!ret) dev_kfree_skb(skb); return ret; } static int channel_bctrl(struct tiger_ch *bc, struct mISDN_ctrl_req *cq) { return mISDN_ctrl_bchannel(&bc->bch, cq); } static int nj_bctrl(struct mISDNchannel *ch, u32 cmd, void *arg) { struct bchannel *bch = container_of(ch, struct bchannel, ch); struct tiger_ch *bc = container_of(bch, struct tiger_ch, bch); struct tiger_hw *card = bch->hw; int ret = -EINVAL; u_long flags; pr_debug("%s: %s cmd:%x %p\n", card->name, __func__, cmd, arg); switch (cmd) { case CLOSE_CHANNEL: test_and_clear_bit(FLG_OPEN, &bch->Flags); cancel_work_sync(&bch->workq); spin_lock_irqsave(&card->lock, flags); mISDN_clear_bchannel(bch); mode_tiger(bc, ISDN_P_NONE); spin_unlock_irqrestore(&card->lock, flags); ch->protocol = ISDN_P_NONE; ch->peer = NULL; module_put(THIS_MODULE); ret = 0; break; case CONTROL_CHANNEL: ret = channel_bctrl(bc, arg); break; default: pr_info("%s: %s unknown prim(%x)\n", card->name, __func__, cmd); } return ret; } static int channel_ctrl(struct tiger_hw *card, struct mISDN_ctrl_req *cq) { int ret = 0; switch (cq->op) { case MISDN_CTRL_GETOP: cq->op = MISDN_CTRL_LOOP | MISDN_CTRL_L1_TIMER3; break; case MISDN_CTRL_LOOP: /* cq->channel: 0 disable, 1 B1 loop 2 B2 loop, 3 both */ if (cq->channel < 0 || cq->channel > 3) { ret = -EINVAL; break; } ret = card->isac.ctrl(&card->isac, HW_TESTLOOP, cq->channel); break; case MISDN_CTRL_L1_TIMER3: ret = card->isac.ctrl(&card->isac, HW_TIMER3_VALUE, cq->p1); break; default: pr_info("%s: %s unknown Op %x\n", card->name, __func__, cq->op); ret = -EINVAL; break; } return ret; } static int open_bchannel(struct tiger_hw *card, struct channel_req *rq) { struct bchannel *bch; if (rq->adr.channel == 0 || rq->adr.channel > 2) return -EINVAL; if (rq->protocol == ISDN_P_NONE) return -EINVAL; bch = &card->bc[rq->adr.channel - 1].bch; if (test_and_set_bit(FLG_OPEN, &bch->Flags)) return -EBUSY; /* b-channel can be only open once */ test_and_clear_bit(FLG_FILLEMPTY, &bch->Flags); bch->ch.protocol = rq->protocol; rq->ch = &bch->ch; return 0; } /* * device control function */ static int nj_dctrl(struct mISDNchannel *ch, u32 cmd, void *arg) { struct mISDNdevice *dev = container_of(ch, struct mISDNdevice, D); struct dchannel *dch = container_of(dev, struct dchannel, dev); struct tiger_hw *card = dch->hw; struct channel_req *rq; int err = 0; pr_debug("%s: %s cmd:%x %p\n", card->name, __func__, cmd, arg); switch (cmd) { case OPEN_CHANNEL: rq = arg; if (rq->protocol == ISDN_P_TE_S0) err = card->isac.open(&card->isac, rq); else err = open_bchannel(card, rq); if (err) break; if (!try_module_get(THIS_MODULE)) pr_info("%s: cannot get module\n", card->name); break; case CLOSE_CHANNEL: pr_debug("%s: dev(%d) close from %p\n", card->name, dch->dev.id, __builtin_return_address(0)); module_put(THIS_MODULE); break; case CONTROL_CHANNEL: err = channel_ctrl(card, arg); break; default: pr_debug("%s: %s unknown command %x\n", card->name, __func__, cmd); return -EINVAL; } return err; } static int nj_init_card(struct tiger_hw *card) { u_long flags; int ret; spin_lock_irqsave(&card->lock, flags); nj_disable_hwirq(card); spin_unlock_irqrestore(&card->lock, flags); card->irq = card->pdev->irq; if (request_irq(card->irq, nj_irq, IRQF_SHARED, card->name, card)) { pr_info("%s: couldn't get interrupt %d\n", card->name, card->irq); card->irq = -1; return -EIO; } spin_lock_irqsave(&card->lock, flags); nj_reset(card); ret = card->isac.init(&card->isac); if (ret) goto error; ret = inittiger(card); if (ret) goto error; mode_tiger(&card->bc[0], ISDN_P_NONE); mode_tiger(&card->bc[1], ISDN_P_NONE); error: spin_unlock_irqrestore(&card->lock, flags); return ret; } static void nj_release(struct tiger_hw *card) { u_long flags; int i; if (card->base_s) { spin_lock_irqsave(&card->lock, flags); nj_disable_hwirq(card); mode_tiger(&card->bc[0], ISDN_P_NONE); mode_tiger(&card->bc[1], ISDN_P_NONE); card->isac.release(&card->isac); spin_unlock_irqrestore(&card->lock, flags); release_region(card->base, card->base_s); card->base_s = 0; } if (card->irq > 0) free_irq(card->irq, card); if (card->isac.dch.dev.dev.class) mISDN_unregister_device(&card->isac.dch.dev); for (i = 0; i < 2; i++) { mISDN_freebchannel(&card->bc[i].bch); kfree(card->bc[i].hsbuf); kfree(card->bc[i].hrbuf); } if (card->dma_p) pci_free_consistent(card->pdev, NJ_DMA_SIZE, card->dma_p, card->dma); write_lock_irqsave(&card_lock, flags); list_del(&card->list); write_unlock_irqrestore(&card_lock, flags); pci_clear_master(card->pdev); pci_disable_device(card->pdev); pci_set_drvdata(card->pdev, NULL); kfree(card); } static int nj_setup(struct tiger_hw *card) { card->base = pci_resource_start(card->pdev, 0); card->base_s = pci_resource_len(card->pdev, 0); if (!request_region(card->base, card->base_s, card->name)) { pr_info("%s: NETjet config port %#x-%#x already in use\n", card->name, card->base, (u32)(card->base + card->base_s - 1)); card->base_s = 0; return -EIO; } ASSIGN_FUNC(nj, ISAC, card->isac); return 0; } static int setup_instance(struct tiger_hw *card) { int i, err; u_long flags; snprintf(card->name, MISDN_MAX_IDLEN - 1, "netjet.%d", nj_cnt + 1); write_lock_irqsave(&card_lock, flags); list_add_tail(&card->list, &Cards); write_unlock_irqrestore(&card_lock, flags); _set_debug(card); card->isac.name = card->name; spin_lock_init(&card->lock); card->isac.hwlock = &card->lock; mISDNisac_init(&card->isac, card); card->isac.dch.dev.Bprotocols = (1 << (ISDN_P_B_RAW & ISDN_P_B_MASK)) | (1 << (ISDN_P_B_HDLC & ISDN_P_B_MASK)); card->isac.dch.dev.D.ctrl = nj_dctrl; for (i = 0; i < 2; i++) { card->bc[i].bch.nr = i + 1; set_channelmap(i + 1, card->isac.dch.dev.channelmap); mISDN_initbchannel(&card->bc[i].bch, MAX_DATA_MEM, NJ_DMA_RXSIZE >> 1); card->bc[i].bch.hw = card; card->bc[i].bch.ch.send = nj_l2l1B; card->bc[i].bch.ch.ctrl = nj_bctrl; card->bc[i].bch.ch.nr = i + 1; list_add(&card->bc[i].bch.ch.list, &card->isac.dch.dev.bchannels); card->bc[i].bch.hw = card; } err = nj_setup(card); if (err) goto error; err = mISDN_register_device(&card->isac.dch.dev, &card->pdev->dev, card->name); if (err) goto error; err = nj_init_card(card); if (!err) { nj_cnt++; pr_notice("Netjet %d cards installed\n", nj_cnt); return 0; } error: nj_release(card); return err; } static int nj_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { int err = -ENOMEM; int cfg; struct tiger_hw *card; if (pdev->subsystem_vendor == 0x8086 && pdev->subsystem_device == 0x0003) { pr_notice("Netjet: Digium X100P/X101P not handled\n"); return -ENODEV; } if (pdev->subsystem_vendor == 0x55 && pdev->subsystem_device == 0x02) { pr_notice("Netjet: Enter!Now not handled yet\n"); return -ENODEV; } if (pdev->subsystem_vendor == 0xb100 && pdev->subsystem_device == 0x0003) { pr_notice("Netjet: Digium TDM400P not handled yet\n"); return -ENODEV; } card = kzalloc(sizeof(struct tiger_hw), GFP_ATOMIC); if (!card) { pr_info("No kmem for Netjet\n"); return err; } card->pdev = pdev; err = pci_enable_device(pdev); if (err) { kfree(card); return err; } printk(KERN_INFO "nj_probe(mISDN): found adapter at %s\n", pci_name(pdev)); pci_set_master(pdev); /* the TJ300 and TJ320 must be detected, the IRQ handling is different * unfortunately the chips use the same device ID, but the TJ320 has * the bit20 in status PCI cfg register set */ pci_read_config_dword(pdev, 0x04, &cfg); if (cfg & 0x00100000) card->typ = NETJET_S_TJ320; else card->typ = NETJET_S_TJ300; card->base = pci_resource_start(pdev, 0); card->irq = pdev->irq; pci_set_drvdata(pdev, card); err = setup_instance(card); if (err) pci_set_drvdata(pdev, NULL); return err; } static void nj_remove(struct pci_dev *pdev) { struct tiger_hw *card = pci_get_drvdata(pdev); if (card) nj_release(card); else pr_info("%s drvdata already removed\n", __func__); } /* We cannot select cards with PCI_SUB... IDs, since here are cards with * SUB IDs set to PCI_ANY_ID, so we need to match all and reject * known other cards which not work with this driver - see probe function */ static struct pci_device_id nj_pci_ids[] = { { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { } }; MODULE_DEVICE_TABLE(pci, nj_pci_ids); static struct pci_driver nj_driver = { .name = "netjet", .probe = nj_probe, .remove = nj_remove, .id_table = nj_pci_ids, }; static int __init nj_init(void) { int err; pr_notice("Netjet PCI driver Rev. %s\n", NETJET_REV); err = pci_register_driver(&nj_driver); return err; } static void __exit nj_cleanup(void) { pci_unregister_driver(&nj_driver); } module_init(nj_init); module_exit(nj_cleanup);
evolver56k/xpenology
drivers/isdn/hardware/mISDN/netjet.c
C
gpl-2.0
29,370
[ 30522, 1013, 1008, 1008, 5658, 15759, 28616, 2094, 2078, 4062, 1008, 1008, 3166, 10556, 19020, 26679, 2140, 1026, 26679, 2140, 1030, 2003, 2094, 2078, 2549, 4115, 5602, 1012, 2139, 1028, 1008, 1008, 9385, 2268, 2011, 10556, 19020, 26679, 21...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
import { baseUniDriverFactory } from '../../test/utils/unidriver'; export const boxDriverFactory = base => { return { ...baseUniDriverFactory(base), }; };
wix/wix-style-react
packages/wix-style-react/src/Box/Box.uni.driver.js
JavaScript
mit
164
[ 30522, 12324, 1063, 2918, 19496, 23663, 12881, 18908, 10253, 1065, 2013, 1005, 1012, 1012, 1013, 1012, 1012, 1013, 3231, 1013, 21183, 12146, 1013, 4895, 3593, 24352, 1005, 1025, 9167, 9530, 3367, 3482, 23663, 12881, 18908, 10253, 1027, 2918, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/*! * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2002-2017 Hitachi Vantara.. All rights reserved. */ package org.pentaho.agilebi.modeler.geo; import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * Created by IntelliJ IDEA. User: rfellows Date: 9/26/11 Time: 2:09 PM To change this template use File | Settings | * File Templates. */ public class LatLngRole extends GeoRole implements Serializable { private static final long serialVersionUID = 3443044732976689019L; private String prefix = ""; public LatLngRole() { super(); } public LatLngRole( String name, List<String> commonAliases ) { super( name, commonAliases ); } public LatLngRole( String name, String commonAliases ) { super( name, commonAliases ); } @Override protected boolean eval( String fieldName, String alias ) { if ( super.eval( fieldName, alias ) ) { return true; } else if ( fieldName.endsWith( getMatchSeparator() + alias ) ) { prefix = fieldName.substring( 0, fieldName.indexOf( getMatchSeparator() + alias ) ); return true; } return false; } public String getPrefix() { return prefix; } public LatLngRole clone() { List<String> clonedAliases = (ArrayList<String>) ( (ArrayList<String>) getCommonAliases() ).clone(); LatLngRole clone = new LatLngRole( getName(), clonedAliases ); clone.prefix = getPrefix(); return clone; } }
kurtwalker/modeler
core/src/main/java/org/pentaho/agilebi/modeler/geo/LatLngRole.java
Java
lgpl-2.1
2,170
[ 30522, 1013, 1008, 999, 1008, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, 2009, 1998, 1013, 2030, 19933, 2009, 2104, 1996, 1008, 3408, 1997, 1996, 27004, 8276, 2236, 2270, 6105, 1010, 2544, 1016, 1012, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php /** * The default template for displaying content * * Used for both single and index/archive/search. * * @package FoundationPress * @since FoundationPress 1.0.0 */ ?> <div id="post-<?php the_ID(); ?>" <?php post_class('blogpost-entry'); ?>> <header> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php foundationpress_entry_meta(); ?> </header> <div class="entry-content"> <?php the_content( __( 'Continue reading...', 'foundationpress' ) ); ?> </div> <footer> <?php $tag = get_the_tags(); if ( $tag ) { ?><p><?php the_tags(); ?></p><?php } ?> </footer> <hr /> </div>
fredlincoln/sprcorp
template-parts/content.php
PHP
mit
624
[ 30522, 1026, 1029, 25718, 1013, 1008, 1008, 1008, 1996, 12398, 23561, 2005, 14962, 4180, 1008, 1008, 2109, 2005, 2119, 2309, 1998, 5950, 1013, 8756, 1013, 3945, 1012, 1008, 1008, 1030, 7427, 3192, 20110, 1008, 1030, 2144, 3192, 20110, 1015,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {Type} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {PRIMARY_OUTLET, Params} from './shared'; import {UrlSegment, UrlSegmentGroup} from './url_tree'; /** * @whatItDoes Represents router configuration. * * @description * `Routes` is an array of route configurations. Each one has the following properties: * * - `path` is a string that uses the route matcher DSL. * - `pathMatch` is a string that specifies the matching strategy. * - `component` is a component type. * - `redirectTo` is the url fragment which will replace the current matched segment. * - `outlet` is the name of the outlet the component should be placed into. * - `canActivate` is an array of DI tokens used to look up CanActivate handlers. See {@link * CanActivate} for more info. * - `canActivateChild` is an array of DI tokens used to look up CanActivateChild handlers. See * {@link * CanActivateChild} for more info. * - `canDeactivate` is an array of DI tokens used to look up CanDeactivate handlers. See {@link * CanDeactivate} for more info. * - `data` is additional data provided to the component via `ActivatedRoute`. * - `resolve` is a map of DI tokens used to look up data resolvers. See {@link Resolve} for more * info. * - `children` is an array of child route definitions. * * ### Simple Configuration * * ``` * [{ * path: 'team/:id', * component: Team, * children: [ * { * path: 'user/:name', * component: User * } * ] * }] * ``` * * When navigating to `/team/11/user/bob`, the router will create the team component with the user * component in it. * * ### Multiple Outlets * * ``` * [{ * path: 'team/:id', * component: Team * }, * { * path: 'chat/:user', * component: Chat * outlet: 'aux' * }] * ``` * * When navigating to `/team/11(aux:chat/jim)`, the router will create the team component next to * the chat component. The chat component will be placed into the aux outlet. * * ### Wild Cards * * ``` * [{ * path: '**', * component: Sink * }] * ``` * * Regardless of where you navigate to, the router will instantiate the sink component. * * ### Redirects * * ``` * [{ * path: 'team/:id', * component: Team, * children: [ * { * path: 'legacy/user/:name', * redirectTo: 'user/:name' * }, * { * path: 'user/:name', * component: User * } * ] * }] * ``` * * When navigating to '/team/11/legacy/user/jim', the router will change the url to * '/team/11/user/jim', and then will instantiate the team component with the user component * in it. * * If the `redirectTo` value starts with a '/', then it is an absolute redirect. E.g., if in the * example above we change the `redirectTo` to `/user/:name`, the result url will be '/user/jim'. * * ### Empty Path * * Empty-path route configurations can be used to instantiate components that do not 'consume' * any url segments. Let's look at the following configuration: * * ``` * [{ * path: 'team/:id', * component: Team, * children: [ * { * path: '', * component: AllUsers * }, * { * path: 'user/:name', * component: User * } * ] * }] * ``` * * When navigating to `/team/11`, the router will instantiate the AllUsers component. * * Empty-path routes can have children. * * ``` * [{ * path: 'team/:id', * component: Team, * children: [ * { * path: '', * component: WrapperCmp, * children: [ * { * path: 'user/:name', * component: User * } * ] * } * ] * }] * ``` * * When navigating to `/team/11/user/jim`, the router will instantiate the wrapper component with * the user component in it. * * An empty path route inherits its parent's params and data. This is because it cannot have its * own params, and, as a result, it often uses its parent's params and data as its own. * * ### Matching Strategy * * By default the router will look at what is left in the url, and check if it starts with * the specified path (e.g., `/team/11/user` starts with `team/:id`). * * We can change the matching strategy to make sure that the path covers the whole unconsumed url, * which is akin to `unconsumedUrl === path` or `$` regular expressions. * * This is particularly important when redirecting empty-path routes. * * ``` * [{ * path: '', * pathMatch: 'prefix', //default * redirectTo: 'main' * }, * { * path: 'main', * component: Main * }] * ``` * * Since an empty path is a prefix of any url, even when navigating to '/main', the router will * still apply the redirect. * * If `pathMatch: full` is provided, the router will apply the redirect if and only if navigating to * '/'. * * ``` * [{ * path: '', * pathMatch: 'full', * redirectTo: 'main' * }, * { * path: 'main', * component: Main * }] * ``` * * ### Componentless Routes * * It is useful at times to have the ability to share parameters between sibling components. * * Say we have two components--ChildCmp and AuxCmp--that we want to put next to each other and both * of them require some id parameter. * * One way to do that would be to have a bogus parent component, so both the siblings can get the id * parameter from it. This is not ideal. Instead, you can use a componentless route. * * ``` * [{ * path: 'parent/:id', * children: [ * { path: 'a', component: MainChild }, * { path: 'b', component: AuxChild, outlet: 'aux' } * ] * }] * ``` * * So when navigating to `parent/10/(a//aux:b)`, the route will instantiate the main child and aux * child components next to each other. In this example, the application component * has to have the primary and aux outlets defined. * * The router will also merge the `params`, `data`, and `resolve` of the componentless parent into * the `params`, `data`, and `resolve` of the children. This is done because there is no component * that can inject the activated route of the componentless parent. * * This is especially useful when child components are defined as follows: * * ``` * [{ * path: 'parent/:id', * children: [ * { path: '', component: MainChild }, * { path: '', component: AuxChild, outlet: 'aux' } * ] * }] * ``` * * With this configuration in place, navigating to '/parent/10' will create the main child and aux * components. * * ### Lazy Loading * * Lazy loading speeds up our application load time by splitting it into multiple bundles, and * loading them on demand. The router is designed to make lazy loading simple and easy. Instead of * providing the children property, you can provide * the loadChildren property, as follows: * * ``` * [{ * path: 'team/:id', * component: Team, * loadChildren: 'team' * }] * ``` * * The router will use registered NgModuleFactoryLoader to fetch an NgModule associated with 'team'. * Then it will * extract the set of routes defined in that NgModule, and will transparently add those routes to * the main configuration. * * @stable use Routes */ export type Routes = Route[]; /** * @whatItDoes Represents the results of the URL matching. * * * `consumed` is an array of the consumed URL segments. * * `posParams` is a map of positional parameters. * * @experimental */ export type UrlMatchResult = { consumed: UrlSegment[]; posParams?: {[name: string]: UrlSegment}; }; /** * @whatItDoes A function matching URLs * * @description * * A custom URL matcher can be provided when a combination of `path` and `pathMatch` isn't * expressive enough. * * For instance, the following matcher matches html files. * * ``` * function htmlFiles(url: UrlSegment[]) { * return url.length === 1 && url[0].path.endsWith('.html') ? ({consumed: url}) : null; * } * * const routes = [{ matcher: htmlFiles, component: HtmlCmp }]; * ``` * * @experimental */ export type UrlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route: Route) => UrlMatchResult; /** * @whatItDoes Represents the static data associated with a particular route. * See {@link Routes} for more details. * @stable */ export type Data = { [name: string]: any }; /** * @whatItDoes Represents the resolved data associated with a particular route. * See {@link Routes} for more details. * @stable */ export type ResolveData = { [name: string]: any }; /** * @whatItDoes The type of `loadChildren`. * See {@link Routes} for more details. * @stable */ export type LoadChildrenCallback = () => Type<any>| Promise<Type<any>>| Observable<Type<any>>; /** * @whatItDoes The type of `loadChildren`. * * See {@link Routes} for more details. * @stable */ export type LoadChildren = string | LoadChildrenCallback; /** * See {@link Routes} for more details. * @stable */ export interface Route { path?: string; pathMatch?: string; matcher?: UrlMatcher; component?: Type<any>; redirectTo?: string; outlet?: string; canActivate?: any[]; canActivateChild?: any[]; canDeactivate?: any[]; canLoad?: any[]; data?: Data; resolve?: ResolveData; children?: Route[]; loadChildren?: LoadChildren; } export function validateConfig(config: Routes): void { // forEach doesn't iterate undefined values for (let i = 0; i < config.length; i++) { validateNode(config[i]); } } function validateNode(route: Route): void { if (!route) { throw new Error(` Invalid route configuration: Encountered undefined route. The reason might be an extra comma. Example: const routes: Routes = [ { path: '', redirectTo: '/dashboard', pathMatch: 'full' }, { path: 'dashboard', component: DashboardComponent },, << two commas { path: 'detail/:id', component: HeroDetailComponent } ]; `); } if (Array.isArray(route)) { throw new Error(`Invalid route configuration: Array cannot be specified`); } if (route.component === undefined && (route.outlet && route.outlet !== PRIMARY_OUTLET)) { throw new Error( `Invalid route configuration of route '${route.path}': a componentless route cannot have a named outlet set`); } if (!!route.redirectTo && !!route.children) { throw new Error( `Invalid configuration of route '${route.path}': redirectTo and children cannot be used together`); } if (!!route.redirectTo && !!route.loadChildren) { throw new Error( `Invalid configuration of route '${route.path}': redirectTo and loadChildren cannot be used together`); } if (!!route.children && !!route.loadChildren) { throw new Error( `Invalid configuration of route '${route.path}': children and loadChildren cannot be used together`); } if (!!route.redirectTo && !!route.component) { throw new Error( `Invalid configuration of route '${route.path}': redirectTo and component cannot be used together`); } if (!!route.path && !!route.matcher) { throw new Error( `Invalid configuration of route '${route.path}': path and matcher cannot be used together`); } if (route.redirectTo === undefined && !route.component && !route.children && !route.loadChildren) { throw new Error( `Invalid configuration of route '${route.path}': one of the following must be provided (component or redirectTo or children or loadChildren)`); } if (route.path === undefined) { throw new Error(`Invalid route configuration: routes must have path specified`); } if (route.path.startsWith('/')) { throw new Error( `Invalid route configuration of route '${route.path}': path cannot start with a slash`); } if (route.path === '' && route.redirectTo !== undefined && route.pathMatch === undefined) { const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`; throw new Error( `Invalid route configuration of route '{path: "${route.path}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`); } if (route.pathMatch !== undefined && route.pathMatch !== 'full' && route.pathMatch !== 'prefix') { throw new Error( `Invalid configuration of route '${route.path}': pathMatch can only be set to 'prefix' or 'full'`); } }
domusofsail/angular
modules/@angular/router/src/config.ts
TypeScript
mit
12,548
[ 30522, 1013, 1008, 1008, 1008, 1030, 6105, 1008, 9385, 8224, 4297, 1012, 2035, 2916, 9235, 1012, 1008, 1008, 2224, 1997, 2023, 3120, 3642, 2003, 9950, 2011, 2019, 10210, 1011, 2806, 6105, 2008, 2064, 2022, 1008, 2179, 1999, 1996, 6105, 53...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Copyright (C) 2010-2011 Daniel Richter <danielrichter2007@web.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef TRAIT_CONTROLLERAWARE_H_ #define TRAIT_CONTROLLERAWARE_H_ template <typename T> class Trait_ControllerAware { protected: T* controller; public: Trait_ControllerAware() : controller(NULL) {} void setController(T& controller) { this->controller = &controller; } }; #endif /* TRAIT_CONTROLLERAWARE_H_ */
ProfessorKaos64/grub-customizer
src/Controller/Trait/ControllerAware.h
C
gpl-3.0
1,108
[ 30522, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2230, 1011, 2249, 3817, 20105, 1026, 3817, 13149, 3334, 28332, 2581, 1030, 4773, 1012, 2139, 1028, 1008, 1008, 2023, 2565, 2003, 2489, 4007, 1025, 2017, 2064, 2417, 2923, 3089, 8569, 2618, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using Android.OS; using GetAllLinks.Core.ViewModels; using MvvmCross.Droid.Shared.Attributes; using Android.Views; namespace GetAllLinks.Droid.Views { [MvxFragment(typeof(MainActivityViewModel), Resource.Layout.settingsView, ViewModelType = typeof(SettingsViewModel), IsCacheableFragment = false)] public class SettingsFragment : BaseFragment<SettingsViewModel> { public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = base.OnCreateView(inflater, container, savedInstanceState); return view; } } }
spanishprisoner/GetAllLinks
src/GetAllLinks.Droid/Views/SettingsFragment.cs
C#
mit
580
[ 30522, 2478, 11924, 1012, 9808, 1025, 2478, 2131, 8095, 13767, 2015, 1012, 4563, 1012, 3193, 5302, 9247, 2015, 1025, 2478, 19842, 2615, 12458, 25725, 1012, 2852, 9314, 1012, 4207, 1012, 12332, 1025, 2478, 11924, 1012, 5328, 1025, 3415, 1532...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use ast::{MetaItem, Item, Expr}; use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; use ext::deriving::generic::ty::*; use parse::token::InternedString; use std::gc::Gc; pub fn expand_deriving_default(cx: &mut ExtCtxt, span: Span, mitem: Gc<MetaItem>, item: Gc<Item>, push: |Gc<Item>|) { let inline = cx.meta_word(span, InternedString::new("inline")); let attrs = vec!(cx.attribute(span, inline)); let trait_def = TraitDef { span: span, attributes: Vec::new(), path: Path::new(vec!("std", "default", "Default")), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), methods: vec!( MethodDef { name: "default", generics: LifetimeBounds::empty(), explicit_self: None, args: Vec::new(), ret_ty: Self, attributes: attrs, const_nonmatching: false, combine_substructure: combine_substructure(|a, b, c| { default_substructure(a, b, c) }) }) }; trait_def.expand(cx, mitem, item, push) } fn default_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> Gc<Expr> { let default_ident = vec!( cx.ident_of("std"), cx.ident_of("default"), cx.ident_of("Default"), cx.ident_of("default") ); let default_call = |span| cx.expr_call_global(span, default_ident.clone(), Vec::new()); return match *substr.fields { StaticStruct(_, ref summary) => { match *summary { Unnamed(ref fields) => { if fields.is_empty() { cx.expr_ident(trait_span, substr.type_ident) } else { let exprs = fields.iter().map(|sp| default_call(*sp)).collect(); cx.expr_call_ident(trait_span, substr.type_ident, exprs) } } Named(ref fields) => { let default_fields = fields.iter().map(|&(ident, span)| { cx.field_imm(span, ident, default_call(span)) }).collect(); cx.expr_struct_ident(trait_span, substr.type_ident, default_fields) } } } StaticEnum(..) => { cx.span_err(trait_span, "`Default` cannot be derived for enums, only structs"); // let compilation continue cx.expr_uint(trait_span, 0) } _ => cx.span_bug(trait_span, "Non-static method in `deriving(Default)`") }; }
pfalabella/rust
src/libsyntax/ext/deriving/default.rs
Rust
apache-2.0
3,308
[ 30522, 1013, 1013, 9385, 2262, 1011, 2286, 1996, 18399, 2622, 9797, 1012, 2156, 1996, 9385, 1013, 1013, 5371, 2012, 1996, 2327, 1011, 2504, 14176, 1997, 2023, 4353, 1998, 2012, 1013, 1013, 8299, 1024, 1013, 1013, 18399, 1011, 11374, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/cpu.h" #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #if _MSC_VER >= 1700 // C4752: found Intel(R) Advanced Vector Extensions; consider using /arch:AVX. #pragma warning(disable: 4752) #endif // Tests whether we can run extended instructions represented by the CPU // information. This test actually executes some extended instructions (such as // MMX, SSE, etc.) supported by the CPU and sees we can run them without // "undefined instruction" exceptions. That is, this test succeeds when this // test finishes without a crash. TEST(CPU, RunExtendedInstructions) { #if defined(ARCH_CPU_X86_FAMILY) // Retrieve the CPU information. base::CPU cpu; ASSERT_TRUE(cpu.has_mmx()); ASSERT_TRUE(cpu.has_sse()); ASSERT_TRUE(cpu.has_sse2()); // GCC and clang instruction test. #if defined(COMPILER_GCC) // Execute an MMX instruction. __asm__ __volatile__("emms\n" : : : "mm0"); // Execute an SSE instruction. __asm__ __volatile__("xorps %%xmm0, %%xmm0\n" : : : "xmm0"); // Execute an SSE 2 instruction. __asm__ __volatile__("psrldq $0, %%xmm0\n" : : : "xmm0"); if (cpu.has_sse3()) { // Execute an SSE 3 instruction. __asm__ __volatile__("addsubpd %%xmm0, %%xmm0\n" : : : "xmm0"); } if (cpu.has_ssse3()) { // Execute a Supplimental SSE 3 instruction. __asm__ __volatile__("psignb %%xmm0, %%xmm0\n" : : : "xmm0"); } if (cpu.has_sse41()) { // Execute an SSE 4.1 instruction. __asm__ __volatile__("pmuldq %%xmm0, %%xmm0\n" : : : "xmm0"); } if (cpu.has_sse42()) { // Execute an SSE 4.2 instruction. __asm__ __volatile__("crc32 %%eax, %%eax\n" : : : "eax"); } if (cpu.has_popcnt()) { // Execute a POPCNT instruction. __asm__ __volatile__("popcnt %%eax, %%eax\n" : : : "eax"); } if (cpu.has_avx()) { // Execute an AVX instruction. __asm__ __volatile__("vzeroupper\n" : : : "xmm0"); } if (cpu.has_avx2()) { // Execute an AVX 2 instruction. __asm__ __volatile__("vpunpcklbw %%ymm0, %%ymm0, %%ymm0\n" : : : "xmm0"); } // Visual C 32 bit and ClangCL 32/64 bit test. #elif defined(COMPILER_MSVC) && (defined(ARCH_CPU_32_BITS) || \ (defined(ARCH_CPU_64_BITS) && defined(__clang__))) // Execute an MMX instruction. __asm emms; // Execute an SSE instruction. __asm xorps xmm0, xmm0; // Execute an SSE 2 instruction. __asm psrldq xmm0, 0; if (cpu.has_sse3()) { // Execute an SSE 3 instruction. __asm addsubpd xmm0, xmm0; } if (cpu.has_ssse3()) { // Execute a Supplimental SSE 3 instruction. __asm psignb xmm0, xmm0; } if (cpu.has_sse41()) { // Execute an SSE 4.1 instruction. __asm pmuldq xmm0, xmm0; } if (cpu.has_sse42()) { // Execute an SSE 4.2 instruction. __asm crc32 eax, eax; } if (cpu.has_popcnt()) { // Execute a POPCNT instruction. __asm popcnt eax, eax; } // Visual C 2012 required for AVX. #if _MSC_VER >= 1700 if (cpu.has_avx()) { // Execute an AVX instruction. __asm vzeroupper; } if (cpu.has_avx2()) { // Execute an AVX 2 instruction. __asm vpunpcklbw ymm0, ymm0, ymm0 } #endif // _MSC_VER >= 1700 #endif // defined(COMPILER_GCC) #endif // defined(ARCH_CPU_X86_FAMILY) }
geminy/aidear
oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/base/cpu_unittest.cc
C++
gpl-3.0
3,413
[ 30522, 1013, 1013, 9385, 1006, 1039, 1007, 2262, 1996, 10381, 21716, 5007, 6048, 1012, 2035, 2916, 9235, 1012, 1013, 1013, 2224, 1997, 2023, 3120, 3642, 2003, 9950, 2011, 1037, 18667, 2094, 1011, 2806, 6105, 2008, 2064, 2022, 1013, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
if __name__ == "__main__": try: from mvc.ui.widgets import Application except ImportError: from mvc.ui.console import Application from mvc.widgets import app from mvc.widgets import initialize app.widgetapp = Application() initialize(app.widgetapp)
pculture/mirovideoconverter3
mvc/__main__.py
Python
gpl-3.0
289
[ 30522, 2065, 1035, 1035, 2171, 1035, 1035, 1027, 1027, 1000, 1035, 1035, 2364, 1035, 1035, 1000, 1024, 3046, 1024, 2013, 19842, 2278, 1012, 21318, 1012, 15536, 28682, 12324, 4646, 3272, 12324, 2121, 29165, 1024, 2013, 19842, 2278, 1012, 213...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# MinimumDisjointPathCovering # 最小不相交路径覆盖
zhaochenyou/Way-to-Algorithm
docs/GraphTheory/BinaryMatch/MinimumDisjointPathCovering/README.md
Markdown
mit
60
[ 30522, 1001, 6263, 10521, 5558, 18447, 15069, 3597, 6299, 2075, 1001, 100, 1829, 1744, 1919, 100, 100, 100, 100, 100, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ #include "prince/variatxt.h" #include "common/debug.h" namespace Prince { VariaTxt::VariaTxt() : _dataSize(0), _data(nullptr) { } VariaTxt::~VariaTxt() { _dataSize = 0; if (_data != nullptr) { free(_data); _data = nullptr; } } bool VariaTxt::loadStream(Common::SeekableReadStream &stream) { _dataSize = stream.size(); _data = (byte *)malloc(_dataSize); stream.read(_data, _dataSize); return true; } byte *VariaTxt::getString(uint32 stringId) { uint32 stringOffset = READ_LE_UINT32(_data + stringId * 4); if (stringOffset > _dataSize) { assert(false); } return _data + stringOffset; } } // End of namespace Prince
jammm/scummvm
engines/prince/variatxt.cpp
C++
gpl-2.0
1,586
[ 30522, 1013, 1008, 8040, 2819, 2213, 2615, 2213, 1011, 8425, 6172, 3194, 1008, 1008, 8040, 2819, 2213, 2615, 2213, 2003, 1996, 3423, 3200, 1997, 2049, 9797, 1010, 3005, 3415, 1008, 2024, 2205, 3365, 2000, 2862, 2182, 1012, 3531, 6523, 200...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * This is a common dao with basic CRUD operations and is not limited to any * persistent layer implementation * * Copyright (C) 2008 Imran M Yousuf (imyousuf@smartitengineering.com) * * This 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. * This 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 this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package com.smartitengineering.dao.common.queryparam; import java.util.Collection; /** * * @author imyousuf */ public interface CompoundQueryParameter<Template extends Object> extends QueryParameter<Template> { public Collection<QueryParameter> getNestedParameters(); }
imyousuf/smart-dao
smart-dao-queryparam/src/main/java/com/smartitengineering/dao/common/queryparam/CompoundQueryParameter.java
Java
lgpl-3.0
1,217
[ 30522, 1013, 1008, 1008, 2023, 2003, 1037, 2691, 4830, 2080, 2007, 3937, 13675, 6784, 3136, 1998, 2003, 2025, 3132, 2000, 2151, 1008, 14516, 6741, 7375, 1008, 1008, 9385, 1006, 1039, 1007, 2263, 10047, 5521, 1049, 2017, 6342, 2546, 1006, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package cc.mallet.util; /** * Static utility methods for Strings */ final public class Strings { public static int commonPrefixIndex (String[] strings) { int prefixLen = strings[0].length(); for (int i = 1; i < strings.length; i++) { if (strings[i].length() < prefixLen) prefixLen = strings[i].length(); int j = 0; if (prefixLen == 0) return 0; while (j < prefixLen) { if (strings[i-1].charAt(j) != strings[i].charAt(j)) { prefixLen = j; break; } j++; } } return prefixLen; } public static String commonPrefix (String[] strings) { return strings[0].substring (0, commonPrefixIndex(strings)); } public static int count (String string, char ch) { int idx = -1; int count = 0; while ((idx = string.indexOf (ch, idx+1)) >= 0) { count++; }; return count; } public static double levenshteinDistance (String s, String t) { int n = s.length(); int m = t.length(); int d[][]; // matrix int i; // iterates through s int j; // iterates through t char s_i; // ith character of s char t_j; // jth character of t int cost; // cost if (n == 0) return 1.0; if (m == 0) return 1.0; d = new int[n+1][m+1]; for (i = 0; i <= n; i++) d[i][0] = i; for (j = 0; j <= m; j++) d[0][j] = j; for (i = 1; i <= n; i++) { s_i = s.charAt (i - 1); for (j = 1; j <= m; j++) { t_j = t.charAt (j - 1); cost = (s_i == t_j) ? 0 : 1; d[i][j] = minimum (d[i-1][j]+1, d[i][j-1]+1, d[i-1][j-1] + cost); } } int longer = (n > m) ? n : m; return (double)d[n][m] / longer; // Normalize to 0-1. } private static int minimum (int a, int b, int c) { int mi = a; if (b < mi) { mi = b; } if (c < mi) { mi = c; } return mi; } }
UnsupervisedOntologyLearning/hrLDA
hrLDA/src/cc/mallet/util/Strings.java
Java
apache-2.0
1,930
[ 30522, 7427, 10507, 1012, 6670, 3388, 1012, 21183, 4014, 1025, 1013, 1008, 1008, 1008, 10763, 9710, 4725, 2005, 7817, 1008, 1013, 2345, 2270, 2465, 7817, 1063, 2270, 10763, 20014, 2691, 28139, 8873, 20303, 3207, 2595, 1006, 5164, 1031, 1033...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/***************************************************************** * This file is part of CCAFS Planning and Reporting Platform. * CCAFS P&R is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * at your option) any later version. * CCAFS P&R is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with CCAFS P&R. If not, see <http://www.gnu.org/licenses/>. * *************************************************************** */ package org.cgiar.ccafs.ap.data.dao.mysql; import org.cgiar.ccafs.ap.data.dao.ProjectOtherContributionDAO; import org.cgiar.ccafs.utils.db.DAOManager; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; import com.google.inject.Inject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author Javier Andrés Gallego B. */ public class MySQLProjectOtherContributionDAO implements ProjectOtherContributionDAO { // Logger private static Logger LOG = LoggerFactory.getLogger(MySQLProjectOtherContributionDAO.class); private DAOManager databaseManager; @Inject public MySQLProjectOtherContributionDAO(DAOManager databaseManager) { this.databaseManager = databaseManager; } @Override public Map<String, String> getIPOtherContributionById(int ipOtherContributionId) { Map<String, String> ipOtherContributionData = new HashMap<String, String>(); LOG.debug(">> getIPOtherContributionById( ipOtherContributionId = {} )", ipOtherContributionId); StringBuilder query = new StringBuilder(); query.append("SELECT ipo.* "); query.append("FROM project_other_contributions as ipo "); query.append("WHERE ipo.id= "); query.append(ipOtherContributionId); try (Connection con = databaseManager.getConnection()) { ResultSet rs = databaseManager.makeQuery(query.toString(), con); if (rs.next()) { ipOtherContributionData.put("id", rs.getString("id")); ipOtherContributionData.put("project_id", rs.getString("project_id")); ipOtherContributionData.put("contribution", rs.getString("contribution")); ipOtherContributionData.put("additional_contribution", rs.getString("additional_contribution")); ipOtherContributionData.put("crp_contributions_nature", rs.getString("crp_contributions_nature")); } con.close(); } catch (SQLException e) { LOG.error("Exception arised getting the IP Other Contribution {}.", ipOtherContributionId, e); } LOG.debug("-- getIPOtherContributionById() > Calling method executeQuery to get the results"); return ipOtherContributionData; } @Override public Map<String, String> getIPOtherContributionByProjectId(int projectID) { LOG.debug(">> getIPOtherContributionByProjectId (projectID = {} )", projectID); Map<String, String> ipOtherContributionData = new HashMap<String, String>(); StringBuilder query = new StringBuilder(); query.append("SELECT ipo.* "); query.append("FROM project_other_contributions as ipo "); query.append("INNER JOIN projects p ON ipo.project_id = p.id "); query.append("WHERE ipo.project_id= "); query.append(projectID); try (Connection con = databaseManager.getConnection()) { ResultSet rs = databaseManager.makeQuery(query.toString(), con); if (rs.next()) { ipOtherContributionData.put("id", rs.getString("id")); ipOtherContributionData.put("project_id", rs.getString("project_id")); ipOtherContributionData.put("contribution", rs.getString("contribution")); ipOtherContributionData.put("additional_contribution", rs.getString("additional_contribution")); ipOtherContributionData.put("crp_contributions_nature", rs.getString("crp_contributions_nature")); } con.close(); } catch (SQLException e) { LOG.error("Exception arised getting the IP Other Contribution by the projectID {}.", projectID, e); } LOG.debug("-- getIPOtherContributionByProjectId() : {}", ipOtherContributionData); return ipOtherContributionData; } @Override public int saveIPOtherContribution(int projectID, Map<String, Object> ipOtherContributionData) { LOG.debug(">> saveIPOtherContribution(ipOtherContributionDataData={})", ipOtherContributionData); StringBuilder query = new StringBuilder(); int result = -1; Object[] values; if (ipOtherContributionData.get("id") == null) { // Insert new IP Other Contribution record query.append("INSERT INTO project_other_contributions (project_id, contribution, additional_contribution, "); query.append("crp_contributions_nature, created_by, modified_by, modification_justification) "); query.append("VALUES (?,?,?,?,?,?,?) "); values = new Object[7]; values[0] = projectID; values[1] = ipOtherContributionData.get("contribution"); values[2] = ipOtherContributionData.get("additional_contribution"); values[3] = ipOtherContributionData.get("crp_contributions_nature"); values[4] = ipOtherContributionData.get("user_id"); values[5] = ipOtherContributionData.get("user_id"); values[6] = ipOtherContributionData.get("justification"); result = databaseManager.saveData(query.toString(), values); if (result <= 0) { LOG.error("A problem happened trying to add a new IP Other Contribution with project id={}", projectID); return -1; } } else { // update IP Other Contribution record query.append("UPDATE project_other_contributions SET project_id = ?, contribution = ?, "); query.append("additional_contribution = ?, crp_contributions_nature = ?, modified_by = ?, "); query.append("modification_justification = ? WHERE id = ? "); values = new Object[7]; values[0] = projectID; values[1] = ipOtherContributionData.get("contribution"); values[2] = ipOtherContributionData.get("additional_contribution"); values[3] = ipOtherContributionData.get("crp_contributions_nature"); values[4] = ipOtherContributionData.get("user_id"); values[5] = ipOtherContributionData.get("justification"); values[6] = ipOtherContributionData.get("id"); result = databaseManager.saveData(query.toString(), values); if (result == -1) { LOG.error("A problem happened trying to update the IP Other Contribution identified with the id = {}", ipOtherContributionData.get("id")); return -1; } } LOG.debug("<< saveIPOtherContribution():{}", result); return result; } }
CCAFS/ccafs-ap
impactPathways/src/main/java/org/cgiar/ccafs/ap/data/dao/mysql/MySQLProjectOtherContributionDAO.java
Java
gpl-3.0
6,952
[ 30522, 1013, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
using NUnit.Framework; using Shouldly.Tests.TestHelpers; namespace Shouldly.Tests.Strings.ShouldNotStartWith { public class ShouldIgnoreCaseByDefault : ShouldlyShouldTestScenario { protected override void ShouldThrowAWobbly() { "Cheese".ShouldNotStartWith("cH", "Some additional context"); } protected override string ChuckedAWobblyErrorMessage { get { return "\"Cheese\" should not start with \"cH\" but was \"Cheese\"" + "Additional Info: " + "Some additional context"; } } protected override void ShouldPass() { "Cheese".ShouldNotStartWith("Ce"); } } }
yannisgu/shouldly
src/Shouldly.Tests/Strings/ShouldNotStartWith/ShouldIgnoreCaseByDefault.cs
C#
bsd-3-clause
754
[ 30522, 2478, 16634, 4183, 1012, 7705, 1025, 2478, 2323, 2135, 1012, 5852, 1012, 3231, 16001, 7347, 1025, 3415, 15327, 2323, 2135, 1012, 5852, 1012, 7817, 1012, 5807, 12868, 7559, 2102, 24415, 1063, 2270, 2465, 2323, 23773, 5686, 18382, 3762...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package jose4j.asym; import org.jose4j.jws.JsonWebSignature; import org.jose4j.lang.JoseException; import java.security.PublicKey; public class Jose4jVerifier { public static void main(String[] args) { String token = new Jose4jProvider().create(); try { new Jose4jVerifier().verify(token); } catch (JoseException e) { e.printStackTrace(); } } public void verify(String token) throws JoseException { JsonWebSignature jws = new JsonWebSignature(); jws.setCompactSerialization(token); PublicKey publicKey = ExampleRsaKeyPair.createPublicKey(); jws.setKey(publicKey); boolean signatureVerified = jws.verifySignature(); System.out.println("JWS Signature is valid: " + signatureVerified); String payload = jws.getPayload(); System.out.println("JWS payload: " + payload); } }
nitram509/decentral-authentication-playground
java/src/main/java/jose4j/asym/Jose4jVerifier.java
Java
apache-2.0
847
[ 30522, 7427, 4560, 2549, 3501, 1012, 2004, 24335, 1025, 12324, 8917, 1012, 4560, 2549, 3501, 1012, 1046, 9333, 1012, 1046, 3385, 8545, 5910, 23773, 4017, 5397, 1025, 12324, 8917, 1012, 4560, 2549, 3501, 1012, 11374, 1012, 4560, 10288, 24422...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#define CPARSER_MAJOR "0" #define CPARSER_MINOR "9" #define CPARSER_PATCHLEVEL "14" #define CPARSER_VERSION CPARSER_MAJOR "." CPARSER_MINOR "." CPARSER_PATCHLEVEL
davidgiven/cparser
src/driver/version.h
C
gpl-2.0
175
[ 30522, 1001, 9375, 18133, 11650, 2121, 1035, 2350, 1000, 1014, 1000, 1001, 9375, 18133, 11650, 2121, 1035, 3576, 1000, 1023, 1000, 1001, 9375, 18133, 11650, 2121, 1035, 8983, 20414, 2884, 1000, 2403, 1000, 1001, 9375, 18133, 11650, 2121, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// This file is automatically generated. package adila.db; /* * Alcatel * * DEVICE: OT-981_gsm * MODEL: Alcatel OT-981A */ final class ot2d9815fgsm_alcatel20ot2d981a { public static final String DATA = "Alcatel||"; }
karim/adila
database/src/main/java/adila/db/ot2d9815fgsm_alcatel20ot2d981a.java
Java
mit
229
[ 30522, 1013, 1013, 2023, 5371, 2003, 8073, 7013, 1012, 7427, 27133, 2721, 1012, 16962, 1025, 1013, 1008, 1008, 2632, 16280, 2140, 1008, 1008, 5080, 1024, 27178, 1011, 5818, 2487, 1035, 28177, 2213, 1008, 2944, 1024, 2632, 16280, 2140, 27178...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.gbif.common.parsers.date; import org.gbif.common.parsers.core.ParseResult; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.Month; import java.time.Year; import java.time.YearMonth; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; import java.util.function.Function; import javax.annotation.Nullable; import org.junit.jupiter.api.Test; import static org.gbif.common.parsers.utils.CSVBasedAssertions.assertTestFile; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; /** * Unit testing for ThreeTenNumericalDateParser. */ public class ThreeTenNumericalDateParserTest { private static final String BADDATE_TEST_FILE = "parse/date/threeten_bad_date_tests.txt"; private static final String LOCALDATE_TEST_FILE = "parse/date/threeten_localdate_tests.txt"; private static final String LOCALDATETIME_TEST_FILE = "parse/date/threeten_localdatetime_tests.txt"; private static final String LOCALDATETIME_TZ_TEST_FILE = "parse/date/local_datetime_tz_tests.txt"; private static final int RAW_VAL_IDX = 0; private static final int YEAR_VAL_IDX = 1; private static final int MONTH_VAL_IDX = 2; private static final int DAY_VAL_IDX = 3; private static final int HOUR_VAL_IDX = 4; private static final int MIN_VAL_IDX = 5; private static final int SEC_VAL_IDX = 6; private static final int NS_VAL_IDX = 7; private static final int TZ_VAL_IDX = 8; private static final TemporalParser PARSER = ThreeTenNumericalDateParser.newInstance(); @Test public void testLocalDateFromFile() { assertTestFile(LOCALDATE_TEST_FILE, new Function<String[], Void>() { @Nullable @Override public Void apply(@Nullable String[] row) { String raw = row[RAW_VAL_IDX]; try { int year = Integer.parseInt(row[YEAR_VAL_IDX]); int month = Integer.parseInt(row[MONTH_VAL_IDX]); int day = Integer.parseInt(row[DAY_VAL_IDX]); ParseResult<TemporalAccessor> result = PARSER.parse(raw); assertNotNull(result.getPayload(), raw + " generated null payload"); assertEquals(LocalDate.of(year, month, day), LocalDate.from(result.getPayload()), "Test file rawValue: " + raw); } catch (NumberFormatException nfEx){ fail("Error while parsing the test input file content." + nfEx.getMessage()); } return null; } }); } @Test public void testLocalDateTimeFromFile() { assertTestFile(LOCALDATETIME_TEST_FILE, new Function<String[], Void>() { @Nullable @Override public Void apply(@Nullable String[] row) { String raw = row[RAW_VAL_IDX]; try { int year = Integer.parseInt(row[YEAR_VAL_IDX]); int month = Integer.parseInt(row[MONTH_VAL_IDX]); int day = Integer.parseInt(row[DAY_VAL_IDX]); int hour = Integer.parseInt(row[HOUR_VAL_IDX]); int minute = Integer.parseInt(row[MIN_VAL_IDX]); int second = Integer.parseInt(row[SEC_VAL_IDX]); int nanosecond = Integer.parseInt(row[NS_VAL_IDX]); ParseResult<TemporalAccessor> result = PARSER.parse(raw); assertNotNull(result.getPayload(), raw + " generated null payload"); assertEquals(LocalDateTime.of(year, month, day, hour, minute, second, nanosecond), LocalDateTime.from(result.getPayload()), "Test file rawValue: " + raw); } catch (NumberFormatException nfEx) { fail("Error while parsing the test input file content." + nfEx.getMessage()); } return null; } }); } @Test public void testLocalDateTimeWithTimezoneFromFile() { assertTestFile(LOCALDATETIME_TZ_TEST_FILE, new Function<String[], Void>() { @Nullable @Override public Void apply(@Nullable String[] row) { String raw = row[RAW_VAL_IDX]; try { int year = Integer.parseInt(row[YEAR_VAL_IDX]); int month = Integer.parseInt(row[MONTH_VAL_IDX]); int day = Integer.parseInt(row[DAY_VAL_IDX]); int hour = Integer.parseInt(row[HOUR_VAL_IDX]); int minute = Integer.parseInt(row[MIN_VAL_IDX]); int second = Integer.parseInt(row[SEC_VAL_IDX]); int millisecond = Integer.parseInt(row[NS_VAL_IDX]); String zoneId = row[TZ_VAL_IDX]; ParseResult<TemporalAccessor> result = PARSER.parse(raw); assertNotNull(result.getPayload(), raw + " generated null payload"); assertEquals(ZonedDateTime.of(year, month, day, hour, minute, second, 0, ZoneId.of(zoneId)).with(ChronoField.MILLI_OF_SECOND, millisecond), ZonedDateTime.from(result.getPayload()), "Test file rawValue: " + raw); } catch (NumberFormatException nfEx) { fail("Error while parsing the test input file content." + nfEx.getMessage()); } return null; } }); } @Test public void testBadDateFromFile() { assertTestFile(BADDATE_TEST_FILE, new Function<String[], Void>() { @Nullable @Override public Void apply(@Nullable String[] row) { assertEquals(ParseResult.STATUS.FAIL, PARSER.parse(row[RAW_VAL_IDX]).getStatus(), "Test file rawValue: " + row[RAW_VAL_IDX]); return null; } }); } @Test public void testParseAsLocalDateTime() { ThreeTenNumericalDateParser parser = ThreeTenNumericalDateParser.newInstance(Year.of(1900)); // month first with 2 digits years >_< assertEquals(LocalDate.of(1978, Month.DECEMBER, 21), LocalDate.from(parser.parse("122178").getPayload())); assertEquals(LocalDate.of(1978, Month.DECEMBER, 21), LocalDate.from(parser.parse("12/21/78").getPayload())); assertEquals(LocalDate.of(1978, Month.DECEMBER, 21), LocalDate.from(parser.parse("12\\21\\78").getPayload())); assertEquals(LocalDate.of(1978, Month.DECEMBER, 21), LocalDate.from(parser.parse("12.21.78").getPayload())); assertEquals(LocalDate.of(1978, Month.DECEMBER, 21), LocalDate.from(parser.parse("12-21-78").getPayload())); assertEquals(LocalDate.of(1978, Month.DECEMBER, 21), LocalDate.from(parser.parse("12_21_78").getPayload())); // month/year alone assertEquals(YearMonth.of(1978, 12), YearMonth.from(parser.parse("1978-12").getPayload())); // year alone assertEquals(Year.of(1978), Year.from(parser.parse("1978").getPayload())); // assertEquals(Year.of(1978), Year.from(parser.parse("78").getPayload())); } @Test public void testParseAsLocalDateByDateParts() { assertEquals(LocalDate.of(1978, Month.DECEMBER, 21), LocalDate.from(PARSER.parse("1978", "12", "21").getPayload())); assertEquals(LocalDate.of(1978, Month.DECEMBER, 21), LocalDate.from(PARSER.parse(1978, 12, 21).getPayload())); assertEquals(LocalDate.of(1978, Month.DECEMBER, 1), LocalDate.from(PARSER.parse("1978", "12", "1").getPayload())); assertEquals(YearMonth.of(1978, 12), YearMonth.from(PARSER.parse("1978", "12", null).getPayload())); assertEquals(YearMonth.of(1978, 12), YearMonth.from(PARSER.parse(1978, 12, null).getPayload())); assertEquals(Year.of(1978), Year.from(PARSER.parse("1978", "", null).getPayload())); // providing the day without the month should result in an error assertEquals(ParseResult.STATUS.FAIL, PARSER.parse("1978", "", "2").getStatus()); assertEquals(ParseResult.STATUS.FAIL, PARSER.parse(1978, null, 2).getStatus()); } // @Ignore("not implemented yet") // @Test // public void testUnsupportedFormat() { // ParseResult<TemporalAccessor> result = PARSER.parse("16/11/1996 0:00:00"); // // System.out.println(PARSER.parse("1996-11-16T00:00:00")); // } @Test public void testParsePreserveZoneOffset() { ZonedDateTime offsetDateTime = ZonedDateTime.of(1978, 12, 21, 0, 0, 0, 0, ZoneOffset.of("+02:00")); assertEquals(offsetDateTime, PARSER.parse("1978-12-21T00:00:00+02:00").getPayload()); } @Test public void testAmbiguousDates() { ParseResult<TemporalAccessor> result; // Ambiguous result = PARSER.parse("1/2/1996"); assertNull(result.getPayload()); assertEquals(2, result.getAlternativePayloads().size()); assertTrue(result.getAlternativePayloads().contains(LocalDate.of(1996, 2, 1))); assertTrue(result.getAlternativePayloads().contains(LocalDate.of(1996, 1, 2))); // Not ambiguous result = PARSER.parse("1/1/1996"); assertEquals(LocalDate.of(1996, 1, 1), result.getPayload()); assertNull(result.getAlternativePayloads()); result = PARSER.parse("31/1/1996"); assertEquals(LocalDate.of(1996, 1, 31), result.getPayload()); assertNull(result.getAlternativePayloads()); // Dots aren't used in America. result = PARSER.parse("4.5.1996"); assertEquals(LocalDate.of(1996, 5, 4), result.getPayload()); assertNull(result.getAlternativePayloads()); } @Test public void testBlankDates() { assertEquals(ParseResult.STATUS.FAIL, PARSER.parse(" ").getStatus()); assertEquals(ParseResult.STATUS.FAIL, PARSER.parse("").getStatus()); assertEquals(ParseResult.STATUS.FAIL, PARSER.parse(null).getStatus()); } }
gbif/parsers
src/test/java/org/gbif/common/parsers/date/ThreeTenNumericalDateParserTest.java
Java
apache-2.0
10,688
[ 30522, 1013, 1008, 1008, 7000, 2104, 1996, 15895, 6105, 1010, 2544, 1016, 1012, 1014, 1006, 1996, 1000, 6105, 1000, 1007, 1025, 1008, 2017, 2089, 2025, 2224, 2023, 5371, 3272, 1999, 12646, 2007, 1996, 6105, 1012, 1008, 2017, 2089, 6855, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
## Python These settings apply only when `--python` is specified on the command line. Please also specify `--python-sdks-folder=<path to the root directory of your azure-sdk-for-python clone>`. Use `--python-mode=update` if you already have a setup.py and just want to update the code itself. ``` yaml $(python) && $(track2) azure-arm: true license-header: MICROSOFT_MIT_NO_VERSION namespace: azure.mgmt.support package-name: azure-mgmt-support package-version: 1.0.0b1 clear-output-folder: true ``` ``` yaml $(python) && $(python-mode) == 'update' && $(track2) no-namespace-folders: true output-folder: $(python-sdks-folder)/support/azure-mgmt-support/azure/mgmt/support ``` ``` yaml $(python) && $(python-mode) == 'create' && $(track2) basic-setup-py: true output-folder: $(python-sdks-folder)/support/azure-mgmt-support ```
naveedaz/azure-rest-api-specs
specification/support/resource-manager/readme.python.md
Markdown
mit
830
[ 30522, 1001, 1001, 18750, 2122, 10906, 6611, 2069, 2043, 1036, 1011, 1011, 18750, 1036, 2003, 9675, 2006, 1996, 3094, 2240, 1012, 3531, 2036, 20648, 1036, 1011, 1011, 18750, 1011, 17371, 5705, 1011, 19622, 1027, 1026, 4130, 2000, 1996, 7117...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
package com.google.example.squash; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.HashMap; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Toast; import com.google.android.gms.common.api.PendingResult; import com.google.android.gms.common.api.ResultCallback; import com.google.android.gms.games.Games; import com.google.android.gms.games.GamesActivityResultCodes; import com.google.android.gms.games.request.GameRequest; import com.google.android.gms.games.request.Requests; import com.google.example.games.basegameutils.BaseGameActivity; public class SquashActivity extends BaseGameActivity { public static final int REQUEST_ACHIEVEMENTS = 1001; public static final int REQUEST_LEADERBOARD = 1002; public static final int SEND_GIFT = 1003; public static final int SHOW_INBOX = 1004; public SquashActivity() { super(CLIENT_GAMES | CLIENT_PLUS); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_leaderboard: startActivityForResult( Games.Leaderboards.getLeaderboardIntent( getApiClient(), getResources().getString( R.string.leaderboard_bounces)), REQUEST_LEADERBOARD); return true; case R.id.menu_reset: return true; case R.id.menu_achievements: if (isSignedIn()) { startActivityForResult( Games.Achievements.getAchievementsIntent( getApiClient() ), REQUEST_ACHIEVEMENTS); } return true; case R.id.menu_send_gift: if (isSignedIn()) { Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); Intent intent = Games.Requests.getSendIntent(getApiClient(), GameRequest.TYPE_GIFT, "Gold".getBytes(), Requests.REQUEST_DEFAULT_LIFETIME_DAYS, bm, "A treasure chest!"); startActivityForResult(intent, SEND_GIFT); } return true; case R.id.menu_gift_inbox: if (isSignedIn()) { startActivityForResult(Games.Requests.getInboxIntent(getApiClient()), SHOW_INBOX); } return true; } return super.onOptionsItemSelected(item); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_squash); // This sets up the click listener. findViewById(R.id.sign_in_button).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // start the asynchronous sign in flow beginUserInitiatedSignIn(); } }); findViewById(R.id.sign_out_button).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { signOut(); setViewVisibility(); } }); findViewById(R.id.quick_match_button).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { startQuickGame(); } }); } private void startQuickGame() { ((SquashView) findViewById(R.id.squashView)).start(); findViewById(R.id.sign_out_button).setVisibility(View.GONE); findViewById(R.id.sign_in_button).setVisibility(View.GONE); findViewById(R.id.quick_match_button).setVisibility(View.GONE); findViewById(R.id.squashView).setVisibility(View.VISIBLE); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.squash, menu); return true; } @Override public void onResume() { super.onResume(); ((SquashView) findViewById(R.id.squashView)).setAnimating(true); } @Override public void onStop() { super.onStop(); ((SquashView) findViewById(R.id.squashView)).setAnimating(false); } // Called whenever the Squash game starts. public void onGameStart(SquashView v) { if (isSignedIn()) { Games.Achievements.unlock( getApiClient(), getResources().getString(R.string.achievement_first) ); } } // Called whenever the Squash game stops. public void onGameStop(SquashView v) { setViewVisibility(); findViewById(R.id.squashView).setVisibility(View.GONE); findViewById(R.id.quick_match_button).setVisibility(View.VISIBLE); if (isSignedIn() && v.mScore > 0) { Games.Achievements.increment( getApiClient(), getResources().getString(R.string.achievement_20), v.mScore); Games.Leaderboards.submitScore(getApiClient(), getResources().getString(R.string.leaderboard_bounces), v.mScore); } } // Set the login button visible or not public void setViewVisibility() { if (isSignedIn()) { findViewById(R.id.sign_out_button).setVisibility(View.VISIBLE); findViewById(R.id.sign_in_button).setVisibility(View.GONE); } else { findViewById(R.id.sign_out_button).setVisibility(View.GONE); findViewById(R.id.sign_in_button).setVisibility(View.VISIBLE); } } @Override public void onSignInFailed() { setViewVisibility(); } @Override public void onSignInSucceeded() { setViewVisibility(); ArrayList<GameRequest> requests = getGameHelper().getRequests(); if (requests != null) { handleGiftRequest(requests); } } @Override public void onActivityResult(int request, int response, Intent intent) { super.onActivityResult(request, response, intent); if (request == SEND_GIFT) { if (response == GamesActivityResultCodes.RESULT_SEND_REQUEST_FAILED) { Toast.makeText(this, "Failed to send gift!", Toast.LENGTH_LONG).show(); } } else if (request == SHOW_INBOX) { if (response == Activity.RESULT_OK && intent != null) { handleGiftRequest(Games.Requests.getGameRequestsFromInboxResponse(intent)); } else { Toast.makeText(this, "Error receiving gift!", Toast.LENGTH_LONG).show(); } } } private void handleGiftRequest(ArrayList<GameRequest> requests) { if (requests == null) { return; } // Attempt to accept these requests. ArrayList<String> requestIds = new ArrayList<String>(); final HashMap<String, GameRequest> gameRequestMap = new HashMap<String, GameRequest>(); // Cache the requests. for (GameRequest request : requests) { String requestId = request.getRequestId(); requestIds.add(requestId); gameRequestMap.put(requestId, request); } // Accept the requests. PendingResult<Requests.UpdateRequestsResult> pendingResults = Games.Requests.acceptRequests(getApiClient(), requestIds); pendingResults.setResultCallback( new ResultCallback<Requests.UpdateRequestsResult>() { @Override public void onResult(Requests.UpdateRequestsResult result) { // Scan each result outcome and process accordingly. for (String requestId : result.getRequestIds()) { // We must have a local cached copy of the request // and the request needs to be a // success in order to continue. if (!gameRequestMap.containsKey(requestId) || result.getRequestOutcome(requestId) != Requests.REQUEST_UPDATE_OUTCOME_SUCCESS) { continue; } // Update succeeded here. Find the type of request // and act accordingly. For wishes, a // responding gift will be automatically sent. switch (gameRequestMap.get(requestId).getType()) { case GameRequest.TYPE_GIFT: // Reward the player here try { Toast.makeText(getApplicationContext(), "Accepted a gift! It is... " + new String(gameRequestMap.get(requestId).getData(), "UTF-8"), Toast.LENGTH_LONG).show(); } catch (UnsupportedEncodingException e) { Toast.makeText(getApplicationContext(), "Accepted a gift!", Toast.LENGTH_LONG).show(); } break; case GameRequest.TYPE_WISH: // Process the wish request Toast.makeText(getApplicationContext(), "Accepted wish!", Toast.LENGTH_LONG).show(); break; } } } } ); } }
googlesamples/io2014-codelabs
play-games/end/Squash/app/src/main/java/com/google/example/squash/SquashActivity.java
Java
apache-2.0
10,160
[ 30522, 7427, 4012, 1012, 8224, 1012, 2742, 1012, 18794, 1025, 12324, 9262, 1012, 22834, 1012, 4895, 6342, 9397, 15613, 2368, 3597, 4667, 10288, 24422, 1025, 12324, 9262, 1012, 21183, 4014, 1012, 9140, 9863, 1025, 12324, 9262, 1012, 21183, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * \file ssl_internal.h * * \brief Internal functions shared by the SSL modules */ /* * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * 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. * * This file is part of mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_SSL_INTERNAL_H #define MBEDTLS_SSL_INTERNAL_H #include "ssl.h" #include "cipher.h" #if defined(MBEDTLS_MD5_C) #include "md5.h" #endif #if defined(MBEDTLS_SHA1_C) #include "sha1.h" #endif #if defined(MBEDTLS_SHA256_C) #include "sha256.h" #endif #if defined(MBEDTLS_SHA512_C) #include "sha512.h" #endif #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) #include "ecjpake.h" #endif #if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \ !defined(inline) && !defined(__cplusplus) #define inline __inline #endif /* Determine minimum supported version */ #define MBEDTLS_SSL_MIN_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3 #if defined(MBEDTLS_SSL_PROTO_SSL3) #define MBEDTLS_SSL_MIN_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_0 #else #if defined(MBEDTLS_SSL_PROTO_TLS1) #define MBEDTLS_SSL_MIN_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_1 #else #if defined(MBEDTLS_SSL_PROTO_TLS1_1) #define MBEDTLS_SSL_MIN_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_2 #else #if defined(MBEDTLS_SSL_PROTO_TLS1_2) #define MBEDTLS_SSL_MIN_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_3 #endif /* MBEDTLS_SSL_PROTO_TLS1_2 */ #endif /* MBEDTLS_SSL_PROTO_TLS1_1 */ #endif /* MBEDTLS_SSL_PROTO_TLS1 */ #endif /* MBEDTLS_SSL_PROTO_SSL3 */ #define MBEDTLS_SSL_MIN_VALID_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_1 #define MBEDTLS_SSL_MIN_VALID_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3 /* Determine maximum supported version */ #define MBEDTLS_SSL_MAX_MAJOR_VERSION MBEDTLS_SSL_MAJOR_VERSION_3 #if defined(MBEDTLS_SSL_PROTO_TLS1_2) #define MBEDTLS_SSL_MAX_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_3 #else #if defined(MBEDTLS_SSL_PROTO_TLS1_1) #define MBEDTLS_SSL_MAX_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_2 #else #if defined(MBEDTLS_SSL_PROTO_TLS1) #define MBEDTLS_SSL_MAX_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_1 #else #if defined(MBEDTLS_SSL_PROTO_SSL3) #define MBEDTLS_SSL_MAX_MINOR_VERSION MBEDTLS_SSL_MINOR_VERSION_0 #endif /* MBEDTLS_SSL_PROTO_SSL3 */ #endif /* MBEDTLS_SSL_PROTO_TLS1 */ #endif /* MBEDTLS_SSL_PROTO_TLS1_1 */ #endif /* MBEDTLS_SSL_PROTO_TLS1_2 */ /* Shorthand for restartable ECC */ #if defined(MBEDTLS_ECP_RESTARTABLE) && \ defined(MBEDTLS_SSL_CLI_C) && \ defined(MBEDTLS_SSL_PROTO_TLS1_2) && \ defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) #define MBEDTLS_SSL__ECP_RESTARTABLE #endif #define MBEDTLS_SSL_INITIAL_HANDSHAKE 0 #define MBEDTLS_SSL_RENEGOTIATION_IN_PROGRESS 1 /* In progress */ #define MBEDTLS_SSL_RENEGOTIATION_DONE 2 /* Done or aborted */ #define MBEDTLS_SSL_RENEGOTIATION_PENDING 3 /* Requested (server only) */ /* * DTLS retransmission states, see RFC 6347 4.2.4 * * The SENDING state is merged in PREPARING for initial sends, * but is distinct for resends. * * Note: initial state is wrong for server, but is not used anyway. */ #define MBEDTLS_SSL_RETRANS_PREPARING 0 #define MBEDTLS_SSL_RETRANS_SENDING 1 #define MBEDTLS_SSL_RETRANS_WAITING 2 #define MBEDTLS_SSL_RETRANS_FINISHED 3 /* * Allow extra bytes for record, authentication and encryption overhead: * counter (8) + header (5) + IV(16) + MAC (16-48) + padding (0-256) * and allow for a maximum of 1024 of compression expansion if * enabled. */ #if defined(MBEDTLS_ZLIB_SUPPORT) #define MBEDTLS_SSL_COMPRESSION_ADD 1024 #else #define MBEDTLS_SSL_COMPRESSION_ADD 0 #endif #if defined(MBEDTLS_ARC4_C) || defined(MBEDTLS_CIPHER_MODE_CBC) /* Ciphersuites using HMAC */ #if defined(MBEDTLS_SHA512_C) #define MBEDTLS_SSL_MAC_ADD 48 /* SHA-384 used for HMAC */ #elif defined(MBEDTLS_SHA256_C) #define MBEDTLS_SSL_MAC_ADD 32 /* SHA-256 used for HMAC */ #else #define MBEDTLS_SSL_MAC_ADD 20 /* SHA-1 used for HMAC */ #endif #else /* AEAD ciphersuites: GCM and CCM use a 128 bits tag */ #define MBEDTLS_SSL_MAC_ADD 16 #endif #if defined(MBEDTLS_CIPHER_MODE_CBC) #define MBEDTLS_SSL_PADDING_ADD 256 #else #define MBEDTLS_SSL_PADDING_ADD 0 #endif #define MBEDTLS_SSL_PAYLOAD_OVERHEAD ( MBEDTLS_SSL_COMPRESSION_ADD + \ MBEDTLS_MAX_IV_LENGTH + \ MBEDTLS_SSL_MAC_ADD + \ MBEDTLS_SSL_PADDING_ADD \ ) #define MBEDTLS_SSL_IN_PAYLOAD_LEN ( MBEDTLS_SSL_PAYLOAD_OVERHEAD + \ ( MBEDTLS_SSL_IN_CONTENT_LEN ) ) #define MBEDTLS_SSL_OUT_PAYLOAD_LEN ( MBEDTLS_SSL_PAYLOAD_OVERHEAD + \ ( MBEDTLS_SSL_OUT_CONTENT_LEN ) ) /* The maximum number of buffered handshake messages. */ #define MBEDTLS_SSL_MAX_BUFFERED_HS 4 /* Maximum length we can advertise as our max content length for RFC 6066 max_fragment_length extension negotiation purposes (the lesser of both sizes, if they are unequal.) */ #define MBEDTLS_TLS_EXT_ADV_CONTENT_LEN ( \ (MBEDTLS_SSL_IN_CONTENT_LEN > MBEDTLS_SSL_OUT_CONTENT_LEN) \ ? ( MBEDTLS_SSL_OUT_CONTENT_LEN ) \ : ( MBEDTLS_SSL_IN_CONTENT_LEN ) \ ) /* * Check that we obey the standard's message size bounds */ #if MBEDTLS_SSL_MAX_CONTENT_LEN > 16384 #error "Bad configuration - record content too large." #endif #if MBEDTLS_SSL_IN_CONTENT_LEN > MBEDTLS_SSL_MAX_CONTENT_LEN #error "Bad configuration - incoming record content should not be larger than MBEDTLS_SSL_MAX_CONTENT_LEN." #endif #if MBEDTLS_SSL_OUT_CONTENT_LEN > MBEDTLS_SSL_MAX_CONTENT_LEN #error "Bad configuration - outgoing record content should not be larger than MBEDTLS_SSL_MAX_CONTENT_LEN." #endif #if MBEDTLS_SSL_IN_PAYLOAD_LEN > MBEDTLS_SSL_MAX_CONTENT_LEN + 2048 #error "Bad configuration - incoming protected record payload too large." #endif #if MBEDTLS_SSL_OUT_PAYLOAD_LEN > MBEDTLS_SSL_MAX_CONTENT_LEN + 2048 #error "Bad configuration - outgoing protected record payload too large." #endif /* Calculate buffer sizes */ /* Note: Even though the TLS record header is only 5 bytes long, we're internally using 8 bytes to store the implicit sequence number. */ #define MBEDTLS_SSL_HEADER_LEN 13 #define MBEDTLS_SSL_IN_BUFFER_LEN \ ( ( MBEDTLS_SSL_HEADER_LEN ) + ( MBEDTLS_SSL_IN_PAYLOAD_LEN ) ) #define MBEDTLS_SSL_OUT_BUFFER_LEN \ ( ( MBEDTLS_SSL_HEADER_LEN ) + ( MBEDTLS_SSL_OUT_PAYLOAD_LEN ) ) #ifdef MBEDTLS_ZLIB_SUPPORT /* Compression buffer holds both IN and OUT buffers, so should be size of the larger */ #define MBEDTLS_SSL_COMPRESS_BUFFER_LEN ( \ ( MBEDTLS_SSL_IN_BUFFER_LEN > MBEDTLS_SSL_OUT_BUFFER_LEN ) \ ? MBEDTLS_SSL_IN_BUFFER_LEN \ : MBEDTLS_SSL_OUT_BUFFER_LEN \ ) #endif /* * TLS extension flags (for extensions with outgoing ServerHello content * that need it (e.g. for RENEGOTIATION_INFO the server already knows because * of state of the renegotiation flag, so no indicator is required) */ #define MBEDTLS_TLS_EXT_SUPPORTED_POINT_FORMATS_PRESENT (1 << 0) #define MBEDTLS_TLS_EXT_ECJPAKE_KKPP_OK (1 << 1) #ifdef __cplusplus extern "C" { #endif #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \ defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED) /* * Abstraction for a grid of allowed signature-hash-algorithm pairs. */ struct mbedtls_ssl_sig_hash_set_t { /* At the moment, we only need to remember a single suitable * hash algorithm per signature algorithm. As long as that's * the case - and we don't need a general lookup function - * we can implement the sig-hash-set as a map from signatures * to hash algorithms. */ mbedtls_md_type_t rsa; mbedtls_md_type_t ecdsa; }; #endif /* MBEDTLS_SSL_PROTO_TLS1_2 && MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED */ /* * This structure contains the parameters only needed during handshake. */ struct mbedtls_ssl_handshake_params { /* * Handshake specific crypto variables */ #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \ defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED) mbedtls_ssl_sig_hash_set_t hash_algs; /*!< Set of suitable sig-hash pairs */ #endif #if defined(MBEDTLS_DHM_C) mbedtls_dhm_context dhm_ctx; /*!< DHM key exchange */ #endif #if defined(MBEDTLS_ECDH_C) mbedtls_ecdh_context ecdh_ctx; /*!< ECDH key exchange */ #endif #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) mbedtls_ecjpake_context ecjpake_ctx; /*!< EC J-PAKE key exchange */ #if defined(MBEDTLS_SSL_CLI_C) unsigned char *ecjpake_cache; /*!< Cache for ClientHello ext */ size_t ecjpake_cache_len; /*!< Length of cached data */ #endif #endif /* MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED */ #if defined(MBEDTLS_ECDH_C) || defined(MBEDTLS_ECDSA_C) || \ defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) const mbedtls_ecp_curve_info **curves; /*!< Supported elliptic curves */ #endif #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED) unsigned char *psk; /*!< PSK from the callback */ size_t psk_len; /*!< Length of PSK from callback */ #endif #if defined(MBEDTLS_X509_CRT_PARSE_C) mbedtls_ssl_key_cert *key_cert; /*!< chosen key/cert pair (server) */ #if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION) int sni_authmode; /*!< authmode from SNI callback */ mbedtls_ssl_key_cert *sni_key_cert; /*!< key/cert list from SNI */ mbedtls_x509_crt *sni_ca_chain; /*!< trusted CAs from SNI callback */ mbedtls_x509_crl *sni_ca_crl; /*!< trusted CAs CRLs from SNI */ #endif /* MBEDTLS_SSL_SERVER_NAME_INDICATION */ #endif /* MBEDTLS_X509_CRT_PARSE_C */ #if defined(MBEDTLS_SSL__ECP_RESTARTABLE) int ecrs_enabled; /*!< Handshake supports EC restart? */ mbedtls_x509_crt_restart_ctx ecrs_ctx; /*!< restart context */ enum { /* this complements ssl->state with info on intra-state operations */ ssl_ecrs_none = 0, /*!< nothing going on (yet) */ ssl_ecrs_crt_verify, /*!< Certificate: crt_verify() */ ssl_ecrs_ske_start_processing, /*!< ServerKeyExchange: pk_verify() */ ssl_ecrs_cke_ecdh_calc_secret, /*!< ClientKeyExchange: ECDH step 2 */ ssl_ecrs_crt_vrfy_sign, /*!< CertificateVerify: pk_sign() */ } ecrs_state; /*!< current (or last) operation */ size_t ecrs_n; /*!< place for saving a length */ #endif #if defined(MBEDTLS_SSL_PROTO_DTLS) unsigned int out_msg_seq; /*!< Outgoing handshake sequence number */ unsigned int in_msg_seq; /*!< Incoming handshake sequence number */ unsigned char *verify_cookie; /*!< Cli: HelloVerifyRequest cookie Srv: unused */ unsigned char verify_cookie_len; /*!< Cli: cookie length Srv: flag for sending a cookie */ uint32_t retransmit_timeout; /*!< Current value of timeout */ unsigned char retransmit_state; /*!< Retransmission state */ mbedtls_ssl_flight_item *flight; /*!< Current outgoing flight */ mbedtls_ssl_flight_item *cur_msg; /*!< Current message in flight */ unsigned char *cur_msg_p; /*!< Position in current message */ unsigned int in_flight_start_seq; /*!< Minimum message sequence in the flight being received */ mbedtls_ssl_transform *alt_transform_out; /*!< Alternative transform for resending messages */ unsigned char alt_out_ctr[8]; /*!< Alternative record epoch/counter for resending messages */ struct { size_t total_bytes_buffered; /*!< Cumulative size of heap allocated * buffers used for message buffering. */ uint8_t seen_ccs; /*!< Indicates if a CCS message has * been seen in the current flight. */ struct mbedtls_ssl_hs_buffer { unsigned is_valid : 1; unsigned is_fragmented : 1; unsigned is_complete : 1; unsigned char *data; size_t data_len; } hs[MBEDTLS_SSL_MAX_BUFFERED_HS]; struct { unsigned char *data; size_t len; unsigned epoch; } future_record; } buffering; uint16_t mtu; /*!< Handshake mtu, used to fragment outgoing messages */ #endif /* MBEDTLS_SSL_PROTO_DTLS */ /* * Checksum contexts */ #if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \ defined(MBEDTLS_SSL_PROTO_TLS1_1) mbedtls_md5_context fin_md5; mbedtls_sha1_context fin_sha1; #endif #if defined(MBEDTLS_SSL_PROTO_TLS1_2) #if defined(MBEDTLS_SHA256_C) mbedtls_sha256_context fin_sha256; #endif #if defined(MBEDTLS_SHA512_C) mbedtls_sha512_context fin_sha512; #endif #endif /* MBEDTLS_SSL_PROTO_TLS1_2 */ void (*update_checksum)(mbedtls_ssl_context *, const unsigned char *, size_t); void (*calc_verify)(mbedtls_ssl_context *, unsigned char *); void (*calc_finished)(mbedtls_ssl_context *, unsigned char *, int); int (*tls_prf)(const unsigned char *, size_t, const char *, const unsigned char *, size_t, unsigned char *, size_t); size_t pmslen; /*!< premaster length */ unsigned char randbytes[64]; /*!< random bytes */ unsigned char premaster[MBEDTLS_PREMASTER_SIZE]; /*!< premaster secret */ int resume; /*!< session resume indicator*/ int max_major_ver; /*!< max. major version client*/ int max_minor_ver; /*!< max. minor version client*/ int cli_exts; /*!< client extension presence*/ #if defined(MBEDTLS_SSL_SESSION_TICKETS) int new_session_ticket; /*!< use NewSessionTicket? */ #endif /* MBEDTLS_SSL_SESSION_TICKETS */ #if defined(MBEDTLS_SSL_EXTENDED_MASTER_SECRET) int extended_ms; /*!< use Extended Master Secret? */ #endif #if defined(MBEDTLS_SSL_ASYNC_PRIVATE) unsigned int async_in_progress : 1; /*!< an asynchronous operation is in progress */ #endif /* MBEDTLS_SSL_ASYNC_PRIVATE */ #if defined(MBEDTLS_SSL_ASYNC_PRIVATE) /** Asynchronous operation context. This field is meant for use by the * asynchronous operation callbacks (mbedtls_ssl_config::f_async_sign_start, * mbedtls_ssl_config::f_async_decrypt_start, * mbedtls_ssl_config::f_async_resume, mbedtls_ssl_config::f_async_cancel). * The library does not use it internally. */ void *user_async_ctx; #endif /* MBEDTLS_SSL_ASYNC_PRIVATE */ }; typedef struct mbedtls_ssl_hs_buffer mbedtls_ssl_hs_buffer; /* * This structure contains a full set of runtime transform parameters * either in negotiation or active. */ struct mbedtls_ssl_transform { /* * Session specific crypto layer */ const mbedtls_ssl_ciphersuite_t *ciphersuite_info; /*!< Chosen cipersuite_info */ unsigned int keylen; /*!< symmetric key length (bytes) */ size_t minlen; /*!< min. ciphertext length */ size_t ivlen; /*!< IV length */ size_t fixed_ivlen; /*!< Fixed part of IV (AEAD) */ size_t maclen; /*!< MAC length */ unsigned char iv_enc[16]; /*!< IV (encryption) */ unsigned char iv_dec[16]; /*!< IV (decryption) */ #if defined(MBEDTLS_SSL_PROTO_SSL3) /* Needed only for SSL v3.0 secret */ unsigned char mac_enc[20]; /*!< SSL v3.0 secret (enc) */ unsigned char mac_dec[20]; /*!< SSL v3.0 secret (dec) */ #endif /* MBEDTLS_SSL_PROTO_SSL3 */ mbedtls_md_context_t md_ctx_enc; /*!< MAC (encryption) */ mbedtls_md_context_t md_ctx_dec; /*!< MAC (decryption) */ mbedtls_cipher_context_t cipher_ctx_enc; /*!< encryption context */ mbedtls_cipher_context_t cipher_ctx_dec; /*!< decryption context */ /* * Session specific compression layer */ #if defined(MBEDTLS_ZLIB_SUPPORT) z_stream ctx_deflate; /*!< compression context */ z_stream ctx_inflate; /*!< decompression context */ #endif }; #if defined(MBEDTLS_X509_CRT_PARSE_C) /* * List of certificate + private key pairs */ struct mbedtls_ssl_key_cert { mbedtls_x509_crt *cert; /*!< cert */ mbedtls_pk_context *key; /*!< private key */ mbedtls_ssl_key_cert *next; /*!< next key/cert pair */ }; #endif /* MBEDTLS_X509_CRT_PARSE_C */ #if defined(MBEDTLS_SSL_PROTO_DTLS) /* * List of handshake messages kept around for resending */ struct mbedtls_ssl_flight_item { unsigned char *p; /*!< message, including handshake headers */ size_t len; /*!< length of p */ unsigned char type; /*!< type of the message: handshake or CCS */ mbedtls_ssl_flight_item *next; /*!< next handshake message(s) */ }; #endif /* MBEDTLS_SSL_PROTO_DTLS */ #if defined(MBEDTLS_SSL_PROTO_TLS1_2) && \ defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED) /* Find an entry in a signature-hash set matching a given hash algorithm. */ mbedtls_md_type_t mbedtls_ssl_sig_hash_set_find( mbedtls_ssl_sig_hash_set_t *set, mbedtls_pk_type_t sig_alg ); /* Add a signature-hash-pair to a signature-hash set */ void mbedtls_ssl_sig_hash_set_add( mbedtls_ssl_sig_hash_set_t *set, mbedtls_pk_type_t sig_alg, mbedtls_md_type_t md_alg ); /* Allow exactly one hash algorithm for each signature. */ void mbedtls_ssl_sig_hash_set_const_hash( mbedtls_ssl_sig_hash_set_t *set, mbedtls_md_type_t md_alg ); /* Setup an empty signature-hash set */ static inline void mbedtls_ssl_sig_hash_set_init( mbedtls_ssl_sig_hash_set_t *set ) { mbedtls_ssl_sig_hash_set_const_hash( set, MBEDTLS_MD_NONE ); } #endif /* MBEDTLS_SSL_PROTO_TLS1_2) && MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED */ /** * \brief Free referenced items in an SSL transform context and clear * memory * * \param transform SSL transform context */ void mbedtls_ssl_transform_free( mbedtls_ssl_transform *transform ); /** * \brief Free referenced items in an SSL handshake context and clear * memory * * \param ssl SSL context */ void mbedtls_ssl_handshake_free( mbedtls_ssl_context *ssl ); int mbedtls_ssl_handshake_client_step( mbedtls_ssl_context *ssl ); int mbedtls_ssl_handshake_server_step( mbedtls_ssl_context *ssl ); void mbedtls_ssl_handshake_wrapup( mbedtls_ssl_context *ssl ); int mbedtls_ssl_send_fatal_handshake_failure( mbedtls_ssl_context *ssl ); void mbedtls_ssl_reset_checksum( mbedtls_ssl_context *ssl ); int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl ); int mbedtls_ssl_handle_message_type( mbedtls_ssl_context *ssl ); int mbedtls_ssl_prepare_handshake_record( mbedtls_ssl_context *ssl ); void mbedtls_ssl_update_handshake_status( mbedtls_ssl_context *ssl ); /** * \brief Update record layer * * This function roughly separates the implementation * of the logic of (D)TLS from the implementation * of the secure transport. * * \param ssl The SSL context to use. * \param update_hs_digest This indicates if the handshake digest * should be automatically updated in case * a handshake message is found. * * \return 0 or non-zero error code. * * \note A clarification on what is called 'record layer' here * is in order, as many sensible definitions are possible: * * The record layer takes as input an untrusted underlying * transport (stream or datagram) and transforms it into * a serially multiplexed, secure transport, which * conceptually provides the following: * * (1) Three datagram based, content-agnostic transports * for handshake, alert and CCS messages. * (2) One stream- or datagram-based transport * for application data. * (3) Functionality for changing the underlying transform * securing the contents. * * The interface to this functionality is given as follows: * * a Updating * [Currently implemented by mbedtls_ssl_read_record] * * Check if and on which of the four 'ports' data is pending: * Nothing, a controlling datagram of type (1), or application * data (2). In any case data is present, internal buffers * provide access to the data for the user to process it. * Consumption of type (1) datagrams is done automatically * on the next update, invalidating that the internal buffers * for previous datagrams, while consumption of application * data (2) is user-controlled. * * b Reading of application data * [Currently manual adaption of ssl->in_offt pointer] * * As mentioned in the last paragraph, consumption of data * is different from the automatic consumption of control * datagrams (1) because application data is treated as a stream. * * c Tracking availability of application data * [Currently manually through decreasing ssl->in_msglen] * * For efficiency and to retain datagram semantics for * application data in case of DTLS, the record layer * provides functionality for checking how much application * data is still available in the internal buffer. * * d Changing the transformation securing the communication. * * Given an opaque implementation of the record layer in the * above sense, it should be possible to implement the logic * of (D)TLS on top of it without the need to know anything * about the record layer's internals. This is done e.g. * in all the handshake handling functions, and in the * application data reading function mbedtls_ssl_read. * * \note The above tries to give a conceptual picture of the * record layer, but the current implementation deviates * from it in some places. For example, our implementation of * the update functionality through mbedtls_ssl_read_record * discards datagrams depending on the current state, which * wouldn't fall under the record layer's responsibility * following the above definition. * */ int mbedtls_ssl_read_record( mbedtls_ssl_context *ssl, unsigned update_hs_digest ); int mbedtls_ssl_fetch_input( mbedtls_ssl_context *ssl, size_t nb_want ); int mbedtls_ssl_write_handshake_msg( mbedtls_ssl_context *ssl ); int mbedtls_ssl_write_record( mbedtls_ssl_context *ssl, uint8_t force_flush ); int mbedtls_ssl_flush_output( mbedtls_ssl_context *ssl ); int mbedtls_ssl_parse_certificate( mbedtls_ssl_context *ssl ); int mbedtls_ssl_write_certificate( mbedtls_ssl_context *ssl ); int mbedtls_ssl_parse_change_cipher_spec( mbedtls_ssl_context *ssl ); int mbedtls_ssl_write_change_cipher_spec( mbedtls_ssl_context *ssl ); int mbedtls_ssl_parse_finished( mbedtls_ssl_context *ssl ); int mbedtls_ssl_write_finished( mbedtls_ssl_context *ssl ); void mbedtls_ssl_optimize_checksum( mbedtls_ssl_context *ssl, const mbedtls_ssl_ciphersuite_t *ciphersuite_info ); #if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED) int mbedtls_ssl_psk_derive_premaster( mbedtls_ssl_context *ssl, mbedtls_key_exchange_type_t key_ex ); #endif #if defined(MBEDTLS_PK_C) unsigned char mbedtls_ssl_sig_from_pk( mbedtls_pk_context *pk ); unsigned char mbedtls_ssl_sig_from_pk_alg( mbedtls_pk_type_t type ); mbedtls_pk_type_t mbedtls_ssl_pk_alg_from_sig( unsigned char sig ); #endif mbedtls_md_type_t mbedtls_ssl_md_alg_from_hash( unsigned char hash ); unsigned char mbedtls_ssl_hash_from_md_alg( int md ); int mbedtls_ssl_set_calc_verify_md( mbedtls_ssl_context *ssl, int md ); #if defined(MBEDTLS_ECP_C) int mbedtls_ssl_check_curve( const mbedtls_ssl_context *ssl, mbedtls_ecp_group_id grp_id ); #endif #if defined(MBEDTLS_KEY_EXCHANGE__WITH_CERT__ENABLED) int mbedtls_ssl_check_sig_hash( const mbedtls_ssl_context *ssl, mbedtls_md_type_t md ); #endif #if defined(MBEDTLS_X509_CRT_PARSE_C) static inline mbedtls_pk_context *mbedtls_ssl_own_key( mbedtls_ssl_context *ssl ) { mbedtls_ssl_key_cert *key_cert; if( ssl->handshake != NULL && ssl->handshake->key_cert != NULL ) key_cert = ssl->handshake->key_cert; else key_cert = ssl->conf->key_cert; return( key_cert == NULL ? NULL : key_cert->key ); } static inline mbedtls_x509_crt *mbedtls_ssl_own_cert( mbedtls_ssl_context *ssl ) { mbedtls_ssl_key_cert *key_cert; if( ssl->handshake != NULL && ssl->handshake->key_cert != NULL ) key_cert = ssl->handshake->key_cert; else key_cert = ssl->conf->key_cert; return( key_cert == NULL ? NULL : key_cert->cert ); } /* * Check usage of a certificate wrt extensions: * keyUsage, extendedKeyUsage (later), and nSCertType (later). * * Warning: cert_endpoint is the endpoint of the cert (ie, of our peer when we * check a cert we received from them)! * * Return 0 if everything is OK, -1 if not. */ int mbedtls_ssl_check_cert_usage( const mbedtls_x509_crt *cert, const mbedtls_ssl_ciphersuite_t *ciphersuite, int cert_endpoint, uint32_t *flags ); #endif /* MBEDTLS_X509_CRT_PARSE_C */ void mbedtls_ssl_write_version( int major, int minor, int transport, unsigned char ver[2] ); void mbedtls_ssl_read_version( int *major, int *minor, int transport, const unsigned char ver[2] ); static inline size_t mbedtls_ssl_hdr_len( const mbedtls_ssl_context *ssl ) { #if defined(MBEDTLS_SSL_PROTO_DTLS) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) return( 13 ); #else ((void) ssl); #endif return( 5 ); } static inline size_t mbedtls_ssl_hs_hdr_len( const mbedtls_ssl_context *ssl ) { #if defined(MBEDTLS_SSL_PROTO_DTLS) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) return( 12 ); #else ((void) ssl); #endif return( 4 ); } #if defined(MBEDTLS_SSL_PROTO_DTLS) void mbedtls_ssl_send_flight_completed( mbedtls_ssl_context *ssl ); void mbedtls_ssl_recv_flight_completed( mbedtls_ssl_context *ssl ); int mbedtls_ssl_resend( mbedtls_ssl_context *ssl ); int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl ); #endif /* Visible for testing purposes only */ #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY) int mbedtls_ssl_dtls_replay_check( mbedtls_ssl_context *ssl ); void mbedtls_ssl_dtls_replay_update( mbedtls_ssl_context *ssl ); #endif /* constant-time buffer comparison */ static inline int mbedtls_ssl_safer_memcmp( const void *a, const void *b, size_t n ) { size_t i; volatile const unsigned char *A = (volatile const unsigned char *) a; volatile const unsigned char *B = (volatile const unsigned char *) b; volatile unsigned char diff = 0; for( i = 0; i < n; i++ ) { /* Read volatile data in order before computing diff. * This avoids IAR compiler warning: * 'the order of volatile accesses is undefined ..' */ unsigned char x = A[i], y = B[i]; diff |= x ^ y; } return( diff ); } #if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \ defined(MBEDTLS_SSL_PROTO_TLS1_1) int mbedtls_ssl_get_key_exchange_md_ssl_tls( mbedtls_ssl_context *ssl, unsigned char *output, unsigned char *data, size_t data_len ); #endif /* MBEDTLS_SSL_PROTO_SSL3 || MBEDTLS_SSL_PROTO_TLS1 || \ MBEDTLS_SSL_PROTO_TLS1_1 */ #if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1) || \ defined(MBEDTLS_SSL_PROTO_TLS1_2) int mbedtls_ssl_get_key_exchange_md_tls1_2( mbedtls_ssl_context *ssl, unsigned char *hash, size_t *hashlen, unsigned char *data, size_t data_len, mbedtls_md_type_t md_alg ); #endif /* MBEDTLS_SSL_PROTO_TLS1 || MBEDTLS_SSL_PROTO_TLS1_1 || \ MBEDTLS_SSL_PROTO_TLS1_2 */ #ifdef __cplusplus } #endif #endif /* ssl_internal.h */
okamstudio/godot
thirdparty/mbedtls/include/mbedtls/ssl_internal.h
C
mit
30,804
[ 30522, 1013, 1008, 1008, 1008, 1032, 5371, 7020, 2140, 1035, 4722, 1012, 1044, 1008, 1008, 1032, 4766, 4722, 4972, 4207, 2011, 1996, 7020, 2140, 14184, 1008, 1013, 1013, 1008, 1008, 9385, 1006, 1039, 1007, 2294, 1011, 2325, 1010, 2849, 31...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
#!/usr/bin/env sh set -ex SCRIPT_DIR=$(dirname $(readlink -f "$0")) WPT_ROOT=$(readlink -f $SCRIPT_DIR/../..) cd $WPT_ROOT main() { cd css if [ -z $VENV ]; then VENV=tools/_virtualenv fi # Create the virtualenv if [ ! -d $VENV ]; then if [ -z $PYTHON ]; then command -v python if [ $? -eq 0 ]; then if [ `python -c 'import sys; print(sys.version[0:3])'` == "2.7" ]; then PYTHON=python fi fi fi if [ -z $PYTHON ]; then command -v python2 if [ $? -eq 0 ]; then PYTHON=python2 fi fi if [ -z $PYTHON ]; then echo "Please ensure Python 2.7 is installed" exit 1 fi virtualenv -p $PYTHON $VENV || { echo "Please ensure virtualenv is installed"; exit 2; } fi # Install dependencies $VENV/bin/pip install -r requirements.txt # Fetch hg submodules if they're not there if [ ! -d tools/apiclient ]; then $VENV/bin/hg clone https://hg.csswg.org/dev/apiclient tools/apiclient fi if [ ! -d tools/w3ctestlib ]; then $VENV/bin/hg clone https://hg.csswg.org/dev/w3ctestlib tools/w3ctestlib fi # Run the build script $VENV/bin/python tools/build.py "$@" } main
thiagopnts/servo
tests/wpt/web-platform-tests/css/build-css-testsuites.sh
Shell
mpl-2.0
1,359
[ 30522, 1001, 999, 1013, 2149, 2099, 1013, 8026, 1013, 4372, 2615, 14021, 2275, 1011, 4654, 5896, 1035, 16101, 1027, 1002, 1006, 16101, 18442, 1002, 1006, 3191, 13767, 1011, 1042, 1000, 1002, 1014, 1000, 1007, 1007, 1059, 13876, 1035, 7117, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
# # MIT License # # Copyright (c) 2016 Paul Taylor # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # module PPool class BasicProcessController def initialize @time_started = Time.now.to_i end def running? return true end def num_processes return 1 end def process_started(pid, num_processes) puts "> process started #{pid}; num_processes #{num_processes}" end def run_process info "#{Process.pid} running" exit 0 end def process_ended(pid, status) puts "> process ended - pid #{pid}, status #{status}" end def progress(stats) puts "> active #{stats[:active_processes]} started #{stats[:processes_started]} ended #{stats[:processes_ended]} errors #{stats[:errors]}" end def delay return 0.1 end def info(m) puts "+ #{m}" end def time_running secs = time_running_secs hours = (secs / (60 * 60)) % 24 mins = (secs / 60) % 60 secs = secs % 60 return "%.2d:%.2d:%.2d" % [hours, mins,secs] end def time_running_secs Time.now.to_i - @time_started end end end
ptaylor/ppool
lib/basic_process_controller.rb
Ruby
mit
2,168
[ 30522, 1001, 1001, 10210, 6105, 1001, 1001, 9385, 1006, 1039, 1007, 2355, 2703, 4202, 1001, 1001, 6656, 2003, 2182, 3762, 4379, 1010, 2489, 1997, 3715, 1010, 2000, 2151, 2711, 11381, 1037, 6100, 1001, 1997, 2023, 4007, 1998, 3378, 12653, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
Imports System Imports System.Reflection Imports 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. ' Review the values of the assembly attributes <Assembly: AssemblyTitle("Bespoke OSC Demo Receiver")> <Assembly: AssemblyDescription("Bespoke OSC Demo Receiver")> <Assembly: AssemblyCompany("Bespoke Software")> <Assembly: AssemblyProduct("Bespoke OSC Demo Receiver")> <Assembly: AssemblyCopyright("Copyright © Bespoke Software 2008-2012")> <Assembly: AssemblyTrademark("")> <Assembly: ComVisible(False)> 'The following GUID is for the ID of the typelib if this project is exposed to COM <Assembly: Guid("8daba8a0-0078-46a1-a3c7-ad68bdfa160e")> ' 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("5.0.0.0")> <Assembly: AssemblyFileVersion("5.0.0.0")>
SublanTV/CasparsPlayoutClient
libs/OscFramework_2.0/Source Code/Samples/OscDemo/VB/Receiver/My Project/AssemblyInfo.vb
Visual Basic
gpl-3.0
1,230
[ 30522, 17589, 2291, 17589, 2291, 1012, 9185, 17589, 2291, 1012, 2448, 7292, 1012, 6970, 11923, 2121, 7903, 2229, 1005, 2236, 2592, 2055, 2019, 3320, 2003, 4758, 2083, 1996, 2206, 1005, 2275, 1997, 12332, 1012, 2689, 2122, 17961, 5300, 2000,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<?php require_once __DIR__.'/Autoloader.php'; ?> <?php spl_autoload_register('Autoloader::loader'); ?> <?php class Employee { private $employee_id; private $employee_firstname; private $employee_lastname; private $employee_username; private $employee_password; private $hash; private $employee_email; private $employee_home_address; private $employee_role; private $date_of_employment; private $still_working; private $phone_number; public function __construct($employee_firstname, $employee_lastname, $employee_username, $employee_password,$hash, $employee_email, $employee_home_address, $employee_role, $date_of_employment, $still_working,$phone_number) { global $db; $this->employee_firstname = mysqli_real_escape_string($db->connection,$employee_firstname); $this->employee_lastname = mysqli_real_escape_string($db->connection,$employee_lastname); $this->employee_username = mysqli_real_escape_string($db->connection,$employee_username); $this->employee_password = mysqli_real_escape_string($db->connection,$employee_password); $this->hash = mysqli_real_escape_string($db->connection, $hash); $this->employee_email = mysqli_real_escape_string($db->connection,$employee_email); $this->employee_home_address = mysqli_real_escape_string($db->connection,$employee_home_address); $this->employee_role = mysqli_real_escape_string($db->connection,$employee_role); $this->date_of_employment = mysqli_real_escape_string($db->connection,$date_of_employment); $this->still_working = mysqli_real_escape_string($db->connection,$still_working); $this->phone_number = mysqli_real_escape_string($db->connection,$phone_number); } // --------------------------------- GETTERS ----------------------------------------------- public function getEmployeeId() { return $this->employee_id; } public function getEmployeeFirstname() { return $this->employee_firstname; } public function getEmployeeLastname() { return $this->employee_lastname; } public function getEmployeeUsername() { return $this->employee_username; } public function getEmployeePassword() { return $this->employee_password; } public function getEmployeeHash() { return $this->hash; } public function getEmployeeEmail() { return $this->employee_email; } public function getEmployeeHomeAdress() { return $this->employee_home_address; } public function getEmployeeRole() { return $this->employee_role; } public function getEmployeeDateOfEmployment() { return $this->date_of_employment; } public function getStillWorking() { return $this->still_working; } public function getPhoneNumber() { return $this->phone_number; } // ------------------------------------------------ SETTERS ------------------------------------------------------------- public function setEmployeeFirstname($employee_firstname) { $this->employee_firstname = $employee_firstname; } public function setEmployeeLastname($employee_lastname) { $this->employee_lastname = $employee_lastname; } public function setEmployeeUsername($employee_username) { $this->employee_username = $employee_username; } public function setEmployeePassword($employee_password) { $this->employee_password = $employee_password; } public function setEmployeeEmail($employee_email) { $this->employee_email = $employee_email; } public function setEmployeeHomeAddress($employee_home_address) { $this->employee_home_address = $employee_home_address; } public function setEmployeeRole($employee_role) { $this->employee_role = $employee_role; } public function setEmployeeDateOfEmployment($date_of_employment) { $this->date_of_employment = $date_of_employment; } public function setStillWorking($still_working) { $this->still_working = $still_working; } public function setPhoneNumber($phone_number) { $this->phone_number = $phone_number; } public function cleanInput($data) { trim($data); mysqli_real_escape_string($db->connection,$data); } //$date = new DateTime(); // $emp_01 = new Employee('Nenad', 'Mirkovic', 'nena91', 'nena91', 'nena91@example.com', '11.oktobar 60', 'Web Developer', $date->setDate(2016, 8, 16), '202-555-1775'); // // $emp_01->getEmployeeId(); }
nexon91/employee-project
employee_project/classes/Employee.php
PHP
mit
4,612
[ 30522, 1026, 1029, 25718, 5478, 1035, 2320, 1035, 1035, 16101, 1035, 1035, 1012, 1005, 1013, 8285, 11066, 2121, 1012, 25718, 1005, 1025, 1029, 1028, 1026, 1029, 25718, 11867, 2140, 1035, 8285, 11066, 1035, 4236, 1006, 1005, 8285, 11066, 212...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
// // HMAppDelegate.h // 网易新闻 // // Created by apple on 14-7-25. // Copyright (c) 2014年 heima. All rights reserved. // #import <UIKit/UIKit.h> @interface HMAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
OSzhou/MyTestDemo
网易新闻/网易新闻/Classes/Other/HMAppDelegate.h
C
apache-2.0
277
[ 30522, 1013, 1013, 1013, 1013, 20287, 29098, 9247, 29107, 2618, 1012, 1044, 1013, 1013, 100, 100, 1862, 100, 1013, 1013, 1013, 1013, 2580, 2011, 6207, 2006, 2403, 1011, 1021, 1011, 2423, 1012, 1013, 1013, 9385, 1006, 1039, 1007, 2297, 184...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/cloudtrail/CloudTrail_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace CloudTrail { namespace Model { /** * <p>A single selector statement in an advanced event selector.</p><p><h3>See * Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/cloudtrail-2013-11-01/AdvancedFieldSelector">AWS * API Reference</a></p> */ class AWS_CLOUDTRAIL_API AdvancedFieldSelector { public: AdvancedFieldSelector(); AdvancedFieldSelector(Aws::Utils::Json::JsonView jsonValue); AdvancedFieldSelector& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p> A field in an event record on which to filter events to be logged. Supported * fields include <code>readOnly</code>, <code>eventCategory</code>, * <code>eventSource</code> (for management events), <code>eventName</code>, * <code>resources.type</code>, and <code>resources.ARN</code>. </p> <ul> <li> <p> * <b> <code>readOnly</code> </b> - Optional. Can be set to <code>Equals</code> a * value of <code>true</code> or <code>false</code>. If you do not add this field, * CloudTrail logs both both <code>read</code> and <code>write</code> events. A * value of <code>true</code> logs only <code>read</code> events. A value of * <code>false</code> logs only <code>write</code> events.</p> </li> <li> <p> <b> * <code>eventSource</code> </b> - For filtering management events only. This can * be set only to <code>NotEquals</code> <code>kms.amazonaws.com</code>.</p> </li> * <li> <p> <b> <code>eventName</code> </b> - Can use any operator. You can use it * to filter in or filter out any data event logged to CloudTrail, such as * <code>PutBucket</code> or <code>GetSnapshotBlock</code>. You can have multiple * values for this field, separated by commas.</p> </li> <li> <p> <b> * <code>eventCategory</code> </b> - This is required. It must be set to * <code>Equals</code>, and the value must be <code>Management</code> or * <code>Data</code>.</p> </li> <li> <p> <b> <code>resources.type</code> </b> - * This field is required. <code>resources.type</code> can only use the * <code>Equals</code> operator, and the value can be one of the following:</p> * <ul> <li> <p> <code>AWS::S3::Object</code> </p> </li> <li> <p> * <code>AWS::Lambda::Function</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Table</code> </p> </li> <li> <p> * <code>AWS::S3Outposts::Object</code> </p> </li> <li> <p> * <code>AWS::ManagedBlockchain::Node</code> </p> </li> <li> <p> * <code>AWS::S3ObjectLambda::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::EC2::Snapshot</code> </p> </li> <li> <p> * <code>AWS::S3::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Stream</code> </p> </li> <li> <p> * <code>AWS::Glue::Table</code> </p> </li> </ul> <p> You can have only one * <code>resources.type</code> field per selector. To log data events on more than * one resource type, add another selector.</p> </li> <li> <p> <b> * <code>resources.ARN</code> </b> - You can use any operator with * <code>resources.ARN</code>, but if you use <code>Equals</code> or * <code>NotEquals</code>, the value must exactly match the ARN of a valid resource * of the type you've specified in the template as the value of resources.type. For * example, if resources.type equals <code>AWS::S3::Object</code>, the ARN must be * in one of the following formats. To log all data events for all objects in a * specific S3 bucket, use the <code>StartsWith</code> operator, and include only * the bucket ARN as the matching value.</p> <p>The trailing slash is intentional; * do not exclude it. Replace the text between less than and greater than symbols * (&lt;&gt;) with resource-specific information. </p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/</code> </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/&lt;object_path&gt;/</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in one of the * following formats. To log events on all objects in an S3 access point, we * recommend that you use only the access point ARN, don’t include the object path, * and use the <code>StartsWith</code> or <code>NotStartsWith</code> operators.</p> * <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;/object/&lt;object_path&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::Lambda::Function</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:lambda:&lt;region&gt;:&lt;account_ID&gt;:function:&lt;function_name&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::DynamoDB::Table</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3Outposts::Object</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-outposts:&lt;region&gt;:&lt;account_ID&gt;:&lt;object_path&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::ManagedBlockchain::Node</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:managedblockchain:&lt;region&gt;:&lt;account_ID&gt;:nodes/&lt;node_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3ObjectLambda::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-object-lambda:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::EC2::Snapshot</code>, and the operator is set to <code>Equals</code> * or <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> * <li> <p> * <code>arn:&lt;partition&gt;:ec2:&lt;region&gt;::snapshot/&lt;snapshot_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::DynamoDB::Stream</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;/stream/&lt;date_time&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::Glue::Table</code>, and the operator is set to <code>Equals</code> or * <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> <li> * <p> * <code>arn:&lt;partition&gt;:glue:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;database_name&gt;/&lt;table_name&gt;</code> * </p> </li> </ul> </li> </ul> */ inline const Aws::String& GetField() const{ return m_field; } /** * <p> A field in an event record on which to filter events to be logged. Supported * fields include <code>readOnly</code>, <code>eventCategory</code>, * <code>eventSource</code> (for management events), <code>eventName</code>, * <code>resources.type</code>, and <code>resources.ARN</code>. </p> <ul> <li> <p> * <b> <code>readOnly</code> </b> - Optional. Can be set to <code>Equals</code> a * value of <code>true</code> or <code>false</code>. If you do not add this field, * CloudTrail logs both both <code>read</code> and <code>write</code> events. A * value of <code>true</code> logs only <code>read</code> events. A value of * <code>false</code> logs only <code>write</code> events.</p> </li> <li> <p> <b> * <code>eventSource</code> </b> - For filtering management events only. This can * be set only to <code>NotEquals</code> <code>kms.amazonaws.com</code>.</p> </li> * <li> <p> <b> <code>eventName</code> </b> - Can use any operator. You can use it * to filter in or filter out any data event logged to CloudTrail, such as * <code>PutBucket</code> or <code>GetSnapshotBlock</code>. You can have multiple * values for this field, separated by commas.</p> </li> <li> <p> <b> * <code>eventCategory</code> </b> - This is required. It must be set to * <code>Equals</code>, and the value must be <code>Management</code> or * <code>Data</code>.</p> </li> <li> <p> <b> <code>resources.type</code> </b> - * This field is required. <code>resources.type</code> can only use the * <code>Equals</code> operator, and the value can be one of the following:</p> * <ul> <li> <p> <code>AWS::S3::Object</code> </p> </li> <li> <p> * <code>AWS::Lambda::Function</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Table</code> </p> </li> <li> <p> * <code>AWS::S3Outposts::Object</code> </p> </li> <li> <p> * <code>AWS::ManagedBlockchain::Node</code> </p> </li> <li> <p> * <code>AWS::S3ObjectLambda::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::EC2::Snapshot</code> </p> </li> <li> <p> * <code>AWS::S3::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Stream</code> </p> </li> <li> <p> * <code>AWS::Glue::Table</code> </p> </li> </ul> <p> You can have only one * <code>resources.type</code> field per selector. To log data events on more than * one resource type, add another selector.</p> </li> <li> <p> <b> * <code>resources.ARN</code> </b> - You can use any operator with * <code>resources.ARN</code>, but if you use <code>Equals</code> or * <code>NotEquals</code>, the value must exactly match the ARN of a valid resource * of the type you've specified in the template as the value of resources.type. For * example, if resources.type equals <code>AWS::S3::Object</code>, the ARN must be * in one of the following formats. To log all data events for all objects in a * specific S3 bucket, use the <code>StartsWith</code> operator, and include only * the bucket ARN as the matching value.</p> <p>The trailing slash is intentional; * do not exclude it. Replace the text between less than and greater than symbols * (&lt;&gt;) with resource-specific information. </p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/</code> </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/&lt;object_path&gt;/</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in one of the * following formats. To log events on all objects in an S3 access point, we * recommend that you use only the access point ARN, don’t include the object path, * and use the <code>StartsWith</code> or <code>NotStartsWith</code> operators.</p> * <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;/object/&lt;object_path&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::Lambda::Function</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:lambda:&lt;region&gt;:&lt;account_ID&gt;:function:&lt;function_name&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::DynamoDB::Table</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3Outposts::Object</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-outposts:&lt;region&gt;:&lt;account_ID&gt;:&lt;object_path&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::ManagedBlockchain::Node</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:managedblockchain:&lt;region&gt;:&lt;account_ID&gt;:nodes/&lt;node_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3ObjectLambda::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-object-lambda:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::EC2::Snapshot</code>, and the operator is set to <code>Equals</code> * or <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> * <li> <p> * <code>arn:&lt;partition&gt;:ec2:&lt;region&gt;::snapshot/&lt;snapshot_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::DynamoDB::Stream</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;/stream/&lt;date_time&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::Glue::Table</code>, and the operator is set to <code>Equals</code> or * <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> <li> * <p> * <code>arn:&lt;partition&gt;:glue:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;database_name&gt;/&lt;table_name&gt;</code> * </p> </li> </ul> </li> </ul> */ inline bool FieldHasBeenSet() const { return m_fieldHasBeenSet; } /** * <p> A field in an event record on which to filter events to be logged. Supported * fields include <code>readOnly</code>, <code>eventCategory</code>, * <code>eventSource</code> (for management events), <code>eventName</code>, * <code>resources.type</code>, and <code>resources.ARN</code>. </p> <ul> <li> <p> * <b> <code>readOnly</code> </b> - Optional. Can be set to <code>Equals</code> a * value of <code>true</code> or <code>false</code>. If you do not add this field, * CloudTrail logs both both <code>read</code> and <code>write</code> events. A * value of <code>true</code> logs only <code>read</code> events. A value of * <code>false</code> logs only <code>write</code> events.</p> </li> <li> <p> <b> * <code>eventSource</code> </b> - For filtering management events only. This can * be set only to <code>NotEquals</code> <code>kms.amazonaws.com</code>.</p> </li> * <li> <p> <b> <code>eventName</code> </b> - Can use any operator. You can use it * to filter in or filter out any data event logged to CloudTrail, such as * <code>PutBucket</code> or <code>GetSnapshotBlock</code>. You can have multiple * values for this field, separated by commas.</p> </li> <li> <p> <b> * <code>eventCategory</code> </b> - This is required. It must be set to * <code>Equals</code>, and the value must be <code>Management</code> or * <code>Data</code>.</p> </li> <li> <p> <b> <code>resources.type</code> </b> - * This field is required. <code>resources.type</code> can only use the * <code>Equals</code> operator, and the value can be one of the following:</p> * <ul> <li> <p> <code>AWS::S3::Object</code> </p> </li> <li> <p> * <code>AWS::Lambda::Function</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Table</code> </p> </li> <li> <p> * <code>AWS::S3Outposts::Object</code> </p> </li> <li> <p> * <code>AWS::ManagedBlockchain::Node</code> </p> </li> <li> <p> * <code>AWS::S3ObjectLambda::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::EC2::Snapshot</code> </p> </li> <li> <p> * <code>AWS::S3::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Stream</code> </p> </li> <li> <p> * <code>AWS::Glue::Table</code> </p> </li> </ul> <p> You can have only one * <code>resources.type</code> field per selector. To log data events on more than * one resource type, add another selector.</p> </li> <li> <p> <b> * <code>resources.ARN</code> </b> - You can use any operator with * <code>resources.ARN</code>, but if you use <code>Equals</code> or * <code>NotEquals</code>, the value must exactly match the ARN of a valid resource * of the type you've specified in the template as the value of resources.type. For * example, if resources.type equals <code>AWS::S3::Object</code>, the ARN must be * in one of the following formats. To log all data events for all objects in a * specific S3 bucket, use the <code>StartsWith</code> operator, and include only * the bucket ARN as the matching value.</p> <p>The trailing slash is intentional; * do not exclude it. Replace the text between less than and greater than symbols * (&lt;&gt;) with resource-specific information. </p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/</code> </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/&lt;object_path&gt;/</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in one of the * following formats. To log events on all objects in an S3 access point, we * recommend that you use only the access point ARN, don’t include the object path, * and use the <code>StartsWith</code> or <code>NotStartsWith</code> operators.</p> * <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;/object/&lt;object_path&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::Lambda::Function</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:lambda:&lt;region&gt;:&lt;account_ID&gt;:function:&lt;function_name&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::DynamoDB::Table</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3Outposts::Object</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-outposts:&lt;region&gt;:&lt;account_ID&gt;:&lt;object_path&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::ManagedBlockchain::Node</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:managedblockchain:&lt;region&gt;:&lt;account_ID&gt;:nodes/&lt;node_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3ObjectLambda::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-object-lambda:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::EC2::Snapshot</code>, and the operator is set to <code>Equals</code> * or <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> * <li> <p> * <code>arn:&lt;partition&gt;:ec2:&lt;region&gt;::snapshot/&lt;snapshot_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::DynamoDB::Stream</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;/stream/&lt;date_time&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::Glue::Table</code>, and the operator is set to <code>Equals</code> or * <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> <li> * <p> * <code>arn:&lt;partition&gt;:glue:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;database_name&gt;/&lt;table_name&gt;</code> * </p> </li> </ul> </li> </ul> */ inline void SetField(const Aws::String& value) { m_fieldHasBeenSet = true; m_field = value; } /** * <p> A field in an event record on which to filter events to be logged. Supported * fields include <code>readOnly</code>, <code>eventCategory</code>, * <code>eventSource</code> (for management events), <code>eventName</code>, * <code>resources.type</code>, and <code>resources.ARN</code>. </p> <ul> <li> <p> * <b> <code>readOnly</code> </b> - Optional. Can be set to <code>Equals</code> a * value of <code>true</code> or <code>false</code>. If you do not add this field, * CloudTrail logs both both <code>read</code> and <code>write</code> events. A * value of <code>true</code> logs only <code>read</code> events. A value of * <code>false</code> logs only <code>write</code> events.</p> </li> <li> <p> <b> * <code>eventSource</code> </b> - For filtering management events only. This can * be set only to <code>NotEquals</code> <code>kms.amazonaws.com</code>.</p> </li> * <li> <p> <b> <code>eventName</code> </b> - Can use any operator. You can use it * to filter in or filter out any data event logged to CloudTrail, such as * <code>PutBucket</code> or <code>GetSnapshotBlock</code>. You can have multiple * values for this field, separated by commas.</p> </li> <li> <p> <b> * <code>eventCategory</code> </b> - This is required. It must be set to * <code>Equals</code>, and the value must be <code>Management</code> or * <code>Data</code>.</p> </li> <li> <p> <b> <code>resources.type</code> </b> - * This field is required. <code>resources.type</code> can only use the * <code>Equals</code> operator, and the value can be one of the following:</p> * <ul> <li> <p> <code>AWS::S3::Object</code> </p> </li> <li> <p> * <code>AWS::Lambda::Function</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Table</code> </p> </li> <li> <p> * <code>AWS::S3Outposts::Object</code> </p> </li> <li> <p> * <code>AWS::ManagedBlockchain::Node</code> </p> </li> <li> <p> * <code>AWS::S3ObjectLambda::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::EC2::Snapshot</code> </p> </li> <li> <p> * <code>AWS::S3::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Stream</code> </p> </li> <li> <p> * <code>AWS::Glue::Table</code> </p> </li> </ul> <p> You can have only one * <code>resources.type</code> field per selector. To log data events on more than * one resource type, add another selector.</p> </li> <li> <p> <b> * <code>resources.ARN</code> </b> - You can use any operator with * <code>resources.ARN</code>, but if you use <code>Equals</code> or * <code>NotEquals</code>, the value must exactly match the ARN of a valid resource * of the type you've specified in the template as the value of resources.type. For * example, if resources.type equals <code>AWS::S3::Object</code>, the ARN must be * in one of the following formats. To log all data events for all objects in a * specific S3 bucket, use the <code>StartsWith</code> operator, and include only * the bucket ARN as the matching value.</p> <p>The trailing slash is intentional; * do not exclude it. Replace the text between less than and greater than symbols * (&lt;&gt;) with resource-specific information. </p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/</code> </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/&lt;object_path&gt;/</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in one of the * following formats. To log events on all objects in an S3 access point, we * recommend that you use only the access point ARN, don’t include the object path, * and use the <code>StartsWith</code> or <code>NotStartsWith</code> operators.</p> * <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;/object/&lt;object_path&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::Lambda::Function</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:lambda:&lt;region&gt;:&lt;account_ID&gt;:function:&lt;function_name&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::DynamoDB::Table</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3Outposts::Object</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-outposts:&lt;region&gt;:&lt;account_ID&gt;:&lt;object_path&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::ManagedBlockchain::Node</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:managedblockchain:&lt;region&gt;:&lt;account_ID&gt;:nodes/&lt;node_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3ObjectLambda::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-object-lambda:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::EC2::Snapshot</code>, and the operator is set to <code>Equals</code> * or <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> * <li> <p> * <code>arn:&lt;partition&gt;:ec2:&lt;region&gt;::snapshot/&lt;snapshot_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::DynamoDB::Stream</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;/stream/&lt;date_time&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::Glue::Table</code>, and the operator is set to <code>Equals</code> or * <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> <li> * <p> * <code>arn:&lt;partition&gt;:glue:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;database_name&gt;/&lt;table_name&gt;</code> * </p> </li> </ul> </li> </ul> */ inline void SetField(Aws::String&& value) { m_fieldHasBeenSet = true; m_field = std::move(value); } /** * <p> A field in an event record on which to filter events to be logged. Supported * fields include <code>readOnly</code>, <code>eventCategory</code>, * <code>eventSource</code> (for management events), <code>eventName</code>, * <code>resources.type</code>, and <code>resources.ARN</code>. </p> <ul> <li> <p> * <b> <code>readOnly</code> </b> - Optional. Can be set to <code>Equals</code> a * value of <code>true</code> or <code>false</code>. If you do not add this field, * CloudTrail logs both both <code>read</code> and <code>write</code> events. A * value of <code>true</code> logs only <code>read</code> events. A value of * <code>false</code> logs only <code>write</code> events.</p> </li> <li> <p> <b> * <code>eventSource</code> </b> - For filtering management events only. This can * be set only to <code>NotEquals</code> <code>kms.amazonaws.com</code>.</p> </li> * <li> <p> <b> <code>eventName</code> </b> - Can use any operator. You can use it * to filter in or filter out any data event logged to CloudTrail, such as * <code>PutBucket</code> or <code>GetSnapshotBlock</code>. You can have multiple * values for this field, separated by commas.</p> </li> <li> <p> <b> * <code>eventCategory</code> </b> - This is required. It must be set to * <code>Equals</code>, and the value must be <code>Management</code> or * <code>Data</code>.</p> </li> <li> <p> <b> <code>resources.type</code> </b> - * This field is required. <code>resources.type</code> can only use the * <code>Equals</code> operator, and the value can be one of the following:</p> * <ul> <li> <p> <code>AWS::S3::Object</code> </p> </li> <li> <p> * <code>AWS::Lambda::Function</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Table</code> </p> </li> <li> <p> * <code>AWS::S3Outposts::Object</code> </p> </li> <li> <p> * <code>AWS::ManagedBlockchain::Node</code> </p> </li> <li> <p> * <code>AWS::S3ObjectLambda::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::EC2::Snapshot</code> </p> </li> <li> <p> * <code>AWS::S3::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Stream</code> </p> </li> <li> <p> * <code>AWS::Glue::Table</code> </p> </li> </ul> <p> You can have only one * <code>resources.type</code> field per selector. To log data events on more than * one resource type, add another selector.</p> </li> <li> <p> <b> * <code>resources.ARN</code> </b> - You can use any operator with * <code>resources.ARN</code>, but if you use <code>Equals</code> or * <code>NotEquals</code>, the value must exactly match the ARN of a valid resource * of the type you've specified in the template as the value of resources.type. For * example, if resources.type equals <code>AWS::S3::Object</code>, the ARN must be * in one of the following formats. To log all data events for all objects in a * specific S3 bucket, use the <code>StartsWith</code> operator, and include only * the bucket ARN as the matching value.</p> <p>The trailing slash is intentional; * do not exclude it. Replace the text between less than and greater than symbols * (&lt;&gt;) with resource-specific information. </p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/</code> </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/&lt;object_path&gt;/</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in one of the * following formats. To log events on all objects in an S3 access point, we * recommend that you use only the access point ARN, don’t include the object path, * and use the <code>StartsWith</code> or <code>NotStartsWith</code> operators.</p> * <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;/object/&lt;object_path&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::Lambda::Function</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:lambda:&lt;region&gt;:&lt;account_ID&gt;:function:&lt;function_name&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::DynamoDB::Table</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3Outposts::Object</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-outposts:&lt;region&gt;:&lt;account_ID&gt;:&lt;object_path&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::ManagedBlockchain::Node</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:managedblockchain:&lt;region&gt;:&lt;account_ID&gt;:nodes/&lt;node_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3ObjectLambda::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-object-lambda:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::EC2::Snapshot</code>, and the operator is set to <code>Equals</code> * or <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> * <li> <p> * <code>arn:&lt;partition&gt;:ec2:&lt;region&gt;::snapshot/&lt;snapshot_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::DynamoDB::Stream</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;/stream/&lt;date_time&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::Glue::Table</code>, and the operator is set to <code>Equals</code> or * <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> <li> * <p> * <code>arn:&lt;partition&gt;:glue:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;database_name&gt;/&lt;table_name&gt;</code> * </p> </li> </ul> </li> </ul> */ inline void SetField(const char* value) { m_fieldHasBeenSet = true; m_field.assign(value); } /** * <p> A field in an event record on which to filter events to be logged. Supported * fields include <code>readOnly</code>, <code>eventCategory</code>, * <code>eventSource</code> (for management events), <code>eventName</code>, * <code>resources.type</code>, and <code>resources.ARN</code>. </p> <ul> <li> <p> * <b> <code>readOnly</code> </b> - Optional. Can be set to <code>Equals</code> a * value of <code>true</code> or <code>false</code>. If you do not add this field, * CloudTrail logs both both <code>read</code> and <code>write</code> events. A * value of <code>true</code> logs only <code>read</code> events. A value of * <code>false</code> logs only <code>write</code> events.</p> </li> <li> <p> <b> * <code>eventSource</code> </b> - For filtering management events only. This can * be set only to <code>NotEquals</code> <code>kms.amazonaws.com</code>.</p> </li> * <li> <p> <b> <code>eventName</code> </b> - Can use any operator. You can use it * to filter in or filter out any data event logged to CloudTrail, such as * <code>PutBucket</code> or <code>GetSnapshotBlock</code>. You can have multiple * values for this field, separated by commas.</p> </li> <li> <p> <b> * <code>eventCategory</code> </b> - This is required. It must be set to * <code>Equals</code>, and the value must be <code>Management</code> or * <code>Data</code>.</p> </li> <li> <p> <b> <code>resources.type</code> </b> - * This field is required. <code>resources.type</code> can only use the * <code>Equals</code> operator, and the value can be one of the following:</p> * <ul> <li> <p> <code>AWS::S3::Object</code> </p> </li> <li> <p> * <code>AWS::Lambda::Function</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Table</code> </p> </li> <li> <p> * <code>AWS::S3Outposts::Object</code> </p> </li> <li> <p> * <code>AWS::ManagedBlockchain::Node</code> </p> </li> <li> <p> * <code>AWS::S3ObjectLambda::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::EC2::Snapshot</code> </p> </li> <li> <p> * <code>AWS::S3::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Stream</code> </p> </li> <li> <p> * <code>AWS::Glue::Table</code> </p> </li> </ul> <p> You can have only one * <code>resources.type</code> field per selector. To log data events on more than * one resource type, add another selector.</p> </li> <li> <p> <b> * <code>resources.ARN</code> </b> - You can use any operator with * <code>resources.ARN</code>, but if you use <code>Equals</code> or * <code>NotEquals</code>, the value must exactly match the ARN of a valid resource * of the type you've specified in the template as the value of resources.type. For * example, if resources.type equals <code>AWS::S3::Object</code>, the ARN must be * in one of the following formats. To log all data events for all objects in a * specific S3 bucket, use the <code>StartsWith</code> operator, and include only * the bucket ARN as the matching value.</p> <p>The trailing slash is intentional; * do not exclude it. Replace the text between less than and greater than symbols * (&lt;&gt;) with resource-specific information. </p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/</code> </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/&lt;object_path&gt;/</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in one of the * following formats. To log events on all objects in an S3 access point, we * recommend that you use only the access point ARN, don’t include the object path, * and use the <code>StartsWith</code> or <code>NotStartsWith</code> operators.</p> * <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;/object/&lt;object_path&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::Lambda::Function</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:lambda:&lt;region&gt;:&lt;account_ID&gt;:function:&lt;function_name&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::DynamoDB::Table</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3Outposts::Object</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-outposts:&lt;region&gt;:&lt;account_ID&gt;:&lt;object_path&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::ManagedBlockchain::Node</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:managedblockchain:&lt;region&gt;:&lt;account_ID&gt;:nodes/&lt;node_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3ObjectLambda::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-object-lambda:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::EC2::Snapshot</code>, and the operator is set to <code>Equals</code> * or <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> * <li> <p> * <code>arn:&lt;partition&gt;:ec2:&lt;region&gt;::snapshot/&lt;snapshot_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::DynamoDB::Stream</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;/stream/&lt;date_time&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::Glue::Table</code>, and the operator is set to <code>Equals</code> or * <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> <li> * <p> * <code>arn:&lt;partition&gt;:glue:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;database_name&gt;/&lt;table_name&gt;</code> * </p> </li> </ul> </li> </ul> */ inline AdvancedFieldSelector& WithField(const Aws::String& value) { SetField(value); return *this;} /** * <p> A field in an event record on which to filter events to be logged. Supported * fields include <code>readOnly</code>, <code>eventCategory</code>, * <code>eventSource</code> (for management events), <code>eventName</code>, * <code>resources.type</code>, and <code>resources.ARN</code>. </p> <ul> <li> <p> * <b> <code>readOnly</code> </b> - Optional. Can be set to <code>Equals</code> a * value of <code>true</code> or <code>false</code>. If you do not add this field, * CloudTrail logs both both <code>read</code> and <code>write</code> events. A * value of <code>true</code> logs only <code>read</code> events. A value of * <code>false</code> logs only <code>write</code> events.</p> </li> <li> <p> <b> * <code>eventSource</code> </b> - For filtering management events only. This can * be set only to <code>NotEquals</code> <code>kms.amazonaws.com</code>.</p> </li> * <li> <p> <b> <code>eventName</code> </b> - Can use any operator. You can use it * to filter in or filter out any data event logged to CloudTrail, such as * <code>PutBucket</code> or <code>GetSnapshotBlock</code>. You can have multiple * values for this field, separated by commas.</p> </li> <li> <p> <b> * <code>eventCategory</code> </b> - This is required. It must be set to * <code>Equals</code>, and the value must be <code>Management</code> or * <code>Data</code>.</p> </li> <li> <p> <b> <code>resources.type</code> </b> - * This field is required. <code>resources.type</code> can only use the * <code>Equals</code> operator, and the value can be one of the following:</p> * <ul> <li> <p> <code>AWS::S3::Object</code> </p> </li> <li> <p> * <code>AWS::Lambda::Function</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Table</code> </p> </li> <li> <p> * <code>AWS::S3Outposts::Object</code> </p> </li> <li> <p> * <code>AWS::ManagedBlockchain::Node</code> </p> </li> <li> <p> * <code>AWS::S3ObjectLambda::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::EC2::Snapshot</code> </p> </li> <li> <p> * <code>AWS::S3::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Stream</code> </p> </li> <li> <p> * <code>AWS::Glue::Table</code> </p> </li> </ul> <p> You can have only one * <code>resources.type</code> field per selector. To log data events on more than * one resource type, add another selector.</p> </li> <li> <p> <b> * <code>resources.ARN</code> </b> - You can use any operator with * <code>resources.ARN</code>, but if you use <code>Equals</code> or * <code>NotEquals</code>, the value must exactly match the ARN of a valid resource * of the type you've specified in the template as the value of resources.type. For * example, if resources.type equals <code>AWS::S3::Object</code>, the ARN must be * in one of the following formats. To log all data events for all objects in a * specific S3 bucket, use the <code>StartsWith</code> operator, and include only * the bucket ARN as the matching value.</p> <p>The trailing slash is intentional; * do not exclude it. Replace the text between less than and greater than symbols * (&lt;&gt;) with resource-specific information. </p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/</code> </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/&lt;object_path&gt;/</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in one of the * following formats. To log events on all objects in an S3 access point, we * recommend that you use only the access point ARN, don’t include the object path, * and use the <code>StartsWith</code> or <code>NotStartsWith</code> operators.</p> * <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;/object/&lt;object_path&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::Lambda::Function</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:lambda:&lt;region&gt;:&lt;account_ID&gt;:function:&lt;function_name&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::DynamoDB::Table</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3Outposts::Object</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-outposts:&lt;region&gt;:&lt;account_ID&gt;:&lt;object_path&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::ManagedBlockchain::Node</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:managedblockchain:&lt;region&gt;:&lt;account_ID&gt;:nodes/&lt;node_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3ObjectLambda::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-object-lambda:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::EC2::Snapshot</code>, and the operator is set to <code>Equals</code> * or <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> * <li> <p> * <code>arn:&lt;partition&gt;:ec2:&lt;region&gt;::snapshot/&lt;snapshot_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::DynamoDB::Stream</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;/stream/&lt;date_time&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::Glue::Table</code>, and the operator is set to <code>Equals</code> or * <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> <li> * <p> * <code>arn:&lt;partition&gt;:glue:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;database_name&gt;/&lt;table_name&gt;</code> * </p> </li> </ul> </li> </ul> */ inline AdvancedFieldSelector& WithField(Aws::String&& value) { SetField(std::move(value)); return *this;} /** * <p> A field in an event record on which to filter events to be logged. Supported * fields include <code>readOnly</code>, <code>eventCategory</code>, * <code>eventSource</code> (for management events), <code>eventName</code>, * <code>resources.type</code>, and <code>resources.ARN</code>. </p> <ul> <li> <p> * <b> <code>readOnly</code> </b> - Optional. Can be set to <code>Equals</code> a * value of <code>true</code> or <code>false</code>. If you do not add this field, * CloudTrail logs both both <code>read</code> and <code>write</code> events. A * value of <code>true</code> logs only <code>read</code> events. A value of * <code>false</code> logs only <code>write</code> events.</p> </li> <li> <p> <b> * <code>eventSource</code> </b> - For filtering management events only. This can * be set only to <code>NotEquals</code> <code>kms.amazonaws.com</code>.</p> </li> * <li> <p> <b> <code>eventName</code> </b> - Can use any operator. You can use it * to filter in or filter out any data event logged to CloudTrail, such as * <code>PutBucket</code> or <code>GetSnapshotBlock</code>. You can have multiple * values for this field, separated by commas.</p> </li> <li> <p> <b> * <code>eventCategory</code> </b> - This is required. It must be set to * <code>Equals</code>, and the value must be <code>Management</code> or * <code>Data</code>.</p> </li> <li> <p> <b> <code>resources.type</code> </b> - * This field is required. <code>resources.type</code> can only use the * <code>Equals</code> operator, and the value can be one of the following:</p> * <ul> <li> <p> <code>AWS::S3::Object</code> </p> </li> <li> <p> * <code>AWS::Lambda::Function</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Table</code> </p> </li> <li> <p> * <code>AWS::S3Outposts::Object</code> </p> </li> <li> <p> * <code>AWS::ManagedBlockchain::Node</code> </p> </li> <li> <p> * <code>AWS::S3ObjectLambda::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::EC2::Snapshot</code> </p> </li> <li> <p> * <code>AWS::S3::AccessPoint</code> </p> </li> <li> <p> * <code>AWS::DynamoDB::Stream</code> </p> </li> <li> <p> * <code>AWS::Glue::Table</code> </p> </li> </ul> <p> You can have only one * <code>resources.type</code> field per selector. To log data events on more than * one resource type, add another selector.</p> </li> <li> <p> <b> * <code>resources.ARN</code> </b> - You can use any operator with * <code>resources.ARN</code>, but if you use <code>Equals</code> or * <code>NotEquals</code>, the value must exactly match the ARN of a valid resource * of the type you've specified in the template as the value of resources.type. For * example, if resources.type equals <code>AWS::S3::Object</code>, the ARN must be * in one of the following formats. To log all data events for all objects in a * specific S3 bucket, use the <code>StartsWith</code> operator, and include only * the bucket ARN as the matching value.</p> <p>The trailing slash is intentional; * do not exclude it. Replace the text between less than and greater than symbols * (&lt;&gt;) with resource-specific information. </p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/</code> </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:::&lt;bucket_name&gt;/&lt;object_path&gt;/</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in one of the * following formats. To log events on all objects in an S3 access point, we * recommend that you use only the access point ARN, don’t include the object path, * and use the <code>StartsWith</code> or <code>NotStartsWith</code> operators.</p> * <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> <li> <p> * <code>arn:&lt;partition&gt;:s3:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;/object/&lt;object_path&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::Lambda::Function</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:lambda:&lt;region&gt;:&lt;account_ID&gt;:function:&lt;function_name&gt;</code> * </p> </li> </ul> <p>When resources.type equals * <code>AWS::DynamoDB::Table</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3Outposts::Object</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-outposts:&lt;region&gt;:&lt;account_ID&gt;:&lt;object_path&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::ManagedBlockchain::Node</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:managedblockchain:&lt;region&gt;:&lt;account_ID&gt;:nodes/&lt;node_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::S3ObjectLambda::AccessPoint</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:s3-object-lambda:&lt;region&gt;:&lt;account_ID&gt;:accesspoint/&lt;access_point_name&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::EC2::Snapshot</code>, and the operator is set to <code>Equals</code> * or <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> * <li> <p> * <code>arn:&lt;partition&gt;:ec2:&lt;region&gt;::snapshot/&lt;snapshot_ID&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::DynamoDB::Stream</code>, and the operator is set to * <code>Equals</code> or <code>NotEquals</code>, the ARN must be in the following * format:</p> <ul> <li> <p> * <code>arn:&lt;partition&gt;:dynamodb:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;table_name&gt;/stream/&lt;date_time&gt;</code> * </p> </li> </ul> <p>When <code>resources.type</code> equals * <code>AWS::Glue::Table</code>, and the operator is set to <code>Equals</code> or * <code>NotEquals</code>, the ARN must be in the following format:</p> <ul> <li> * <p> * <code>arn:&lt;partition&gt;:glue:&lt;region&gt;:&lt;account_ID&gt;:table/&lt;database_name&gt;/&lt;table_name&gt;</code> * </p> </li> </ul> </li> </ul> */ inline AdvancedFieldSelector& WithField(const char* value) { SetField(value); return *this;} /** * <p> An operator that includes events that match the exact value of the event * record field specified as the value of <code>Field</code>. This is the only * valid operator that you can use with the <code>readOnly</code>, * <code>eventCategory</code>, and <code>resources.type</code> fields.</p> */ inline const Aws::Vector<Aws::String>& GetEquals() const{ return m_equals; } /** * <p> An operator that includes events that match the exact value of the event * record field specified as the value of <code>Field</code>. This is the only * valid operator that you can use with the <code>readOnly</code>, * <code>eventCategory</code>, and <code>resources.type</code> fields.</p> */ inline bool EqualsHasBeenSet() const { return m_equalsHasBeenSet; } /** * <p> An operator that includes events that match the exact value of the event * record field specified as the value of <code>Field</code>. This is the only * valid operator that you can use with the <code>readOnly</code>, * <code>eventCategory</code>, and <code>resources.type</code> fields.</p> */ inline void SetEquals(const Aws::Vector<Aws::String>& value) { m_equalsHasBeenSet = true; m_equals = value; } /** * <p> An operator that includes events that match the exact value of the event * record field specified as the value of <code>Field</code>. This is the only * valid operator that you can use with the <code>readOnly</code>, * <code>eventCategory</code>, and <code>resources.type</code> fields.</p> */ inline void SetEquals(Aws::Vector<Aws::String>&& value) { m_equalsHasBeenSet = true; m_equals = std::move(value); } /** * <p> An operator that includes events that match the exact value of the event * record field specified as the value of <code>Field</code>. This is the only * valid operator that you can use with the <code>readOnly</code>, * <code>eventCategory</code>, and <code>resources.type</code> fields.</p> */ inline AdvancedFieldSelector& WithEquals(const Aws::Vector<Aws::String>& value) { SetEquals(value); return *this;} /** * <p> An operator that includes events that match the exact value of the event * record field specified as the value of <code>Field</code>. This is the only * valid operator that you can use with the <code>readOnly</code>, * <code>eventCategory</code>, and <code>resources.type</code> fields.</p> */ inline AdvancedFieldSelector& WithEquals(Aws::Vector<Aws::String>&& value) { SetEquals(std::move(value)); return *this;} /** * <p> An operator that includes events that match the exact value of the event * record field specified as the value of <code>Field</code>. This is the only * valid operator that you can use with the <code>readOnly</code>, * <code>eventCategory</code>, and <code>resources.type</code> fields.</p> */ inline AdvancedFieldSelector& AddEquals(const Aws::String& value) { m_equalsHasBeenSet = true; m_equals.push_back(value); return *this; } /** * <p> An operator that includes events that match the exact value of the event * record field specified as the value of <code>Field</code>. This is the only * valid operator that you can use with the <code>readOnly</code>, * <code>eventCategory</code>, and <code>resources.type</code> fields.</p> */ inline AdvancedFieldSelector& AddEquals(Aws::String&& value) { m_equalsHasBeenSet = true; m_equals.push_back(std::move(value)); return *this; } /** * <p> An operator that includes events that match the exact value of the event * record field specified as the value of <code>Field</code>. This is the only * valid operator that you can use with the <code>readOnly</code>, * <code>eventCategory</code>, and <code>resources.type</code> fields.</p> */ inline AdvancedFieldSelector& AddEquals(const char* value) { m_equalsHasBeenSet = true; m_equals.push_back(value); return *this; } /** * <p>An operator that includes events that match the first few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline const Aws::Vector<Aws::String>& GetStartsWith() const{ return m_startsWith; } /** * <p>An operator that includes events that match the first few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline bool StartsWithHasBeenSet() const { return m_startsWithHasBeenSet; } /** * <p>An operator that includes events that match the first few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline void SetStartsWith(const Aws::Vector<Aws::String>& value) { m_startsWithHasBeenSet = true; m_startsWith = value; } /** * <p>An operator that includes events that match the first few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline void SetStartsWith(Aws::Vector<Aws::String>&& value) { m_startsWithHasBeenSet = true; m_startsWith = std::move(value); } /** * <p>An operator that includes events that match the first few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline AdvancedFieldSelector& WithStartsWith(const Aws::Vector<Aws::String>& value) { SetStartsWith(value); return *this;} /** * <p>An operator that includes events that match the first few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline AdvancedFieldSelector& WithStartsWith(Aws::Vector<Aws::String>&& value) { SetStartsWith(std::move(value)); return *this;} /** * <p>An operator that includes events that match the first few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline AdvancedFieldSelector& AddStartsWith(const Aws::String& value) { m_startsWithHasBeenSet = true; m_startsWith.push_back(value); return *this; } /** * <p>An operator that includes events that match the first few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline AdvancedFieldSelector& AddStartsWith(Aws::String&& value) { m_startsWithHasBeenSet = true; m_startsWith.push_back(std::move(value)); return *this; } /** * <p>An operator that includes events that match the first few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline AdvancedFieldSelector& AddStartsWith(const char* value) { m_startsWithHasBeenSet = true; m_startsWith.push_back(value); return *this; } /** * <p>An operator that includes events that match the last few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline const Aws::Vector<Aws::String>& GetEndsWith() const{ return m_endsWith; } /** * <p>An operator that includes events that match the last few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline bool EndsWithHasBeenSet() const { return m_endsWithHasBeenSet; } /** * <p>An operator that includes events that match the last few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline void SetEndsWith(const Aws::Vector<Aws::String>& value) { m_endsWithHasBeenSet = true; m_endsWith = value; } /** * <p>An operator that includes events that match the last few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline void SetEndsWith(Aws::Vector<Aws::String>&& value) { m_endsWithHasBeenSet = true; m_endsWith = std::move(value); } /** * <p>An operator that includes events that match the last few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline AdvancedFieldSelector& WithEndsWith(const Aws::Vector<Aws::String>& value) { SetEndsWith(value); return *this;} /** * <p>An operator that includes events that match the last few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline AdvancedFieldSelector& WithEndsWith(Aws::Vector<Aws::String>&& value) { SetEndsWith(std::move(value)); return *this;} /** * <p>An operator that includes events that match the last few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline AdvancedFieldSelector& AddEndsWith(const Aws::String& value) { m_endsWithHasBeenSet = true; m_endsWith.push_back(value); return *this; } /** * <p>An operator that includes events that match the last few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline AdvancedFieldSelector& AddEndsWith(Aws::String&& value) { m_endsWithHasBeenSet = true; m_endsWith.push_back(std::move(value)); return *this; } /** * <p>An operator that includes events that match the last few characters of the * event record field specified as the value of <code>Field</code>.</p> */ inline AdvancedFieldSelector& AddEndsWith(const char* value) { m_endsWithHasBeenSet = true; m_endsWith.push_back(value); return *this; } /** * <p> An operator that excludes events that match the exact value of the event * record field specified as the value of <code>Field</code>. </p> */ inline const Aws::Vector<Aws::String>& GetNotEquals() const{ return m_notEquals; } /** * <p> An operator that excludes events that match the exact value of the event * record field specified as the value of <code>Field</code>. </p> */ inline bool NotEqualsHasBeenSet() const { return m_notEqualsHasBeenSet; } /** * <p> An operator that excludes events that match the exact value of the event * record field specified as the value of <code>Field</code>. </p> */ inline void SetNotEquals(const Aws::Vector<Aws::String>& value) { m_notEqualsHasBeenSet = true; m_notEquals = value; } /** * <p> An operator that excludes events that match the exact value of the event * record field specified as the value of <code>Field</code>. </p> */ inline void SetNotEquals(Aws::Vector<Aws::String>&& value) { m_notEqualsHasBeenSet = true; m_notEquals = std::move(value); } /** * <p> An operator that excludes events that match the exact value of the event * record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& WithNotEquals(const Aws::Vector<Aws::String>& value) { SetNotEquals(value); return *this;} /** * <p> An operator that excludes events that match the exact value of the event * record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& WithNotEquals(Aws::Vector<Aws::String>&& value) { SetNotEquals(std::move(value)); return *this;} /** * <p> An operator that excludes events that match the exact value of the event * record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& AddNotEquals(const Aws::String& value) { m_notEqualsHasBeenSet = true; m_notEquals.push_back(value); return *this; } /** * <p> An operator that excludes events that match the exact value of the event * record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& AddNotEquals(Aws::String&& value) { m_notEqualsHasBeenSet = true; m_notEquals.push_back(std::move(value)); return *this; } /** * <p> An operator that excludes events that match the exact value of the event * record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& AddNotEquals(const char* value) { m_notEqualsHasBeenSet = true; m_notEquals.push_back(value); return *this; } /** * <p> An operator that excludes events that match the first few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline const Aws::Vector<Aws::String>& GetNotStartsWith() const{ return m_notStartsWith; } /** * <p> An operator that excludes events that match the first few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline bool NotStartsWithHasBeenSet() const { return m_notStartsWithHasBeenSet; } /** * <p> An operator that excludes events that match the first few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline void SetNotStartsWith(const Aws::Vector<Aws::String>& value) { m_notStartsWithHasBeenSet = true; m_notStartsWith = value; } /** * <p> An operator that excludes events that match the first few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline void SetNotStartsWith(Aws::Vector<Aws::String>&& value) { m_notStartsWithHasBeenSet = true; m_notStartsWith = std::move(value); } /** * <p> An operator that excludes events that match the first few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& WithNotStartsWith(const Aws::Vector<Aws::String>& value) { SetNotStartsWith(value); return *this;} /** * <p> An operator that excludes events that match the first few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& WithNotStartsWith(Aws::Vector<Aws::String>&& value) { SetNotStartsWith(std::move(value)); return *this;} /** * <p> An operator that excludes events that match the first few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& AddNotStartsWith(const Aws::String& value) { m_notStartsWithHasBeenSet = true; m_notStartsWith.push_back(value); return *this; } /** * <p> An operator that excludes events that match the first few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& AddNotStartsWith(Aws::String&& value) { m_notStartsWithHasBeenSet = true; m_notStartsWith.push_back(std::move(value)); return *this; } /** * <p> An operator that excludes events that match the first few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& AddNotStartsWith(const char* value) { m_notStartsWithHasBeenSet = true; m_notStartsWith.push_back(value); return *this; } /** * <p> An operator that excludes events that match the last few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline const Aws::Vector<Aws::String>& GetNotEndsWith() const{ return m_notEndsWith; } /** * <p> An operator that excludes events that match the last few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline bool NotEndsWithHasBeenSet() const { return m_notEndsWithHasBeenSet; } /** * <p> An operator that excludes events that match the last few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline void SetNotEndsWith(const Aws::Vector<Aws::String>& value) { m_notEndsWithHasBeenSet = true; m_notEndsWith = value; } /** * <p> An operator that excludes events that match the last few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline void SetNotEndsWith(Aws::Vector<Aws::String>&& value) { m_notEndsWithHasBeenSet = true; m_notEndsWith = std::move(value); } /** * <p> An operator that excludes events that match the last few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& WithNotEndsWith(const Aws::Vector<Aws::String>& value) { SetNotEndsWith(value); return *this;} /** * <p> An operator that excludes events that match the last few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& WithNotEndsWith(Aws::Vector<Aws::String>&& value) { SetNotEndsWith(std::move(value)); return *this;} /** * <p> An operator that excludes events that match the last few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& AddNotEndsWith(const Aws::String& value) { m_notEndsWithHasBeenSet = true; m_notEndsWith.push_back(value); return *this; } /** * <p> An operator that excludes events that match the last few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& AddNotEndsWith(Aws::String&& value) { m_notEndsWithHasBeenSet = true; m_notEndsWith.push_back(std::move(value)); return *this; } /** * <p> An operator that excludes events that match the last few characters of the * event record field specified as the value of <code>Field</code>. </p> */ inline AdvancedFieldSelector& AddNotEndsWith(const char* value) { m_notEndsWithHasBeenSet = true; m_notEndsWith.push_back(value); return *this; } private: Aws::String m_field; bool m_fieldHasBeenSet; Aws::Vector<Aws::String> m_equals; bool m_equalsHasBeenSet; Aws::Vector<Aws::String> m_startsWith; bool m_startsWithHasBeenSet; Aws::Vector<Aws::String> m_endsWith; bool m_endsWithHasBeenSet; Aws::Vector<Aws::String> m_notEquals; bool m_notEqualsHasBeenSet; Aws::Vector<Aws::String> m_notStartsWith; bool m_notStartsWithHasBeenSet; Aws::Vector<Aws::String> m_notEndsWith; bool m_notEndsWithHasBeenSet; }; } // namespace Model } // namespace CloudTrail } // namespace Aws
aws/aws-sdk-cpp
aws-cpp-sdk-cloudtrail/include/aws/cloudtrail/model/AdvancedFieldSelector.h
C
apache-2.0
78,487
[ 30522, 1013, 1008, 1008, 1008, 9385, 9733, 1012, 4012, 1010, 4297, 1012, 2030, 2049, 18460, 1012, 2035, 2916, 9235, 1012, 1008, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 15895, 1011, 1016, 1012, 1014, 1012, 1008, 1013, 1001, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Dashboard for /usr/local/bin/phpunit/php-timer</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="../css/bootstrap.min.css" rel="stylesheet"> <link href="../css/nv.d3.min.css" rel="stylesheet"> <link href="../css/style.css" rel="stylesheet"> <!--[if lt IE 9]> <script src="../js/html5shiv.min.js"></script> <script src="../js/respond.min.js"></script> <![endif]--> </head> <body> <header> <div class="container"> <div class="row"> <div class="col-md-12"> <ol class="breadcrumb"> <li><a href="../index.html">/usr/local/bin/phpunit</a></li> <li><a href="index.html">php-timer</a></li> <li class="active">(Dashboard)</li> </ol> </div> </div> </div> </header> <div class="container"> <div class="row"> <div class="col-md-12"> <h2>Classes</h2> </div> </div> <div class="row"> <div class="col-md-6"> <h3>Coverage Distribution</h3> <div id="classCoverageDistribution" style="height: 300px;"> <svg></svg> </div> </div> <div class="col-md-6"> <h3>Complexity</h3> <div id="classComplexity" style="height: 300px;"> <svg></svg> </div> </div> </div> <div class="row"> <div class="col-md-6"> <h3>Insufficient Coverage</h3> <div class="scrollbox"> <table class="table"> <thead> <tr> <th>Class</th> <th class="text-right">Coverage</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> <div class="col-md-6"> <h3>Project Risks</h3> <div class="scrollbox"> <table class="table"> <thead> <tr> <th>Class</th> <th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div> <div class="row"> <div class="col-md-12"> <h2>Methods</h2> </div> </div> <div class="row"> <div class="col-md-6"> <h3>Coverage Distribution</h3> <div id="methodCoverageDistribution" style="height: 300px;"> <svg></svg> </div> </div> <div class="col-md-6"> <h3>Complexity</h3> <div id="methodComplexity" style="height: 300px;"> <svg></svg> </div> </div> </div> <div class="row"> <div class="col-md-6"> <h3>Insufficient Coverage</h3> <div class="scrollbox"> <table class="table"> <thead> <tr> <th>Method</th> <th class="text-right">Coverage</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> <div class="col-md-6"> <h3>Project Risks</h3> <div class="scrollbox"> <table class="table"> <thead> <tr> <th>Method</th> <th class="text-right"><abbr title="Change Risk Anti-Patterns (CRAP) Index">CRAP</abbr></th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div> <footer> <hr/> <p> <small>Generated by <a href="http://github.com/sebastianbergmann/php-code-coverage" target="_top">PHP_CodeCoverage 3.0.1</a> using <a href="http://php.net/" target="_top">PHP 5.6.14-1+deb.sury.org~trusty+1</a> and <a href="http://phpunit.de/">PHPUnit 5.0.8</a> at Tue Oct 27 1:46:36 CET 2015.</small> </p> </footer> </div> <script src="../js/jquery.min.js" type="text/javascript"></script> <script src="../js/bootstrap.min.js" type="text/javascript"></script> <script src="../js/holder.min.js" type="text/javascript"></script> <script src="../js/d3.min.js" type="text/javascript"></script> <script src="../js/nv.d3.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { nv.addGraph(function() { var chart = nv.models.multiBarChart(); chart.tooltips(false) .showControls(false) .showLegend(false) .reduceXTicks(false) .staggerLabels(true) .yAxis.tickFormat(d3.format('d')); d3.select('#classCoverageDistribution svg') .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,0,0], "Class Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); return chart; }); nv.addGraph(function() { var chart = nv.models.multiBarChart(); chart.tooltips(false) .showControls(false) .showLegend(false) .reduceXTicks(false) .staggerLabels(true) .yAxis.tickFormat(d3.format('d')); d3.select('#methodCoverageDistribution svg') .datum(getCoverageDistributionData([0,0,0,0,0,0,0,0,0,0,0,0], "Method Coverage")) .transition().duration(500).call(chart); nv.utils.windowResize(chart.update); return chart; }); function getCoverageDistributionData(data, label) { var labels = [ '0%', '0-10%', '10-20%', '20-30%', '30-40%', '40-50%', '50-60%', '60-70%', '70-80%', '80-90%', '90-100%', '100%' ]; var values = []; $.each(labels, function(key) { values.push({x: labels[key], y: data[key]}); }); return [ { key: label, values: values, color: "#4572A7" } ]; } nv.addGraph(function() { var chart = nv.models.scatterChart() .showDistX(true) .showDistY(true) .showLegend(false) .forceX([0, 100]); chart.tooltipContent(function(key, y, e, graph) { return '<p>' + graph.point.class + '</p>'; }); chart.xAxis.axisLabel('Code Coverage (in percent)'); chart.yAxis.axisLabel('Cyclomatic Complexity'); d3.select('#classComplexity svg') .datum(getComplexityData([], 'Class Complexity')) .transition() .duration(500) .call(chart); nv.utils.windowResize(chart.update); return chart; }); nv.addGraph(function() { var chart = nv.models.scatterChart() .showDistX(true) .showDistY(true) .showLegend(false) .forceX([0, 100]); chart.tooltipContent(function(key, y, e, graph) { return '<p>' + graph.point.class + '</p>'; }); chart.xAxis.axisLabel('Code Coverage (in percent)'); chart.yAxis.axisLabel('Method Complexity'); d3.select('#methodComplexity svg') .datum(getComplexityData([], 'Method Complexity')) .transition() .duration(500) .call(chart); nv.utils.windowResize(chart.update); return chart; }); function getComplexityData(data, label) { var values = []; $.each(data, function(key) { var value = Math.round(data[key][0]*100) / 100; values.push({ x: value, y: data[key][1], class: data[key][2], size: 0.05, shape: 'diamond' }); }); return [ { key: label, values: values, color: "#4572A7" } ]; } }); </script> </body> </html>
fynrir/youjqtube
report/php-timer/dashboard.html
HTML
mit
7,119
[ 30522, 1026, 999, 9986, 13874, 16129, 1028, 1026, 16129, 11374, 1027, 1000, 4372, 1000, 1028, 1026, 2132, 1028, 1026, 18804, 25869, 13462, 1027, 1000, 21183, 2546, 1011, 1022, 1000, 1028, 1026, 2516, 1028, 24923, 2005, 1013, 2149, 2099, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
-- select your database first and source this file. SELECT COUNT(*) AS SESSION_NUMBER FROM user; SELECT COUNT(*) AS SESSION_WITH_REFER_NUMBER FROM user U WHERE U.refer IS NOT NULL AND U.refer != '' AND U.refer != 'null'; SELECT COUNT(*) AS VISIT_NUMBER FROM visit; SELECT COUNT(*) AS PRODUCT_VISIT_NUMBER FROM visit WHERE pagetype = 'product'; SELECT count(*) AS LAND_ON_HOMEPAGE_NUMBER FROM (SELECT U.userid, MIN(v.time), v.pagetype pt FROM user U JOIN visit V ON U.userid = V.userid WHERE U.refer IS NOT NULL AND U.refer != '' AND U.refer != 'null' GROUP BY V.userid) t WHERE pt = 'home';
kavinyao/SKBPR
basic-stat.sql
SQL
mit
596
[ 30522, 1011, 1011, 7276, 2115, 7809, 2034, 1998, 3120, 2023, 5371, 1012, 7276, 4175, 1006, 1008, 1007, 2004, 5219, 1035, 2193, 2013, 5310, 1025, 7276, 4175, 1006, 1008, 1007, 2004, 5219, 1035, 2007, 1035, 6523, 1035, 2193, 2013, 5310, 105...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...