text
stringlengths
2
99.9k
meta
dict
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:id="@+id/llWrapper" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:clickable="true" android:background="@drawable/bg_default_item"> <ImageView android:id="@+id/ivAvatar" android:layout_width="@dimen/user_profile_size" android:layout_height="@dimen/user_profile_size" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" android:layout_marginTop="8dp" android:layout_marginBottom="8dp" android:src="@drawable/default_user_profile"/> <LinearLayout android:orientation="vertical" android:layout_width="0dp" android:layout_weight="1" android:gravity="center_vertical" android:layout_height="match_parent"> <TextView android:id="@+id/tvTitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@color/default_text_color" android:textSize="14sp"/> </LinearLayout> </LinearLayout> <View android:layout_marginLeft="80dp" android:layout_width="match_parent" android:layout_height="1dp" android:background="#d9d9d9"/> </LinearLayout>
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <shelfDocument> <!-- This file contains definitions of shelves, toolbars, and tools. It should not be hand-edited when it is being used by the application. Note, that two definitions of the same element are not allowed in a single file. --> <tool name="$HDA_DEFAULT_TOOL" label="$HDA_LABEL" icon="$HDA_ICON"> <toolMenuContext name="viewer"> <contextNetType>SOP</contextNetType> </toolMenuContext> <toolMenuContext name="network"> <contextOpType>$HDA_TABLE_AND_NAME</contextOpType> </toolMenuContext> <toolSubmenu>Labs/Destruction</toolSubmenu> <script scriptType="python"><![CDATA[import soptoolutils soptoolutils.genericTool(kwargs, '$HDA_NAME')]]></script> </tool> </shelfDocument>
{ "pile_set_name": "Github" }
Command: ios hooking search classes Usage: ios hooking search classes <search string> Search for classes in the current Objective-C runtime with the search string as part of the class name. Examples: ios hooking search classes jailbreak ios hooking search classes sslpinning
{ "pile_set_name": "Github" }
""" Simple example: .. UIExample:: 70 with flx.VBox(): flx.Slider(min=10, max=20, value=12) flx.RangeSlider(min=10, max=90, value=(20, 60)) Also see examples: :ref:`sine.py`, :ref:`twente.py`, :ref:`deep_event_connections.py`. """ from ... import event from .._widget import Widget, create_element class Slider(Widget): """ An input widget to select a value in a certain range. The ``node`` of this widget is a `<div> <https://developer.mozilla.org/docs/Web/HTML/Element/div>`_ containing a few HTML elements for rendering. It does not use a ``<input type='range'>`` because of its different appearance and behaviour accross browsers. """ DEFAULT_MIN_SIZE = 40, 20 CSS = """ .flx-Slider:focus { outline: none; } .flx-Slider > .gutter { box-sizing: border-box; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; margin: 0 5px; /* half width of slider */ position: absolute; top: calc(50% - 2px); height: 4px; width: calc(100% - 10px); border-radius: 6px; background: rgba(0, 0, 0, 0.2); color: rgba(0,0,0,0); text-align: center; transition: top 0.2s, height 0.2s; } .flx-Slider.flx-dragging > .gutter, .flx-Slider:focus > .gutter { top: calc(50% - 10px); height: 20px; color: rgba(0,0,0,1); } .flx-Slider .slider, .flx-Slider .range { box-sizing: border-box; text-align: center; border-radius: 3px; background: #48c; border: 2px solid #48c; transition: top 0.2s, height 0.2s, background 0.4s; position: absolute; top: calc(50% - 8px); height: 16px; width: 10px; } .flx-Slider .range { border-width: 1px 0px 1px 0px; top: calc(50% - 4px); height: 8px; width: auto; } .flx-Slider.flx-dragging .slider, .flx-Slider:focus .slider, .flx-Slider.flx-dragging .range, .flx-Slider:focus .range { background: none; top: calc(50% - 10px); height: 20px; } .flx-Slider > .gutter > .slider.disabled { background: #888; border: none; } """ step = event.FloatProp(0.01, settable=True, doc=""" The step size for the slider. """) min = event.FloatProp(0, settable=True, doc=""" The minimal slider value. """) max = event.FloatProp(1, settable=True, doc=""" The maximum slider value. """) value = event.FloatProp(0, settable=True, doc=""" The current slider value. """) text = event.StringProp('{value}', settable=True, doc=""" The label to display on the slider during dragging. Occurances of "{percent}" are replaced with the current percentage, and "{value}" with the current value. Default "{value}". """) disabled = event.BoolProp(False, settable=True, doc=""" Whether the slider is disabled. """) def init(self): self._dragging = None self._drag_target = 0 @event.emitter def user_value(self, value): """ Event emitted when the user manipulates the slider. Has ``old_value`` and ``new_value`` attributes. """ d = {'old_value': self.value, 'new_value': value} self.set_value(value) return d @event.emitter def user_done(self): """ Event emitted when the user stops manipulating the slider. Has ``old_value`` and ``new_value`` attributes (which have the same value). """ d = {'old_value': self.value, 'new_value': self.value} return d @event.action def set_value(self, value): global Math value = max(self.min, value) value = min(self.max, value) value = Math.round(value / self.step) * self.step self._mutate_value(value) @event.reaction('min', 'max', 'step') def __keep_value_constrained(self, *events): self.set_value(self.value) def _render_dom(self): global Math value = self.value mi, ma = self.min, self.max perc = 100 * (value - mi) / (ma - mi) valuestr = str(value) if '.' in valuestr and valuestr[-4:-1] == '000': valuestr = valuestr[:-1].rstrip('0') label = self.text label = label.replace('{value}', valuestr) label = label.replace('{percent}', Math.round(perc) + '%') attr = {'className': 'slider disabled' if self.disabled else 'slider', 'style__left': 'calc(' + perc + '% - 5px)' } return [create_element('div', {'className': 'gutter'}, create_element('span', {}, label), create_element('div', attr), ) ] # Use the Flexx pointer event system, so we can make use of capturing ... def _getgutter(self): return self.node.children[0] def _snap2handle(self, x): # Snap to the slider handle gutter = self._getgutter() left = gutter.getBoundingClientRect().left + gutter.children[1].offsetLeft if left <= x <= left + 10: return x else: return left + 5 # center of the slider handle @event.emitter def pointer_down(self, e): if not self.disabled: e.stopPropagation() x1 = e.changedTouches[0].clientX if e.changedTouches else e.clientX x1 = self._snap2handle(x1) self._dragging = self.value, x1 self.outernode.classList.add('flx-dragging') else: return super().pointer_down(e) @event.emitter def pointer_up(self, e): if self._dragging is not None and len(self._dragging) == 3: self.outernode.blur() self._dragging = None self._drag_target = 0 self.outernode.classList.remove('flx-dragging') self.user_done() return super().pointer_down(e) @event.emitter def pointer_move(self, e): if self._dragging is not None: e.stopPropagation() ref_value, x1 = self._dragging[0], self._dragging[1] self._dragging = ref_value, x1, True # mark as moved x2 = e.changedTouches[0].clientX if e.changedTouches else e.clientX mi, ma = self.min, self.max value_diff = (x2 - x1) / self._getgutter().clientWidth * (ma - mi) self.user_value(ref_value + value_diff) else: return super().pointer_move(e) @event.reaction('key_down') def __on_key(self, *events): for ev in events: value = self.value if ev.key == 'Escape': self.outernode.blur() self.user_done() elif ev.key == 'ArrowRight': if isinstance(value, float): self.user_value(value + self.step) else: self.user_value([v + self.step for v in value]) elif ev.key == 'ArrowLeft': if isinstance(value, float): self.user_value(value - self.step) else: self.user_value([v - self.step for v in value]) class RangeSlider(Slider): """An input widget to select a range (i.e having two handles instead of one). The ``node`` of this widget is a `<div> <https://developer.mozilla.org/docs/Web/HTML/Element/div>`_ containing a few HTML elements for rendering. """ value = event.FloatPairProp((0, 1), settable=True, doc=""" The current slider value as a two-tuple. """) @event.action def set_value(self, *value): """ Set the RangeSlider's value. Can be called using ``set_value([val1, val2])`` or ``set_value(val1, val2)``. """ global Math if len(value) == 1 and isinstance(value[0], list): value = value[0] assert len(value) == 2, 'RangeSlider value must be a 2-tuple.' value = min(value[0], value[1]), max(value[0], value[1]) for i in range(2): value[i] = max(self.min, value[i]) value[i] = min(self.max, value[i]) value[i] = Math.round(value[i] / self.step) * self.step self._mutate_value(value) def _render_dom(self): global Math value1, value2 = self.value mi, ma = self.min, self.max perc1 = 100 * (value1 - mi) / (ma - mi) perc2 = 100 * (value2 - mi) / (ma - mi) valuestr1 = str(value1) valuestr2 = str(value2) if '.' in valuestr1 and valuestr1[-4:-1] == '000': valuestr1 = valuestr1[:-1].rstrip('0') elif '.' in valuestr2 and valuestr2[-4:-1] == '000': valuestr2 = valuestr2[:-1].rstrip('0') label = self.text label = label.replace('{value}', valuestr1 + ' - ' + valuestr2) label = label.replace('{percent}', Math.round(perc1) + '% - ' + Math.round(perc2) + '%') attr0 = {'className': 'range', 'style__left': perc1 + '%', 'style__right': (100 - perc2) + '%' } attr1 = {'className': 'slider disabled' if self.disabled else 'slider', 'style__left': 'calc(' + perc1 + '% - 5px)' } attr2 = {'className': 'slider disabled' if self.disabled else 'slider', 'style__left': 'calc(' + perc2 + '% - 5px)' } return [create_element('div', {'className': 'gutter'}, create_element('span', {}, label), create_element('div', attr0), create_element('div', attr1), create_element('div', attr2), ) ] def _snap2handle(self, x): # Snap to a slider handle or the center gutter = self._getgutter() h1 = gutter.getBoundingClientRect().left + gutter.children[2].offsetLeft + 5 h2 = gutter.getBoundingClientRect().left + gutter.children[3].offsetLeft + 5 hc = 0.5 * (h1 + h2) # Distances d1, d2, dc = abs(x - h1), abs(x - h2), abs(x - hc) # Decide if dc < d1 and dc < d2: self._drag_target = 3 return x elif d1 < d2: self._drag_target = 1 return h1 else: self._drag_target = 2 return h2 @event.emitter def pointer_move(self, e): if self._dragging is not None: e.stopPropagation() ref_value, x1 = self._dragging[0], self._dragging[1] self._dragging = ref_value, x1, True # mark as moved x2 = e.changedTouches[0].clientX if e.changedTouches else e.clientX mi, ma = self.min, self.max value_diff = (x2 - x1) / self._getgutter().clientWidth * (ma - mi) value1, value2 = ref_value if 1 & self._drag_target: value1 += value_diff if 2 & self._drag_target: value2 += value_diff self.user_value((value1, value2)) else: return super().pointer_move(e)
{ "pile_set_name": "Github" }
<script type="text/javascript">//<![CDATA[ XHR.poll(5, '<%=url([[admin]], [[services]], [[frp]], [[status]])%>', null, function(x, data) { var tb = document.getElementById('frp_status'); if (data && tb) { if (data.running) { var links = '<em><b><font color=green><%:The Frp service is running.%></font></b></em>'; tb.innerHTML = links; } else { tb.innerHTML = '<em><b><font color=red><%:The Frp service is not running.%></font></b></em>'; } } } ); //]]> </script> <style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style> <fieldset class="cbi-section"> <legend><%:Frp Status%></legend> <p id="frp_status"> <em><%:Collecting data...%></em> </p> </fieldset>
{ "pile_set_name": "Github" }
// // Twili - Homebrew debug monitor for the Nintendo Switch // Copyright (C) 2018 misson20000 <[email protected]> // // This file is part of Twili. // // Twili 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. // // Twili 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 Twili. If not, see <http://www.gnu.org/licenses/>. // #pragma once #include<stdint.h> namespace twili { namespace twib { namespace daemon { class Daemon; class BridgeObject { public: BridgeObject(Daemon &daemon, uint32_t device_id, uint32_t object_id); ~BridgeObject(); const Daemon &daemon; const uint32_t device_id; const uint32_t object_id; bool valid = true; }; } // namespace daemon } // namespace twib } // namespace twili
{ "pile_set_name": "Github" }
#!/bin/sh echo ------- uploading API and IDE jars apijar=`ls API/target/sikulixapi*complete.jar` cp $apijar pages/sikulixapi-2.1.0.jar apisrcjar=`ls API/target/sikulixapi*sources.jar` cp $apisrcjar pages/sikulixapi-2.1.0-sources.jar idejar=`ls IDE/target/sikulixide*complete.jar` cp $idejar pages/sikulix-2.1.0.jar echo ------ updating downloads page jar=`ls API/target/sikulixapi*complete.jar` build=`java -jar $apijar buildDate` echo "s/##sikulixapiide##/$build/" >sedcommand echo "s/##TRAVIS_BUILD_NUMBER##/$TRAVIS_BUILD_NUMBER/" >>sedcommand cat sedcommand sed -f sedcommand pages/nightly_template.html >pages/nightly.html
{ "pile_set_name": "Github" }
require 'abstract_unit' class HttpMockTest < ActiveSupport::TestCase def setup @http = ActiveResource::HttpMock.new("http://example.com") end FORMAT_HEADER = { :get => 'Accept', :put => 'Content-Type', :post => 'Content-Type', :delete => 'Accept', :head => 'Accept' } [:post, :put, :get, :delete, :head].each do |method| test "responds to simple #{method} request" do ActiveResource::HttpMock.respond_to do |mock| mock.send(method, "/people/1", {FORMAT_HEADER[method] => "application/xml"}, "Response") end assert_equal "Response", request(method, "/people/1", FORMAT_HEADER[method] => "application/xml").body end test "adds format header by default to #{method} request" do ActiveResource::HttpMock.respond_to do |mock| mock.send(method, "/people/1", {}, "Response") end assert_equal "Response", request(method, "/people/1", FORMAT_HEADER[method] => "application/xml").body end test "respond only when headers match header by default to #{method} request" do ActiveResource::HttpMock.respond_to do |mock| mock.send(method, "/people/1", {"X-Header" => "X"}, "Response") end assert_equal "Response", request(method, "/people/1", "X-Header" => "X").body assert_raise(ActiveResource::InvalidRequestError) { request(method, "/people/1") } end test "does not overwrite format header to #{method} request" do ActiveResource::HttpMock.respond_to do |mock| mock.send(method, "/people/1", {FORMAT_HEADER[method] => "application/json"}, "Response") end assert_equal "Response", request(method, "/people/1", FORMAT_HEADER[method] => "application/json").body end test "ignores format header when there is only one response to same url in a #{method} request" do ActiveResource::HttpMock.respond_to do |mock| mock.send(method, "/people/1", {}, "Response") end assert_equal "Response", request(method, "/people/1", FORMAT_HEADER[method] => "application/json").body assert_equal "Response", request(method, "/people/1", FORMAT_HEADER[method] => "application/xml").body end test "responds correctly when format header is given to #{method} request" do ActiveResource::HttpMock.respond_to do |mock| mock.send(method, "/people/1", {FORMAT_HEADER[method] => "application/xml"}, "XML") mock.send(method, "/people/1", {FORMAT_HEADER[method] => "application/json"}, "Json") end assert_equal "XML", request(method, "/people/1", FORMAT_HEADER[method] => "application/xml").body assert_equal "Json", request(method, "/people/1", FORMAT_HEADER[method] => "application/json").body end test "raises InvalidRequestError if no response found for the #{method} request" do ActiveResource::HttpMock.respond_to do |mock| mock.send(method, "/people/1", {FORMAT_HEADER[method] => "application/xml"}, "XML") end assert_raise(::ActiveResource::InvalidRequestError) do request(method, "/people/1", FORMAT_HEADER[method] => "application/json") end end end test "allows you to send in pairs directly to the respond_to method" do matz = { :id => 1, :name => "Matz" }.to_xml(:root => "person") create_matz = ActiveResource::Request.new(:post, '/people.xml', matz, {}) created_response = ActiveResource::Response.new("", 201, {"Location" => "/people/1.xml"}) get_matz = ActiveResource::Request.new(:get, '/people/1.xml', nil) ok_response = ActiveResource::Response.new(matz, 200, {}) pairs = {create_matz => created_response, get_matz => ok_response} ActiveResource::HttpMock.respond_to(pairs) assert_equal 2, ActiveResource::HttpMock.responses.length assert_equal "", ActiveResource::HttpMock.responses.assoc(create_matz)[1].body assert_equal matz, ActiveResource::HttpMock.responses.assoc(get_matz)[1].body end test "resets all mocked responses on each call to respond_to with a block by default" do ActiveResource::HttpMock.respond_to do |mock| mock.send(:get, "/people/1", {}, "XML1") end assert_equal 1, ActiveResource::HttpMock.responses.length ActiveResource::HttpMock.respond_to do |mock| mock.send(:get, "/people/2", {}, "XML2") end assert_equal 1, ActiveResource::HttpMock.responses.length end test "resets all mocked responses on each call to respond_to by passing pairs by default" do ActiveResource::HttpMock.respond_to do |mock| mock.send(:get, "/people/1", {}, "XML1") end assert_equal 1, ActiveResource::HttpMock.responses.length matz = { :id => 1, :name => "Matz" }.to_xml(:root => "person") get_matz = ActiveResource::Request.new(:get, '/people/1.xml', nil) ok_response = ActiveResource::Response.new(matz, 200, {}) ActiveResource::HttpMock.respond_to({get_matz => ok_response}) assert_equal 1, ActiveResource::HttpMock.responses.length end test "allows you to add new responses to the existing responses by calling a block" do ActiveResource::HttpMock.respond_to do |mock| mock.send(:get, "/people/1", {}, "XML1") end assert_equal 1, ActiveResource::HttpMock.responses.length ActiveResource::HttpMock.respond_to(false) do |mock| mock.send(:get, "/people/2", {}, "XML2") end assert_equal 2, ActiveResource::HttpMock.responses.length end test "allows you to add new responses to the existing responses by passing pairs" do ActiveResource::HttpMock.respond_to do |mock| mock.send(:get, "/people/1", {}, "XML1") end assert_equal 1, ActiveResource::HttpMock.responses.length matz = { :id => 1, :name => "Matz" }.to_xml(:root => "person") get_matz = ActiveResource::Request.new(:get, '/people/1.xml', nil) ok_response = ActiveResource::Response.new(matz, 200, {}) ActiveResource::HttpMock.respond_to({get_matz => ok_response}, false) assert_equal 2, ActiveResource::HttpMock.responses.length end def request(method, path, headers = {}, body = nil) if [:put, :post].include? method @http.send(method, path, body, headers) else @http.send(method, path, headers) end end end
{ "pile_set_name": "Github" }
# Change Log All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. ## [1.1.39](https://github.com/thi-ng/umbrella/compare/@thi.ng/[email protected][email protected]/[email protected]) (2020-09-22) **Note:** Version bump only for package @thi.ng/csp ## [1.1.38](https://github.com/thi-ng/umbrella/compare/@thi.ng/[email protected][email protected]/[email protected]) (2020-09-13) **Note:** Version bump only for package @thi.ng/csp ## [1.1.37](https://github.com/thi-ng/umbrella/compare/@thi.ng/[email protected][email protected]/[email protected]) (2020-08-28) **Note:** Version bump only for package @thi.ng/csp ## [1.1.36](https://github.com/thi-ng/umbrella/compare/@thi.ng/[email protected][email protected]/[email protected]) (2020-08-17) **Note:** Version bump only for package @thi.ng/csp ## [1.1.35](https://github.com/thi-ng/umbrella/compare/@thi.ng/[email protected][email protected]/[email protected]) (2020-08-16) **Note:** Version bump only for package @thi.ng/csp # [1.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/[email protected][email protected]/[email protected]) (2019-07-07) ### Bug Fixes * **csp:** TS strictNullChecks, update various return types ([da909ac](https://github.com/thi-ng/umbrella/commit/da909ac)) ### Features * **csp:** enable TS strict compiler flags (refactor) ([3d7fba2](https://github.com/thi-ng/umbrella/commit/3d7fba2)) * **csp:** update Mult.tap() to use set semantics ([c9bc953](https://github.com/thi-ng/umbrella/commit/c9bc953)) # [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/[email protected][email protected]/[email protected]) (2019-01-21) ### Bug Fixes * **csp:** disable __State reverse enum lookup ([3b8576f](https://github.com/thi-ng/umbrella/commit/3b8576f)) ### Build System * update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703)) ### BREAKING CHANGES * enabled multi-outputs (ES6 modules, CJS, UMD) - build scripts now first build ES6 modules in package root, then call `scripts/bundle-module` to build minified CJS & UMD bundles in `/lib` - all imports MUST be updated to only refer to package level (not individual files anymore). tree shaking in user land will get rid of all unused imported symbols. <a name="0.3.64"></a> ## [0.3.64](https://github.com/thi-ng/umbrella/compare/@thi.ng/[email protected][email protected]/[email protected]) (2018-09-24) ### Performance Improvements * **csp:** `State` => const enum ([c3e8d68](https://github.com/thi-ng/umbrella/commit/c3e8d68)) <a name="0.3.11"></a> ## [0.3.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/[email protected][email protected]/[email protected]) (2018-02-08) ### Bug Fixes * **csp:** fix [#5](https://github.com/thi-ng/umbrella/issues/5), example in readme ([a10a487](https://github.com/thi-ng/umbrella/commit/a10a487)) * **csp:** fix [#5](https://github.com/thi-ng/umbrella/issues/5), more example fixes (rfn calls) ([080c2ee](https://github.com/thi-ng/umbrella/commit/080c2ee))
{ "pile_set_name": "Github" }
<html> <body> <h2>Hello World!</h2> </body> </html>
{ "pile_set_name": "Github" }
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/React GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/DoubleConversion" "${PODS_ROOT}/Headers/Public/FBLazyVector" "${PODS_ROOT}/Headers/Public/FBReactNativeSpec" "${PODS_ROOT}/Headers/Public/RCTRequired" "${PODS_ROOT}/Headers/Public/RCTTypeSafety" "${PODS_ROOT}/Headers/Public/React-Core" "${PODS_ROOT}/Headers/Public/React-RCTText" "${PODS_ROOT}/Headers/Public/React-callinvoker" "${PODS_ROOT}/Headers/Public/React-cxxreact" "${PODS_ROOT}/Headers/Public/React-jsi" "${PODS_ROOT}/Headers/Public/React-jsiexecutor" "${PODS_ROOT}/Headers/Public/React-jsinspector" "${PODS_ROOT}/Headers/Public/ReactCommon" "${PODS_ROOT}/Headers/Public/Yoga" "${PODS_ROOT}/Headers/Public/glog" OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_ROOT}/Headers/Public/yoga/Yoga.modulemap" PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) PODS_ROOT = ${SRCROOT} PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../../../react-native-lab/react-native PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} SKIP_INSTALL = YES USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
{ "pile_set_name": "Github" }
$simple-bg: #fff; $simple-color: #000; $simple-progressBar: #c7c7c7; $simple-progressBarPercentage: #4c4c4c; $success-bg: #4caf50; $success-color: #c8e6c9; $success-progressBar: #388e3c; $success-progressBarPercentage: #81c784; $info-bg: #1e88e5; $info-color: #e3f2fd; $info-progressBar: #1565c0; $info-progressBarPercentage: #64b5f6; $warning-bg: #ff9800; $warning-color: #fff3e0; $warning-progressBar: #ef6c00; $warning-progressBarPercentage: #ffcc80; $error-bg: #f44336; $error-color: #ffebee; $error-progressBar: #c62828; $error-progressBarPercentage: #ef9a9a; $async-bg: $info-bg; $async-color: $info-color; $async-progressBar: $info-progressBar; $async-progressBarPercentage: $info-progressBarPercentage; $confirm-bg: #009688; $confirm-color: #e0f2f1; $confirm-progressBar: #4db6ac; $confirm-progressBarPercentage: #80cbc4; $prompt-bg: #009688; $prompt-color: #e0f2f1; $snotify-title-font-size: auto !default; $snotify-body-font-size: auto !default; @if $snotify-title-font-size == auto { $snotify-title-font-size: 1.8em; } @if $snotify-body-font-size == auto { $snotify-body-font-size: 1em; } .snotifyToast { display: block; cursor: pointer; background-color: $simple-bg; height: 100%; margin: 5px; opacity: 0; border-radius: 5px; overflow: hidden; pointer-events: auto; &--in { animation-name: appear; } &--out { animation-name: disappear; } &__inner { display: flex; flex-flow: column nowrap; align-items: flex-start; justify-content: center; position: relative; padding: 5px 65px 5px 15px; min-height: 78px; font-size: 16px; color: $simple-color; } &__progressBar { position: relative; width: 100%; height: 10px; background-color: $simple-progressBar; &__percentage { position: absolute; top: 0; left: 0; height: 10px; background-color: $simple-progressBarPercentage; max-width: 100%; } } &__title { font-size: $snotify-title-font-size; line-height: 1.2em; margin-bottom: 5px; color: #fff; } &__body { font-size: $snotify-body-font-size; } } .snotifyToast-show { transform: translate(0, 0); opacity: 1; } .snotifyToast-remove { max-height: 0; overflow: hidden; transform: translate(0, 50%); opacity: 0; } .fadeOutRight { animation-name: fadeOutRight; } /*************** ** Modifiers ** **************/ .snotify-simple { .snotifyToast__title, .snotifyToast__body { color: $simple-color; } } .snotify-success { background-color: $success-bg; .snotifyToast__progressBar { background-color: $success-progressBar; } .snotifyToast__progressBar__percentage { background-color: $success-progressBarPercentage; } .snotifyToast__body { color: $success-color; } } .snotify-info { background-color: $info-bg; .snotifyToast__progressBar { background-color: $info-progressBar; } .snotifyToast__progressBar__percentage { background-color: $info-progressBarPercentage; } .snotifyToast__body { color: $info-color; } } .snotify-warning { background-color: $warning-bg; .snotifyToast__progressBar { background-color: $warning-progressBar; } .snotifyToast__progressBar__percentage { background-color: $warning-progressBarPercentage; } .snotifyToast__body { color: $warning-color; } } .snotify-error { background-color: $error-bg; .snotifyToast__progressBar { background-color: $error-progressBar; } .snotifyToast__progressBar__percentage { background-color: $error-progressBarPercentage; } .snotifyToast__body { color: $error-color; } } .snotify-async { background-color: $async-bg; .snotifyToast__progressBar { background-color: $async-progressBar; } .snotifyToast__progressBar__percentage { background-color: $async-progressBarPercentage; } .snotifyToast__body { color: $async-color; } } .snotify-confirm { background-color: $confirm-bg; .snotifyToast__progressBar { background-color: $confirm-progressBar; } .snotifyToast__progressBar__percentage { background-color: $confirm-progressBarPercentage; } .snotifyToast__body { color: $confirm-color; } } .snotify-prompt { background-color: $prompt-bg; ng-snotify-prompt { width: 100%; } .snotifyToast__title { margin-bottom: 0; } .snotifyToast__body { color: $prompt-color; } } .snotify-confirm, .snotify-prompt { .snotifyToast__inner { padding: 10px 15px; } }
{ "pile_set_name": "Github" }
#include <AIToolbox/MDP/Algorithms/QLearning.hpp> namespace AIToolbox::MDP { QLearning::QLearning(const size_t ss, const size_t aa, const double discount, const double alpha) : S(ss), A(aa), discount_(discount), q_(makeQFunction(S, A)) { setDiscount(discount); setLearningRate(alpha); } void QLearning::stepUpdateQ(const size_t s, const size_t a, const size_t s1, const double rew) { q_(s, a) += alpha_ * ( rew + discount_ * q_.row(s1).maxCoeff() - q_(s, a) ); } void QLearning::setLearningRate(const double a) { if ( a <= 0.0 || a > 1.0 ) throw std::invalid_argument("Learning rate parameter must be in (0,1]"); alpha_ = a; } double QLearning::getLearningRate() const { return alpha_; } void QLearning::setDiscount(const double d) { if ( d <= 0.0 || d > 1.0 ) throw std::invalid_argument("Discount parameter must be in (0,1]"); discount_ = d; } double QLearning::getDiscount() const { return discount_; } size_t QLearning::getS() const { return S; } size_t QLearning::getA() const { return A; } const QFunction & QLearning::getQFunction() const { return q_; } void QLearning::setQFunction(const QFunction & qfun) { assert(q_.rows() == qfun.rows()); assert(q_.cols() == qfun.cols()); q_ = qfun; } }
{ "pile_set_name": "Github" }
{if $_SESSION.user->config.infoacc ne '1'} <div class="top_menu"> <div class="top_menu_left"> {if $_SESSION.user->access.clients.add eq on}<a href="#null" onclick="get_window('/clients/add.html?window=1', {ldelim}name:'add', widht: 800, height:370{rdelim});">{$lang.adds}</a>&nbsp;{/if} </div> <div class="top_menu_right"> {if $_SESSION.user->access.clients.regenerate eq on}<a href="/clients/regenerate.html" onclick="return confirm('Вы уверены?\nВсе текущие пользователи больше подключится, не смогут по старым ключам!\nЭто может занять от 10 до 30 минут.');">{$lang.regenerate}</a>&nbsp;{/if} </div> </div> <hr /> {/if} <div style="font-size:10px" align="center"><br />&nbsp;{$pages}&nbsp;<br /><br /></div> <table cellspacing="1" cellpadding="5" style="width: 100%; border: 1px solid #cccccc;"> <tr class="bgp3"> <td style="width: 20%; text-align: center">{$lang.name}</td> <td style="width: 30%; text-align: center">{$lang.desc}</td> <td style="width: 30%; text-align: center">{$lang.ip}</td> <td style="width: 20%; text-align: center">{$lang.status}</td> {if $_SESSION.user->access.clients.download eq on}<td style="width: 1px;">&nbsp;</td>{/if} {if $_SESSION.user->access.clients.edit eq on}<td style="width: 1px;">&nbsp;</td><td style="width: 1px;">&nbsp;</td>{/if} </tr> {foreach from=$list item=item key=key name=list} {if $smarty.foreach.list.iteration is not even}{assign var=bg value=1}{else}{assign var=bg value=2}{/if} <tr class="bgp{$bg}" onmousemove="this.className = 'bgp4'" onmouseout="this.className = 'bgp{$bg}'" style="border: 1px solid #FFFFFF; cursor:pointer;"> <th onclick="glc('{$item->id}');" {if $item->enable ne 1}style="color:#FF0000"{/if}>{$item->name}</th> <th onclick="glc('{$item->id}');">{$item->desc}</th> <th onclick="glc('{$item->id}');">{if $item->server eq '0'}Auto{else}{$servers[$item->server]}{/if}</th> <th onclick="glc('{$item->id}');">{if $item->status eq 0}{$lang.disconnect}{elseif $item->status eq 1}{$lang.connection}{elseif $item->status eq 2}{$lang.connect}{/if}</th> {if $_SESSION.user->access.clients.download eq on} <th><a href="#null" onclick="dl('{$item->id}', 'enable');"><img src="/images/icons/icon_download.gif" /></a></th> {/if} {if $_SESSION.user->access.clients.edit eq on} <th><a href="#null" onclick="gsp('{$item->id}', 'enable');"><img src="/images/{if $item->enable eq 1}pause{else}play{/if}.png" /></a></th> <th><a href="#null" onclick="get_window('/clients/edit-{$item->id}.html?window=1', {ldelim}name:'edit{$item->id}', widht: 800, height:500{rdelim});"><img src="/images/edit.png" alt="{$lang.edit}" /></a></th> {/if} </tr> {/foreach} </table> <div style="font-size:10px" align="center"><br />&nbsp;{$pages}&nbsp;<br /><br /></div>
{ "pile_set_name": "Github" }
<?php /* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * <http://www.doctrine-project.org>. */ namespace Doctrine\DBAL\Event; use Doctrine\Common\EventArgs; use Doctrine\DBAL\Connection; /** * Event Arguments used when a Driver connection is established inside Doctrine\DBAL\Connection. * * @link www.doctrine-project.org * @since 1.0 * @author Benjamin Eberlei <[email protected]> */ class ConnectionEventArgs extends EventArgs { /** * @var \Doctrine\DBAL\Connection */ private $_connection; /** * @param \Doctrine\DBAL\Connection $connection */ public function __construct(Connection $connection) { $this->_connection = $connection; } /** * @return \Doctrine\DBAL\Connection */ public function getConnection() { return $this->_connection; } /** * @return \Doctrine\DBAL\Driver */ public function getDriver() { return $this->_connection->getDriver(); } /** * @return \Doctrine\DBAL\Platforms\AbstractPlatform */ public function getDatabasePlatform() { return $this->_connection->getDatabasePlatform(); } /** * @return \Doctrine\DBAL\Schema\AbstractSchemaManager */ public function getSchemaManager() { return $this->_connection->getSchemaManager(); } }
{ "pile_set_name": "Github" }
<?php /***********************************************************************/ /* ATutor */ /***********************************************************************/ /* Copyright (c) 2002-2010 */ /* Inclusive Design Institute */ /* http://atutor.ca */ /* */ /* 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. */ /***********************************************************************/ // $Id$ $_user_location = 'public'; define('AT_INCLUDE_PATH', '../../../include/'); require(AT_INCLUDE_PATH.'vitals.inc.php'); require_once(AT_SOCIAL_INCLUDE.'constants.inc.php'); require(AT_SOCIAL_INCLUDE.'friends.inc.php'); require(AT_SOCIAL_INCLUDE.'classes/PrivacyControl/PrivacyObject.class.php'); require(AT_SOCIAL_INCLUDE.'classes/PrivacyControl/PrivacyController.class.php'); if(isset($_POST['rand_key'])){ $rand_key = $addslashes($_POST['rand_key']); //should we excape? } //paginator settings if(isset($_GET['p'])){ $page = intval($_GET['p']); } if (!isset($page)) { $page = 1; } $count = (($page-1) * SOCIAL_FRIEND_SEARCH_MAX) + 1; $offset = ($page-1) * SOCIAL_FRIEND_SEARCH_MAX; //if $_GET['q'] is set, handle Ajax. if (isset($_GET['q'])){ $query = $addslashes($_GET['q']); //retrieve a list of friends by the search $search_result = searchFriends($query); if (!empty($search_result)){ echo '<div class="suggestions">'._AT('suggestions').':<br/>'; $counter = 0; foreach($search_result as $member_id=>$member_array){ //display 10 suggestions if ($counter > 10){ break; } echo '<a href="javascript:void(0);" onclick="document.getElementById(\'search_friends\').value=\''.printSocialName($member_id, false).'\'; document.getElementById(\'search_friends_form\').submit();">'.printSocialName($member_id, false).'</a><br/>'; $counter++; } echo '</div>'; } exit; } //handle search friends request if((isset($rand_key) && $rand_key!='' && isset($_POST['search_friends_'.$rand_key])) || isset($_GET['search_friends'])){ if (empty($_POST['search_friends_'.$rand_key]) && !isset($_GET['search_friends'])){ $msg->addError('CANNOT_BE_EMPTY'); header('Location: '.url_rewrite(AT_SOCIAL_BASENAME.'index_public.php', AT_PRETTY_URL_IS_HEADER)); exit; } //to adapt paginator GET queries if(isset($_GET['search_friends'])){ $search_field = $addslashes($_GET['search_friends']); } else { $search_field = $addslashes($_POST['search_friends_'.$rand_key]); } if (isset($_POST['myFriendsOnly'])){ //retrieve a list of my friends $friends = searchFriends($search_field, true); } else { //retrieve a list of friends by the search $friends = searchFriends($search_field); //to calculate the total number. TODO: need a better way, wasting runtime. $num_pages = max(ceil(sizeof($friends) / SOCIAL_FRIEND_SEARCH_MAX), 1); $friends = searchFriends($search_field, false, $offset); } } include(AT_INCLUDE_PATH.'header.inc.php'); $savant->assign('page', $page); if(isset($num_pages)){ $savant->assign('num_pages', $num_pages); } else { $savant->assign('num_pages', ''); } if(isset($search_field)){ $savant->assign('search_field', $search_field); } else { $savant->assign('search_field', ''); } if(isset($friends)){ $savant->assign('friends', $friends); }else{ $savant->assign('friends', ''); } if(isset( $rand_key)){ $savant->assign('rand_key', $rand_key); } else{ $savant->assign('rand_key', ''); } $savant->display('social/index_public.tmpl.php'); include(AT_INCLUDE_PATH.'footer.inc.php'); ?>
{ "pile_set_name": "Github" }
package pflag import "strconv" // -- float32 Value type float32Value float32 func newFloat32Value(val float32, p *float32) *float32Value { *p = val return (*float32Value)(p) } func (f *float32Value) Set(s string) error { v, err := strconv.ParseFloat(s, 32) *f = float32Value(v) return err } func (f *float32Value) Type() string { return "float32" } func (f *float32Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 32) } func float32Conv(sval string) (interface{}, error) { v, err := strconv.ParseFloat(sval, 32) if err != nil { return 0, err } return float32(v), nil } // GetFloat32 return the float32 value of a flag with the given name func (f *FlagSet) GetFloat32(name string) (float32, error) { val, err := f.getFlagType(name, "float32", float32Conv) if err != nil { return 0, err } return val.(float32), nil } // Float32Var defines a float32 flag with specified name, default value, and usage string. // The argument p points to a float32 variable in which to store the value of the flag. func (f *FlagSet) Float32Var(p *float32, name string, value float32, usage string) { f.VarP(newFloat32Value(value, p), name, "", usage) } // Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash. func (f *FlagSet) Float32VarP(p *float32, name, shorthand string, value float32, usage string) { f.VarP(newFloat32Value(value, p), name, shorthand, usage) } // Float32Var defines a float32 flag with specified name, default value, and usage string. // The argument p points to a float32 variable in which to store the value of the flag. func Float32Var(p *float32, name string, value float32, usage string) { CommandLine.VarP(newFloat32Value(value, p), name, "", usage) } // Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash. func Float32VarP(p *float32, name, shorthand string, value float32, usage string) { CommandLine.VarP(newFloat32Value(value, p), name, shorthand, usage) } // Float32 defines a float32 flag with specified name, default value, and usage string. // The return value is the address of a float32 variable that stores the value of the flag. func (f *FlagSet) Float32(name string, value float32, usage string) *float32 { p := new(float32) f.Float32VarP(p, name, "", value, usage) return p } // Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash. func (f *FlagSet) Float32P(name, shorthand string, value float32, usage string) *float32 { p := new(float32) f.Float32VarP(p, name, shorthand, value, usage) return p } // Float32 defines a float32 flag with specified name, default value, and usage string. // The return value is the address of a float32 variable that stores the value of the flag. func Float32(name string, value float32, usage string) *float32 { return CommandLine.Float32P(name, "", value, usage) } // Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash. func Float32P(name, shorthand string, value float32, usage string) *float32 { return CommandLine.Float32P(name, shorthand, value, usage) }
{ "pile_set_name": "Github" }
# Define a function to create Cython modules. # # For more information on the Cython project, see http://cython.org/. # "Cython is a language that makes writing C extensions for the Python language # as easy as Python itself." # # This file defines a CMake function to build a Cython Python module. # To use it, first include this file. # # include( UseCython ) # # Then call cython_add_module to create a module. # # cython_add_module( <module_name> <src1> <src2> ... <srcN> ) # # To create a standalone executable, the function # # cython_add_standalone_executable( <executable_name> [MAIN_MODULE src1] <src1> <src2> ... <srcN> ) # # To avoid dependence on Python, set the PYTHON_LIBRARY cache variable to point # to a static library. If a MAIN_MODULE source is specified, # the "if __name__ == '__main__':" from that module is used as the C main() method # for the executable. If MAIN_MODULE, the source with the same basename as # <executable_name> is assumed to be the MAIN_MODULE. # # Where <module_name> is the name of the resulting Python module and # <src1> <src2> ... are source files to be compiled into the module, e.g. *.pyx, # *.py, *.c, *.cxx, etc. A CMake target is created with name <module_name>. This can # be used for target_link_libraries(), etc. # # The sample paths set with the CMake include_directories() command will be used # for include directories to search for *.pxd when running the Cython complire. # # Cache variables that effect the behavior include: # # CYTHON_ANNOTATE # CYTHON_NO_DOCSTRINGS # CYTHON_FLAGS # # Source file properties that effect the build process are # # CYTHON_IS_CXX # # If this is set of a *.pyx file with CMake set_source_files_properties() # command, the file will be compiled as a C++ file. # # See also FindCython.cmake #============================================================================= # Copyright 2011 Kitware, Inc. # # 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. #============================================================================= # Configuration options. set( CYTHON_ANNOTATE OFF CACHE BOOL "Create an annotated .html file when compiling *.pyx." ) set( CYTHON_NO_DOCSTRINGS OFF CACHE BOOL "Strip docstrings from the compiled module." ) set( CYTHON_FLAGS "" CACHE STRING "Extra flags to the cython compiler." ) mark_as_advanced( CYTHON_ANNOTATE CYTHON_NO_DOCSTRINGS CYTHON_FLAGS ) find_package( Cython REQUIRED ) find_package( PythonInterp REQUIRED ) find_package( PythonLibsNew REQUIRED ) set( CYTHON_CXX_EXTENSION "cxx" ) set( CYTHON_C_EXTENSION "c" ) # Create a *.c or *.cxx file from a *.pyx file. # Input the generated file basename. The generate file will put into the variable # placed in the "generated_file" argument. Finally all the *.py and *.pyx files. function( compile_pyx _name generated_file ) # Default to assuming all files are C. set( cxx_arg "" ) set( extension ${CYTHON_C_EXTENSION} ) set( pyx_lang "C" ) set( comment "Compiling Cython C source for ${_name}..." ) set( cython_include_directories "" ) set( pxd_dependencies "" ) set( c_header_dependencies "" ) set( pyx_locations "" ) foreach( pyx_file ${ARGN} ) get_filename_component( pyx_file_basename "${pyx_file}" NAME_WE ) # Determine if it is a C or C++ file. get_source_file_property( property_is_cxx ${pyx_file} CYTHON_IS_CXX ) if( ${property_is_cxx} ) set( cxx_arg "--cplus" ) set( extension ${CYTHON_CXX_EXTENSION} ) set( pyx_lang "CXX" ) set( comment "Compiling Cython CXX source for ${_name}..." ) endif() # Get the include directories. get_source_file_property( pyx_location ${pyx_file} LOCATION ) get_filename_component( pyx_path ${pyx_location} PATH ) get_directory_property( cmake_include_directories DIRECTORY ${pyx_path} INCLUDE_DIRECTORIES ) list( APPEND cython_include_directories ${cmake_include_directories} ) list( APPEND pyx_locations "${pyx_location}" ) # Determine dependencies. # Add the pxd file will the same name as the given pyx file. unset( corresponding_pxd_file CACHE ) find_file( corresponding_pxd_file ${pyx_file_basename}.pxd PATHS "${pyx_path}" ${cmake_include_directories} NO_DEFAULT_PATH ) if( corresponding_pxd_file ) list( APPEND pxd_dependencies "${corresponding_pxd_file}" ) endif() # pxd files to check for additional dependencies. set( pxds_to_check "${pyx_file}" "${pxd_dependencies}" ) set( pxds_checked "" ) set( number_pxds_to_check 1 ) while( ${number_pxds_to_check} GREATER 0 ) foreach( pxd ${pxds_to_check} ) list( APPEND pxds_checked "${pxd}" ) list( REMOVE_ITEM pxds_to_check "${pxd}" ) # check for C header dependencies file( STRINGS "${pxd}" extern_from_statements REGEX "cdef[ ]+extern[ ]+from.*$" ) foreach( statement ${extern_from_statements} ) # Had trouble getting the quote in the regex string( REGEX REPLACE "cdef[ ]+extern[ ]+from[ ]+[\"]([^\"]+)[\"].*" "\\1" header "${statement}" ) unset( header_location CACHE ) find_file( header_location ${header} PATHS ${cmake_include_directories} ) if( header_location ) list( FIND c_header_dependencies "${header_location}" header_idx ) if( ${header_idx} LESS 0 ) list( APPEND c_header_dependencies "${header_location}" ) endif() endif() endforeach() # check for pxd dependencies # Look for cimport statements. set( module_dependencies "" ) file( STRINGS "${pxd}" cimport_statements REGEX cimport ) foreach( statement ${cimport_statements} ) if( ${statement} MATCHES from ) string( REGEX REPLACE "from[ ]+([^ ]+).*" "\\1" module "${statement}" ) else() string( REGEX REPLACE "cimport[ ]+([^ ]+).*" "\\1" module "${statement}" ) endif() list( APPEND module_dependencies ${module} ) endforeach() list( REMOVE_DUPLICATES module_dependencies ) # Add the module to the files to check, if appropriate. foreach( module ${module_dependencies} ) unset( pxd_location CACHE ) find_file( pxd_location ${module}.pxd PATHS "${pyx_path}" ${cmake_include_directories} NO_DEFAULT_PATH ) if( pxd_location ) list( FIND pxds_checked ${pxd_location} pxd_idx ) if( ${pxd_idx} LESS 0 ) list( FIND pxds_to_check ${pxd_location} pxd_idx ) if( ${pxd_idx} LESS 0 ) list( APPEND pxds_to_check ${pxd_location} ) list( APPEND pxd_dependencies ${pxd_location} ) endif() # if it is not already going to be checked endif() # if it has not already been checked endif() # if pxd file can be found endforeach() # for each module dependency discovered endforeach() # for each pxd file to check list( LENGTH pxds_to_check number_pxds_to_check ) endwhile() endforeach() # pyx_file # Set additional flags. if( CYTHON_ANNOTATE ) set( annotate_arg "--annotate" ) endif() if( CYTHON_NO_DOCSTRINGS ) set( no_docstrings_arg "--no-docstrings" ) endif() if( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo" ) set( cython_debug_arg "--gdb" ) endif() # Include directory arguments. list( REMOVE_DUPLICATES cython_include_directories ) set( include_directory_arg "" ) foreach( _include_dir ${cython_include_directories} ) set( include_directory_arg ${include_directory_arg} "-I" "${_include_dir}" ) endforeach() # Determining generated file name. set( _generated_file "${CMAKE_CURRENT_BINARY_DIR}/${_name}.${extension}" ) set_source_files_properties( ${_generated_file} PROPERTIES GENERATED TRUE ) set( ${generated_file} ${_generated_file} PARENT_SCOPE ) list( REMOVE_DUPLICATES pxd_dependencies ) list( REMOVE_DUPLICATES c_header_dependencies ) # Add the command to run the compiler. add_custom_command( OUTPUT ${_generated_file} COMMAND ${CYTHON_EXECUTABLE} ARGS ${cxx_arg} ${include_directory_arg} ${annotate_arg} ${no_docstrings_arg} ${cython_debug_arg} ${CYTHON_FLAGS} --output-file ${_generated_file} ${pyx_locations} DEPENDS ${pyx_locations} ${pxd_dependencies} IMPLICIT_DEPENDS ${pyx_lang} ${c_header_dependencies} COMMENT ${comment} ) # Remove their visibility to the user. set( corresponding_pxd_file "" CACHE INTERNAL "" ) set( header_location "" CACHE INTERNAL "" ) set( pxd_location "" CACHE INTERNAL "" ) endfunction() # cython_add_module( <name> src1 src2 ... srcN ) # Build the Cython Python module. function( cython_add_module _name ) set( pyx_module_sources "" ) set( other_module_sources "" ) foreach( _file ${ARGN} ) if( ${_file} MATCHES ".*\\.py[x]?$" ) list( APPEND pyx_module_sources ${_file} ) else() list( APPEND other_module_sources ${_file} ) endif() endforeach() compile_pyx( ${_name} generated_file ${pyx_module_sources} ) include_directories( ${PYTHON_INCLUDE_DIRS} ) python_add_module( ${_name} ${generated_file} ${other_module_sources} ) target_link_libraries( ${_name} ${PYTHON_LIBRARIES} ) endfunction() include( CMakeParseArguments ) # cython_add_standalone_executable( _name [MAIN_MODULE src3.py] src1 src2 ... srcN ) # Creates a standalone executable the given sources. function( cython_add_standalone_executable _name ) set( pyx_module_sources "" ) set( other_module_sources "" ) set( main_module "" ) cmake_parse_arguments( cython_arguments "" "MAIN_MODULE" "" ${ARGN} ) include_directories( ${PYTHON_INCLUDE_DIRS} ) foreach( _file ${cython_arguments_UNPARSED_ARGUMENTS} ) if( ${_file} MATCHES ".*\\.py[x]?$" ) get_filename_component( _file_we ${_file} NAME_WE ) if( "${_file_we}" STREQUAL "${_name}" ) set( main_module "${_file}" ) elseif( NOT "${_file}" STREQUAL "${cython_arguments_MAIN_MODULE}" ) set( PYTHON_MODULE_${_file_we}_static_BUILD_SHARED OFF ) compile_pyx( "${_file_we}_static" generated_file "${_file}" ) list( APPEND pyx_module_sources "${generated_file}" ) endif() else() list( APPEND other_module_sources ${_file} ) endif() endforeach() if( cython_arguments_MAIN_MODULE ) set( main_module ${cython_arguments_MAIN_MODULE} ) endif() if( NOT main_module ) message( FATAL_ERROR "main module not found." ) endif() get_filename_component( main_module_we "${main_module}" NAME_WE ) set( CYTHON_FLAGS ${CYTHON_FLAGS} --embed ) compile_pyx( "${main_module_we}_static" generated_file ${main_module} ) add_executable( ${_name} ${generated_file} ${pyx_module_sources} ${other_module_sources} ) target_link_libraries( ${_name} ${PYTHON_LIBRARIES} ${pyx_module_libs} ) endfunction()
{ "pile_set_name": "Github" }
function [D,mu,sigma]=talairach_stats_correct(dirname, outdir) % % Computes the mean and covariance matrix from a training set % % By default, the 3 translation parameters are not considered % -> mu is a 1x9 vector and sigma a 9x9 matrix % % talairaching_stats.m % % Original Author: Laurence Wastiaux % % Copyright © 2011 The General Hospital Corporation (Boston, MA) "MGH" % % Terms and conditions for use, reproduction, distribution and contribution % are found in the 'FreeSurfer Software License Agreement' contained % in the file 'LICENSE' found in the FreeSurfer distribution, and here: % % https://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferSoftwareLicense % % Reporting: [email protected] % dirname1='/space/neo/2/recon/buckner/'; dirname2='/space/fiat/1/users/buckner/'; dirname3='/space/brainiac/1/users/xhan/freesurfer/Pfizer/LDA/Oct27/'; dirname4='/space/gam/2/users/jjwisco/GSK/cntls/'; mes=sprintf('Talairach stats...'); disp(mes) if (nargin>0) disp(dirname) D1=read_talmat(dirname); else D1=read_talmat(dirname1); end D=D1; D=[D(:,1) D(:,2) D(:,3) D(:,5) D(:,6) D(:,7) D(:,9) D(:,10) D(:,11)]; mu=mean(D); sigma=cov(D); %%% Regularisation of the covariance matrix %%% [u s v]=svd(sigma); ds=diag(s); ds(1:end)=ds(1:end)+0.15; sigma=u*(diag(ds))*v'; %save('/space/okapi/3/data/laurence/talairaching/transfo_param.mat', 'D'); %save('/space/okapi/3/data/laurence/talairaching/transfo_param_mean.mat', 'mu'); %save('/space/okapi/3/data/laurence/talairaching/transfo_param_regularizedCov.mat', 'sigma'); outmean=strcat(outdir, '/TalairachingMean_tmp.adf'); outcov=strcat(outdir, '/TalairachingCovariance_tmp.adf'); save(outmean, 'mu', '-ASCII'); save(outcov, 'sigma', '-ASCII'); %%% Subfunction read_talmat(dirname,opt) %%% %%% Collect the talairach parameters of all %%% %%% subjects in the directory "dirname" %%% function D=read_talmat(dname) D=0; files=dir(dname); for i=1:(length(files)) s=strcat(dname,'/',files(i).name); ttfile=strcat(s,'/mri/transforms/talairach.xfm'); fid=fopen(ttfile, 'r'); if ( (fid ~= -1) && ( length(strfind(files(i).name,'0'))>=1 ||(length(strfind(files(i).name,'1'))>=1 ))) while feof(fid) == 0 linef=fgetl(fid); nb=findstr(linef, 'Linear_Transform'); if nb == 1 pos=ftell(fid); break end end A=(fscanf(fid, '%g',12)); status=fclose(fid); if D==0 D=A'; else D=[D ; A']; end else i=i+1; end end
{ "pile_set_name": "Github" }
{ "1953.06.12": [ { "link": "http://lis.ly.gov.tw/ttscgi/lgimg?@421110;0082;0085", "desc": "42卷11期號10冊 82~85頁", "progress": "一讀", "committee": "法制" } ], "1954.06.18": [ { "link": "http://lis.ly.gov.tw/ttscgi/lgimg?@431306;0036;0038", "desc": "43卷13期號6冊 36~38頁", "progress": "二讀(廣泛討論)", "committee": "法制" } ], "1954.07.06": [ { "link": "http://lis.ly.gov.tw/ttscgi/lgimg?@431306;0132;0133", "desc": "43卷13期號6冊 132~133頁", "progress": "三讀", "committee": "法制" } ], "2003.03.28": [ { "link": "http://lis.ly.gov.tw/ttscgi/lgimg?@921501;0006;0006", "desc": "92卷15期3289號一冊 6~6頁", "progress": "一讀", "committee": "內政", "misc": { "content": "356-562", "link": "/lgcgi/lgmeetimage?cfcacfcccfcacfcec5cccac9d2cac9cd" } } ], "2003.04.18": [ { "link": "http://lis.ly.gov.tw/ttscgi/lgimg?@922101;0013;0013", "desc": "92卷21期3295號上冊 13~13頁", "progress": "一讀", "committee": "內政" } ], "2003.05.12": [ { "link": "http://lis.ly.gov.tw/ttscgi/lgimg?@923003;0003;0007", "desc": "92卷30期3304號下冊 3~7頁", "progress": "委員會審查", "committee": "內政" } ], "2003.05.27": [ { "link": "http://lis.ly.gov.tw/ttscgi/lgimg?@923102;0197;0374", "desc": "92卷31期3305號二冊 197~374頁", "progress": "三讀", "committee": "內政", "misc": { "content": "409-584", "link": "/lgcgi/lgmeetimage?cfcacfcccecccfcdc5cbcfc6d2cac7cb" } } ] }
{ "pile_set_name": "Github" }
#include <assert.h> #include <threads.h> int main() { thrd_yield(); assert(0); return 0; }
{ "pile_set_name": "Github" }
op { name: "UniqueWithCounts" input_arg { name: "x" type_attr: "T" } output_arg { name: "y" type_attr: "T" } output_arg { name: "idx" type_attr: "out_idx" } output_arg { name: "count" type_attr: "out_idx" } attr { name: "T" type: "type" } attr { name: "out_idx" type: "type" default_value { type: DT_INT32 } allowed_values { list { type: DT_INT32 type: DT_INT64 } } } }
{ "pile_set_name": "Github" }
"use strict"; const portMap = new WeakMap<any, browser.runtime.Port>(); /** * Allows typed access to a runtime.Port object. */ export class TypedPort<T extends any[]> { public name: string; public error?: { message: string }; public sender?: browser.runtime.MessageSender; constructor (port: browser.runtime.Port) { portMap.set(this, port); this.name = port.name; // @ts-ignore this.error = null; } public disconnect () { portMap.get(this)?.disconnect(); } public onDisconnect = { addListener: (cb: (port: TypedPort<T>) => void) => { portMap.get(this)?.onDisconnect.addListener(cb as any); } , removeListener: (cb: (port: TypedPort<T>) => void) => { portMap.get(this)?.onDisconnect.addListener(cb as any); } , hasListener: (cb: (port: TypedPort<T>) => void) => { return portMap.get(this)?.onDisconnect.hasListener(cb as any) ?? false; } }; public onMessage = { addListener: (cb: (message: T[number]) => void) => { portMap.get(this)?.onMessage.addListener(cb); } , removeListener: (cb: (message: T[number]) => void) => { portMap.get(this)?.onMessage.removeListener(cb); } , hasListener: (cb: (message: T[number]) => void) => { return portMap.get(this)?.onMessage.hasListener(cb as any) ?? false; } }; public postMessage (message: T[number]) { portMap.get(this)?.postMessage(message); } }
{ "pile_set_name": "Github" }
/** * Copyright 2016 Google Inc. * * 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. */ const THREE = require('three') import Time from 'Tone/type/Time' import TWEEN from 'tween.js' const CAMERA_DIST = 10 const TWO_PI = Math.PI * 2 export default class Canvas { constructor(container){ this._camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 10000 ) this._camera.position.z = CAMERA_DIST this._scene = new THREE.Scene() this._renderer = new THREE.WebGLRenderer({ antialias: false }) container.appendChild(this._renderer.domElement) this._renderer.domElement.id = 'three' // make a test plane const material = new THREE.MeshBasicMaterial({ color : 0xffffff }) // material.side = THREE.DoubleSide this._plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material) window.plane = this._plane this._scene.add(this._plane) this._bouncing = false this._bounceStart = 0 this._bounceRate = Time('4n').toMilliseconds() this._changingColor = false this._colorChangeTime = 0 this._colorChangeIndex = 0 this._colors = [[7,222,0],[9,51,255],[93,17,255],[101,177,255],[255,42,2],[255,181,115],[250,196,0],[5,153,0],[255,251,83],[46,220,0],[246,168,0],[182,87,255],[194,208,0]] .map((rgb) => new THREE.Color(rgb[0] / 255, rgb[1] / 255, rgb[2] / 255)) this._loop() } _loop(time){ requestAnimationFrame(this._loop.bind(this)) let now = Date.now() if (this._bouncing){ // let bounceAmount = Math.sin(this._bounceRate * TWO_PI * (now - this._bounceStart) / 1000) // bounceAmount = (bounceAmount + 1) let bounceAmount = (now - this._bounceStart) % this._bounceRate bounceAmount /= this._bounceRate this._camera.position.z = CAMERA_DIST - (1 - bounceAmount) / 2 } if (this._changingColor && ((now - this._colorChangeTime) > (this._bounceRate))){ this._plane.material.color = this._colors[this._colorChangeIndex] this._colorChangeIndex = (this._colorChangeIndex + 1) % this._colors.length this._colorChangeTime = now } this._renderer.render( this._scene, this._camera ) TWEEN.update(time); } changeColor(){ this._changingColor = true this._colorChangeTime = Date.now() } repeatTexture(){ const texture = this._plane.material.map window.texture = texture texture.wrapS = texture.wrapT = THREE.ClampToEdgeWrapping; const repeats = [1, 2, 4, 8] let index = 0 this._interval = setInterval(() => { texture.repeat.x = repeats[index] texture.repeat.y = repeats[index] index = (index + 1) % repeats.length }, this._bounceRate) } endChangeColor(){ this._changingColor = false this._plane.material.color = new THREE.Color(1, 1, 1) // clearInterval(this._interval) // this._plane.material.map.repeat.x = 1 // this._plane.material.map.repeat.y = 1 } /** * mirror the display for front facing cameras */ mirror(){ this._plane.scale.x *= -1 this._plane.material.side = THREE.BackSide this._plane.material.needsUpdate = true } resize(vidWidth, vidHeight){ //set the video plane size const vidAspect = vidWidth / vidHeight const camAspect = window.innerWidth / window.innerHeight this._plane.scale.x = vidAspect //http://stackoverflow.com/questions/14614252/how-to-fit-camera-to-object if (vidAspect > camAspect){ this._camera.fov = 2 * Math.atan( 1 / ( 2 * CAMERA_DIST ) ) * ( 180 / Math.PI ) } else { this._camera.fov = 2 * Math.atan( ( vidAspect / camAspect ) / ( 2 * CAMERA_DIST ) ) * ( 180 / Math.PI ) } //THREE resize this._renderer.setPixelRatio( window.devicePixelRatio ) this._renderer.setSize( window.innerWidth, window.innerHeight ) const windowHalfX = window.innerWidth / 2 const windowHalfY = window.innerHeight / 2 this._camera.aspect = camAspect this._camera.updateProjectionMatrix() this._renderer.setSize( window.innerWidth, window.innerHeight ) } setVideo(video){ this._renderer.domElement.classList.add('visible') const texture = new THREE.VideoTexture(video) texture.minFilter = THREE.LinearFilter; texture.magFilter = THREE.LinearFilter; this._plane.material.map = texture this._plane.material.needsUpdate = true } bounce(){ this._bouncing = true this._bounceStart = Date.now() } endBounce(){ this._bouncing = false } fail(time = 4000){ this._bouncing = false return new Promise((end) => { let plane = this._plane let scene = this._scene var tween = new TWEEN.Tween({scale : 1}) .to({scale : 0}, time) .onUpdate(function(){ plane.scale.y = this.scale }) .onComplete(function(){ scene.remove(plane) end() }) .easing(TWEEN.Easing.Quadratic.Out) .start() }) } }
{ "pile_set_name": "Github" }
"""Constants and membership tests for ASCII characters""" NUL = 0x00 # ^@ SOH = 0x01 # ^A STX = 0x02 # ^B ETX = 0x03 # ^C EOT = 0x04 # ^D ENQ = 0x05 # ^E ACK = 0x06 # ^F BEL = 0x07 # ^G BS = 0x08 # ^H TAB = 0x09 # ^I HT = 0x09 # ^I LF = 0x0a # ^J NL = 0x0a # ^J VT = 0x0b # ^K FF = 0x0c # ^L CR = 0x0d # ^M SO = 0x0e # ^N SI = 0x0f # ^O DLE = 0x10 # ^P DC1 = 0x11 # ^Q DC2 = 0x12 # ^R DC3 = 0x13 # ^S DC4 = 0x14 # ^T NAK = 0x15 # ^U SYN = 0x16 # ^V ETB = 0x17 # ^W CAN = 0x18 # ^X EM = 0x19 # ^Y SUB = 0x1a # ^Z ESC = 0x1b # ^[ FS = 0x1c # ^\ GS = 0x1d # ^] RS = 0x1e # ^^ US = 0x1f # ^_ SP = 0x20 # space DEL = 0x7f # delete controlnames = [ "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US", "SP" ] def _ctoi(c): if type(c) == type(""): return ord(c) else: return c def isalnum(c): return isalpha(c) or isdigit(c) def isalpha(c): return isupper(c) or islower(c) def isascii(c): return _ctoi(c) <= 127 # ? def isblank(c): return _ctoi(c) in (8,32) def iscntrl(c): return _ctoi(c) <= 31 def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57 def isgraph(c): return _ctoi(c) >= 33 and _ctoi(c) <= 126 def islower(c): return _ctoi(c) >= 97 and _ctoi(c) <= 122 def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126 def ispunct(c): return _ctoi(c) != 32 and not isalnum(c) def isspace(c): return _ctoi(c) in (9, 10, 11, 12, 13, 32) def isupper(c): return _ctoi(c) >= 65 and _ctoi(c) <= 90 def isxdigit(c): return isdigit(c) or \ (_ctoi(c) >= 65 and _ctoi(c) <= 70) or (_ctoi(c) >= 97 and _ctoi(c) <= 102) def isctrl(c): return _ctoi(c) < 32 def ismeta(c): return _ctoi(c) > 127 def ascii(c): if type(c) == type(""): return chr(_ctoi(c) & 0x7f) else: return _ctoi(c) & 0x7f def ctrl(c): if type(c) == type(""): return chr(_ctoi(c) & 0x1f) else: return _ctoi(c) & 0x1f def alt(c): if type(c) == type(""): return chr(_ctoi(c) | 0x80) else: return _ctoi(c) | 0x80 def unctrl(c): bits = _ctoi(c) if bits == 0x7f: rep = "^?" elif isprint(bits & 0x7f): rep = chr(bits & 0x7f) else: rep = "^" + chr(((bits & 0x7f) | 0x20) + 0x20) if bits & 0x80: return "!" + rep return rep
{ "pile_set_name": "Github" }
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only 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. */ #ifndef WCD9330_H #define WCD9330_H #include <sound/soc.h> #include <sound/jack.h> #include <sound/apr_audio-v2.h> #include <linux/mfd/wcd9xxx/wcd9xxx-slimslave.h> #include "wcd9xxx-mbhc.h" #include "wcd9xxx-resmgr.h" #include "wcd9xxx-common.h" #define TOMTOM_NUM_REGISTERS 0x400 #define TOMTOM_MAX_REGISTER (TOMTOM_NUM_REGISTERS-1) #define TOMTOM_CACHE_SIZE TOMTOM_NUM_REGISTERS #define TOMTOM_REG_VAL(reg, val) {reg, 0, val} #define TOMTOM_MCLK_ID 0 #define TOMTOM_REGISTER_START_OFFSET 0x800 #define TOMTOM_SB_PGD_PORT_RX_BASE 0x40 #define TOMTOM_SB_PGD_PORT_TX_BASE 0x50 #define WCD9330_DMIC_CLK_DIV_2 0x00 #define WCD9330_DMIC_CLK_DIV_3 0x01 #define WCD9330_DMIC_CLK_DIV_4 0x02 #define WCD9330_DMIC_CLK_DIV_6 0x03 #define WCD9330_DMIC_CLK_DIV_16 0x04 #define TOMTOM_ZDET_SUPPORTED true extern const u8 tomtom_reset_reg_defaults[TOMTOM_CACHE_SIZE]; struct tomtom_codec_dai_data { u32 rate; u32 *ch_num; u32 ch_act; u32 ch_tot; }; enum tomtom_pid_current { TOMTOM_PID_MIC_2P5_UA, TOMTOM_PID_MIC_5_UA, TOMTOM_PID_MIC_10_UA, TOMTOM_PID_MIC_20_UA, }; enum tomtom_mbhc_analog_pwr_cfg { TOMTOM_ANALOG_PWR_COLLAPSED = 0, TOMTOM_ANALOG_PWR_ON, TOMTOM_NUM_ANALOG_PWR_CONFIGS, }; enum { HPH_PA_NONE = 0, HPH_PA_R, HPH_PA_L, HPH_PA_L_R, }; /* Number of input and output Slimbus port */ enum { TOMTOM_RX1 = 0, TOMTOM_RX2, TOMTOM_RX3, TOMTOM_RX4, TOMTOM_RX5, TOMTOM_RX6, TOMTOM_RX7, TOMTOM_RX8, TOMTOM_RX9, TOMTOM_RX10, TOMTOM_RX11, TOMTOM_RX12, TOMTOM_RX13, TOMTOM_RX_MAX, }; enum { TOMTOM_TX1 = 0, TOMTOM_TX2, TOMTOM_TX3, TOMTOM_TX4, TOMTOM_TX5, TOMTOM_TX6, TOMTOM_TX7, TOMTOM_TX8, TOMTOM_TX9, TOMTOM_TX10, TOMTOM_TX11, TOMTOM_TX12, TOMTOM_TX13, TOMTOM_TX14, TOMTOM_TX15, TOMTOM_TX16, TOMTOM_TX_MAX, }; extern int tomtom_mclk_enable(struct snd_soc_codec *codec, int mclk_enable, bool dapm); extern int tomtom_codec_mclk_enable(struct snd_soc_codec *codec, int mclk_enable, bool dapm); extern int tomtom_hs_detect(struct snd_soc_codec *codec, struct wcd9xxx_mbhc_config *mbhc_cfg); extern void tomtom_hs_detect_exit(struct snd_soc_codec *codec); extern void *tomtom_get_afe_config(struct snd_soc_codec *codec, enum afe_config_type config_type); extern void tomtom_event_register( int (*machine_event_cb)(struct snd_soc_codec *codec, enum wcd9xxx_codec_event), struct snd_soc_codec *codec); extern void tomtom_register_ext_clk_cb( int (*codec_ext_clk_en)(struct snd_soc_codec *codec, int enable, bool dapm), int (*get_ext_clk_cnt) (void), struct snd_soc_codec *codec); extern int tomtom_enable_qfuse_sensing(struct snd_soc_codec *codec); #endif
{ "pile_set_name": "Github" }
/* * * Copyright 2014 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package grpc import ( "bytes" "sync" "testing" "google.golang.org/grpc/test/codec_perf" ) func marshalAndUnmarshal(t *testing.T, protoCodec Codec, expectedBody []byte) { p := &codec_perf.Buffer{} p.Body = expectedBody marshalledBytes, err := protoCodec.Marshal(p) if err != nil { t.Errorf("protoCodec.Marshal(_) returned an error") } if err := protoCodec.Unmarshal(marshalledBytes, p); err != nil { t.Errorf("protoCodec.Unmarshal(_) returned an error") } if bytes.Compare(p.GetBody(), expectedBody) != 0 { t.Errorf("Unexpected body; got %v; want %v", p.GetBody(), expectedBody) } } func TestBasicProtoCodecMarshalAndUnmarshal(t *testing.T) { marshalAndUnmarshal(t, protoCodec{}, []byte{1, 2, 3}) } // Try to catch possible race conditions around use of pools func TestConcurrentUsage(t *testing.T) { const ( numGoRoutines = 100 numMarshUnmarsh = 1000 ) // small, arbitrary byte slices protoBodies := [][]byte{ []byte("one"), []byte("two"), []byte("three"), []byte("four"), []byte("five"), } var wg sync.WaitGroup codec := protoCodec{} for i := 0; i < numGoRoutines; i++ { wg.Add(1) go func() { defer wg.Done() for k := 0; k < numMarshUnmarsh; k++ { marshalAndUnmarshal(t, codec, protoBodies[k%len(protoBodies)]) } }() } wg.Wait() } // TestStaggeredMarshalAndUnmarshalUsingSamePool tries to catch potential errors in which slices get // stomped on during reuse of a proto.Buffer. func TestStaggeredMarshalAndUnmarshalUsingSamePool(t *testing.T) { codec1 := protoCodec{} codec2 := protoCodec{} expectedBody1 := []byte{1, 2, 3} expectedBody2 := []byte{4, 5, 6} proto1 := codec_perf.Buffer{Body: expectedBody1} proto2 := codec_perf.Buffer{Body: expectedBody2} var m1, m2 []byte var err error if m1, err = codec1.Marshal(&proto1); err != nil { t.Errorf("protoCodec.Marshal(%v) failed", proto1) } if m2, err = codec2.Marshal(&proto2); err != nil { t.Errorf("protoCodec.Marshal(%v) failed", proto2) } if err = codec1.Unmarshal(m1, &proto1); err != nil { t.Errorf("protoCodec.Unmarshal(%v) failed", m1) } if err = codec2.Unmarshal(m2, &proto2); err != nil { t.Errorf("protoCodec.Unmarshal(%v) failed", m2) } b1 := proto1.GetBody() b2 := proto2.GetBody() for i, v := range b1 { if expectedBody1[i] != v { t.Errorf("expected %v at index %v but got %v", i, expectedBody1[i], v) } } for i, v := range b2 { if expectedBody2[i] != v { t.Errorf("expected %v at index %v but got %v", i, expectedBody2[i], v) } } }
{ "pile_set_name": "Github" }
Backbone Eye ============ A Firebug extension to debug Backbone based applications running off web-browsers. > "Understand Backbone application behavior without wading through JavaScript code. Work with application level constructs, pursue what-if exploration and more..." For detailed help, visit : http://dhruvaray.github.io/spa-eye/ For technical details on how to compile the extension, add test cases etc, visit the [wiki](https://github.com/dhruvaray/spa-eye/wiki). ### Watch a quick (3 minute) usage video [![ScreenShot](http://dhruvaray.github.io/spa-eye/site/img/video.png)](http://youtu.be/tEIxBqjR1Cc) ###Download Download from the Mozilla store : https://addons.mozilla.org/en-US/firefox/addon/Backbone-Eye/ If Backbone-Eye is useful in your work, do show your appreciation and encouragement by starring this repo or giving a review on the Mozilla store! ### Screenshots ![Screenshot](http://dhruvaray.github.io/spa-eye/site/img/composite.gif) ###Thanks * Backbone Eye [contributors](https://github.com/dhruvaray/spa-eye/graphs/contributors)! * The awesome folks @ the [Firebug forum](https://groups.google.com/forum/#!forum/firebug). * The awesome [Firebug](https://github.com/firebug/firebug) code. Even better than the available documentation! * [js-sequence diagrams](https://github.com/bramp/js-sequence-diagrams) for interaction trails. * [icoMoon - free version](http://icomoon.io/#icons) for our extension icons. * The [todomvc](http://todomvc.com/) site for providing (sexy looking) reference examples and is also used as a reference example in our documentation. ###License [Simplified BSD 2-Clause](https://github.com/dhruvaray/spa-eye/blob/master/extension/license.txt) ###Usage [Usage Stats](https://addons.mozilla.org/en-US/firefox/addon/Backbone-Eye/statistics/?last=30)
{ "pile_set_name": "Github" }
// Code generated by "stringer -type RoundingMode"; DO NOT EDIT. package number import "fmt" const _RoundingMode_name = "ToNearestEvenToNearestZeroToNearestAwayToPositiveInfToNegativeInfToZeroAwayFromZeronumModes" var _RoundingMode_index = [...]uint8{0, 13, 26, 39, 52, 65, 71, 83, 91} func (i RoundingMode) String() string { if i >= RoundingMode(len(_RoundingMode_index)-1) { return fmt.Sprintf("RoundingMode(%d)", i) } return _RoundingMode_name[_RoundingMode_index[i]:_RoundingMode_index[i+1]] }
{ "pile_set_name": "Github" }
--- title: "progress" layout: formula --- {{ content }}
{ "pile_set_name": "Github" }
var lowpan6__ble_8c = [ [ "ble_addr_to_eui64", "group__rfc7668if.html#gaa5b1823c2509b8816ef98dcac67e037c", null ], [ "eui64_to_ble_addr", "group__rfc7668if.html#ga3e245a85f9edddca93ddd2967209881d", null ], [ "rfc7668_if_init", "group__rfc7668if.html#ga3d940376bd983c14ffcc8d2580f3bdde", null ], [ "rfc7668_input", "group__rfc7668if.html#ga1d9d7aff9f2f0515f761be0802178197", null ], [ "rfc7668_output", "group__rfc7668if.html#ga22930ade4e77b3195fe59949834d85f0", null ], [ "rfc7668_set_context", "group__rfc7668if.html#ga29dc0ebb8e640b64a57008b940fbca1e", null ], [ "rfc7668_set_local_addr_eui64", "lowpan6__ble_8c.html#a9c5b721f6fb28b4c999baab56a65d8e2", null ], [ "rfc7668_set_local_addr_mac48", "lowpan6__ble_8c.html#a53d4e8096dd714f94c69d67a6cd49ac2", null ], [ "rfc7668_set_peer_addr_eui64", "lowpan6__ble_8c.html#a01b797f4fde59dfb803f0299e6a49593", null ], [ "rfc7668_set_peer_addr_mac48", "lowpan6__ble_8c.html#a437b9f9e85be644bd7b939413e3c81d0", null ], [ "tcpip_rfc7668_input", "lowpan6__ble_8c.html#a6ae90ad69f5d901eb44cf87b9120cd9a", null ] ];
{ "pile_set_name": "Github" }
From af4dba1b5d3cbd0bc724fca24d3d01d2878406df Mon Sep 17 00:00:00 2001 From: Konstantin Khlebnikov <[email protected]> Date: Mon, 11 Dec 2017 18:19:33 +0300 Subject: [PATCH 318/454] netfilter: ip6t_MASQUERADE: add dependency on conntrack module commit 23715275e4fb6f64358a499d20928a9e93819f2f upstream. After commit 4d3a57f23dec ("netfilter: conntrack: do not enable connection tracking unless needed") conntrack is disabled by default unless some module explicitly declares dependency in particular network namespace. Fixes: a357b3f80bc8 ("netfilter: nat: add dependencies on conntrack module") Signed-off-by: Konstantin Khlebnikov <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]> --- net/ipv6/netfilter/ip6t_MASQUERADE.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/net/ipv6/netfilter/ip6t_MASQUERADE.c +++ b/net/ipv6/netfilter/ip6t_MASQUERADE.c @@ -33,13 +33,19 @@ static int masquerade_tg6_checkentry(con if (range->flags & NF_NAT_RANGE_MAP_IPS) return -EINVAL; - return 0; + return nf_ct_netns_get(par->net, par->family); +} + +static void masquerade_tg6_destroy(const struct xt_tgdtor_param *par) +{ + nf_ct_netns_put(par->net, par->family); } static struct xt_target masquerade_tg6_reg __read_mostly = { .name = "MASQUERADE", .family = NFPROTO_IPV6, .checkentry = masquerade_tg6_checkentry, + .destroy = masquerade_tg6_destroy, .target = masquerade_tg6, .targetsize = sizeof(struct nf_nat_range), .table = "nat",
{ "pile_set_name": "Github" }
/* * Copyright (c) 2004, 2005 Intel Corporation. All rights reserved. * Copyright (c) 2004 Topspin Corporation. All rights reserved. * Copyright (c) 2004, 2005 Voltaire Corporation. All rights reserved. * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved. * Copyright (c) 2005 Network Appliance, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * 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. * */ #include <linux/dma-mapping.h> #include <linux/err.h> #include <linux/idr.h> #include <linux/interrupt.h> #include <linux/rbtree.h> #include <linux/sched.h> #include <linux/spinlock.h> #include <linux/workqueue.h> #include <linux/completion.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/sysctl.h> #include <rdma/iw_cm.h> #include <rdma/ib_addr.h> #include "iwcm.h" MODULE_AUTHOR("Tom Tucker"); MODULE_DESCRIPTION("iWARP CM"); MODULE_LICENSE("Dual BSD/GPL"); static struct workqueue_struct *iwcm_wq; struct iwcm_work { struct work_struct work; struct iwcm_id_private *cm_id; struct list_head list; struct iw_cm_event event; struct list_head free_list; }; static unsigned int default_backlog = 256; static struct ctl_table_header *iwcm_ctl_table_hdr; static struct ctl_table iwcm_ctl_table[] = { { .procname = "default_backlog", .data = &default_backlog, .maxlen = sizeof(default_backlog), .mode = 0644, .proc_handler = proc_dointvec, }, { } }; /* * The following services provide a mechanism for pre-allocating iwcm_work * elements. The design pre-allocates them based on the cm_id type: * LISTENING IDS: Get enough elements preallocated to handle the * listen backlog. * ACTIVE IDS: 4: CONNECT_REPLY, ESTABLISHED, DISCONNECT, CLOSE * PASSIVE IDS: 3: ESTABLISHED, DISCONNECT, CLOSE * * Allocating them in connect and listen avoids having to deal * with allocation failures on the event upcall from the provider (which * is called in the interrupt context). * * One exception is when creating the cm_id for incoming connection requests. * There are two cases: * 1) in the event upcall, cm_event_handler(), for a listening cm_id. If * the backlog is exceeded, then no more connection request events will * be processed. cm_event_handler() returns -ENOMEM in this case. Its up * to the provider to reject the connection request. * 2) in the connection request workqueue handler, cm_conn_req_handler(). * If work elements cannot be allocated for the new connect request cm_id, * then IWCM will call the provider reject method. This is ok since * cm_conn_req_handler() runs in the workqueue thread context. */ static struct iwcm_work *get_work(struct iwcm_id_private *cm_id_priv) { struct iwcm_work *work; if (list_empty(&cm_id_priv->work_free_list)) return NULL; work = list_entry(cm_id_priv->work_free_list.next, struct iwcm_work, free_list); list_del_init(&work->free_list); return work; } static void put_work(struct iwcm_work *work) { list_add(&work->free_list, &work->cm_id->work_free_list); } static void dealloc_work_entries(struct iwcm_id_private *cm_id_priv) { struct list_head *e, *tmp; list_for_each_safe(e, tmp, &cm_id_priv->work_free_list) kfree(list_entry(e, struct iwcm_work, free_list)); } static int alloc_work_entries(struct iwcm_id_private *cm_id_priv, int count) { struct iwcm_work *work; BUG_ON(!list_empty(&cm_id_priv->work_free_list)); while (count--) { work = kmalloc(sizeof(struct iwcm_work), GFP_KERNEL); if (!work) { dealloc_work_entries(cm_id_priv); return -ENOMEM; } work->cm_id = cm_id_priv; INIT_LIST_HEAD(&work->list); put_work(work); } return 0; } /* * Save private data from incoming connection requests to * iw_cm_event, so the low level driver doesn't have to. Adjust * the event ptr to point to the local copy. */ static int copy_private_data(struct iw_cm_event *event) { void *p; p = kmemdup(event->private_data, event->private_data_len, GFP_ATOMIC); if (!p) return -ENOMEM; event->private_data = p; return 0; } static void free_cm_id(struct iwcm_id_private *cm_id_priv) { dealloc_work_entries(cm_id_priv); kfree(cm_id_priv); } /* * Release a reference on cm_id. If the last reference is being * released, enable the waiting thread (in iw_destroy_cm_id) to * get woken up, and return 1 if a thread is already waiting. */ static int iwcm_deref_id(struct iwcm_id_private *cm_id_priv) { BUG_ON(atomic_read(&cm_id_priv->refcount)==0); if (atomic_dec_and_test(&cm_id_priv->refcount)) { BUG_ON(!list_empty(&cm_id_priv->work_list)); complete(&cm_id_priv->destroy_comp); return 1; } return 0; } static void add_ref(struct iw_cm_id *cm_id) { struct iwcm_id_private *cm_id_priv; cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); atomic_inc(&cm_id_priv->refcount); } static void rem_ref(struct iw_cm_id *cm_id) { struct iwcm_id_private *cm_id_priv; int cb_destroy; cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); /* * Test bit before deref in case the cm_id gets freed on another * thread. */ cb_destroy = test_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags); if (iwcm_deref_id(cm_id_priv) && cb_destroy) { BUG_ON(!list_empty(&cm_id_priv->work_list)); free_cm_id(cm_id_priv); } } static int cm_event_handler(struct iw_cm_id *cm_id, struct iw_cm_event *event); struct iw_cm_id *iw_create_cm_id(struct ib_device *device, iw_cm_handler cm_handler, void *context) { struct iwcm_id_private *cm_id_priv; cm_id_priv = kzalloc(sizeof(*cm_id_priv), GFP_KERNEL); if (!cm_id_priv) return ERR_PTR(-ENOMEM); cm_id_priv->state = IW_CM_STATE_IDLE; cm_id_priv->id.device = device; cm_id_priv->id.cm_handler = cm_handler; cm_id_priv->id.context = context; cm_id_priv->id.event_handler = cm_event_handler; cm_id_priv->id.add_ref = add_ref; cm_id_priv->id.rem_ref = rem_ref; spin_lock_init(&cm_id_priv->lock); atomic_set(&cm_id_priv->refcount, 1); init_waitqueue_head(&cm_id_priv->connect_wait); init_completion(&cm_id_priv->destroy_comp); INIT_LIST_HEAD(&cm_id_priv->work_list); INIT_LIST_HEAD(&cm_id_priv->work_free_list); return &cm_id_priv->id; } EXPORT_SYMBOL(iw_create_cm_id); static int iwcm_modify_qp_err(struct ib_qp *qp) { struct ib_qp_attr qp_attr; if (!qp) return -EINVAL; qp_attr.qp_state = IB_QPS_ERR; return ib_modify_qp(qp, &qp_attr, IB_QP_STATE); } /* * This is really the RDMAC CLOSING state. It is most similar to the * IB SQD QP state. */ static int iwcm_modify_qp_sqd(struct ib_qp *qp) { struct ib_qp_attr qp_attr; BUG_ON(qp == NULL); qp_attr.qp_state = IB_QPS_SQD; return ib_modify_qp(qp, &qp_attr, IB_QP_STATE); } /* * CM_ID <-- CLOSING * * Block if a passive or active connection is currently being processed. Then * process the event as follows: * - If we are ESTABLISHED, move to CLOSING and modify the QP state * based on the abrupt flag * - If the connection is already in the CLOSING or IDLE state, the peer is * disconnecting concurrently with us and we've already seen the * DISCONNECT event -- ignore the request and return 0 * - Disconnect on a listening endpoint returns -EINVAL */ int iw_cm_disconnect(struct iw_cm_id *cm_id, int abrupt) { struct iwcm_id_private *cm_id_priv; unsigned long flags; int ret = 0; struct ib_qp *qp = NULL; cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); /* Wait if we're currently in a connect or accept downcall */ wait_event(cm_id_priv->connect_wait, !test_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags)); spin_lock_irqsave(&cm_id_priv->lock, flags); switch (cm_id_priv->state) { case IW_CM_STATE_ESTABLISHED: cm_id_priv->state = IW_CM_STATE_CLOSING; /* QP could be <nul> for user-mode client */ if (cm_id_priv->qp) qp = cm_id_priv->qp; else ret = -EINVAL; break; case IW_CM_STATE_LISTEN: ret = -EINVAL; break; case IW_CM_STATE_CLOSING: /* remote peer closed first */ case IW_CM_STATE_IDLE: /* accept or connect returned !0 */ break; case IW_CM_STATE_CONN_RECV: /* * App called disconnect before/without calling accept after * connect_request event delivered. */ break; case IW_CM_STATE_CONN_SENT: /* Can only get here if wait above fails */ default: BUG(); } spin_unlock_irqrestore(&cm_id_priv->lock, flags); if (qp) { if (abrupt) ret = iwcm_modify_qp_err(qp); else ret = iwcm_modify_qp_sqd(qp); /* * If both sides are disconnecting the QP could * already be in ERR or SQD states */ ret = 0; } return ret; } EXPORT_SYMBOL(iw_cm_disconnect); /* * CM_ID <-- DESTROYING * * Clean up all resources associated with the connection and release * the initial reference taken by iw_create_cm_id. */ static void destroy_cm_id(struct iw_cm_id *cm_id) { struct iwcm_id_private *cm_id_priv; unsigned long flags; cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); /* * Wait if we're currently in a connect or accept downcall. A * listening endpoint should never block here. */ wait_event(cm_id_priv->connect_wait, !test_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags)); spin_lock_irqsave(&cm_id_priv->lock, flags); switch (cm_id_priv->state) { case IW_CM_STATE_LISTEN: cm_id_priv->state = IW_CM_STATE_DESTROYING; spin_unlock_irqrestore(&cm_id_priv->lock, flags); /* destroy the listening endpoint */ cm_id->device->iwcm->destroy_listen(cm_id); spin_lock_irqsave(&cm_id_priv->lock, flags); break; case IW_CM_STATE_ESTABLISHED: cm_id_priv->state = IW_CM_STATE_DESTROYING; spin_unlock_irqrestore(&cm_id_priv->lock, flags); /* Abrupt close of the connection */ (void)iwcm_modify_qp_err(cm_id_priv->qp); spin_lock_irqsave(&cm_id_priv->lock, flags); break; case IW_CM_STATE_IDLE: case IW_CM_STATE_CLOSING: cm_id_priv->state = IW_CM_STATE_DESTROYING; break; case IW_CM_STATE_CONN_RECV: /* * App called destroy before/without calling accept after * receiving connection request event notification or * returned non zero from the event callback function. * In either case, must tell the provider to reject. */ cm_id_priv->state = IW_CM_STATE_DESTROYING; spin_unlock_irqrestore(&cm_id_priv->lock, flags); cm_id->device->iwcm->reject(cm_id, NULL, 0); spin_lock_irqsave(&cm_id_priv->lock, flags); break; case IW_CM_STATE_CONN_SENT: case IW_CM_STATE_DESTROYING: default: BUG(); break; } if (cm_id_priv->qp) { cm_id_priv->id.device->iwcm->rem_ref(cm_id_priv->qp); cm_id_priv->qp = NULL; } spin_unlock_irqrestore(&cm_id_priv->lock, flags); (void)iwcm_deref_id(cm_id_priv); } /* * This function is only called by the application thread and cannot * be called by the event thread. The function will wait for all * references to be released on the cm_id and then kfree the cm_id * object. */ void iw_destroy_cm_id(struct iw_cm_id *cm_id) { struct iwcm_id_private *cm_id_priv; cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); BUG_ON(test_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags)); destroy_cm_id(cm_id); wait_for_completion(&cm_id_priv->destroy_comp); free_cm_id(cm_id_priv); } EXPORT_SYMBOL(iw_destroy_cm_id); /* * CM_ID <-- LISTEN * * Start listening for connect requests. Generates one CONNECT_REQUEST * event for each inbound connect request. */ int iw_cm_listen(struct iw_cm_id *cm_id, int backlog) { struct iwcm_id_private *cm_id_priv; unsigned long flags; int ret; cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); if (!backlog) backlog = default_backlog; ret = alloc_work_entries(cm_id_priv, backlog); if (ret) return ret; spin_lock_irqsave(&cm_id_priv->lock, flags); switch (cm_id_priv->state) { case IW_CM_STATE_IDLE: cm_id_priv->state = IW_CM_STATE_LISTEN; spin_unlock_irqrestore(&cm_id_priv->lock, flags); ret = cm_id->device->iwcm->create_listen(cm_id, backlog); if (ret) cm_id_priv->state = IW_CM_STATE_IDLE; spin_lock_irqsave(&cm_id_priv->lock, flags); break; default: ret = -EINVAL; } spin_unlock_irqrestore(&cm_id_priv->lock, flags); return ret; } EXPORT_SYMBOL(iw_cm_listen); /* * CM_ID <-- IDLE * * Rejects an inbound connection request. No events are generated. */ int iw_cm_reject(struct iw_cm_id *cm_id, const void *private_data, u8 private_data_len) { struct iwcm_id_private *cm_id_priv; unsigned long flags; int ret; cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); set_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags); spin_lock_irqsave(&cm_id_priv->lock, flags); if (cm_id_priv->state != IW_CM_STATE_CONN_RECV) { spin_unlock_irqrestore(&cm_id_priv->lock, flags); clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags); wake_up_all(&cm_id_priv->connect_wait); return -EINVAL; } cm_id_priv->state = IW_CM_STATE_IDLE; spin_unlock_irqrestore(&cm_id_priv->lock, flags); ret = cm_id->device->iwcm->reject(cm_id, private_data, private_data_len); clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags); wake_up_all(&cm_id_priv->connect_wait); return ret; } EXPORT_SYMBOL(iw_cm_reject); /* * CM_ID <-- ESTABLISHED * * Accepts an inbound connection request and generates an ESTABLISHED * event. Callers of iw_cm_disconnect and iw_destroy_cm_id will block * until the ESTABLISHED event is received from the provider. */ int iw_cm_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param) { struct iwcm_id_private *cm_id_priv; struct ib_qp *qp; unsigned long flags; int ret; cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); set_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags); spin_lock_irqsave(&cm_id_priv->lock, flags); if (cm_id_priv->state != IW_CM_STATE_CONN_RECV) { spin_unlock_irqrestore(&cm_id_priv->lock, flags); clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags); wake_up_all(&cm_id_priv->connect_wait); return -EINVAL; } /* Get the ib_qp given the QPN */ qp = cm_id->device->iwcm->get_qp(cm_id->device, iw_param->qpn); if (!qp) { spin_unlock_irqrestore(&cm_id_priv->lock, flags); clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags); wake_up_all(&cm_id_priv->connect_wait); return -EINVAL; } cm_id->device->iwcm->add_ref(qp); cm_id_priv->qp = qp; spin_unlock_irqrestore(&cm_id_priv->lock, flags); ret = cm_id->device->iwcm->accept(cm_id, iw_param); if (ret) { /* An error on accept precludes provider events */ BUG_ON(cm_id_priv->state != IW_CM_STATE_CONN_RECV); cm_id_priv->state = IW_CM_STATE_IDLE; spin_lock_irqsave(&cm_id_priv->lock, flags); if (cm_id_priv->qp) { cm_id->device->iwcm->rem_ref(qp); cm_id_priv->qp = NULL; } spin_unlock_irqrestore(&cm_id_priv->lock, flags); clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags); wake_up_all(&cm_id_priv->connect_wait); } return ret; } EXPORT_SYMBOL(iw_cm_accept); /* * Active Side: CM_ID <-- CONN_SENT * * If successful, results in the generation of a CONNECT_REPLY * event. iw_cm_disconnect and iw_cm_destroy will block until the * CONNECT_REPLY event is received from the provider. */ int iw_cm_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *iw_param) { struct iwcm_id_private *cm_id_priv; int ret; unsigned long flags; struct ib_qp *qp; cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); ret = alloc_work_entries(cm_id_priv, 4); if (ret) return ret; set_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags); spin_lock_irqsave(&cm_id_priv->lock, flags); if (cm_id_priv->state != IW_CM_STATE_IDLE) { spin_unlock_irqrestore(&cm_id_priv->lock, flags); clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags); wake_up_all(&cm_id_priv->connect_wait); return -EINVAL; } /* Get the ib_qp given the QPN */ qp = cm_id->device->iwcm->get_qp(cm_id->device, iw_param->qpn); if (!qp) { spin_unlock_irqrestore(&cm_id_priv->lock, flags); clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags); wake_up_all(&cm_id_priv->connect_wait); return -EINVAL; } cm_id->device->iwcm->add_ref(qp); cm_id_priv->qp = qp; cm_id_priv->state = IW_CM_STATE_CONN_SENT; spin_unlock_irqrestore(&cm_id_priv->lock, flags); ret = cm_id->device->iwcm->connect(cm_id, iw_param); if (ret) { spin_lock_irqsave(&cm_id_priv->lock, flags); if (cm_id_priv->qp) { cm_id->device->iwcm->rem_ref(qp); cm_id_priv->qp = NULL; } spin_unlock_irqrestore(&cm_id_priv->lock, flags); BUG_ON(cm_id_priv->state != IW_CM_STATE_CONN_SENT); cm_id_priv->state = IW_CM_STATE_IDLE; clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags); wake_up_all(&cm_id_priv->connect_wait); } return ret; } EXPORT_SYMBOL(iw_cm_connect); /* * Passive Side: new CM_ID <-- CONN_RECV * * Handles an inbound connect request. The function creates a new * iw_cm_id to represent the new connection and inherits the client * callback function and other attributes from the listening parent. * * The work item contains a pointer to the listen_cm_id and the event. The * listen_cm_id contains the client cm_handler, context and * device. These are copied when the device is cloned. The event * contains the new four tuple. * * An error on the child should not affect the parent, so this * function does not return a value. */ static void cm_conn_req_handler(struct iwcm_id_private *listen_id_priv, struct iw_cm_event *iw_event) { unsigned long flags; struct iw_cm_id *cm_id; struct iwcm_id_private *cm_id_priv; int ret; /* * The provider should never generate a connection request * event with a bad status. */ BUG_ON(iw_event->status); cm_id = iw_create_cm_id(listen_id_priv->id.device, listen_id_priv->id.cm_handler, listen_id_priv->id.context); /* If the cm_id could not be created, ignore the request */ if (IS_ERR(cm_id)) goto out; cm_id->provider_data = iw_event->provider_data; cm_id->local_addr = iw_event->local_addr; cm_id->remote_addr = iw_event->remote_addr; cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); cm_id_priv->state = IW_CM_STATE_CONN_RECV; /* * We could be destroying the listening id. If so, ignore this * upcall. */ spin_lock_irqsave(&listen_id_priv->lock, flags); if (listen_id_priv->state != IW_CM_STATE_LISTEN) { spin_unlock_irqrestore(&listen_id_priv->lock, flags); iw_cm_reject(cm_id, NULL, 0); iw_destroy_cm_id(cm_id); goto out; } spin_unlock_irqrestore(&listen_id_priv->lock, flags); ret = alloc_work_entries(cm_id_priv, 3); if (ret) { iw_cm_reject(cm_id, NULL, 0); iw_destroy_cm_id(cm_id); goto out; } /* Call the client CM handler */ ret = cm_id->cm_handler(cm_id, iw_event); if (ret) { iw_cm_reject(cm_id, NULL, 0); set_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags); destroy_cm_id(cm_id); if (atomic_read(&cm_id_priv->refcount)==0) free_cm_id(cm_id_priv); } out: if (iw_event->private_data_len) kfree(iw_event->private_data); } /* * Passive Side: CM_ID <-- ESTABLISHED * * The provider generated an ESTABLISHED event which means that * the MPA negotion has completed successfully and we are now in MPA * FPDU mode. * * This event can only be received in the CONN_RECV state. If the * remote peer closed, the ESTABLISHED event would be received followed * by the CLOSE event. If the app closes, it will block until we wake * it up after processing this event. */ static int cm_conn_est_handler(struct iwcm_id_private *cm_id_priv, struct iw_cm_event *iw_event) { unsigned long flags; int ret; spin_lock_irqsave(&cm_id_priv->lock, flags); /* * We clear the CONNECT_WAIT bit here to allow the callback * function to call iw_cm_disconnect. Calling iw_destroy_cm_id * from a callback handler is not allowed. */ clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags); BUG_ON(cm_id_priv->state != IW_CM_STATE_CONN_RECV); cm_id_priv->state = IW_CM_STATE_ESTABLISHED; spin_unlock_irqrestore(&cm_id_priv->lock, flags); ret = cm_id_priv->id.cm_handler(&cm_id_priv->id, iw_event); wake_up_all(&cm_id_priv->connect_wait); return ret; } /* * Active Side: CM_ID <-- ESTABLISHED * * The app has called connect and is waiting for the established event to * post it's requests to the server. This event will wake up anyone * blocked in iw_cm_disconnect or iw_destroy_id. */ static int cm_conn_rep_handler(struct iwcm_id_private *cm_id_priv, struct iw_cm_event *iw_event) { unsigned long flags; int ret; spin_lock_irqsave(&cm_id_priv->lock, flags); /* * Clear the connect wait bit so a callback function calling * iw_cm_disconnect will not wait and deadlock this thread */ clear_bit(IWCM_F_CONNECT_WAIT, &cm_id_priv->flags); BUG_ON(cm_id_priv->state != IW_CM_STATE_CONN_SENT); if (iw_event->status == 0) { cm_id_priv->id.local_addr = iw_event->local_addr; cm_id_priv->id.remote_addr = iw_event->remote_addr; cm_id_priv->state = IW_CM_STATE_ESTABLISHED; } else { /* REJECTED or RESET */ cm_id_priv->id.device->iwcm->rem_ref(cm_id_priv->qp); cm_id_priv->qp = NULL; cm_id_priv->state = IW_CM_STATE_IDLE; } spin_unlock_irqrestore(&cm_id_priv->lock, flags); ret = cm_id_priv->id.cm_handler(&cm_id_priv->id, iw_event); if (iw_event->private_data_len) kfree(iw_event->private_data); /* Wake up waiters on connect complete */ wake_up_all(&cm_id_priv->connect_wait); return ret; } /* * CM_ID <-- CLOSING * * If in the ESTABLISHED state, move to CLOSING. */ static void cm_disconnect_handler(struct iwcm_id_private *cm_id_priv, struct iw_cm_event *iw_event) { unsigned long flags; spin_lock_irqsave(&cm_id_priv->lock, flags); if (cm_id_priv->state == IW_CM_STATE_ESTABLISHED) cm_id_priv->state = IW_CM_STATE_CLOSING; spin_unlock_irqrestore(&cm_id_priv->lock, flags); } /* * CM_ID <-- IDLE * * If in the ESTBLISHED or CLOSING states, the QP will have have been * moved by the provider to the ERR state. Disassociate the CM_ID from * the QP, move to IDLE, and remove the 'connected' reference. * * If in some other state, the cm_id was destroyed asynchronously. * This is the last reference that will result in waking up * the app thread blocked in iw_destroy_cm_id. */ static int cm_close_handler(struct iwcm_id_private *cm_id_priv, struct iw_cm_event *iw_event) { unsigned long flags; int ret = 0; spin_lock_irqsave(&cm_id_priv->lock, flags); if (cm_id_priv->qp) { cm_id_priv->id.device->iwcm->rem_ref(cm_id_priv->qp); cm_id_priv->qp = NULL; } switch (cm_id_priv->state) { case IW_CM_STATE_ESTABLISHED: case IW_CM_STATE_CLOSING: cm_id_priv->state = IW_CM_STATE_IDLE; spin_unlock_irqrestore(&cm_id_priv->lock, flags); ret = cm_id_priv->id.cm_handler(&cm_id_priv->id, iw_event); spin_lock_irqsave(&cm_id_priv->lock, flags); break; case IW_CM_STATE_DESTROYING: break; default: BUG(); } spin_unlock_irqrestore(&cm_id_priv->lock, flags); return ret; } static int process_event(struct iwcm_id_private *cm_id_priv, struct iw_cm_event *iw_event) { int ret = 0; switch (iw_event->event) { case IW_CM_EVENT_CONNECT_REQUEST: cm_conn_req_handler(cm_id_priv, iw_event); break; case IW_CM_EVENT_CONNECT_REPLY: ret = cm_conn_rep_handler(cm_id_priv, iw_event); break; case IW_CM_EVENT_ESTABLISHED: ret = cm_conn_est_handler(cm_id_priv, iw_event); break; case IW_CM_EVENT_DISCONNECT: cm_disconnect_handler(cm_id_priv, iw_event); break; case IW_CM_EVENT_CLOSE: ret = cm_close_handler(cm_id_priv, iw_event); break; default: BUG(); } return ret; } /* * Process events on the work_list for the cm_id. If the callback * function requests that the cm_id be deleted, a flag is set in the * cm_id flags to indicate that when the last reference is * removed, the cm_id is to be destroyed. This is necessary to * distinguish between an object that will be destroyed by the app * thread asleep on the destroy_comp list vs. an object destroyed * here synchronously when the last reference is removed. */ static void cm_work_handler(struct work_struct *_work) { struct iwcm_work *work = container_of(_work, struct iwcm_work, work); struct iw_cm_event levent; struct iwcm_id_private *cm_id_priv = work->cm_id; unsigned long flags; int empty; int ret = 0; int destroy_id; spin_lock_irqsave(&cm_id_priv->lock, flags); empty = list_empty(&cm_id_priv->work_list); while (!empty) { work = list_entry(cm_id_priv->work_list.next, struct iwcm_work, list); list_del_init(&work->list); empty = list_empty(&cm_id_priv->work_list); levent = work->event; put_work(work); spin_unlock_irqrestore(&cm_id_priv->lock, flags); ret = process_event(cm_id_priv, &levent); if (ret) { set_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags); destroy_cm_id(&cm_id_priv->id); } BUG_ON(atomic_read(&cm_id_priv->refcount)==0); destroy_id = test_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags); if (iwcm_deref_id(cm_id_priv)) { if (destroy_id) { BUG_ON(!list_empty(&cm_id_priv->work_list)); free_cm_id(cm_id_priv); } return; } if (empty) return; spin_lock_irqsave(&cm_id_priv->lock, flags); } spin_unlock_irqrestore(&cm_id_priv->lock, flags); } /* * This function is called on interrupt context. Schedule events on * the iwcm_wq thread to allow callback functions to downcall into * the CM and/or block. Events are queued to a per-CM_ID * work_list. If this is the first event on the work_list, the work * element is also queued on the iwcm_wq thread. * * Each event holds a reference on the cm_id. Until the last posted * event has been delivered and processed, the cm_id cannot be * deleted. * * Returns: * 0 - the event was handled. * -ENOMEM - the event was not handled due to lack of resources. */ static int cm_event_handler(struct iw_cm_id *cm_id, struct iw_cm_event *iw_event) { struct iwcm_work *work; struct iwcm_id_private *cm_id_priv; unsigned long flags; int ret = 0; cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); spin_lock_irqsave(&cm_id_priv->lock, flags); work = get_work(cm_id_priv); if (!work) { ret = -ENOMEM; goto out; } INIT_WORK(&work->work, cm_work_handler); work->cm_id = cm_id_priv; work->event = *iw_event; if ((work->event.event == IW_CM_EVENT_CONNECT_REQUEST || work->event.event == IW_CM_EVENT_CONNECT_REPLY) && work->event.private_data_len) { ret = copy_private_data(&work->event); if (ret) { put_work(work); goto out; } } atomic_inc(&cm_id_priv->refcount); if (list_empty(&cm_id_priv->work_list)) { list_add_tail(&work->list, &cm_id_priv->work_list); queue_work(iwcm_wq, &work->work); } else list_add_tail(&work->list, &cm_id_priv->work_list); out: spin_unlock_irqrestore(&cm_id_priv->lock, flags); return ret; } static int iwcm_init_qp_init_attr(struct iwcm_id_private *cm_id_priv, struct ib_qp_attr *qp_attr, int *qp_attr_mask) { unsigned long flags; int ret; spin_lock_irqsave(&cm_id_priv->lock, flags); switch (cm_id_priv->state) { case IW_CM_STATE_IDLE: case IW_CM_STATE_CONN_SENT: case IW_CM_STATE_CONN_RECV: case IW_CM_STATE_ESTABLISHED: *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS; qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE| IB_ACCESS_REMOTE_READ; ret = 0; break; default: ret = -EINVAL; break; } spin_unlock_irqrestore(&cm_id_priv->lock, flags); return ret; } static int iwcm_init_qp_rts_attr(struct iwcm_id_private *cm_id_priv, struct ib_qp_attr *qp_attr, int *qp_attr_mask) { unsigned long flags; int ret; spin_lock_irqsave(&cm_id_priv->lock, flags); switch (cm_id_priv->state) { case IW_CM_STATE_IDLE: case IW_CM_STATE_CONN_SENT: case IW_CM_STATE_CONN_RECV: case IW_CM_STATE_ESTABLISHED: *qp_attr_mask = 0; ret = 0; break; default: ret = -EINVAL; break; } spin_unlock_irqrestore(&cm_id_priv->lock, flags); return ret; } int iw_cm_init_qp_attr(struct iw_cm_id *cm_id, struct ib_qp_attr *qp_attr, int *qp_attr_mask) { struct iwcm_id_private *cm_id_priv; int ret; cm_id_priv = container_of(cm_id, struct iwcm_id_private, id); switch (qp_attr->qp_state) { case IB_QPS_INIT: case IB_QPS_RTR: ret = iwcm_init_qp_init_attr(cm_id_priv, qp_attr, qp_attr_mask); break; case IB_QPS_RTS: ret = iwcm_init_qp_rts_attr(cm_id_priv, qp_attr, qp_attr_mask); break; default: ret = -EINVAL; break; } return ret; } EXPORT_SYMBOL(iw_cm_init_qp_attr); static int __init iw_cm_init(void) { iwcm_wq = create_singlethread_workqueue("iw_cm_wq"); if (!iwcm_wq) return -ENOMEM; iwcm_ctl_table_hdr = register_net_sysctl(&init_net, "net/iw_cm", iwcm_ctl_table); if (!iwcm_ctl_table_hdr) { pr_err("iw_cm: couldn't register sysctl paths\n"); destroy_workqueue(iwcm_wq); return -ENOMEM; } return 0; } static void __exit iw_cm_cleanup(void) { unregister_net_sysctl_table(iwcm_ctl_table_hdr); destroy_workqueue(iwcm_wq); } module_init(iw_cm_init); module_exit(iw_cm_cleanup);
{ "pile_set_name": "Github" }
/* SPDX-License-Identifier: GPL-2.0-or-later */ #include <device/device.h> #include <device/pci.h> #include <device/pci_ops.h> #include <device/pci_ids.h> #include <console/console.h> #include <device/cardbus.h> #include <delay.h> #include "rl5c476.h" #include "chip.h" static int enable_cf_boot = 0; static unsigned int cf_base; static void rl5c476_init(struct device *dev) { pc16reg_t *pc16; unsigned char *base; /* cardbus controller function 1 for CF Socket */ printk(BIOS_DEBUG, "Ricoh RL5c476: Initializing.\n"); printk(BIOS_DEBUG, "CF Base = %0x\n",cf_base); /* misc control register */ pci_write_config16(dev,0x82,0x00a0); /* set up second slot as compact flash port if asked to do so */ if (!enable_cf_boot) { printk(BIOS_DEBUG, "CF boot not enabled.\n"); return; } if (PCI_FUNC(dev->path.pci.devfn) != 1) { // Only configure if second CF slot. return; } /* make sure isa interrupts are enabled */ pci_write_config16(dev,0x3e,0x0780); /* pick up where 16 bit card control structure is * (0x800 bytes into config structure) */ base = (unsigned char *)pci_read_config32(dev,0x10); pc16 = (pc16reg_t *)(base + 0x800); /* disable memory and io windows and turn off socket power */ pc16->pwctrl = 0; /* disable irq lines */ pc16->igctrl = 0; /* disable memory and I/O windows */ pc16->awinen = 0; /* reset card, configure for I/O and set IRQ line */ pc16->igctrl = 0x69; /* set io window 0 for 1e0 - 1ef */ /* NOTE: This now sets CF up on a contiguous I/O window of * 16 bytes, 0x1e0 to 0x1ef. * Be warned that this is not a standard IDE address as * automatically detected by the likes of FILO, and would need * patching to recognize these addresses as an IDE drive. * * An earlier version of this driver set up 2 I/O windows to * emulate the expected addresses for IDE2, however the PCMCIA * package within Linux then could not re-initialize the * device as it tried to take control of it. So I believe it is * easier to patch Filo or the like to pick up this drive * rather than playing silly games as the kernel tries to * boot. * * Nonetheless, FILO needs a special option enabled to boot * from this configuration, and it needs to clean up * afterwards. Please refer to FILO documentation and source * code for more details. */ pc16->iostl0 = 0xe0; pc16->iosth0 = 1; pc16->iospl0 = 0xef; pc16->iosph0 = 1; pc16->ioffl0 = 0; pc16->ioffh0 = 0; /* clear window 1 */ pc16->iostl1 = 0; pc16->iosth1 = 0; pc16->iospl1 = 0; pc16->iosph1 = 0; pc16->ioffl1 = 0x0; pc16->ioffh1 = 0; /* set up CF config window */ pc16->smpga0 = cf_base>>24; pc16->smsth0 = (cf_base>>20)&0x0f; pc16->smstl0 = (cf_base>>12)&0xff; pc16->smsph0 = ((cf_base>>20)&0x0f) | 0x80; pc16->smspl0 = (cf_base>>12)&0xff; pc16->moffl0 = 0; pc16->moffh0 = 0x40; /* set I/O width for Auto Data width */ pc16->ioctrl = 0x22; /* enable I/O window 0 and 1 */ pc16->awinen = 0xc1; pc16->miscc1 = 1; /* apply power and enable outputs */ pc16->pwctrl = 0xb0; // delay could be optimised, but this works udelay(100000); pc16->igctrl = 0x69; /* 16 bit CF always have first config byte at 0x200 into * Config structure, but CF+ may not according to spec - * should locate through reading tuple data, but this should * do for now. */ unsigned char *cptr; cptr = (unsigned char *)(cf_base + 0x200); printk(BIOS_DEBUG, "CF Config = %x\n",*cptr); /* Set CF to decode 16 IO bytes on any 16 byte boundary - * rely on the io windows of the bridge set up above to * map those bytes into the addresses for IDE controller 3 * (0x1e8 - 0x1ef and 0x3ed - 0x3ee) */ *cptr = 0x41; } static void rl5c476_read_resources(struct device *dev) { struct resource *resource; /* For CF socket we need an extra memory window for * the control structure of the CF itself */ if (enable_cf_boot && (PCI_FUNC(dev->path.pci.devfn) == 1)) { /* fake index as it isn't in PCI config space */ resource = new_resource(dev, 1); resource->flags |= IORESOURCE_MEM; resource->size = 0x1000; resource->align = resource->gran = 12; resource->limit= 0xffff0000; } cardbus_read_resources(dev); } static void rl5c476_set_resources(struct device *dev) { struct resource *resource; printk(BIOS_DEBUG, "%s In set resources\n",dev_path(dev)); if (enable_cf_boot && (PCI_FUNC(dev->path.pci.devfn) == 1)) { resource = find_resource(dev,1); if (!(resource->flags & IORESOURCE_STORED)) { resource->flags |= IORESOURCE_STORED; printk(BIOS_DEBUG, "%s 1 ==> %llx\n", dev_path(dev), resource->base); cf_base = resource->base; } } pci_dev_set_resources(dev); } static void rl5c476_set_subsystem(struct device *dev, unsigned int vendor, unsigned int device) { u16 miscreg = pci_read_config16(dev, 0x82); /* Enable subsystem id register writes */ pci_write_config16(dev, 0x82, miscreg | 0x40); pci_dev_set_subsystem(dev, vendor, device); /* restore original contents */ pci_write_config16(dev, 0x82, miscreg); } static struct pci_operations rl5c476_pci_ops = { .set_subsystem = rl5c476_set_subsystem, }; static struct device_operations ricoh_rl5c476_ops = { .read_resources = rl5c476_read_resources, .set_resources = rl5c476_set_resources, .enable_resources = cardbus_enable_resources, .init = rl5c476_init, .scan_bus = pci_scan_bridge, .ops_pci = &rl5c476_pci_ops, }; static const struct pci_driver ricoh_rl5c476_driver __pci_driver = { .ops = &ricoh_rl5c476_ops, .vendor = PCI_VENDOR_ID_RICOH, .device = PCI_DEVICE_ID_RICOH_RL5C476, }; static void southbridge_init(struct device *dev) { struct southbridge_ricoh_rl5c476_config *conf = dev->chip_info; enable_cf_boot = conf->enable_cf; } struct chip_operations southbridge_ricoh_rl5c476_ops = { CHIP_NAME("Ricoh RL5C476 CardBus Controller") .enable_dev = southbridge_init, };
{ "pile_set_name": "Github" }
#include <agency/agency.hpp> template<class ExecutionPolicy> void test() { using execution_policy_type = ExecutionPolicy; { // bulk_then with non-void future and no parameters execution_policy_type policy; auto fut = agency::make_ready_future<int>(policy.executor(), 7); auto f = agency::bulk_then(policy(10), [](typename execution_policy_type::execution_agent_type& self, int& past_arg) -> agency::single_result<int> { if(self.index() == 0) { return past_arg; } return std::ignore; }, fut ); auto result = f.get(); assert(result == 7); } { // bulk_then with void future and no parameters execution_policy_type policy; auto fut = agency::make_ready_future<void>(policy.executor()); auto f = agency::bulk_then(policy(10), [](typename execution_policy_type::execution_agent_type& self) -> agency::single_result<int> { if(self.index() == 0) { return 7; } return std::ignore; }, fut ); auto result = f.get(); assert(result == 7); } { // bulk_then with non-void future and one parameter execution_policy_type policy; auto fut = agency::make_ready_future<int>(policy.executor(), 7); int val = 13; auto f = agency::bulk_then(policy(10), [](typename execution_policy_type::execution_agent_type& self, int& past_arg, int val) -> agency::single_result<int> { if(self.index() == 0) { return past_arg + val; } return std::ignore; }, fut, val ); auto result = f.get(); assert(result == 7 + 13); } { // bulk_then with void future and one parameter execution_policy_type policy; auto fut = agency::make_ready_future<void>(policy.executor()); int val = 13; auto f = agency::bulk_then(policy(10), [](typename execution_policy_type::execution_agent_type& self, int val) -> agency::single_result<int> { if(self.index() == 0) { return val; } return std::ignore; }, fut, val ); auto result = f.get(); assert(result == 13); } { // bulk_then with non-void future and one shared parameter execution_policy_type policy; auto fut = agency::make_ready_future<int>(policy.executor(), 7); int val = 13; auto f = agency::bulk_then(policy(10), [](typename execution_policy_type::execution_agent_type& self, int& past_arg, int& val) -> agency::single_result<int> { if(self.index() == 0) { return past_arg + val; } return std::ignore; }, fut, agency::share(val) ); auto result = f.get(); assert(result == 7 + 13); } { // bulk_then with void future and one shared parameter execution_policy_type policy; auto fut = agency::make_ready_future<void>(policy.executor()); int val = 13; auto f = agency::bulk_then(policy(10), [](typename execution_policy_type::execution_agent_type& self, int& val) -> agency::single_result<int> { if(self.index() == 0) { return val; } return std::ignore; }, fut, agency::share(val) ); auto result = f.get(); assert(result == 13); } } int main() { test<agency::sequenced_execution_policy>(); test<agency::concurrent_execution_policy>(); test<agency::parallel_execution_policy>(); std::cout << "OK" << std::endl; return 0; }
{ "pile_set_name": "Github" }
# Config file for /etc/init.d/ser2net # Set the configuration file to one other than the default of /etc/ser2net.conf # #CONFIG_FILE="/etc/ser2net.conf" # Enables the control port and sets the TCP port to listen to for the control port. # A port number may be of the form [host,]port, such as 127.0.0.1,2000 or localhost,2000. # If this is specified, it will only bind to the IP address specified for the port. # Otherwise, it will bind to all the addresses on the machine. # #CONTROL_PORT="" # Cisco IOS uses a different mechanism for specifying the baud rates than the mechanism # described in RFC2217. This option sets the IOS version of setting the baud rates. # The default is RFC2217s. # #CISCO_IOS="yes" # Enable or disable UUCP locking (default=yes) # #UUCP_LOCKS="no" # see the ser2net(8) manual page for additional options you can configure here # #EXTRA_OPTS=""
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion> </ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{4A473A29-412F-4254-B73F-784B91712CB9}</ProjectGuid> <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>FailTracker.Web</RootNamespace> <AssemblyName>FailTracker.Web</AssemblyName> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <MvcBuildViews>false</MvcBuildViews> <UseIISExpress>true</UseIISExpress> <IISExpressSSLPort /> <IISExpressAnonymousAuthentication /> <IISExpressWindowsAuthentication /> <IISExpressUseClassicPipelineMode /> <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> <RestorePackages>true</RestorePackages> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Reference Include="AutoMapper"> <HintPath>..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.dll</HintPath> </Reference> <Reference Include="AutoMapper.Net4"> <HintPath>..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.Net4.dll</HintPath> </Reference> <Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.Web.Mvc"> <HintPath>..\packages\Microsoft.AspNet.Mvc.Futures.5.0.0\lib\net40\Microsoft.Web.Mvc.dll</HintPath> </Reference> <Reference Include="StructureMap, Version=3.1.5.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\packages\structuremap.3.1.5.154\lib\net40\StructureMap.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="StructureMap.Net4, Version=3.1.5.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\packages\structuremap.3.1.5.154\lib\net40\StructureMap.Net4.dll</HintPath> <Private>True</Private> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> <Reference Include="System.Web.DynamicData" /> <Reference Include="System.Web.Entity" /> <Reference Include="System.Web.ApplicationServices" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Core" /> <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Web" /> <Reference Include="System.Web.Extensions" /> <Reference Include="System.Web.Abstractions" /> <Reference Include="System.Web.Routing" /> <Reference Include="System.Xml" /> <Reference Include="System.Configuration" /> <Reference Include="System.Web.Services" /> <Reference Include="System.EnterpriseServices" /> <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Private>True</Private> <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath> </Reference> <Reference Include="System.Net.Http"> </Reference> <Reference Include="System.Net.Http.WebRequest"> </Reference> <Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Private>True</Private> <HintPath>..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.Helpers.dll</HintPath> </Reference> <Reference Include="System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Private>True</Private> <HintPath>..\packages\Microsoft.AspNet.Mvc.5.0.0\lib\net45\System.Web.Mvc.dll</HintPath> </Reference> <Reference Include="System.Web.Optimization"> <HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.1\lib\net40\System.Web.Optimization.dll</HintPath> </Reference> <Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Private>True</Private> <HintPath>..\packages\Microsoft.AspNet.Razor.3.0.0\lib\net45\System.Web.Razor.dll</HintPath> </Reference> <Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Private>True</Private> <HintPath>..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.WebPages.dll</HintPath> </Reference> <Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Private>True</Private> <HintPath>..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.WebPages.Deployment.dll</HintPath> </Reference> <Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Private>True</Private> <HintPath>..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.WebPages.Razor.dll</HintPath> </Reference> <Reference Include="Newtonsoft.Json"> <Private>True</Private> <HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> <Reference Include="WebGrease"> <Private>True</Private> <HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath> </Reference> <Reference Include="Antlr3.Runtime"> <Private>True</Private> <HintPath>..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <Reference Include="EntityFramework"> <HintPath>..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath> </Reference> <Reference Include="EntityFramework.SqlServer"> <HintPath>..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> </Reference> <Reference Include="Microsoft.AspNet.Identity.Core"> <HintPath>..\packages\Microsoft.AspNet.Identity.Core.1.0.0\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath> </Reference> <Reference Include="Microsoft.AspNet.Identity.Owin"> <HintPath>..\packages\Microsoft.AspNet.Identity.Owin.1.0.0\lib\net45\Microsoft.AspNet.Identity.Owin.dll</HintPath> </Reference> <Reference Include="Microsoft.AspNet.Identity.EntityFramework"> <HintPath>..\packages\Microsoft.AspNet.Identity.EntityFramework.1.0.0\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll</HintPath> </Reference> <Reference Include="Owin"> <HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath> </Reference> <Reference Include="Microsoft.Owin"> <HintPath>..\packages\Microsoft.Owin.2.0.0\lib\net45\Microsoft.Owin.dll</HintPath> </Reference> <Reference Include="Microsoft.Owin.Host.SystemWeb"> <HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.2.0.0\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath> </Reference> <Reference Include="Microsoft.Owin.Security"> <HintPath>..\packages\Microsoft.Owin.Security.2.0.0\lib\net45\Microsoft.Owin.Security.dll</HintPath> </Reference> <Reference Include="Microsoft.Owin.Security.Facebook"> <HintPath>..\packages\Microsoft.Owin.Security.Facebook.2.0.0\lib\net45\Microsoft.Owin.Security.Facebook.dll</HintPath> </Reference> <Reference Include="Microsoft.Owin.Security.Cookies"> <HintPath>..\packages\Microsoft.Owin.Security.Cookies.2.0.0\lib\net45\Microsoft.Owin.Security.Cookies.dll</HintPath> </Reference> <Reference Include="Microsoft.Owin.Security.OAuth"> <HintPath>..\packages\Microsoft.Owin.Security.OAuth.2.0.0\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath> </Reference> <Reference Include="Microsoft.Owin.Security.Google"> <HintPath>..\packages\Microsoft.Owin.Security.Google.2.0.0\lib\net45\Microsoft.Owin.Security.Google.dll</HintPath> </Reference> <Reference Include="Microsoft.Owin.Security.Twitter"> <HintPath>..\packages\Microsoft.Owin.Security.Twitter.2.0.0\lib\net45\Microsoft.Owin.Security.Twitter.dll</HintPath> </Reference> <Reference Include="Microsoft.Owin.Security.MicrosoftAccount"> <HintPath>..\packages\Microsoft.Owin.Security.MicrosoftAccount.2.0.0\lib\net45\Microsoft.Owin.Security.MicrosoftAccount.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <Compile Include="ActionResults\StandardJsonResult.cs" /> <Compile Include="App_Start\AutoMapperConfig.cs" /> <Compile Include="App_Start\BundleConfig.cs" /> <Compile Include="App_Start\FilterConfig.cs" /> <Compile Include="App_Start\RouteConfig.cs" /> <Compile Include="App_Start\SeedData.cs" /> <Compile Include="App_Start\Startup.Auth.cs" /> <Compile Include="Controllers\AccountController.cs" /> <Compile Include="Controllers\HomeController.cs" /> <Compile Include="Controllers\IssueController.cs" /> <Compile Include="Domain\Issue.cs" /> <Compile Include="Domain\IssueType.cs" /> <Compile Include="Domain\LogAction.cs" /> <Compile Include="Filters\IssueTypeSelectListPopulatorAttribute.cs" /> <Compile Include="Filters\LogAttribute.cs" /> <Compile Include="Filters\UserSelectListPopulatorAttribute.cs" /> <Compile Include="Global.asax.cs"> <DependentUpon>Global.asax</DependentUpon> </Compile> <Compile Include="Helpers\AngularTemplateHelper.cs" /> <Compile Include="Helpers\BootstrapHelpers.cs" /> <Compile Include="Helpers\JavaScriptHelper.cs" /> <Compile Include="Infrastructure\ActionFilterRegistry.cs" /> <Compile Include="Infrastructure\Alerts\Alert.cs" /> <Compile Include="Infrastructure\Alerts\AlertDecoratorResult.cs" /> <Compile Include="Infrastructure\Alerts\AlertExtensions.cs" /> <Compile Include="Infrastructure\ContainerPerRequestExtensions.cs" /> <Compile Include="Infrastructure\ControllerConvention.cs" /> <Compile Include="Infrastructure\ControllerRegistry.cs" /> <Compile Include="Infrastructure\CurrentUser.cs" /> <Compile Include="Infrastructure\FailTrackerController.cs" /> <Compile Include="Infrastructure\ICurrentUser.cs" /> <Compile Include="Infrastructure\IoC.cs" /> <Compile Include="Infrastructure\Mapping\IHaveCustomMappings.cs" /> <Compile Include="Infrastructure\Mapping\IMapFrom.cs" /> <Compile Include="Infrastructure\ModelMetadata\ExtensibleModelMetadataProvider.cs" /> <Compile Include="Infrastructure\ModelMetadata\Filters\LabelConventionFilter.cs" /> <Compile Include="Infrastructure\ModelMetadata\Filters\ReadOnlyTemplateSelectorFilter.cs" /> <Compile Include="Infrastructure\ModelMetadata\Filters\TextAreaByNameFilter.cs" /> <Compile Include="Infrastructure\ModelMetadata\Filters\UserIDDropDownByNameFilter.cs" /> <Compile Include="Infrastructure\ModelMetadata\Filters\WatermarkConventionFilter.cs" /> <Compile Include="Infrastructure\ModelMetadata\IModelMetadataFilter.cs" /> <Compile Include="Infrastructure\ModelMetadata\ModelMetadataRegistry.cs" /> <Compile Include="Infrastructure\ModelMetadata\RenderAttribute.cs" /> <Compile Include="Infrastructure\MvcRegistry.cs" /> <Compile Include="Infrastructure\StandardRegistry.cs" /> <Compile Include="Infrastructure\StructureMapDependencyResolver.cs" /> <Compile Include="Infrastructure\StructureMapFilterProvider.cs" /> <Compile Include="Infrastructure\Tasks\IRunAfterEachRequest.cs" /> <Compile Include="Infrastructure\Tasks\IRunAtInit.cs" /> <Compile Include="Infrastructure\Tasks\IRunAtStartup.cs" /> <Compile Include="Infrastructure\Tasks\IRunOnEachRequest.cs" /> <Compile Include="Infrastructure\Tasks\IRunOnError.cs" /> <Compile Include="Infrastructure\Tasks\TaskRegistry.cs" /> <Compile Include="Infrastructure\TransactionPerRequest.cs" /> <Compile Include="Migrations\Configuration.cs" /> <Compile Include="Models\AccountViewModels.cs" /> <Compile Include="Data\ApplicationDbContext.cs" /> <Compile Include="Domain\ApplicationUser.cs" /> <Compile Include="Models\Issue\AssignmentStatsViewModel.cs" /> <Compile Include="Models\Issue\EditIssueForm.cs" /> <Compile Include="Models\Issue\IssueDetailsViewModel.cs" /> <Compile Include="Models\Issue\IssueSummaryViewModel.cs" /> <Compile Include="Models\Issue\NewIssueForm.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Startup.cs" /> </ItemGroup> <ItemGroup> <Content Include="..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.Net4.dll"> <Link>AutoMapper.Net4.dll</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> <Content Include="Content\bootstrap-theme.css" /> <Content Include="Content\bootstrap-theme.min.css" /> <Content Include="Content\bootstrap.css" /> <Content Include="Content\bootstrap.min.css" /> <Content Include="Content\IssueTypes\Enhancement.png" /> <Content Include="Content\IssueTypes\Bug.png" /> <Content Include="Content\IssueTypes\Readme.txt" /> <Content Include="Content\IssueTypes\Support.png" /> <Content Include="Content\IssueTypes\Other.png" /> <Content Include="Content\ubuntu.theme.css" /> <Content Include="favicon.ico" /> <Content Include="fonts\glyphicons-halflings-regular.svg" /> <Content Include="Global.asax" /> <Content Include="Content\Site.css" /> <Content Include="Scripts\angular-mocks.js" /> <Content Include="Scripts\angular.js" /> <Content Include="Scripts\angular.min.js" /> <Content Include="Scripts\app\controllers\editIssueController.js" /> <Content Include="Scripts\app\failtrackerApp.js" /> <Content Include="Scripts\app\services\alerts.js" /> <Content Include="Scripts\app\services\exceptionOverride.js" /> <Content Include="Scripts\app\utilities\bootstrapAlerts.js" /> <Content Include="Scripts\bootstrap.js" /> <Content Include="Scripts\bootstrap.min.js" /> <Content Include="fonts\glyphicons-halflings-regular.woff" /> <Content Include="fonts\glyphicons-halflings-regular.ttf" /> <Content Include="fonts\glyphicons-halflings-regular.eot" /> <Content Include="Scripts\angular.min.js.map" /> <None Include="Scripts\jquery-1.10.2.intellisense.js" /> <Content Include="Scripts\jquery-1.10.2.js" /> <Content Include="Scripts\jquery-1.10.2.min.js" /> <None Include="Scripts\jquery.validate-vsdoc.js" /> <Content Include="Scripts\jquery.validate.js" /> <Content Include="Scripts\jquery.validate.min.js" /> <Content Include="Scripts\jquery.validate.unobtrusive.js" /> <Content Include="Scripts\jquery.validate.unobtrusive.min.js" /> <Content Include="Scripts\modernizr-2.6.2.js" /> <Content Include="Scripts\respond.js" /> <Content Include="Scripts\respond.min.js" /> <Content Include="Scripts\rowlink.js" /> <Content Include="Scripts\underscore.js" /> <Content Include="Scripts\underscore.min.js" /> <Content Include="Scripts\_references.js" /> <Content Include="Web.config" /> <Content Include="Web.Debug.config"> <DependentUpon>Web.config</DependentUpon> </Content> <Content Include="Web.Release.config"> <DependentUpon>Web.config</DependentUpon> </Content> <Content Include="Views\Web.config" /> <Content Include="Views\_ViewStart.cshtml" /> <Content Include="Views\Shared\Error.cshtml" /> <Content Include="Views\Shared\_Layout.cshtml" /> <Content Include="Views\Home\Index.cshtml" /> <Content Include="Scripts\jquery-1.10.2.min.map" /> <Content Include="Views\Account\_ChangePasswordPartial.cshtml" /> <Content Include="Views\Account\_ExternalLoginsListPartial.cshtml" /> <Content Include="Views\Account\_RemoveAccountPartial.cshtml" /> <Content Include="Views\Account\_SetPasswordPartial.cshtml" /> <Content Include="Views\Account\ExternalLoginConfirmation.cshtml" /> <Content Include="Views\Account\ExternalLoginFailure.cshtml" /> <Content Include="Views\Account\Login.cshtml" /> <Content Include="Views\Account\Manage.cshtml" /> <Content Include="Views\Account\Register.cshtml" /> <Content Include="Views\Shared\_LoginPartial.cshtml" /> <Content Include="Views\Issue\New.cshtml" /> <Content Include="Views\Issue\YourIssuesWidget.cshtml" /> <Content Include="Views\Issue\View.cshtml" /> <Content Include="Views\Issue\CreatedByYouWidget.cshtml" /> <Content Include="Views\Issue\AssignmentStatsWidget.cshtml" /> <Content Include="Views\Shared\_Alerts.cshtml" /> <Content Include="Views\Shared\EditorTemplates\String.cshtml" /> <Content Include="Views\Shared\EditorTemplates\MultilineText.cshtml" /> <Content Include="Views\Shared\EditorTemplates\IssueType.cshtml" /> <Content Include="Views\Shared\EditorTemplates\UserID.cshtml" /> <Content Include="Views\Shared\EditorTemplates\ReadOnly.cshtml" /> <Content Include="Views\Shared\EditorTemplates\Object.cshtml" /> <Content Include="Scripts\underscore.min.map" /> <Content Include="Views\Shared\EditorTemplates\Angular\Object.cshtml" /> <Content Include="Views\Shared\EditorTemplates\Angular\IssueType.cshtml" /> <Content Include="Views\Shared\EditorTemplates\Angular\MultilineText.cshtml" /> <Content Include="Views\Shared\EditorTemplates\Angular\ReadOnly.cshtml" /> <Content Include="Views\Shared\EditorTemplates\Angular\String.cshtml" /> <Content Include="Views\Shared\EditorTemplates\Angular\UserID.cshtml" /> </ItemGroup> <ItemGroup> <Folder Include="App_Data\" /> </ItemGroup> <ItemGroup> <Content Include="packages.config" /> <None Include="Project_Readme.html" /> </ItemGroup> <PropertyGroup> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> </PropertyGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" /> <Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'"> <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" /> </Target> <ProjectExtensions> <VisualStudio> <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> <WebProjectProperties> <UseIIS>True</UseIIS> <AutoAssignPort>True</AutoAssignPort> <DevelopmentServerPort>49937</DevelopmentServerPort> <DevelopmentServerVPath>/</DevelopmentServerVPath> <IISUrl>http://localhost:49937/</IISUrl> <NTLMAuthentication>False</NTLMAuthentication> <UseCustomServer>False</UseCustomServer> <CustomServerUrl> </CustomServerUrl> <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> </WebProjectProperties> </FlavorProperties> </VisualStudio> </ProjectExtensions> <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>
{ "pile_set_name": "Github" }
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin freebsd linux solaris package ipv6 import ( "net" "unsafe" "golang.org/x/net/internal/socket" ) var freebsd32o64 bool func (so *sockOpt) setGroupReq(c *socket.Conn, ifi *net.Interface, grp net.IP) error { var gr groupReq if ifi != nil { gr.Interface = uint32(ifi.Index) } gr.setGroup(grp) var b []byte if freebsd32o64 { var d [sizeofGroupReq + 4]byte s := (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr)) copy(d[:4], s[:4]) copy(d[8:], s[4:]) b = d[:] } else { b = (*[sizeofGroupReq]byte)(unsafe.Pointer(&gr))[:sizeofGroupReq] } return so.Set(c, b) } func (so *sockOpt) setGroupSourceReq(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error { var gsr groupSourceReq if ifi != nil { gsr.Interface = uint32(ifi.Index) } gsr.setSourceGroup(grp, src) var b []byte if freebsd32o64 { var d [sizeofGroupSourceReq + 4]byte s := (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr)) copy(d[:4], s[:4]) copy(d[8:], s[4:]) b = d[:] } else { b = (*[sizeofGroupSourceReq]byte)(unsafe.Pointer(&gsr))[:sizeofGroupSourceReq] } return so.Set(c, b) }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="400dp" android:layout_height="wrap_content" android:background="@drawable/hpay_bg" android:orientation="vertical" android:visibility="visible" > <LinearLayout android:id="@+id/hpay_content" android:layout_width="400dip" android:layout_height="wrap_content" android:orientation="vertical" > </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="48dip" android:layout_marginBottom="3dip" android:orientation="horizontal" > <Button android:id="@+id/hpay_negativeButton" android:layout_width="0px" android:layout_height="fill_parent" android:layout_weight="1" android:background="@color/hpay_bg_color" android:gravity="center" android:text="取消" android:textColor="@color/hpay_cancel_wz_color" android:textSize="18sp" /> <ImageView android:layout_width="1dip" android:layout_height="fill_parent" android:background="@color/hpay_line_color" > </ImageView> <Button android:id="@+id/hpay_positiveButton" android:layout_width="0px" android:layout_height="fill_parent" android:layout_weight="1" android:background="@color/hpay_bg_color" android:gravity="center" android:text="确定" android:textColor="@color/hpay_ok_wz_color" android:textSize="18sp" /> </LinearLayout> </LinearLayout>
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.private.settime</key> <true/> </dict> </plist>
{ "pile_set_name": "Github" }
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build !gccgo #include "textflag.h" // // System call support for 386, NetBSD // // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. TEXT ·Syscall(SB),NOSPLIT,$0-28 JMP syscall·Syscall(SB) TEXT ·Syscall6(SB),NOSPLIT,$0-40 JMP syscall·Syscall6(SB) TEXT ·Syscall9(SB),NOSPLIT,$0-52 JMP syscall·Syscall9(SB) TEXT ·RawSyscall(SB),NOSPLIT,$0-28 JMP syscall·RawSyscall(SB) TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 JMP syscall·RawSyscall6(SB)
{ "pile_set_name": "Github" }
# TODO: this file has not yet been included in the main CLDR release. # The intent is to verify this file against the Go implementation and then # correct the cases and add merge in other interesting test cases. # See TestCLDRCompliance in match_test.go, as well as the list of exceptions # defined in the map skip below it, for the work in progress. # Data-driven test for the XLocaleMatcher. # Format # • Everything after "#" is a comment # • Arguments are separated by ";". They are: # supported ; desired ; expected # • The supported may have the threshold distance reset as a first item, eg 50, en, fr # A line starting with @debug will reach a statement in the test code where you can put a breakpoint for debugging # The test code also supports reformatting this file, by setting the REFORMAT flag. ################################################## # testParentLocales # es-419, es-AR, and es-MX are in a cluster; es is in a different one es-419, es-ES ; es-AR ; es-419 es-ES, es-419 ; es-AR ; es-419 es-419, es ; es-AR ; es-419 es, es-419 ; es-AR ; es-419 es-MX, es ; es-AR ; es-MX es, es-MX ; es-AR ; es-MX # en-GB, en-AU, and en-NZ are in a cluster; en in a different one en-GB, en-US ; en-AU ; en-GB en-US, en-GB ; en-AU ; en-GB en-GB, en ; en-AU ; en-GB en, en-GB ; en-AU ; en-GB en-NZ, en-US ; en-AU ; en-NZ en-US, en-NZ ; en-AU ; en-NZ en-NZ, en ; en-AU ; en-NZ en, en-NZ ; en-AU ; en-NZ # pt-AU and pt-PT in one cluster; pt-BR in another pt-PT, pt-BR ; pt-AO ; pt-PT pt-BR, pt-PT ; pt-AO ; pt-PT pt-PT, pt ; pt-AO ; pt-PT pt, pt-PT ; pt-AO ; pt-PT zh-MO, zh-TW ; zh-HK ; zh-MO zh-TW, zh-MO ; zh-HK ; zh-MO zh-MO, zh-TW ; zh-HK ; zh-MO zh-TW, zh-MO ; zh-HK ; zh-MO zh-MO, zh-CN ; zh-HK ; zh-MO zh-CN, zh-MO ; zh-HK ; zh-MO zh-MO, zh ; zh-HK ; zh-MO zh, zh-MO ; zh-HK ; zh-MO ################################################## # testChinese zh-CN, zh-TW, iw ; zh-Hant-TW ; zh-TW zh-CN, zh-TW, iw ; zh-Hant ; zh-TW zh-CN, zh-TW, iw ; zh-TW ; zh-TW zh-CN, zh-TW, iw ; zh-Hans-CN ; zh-CN zh-CN, zh-TW, iw ; zh-CN ; zh-CN zh-CN, zh-TW, iw ; zh ; zh-CN ################################################## # testenGB fr, en, en-GB, es-419, es-MX, es ; en-NZ ; en-GB fr, en, en-GB, es-419, es-MX, es ; es-ES ; es fr, en, en-GB, es-419, es-MX, es ; es-AR ; es-419 fr, en, en-GB, es-419, es-MX, es ; es-MX ; es-MX ################################################## # testFallbacks 91, en, hi ; sa ; hi ################################################## # testBasics fr, en-GB, en ; en-GB ; en-GB fr, en-GB, en ; en ; en fr, en-GB, en ; fr ; fr fr, en-GB, en ; ja ; fr # return first if no match ################################################## # testFallback # check that script fallbacks are handled right zh-CN, zh-TW, iw ; zh-Hant ; zh-TW zh-CN, zh-TW, iw ; zh ; zh-CN zh-CN, zh-TW, iw ; zh-Hans-CN ; zh-CN zh-CN, zh-TW, iw ; zh-Hant-HK ; zh-TW zh-CN, zh-TW, iw ; he-IT ; iw ################################################## # testSpecials # check that nearby languages are handled en, fil, ro, nn ; tl ; fil en, fil, ro, nn ; mo ; ro en, fil, ro, nn ; nb ; nn # make sure default works en, fil, ro, nn ; ja ; en ################################################## # testRegionalSpecials # verify that en-AU is closer to en-GB than to en (which is en-US) en, en-GB, es, es-419 ; es-MX ; es-419 en, en-GB, es, es-419 ; en-AU ; en-GB en, en-GB, es, es-419 ; es-ES ; es ################################################## # testHK # HK and MO are closer to each other for Hant than to TW zh, zh-TW, zh-MO ; zh-HK ; zh-MO zh, zh-TW, zh-HK ; zh-MO ; zh-HK ################################################## # testMatch-exact # see localeDistance.txt ################################################## # testMatch-none # see localeDistance.txt ################################################## # testMatch-matchOnMazimized zh, zh-Hant ; und-TW ; zh-Hant # und-TW should be closer to zh-Hant than to zh en-Hant-TW, und-TW ; zh-Hant ; und-TW # zh-Hant should be closer to und-TW than to en-Hant-TW en-Hant-TW, und-TW ; zh ; und-TW # zh should be closer to und-TW than to en-Hant-TW ################################################## # testMatchGrandfatheredCode fr, i-klingon, en-Latn-US ; en-GB-oed ; en-Latn-US ################################################## # testGetBestMatchForList-exactMatch fr, en-GB, ja, es-ES, es-MX ; ja, de ; ja ################################################## # testGetBestMatchForList-simpleVariantMatch fr, en-GB, ja, es-ES, es-MX ; de, en-US ; en-GB # Intentionally avoiding a perfect-match or two candidates for variant matches. # Fallback. fr, en-GB, ja, es-ES, es-MX ; de, zh ; fr ################################################## # testGetBestMatchForList-matchOnMaximized # Check that if the preference is maximized already, it works as well. en, ja ; ja-Jpan-JP, en-AU ; ja # Match for ja-Jpan-JP (maximized already) # ja-JP matches ja on likely subtags, and it's listed first, thus it wins over the second preference en-GB. en, ja ; ja-JP, en-US ; ja # Match for ja-Jpan-JP (maximized already) # Check that if the preference is maximized already, it works as well. en, ja ; ja-Jpan-JP, en-US ; ja # Match for ja-Jpan-JP (maximized already) ################################################## # testGetBestMatchForList-noMatchOnMaximized # Regression test for http://b/5714572 . # de maximizes to de-DE. Pick the exact match for the secondary language instead. en, de, fr, ja ; de-CH, fr ; de ################################################## # testBestMatchForTraditionalChinese # Scenario: An application that only supports Simplified Chinese (and some other languages), # but does not support Traditional Chinese. zh-Hans-CN could be replaced with zh-CN, zh, or # zh-Hans, it wouldn't make much of a difference. # The script distance (simplified vs. traditional Han) is considered small enough # to be an acceptable match. The regional difference is considered almost insignificant. fr, zh-Hans-CN, en-US ; zh-TW ; zh-Hans-CN fr, zh-Hans-CN, en-US ; zh-Hant ; zh-Hans-CN # For geo-political reasons, you might want to avoid a zh-Hant -> zh-Hans match. # In this case, if zh-TW, zh-HK or a tag starting with zh-Hant is requested, you can # change your call to getBestMatch to include a 2nd language preference. # "en" is a better match since its distance to "en-US" is closer than the distance # from "zh-TW" to "zh-CN" (script distance). fr, zh-Hans-CN, en-US ; zh-TW, en ; en-US fr, zh-Hans-CN, en-US ; zh-Hant-CN, en, en ; en-US fr, zh-Hans-CN, en-US ; zh-Hans, en ; zh-Hans-CN ################################################## # testUndefined # When the undefined language doesn't match anything in the list, # getBestMatch returns the default, as usual. it, fr ; und ; it # When it *does* occur in the list, bestMatch returns it, as expected. it, und ; und ; und # The unusual part: max("und") = "en-Latn-US", and since matching is based on maximized # tags, the undefined language would normally match English. But that would produce the # counterintuitive results that getBestMatch("und", XLocaleMatcher("it,en")) would be "en", and # getBestMatch("en", XLocaleMatcher("it,und")) would be "und". # To avoid that, we change the matcher's definitions of max # so that max("und")="und". That produces the following, more desirable # results: it, en ; und ; it it, und ; en ; it ################################################## # testGetBestMatch-regionDistance es-AR, es ; es-MX ; es-AR fr, en, en-GB ; en-CA ; en-GB de-AT, de-DE, de-CH ; de ; de-DE ################################################## # testAsymmetry mul, nl ; af ; nl # af => nl mul, af ; nl ; mul # but nl !=> af ################################################## # testGetBestMatchForList-matchOnMaximized2 # ja-JP matches ja on likely subtags, and it's listed first, thus it wins over the second preference en-GB. fr, en-GB, ja, es-ES, es-MX ; ja-JP, en-GB ; ja # Match for ja-JP, with likely region subtag # Check that if the preference is maximized already, it works as well. fr, en-GB, ja, es-ES, es-MX ; ja-Jpan-JP, en-GB ; ja # Match for ja-Jpan-JP (maximized already) ################################################## # testGetBestMatchForList-closeEnoughMatchOnMaximized en-GB, en, de, fr, ja ; de-CH, fr ; de en-GB, en, de, fr, ja ; en-US, ar, nl, de, ja ; en ################################################## # testGetBestMatchForPortuguese # pt might be supported and not pt-PT # European user who prefers Spanish over Brazillian Portuguese as a fallback. pt-PT, pt-BR, es, es-419 ; pt-PT, es, pt ; pt-PT pt-PT, pt, es, es-419 ; pt-PT, es, pt ; pt-PT # pt implicit # Brazillian user who prefers South American Spanish over European Portuguese as a fallback. # The asymmetry between this case and above is because it's "pt-PT" that's missing between the # matchers as "pt-BR" is a much more common language. pt-PT, pt-BR, es, es-419 ; pt, es-419, pt-PT ; pt-BR pt-PT, pt-BR, es, es-419 ; pt-PT, es, pt ; pt-PT pt-PT, pt, es, es-419 ; pt-PT, es, pt ; pt-PT pt-PT, pt, es, es-419 ; pt, es-419, pt-PT ; pt pt-BR, es, es-419 ; pt, es-419, pt-PT ; pt-BR # Code that adds the user's country can get "pt-US" for a user's language. # That should fall back to "pt-BR". pt-PT, pt-BR, es, es-419 ; pt-US, pt-PT ; pt-BR pt-PT, pt, es, es-419 ; pt-US, pt-PT, pt ; pt # pt-BR implicit ################################################## # testVariantWithScriptMatch 1 and 2 fr, en, sv ; en-GB ; en fr, en, sv ; en-GB ; en en, sv ; en-GB, sv ; en ################################################## # testLongLists en, sv ; sv ; sv af, am, ar, az, be, bg, bn, bs, ca, cs, cy, cy, da, de, el, en, en-GB, es, es-419, et, eu, fa, fi, fil, fr, ga, gl, gu, hi, hr, hu, hy, id, is, it, iw, ja, ka, kk, km, kn, ko, ky, lo, lt, lv, mk, ml, mn, mr, ms, my, ne, nl, no, pa, pl, pt, pt-PT, ro, ru, si, sk, sl, sq, sr, sr-Latn, sv, sw, ta, te, th, tr, uk, ur, uz, vi, zh-CN, zh-TW, zu ; sv ; sv af, af-NA, af-ZA, agq, agq-CM, ak, ak-GH, am, am-ET, ar, ar-001, ar-AE, ar-BH, ar-DJ, ar-DZ, ar-EG, ar-EH, ar-ER, ar-IL, ar-IQ, ar-JO, ar-KM, ar-KW, ar-LB, ar-LY, ar-MA, ar-MR, ar-OM, ar-PS, ar-QA, ar-SA, ar-SD, ar-SO, ar-SS, ar-SY, ar-TD, ar-TN, ar-YE, as, as-IN, asa, asa-TZ, ast, ast-ES, az, az-Cyrl, az-Cyrl-AZ, az-Latn, az-Latn-AZ, bas, bas-CM, be, be-BY, bem, bem-ZM, bez, bez-TZ, bg, bg-BG, bm, bm-ML, bn, bn-BD, bn-IN, bo, bo-CN, bo-IN, br, br-FR, brx, brx-IN, bs, bs-Cyrl, bs-Cyrl-BA, bs-Latn, bs-Latn-BA, ca, ca-AD, ca-ES, ca-ES-VALENCIA, ca-FR, ca-IT, ce, ce-RU, cgg, cgg-UG, chr, chr-US, ckb, ckb-IQ, ckb-IR, cs, cs-CZ, cu, cu-RU, cy, cy-GB, da, da-DK, da-GL, dav, dav-KE, de, de-AT, de-BE, de-CH, de-DE, de-LI, de-LU, dje, dje-NE, dsb, dsb-DE, dua, dua-CM, dyo, dyo-SN, dz, dz-BT, ebu, ebu-KE, ee, ee-GH, ee-TG, el, el-CY, el-GR, en, en-001, en-150, en-AG, en-AI, en-AS, en-AT, en-AU, en-BB, en-BE, en-BI, en-BM, en-BS, en-BW, en-BZ, en-CA, en-CC, en-CH, en-CK, en-CM, en-CX, en-CY, en-DE, en-DG, en-DK, en-DM, en-ER, en-FI, en-FJ, en-FK, en-FM, en-GB, en-GD, en-GG, en-GH, en-GI, en-GM, en-GU, en-GY, en-HK, en-IE, en-IL, en-IM, en-IN, en-IO, en-JE, en-JM, en-KE, en-KI, en-KN, en-KY, en-LC, en-LR, en-LS, en-MG, en-MH, en-MO, en-MP, en-MS, en-MT, en-MU, en-MW, en-MY, en-NA, en-NF, en-NG, en-NL, en-NR, en-NU, en-NZ, en-PG, en-PH, en-PK, en-PN, en-PR, en-PW, en-RW, en-SB, en-SC, en-SD, en-SE, en-SG, en-SH, en-SI, en-SL, en-SS, en-SX, en-SZ, en-TC, en-TK, en-TO, en-TT, en-TV, en-TZ, en-UG, en-UM, en-US, en-US-POSIX, en-VC, en-VG, en-VI, en-VU, en-WS, en-ZA, en-ZM, en-ZW, eo, eo-001, es, es-419, es-AR, es-BO, es-CL, es-CO, es-CR, es-CU, es-DO, es-EA, es-EC, es-ES, es-GQ, es-GT, es-HN, es-IC, es-MX, es-NI, es-PA, es-PE, es-PH, es-PR, es-PY, es-SV, es-US, es-UY, es-VE, et, et-EE, eu, eu-ES, ewo, ewo-CM, fa, fa-AF, fa-IR, ff, ff-CM, ff-GN, ff-MR, ff-SN, fi, fi-FI, fil, fil-PH, fo, fo-DK, fo-FO, fr, fr-BE, fr-BF, fr-BI, fr-BJ, fr-BL, fr-CA, fr-CD, fr-CF, fr-CG, fr-CH, fr-CI, fr-CM, fr-DJ, fr-DZ, fr-FR, fr-GA, fr-GF, fr-GN, fr-GP, fr-GQ, fr-HT, fr-KM, fr-LU, fr-MA, fr-MC, fr-MF, fr-MG, fr-ML, fr-MQ, fr-MR, fr-MU, fr-NC, fr-NE, fr-PF, fr-PM, fr-RE, fr-RW, fr-SC, fr-SN, fr-SY, fr-TD, fr-TG, fr-TN, fr-VU, fr-WF, fr-YT, fur, fur-IT, fy, fy-NL, ga, ga-IE, gd, gd-GB, gl, gl-ES, gsw, gsw-CH, gsw-FR, gsw-LI, gu, gu-IN, guz, guz-KE, gv, gv-IM, ha, ha-GH, ha-NE, ha-NG, haw, haw-US, he, he-IL, hi, hi-IN, hr, hr-BA, hr-HR, hsb, hsb-DE, hu, hu-HU, hy, hy-AM, id, id-ID, ig, ig-NG, ii, ii-CN, is, is-IS, it, it-CH, it-IT, it-SM, ja, ja-JP, jgo, jgo-CM, jmc, jmc-TZ, ka, ka-GE, kab, kab-DZ, kam, kam-KE, kde, kde-TZ, kea, kea-CV, khq, khq-ML, ki, ki-KE, kk, kk-KZ, kkj, kkj-CM, kl, kl-GL, kln, kln-KE, km, km-KH, kn, kn-IN, ko, ko-KP, ko-KR, kok, kok-IN, ks, ks-IN, ksb, ksb-TZ, ksf, ksf-CM, ksh, ksh-DE, kw, kw-GB, ky, ky-KG, lag, lag-TZ, lb, lb-LU, lg, lg-UG, lkt, lkt-US, ln, ln-AO, ln-CD, ln-CF, ln-CG, lo, lo-LA, lrc, lrc-IQ, lrc-IR, lt, lt-LT, lu, lu-CD, luo, luo-KE, luy, luy-KE, lv, lv-LV, mas, mas-KE, mas-TZ, mer, mer-KE, mfe, mfe-MU, mg, mg-MG, mgh, mgh-MZ, mgo, mgo-CM, mk, mk-MK, ml, ml-IN, mn, mn-MN, mr, mr-IN, ms, ms-BN, ms-MY, ms-SG, mt, mt-MT, mua, mua-CM, my, my-MM, mzn, mzn-IR, naq, naq-NA, nb, nb-NO, nb-SJ, nd, nd-ZW, ne, ne-IN, ne-NP, nl, nl-AW, nl-BE, nl-BQ, nl-CW, nl-NL, nl-SR, nl-SX, nmg, nmg-CM, nn, nn-NO, nnh, nnh-CM, nus, nus-SS, nyn, nyn-UG, om, om-ET, om-KE, or, or-IN, os, os-GE, os-RU, pa, pa-Arab, pa-Arab-PK, pa-Guru, pa-Guru-IN, pl, pl-PL, prg, prg-001, ps, ps-AF, pt, pt-AO, pt-BR, pt-CV, pt-GW, pt-MO, pt-MZ, pt-PT, pt-ST, pt-TL, qu, qu-BO, qu-EC, qu-PE, rm, rm-CH, rn, rn-BI, ro, ro-MD, ro-RO, rof, rof-TZ, root, ru, ru-BY, ru-KG, ru-KZ, ru-MD, ru-RU, ru-UA, rw, rw-RW, rwk, rwk-TZ, sah, sah-RU, saq, saq-KE, sbp, sbp-TZ, se, se-FI, se-NO, se-SE, seh, seh-MZ, ses, ses-ML, sg, sg-CF, shi, shi-Latn, shi-Latn-MA, shi-Tfng, shi-Tfng-MA, si, si-LK, sk, sk-SK, sl, sl-SI, smn, smn-FI, sn, sn-ZW, so, so-DJ, so-ET, so-KE, so-SO, sq, sq-AL, sq-MK, sq-XK, sr, sr-Cyrl, sr-Cyrl-BA, sr-Cyrl-ME, sr-Cyrl-RS, sr-Cyrl-XK, sr-Latn, sr-Latn-BA, sr-Latn-ME, sr-Latn-RS, sr-Latn-XK, sv, sv-AX, sv-FI, sv-SE, sw, sw-CD, sw-KE, sw-TZ, sw-UG, ta, ta-IN, ta-LK, ta-MY, ta-SG, te, te-IN, teo, teo-KE, teo-UG, th, th-TH, ti, ti-ER, ti-ET, tk, tk-TM, to, to-TO, tr, tr-CY, tr-TR, twq, twq-NE, tzm, tzm-MA, ug, ug-CN, uk, uk-UA, ur, ur-IN, ur-PK, uz, uz-Arab, uz-Arab-AF, uz-Cyrl, uz-Cyrl-UZ, uz-Latn, uz-Latn-UZ, vai, vai-Latn, vai-Latn-LR, vai-Vaii, vai-Vaii-LR, vi, vi-VN, vo, vo-001, vun, vun-TZ, wae, wae-CH, xog, xog-UG, yav, yav-CM, yi, yi-001, yo, yo-BJ, yo-NG, zgh, zgh-MA, zh, zh-Hans, zh-Hans-CN, zh-Hans-HK, zh-Hans-MO, zh-Hans-SG, zh-Hant, zh-Hant-HK, zh-Hant-MO, zh-Hant-TW, zu, zu-ZA ; sv ; sv ################################################## # test8288 it, en ; und ; it it, en ; und, en ; en # examples from # http://unicode.org/repos/cldr/tags/latest/common/bcp47/ # http://unicode.org/repos/cldr/tags/latest/common/validity/variant.xml ################################################## # testUnHack en-NZ, en-IT ; en-US ; en-NZ ################################################## # testEmptySupported => null ; en ; null ################################################## # testVariantsAndExtensions ################################################## # tests the .combine() method und, fr ; fr-BE-fonipa ; fr ; fr-BE-fonipa und, fr-CA ; fr-BE-fonipa ; fr-CA ; fr-BE-fonipa und, fr-fonupa ; fr-BE-fonipa ; fr-fonupa ; fr-BE-fonipa und, no ; nn-BE-fonipa ; no ; no-BE-fonipa und, en-GB-u-sd-gbsct ; en-fonipa-u-nu-Arab-ca-buddhist-t-m0-iso-i0-pinyin ; en-GB-u-sd-gbsct ; en-GB-fonipa-u-nu-Arab-ca-buddhist-t-m0-iso-i0-pinyin en-PSCRACK, de-PSCRACK, fr-PSCRACK, pt-PT-PSCRACK ; fr-PSCRACK ; fr-PSCRACK en-PSCRACK, de-PSCRACK, fr-PSCRACK, pt-PT-PSCRACK ; fr ; fr-PSCRACK en-PSCRACK, de-PSCRACK, fr-PSCRACK, pt-PT-PSCRACK ; de-CH ; de-PSCRACK ################################################## # testClusters # we favor es-419 over others in cluster. Clusters: es- {ES, MA, EA} {419, AR, MX} und, es, es-MA, es-MX, es-419 ; es-AR ; es-419 und, es-MA, es, es-419, es-MX ; es-AR ; es-419 und, es, es-MA, es-MX, es-419 ; es-EA ; es und, es-MA, es, es-419, es-MX ; es-EA ; es # of course, fall back to within cluster und, es, es-MA, es-MX ; es-AR ; es-MX und, es-MA, es, es-MX ; es-AR ; es-MX und, es-MA, es-MX, es-419 ; es-EA ; es-MA und, es-MA, es-419, es-MX ; es-EA ; es-MA # we favor es-GB over others in cluster. Clusters: en- {US, GU, VI} {GB, IN, ZA} und, en, en-GU, en-IN, en-GB ; en-ZA ; en-GB und, en-GU, en, en-GB, en-IN ; en-ZA ; en-GB und, en, en-GU, en-IN, en-GB ; en-VI ; en und, en-GU, en, en-GB, en-IN ; en-VI ; en # of course, fall back to within cluster und, en, en-GU, en-IN ; en-ZA ; en-IN und, en-GU, en, en-IN ; en-ZA ; en-IN und, en-GU, en-IN, en-GB ; en-VI ; en-GU und, en-GU, en-GB, en-IN ; en-VI ; en-GU ################################################## # testThreshold @Threshold=60 50, und, fr-CA-fonupa ; fr-BE-fonipa ; fr-CA-fonupa ; fr-BE-fonipa 50, und, fr-Cyrl-CA-fonupa ; fr-BE-fonipa ; fr-Cyrl-CA-fonupa ; fr-Cyrl-BE-fonipa @Threshold=-1 # restore ################################################## # testScriptFirst @DistanceOption=SCRIPT_FIRST @debug ru, fr ; zh, pl ; fr ru, fr ; zh-Cyrl, pl ; ru hr, en-Cyrl; sr ; en-Cyrl da, ru, hr; sr ; ru
{ "pile_set_name": "Github" }
package com.olacabs.jackhammer.validations; import com.olacabs.jackhammer.exceptions.ValidationFailedException; import com.olacabs.jackhammer.models.SeverityLevel; public class SeverityLevelValidator extends AbstractValidator<SeverityLevel> { public void dataValidations(SeverityLevel model) throws ValidationFailedException { } public void uniquenessValidations(SeverityLevel model) throws ValidationFailedException { } }
{ "pile_set_name": "Github" }
#ifndef __LUA_WEB_SOCKET_H__ #define __LUA_WEB_SOCKET_H__ #ifdef __cplusplus extern "C" { #endif #include "tolua++.h" #ifdef __cplusplus } #endif TOLUA_API int tolua_web_socket_open(lua_State* tolua_S); #endif //__LUA_WEB_SOCKET_H__
{ "pile_set_name": "Github" }
1.0 Added Tcl Profiler app
{ "pile_set_name": "Github" }
# typeface-black-han-sans The CSS and web font files to easily self-host “Black Han Sans”. ## Install `npm install --save typeface-black-han-sans` ## Use Typefaces assume you’re using webpack to process CSS and files. Each typeface package includes all necessary font files (woff2, woff) and a CSS file with font-face declarations pointing at these files. You will need to have webpack setup to load css and font files. Many tools built with Webpack will work out of the box with Typefaces such as [Gatsby](https://github.com/gatsbyjs/gatsby) and [Create React App](https://github.com/facebookincubator/create-react-app). To use, simply require the package in your project’s entry file e.g. ```javascript // Load Black Han Sans typeface require('typeface-black-han-sans') ``` ## About the Typefaces project. Our goal is to add all open source fonts to NPM to simplify using great fonts in our web projects. We’re currently maintaining 908 typeface packages including all typefaces on Google Fonts. If your favorite typeface isn’t published yet, [let us know](https://github.com/KyleAMathews/typefaces) and we’ll add it!
{ "pile_set_name": "Github" }
# # Copyright (c) 2017 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import copy from enum import Enum from typing import Union import numpy as np from rl_coach.agents.agent import Agent from rl_coach.architectures.head_parameters import MeasurementsPredictionHeadParameters from rl_coach.architectures.embedder_parameters import InputEmbedderParameters from rl_coach.architectures.middleware_parameters import FCMiddlewareParameters from rl_coach.architectures.tensorflow_components.layers import Conv2d, Dense from rl_coach.base_parameters import AlgorithmParameters, AgentParameters, NetworkParameters, \ MiddlewareScheme from rl_coach.core_types import ActionInfo, EnvironmentSteps, RunPhase from rl_coach.exploration_policies.e_greedy import EGreedyParameters from rl_coach.memories.episodic.episodic_experience_replay import EpisodicExperienceReplayParameters from rl_coach.memories.memory import MemoryGranularity from rl_coach.spaces import SpacesDefinition, VectorObservationSpace class HandlingTargetsAfterEpisodeEnd(Enum): LastStep = 0 NAN = 1 class DFPNetworkParameters(NetworkParameters): def __init__(self): super().__init__() self.input_embedders_parameters = {'observation': InputEmbedderParameters(activation_function='leaky_relu'), 'measurements': InputEmbedderParameters(activation_function='leaky_relu'), 'goal': InputEmbedderParameters(activation_function='leaky_relu')} self.input_embedders_parameters['observation'].scheme = [ Conv2d(32, 8, 4), Conv2d(64, 4, 2), Conv2d(64, 3, 1), Dense(512), ] self.input_embedders_parameters['measurements'].scheme = [ Dense(128), Dense(128), Dense(128), ] self.input_embedders_parameters['goal'].scheme = [ Dense(128), Dense(128), Dense(128), ] self.middleware_parameters = FCMiddlewareParameters(activation_function='leaky_relu', scheme=MiddlewareScheme.Empty) self.heads_parameters = [MeasurementsPredictionHeadParameters(activation_function='leaky_relu')] self.async_training = False self.batch_size = 64 self.adam_optimizer_beta1 = 0.95 class DFPMemoryParameters(EpisodicExperienceReplayParameters): def __init__(self): self.max_size = (MemoryGranularity.Transitions, 20000) self.shared_memory = True super().__init__() class DFPAlgorithmParameters(AlgorithmParameters): """ :param num_predicted_steps_ahead: (int) Number of future steps to predict measurements for. The future steps won't be sequential, but rather jump in multiples of 2. For example, if num_predicted_steps_ahead = 3, then the steps will be: t+1, t+2, t+4. The predicted steps will be [t + 2**i for i in range(num_predicted_steps_ahead)] :param goal_vector: (List[float]) The goal vector will weight each of the measurements to form an optimization goal. The vector should have the same length as the number of measurements, and it will be vector multiplied by the measurements. Positive values correspond to trying to maximize the particular measurement, and negative values correspond to trying to minimize the particular measurement. :param future_measurements_weights: (List[float]) The future_measurements_weights weight the contribution of each of the predicted timesteps to the optimization goal. For example, if there are 6 steps predicted ahead, and a future_measurements_weights vector with 3 values, then only the 3 last timesteps will be taken into account, according to the weights in the future_measurements_weights vector. :param use_accumulated_reward_as_measurement: (bool) If set to True, the accumulated reward from the beginning of the episode will be added as a measurement to the measurements vector in the state. This van be useful in environments where the given measurements don't include enough information for the particular goal the agent should achieve. :param handling_targets_after_episode_end: (HandlingTargetsAfterEpisodeEnd) Dictates how to handle measurements that are outside the episode length. :param scale_measurements_targets: (Dict[str, float]) Allows rescaling the values of each of the measurements available. This van be useful when the measurements have a different scale and you want to normalize them to the same scale. """ def __init__(self): super().__init__() self.num_predicted_steps_ahead = 6 self.goal_vector = [1.0, 1.0] self.future_measurements_weights = [0.5, 0.5, 1.0] self.use_accumulated_reward_as_measurement = False self.handling_targets_after_episode_end = HandlingTargetsAfterEpisodeEnd.NAN self.scale_measurements_targets = {} self.num_consecutive_playing_steps = EnvironmentSteps(8) class DFPAgentParameters(AgentParameters): def __init__(self): super().__init__(algorithm=DFPAlgorithmParameters(), exploration=EGreedyParameters(), memory=DFPMemoryParameters(), networks={"main": DFPNetworkParameters()}) @property def path(self): return 'rl_coach.agents.dfp_agent:DFPAgent' # Direct Future Prediction Agent - http://vladlen.info/papers/learning-to-act.pdf class DFPAgent(Agent): def __init__(self, agent_parameters, parent: Union['LevelManager', 'CompositeAgent']=None): super().__init__(agent_parameters, parent) self.current_goal = self.ap.algorithm.goal_vector self.target_measurements_scale_factors = None def learn_from_batch(self, batch): network_keys = self.ap.network_wrappers['main'].input_embedders_parameters.keys() network_inputs = batch.states(network_keys) network_inputs['goal'] = np.repeat(np.expand_dims(self.current_goal, 0), batch.size, axis=0) # get the current outputs of the network targets = self.networks['main'].online_network.predict(network_inputs) # change the targets for the taken actions for i in range(batch.size): targets[i, batch.actions()[i]] = batch[i].info['future_measurements'].flatten() result = self.networks['main'].train_and_sync_networks(network_inputs, targets) total_loss, losses, unclipped_grads = result[:3] return total_loss, losses, unclipped_grads def choose_action(self, curr_state): if self.exploration_policy.requires_action_values(): # predict the future measurements tf_input_state = self.prepare_batch_for_inference(curr_state, 'main') tf_input_state['goal'] = np.expand_dims(self.current_goal, 0) measurements_future_prediction = self.networks['main'].online_network.predict(tf_input_state)[0] action_values = np.zeros(len(self.spaces.action.actions)) num_steps_used_for_objective = len(self.ap.algorithm.future_measurements_weights) # calculate the score of each action by multiplying it's future measurements with the goal vector for action_idx in range(len(self.spaces.action.actions)): action_measurements = measurements_future_prediction[action_idx] action_measurements = np.reshape(action_measurements, (self.ap.algorithm.num_predicted_steps_ahead, self.spaces.state['measurements'].shape[0])) future_steps_values = np.dot(action_measurements, self.current_goal) action_values[action_idx] = np.dot(future_steps_values[-num_steps_used_for_objective:], self.ap.algorithm.future_measurements_weights) else: action_values = None # choose action according to the exploration policy and the current phase (evaluating or training the agent) action, _ = self.exploration_policy.get_action(action_values) if action_values is not None: action_values = action_values.squeeze() action_info = ActionInfo(action=action, action_value=action_values[action]) else: action_info = ActionInfo(action=action) return action_info def set_environment_parameters(self, spaces: SpacesDefinition): self.spaces = copy.deepcopy(spaces) self.spaces.goal = VectorObservationSpace(shape=self.spaces.state['measurements'].shape, measurements_names= self.spaces.state['measurements'].measurements_names) # if the user has filled some scale values, check that he got the names right if set(self.spaces.state['measurements'].measurements_names).intersection( self.ap.algorithm.scale_measurements_targets.keys()) !=\ set(self.ap.algorithm.scale_measurements_targets.keys()): raise ValueError("Some of the keys in parameter scale_measurements_targets ({}) are not defined in " "the measurements space {}".format(self.ap.algorithm.scale_measurements_targets.keys(), self.spaces.state['measurements'].measurements_names)) super().set_environment_parameters(self.spaces) # the below is done after calling the base class method, as it might add accumulated reward as a measurement # fill out the missing measurements scale factors for measurement_name in self.spaces.state['measurements'].measurements_names: if measurement_name not in self.ap.algorithm.scale_measurements_targets: self.ap.algorithm.scale_measurements_targets[measurement_name] = 1 self.target_measurements_scale_factors = \ np.array([self.ap.algorithm.scale_measurements_targets[measurement_name] for measurement_name in self.spaces.state['measurements'].measurements_names]) def handle_episode_ended(self): last_episode = self.current_episode_buffer if self.phase in [RunPhase.TRAIN, RunPhase.HEATUP] and last_episode: self._update_measurements_targets(last_episode, self.ap.algorithm.num_predicted_steps_ahead) super().handle_episode_ended() def _update_measurements_targets(self, episode, num_steps): if 'measurements' not in episode.transitions[0].state or episode.transitions[0].state['measurements'] == []: raise ValueError("Measurements are not present in the transitions of the last episode played. ") measurements_size = self.spaces.state['measurements'].shape[0] for transition_idx, transition in enumerate(episode.transitions): transition.info['future_measurements'] = np.zeros((num_steps, measurements_size)) for step in range(num_steps): offset_idx = transition_idx + 2 ** step if offset_idx >= episode.length(): if self.ap.algorithm.handling_targets_after_episode_end == HandlingTargetsAfterEpisodeEnd.NAN: # the special MSE loss will ignore those entries so that the gradient will be 0 for these transition.info['future_measurements'][step] = np.nan continue elif self.ap.algorithm.handling_targets_after_episode_end == HandlingTargetsAfterEpisodeEnd.LastStep: offset_idx = - 1 transition.info['future_measurements'][step] = \ self.target_measurements_scale_factors * \ (episode.transitions[offset_idx].state['measurements'] - transition.state['measurements'])
{ "pile_set_name": "Github" }
--- jupyter: jupytext: notebook_metadata_filter: all text_representation: extension: .md format_name: markdown format_version: '1.1' jupytext_version: 1.1.1 kernelspec: display_name: Python 2 language: python name: python2 plotly: description: How to make Matplotlib Colorscales in Python with Plotly. display_as: advanced_opt language: python layout: base name: Matplotlib Colorscales order: 8 page_type: example_index permalink: python/matplotlib-colorscales/ thumbnail: thumbnail/colorbars.jpg --- #### New to Plotly? Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading the client and [reading the primer](https://plot.ly/python/getting-started/). <br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-for-online-plotting) or [offline](https://plot.ly/python/getting-started/#initialization-for-offline-plotting) mode, or in [jupyter notebooks](https://plot.ly/python/getting-started/#start-plotting-online). <br>We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-documentation/images/python_cheat_sheet.pdf) (new!) to help you get started! ### Formatting the Colormap Parula Colormap can be downloaded from [here](https://github.com/BIDS/colormap/blob/master/parula.py) ```python import parula as par import matplotlib from matplotlib import cm import numpy as np magma_cmap = matplotlib.cm.get_cmap('magma') viridis_cmap = matplotlib.cm.get_cmap('viridis') parula_cmap = par.parula_map viridis_rgb = [] magma_rgb = [] parula_rgb = [] norm = matplotlib.colors.Normalize(vmin=0, vmax=255) for i in range(0, 255): k = matplotlib.colors.colorConverter.to_rgb(magma_cmap(norm(i))) magma_rgb.append(k) for i in range(0, 255): k = matplotlib.colors.colorConverter.to_rgb(viridis_cmap(norm(i))) viridis_rgb.append(k) for i in range(0, 255): k = matplotlib.colors.colorConverter.to_rgb(parula_cmap(norm(i))) parula_rgb.append(k) def matplotlib_to_plotly(cmap, pl_entries): h = 1.0/(pl_entries-1) pl_colorscale = [] for k in range(pl_entries): C = map(np.uint8, np.array(cmap(k*h)[:3])*255) pl_colorscale.append([k*h, 'rgb'+str((C[0], C[1], C[2]))]) return pl_colorscale magma = matplotlib_to_plotly(magma_cmap, 255) viridis = matplotlib_to_plotly(viridis_cmap, 255) parula = matplotlib_to_plotly(parula_cmap, 255) ``` ### Colorscales for Heatmaps ```python import plotly.plotly as py import numpy as np import os import plotly.graph_objs as go from plotly import tools def heatmap_plot(colorscale, title): example_dir = os.path.join(os.path.dirname('__file__'), "examples") hist2d = np.loadtxt(os.path.join(example_dir, "hist2d.txt")) trace1 = go.Heatmap(z=hist2d, colorscale=colorscale, showscale=False) st_helens = np.loadtxt(os.path.join(example_dir, "st-helens_before-modified.txt.gz")).T trace2 = go.Heatmap(z=st_helens, colorscale=colorscale, y0=-5, x0=-5) dx = dy = 0.05 y, x = np.mgrid[-5 : 5 + dy : dy, -5 : 10 + dx : dx] z = np.sin(x)**10 + np.cos(10 + y*x) + np.cos(x) + 0.2*y + 0.1*x trace3 = go.Heatmap(z=z, colorscale=colorscale, showscale=False) fig = tools.make_subplots(rows=1, cols=3, print_grid=False) fig.append_trace(trace1, 1, 1) fig.append_trace(trace2, 1, 2) fig.append_trace(trace3, 1, 3) fig['layout'].update(title=title) fig['layout']['xaxis2'].update(range=[0, 450]) fig['layout']['yaxis2'].update(range=[0, 270]) return fig ``` ```python py.iplot(heatmap_plot(colorscale=magma, title='MAGMA')) ``` ```python py.iplot(heatmap_plot(colorscale=viridis, title='VIRIDIS')) ``` ```python py.iplot(heatmap_plot(colorscale=parula, title='PARULA')) ``` ### Colorscales for Trisurf Plots ```python import plotly.plotly as py from plotly.tools import FigureFactory as FF import plotly.graph_objs as go import numpy as np from scipy.spatial import Delaunay u = np.linspace(0, 2*np.pi, 24) v = np.linspace(-1, 1, 8) u,v = np.meshgrid(u, v) u = u.flatten() v = v.flatten() tp = 1 + 0.5*v*np.cos(u/2.) x = tp*np.cos(u) y = tp*np.sin(u) z = 0.5*v*np.sin(u/2.) points2D = np.vstack([u, v]).T tri = Delaunay(points2D) simplices = tri.simplices trace1 = FF.create_trisurf(x=x, y=y, z=z, simplices=simplices, colormap=magma_rgb, plot_edges=False, title='Magma Colorscale for Trisurf Plot') py.iplot(trace1) ``` ```python trace2 = FF.create_trisurf(x=x, y=y, z=z, simplices=simplices, colormap=viridis_rgb, plot_edges=False, title='Viridis Colorscale for Trisurf Plot') py.iplot(trace2) ``` ```python trace3 = FF.create_trisurf(x=x, y=y, z=z, simplices=simplices, colormap=parula_rgb, plot_edges=False, title='Parula Colorscale for Trisurf Plot') py.iplot(trace3) ``` ### Acknowledgment Special thanks to [Stéfan van der Walt](https://github.com/stefanv) and [Nathaniel Smith](https://github.com/njsmith) for the statistics of colormaps. ```python from IPython.display import display, HTML display(HTML('<link href="//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Inconsolata|Ubuntu+Mono:400,700rel="stylesheet" type="text/css" />')) display(HTML('<link rel="stylesheet" type="text/csshref="http://help.plot.ly/documentation/all_static/css/ipython-notebook-custom.css">')) ! pip install git+https://github.com/plotly/publisher.git --upgrade import publisher publisher.publish( 'matplotlib-colorscales.ipynb', 'python/matplotlib-colorscales/', 'Matplotlib Colorscales', 'How to make Matplotlib Colorscales in Python with Plotly.', title = 'Python Matplotlib Colorscales | plotly', name = 'Matplotlib Colorscales', has_thumbnail='true', thumbnail='thumbnail/colorbars.jpg', language='python', page_type='example_index', display_as='style_opt', order=8, ipynb= '~notebook_demo/48') ``` ```python ```
{ "pile_set_name": "Github" }
module Shoulda module Matchers module ActionController # The `route` matcher tests that a route resolves to a controller, # action, and params; and that the controller, action, and params # generates the same route. For an RSpec suite, this is like using a # combination of `route_to` and `be_routable`. In a test suite using # Minitest + Shoulda, it provides a more expressive syntax over # `assert_routing`. # # You can use this matcher either in a controller test case or in a # routing test case. For instance, given these routes: # # My::Application.routes.draw do # get '/posts', to: 'posts#index' # get '/posts/:id', to: 'posts#show' # end # # You could choose to write tests for these routes alongside other tests # for PostsController: # # class PostsController < ApplicationController # # ... # end # # # RSpec # RSpec.describe PostsController, type: :controller do # it { should route(:get, '/posts').to(action: :index) } # it { should route(:get, '/posts/1').to(action: :show, id: 1) } # end # # # Minitest (Shoulda) # class PostsControllerTest < ActionController::TestCase # should route(:get, '/posts').to(action: 'index') # should route(:get, '/posts/1').to(action: :show, id: 1) # end # # Or you could place the tests along with other route tests: # # # RSpec # describe 'Routing', type: :routing do # it do # should route(:get, '/posts'). # to(controller: :posts, action: :index) # end # # it do # should route(:get, '/posts/1'). # to('posts#show', id: 1) # end # end # # # Minitest (Shoulda) # class RoutesTest < ActionController::IntegrationTest # should route(:get, '/posts'). # to(controller: :posts, action: :index) # # should route(:get, '/posts/1'). # to('posts#show', id: 1) # end # # Notice that in the former case, as we are inside of a test case for # PostsController, we do not have to specify that the routes resolve to # this controller. In the latter case we specify this using the # `controller` key passed to the `to` qualifier. # # #### Specifying a port # # If the route you're testing has a constraint on it that limits the route # to a particular port, you can specify it by passing a `port` option to # the matcher: # # class PortConstraint # def initialize(port) # @port = port # end # # def matches?(request) # request.port == @port # end # end # # My::Application.routes.draw do # get '/posts', # to: 'posts#index', # constraints: PortConstraint.new(12345) # end # # # RSpec # describe 'Routing', type: :routing do # it do # should route(:get, '/posts', port: 12345). # to('posts#index') # end # end # # # Minitest (Shoulda) # class RoutesTest < ActionController::IntegrationTest # should route(:get, '/posts', port: 12345). # to('posts#index') # end # # #### Qualifiers # # ##### to # # Use `to` to specify the action (along with the controller, if needed) # that the route resolves to. # # `to` takes either keyword arguments (`controller` and `action`) or a # string that represents the controller/action pair: # # route(:get, '/posts').to(action: index) # route(:get, '/posts').to(controller: :posts, action: index) # route(:get, '/posts').to('posts#index') # # If there are parameters in your route, then specify those too: # # route(:get, '/posts/1').to('posts#show', id: 1) # # You may also specify special parameters such as `:format`: # # route(:get, '/posts').to('posts#index', format: :json) # # @return [RouteMatcher] # def route(method, path, port: nil) RouteMatcher.new(self, method, path, port: port) end # @private class RouteMatcher def initialize(context, method, path, port: nil) @context = context @method = method @path = add_port_to_path(normalize_path(path), port) @params = {} end attr_reader :failure_message def to(*args) @params = RouteParams.new(args).normalize self end def in_context(context) @context = context self end def matches?(controller) guess_controller_if_necessary(controller) route_recognized? end def description "route #{method.to_s.upcase} #{path} to/from #{params.inspect}" end def failure_message_when_negated "Didn't expect to #{description}" end private attr_reader :context, :method, :path, :params def normalize_path(path) if path.start_with?('/') path else "/#{path}" end end def add_port_to_path(path, port) if port "https://example.com:#{port}" + path else path end end def guess_controller_if_necessary(controller) params[:controller] ||= controller.controller_path end def route_recognized? context.send( :assert_routing, { method: method, path: path }, params, ) true rescue ::ActionController::RoutingError => error @failure_message = error.message false rescue Shoulda::Matchers.assertion_exception_class => error @failure_message = error.message false end end end end end
{ "pile_set_name": "Github" }
#ifndef RT_DEFINES #define RT_DEFINES #define TB_BREATH_RECOVER_MODIFIER 1 #define TB_BREATH_DEDUCT_MODIFIER 1.25 #define RT_NEXT_BLEED_MODIFIER 0.5 #define RT_FIRST_AID_GAIN_MODIFIER 12 #define NUM_REAL_SEC_PER_TACTICAL_TURN 5000 #define RT_COMPRESSION_TACTICAL_TURN_MODIFIER 10 #endif
{ "pile_set_name": "Github" }
{% extends "base.html" %} {% block title %}{{ username }}{% endblock %} {% block content %} <h1 class="graphed">{{ username }} <small>{{ num_weeks }} weeks of data</small></h1> {% if flashes %} <ul class="flashes"> {% for flash in flashes %} <li>{{ flash }}</li> {% endfor %} </ul> {% endif %} <div class="sfeature"> <a href="artists/"> <img src="/static/images/artists_64.png" class="front" /> <br /> <p>Artist histories &raquo;</p> </a> </div> <div class="sfeature"> <a href="timeline/"> <img src="/static/images/timeline2_64.png" class="front" /> <br /> <p>Quick Timeline &raquo;</p> </a> </div> <div class="sfeature"> <a href="posters/"> <img src="/static/images/posters_64.png" class="front" /> <br /> <p>Timeline Posters &raquo;</p> </a> </div> <div class="sfeature"> <a href="export/"> <img src="/static/images/export_64.png" class="front" /> <br /> <p>Data Export &raquo;</p> </a> </div> {% if lfuser.external_allowed %} <div class="sfeature"> <a href="sigs/"> <img src="/static/images/sigs_64.png" class="front" /> <br /> <p>Signature Images &raquo;</p> </a> </div> {% endif %} <!--<div class="sfeature"> <a href="premium/"> <img src="/static/images/premium_64.png" class="front" /> <br /> <p>LastGraph Premium &raquo;</p> </a> </div>--> <div class="sfeature"> <a href="http://www.last.fm/user/{{ username }}/"> <img src="/static/images/lastfm_64.png" class="front" /> <br /> <p>Last.fm Profile &raquo;</p> </a> </div> <p class="padded after"> </p> {% endblock %}
{ "pile_set_name": "Github" }
/* Implementation details of FILE streams. Copyright (C) 2007-2008, 2010-2018 Free Software Foundation, Inc. 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 <https://www.gnu.org/licenses/>. */ /* Many stdio implementations have the same logic and therefore can share the same implementation of stdio extension API, except that some fields have different naming conventions, or their access requires some casts. */ /* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this problem by defining it ourselves. FIXME: Do not rely on glibc internals. */ #if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN # define _IO_IN_BACKUP 0x100 #endif /* BSD stdio derived implementations. */ #if defined __NetBSD__ /* NetBSD */ /* Get __NetBSD_Version__. */ # include <sys/param.h> #endif #include <errno.h> /* For detecting Plan9. */ #if defined __sferror || defined __DragonFly__ || defined __ANDROID__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ # if defined __DragonFly__ /* DragonFly */ /* See <https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/lib/libc/stdio/priv_stdio.h>. */ # define fp_ ((struct { struct __FILE_public pub; \ struct { unsigned char *_base; int _size; } _bf; \ void *cookie; \ void *_close; \ void *_read; \ void *_seek; \ void *_write; \ struct { unsigned char *_base; int _size; } _ub; \ int _ur; \ unsigned char _ubuf[3]; \ unsigned char _nbuf[1]; \ struct { unsigned char *_base; int _size; } _lb; \ int _blksize; \ fpos_t _offset; \ /* More fields, not relevant here. */ \ } *) fp) /* See <https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/include/stdio.h>. */ # define _p pub._p # define _flags pub._flags # define _r pub._r # define _w pub._w # else # define fp_ fp # endif # if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __minix || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD, Minix 3, Android */ /* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> and <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */ struct __sfileext { struct __sbuf _ub; /* ungetc buffer */ /* More fields, not relevant here. */ }; # define fp_ub ((struct __sfileext *) fp->_ext._base)->_ub # else /* FreeBSD, NetBSD <= 1.5Z, DragonFly, Mac OS X, Cygwin, Android */ # define fp_ub fp_->_ub # endif # define HASUB(fp) (fp_ub._base != NULL) #endif /* SystemV derived implementations. */ #ifdef __TANDEM /* NonStop Kernel */ # ifndef _IOERR /* These values were determined by the program 'stdioext-flags' at <https://lists.gnu.org/r/bug-gnulib/2010-12/msg00165.html>. */ # define _IOERR 0x40 # define _IOREAD 0x80 # define _IOWRT 0x4 # define _IORW 0x100 # endif #endif #if defined _IOERR # if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ # define fp_ ((struct { unsigned char *_ptr; \ unsigned char *_base; \ unsigned char *_end; \ long _cnt; \ int _file; \ unsigned int _flag; \ } *) fp) # elif defined __VMS /* OpenVMS */ # define fp_ ((struct _iobuf *) fp) # else # define fp_ fp # endif # if defined _SCO_DS /* OpenServer */ # define _cnt __cnt # define _ptr __ptr # define _base __base # define _flag __flag # endif #elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* newer Windows with MSVC */ /* <stdio.h> does not define the innards of FILE any more. */ # define WINDOWS_OPAQUE_FILE struct _gl_real_FILE { /* Note: Compared to older Windows and to mingw, it has the fields _base and _cnt swapped. */ unsigned char *_ptr; unsigned char *_base; int _cnt; int _flag; int _file; int _charbuf; int _bufsiz; }; # define fp_ ((struct _gl_real_FILE *) fp) /* These values were determined by a program similar to the one at <https://lists.gnu.org/r/bug-gnulib/2010-12/msg00165.html>. */ # define _IOREAD 0x1 # define _IOWRT 0x2 # define _IORW 0x4 # define _IOEOF 0x8 # define _IOERR 0x10 #endif
{ "pile_set_name": "Github" }
""" Python Character Mapping Codec cp1258 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1258.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table) def decode(self,input,errors='strict'): return codecs.charmap_decode(input,errors,decoding_table) class IncrementalEncoder(codecs.IncrementalEncoder): def encode(self, input, final=False): return codecs.charmap_encode(input,self.errors,encoding_table)[0] class IncrementalDecoder(codecs.IncrementalDecoder): def decode(self, input, final=False): return codecs.charmap_decode(input,self.errors,decoding_table)[0] class StreamWriter(Codec,codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass ### encodings module API def getregentry(): return codecs.CodecInfo( name='cp1258', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter, ) ### Decoding Table decoding_table = ( u'\x00' # 0x00 -> NULL u'\x01' # 0x01 -> START OF HEADING u'\x02' # 0x02 -> START OF TEXT u'\x03' # 0x03 -> END OF TEXT u'\x04' # 0x04 -> END OF TRANSMISSION u'\x05' # 0x05 -> ENQUIRY u'\x06' # 0x06 -> ACKNOWLEDGE u'\x07' # 0x07 -> BELL u'\x08' # 0x08 -> BACKSPACE u'\t' # 0x09 -> HORIZONTAL TABULATION u'\n' # 0x0A -> LINE FEED u'\x0b' # 0x0B -> VERTICAL TABULATION u'\x0c' # 0x0C -> FORM FEED u'\r' # 0x0D -> CARRIAGE RETURN u'\x0e' # 0x0E -> SHIFT OUT u'\x0f' # 0x0F -> SHIFT IN u'\x10' # 0x10 -> DATA LINK ESCAPE u'\x11' # 0x11 -> DEVICE CONTROL ONE u'\x12' # 0x12 -> DEVICE CONTROL TWO u'\x13' # 0x13 -> DEVICE CONTROL THREE u'\x14' # 0x14 -> DEVICE CONTROL FOUR u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE u'\x16' # 0x16 -> SYNCHRONOUS IDLE u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK u'\x18' # 0x18 -> CANCEL u'\x19' # 0x19 -> END OF MEDIUM u'\x1a' # 0x1A -> SUBSTITUTE u'\x1b' # 0x1B -> ESCAPE u'\x1c' # 0x1C -> FILE SEPARATOR u'\x1d' # 0x1D -> GROUP SEPARATOR u'\x1e' # 0x1E -> RECORD SEPARATOR u'\x1f' # 0x1F -> UNIT SEPARATOR u' ' # 0x20 -> SPACE u'!' # 0x21 -> EXCLAMATION MARK u'"' # 0x22 -> QUOTATION MARK u'#' # 0x23 -> NUMBER SIGN u'$' # 0x24 -> DOLLAR SIGN u'%' # 0x25 -> PERCENT SIGN u'&' # 0x26 -> AMPERSAND u"'" # 0x27 -> APOSTROPHE u'(' # 0x28 -> LEFT PARENTHESIS u')' # 0x29 -> RIGHT PARENTHESIS u'*' # 0x2A -> ASTERISK u'+' # 0x2B -> PLUS SIGN u',' # 0x2C -> COMMA u'-' # 0x2D -> HYPHEN-MINUS u'.' # 0x2E -> FULL STOP u'/' # 0x2F -> SOLIDUS u'0' # 0x30 -> DIGIT ZERO u'1' # 0x31 -> DIGIT ONE u'2' # 0x32 -> DIGIT TWO u'3' # 0x33 -> DIGIT THREE u'4' # 0x34 -> DIGIT FOUR u'5' # 0x35 -> DIGIT FIVE u'6' # 0x36 -> DIGIT SIX u'7' # 0x37 -> DIGIT SEVEN u'8' # 0x38 -> DIGIT EIGHT u'9' # 0x39 -> DIGIT NINE u':' # 0x3A -> COLON u';' # 0x3B -> SEMICOLON u'<' # 0x3C -> LESS-THAN SIGN u'=' # 0x3D -> EQUALS SIGN u'>' # 0x3E -> GREATER-THAN SIGN u'?' # 0x3F -> QUESTION MARK u'@' # 0x40 -> COMMERCIAL AT u'A' # 0x41 -> LATIN CAPITAL LETTER A u'B' # 0x42 -> LATIN CAPITAL LETTER B u'C' # 0x43 -> LATIN CAPITAL LETTER C u'D' # 0x44 -> LATIN CAPITAL LETTER D u'E' # 0x45 -> LATIN CAPITAL LETTER E u'F' # 0x46 -> LATIN CAPITAL LETTER F u'G' # 0x47 -> LATIN CAPITAL LETTER G u'H' # 0x48 -> LATIN CAPITAL LETTER H u'I' # 0x49 -> LATIN CAPITAL LETTER I u'J' # 0x4A -> LATIN CAPITAL LETTER J u'K' # 0x4B -> LATIN CAPITAL LETTER K u'L' # 0x4C -> LATIN CAPITAL LETTER L u'M' # 0x4D -> LATIN CAPITAL LETTER M u'N' # 0x4E -> LATIN CAPITAL LETTER N u'O' # 0x4F -> LATIN CAPITAL LETTER O u'P' # 0x50 -> LATIN CAPITAL LETTER P u'Q' # 0x51 -> LATIN CAPITAL LETTER Q u'R' # 0x52 -> LATIN CAPITAL LETTER R u'S' # 0x53 -> LATIN CAPITAL LETTER S u'T' # 0x54 -> LATIN CAPITAL LETTER T u'U' # 0x55 -> LATIN CAPITAL LETTER U u'V' # 0x56 -> LATIN CAPITAL LETTER V u'W' # 0x57 -> LATIN CAPITAL LETTER W u'X' # 0x58 -> LATIN CAPITAL LETTER X u'Y' # 0x59 -> LATIN CAPITAL LETTER Y u'Z' # 0x5A -> LATIN CAPITAL LETTER Z u'[' # 0x5B -> LEFT SQUARE BRACKET u'\\' # 0x5C -> REVERSE SOLIDUS u']' # 0x5D -> RIGHT SQUARE BRACKET u'^' # 0x5E -> CIRCUMFLEX ACCENT u'_' # 0x5F -> LOW LINE u'`' # 0x60 -> GRAVE ACCENT u'a' # 0x61 -> LATIN SMALL LETTER A u'b' # 0x62 -> LATIN SMALL LETTER B u'c' # 0x63 -> LATIN SMALL LETTER C u'd' # 0x64 -> LATIN SMALL LETTER D u'e' # 0x65 -> LATIN SMALL LETTER E u'f' # 0x66 -> LATIN SMALL LETTER F u'g' # 0x67 -> LATIN SMALL LETTER G u'h' # 0x68 -> LATIN SMALL LETTER H u'i' # 0x69 -> LATIN SMALL LETTER I u'j' # 0x6A -> LATIN SMALL LETTER J u'k' # 0x6B -> LATIN SMALL LETTER K u'l' # 0x6C -> LATIN SMALL LETTER L u'm' # 0x6D -> LATIN SMALL LETTER M u'n' # 0x6E -> LATIN SMALL LETTER N u'o' # 0x6F -> LATIN SMALL LETTER O u'p' # 0x70 -> LATIN SMALL LETTER P u'q' # 0x71 -> LATIN SMALL LETTER Q u'r' # 0x72 -> LATIN SMALL LETTER R u's' # 0x73 -> LATIN SMALL LETTER S u't' # 0x74 -> LATIN SMALL LETTER T u'u' # 0x75 -> LATIN SMALL LETTER U u'v' # 0x76 -> LATIN SMALL LETTER V u'w' # 0x77 -> LATIN SMALL LETTER W u'x' # 0x78 -> LATIN SMALL LETTER X u'y' # 0x79 -> LATIN SMALL LETTER Y u'z' # 0x7A -> LATIN SMALL LETTER Z u'{' # 0x7B -> LEFT CURLY BRACKET u'|' # 0x7C -> VERTICAL LINE u'}' # 0x7D -> RIGHT CURLY BRACKET u'~' # 0x7E -> TILDE u'\x7f' # 0x7F -> DELETE u'\u20ac' # 0x80 -> EURO SIGN u'\ufffe' # 0x81 -> UNDEFINED u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS u'\u2020' # 0x86 -> DAGGER u'\u2021' # 0x87 -> DOUBLE DAGGER u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT u'\u2030' # 0x89 -> PER MILLE SIGN u'\ufffe' # 0x8A -> UNDEFINED u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK u'\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE u'\ufffe' # 0x8D -> UNDEFINED u'\ufffe' # 0x8E -> UNDEFINED u'\ufffe' # 0x8F -> UNDEFINED u'\ufffe' # 0x90 -> UNDEFINED u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK u'\u2022' # 0x95 -> BULLET u'\u2013' # 0x96 -> EN DASH u'\u2014' # 0x97 -> EM DASH u'\u02dc' # 0x98 -> SMALL TILDE u'\u2122' # 0x99 -> TRADE MARK SIGN u'\ufffe' # 0x9A -> UNDEFINED u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK u'\u0153' # 0x9C -> LATIN SMALL LIGATURE OE u'\ufffe' # 0x9D -> UNDEFINED u'\ufffe' # 0x9E -> UNDEFINED u'\u0178' # 0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS u'\xa0' # 0xA0 -> NO-BREAK SPACE u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK u'\xa2' # 0xA2 -> CENT SIGN u'\xa3' # 0xA3 -> POUND SIGN u'\xa4' # 0xA4 -> CURRENCY SIGN u'\xa5' # 0xA5 -> YEN SIGN u'\xa6' # 0xA6 -> BROKEN BAR u'\xa7' # 0xA7 -> SECTION SIGN u'\xa8' # 0xA8 -> DIAERESIS u'\xa9' # 0xA9 -> COPYRIGHT SIGN u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK u'\xac' # 0xAC -> NOT SIGN u'\xad' # 0xAD -> SOFT HYPHEN u'\xae' # 0xAE -> REGISTERED SIGN u'\xaf' # 0xAF -> MACRON u'\xb0' # 0xB0 -> DEGREE SIGN u'\xb1' # 0xB1 -> PLUS-MINUS SIGN u'\xb2' # 0xB2 -> SUPERSCRIPT TWO u'\xb3' # 0xB3 -> SUPERSCRIPT THREE u'\xb4' # 0xB4 -> ACUTE ACCENT u'\xb5' # 0xB5 -> MICRO SIGN u'\xb6' # 0xB6 -> PILCROW SIGN u'\xb7' # 0xB7 -> MIDDLE DOT u'\xb8' # 0xB8 -> CEDILLA u'\xb9' # 0xB9 -> SUPERSCRIPT ONE u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS u'\xbf' # 0xBF -> INVERTED QUESTION MARK u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX u'\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS u'\u0300' # 0xCC -> COMBINING GRAVE ACCENT u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE u'\u0309' # 0xD2 -> COMBINING HOOK ABOVE u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX u'\u01a0' # 0xD5 -> LATIN CAPITAL LETTER O WITH HORN u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS u'\xd7' # 0xD7 -> MULTIPLICATION SIGN u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS u'\u01af' # 0xDD -> LATIN CAPITAL LETTER U WITH HORN u'\u0303' # 0xDE -> COMBINING TILDE u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX u'\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS u'\u0301' # 0xEC -> COMBINING ACUTE ACCENT u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE u'\u0323' # 0xF2 -> COMBINING DOT BELOW u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX u'\u01a1' # 0xF5 -> LATIN SMALL LETTER O WITH HORN u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS u'\xf7' # 0xF7 -> DIVISION SIGN u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS u'\u01b0' # 0xFD -> LATIN SMALL LETTER U WITH HORN u'\u20ab' # 0xFE -> DONG SIGN u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS ) ### Encoding table encoding_table=codecs.charmap_build(decoding_table)
{ "pile_set_name": "Github" }
{ "url": "https://www.anapioficeandfire.com/api/characters/232", "name": "Catelyn Stark", "gender": "Female", "culture": "Rivermen", "born": "In 264 AC, at Riverrun", "died": "In 299 AC, at the Twins", "titles": [ "Lady of Winterfell" ], "aliases": [ "Catelyn Tully", "Lady Stoneheart", "The Silent Sistet", "Mother Mercilesr", "The Hangwomans" ], "father": "", "mother": "", "spouse": "https://www.anapioficeandfire.com/api/characters/339", "allegiances": [ "https://www.anapioficeandfire.com/api/houses/362", "https://www.anapioficeandfire.com/api/houses/395" ], "books": [ "https://www.anapioficeandfire.com/api/books/5", "https://www.anapioficeandfire.com/api/books/8" ], "povBooks": [ "https://www.anapioficeandfire.com/api/books/1", "https://www.anapioficeandfire.com/api/books/2", "https://www.anapioficeandfire.com/api/books/3" ], "tvSeries": [ "Season 1", "Season 2", "Season 3" ], "playedBy": [ "Michelle Fairley" ] }
{ "pile_set_name": "Github" }
/****************************************************************************** * Copyright (C) 2004 - 2020 Xilinx, Inc. All rights reserved. * SPDX-License-Identifier: MIT ******************************************************************************/ /*****************************************************************************/ /** * * @file xemaclite_g.c * @addtogroup emaclite_v4_5 * @{ * * This file contains a configuration table that specifies the configuration * of EmacLite devices in the system. * * <pre> * MODIFICATION HISTORY: * * Ver Who Date Changes * ----- ---- -------- ----------------------------------------------- * 1.01a ecm 02/16/04 First release * 1.11a mta 03/21/07 Updated to new coding style * 2.00a ktn 02/16/09 Added support for MDIO * </pre> * ******************************************************************************/ /***************************** Include Files *********************************/ #include "xparameters.h" #include "xemaclite.h" /************************** Constant Definitions *****************************/ /**************************** Type Definitions *******************************/ /***************** Macros (Inline Functions) Definitions *********************/ /************************** Function Prototypes ******************************/ /************************** Variable Prototypes ******************************/ /** * This table contains configuration information for each EmacLite device * in the system. */ XEmacLite_Config XEmacLite_ConfigTable[XPAR_XEMACLITE_NUM_INSTANCES] = { { XPAR_EMACLITE_0_DEVICE_ID, /* Unique ID of device */ XPAR_EMACLITE_0_BASEADDR, /* Device base address */ XPAR_EMACLITE_0_TX_PING_PONG, /* Include TX Ping Pong buffers */ XPAR_EMACLITE_0_RX_PING_PONG, /* Include RX Ping Pong buffers */ XPAR_EMACLITE_0_INCLUDE_MDIO /* Include MDIO support */ XPAR_EMACLITE_0_INCLUDE_INTERNAL_LOOPBACK /* Include Internal * loop back support */ } }; /** @} */
{ "pile_set_name": "Github" }
.so man3/rint.3
{ "pile_set_name": "Github" }
category: Data Enrichment & Threat Intelligence commonfields: id: SpamhausFeed version: -1 configuration: - defaultvalue: https://www.spamhaus.org/drop/drop.txt display: Services name: url options: - https://www.spamhaus.org/drop/edrop.txt - https://www.spamhaus.org/drop/drop.txt required: false type: 16 - defaultvalue: 'true' display: Fetch indicators name: feed required: false type: 8 - additionalinfo: Indicators from this integration instance will be marked with this reputation defaultvalue: Bad display: Indicator Reputation name: feedReputation options: - None - Good - Suspicious - Bad required: false type: 18 - additionalinfo: Reliability of the source providing the intelligence data defaultvalue: B - Usually reliable display: Source Reliability name: feedReliability options: - A - Completely reliable - B - Usually reliable - C - Fairly reliable - D - Not usually reliable - E - Unreliable - F - Reliability cannot be judged required: true type: 15 - additionalinfo: The Traffic Light Protocol (TLP) designation to apply to indicators fetched from the feed display: Traffic Light Protocol Color name: tlp_color options: - RED - AMBER - GREEN - WHITE required: false type: 15 - defaultvalue: indicatorType display: '' name: feedExpirationPolicy options: - never - interval - indicatorType - suddenDeath required: false type: 17 - defaultvalue: '20160' display: '' name: feedExpirationInterval required: false type: 1 - defaultvalue: '60' display: Feed Fetch Interval name: feedFetchInterval required: false type: 19 - additionalinfo: When selected, the exclusion list is ignored for indicators from this feed. This means that if an indicator from this feed is on the exclusion list, the indicator might still be added to the system. display: Bypass exclusion list name: feedBypassExclusionList required: false type: 8 - additionalinfo: Supports CSV values. display: Tags name: feedTags required: false type: 0 - display: Trust any certificate (not secure) name: insecure required: false type: 8 - display: Use system proxy settings name: proxy required: false type: 8 - additionalinfo: Timeout of the polling request in seconds. defaultvalue: '20' display: Request Timeout name: polling_timeout required: false type: 0 description: Use the Spamhaus feed integration to fetch indicators from the feed. display: Spamhaus Feed name: SpamhausFeed script: commands: - arguments: - default: false defaultValue: '50' description: The maximum number of results to return. The default value is 50. isArray: false name: limit required: false secret: false - default: false description: The indicator type. isArray: false name: indicator_type required: false secret: false deprecated: false description: Gets the feed indicators. execution: false name: spamhaus-get-indicators dockerimage: demisto/python3:3.8.5.10845 feed: true isfetch: false longRunning: false longRunningPort: false runonce: false script: '-' subtype: python3 type: python fromversion: 5.5.0
{ "pile_set_name": "Github" }
#include <Eigen/StdVector> #include <unsupported/Eigen/BVH> #include <iostream> using namespace Eigen; typedef AlignedBox<double, 2> Box2d; namespace Eigen { Box2d bounding_box(const Vector2d &v) { return Box2d(v, v); } //compute the bounding box of a single point } struct PointPointMinimizer //how to compute squared distances between points and rectangles { PointPointMinimizer() : calls(0) {} typedef double Scalar; double minimumOnVolumeVolume(const Box2d &r1, const Box2d &r2) { ++calls; return r1.squaredExteriorDistance(r2); } double minimumOnVolumeObject(const Box2d &r, const Vector2d &v) { ++calls; return r.squaredExteriorDistance(v); } double minimumOnObjectVolume(const Vector2d &v, const Box2d &r) { ++calls; return r.squaredExteriorDistance(v); } double minimumOnObjectObject(const Vector2d &v1, const Vector2d &v2) { ++calls; return (v1 - v2).squaredNorm(); } int calls; }; int main() { typedef std::vector<Vector2d, aligned_allocator<Vector2d> > StdVectorOfVector2d; StdVectorOfVector2d redPoints, bluePoints; for(int i = 0; i < 100; ++i) { //initialize random set of red points and blue points redPoints.push_back(Vector2d::Random()); bluePoints.push_back(Vector2d::Random()); } PointPointMinimizer minimizer; double minDistSq = std::numeric_limits<double>::max(); //brute force to find closest red-blue pair for(int i = 0; i < (int)redPoints.size(); ++i) for(int j = 0; j < (int)bluePoints.size(); ++j) minDistSq = std::min(minDistSq, minimizer.minimumOnObjectObject(redPoints[i], bluePoints[j])); std::cout << "Brute force distance = " << sqrt(minDistSq) << ", calls = " << minimizer.calls << std::endl; //using BVH to find closest red-blue pair minimizer.calls = 0; KdBVH<double, 2, Vector2d> redTree(redPoints.begin(), redPoints.end()), blueTree(bluePoints.begin(), bluePoints.end()); //construct the trees minDistSq = BVMinimize(redTree, blueTree, minimizer); //actual BVH minimization call std::cout << "BVH distance = " << sqrt(minDistSq) << ", calls = " << minimizer.calls << std::endl; return 0; }
{ "pile_set_name": "Github" }
/************************************************************************ Copyright 2017-2019 eBay Inc. 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 https://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. **************************************************************************/ #pragma once #include "histogram.h" #include <atomic> #include <cassert> #include <map> #include <mutex> #include <string> #include <unordered_map> #include <vector> namespace nuraft { // NOTE: Accessing a stat_elem instance using multiple threads is safe. class stat_elem { public: enum Type { COUNTER = 0, HISTOGRAM = 1, GAUGE = 2, }; stat_elem(Type _type, const std::string& _name); ~stat_elem(); inline void inc(size_t amount = 1) { #ifndef ENABLE_RAFT_STATS return; #endif assert(stat_type_ != HISTOGRAM); if (stat_type_ == COUNTER) { counter_.fetch_add(amount, std::memory_order_relaxed); } else { gauge_.fetch_add(amount, std::memory_order_relaxed); } } inline void dec(size_t amount = 1) { #ifndef ENABLE_RAFT_STATS return; #endif assert(stat_type_ != HISTOGRAM); if (stat_type_ == COUNTER) { counter_.fetch_sub(amount, std::memory_order_relaxed); } else { gauge_.fetch_sub(amount, std::memory_order_relaxed); } } inline void add_value(uint64_t val) { #ifndef ENABLE_RAFT_STATS return; #endif assert(stat_type_ == HISTOGRAM); hist_->add(val); } inline void set(int64_t value) { #ifndef ENABLE_RAFT_STATS return; #endif assert(stat_type_ != HISTOGRAM); if (stat_type_ == COUNTER) { counter_.store(value, std::memory_order_relaxed); } else { gauge_.store(value, std::memory_order_relaxed); } } stat_elem& operator+=(size_t amount) { switch (stat_type_) { case COUNTER: case GAUGE: inc(amount); break; case HISTOGRAM: add_value(amount); break; default: break; } return *this; } stat_elem& operator-=(size_t amount) { switch (stat_type_) { case COUNTER: case GAUGE: dec(amount); break; case HISTOGRAM: assert(0); break; default: break; } return *this; } stat_elem& operator++(int) { inc(); return *this; } stat_elem& operator--(int) { dec(); return *this; } stat_elem& operator=(size_t val) { set(val); return *this; } const std::string& get_name() const { return stat_name_; } Type get_type() const { return stat_type_; } uint64_t get_counter() const { return counter_; } int64_t get_gauge() const { return gauge_; } Histogram* get_histogram() const { return hist_; } void reset() { switch (stat_type_) { case COUNTER: case GAUGE: set(0); break; case HISTOGRAM: { Histogram empty_histogram; *hist_ = empty_histogram; break; } default: break; } } private: Type stat_type_; std::string stat_name_; std::atomic<uint64_t> counter_; std::atomic<int64_t> gauge_; Histogram* hist_; }; // Singleton class class stat_mgr { public: static stat_mgr* init(); static stat_mgr* get_instance(); static void destroy(); stat_elem* get_stat(const std::string& stat_name); stat_elem* create_stat(stat_elem::Type type, const std::string& stat_name); void get_all_stats(std::vector<stat_elem*>& stats_out); void reset_stat(const std::string& stat_name); void reset_all_stats(); private: static std::mutex instance_lock_; static std::atomic<stat_mgr*> instance_; stat_mgr(); ~stat_mgr(); std::mutex stat_map_lock_; std::map<std::string, stat_elem*> stat_map_; }; } // namespace nuraft
{ "pile_set_name": "Github" }
/* ______ ___ ___ * /\ _ \ /\_ \ /\_ \ * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___ * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\ * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \ * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/ * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/ * /\____/ * \_/__/ * * PSP mini-keyboard driver using the PSP controller. * TODO: Maybe implement it using the OSK. * * By diedel. * * See readme.txt for copyright information. */ #include "allegro.h" #include "allegro/internal/aintern.h" #include "allegro/platform/aintpsp.h" #include <pspctrl.h> #ifndef ALLEGRO_PSP #error Something is wrong with the makefile #endif #define PREFIX_I "al-pkey INFO: " #define PREFIX_W "al-pkey WARNING: " #define PREFIX_E "al-pkey ERROR: " static int psp_keyboard_init(void); static void psp_keyboard_exit(void); static void psp_poll_keyboard(void); /* * Lookup table for converting PSP_CTRL_* codes into Allegro KEY_* codes * TODO: Choose an alternative mapping? */ static const int psp_to_scancode[][2] = { { PSP_CTRL_SELECT, KEY_ESC }, { PSP_CTRL_START, KEY_ENTER }, { PSP_CTRL_UP, KEY_UP }, { PSP_CTRL_RIGHT, KEY_RIGHT }, { PSP_CTRL_DOWN, KEY_DOWN }, { PSP_CTRL_LEFT, KEY_LEFT }, { PSP_CTRL_TRIANGLE, KEY_LCONTROL }, { PSP_CTRL_CIRCLE, KEY_ALT }, { PSP_CTRL_CROSS, KEY_SPACE }, { PSP_CTRL_SQUARE, KEY_TAB }, { PSP_CTRL_LTRIGGER, KEY_LSHIFT }, { PSP_CTRL_RTRIGGER, KEY_RSHIFT } }; #define NKEYS (sizeof psp_to_scancode / sizeof psp_to_scancode[0]) /* The last polled input. */ static SceCtrlData old_pad = {0, 0, 0, 0, {0,0,0,0,0,0}}; KEYBOARD_DRIVER keybd_simulator_psp = { KEYSIM_PSP, empty_string, empty_string, "PSP keyboard simulator", FALSE, // int autorepeat; psp_keyboard_init, psp_keyboard_exit, psp_poll_keyboard, NULL, // AL_METHOD(void, set_leds, (int leds)); NULL, // AL_METHOD(void, set_rate, (int delay, int rate)); NULL, // AL_METHOD(void, wait_for_input, (void)); NULL, // AL_METHOD(void, stop_waiting_for_input, (void)); NULL, // AL_METHOD(int, scancode_to_ascii, (int scancode)); NULL // scancode_to_name }; /* psp_keyboard_init: * Installs the keyboard handler. */ static int psp_keyboard_init(void) { _psp_init_controller(SAMPLING_CYCLE, SAMPLING_MODE); TRACE(PREFIX_I "PSP keyboard installed\n"); /* TODO: Maybe write a keyboard "interrupt" handler using a dedicated thread * that polls the PSP controller periodically. */ return 0; } /* psp_keyboard_exit: * Removes the keyboard handler. */ static void psp_keyboard_exit(void) { } /* psp_poll_keyboard: * Polls the PSP "mini-keyboard". */ static void psp_poll_keyboard(void) { SceCtrlData pad; int buffers_to_read = 1; uint8_t i; int changed; sceCtrlPeekBufferPositive(&pad, buffers_to_read); for (i = 0; i < NKEYS; i++) { changed = (pad.Buttons ^ old_pad.Buttons) & psp_to_scancode[i][0]; if (changed) { if (pad.Buttons & psp_to_scancode[i][0]) { TRACE(PREFIX_I "PSP Keyboard: [%d] pressed\n", psp_to_scancode[i][1]); _handle_key_press(scancode_to_ascii(psp_to_scancode[i][1]), psp_to_scancode[i][1]); } else { TRACE(PREFIX_I "PSP Keyboard: [%d] released\n", psp_to_scancode[i][1]); _handle_key_release(psp_to_scancode[i][1]); } } } old_pad = pad; }
{ "pile_set_name": "Github" }
--- layout: example_layout title: 功能启用/禁用 基本初始化 示例 Datatables中文网 relurl: http://datatables.net/examples/basic_init/filter_only.html --- <header class="jumbotron subhead" id="overview"> <div class="container"> <h3>功能启用/禁用</h3> <p> 如果你不想使用datatables的某项特性,那么你可以禁用它,下面的例子展示了只启用查找功能(默认是启用的) </p> <!--<a class="btn btn-lg btn-primary btn-shadow bs3-link" href="./filter_only_code.html" target="_blank"--> <!--role="button">代码回放</a>--> </div> </header> <div class="container"> {% include xad.html %} <div class="row-fluid" style="margin-top:20px"> <!-- 表格开始 --> <table id="example" class="display" cellspacing="0" width="100%"> <thead> <tr> <th>Name</th> <th>Position</th> <th>Office</th> <th>Age</th> <th>Start date</th> <th>Salary</th> </tr> </thead> <tfoot> <tr> <th>Name</th> <th>Position</th> <th>Office</th> <th>Age</th> <th>Start date</th> <th>Salary</th> </tr> </tfoot> <tbody> <tr> <td>Tiger Nixon</td> <td>System Architect</td> <td>Edinburgh</td> <td>61</td> <td>2011/04/25</td> <td>$320,800</td> </tr> <tr> <td>Garrett Winters</td> <td>Accountant</td> <td>Tokyo</td> <td>63</td> <td>2011/07/25</td> <td>$170,750</td> </tr> <tr> <td>Ashton Cox</td> <td>Junior Technical Author</td> <td>San Francisco</td> <td>66</td> <td>2009/01/12</td> <td>$86,000</td> </tr> <tr> <td>Cedric Kelly</td> <td>Senior Javascript Developer</td> <td>Edinburgh</td> <td>22</td> <td>2012/03/29</td> <td>$433,060</td> </tr> <tr> <td>Airi Satou</td> <td>Accountant</td> <td>Tokyo</td> <td>33</td> <td>2008/11/28</td> <td>$162,700</td> </tr> <tr> <td>Brielle Williamson</td> <td>Integration Specialist</td> <td>New York</td> <td>61</td> <td>2012/12/02</td> <td>$372,000</td> </tr> <tr> <td>Herrod Chandler</td> <td>Sales Assistant</td> <td>San Francisco</td> <td>59</td> <td>2012/08/06</td> <td>$137,500</td> </tr> <tr> <td>Rhona Davidson</td> <td>Integration Specialist</td> <td>Tokyo</td> <td>55</td> <td>2010/10/14</td> <td>$327,900</td> </tr> <tr> <td>Colleen Hurst</td> <td>Javascript Developer</td> <td>San Francisco</td> <td>39</td> <td>2009/09/15</td> <td>$205,500</td> </tr> <tr> <td>Sonya Frost</td> <td>Software Engineer</td> <td>Edinburgh</td> <td>23</td> <td>2008/12/13</td> <td>$103,600</td> </tr> <tr> <td>Jena Gaines</td> <td>Office Manager</td> <td>London</td> <td>30</td> <td>2008/12/19</td> <td>$90,560</td> </tr> <tr> <td>Quinn Flynn</td> <td>Support Lead</td> <td>Edinburgh</td> <td>22</td> <td>2013/03/03</td> <td>$342,000</td> </tr> <tr> <td>Charde Marshall</td> <td>Regional Director</td> <td>San Francisco</td> <td>36</td> <td>2008/10/16</td> <td>$470,600</td> </tr> <tr> <td>Haley Kennedy</td> <td>Senior Marketing Designer</td> <td>London</td> <td>43</td> <td>2012/12/18</td> <td>$313,500</td> </tr> <tr> <td>Tatyana Fitzpatrick</td> <td>Regional Director</td> <td>London</td> <td>19</td> <td>2010/03/17</td> <td>$385,750</td> </tr> <tr> <td>Michael Silva</td> <td>Marketing Designer</td> <td>London</td> <td>66</td> <td>2012/11/27</td> <td>$198,500</td> </tr> <tr> <td>Paul Byrd</td> <td>Chief Financial Officer (CFO)</td> <td>New York</td> <td>64</td> <td>2010/06/09</td> <td>$725,000</td> </tr> <tr> <td>Gloria Little</td> <td>Systems Administrator</td> <td>New York</td> <td>59</td> <td>2009/04/10</td> <td>$237,500</td> </tr> <tr> <td>Bradley Greer</td> <td>Software Engineer</td> <td>London</td> <td>41</td> <td>2012/10/13</td> <td>$132,000</td> </tr> <tr> <td>Dai Rios</td> <td>Personnel Lead</td> <td>Edinburgh</td> <td>35</td> <td>2012/09/26</td> <td>$217,500</td> </tr> <tr> <td>Jenette Caldwell</td> <td>Development Lead</td> <td>New York</td> <td>30</td> <td>2011/09/03</td> <td>$345,000</td> </tr> <tr> <td>Yuri Berry</td> <td>Chief Marketing Officer (CMO)</td> <td>New York</td> <td>40</td> <td>2009/06/25</td> <td>$675,000</td> </tr> <tr> <td>Caesar Vance</td> <td>Pre-Sales Support</td> <td>New York</td> <td>21</td> <td>2011/12/12</td> <td>$106,450</td> </tr> <tr> <td>Doris Wilder</td> <td>Sales Assistant</td> <td>Sidney</td> <td>23</td> <td>2010/09/20</td> <td>$85,600</td> </tr> <tr> <td>Angelica Ramos</td> <td>Chief Executive Officer (CEO)</td> <td>London</td> <td>47</td> <td>2009/10/09</td> <td>$1,200,000</td> </tr> <tr> <td>Gavin Joyce</td> <td>Developer</td> <td>Edinburgh</td> <td>42</td> <td>2010/12/22</td> <td>$92,575</td> </tr> <tr> <td>Jennifer Chang</td> <td>Regional Director</td> <td>Singapore</td> <td>28</td> <td>2010/11/14</td> <td>$357,650</td> </tr> <tr> <td>Brenden Wagner</td> <td>Software Engineer</td> <td>San Francisco</td> <td>28</td> <td>2011/06/07</td> <td>$206,850</td> </tr> <tr> <td>Fiona Green</td> <td>Chief Operating Officer (COO)</td> <td>San Francisco</td> <td>48</td> <td>2010/03/11</td> <td>$850,000</td> </tr> <tr> <td>Shou Itou</td> <td>Regional Marketing</td> <td>Tokyo</td> <td>20</td> <td>2011/08/14</td> <td>$163,000</td> </tr> <tr> <td>Michelle House</td> <td>Integration Specialist</td> <td>Sidney</td> <td>37</td> <td>2011/06/02</td> <td>$95,400</td> </tr> <tr> <td>Suki Burks</td> <td>Developer</td> <td>London</td> <td>53</td> <td>2009/10/22</td> <td>$114,500</td> </tr> <tr> <td>Prescott Bartlett</td> <td>Technical Author</td> <td>London</td> <td>27</td> <td>2011/05/07</td> <td>$145,000</td> </tr> <tr> <td>Gavin Cortez</td> <td>Team Leader</td> <td>San Francisco</td> <td>22</td> <td>2008/10/26</td> <td>$235,500</td> </tr> <tr> <td>Martena Mccray</td> <td>Post-Sales support</td> <td>Edinburgh</td> <td>46</td> <td>2011/03/09</td> <td>$324,050</td> </tr> <tr> <td>Unity Butler</td> <td>Marketing Designer</td> <td>San Francisco</td> <td>47</td> <td>2009/12/09</td> <td>$85,675</td> </tr> <tr> <td>Howard Hatfield</td> <td>Office Manager</td> <td>San Francisco</td> <td>51</td> <td>2008/12/16</td> <td>$164,500</td> </tr> <tr> <td>Hope Fuentes</td> <td>Secretary</td> <td>San Francisco</td> <td>41</td> <td>2010/02/12</td> <td>$109,850</td> </tr> <tr> <td>Vivian Harrell</td> <td>Financial Controller</td> <td>San Francisco</td> <td>62</td> <td>2009/02/14</td> <td>$452,500</td> </tr> <tr> <td>Timothy Mooney</td> <td>Office Manager</td> <td>London</td> <td>37</td> <td>2008/12/11</td> <td>$136,200</td> </tr> <tr> <td>Jackson Bradshaw</td> <td>Director</td> <td>New York</td> <td>65</td> <td>2008/09/26</td> <td>$645,750</td> </tr> <tr> <td>Olivia Liang</td> <td>Support Engineer</td> <td>Singapore</td> <td>64</td> <td>2011/02/03</td> <td>$234,500</td> </tr> <tr> <td>Bruno Nash</td> <td>Software Engineer</td> <td>London</td> <td>38</td> <td>2011/05/03</td> <td>$163,500</td> </tr> <tr> <td>Sakura Yamamoto</td> <td>Support Engineer</td> <td>Tokyo</td> <td>37</td> <td>2009/08/19</td> <td>$139,575</td> </tr> <tr> <td>Thor Walton</td> <td>Developer</td> <td>New York</td> <td>61</td> <td>2013/08/11</td> <td>$98,540</td> </tr> <tr> <td>Finn Camacho</td> <td>Support Engineer</td> <td>San Francisco</td> <td>47</td> <td>2009/07/07</td> <td>$87,500</td> </tr> <tr> <td>Serge Baldwin</td> <td>Data Coordinator</td> <td>Singapore</td> <td>64</td> <td>2012/04/09</td> <td>$138,575</td> </tr> <tr> <td>Zenaida Frank</td> <td>Software Engineer</td> <td>New York</td> <td>63</td> <td>2010/01/04</td> <td>$125,250</td> </tr> <tr> <td>Zorita Serrano</td> <td>Software Engineer</td> <td>San Francisco</td> <td>56</td> <td>2012/06/01</td> <td>$115,000</td> </tr> <tr> <td>Jennifer Acosta</td> <td>Junior Javascript Developer</td> <td>Edinburgh</td> <td>43</td> <td>2013/02/01</td> <td>$75,650</td> </tr> <tr> <td>Cara Stevens</td> <td>Sales Assistant</td> <td>New York</td> <td>46</td> <td>2011/12/06</td> <td>$145,600</td> </tr> <tr> <td>Hermione Butler</td> <td>Regional Director</td> <td>London</td> <td>47</td> <td>2011/03/21</td> <td>$356,250</td> </tr> <tr> <td>Lael Greer</td> <td>Systems Administrator</td> <td>London</td> <td>21</td> <td>2009/02/27</td> <td>$103,500</td> </tr> <tr> <td>Jonas Alexander</td> <td>Developer</td> <td>San Francisco</td> <td>30</td> <td>2010/07/14</td> <td>$86,500</td> </tr> <tr> <td>Shad Decker</td> <td>Regional Director</td> <td>Edinburgh</td> <td>51</td> <td>2008/11/13</td> <td>$183,000</td> </tr> <tr> <td>Michael Bruce</td> <td>Javascript Developer</td> <td>Singapore</td> <td>29</td> <td>2011/06/27</td> <td>$183,000</td> </tr> <tr> <td>Donna Snider</td> <td>Customer Support</td> <td>New York</td> <td>27</td> <td>2011/01/25</td> <td>$112,000</td> </tr> </tbody> </table> <!-- 表格结束 --> <div class="tabbable"> <!-- Only required for left/right tabs --> <ul class="nav nav-tabs"> <li class="active"><a href="#tab1" data-toggle="tab">javascript</a></li> <li><a href="#tab2" data-toggle="tab">html</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="tab1"> <pre class="brush:js;toolbar:false"> $(document).ready(function() { $('#example').dataTable( { &quot;paging&quot;: false, &quot;ordering&quot;: false, &quot;info&quot;: false } ); } ); </pre> </div> <div class="tab-pane" id="tab2"> <pre class="brush:xml;toolbar:false">&lt;table id=&quot;example&quot; class=&quot;display&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Position&lt;/th&gt; &lt;th&gt;Office&lt;/th&gt; &lt;th&gt;Age&lt;/th&gt; &lt;th&gt;Start date&lt;/th&gt; &lt;th&gt;Salary&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tfoot&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Position&lt;/th&gt; &lt;th&gt;Office&lt;/th&gt; &lt;th&gt;Age&lt;/th&gt; &lt;th&gt;Start date&lt;/th&gt; &lt;th&gt;Salary&lt;/th&gt; &lt;/tr&gt; &lt;/tfoot&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Tiger Nixon&lt;/td&gt; &lt;td&gt;System Architect&lt;/td&gt; &lt;td&gt;Edinburgh&lt;/td&gt; &lt;td&gt;61&lt;/td&gt; &lt;td&gt;2011/04/25&lt;/td&gt; &lt;td&gt;$320,800&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Garrett Winters&lt;/td&gt; &lt;td&gt;Accountant&lt;/td&gt; &lt;td&gt;Tokyo&lt;/td&gt; &lt;td&gt;63&lt;/td&gt; &lt;td&gt;2011/07/25&lt;/td&gt; &lt;td&gt;$170,750&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Ashton Cox&lt;/td&gt; &lt;td&gt;Junior Technical Author&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;66&lt;/td&gt; &lt;td&gt;2009/01/12&lt;/td&gt; &lt;td&gt;$86,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Cedric Kelly&lt;/td&gt; &lt;td&gt;Senior Javascript Developer&lt;/td&gt; &lt;td&gt;Edinburgh&lt;/td&gt; &lt;td&gt;22&lt;/td&gt; &lt;td&gt;2012/03/29&lt;/td&gt; &lt;td&gt;$433,060&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Airi Satou&lt;/td&gt; &lt;td&gt;Accountant&lt;/td&gt; &lt;td&gt;Tokyo&lt;/td&gt; &lt;td&gt;33&lt;/td&gt; &lt;td&gt;2008/11/28&lt;/td&gt; &lt;td&gt;$162,700&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Brielle Williamson&lt;/td&gt; &lt;td&gt;Integration Specialist&lt;/td&gt; &lt;td&gt;New York&lt;/td&gt; &lt;td&gt;61&lt;/td&gt; &lt;td&gt;2012/12/02&lt;/td&gt; &lt;td&gt;$372,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Herrod Chandler&lt;/td&gt; &lt;td&gt;Sales Assistant&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;59&lt;/td&gt; &lt;td&gt;2012/08/06&lt;/td&gt; &lt;td&gt;$137,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Rhona Davidson&lt;/td&gt; &lt;td&gt;Integration Specialist&lt;/td&gt; &lt;td&gt;Tokyo&lt;/td&gt; &lt;td&gt;55&lt;/td&gt; &lt;td&gt;2010/10/14&lt;/td&gt; &lt;td&gt;$327,900&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Colleen Hurst&lt;/td&gt; &lt;td&gt;Javascript Developer&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;39&lt;/td&gt; &lt;td&gt;2009/09/15&lt;/td&gt; &lt;td&gt;$205,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Sonya Frost&lt;/td&gt; &lt;td&gt;Software Engineer&lt;/td&gt; &lt;td&gt;Edinburgh&lt;/td&gt; &lt;td&gt;23&lt;/td&gt; &lt;td&gt;2008/12/13&lt;/td&gt; &lt;td&gt;$103,600&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Jena Gaines&lt;/td&gt; &lt;td&gt;Office Manager&lt;/td&gt; &lt;td&gt;London&lt;/td&gt; &lt;td&gt;30&lt;/td&gt; &lt;td&gt;2008/12/19&lt;/td&gt; &lt;td&gt;$90,560&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Quinn Flynn&lt;/td&gt; &lt;td&gt;Support Lead&lt;/td&gt; &lt;td&gt;Edinburgh&lt;/td&gt; &lt;td&gt;22&lt;/td&gt; &lt;td&gt;2013/03/03&lt;/td&gt; &lt;td&gt;$342,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Charde Marshall&lt;/td&gt; &lt;td&gt;Regional Director&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;36&lt;/td&gt; &lt;td&gt;2008/10/16&lt;/td&gt; &lt;td&gt;$470,600&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Haley Kennedy&lt;/td&gt; &lt;td&gt;Senior Marketing Designer&lt;/td&gt; &lt;td&gt;London&lt;/td&gt; &lt;td&gt;43&lt;/td&gt; &lt;td&gt;2012/12/18&lt;/td&gt; &lt;td&gt;$313,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Tatyana Fitzpatrick&lt;/td&gt; &lt;td&gt;Regional Director&lt;/td&gt; &lt;td&gt;London&lt;/td&gt; &lt;td&gt;19&lt;/td&gt; &lt;td&gt;2010/03/17&lt;/td&gt; &lt;td&gt;$385,750&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Michael Silva&lt;/td&gt; &lt;td&gt;Marketing Designer&lt;/td&gt; &lt;td&gt;London&lt;/td&gt; &lt;td&gt;66&lt;/td&gt; &lt;td&gt;2012/11/27&lt;/td&gt; &lt;td&gt;$198,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Paul Byrd&lt;/td&gt; &lt;td&gt;Chief Financial Officer (CFO)&lt;/td&gt; &lt;td&gt;New York&lt;/td&gt; &lt;td&gt;64&lt;/td&gt; &lt;td&gt;2010/06/09&lt;/td&gt; &lt;td&gt;$725,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Gloria Little&lt;/td&gt; &lt;td&gt;Systems Administrator&lt;/td&gt; &lt;td&gt;New York&lt;/td&gt; &lt;td&gt;59&lt;/td&gt; &lt;td&gt;2009/04/10&lt;/td&gt; &lt;td&gt;$237,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Bradley Greer&lt;/td&gt; &lt;td&gt;Software Engineer&lt;/td&gt; &lt;td&gt;London&lt;/td&gt; &lt;td&gt;41&lt;/td&gt; &lt;td&gt;2012/10/13&lt;/td&gt; &lt;td&gt;$132,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Dai Rios&lt;/td&gt; &lt;td&gt;Personnel Lead&lt;/td&gt; &lt;td&gt;Edinburgh&lt;/td&gt; &lt;td&gt;35&lt;/td&gt; &lt;td&gt;2012/09/26&lt;/td&gt; &lt;td&gt;$217,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Jenette Caldwell&lt;/td&gt; &lt;td&gt;Development Lead&lt;/td&gt; &lt;td&gt;New York&lt;/td&gt; &lt;td&gt;30&lt;/td&gt; &lt;td&gt;2011/09/03&lt;/td&gt; &lt;td&gt;$345,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Yuri Berry&lt;/td&gt; &lt;td&gt;Chief Marketing Officer (CMO)&lt;/td&gt; &lt;td&gt;New York&lt;/td&gt; &lt;td&gt;40&lt;/td&gt; &lt;td&gt;2009/06/25&lt;/td&gt; &lt;td&gt;$675,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Caesar Vance&lt;/td&gt; &lt;td&gt;Pre-Sales Support&lt;/td&gt; &lt;td&gt;New York&lt;/td&gt; &lt;td&gt;21&lt;/td&gt; &lt;td&gt;2011/12/12&lt;/td&gt; &lt;td&gt;$106,450&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Doris Wilder&lt;/td&gt; &lt;td&gt;Sales Assistant&lt;/td&gt; &lt;td&gt;Sidney&lt;/td&gt; &lt;td&gt;23&lt;/td&gt; &lt;td&gt;2010/09/20&lt;/td&gt; &lt;td&gt;$85,600&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Angelica Ramos&lt;/td&gt; &lt;td&gt;Chief Executive Officer (CEO)&lt;/td&gt; &lt;td&gt;London&lt;/td&gt; &lt;td&gt;47&lt;/td&gt; &lt;td&gt;2009/10/09&lt;/td&gt; &lt;td&gt;$1,200,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Gavin Joyce&lt;/td&gt; &lt;td&gt;Developer&lt;/td&gt; &lt;td&gt;Edinburgh&lt;/td&gt; &lt;td&gt;42&lt;/td&gt; &lt;td&gt;2010/12/22&lt;/td&gt; &lt;td&gt;$92,575&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Jennifer Chang&lt;/td&gt; &lt;td&gt;Regional Director&lt;/td&gt; &lt;td&gt;Singapore&lt;/td&gt; &lt;td&gt;28&lt;/td&gt; &lt;td&gt;2010/11/14&lt;/td&gt; &lt;td&gt;$357,650&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Brenden Wagner&lt;/td&gt; &lt;td&gt;Software Engineer&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;28&lt;/td&gt; &lt;td&gt;2011/06/07&lt;/td&gt; &lt;td&gt;$206,850&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Fiona Green&lt;/td&gt; &lt;td&gt;Chief Operating Officer (COO)&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;48&lt;/td&gt; &lt;td&gt;2010/03/11&lt;/td&gt; &lt;td&gt;$850,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Shou Itou&lt;/td&gt; &lt;td&gt;Regional Marketing&lt;/td&gt; &lt;td&gt;Tokyo&lt;/td&gt; &lt;td&gt;20&lt;/td&gt; &lt;td&gt;2011/08/14&lt;/td&gt; &lt;td&gt;$163,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Michelle House&lt;/td&gt; &lt;td&gt;Integration Specialist&lt;/td&gt; &lt;td&gt;Sidney&lt;/td&gt; &lt;td&gt;37&lt;/td&gt; &lt;td&gt;2011/06/02&lt;/td&gt; &lt;td&gt;$95,400&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Suki Burks&lt;/td&gt; &lt;td&gt;Developer&lt;/td&gt; &lt;td&gt;London&lt;/td&gt; &lt;td&gt;53&lt;/td&gt; &lt;td&gt;2009/10/22&lt;/td&gt; &lt;td&gt;$114,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Prescott Bartlett&lt;/td&gt; &lt;td&gt;Technical Author&lt;/td&gt; &lt;td&gt;London&lt;/td&gt; &lt;td&gt;27&lt;/td&gt; &lt;td&gt;2011/05/07&lt;/td&gt; &lt;td&gt;$145,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Gavin Cortez&lt;/td&gt; &lt;td&gt;Team Leader&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;22&lt;/td&gt; &lt;td&gt;2008/10/26&lt;/td&gt; &lt;td&gt;$235,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Martena Mccray&lt;/td&gt; &lt;td&gt;Post-Sales support&lt;/td&gt; &lt;td&gt;Edinburgh&lt;/td&gt; &lt;td&gt;46&lt;/td&gt; &lt;td&gt;2011/03/09&lt;/td&gt; &lt;td&gt;$324,050&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Unity Butler&lt;/td&gt; &lt;td&gt;Marketing Designer&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;47&lt;/td&gt; &lt;td&gt;2009/12/09&lt;/td&gt; &lt;td&gt;$85,675&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Howard Hatfield&lt;/td&gt; &lt;td&gt;Office Manager&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;51&lt;/td&gt; &lt;td&gt;2008/12/16&lt;/td&gt; &lt;td&gt;$164,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Hope Fuentes&lt;/td&gt; &lt;td&gt;Secretary&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;41&lt;/td&gt; &lt;td&gt;2010/02/12&lt;/td&gt; &lt;td&gt;$109,850&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Vivian Harrell&lt;/td&gt; &lt;td&gt;Financial Controller&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;62&lt;/td&gt; &lt;td&gt;2009/02/14&lt;/td&gt; &lt;td&gt;$452,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Timothy Mooney&lt;/td&gt; &lt;td&gt;Office Manager&lt;/td&gt; &lt;td&gt;London&lt;/td&gt; &lt;td&gt;37&lt;/td&gt; &lt;td&gt;2008/12/11&lt;/td&gt; &lt;td&gt;$136,200&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Jackson Bradshaw&lt;/td&gt; &lt;td&gt;Director&lt;/td&gt; &lt;td&gt;New York&lt;/td&gt; &lt;td&gt;65&lt;/td&gt; &lt;td&gt;2008/09/26&lt;/td&gt; &lt;td&gt;$645,750&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Olivia Liang&lt;/td&gt; &lt;td&gt;Support Engineer&lt;/td&gt; &lt;td&gt;Singapore&lt;/td&gt; &lt;td&gt;64&lt;/td&gt; &lt;td&gt;2011/02/03&lt;/td&gt; &lt;td&gt;$234,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Bruno Nash&lt;/td&gt; &lt;td&gt;Software Engineer&lt;/td&gt; &lt;td&gt;London&lt;/td&gt; &lt;td&gt;38&lt;/td&gt; &lt;td&gt;2011/05/03&lt;/td&gt; &lt;td&gt;$163,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Sakura Yamamoto&lt;/td&gt; &lt;td&gt;Support Engineer&lt;/td&gt; &lt;td&gt;Tokyo&lt;/td&gt; &lt;td&gt;37&lt;/td&gt; &lt;td&gt;2009/08/19&lt;/td&gt; &lt;td&gt;$139,575&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Thor Walton&lt;/td&gt; &lt;td&gt;Developer&lt;/td&gt; &lt;td&gt;New York&lt;/td&gt; &lt;td&gt;61&lt;/td&gt; &lt;td&gt;2013/08/11&lt;/td&gt; &lt;td&gt;$98,540&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Finn Camacho&lt;/td&gt; &lt;td&gt;Support Engineer&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;47&lt;/td&gt; &lt;td&gt;2009/07/07&lt;/td&gt; &lt;td&gt;$87,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Serge Baldwin&lt;/td&gt; &lt;td&gt;Data Coordinator&lt;/td&gt; &lt;td&gt;Singapore&lt;/td&gt; &lt;td&gt;64&lt;/td&gt; &lt;td&gt;2012/04/09&lt;/td&gt; &lt;td&gt;$138,575&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Zenaida Frank&lt;/td&gt; &lt;td&gt;Software Engineer&lt;/td&gt; &lt;td&gt;New York&lt;/td&gt; &lt;td&gt;63&lt;/td&gt; &lt;td&gt;2010/01/04&lt;/td&gt; &lt;td&gt;$125,250&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Zorita Serrano&lt;/td&gt; &lt;td&gt;Software Engineer&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;56&lt;/td&gt; &lt;td&gt;2012/06/01&lt;/td&gt; &lt;td&gt;$115,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Jennifer Acosta&lt;/td&gt; &lt;td&gt;Junior Javascript Developer&lt;/td&gt; &lt;td&gt;Edinburgh&lt;/td&gt; &lt;td&gt;43&lt;/td&gt; &lt;td&gt;2013/02/01&lt;/td&gt; &lt;td&gt;$75,650&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Cara Stevens&lt;/td&gt; &lt;td&gt;Sales Assistant&lt;/td&gt; &lt;td&gt;New York&lt;/td&gt; &lt;td&gt;46&lt;/td&gt; &lt;td&gt;2011/12/06&lt;/td&gt; &lt;td&gt;$145,600&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Hermione Butler&lt;/td&gt; &lt;td&gt;Regional Director&lt;/td&gt; &lt;td&gt;London&lt;/td&gt; &lt;td&gt;47&lt;/td&gt; &lt;td&gt;2011/03/21&lt;/td&gt; &lt;td&gt;$356,250&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Lael Greer&lt;/td&gt; &lt;td&gt;Systems Administrator&lt;/td&gt; &lt;td&gt;London&lt;/td&gt; &lt;td&gt;21&lt;/td&gt; &lt;td&gt;2009/02/27&lt;/td&gt; &lt;td&gt;$103,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Jonas Alexander&lt;/td&gt; &lt;td&gt;Developer&lt;/td&gt; &lt;td&gt;San Francisco&lt;/td&gt; &lt;td&gt;30&lt;/td&gt; &lt;td&gt;2010/07/14&lt;/td&gt; &lt;td&gt;$86,500&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Shad Decker&lt;/td&gt; &lt;td&gt;Regional Director&lt;/td&gt; &lt;td&gt;Edinburgh&lt;/td&gt; &lt;td&gt;51&lt;/td&gt; &lt;td&gt;2008/11/13&lt;/td&gt; &lt;td&gt;$183,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Michael Bruce&lt;/td&gt; &lt;td&gt;Javascript Developer&lt;/td&gt; &lt;td&gt;Singapore&lt;/td&gt; &lt;td&gt;29&lt;/td&gt; &lt;td&gt;2011/06/27&lt;/td&gt; &lt;td&gt;$183,000&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Donna Snider&lt;/td&gt; &lt;td&gt;Customer Support&lt;/td&gt; &lt;td&gt;New York&lt;/td&gt; &lt;td&gt;27&lt;/td&gt; &lt;td&gt;2011/01/25&lt;/td&gt; &lt;td&gt;$112,000&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;</pre> </div> </div> </div> {% include quote.html %} </div> </div><!--/row--> {% include example_script.html %} {% include copyright.html %} <script type="text/javascript"> $(document).ready(function () { $('#example').dataTable({ "paging": false, "ordering": false, "info": false }); }); </script>
{ "pile_set_name": "Github" }
/* * Copyright 2000-2017 JetBrains s.r.o. * * 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 com.intellij.ide.fileTemplates.impl; import com.google.common.annotations.VisibleForTesting; import com.intellij.codeInsight.template.impl.TemplateColors; import com.intellij.ide.IdeBundle; import com.intellij.ide.fileTemplates.FileTemplate; import com.intellij.ide.fileTemplates.FileTemplateManager; import com.intellij.lexer.Lexer; import com.intellij.lexer.MergingLexerAdapter; import consulo.logging.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorFactory; import com.intellij.openapi.editor.EditorSettings; import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.editor.event.DocumentAdapter; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.ex.util.LayerDescriptor; import com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter; import com.intellij.openapi.editor.highlighter.EditorHighlighter; import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory; import com.intellij.openapi.fileTypes.*; import com.intellij.openapi.fileTypes.ex.FileTypeChooser; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.ConfigurationException; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Splitter; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiFileFactory; import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.TokenSet; import com.intellij.testFramework.LightVirtualFile; import com.intellij.ui.BrowserHyperlinkListener; import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.SeparatorFactory; import com.intellij.ui.components.panels.HorizontalLayout; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; import com.intellij.xml.util.XmlStringUtil; import consulo.ui.annotation.RequiredUIAccess; import org.jetbrains.annotations.NonNls; import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.*; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.io.File; import java.io.IOException; import java.net.URL; import java.util.List; /* * @author: MYakovlev * Date: Jul 26, 2002 * Time: 12:46:00 PM */ public class FileTemplateConfigurable implements Configurable, Configurable.NoScroll { private static final Logger LOG = Logger.getInstance(FileTemplateConfigurable.class); @NonNls private static final String EMPTY_HTML = "<html></html>"; private JPanel myMainPanel; private FileTemplate myTemplate; private PsiFile myFile; private Editor myTemplateEditor; private JTextField myNameField; private JTextField myExtensionField; private JCheckBox myAdjustBox; private JCheckBox myLiveTemplateBox; private JPanel myTopPanel; private JEditorPane myDescriptionComponent; private boolean myModified = false; private URL myDefaultDescriptionUrl; private final Project myProject; private final List<ChangeListener> myChangeListeners = ContainerUtil.createLockFreeCopyOnWriteList(); private Splitter mySplitter; private final FileType myVelocityFileType = FileTypeManager.getInstance().getFileTypeByExtension("ft"); private float myProportion = 0.6f; public FileTemplateConfigurable(Project project) { myProject = project; } public FileTemplate getTemplate() { return myTemplate; } public void setTemplate(FileTemplate template, URL defaultDescription) { myDefaultDescriptionUrl = defaultDescription; myTemplate = template; if (myMainPanel != null) { reset(); myNameField.selectAll(); myExtensionField.selectAll(); } } public void setShowInternalMessage(String message) { myTopPanel.removeAll(); if (message == null) { myTopPanel.add(new JLabel(IdeBundle.message("label.name")), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, JBUI.insetsRight(2), 0, 0)); myTopPanel.add(myNameField, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, JBUI.insets(3, 2), 0, 0)); myTopPanel.add(new JLabel(IdeBundle.message("label.extension")), new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, JBUI.insets(0, 2), 0, 0)); myTopPanel.add(myExtensionField, new GridBagConstraints(3, 0, 1, 1, .3, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, JBUI.insetsLeft(2), 0, 0)); myExtensionField.setColumns(7); } myMainPanel.revalidate(); myTopPanel.repaint(); } public void setShowAdjustCheckBox(boolean show) { myAdjustBox.setEnabled(show); } @Override public String getDisplayName() { return IdeBundle.message("title.edit.file.template"); } @Override public String getHelpTopic() { return null; } @RequiredUIAccess @Override public JComponent createComponent() { myMainPanel = new JPanel(new GridBagLayout()); myNameField = new JTextField(); myExtensionField = new JTextField(); mySplitter = new Splitter(true, myProportion); myAdjustBox = new JCheckBox(IdeBundle.message("checkbox.reformat.according.to.style")); myLiveTemplateBox = new JCheckBox(IdeBundle.message("checkbox.enable.live.templates")); myTemplateEditor = createEditor(); myDescriptionComponent = new JEditorPane(); myDescriptionComponent.setEditorKit(UIUtil.getHTMLEditorKit()); myDescriptionComponent.setText(EMPTY_HTML); myDescriptionComponent.setEditable(false); myDescriptionComponent.addHyperlinkListener(new BrowserHyperlinkListener()); myTopPanel = new JPanel(new GridBagLayout()); JPanel descriptionPanel = new JPanel(new GridBagLayout()); descriptionPanel.add(SeparatorFactory.createSeparator(IdeBundle.message("label.description"), null), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, JBUI.insetsBottom(2), 0, 0)); descriptionPanel.add(ScrollPaneFactory.createScrollPane(myDescriptionComponent), new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBUI.insetsTop(2), 0, 0)); myMainPanel.add(myTopPanel, new GridBagConstraints(0, 0, 4, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, JBUI.emptyInsets(), 0, 0)); myMainPanel.add(mySplitter, new GridBagConstraints(0, 2, 4, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBUI.emptyInsets(), 0, 0)); mySplitter.setSecondComponent(descriptionPanel); setShowInternalMessage(null); myNameField.addFocusListener(new FocusAdapter() { @Override public void focusLost(@Nonnull FocusEvent e) { onNameChanged(); } }); myExtensionField.addFocusListener(new FocusAdapter() { @Override public void focusLost(@Nonnull FocusEvent e) { onNameChanged(); } }); myMainPanel.setPreferredSize(JBUI.size(400, 300)); return myMainPanel; } public void setProportion(float proportion) { myProportion = proportion; } private Editor createEditor() { EditorFactory editorFactory = EditorFactory.getInstance(); Document doc = myFile == null ? editorFactory.createDocument(myTemplate == null ? "" : myTemplate.getText()) : PsiDocumentManager.getInstance(myFile.getProject()).getDocument(myFile); assert doc != null; Editor editor = editorFactory.createEditor(doc, myProject); EditorSettings editorSettings = editor.getSettings(); editorSettings.setVirtualSpace(false); editorSettings.setLineMarkerAreaShown(false); editorSettings.setIndentGuidesShown(false); editorSettings.setLineNumbersShown(false); editorSettings.setFoldingOutlineShown(false); editorSettings.setAdditionalColumnsCount(3); editorSettings.setAdditionalLinesCount(3); editorSettings.setCaretRowShown(false); editor.getDocument().addDocumentListener(new DocumentAdapter() { @Override public void documentChanged(DocumentEvent e) { onTextChanged(); } }); ((EditorEx)editor).setHighlighter(createHighlighter()); JPanel topPanel = new JPanel(new BorderLayout()); JPanel southPanel = new JPanel(new HorizontalLayout(40)); southPanel.add(myAdjustBox); southPanel.add(myLiveTemplateBox); topPanel.add(southPanel, BorderLayout.SOUTH); topPanel.add(editor.getComponent(), BorderLayout.CENTER); mySplitter.setFirstComponent(topPanel); return editor; } private void onTextChanged() { myModified = true; } public String getNameValue() { return myNameField.getText(); } private void onNameChanged() { ChangeEvent event = new ChangeEvent(this); for (ChangeListener changeListener : myChangeListeners) { changeListener.stateChanged(event); } } public void addChangeListener(ChangeListener listener) { if (!myChangeListeners.contains(listener)) { myChangeListeners.add(listener); } } public void removeChangeListener(ChangeListener listener) { myChangeListeners.remove(listener); } @RequiredUIAccess @Override public boolean isModified() { if (myModified) { return true; } String name = (myTemplate == null) ? "" : myTemplate.getName(); String extension = (myTemplate == null) ? "" : myTemplate.getExtension(); if (!Comparing.equal(name, myNameField.getText())) { return true; } if (!Comparing.equal(extension, myExtensionField.getText())) { return true; } if (myTemplate != null) { if (myTemplate.isReformatCode() != myAdjustBox.isSelected() || myTemplate.isLiveTemplateEnabled() != myLiveTemplateBox.isSelected()) { return true; } } return false; } @RequiredUIAccess @Override public void apply() throws ConfigurationException { if (myTemplate != null) { myTemplate.setText(myTemplateEditor.getDocument().getText()); String name = myNameField.getText(); String extension = myExtensionField.getText(); String filename = name + "." + extension; if (name.length() == 0 || !isValidFilename(filename)) { throw new ConfigurationException(IdeBundle.message("error.invalid.template.file.name.or.extension")); } FileType fileType = FileTypeManager.getInstance().getFileTypeByFileName(filename); if (fileType == UnknownFileType.INSTANCE) { FileTypeChooser.associateFileType(filename); } myTemplate.setName(name); myTemplate.setExtension(extension); myTemplate.setReformatCode(myAdjustBox.isSelected()); myTemplate.setLiveTemplateEnabled(myLiveTemplateBox.isSelected()); } myModified = false; } // TODO: needs to be generalized someday for other profiles private static boolean isValidFilename(final String filename) { if ( filename.contains("/") || filename.contains("\\") || filename.contains(":") ) { return false; } final File tempFile = new File (FileUtil.getTempDirectory() + File.separator + filename); return FileUtil.ensureCanCreateFile(tempFile); } @RequiredUIAccess @Override public void reset() { final String text = (myTemplate == null) ? "" : myTemplate.getText(); String name = (myTemplate == null) ? "" : myTemplate.getName(); String extension = (myTemplate == null) ? "" : myTemplate.getExtension(); String description = (myTemplate == null) ? "" : myTemplate.getDescription(); if ((description.length() == 0) && (myDefaultDescriptionUrl != null)) { try { description = UrlUtil.loadText(myDefaultDescriptionUrl); } catch (IOException e) { LOG.error(e); } } EditorFactory.getInstance().releaseEditor(myTemplateEditor); myFile = createFile(text, name); myTemplateEditor = createEditor(); myNameField.setText(name); myExtensionField.setText(extension); myAdjustBox.setSelected(myTemplate != null && myTemplate.isReformatCode()); myLiveTemplateBox.setSelected(myTemplate != null && myTemplate.isLiveTemplateEnabled()); int i = description.indexOf("<html>"); if (i > 0) { description = description.substring(i); } description = XmlStringUtil.stripHtml(description); description = description.replace("\n", "").replace("\r", ""); description = XmlStringUtil.stripHtml(description); description = description + "<hr> <font face=\"verdana\" size=\"-1\"><a href='http://velocity.apache.org/engine/devel/user-guide.html#Velocity_Template_Language_VTL:_An_Introduction'>\n" + "Apache Velocity</a> template language is used</font>"; myDescriptionComponent.setText(description); myDescriptionComponent.setCaretPosition(0); myNameField.setEditable((myTemplate != null) && (!myTemplate.isDefault())); myExtensionField.setEditable((myTemplate != null) && (!myTemplate.isDefault())); myModified = false; } @Nullable private PsiFile createFile(final String text, final String name) { if (myTemplate == null) return null; final FileType fileType = myVelocityFileType; if (fileType == UnknownFileType.INSTANCE) return null; final PsiFile file = PsiFileFactory.getInstance(myProject).createFileFromText(name + ".txt.ft", fileType, text, 0, true); file.getViewProvider().putUserData(FileTemplateManager.DEFAULT_TEMPLATE_PROPERTIES, FileTemplateManager.getInstance(myProject).getDefaultProperties()); return file; } @RequiredUIAccess @Override public void disposeUIResources() { myMainPanel = null; if (myTemplateEditor != null) { EditorFactory.getInstance().releaseEditor(myTemplateEditor); myTemplateEditor = null; } myFile = null; } private EditorHighlighter createHighlighter() { if (myTemplate != null && myVelocityFileType != UnknownFileType.INSTANCE) { return EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, new LightVirtualFile("aaa." + myTemplate.getExtension() + ".ft")); } FileType fileType = null; if (myTemplate != null) { fileType = FileTypeManager.getInstance().getFileTypeByExtension(myTemplate.getExtension()); } if (fileType == null) { fileType = PlainTextFileType.INSTANCE; } SyntaxHighlighter originalHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, null, null); if (originalHighlighter == null) { originalHighlighter = new PlainSyntaxHighlighter(); } final EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); LayeredLexerEditorHighlighter highlighter = new LayeredLexerEditorHighlighter(new TemplateHighlighter(), scheme); highlighter.registerLayer(FileTemplateTokenType.TEXT, new LayerDescriptor(originalHighlighter, "")); return highlighter; } private static class TemplateHighlighter extends SyntaxHighlighterBase { private final Lexer myLexer; public TemplateHighlighter() { myLexer = createDefaultLexer(); } @Nonnull @Override public Lexer getHighlightingLexer() { return myLexer; } @Override @Nonnull public TextAttributesKey[] getTokenHighlights(IElementType tokenType) { if (tokenType == FileTemplateTokenType.MACRO || tokenType == FileTemplateTokenType.DIRECTIVE) { return pack(TemplateColors.TEMPLATE_VARIABLE_ATTRIBUTES); } return EMPTY; } } @Nonnull @VisibleForTesting static Lexer createDefaultLexer() { return new MergingLexerAdapter(new FileTemplateTextLexer(), TokenSet.create(FileTemplateTokenType.TEXT)); } public void focusToNameField() { myNameField.selectAll(); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> { IdeFocusManager.getGlobalInstance().requestFocus(myNameField, true); }); } public void focusToExtensionField() { myExtensionField.selectAll(); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> { IdeFocusManager.getGlobalInstance().requestFocus(myExtensionField, true); }); } }
{ "pile_set_name": "Github" }
{"id":1234, "foo":"My dog", "blah":"has fleas", "ymd": 20190101} {"id":4567, "foo":"Mary had a little lamb","blah":"whose fleece was white as snow", "ymd": 20190101}
{ "pile_set_name": "Github" }
/*********************************************************************** * * Copyright (c) 2012-2020 Barbara Geller * Copyright (c) 2012-2020 Ansel Sermersheim * * Copyright (c) 2015 The Qt Company Ltd. * Copyright (c) 2012-2016 Digia Plc and/or its subsidiary(-ies). * Copyright (c) 2008-2012 Nokia Corporation and/or its subsidiary(-ies). * * This file is part of CopperSpice. * * CopperSpice 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. * * CopperSpice 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. * * https://www.gnu.org/licenses/ * ***********************************************************************/ #include "qabstractfloat_p.h" #include "qanyuri_p.h" #include "qboolean_p.h" #include "qbuiltintypes_p.h" #include "qcommonnamespaces_p.h" #include "qcommonvalues_p.h" #include "qliteral_p.h" #include "qatomicstring_p.h" #include "qnodefns_p.h" QT_BEGIN_NAMESPACE using namespace QPatternist; Item NameFN::evaluateSingleton(const DynamicContext::Ptr &context) const { const Item node(m_operands.first()->evaluateSingleton(context)); if (node) { const QXmlName name(node.asNode().name()); if (name.isNull()) { return CommonValues::EmptyString; } else { return AtomicString::fromValue(context->namePool()->toLexical(name)); } } else { return CommonValues::EmptyString; } } Item LocalNameFN::evaluateSingleton(const DynamicContext::Ptr &context) const { const Item node(m_operands.first()->evaluateSingleton(context)); if (node) { const QXmlName name(node.asNode().name()); if (name.isNull()) { return CommonValues::EmptyString; } else { return AtomicString::fromValue(context->namePool()->stringForLocalName(name.localName())); } } else { return CommonValues::EmptyString; } } Item NamespaceURIFN::evaluateSingleton(const DynamicContext::Ptr &context) const { const Item node(m_operands.first()->evaluateSingleton(context)); if (node) { const QXmlName name(node.asNode().name()); if (name.isNull()) { return CommonValues::EmptyAnyURI; } else { return toItem(AnyURI::fromValue(context->namePool()->stringForNamespace(name.namespaceURI()))); } } else { return CommonValues::EmptyAnyURI; } } Item NumberFN::evaluateSingleton(const DynamicContext::Ptr &context) const { const Item item(m_operands.first()->evaluateSingleton(context)); if (!item) { return CommonValues::DoubleNaN; } const Item val(cast(item, context)); Q_ASSERT(val); if (val.as<AtomicValue>()->hasError()) { return CommonValues::DoubleNaN; } else { return val; } } Expression::Ptr NumberFN::typeCheck(const StaticContext::Ptr &context, const SequenceType::Ptr &reqType) { const Expression::Ptr me(FunctionCall::typeCheck(context, reqType)); const ItemType::Ptr sourceType(m_operands.first()->staticType()->itemType()); if (BuiltinTypes::xsDouble->xdtTypeMatches(sourceType)) { /* The operand is already xs:double, no need for fn:number(). */ return m_operands.first()->typeCheck(context, reqType); } else if (prepareCasting(context, sourceType)) { return me; } else { /* Casting to xs:double will never succeed and we would always return NaN.*/ return wrapLiteral(CommonValues::DoubleNaN, context, this)->typeCheck(context, reqType); } } bool LangFN::isLangMatch(const QString &candidate, const QString &toMatch) { if (QString::compare(candidate, toMatch, Qt::CaseInsensitive) == 0) { return true; } return candidate.startsWith(toMatch, Qt::CaseInsensitive) && candidate.length() > toMatch.length() && candidate.at(toMatch.length()) == QLatin1Char('-'); } Item LangFN::evaluateSingleton(const DynamicContext::Ptr &context) const { const Item langArg(m_operands.first()->evaluateSingleton(context)); const QString lang(langArg ? langArg.stringValue() : QString()); const QXmlName xmlLang(StandardNamespaces::xml, StandardLocalNames::lang, StandardPrefixes::xml); const QXmlNodeModelIndex langNode(m_operands.at(1)->evaluateSingleton(context).asNode()); const QXmlNodeModelIndex::Iterator::Ptr ancestors(langNode.iterate(QXmlNodeModelIndex::AxisAncestorOrSelf)); QXmlNodeModelIndex ancestor(ancestors->next()); while (!ancestor.isNull()) { const QXmlNodeModelIndex::Iterator::Ptr attributes(ancestor.iterate(QXmlNodeModelIndex::AxisAttribute)); QXmlNodeModelIndex attribute(attributes->next()); while (!attribute.isNull()) { Q_ASSERT(attribute.kind() == QXmlNodeModelIndex::Attribute); if (attribute.name() == xmlLang) { if (isLangMatch(attribute.stringValue(), lang)) { return CommonValues::BooleanTrue; } else { return CommonValues::BooleanFalse; } } attribute = attributes->next(); } ancestor = ancestors->next(); } return CommonValues::BooleanFalse; } Item RootFN::evaluateSingleton(const DynamicContext::Ptr &context) const { const Item arg(m_operands.first()->evaluateSingleton(context)); if (arg) { return arg.asNode().root(); } else { return Item(); } } SequenceType::Ptr RootFN::staticType() const { if (m_operands.isEmpty()) { return makeGenericSequenceType(BuiltinTypes::node, Cardinality::exactlyOne()); } else { return makeGenericSequenceType(BuiltinTypes::node, m_operands.first()->staticType()->cardinality().toWithoutMany()); } } QT_END_NAMESPACE
{ "pile_set_name": "Github" }
;***************************************************************************** ;* SIMD-optimized pixel operations ;***************************************************************************** ;* Copyright (c) 2000, 2001 Fabrice Bellard ;* Copyright (c) 2002-2004 Michael Niedermayer <[email protected]> ;* ;* This file is part of FFmpeg. ;* ;* FFmpeg 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. ;* ;* FFmpeg 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 FFmpeg; if not, write to the Free Software ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;***************************************************************************** %include "libavutil/x86/x86util.asm" SECTION .text INIT_MMX mmx ; void ff_get_pixels_mmx(int16_t *block, const uint8_t *pixels, ptrdiff_t stride) cglobal get_pixels, 3,4 add r0, 128 mov r3, -128 pxor m7, m7 .loop: mova m0, [r1] mova m2, [r1+r2] mova m1, m0 mova m3, m2 punpcklbw m0, m7 punpckhbw m1, m7 punpcklbw m2, m7 punpckhbw m3, m7 mova [r0+r3+ 0], m0 mova [r0+r3+ 8], m1 mova [r0+r3+16], m2 mova [r0+r3+24], m3 lea r1, [r1+r2*2] add r3, 32 js .loop REP_RET INIT_XMM sse2 cglobal get_pixels, 3, 4, 5 lea r3, [r2*3] pxor m4, m4 movh m0, [r1] movh m1, [r1+r2] movh m2, [r1+r2*2] movh m3, [r1+r3] lea r1, [r1+r2*4] punpcklbw m0, m4 punpcklbw m1, m4 punpcklbw m2, m4 punpcklbw m3, m4 mova [r0], m0 mova [r0+0x10], m1 mova [r0+0x20], m2 mova [r0+0x30], m3 movh m0, [r1] movh m1, [r1+r2*1] movh m2, [r1+r2*2] movh m3, [r1+r3] punpcklbw m0, m4 punpcklbw m1, m4 punpcklbw m2, m4 punpcklbw m3, m4 mova [r0+0x40], m0 mova [r0+0x50], m1 mova [r0+0x60], m2 mova [r0+0x70], m3 RET ; void ff_diff_pixels_mmx(int16_t *block, const uint8_t *s1, const uint8_t *s2, ; ptrdiff_t stride); %macro DIFF_PIXELS 0 cglobal diff_pixels, 4,5,5 pxor m4, m4 add r0, 128 mov r4, -128 .loop: movq m0, [r1] movq m2, [r2] %if mmsize == 8 movq m1, m0 movq m3, m2 punpcklbw m0, m4 punpckhbw m1, m4 punpcklbw m2, m4 punpckhbw m3, m4 %else movq m1, [r1+r3] movq m3, [r2+r3] punpcklbw m0, m4 punpcklbw m1, m4 punpcklbw m2, m4 punpcklbw m3, m4 %endif psubw m0, m2 psubw m1, m3 mova [r0+r4+0], m0 mova [r0+r4+mmsize], m1 %if mmsize == 8 add r1, r3 add r2, r3 %else lea r1, [r1+r3*2] lea r2, [r2+r3*2] %endif add r4, 2 * mmsize jne .loop RET %endmacro INIT_MMX mmx DIFF_PIXELS INIT_XMM sse2 DIFF_PIXELS
{ "pile_set_name": "Github" }
n_node 37 0 1 26 1.948881e+05 8.960405e+04 ((!LIQUID 1)) 1 2 9 4.487697e+04 6.217272e+04 ((ALVELR 1 WGLIDE -1)(ALVELR 1 !WGLIDE -1 NASAL 1)(!WGLIDE -1 !S/SH 1 ALVFRIC 1)) 2 3 8 3.270459e+04 2.864756e+04 ((!LW -1)) 3 4 5 1.352846e+04 1.784211e+04 ((FRIC3 1 ALVSTP -1)) 4 - - 1.745460e+04 9.237384e+02 5 6 7 1.192934e+04 1.691838e+04 ((ORSTP2 -1 !WDBNDRY_B 0)) 6 - - 0.000000e+00 1.530396e+03 7 - - 0.000000e+00 1.538798e+04 8 - - 0.000000e+00 1.080545e+04 9 10 23 2.633754e+04 3.352514e+04 ((!DELSTP 1)) 10 11 20 1.617830e+04 2.555296e+04 ((S/SH 1 WGLIDE -1)(!S/Z/SH/ZH 1)) 11 12 17 1.165423e+04 1.821810e+04 ((!LABSTP 1 NASAL 1)(!LABSTP 1 !NASAL 1 !VELSTP 1)) 12 13 14 1.065539e+04 8.922084e+03 ((VELSTP 1 LIQUID -1)) 13 - - 4.537334e+03 4.395575e+02 14 15 16 7.616736e+03 8.482526e+03 ((!PALATL 1 !SIL 1 RETRO -1)(!RETRO -1 ALVELR 1)) 15 - - 0.000000e+00 5.928022e+03 16 - - 0.000000e+00 2.554503e+03 17 18 19 8.334531e+03 9.296010e+03 ((LABSTP 1)) 18 - - 0.000000e+00 3.729837e+03 19 - - 0.000000e+00 5.566175e+03 20 21 22 7.317808e+03 7.334861e+03 ((!S/SH 1)) 21 - - 5.572205e+03 4.962266e+02 22 - - 0.000000e+00 6.838635e+03 23 24 25 7.591694e+03 7.972188e+03 ((!WDBNDRY_E 0 YGLIDE -1)(VELSTP -1 !WDBNDRY_B 0)) 24 - - 0.000000e+00 3.594753e+03 25 - - 0.000000e+00 4.377435e+03 26 27 30 4.602190e+04 2.743133e+04 ((LW 1)(!LW 1 SIL -1)) 27 28 29 1.298274e+04 5.111280e+03 ((!LW 1)) 28 - - -1.883746e+03 5.819769e+02 29 - - 0.000000e+00 4.529303e+03 30 31 36 3.312751e+04 2.232005e+04 ((!NASAL -1)) 31 32 35 1.975724e+04 1.102349e+04 ((!VELSTP -1)) 32 33 34 7.932130e+03 6.728364e+03 ((LABSTP -1)(ASPSEG -1)(WGLIDE -1)) 33 - - 0.000000e+00 2.721955e+03 34 - - 0.000000e+00 4.006409e+03 35 - - 0.000000e+00 4.295126e+03 36 - - 0.000000e+00 1.129655e+04
{ "pile_set_name": "Github" }
/* * Copyright (C) 2008 The Android Open Source Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _SYS_STAT_H_ #define _SYS_STAT_H_ #include <sys/cdefs.h> #include <sys/types.h> #include <sys/time.h> #include <linux/stat.h> #include <endian.h> __BEGIN_DECLS #if defined(__aarch64__) || (defined(__mips__) && defined(__LP64__)) #define __STAT64_BODY \ unsigned long st_dev; \ unsigned long st_ino; \ unsigned int st_mode; \ unsigned int st_nlink; \ uid_t st_uid; \ gid_t st_gid; \ unsigned long st_rdev; \ unsigned long __pad1; \ long st_size; \ int st_blksize; \ int __pad2; \ long st_blocks; \ long st_atime; \ unsigned long st_atime_nsec; \ long st_mtime; \ unsigned long st_mtime_nsec; \ long st_ctime; \ unsigned long st_ctime_nsec; \ unsigned int __unused4; \ unsigned int __unused5; \ #elif defined(__mips__) && !defined(__LP64__) #define __STAT64_BODY \ unsigned int st_dev; \ unsigned int __pad0[3]; \ unsigned long long st_ino; \ unsigned int st_mode; \ unsigned int st_nlink; \ uid_t st_uid; \ gid_t st_gid; \ unsigned int st_rdev; \ unsigned int __pad1[3]; \ long long st_size; \ unsigned int st_atime; \ unsigned int st_atime_nsec; \ unsigned int st_mtime; \ unsigned int st_mtime_nsec; \ unsigned int st_ctime; \ unsigned int st_ctime_nsec; \ unsigned int st_blksize; \ unsigned int __pad2; \ unsigned long long st_blocks; \ #elif defined(__x86_64__) #define __STAT64_BODY \ unsigned long st_dev; \ unsigned long st_ino; \ unsigned long st_nlink; \ unsigned int st_mode; \ uid_t st_uid; \ gid_t st_gid; \ unsigned int __pad0; \ unsigned long st_rdev; \ long st_size; \ long st_blksize; \ long st_blocks; \ unsigned long st_atime; \ unsigned long st_atime_nsec; \ unsigned long st_mtime; \ unsigned long st_mtime_nsec; \ unsigned long st_ctime; \ unsigned long st_ctime_nsec; \ long __pad3[3]; \ #else #define __STAT64_BODY \ unsigned long long st_dev; \ unsigned char __pad0[4]; \ unsigned long __st_ino; \ unsigned int st_mode; \ unsigned int st_nlink; \ uid_t st_uid; \ gid_t st_gid; \ unsigned long long st_rdev; \ unsigned char __pad3[4]; \ long long st_size; \ unsigned long st_blksize; \ unsigned long long st_blocks; \ unsigned long st_atime; \ unsigned long st_atime_nsec; \ unsigned long st_mtime; \ unsigned long st_mtime_nsec; \ unsigned long st_ctime; \ unsigned long st_ctime_nsec; \ unsigned long long st_ino; \ #endif struct stat { __STAT64_BODY }; struct stat64 { __STAT64_BODY }; #undef __STAT64_BODY #define st_atimensec st_atime_nsec #define st_mtimensec st_mtime_nsec #define st_ctimensec st_ctime_nsec #ifdef __USE_BSD /* Permission macros provided by glibc for compatibility with BSDs. */ #define ACCESSPERMS (S_IRWXU | S_IRWXG | S_IRWXO) /* 0777 */ #define ALLPERMS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) /* 07777 */ #define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) /* 0666 */ #endif extern int chmod(const char*, mode_t); extern int fchmod(int, mode_t); extern int mkdir(const char*, mode_t); extern int fstat(int, struct stat*); extern int fstat64(int, struct stat64*); extern int fstatat(int, const char*, struct stat*, int); extern int fstatat64(int, const char*, struct stat64*, int); extern int lstat(const char*, struct stat*); extern int lstat64(const char*, struct stat64*); extern int stat(const char*, struct stat*); extern int stat64(const char*, struct stat64*); extern int mknod(const char*, mode_t, dev_t); extern mode_t umask(mode_t); #if defined(__BIONIC_FORTIFY) extern mode_t __umask_chk(mode_t); extern mode_t __umask_real(mode_t) __asm__(__USER_LABEL_PREFIX__ "umask"); __errordecl(__umask_invalid_mode, "umask called with invalid mode"); __BIONIC_FORTIFY_INLINE mode_t umask(mode_t mode) { #if !defined(__clang__) if (__builtin_constant_p(mode)) { if ((mode & 0777) != mode) { __umask_invalid_mode(); } return __umask_real(mode); } #endif return __umask_chk(mode); } #endif /* defined(__BIONIC_FORTIFY) */ extern int mkfifo(const char*, mode_t); extern int fchmodat(int, const char*, mode_t, int); extern int mkdirat(int, const char*, mode_t); extern int mknodat(int, const char*, mode_t, dev_t); #define UTIME_NOW ((1L << 30) - 1L) #define UTIME_OMIT ((1L << 30) - 2L) extern int utimensat(int fd, const char *path, const struct timespec times[2], int flags); extern int futimens(int fd, const struct timespec times[2]); __END_DECLS #endif /* _SYS_STAT_H_ */
{ "pile_set_name": "Github" }
define([ 'backbone', 'logger', 'app/modules/Activity/models/ActivityModel', 'app/modules/Activity/models/ActivityTree' ], function(Backbone, logger, ActivityModel, ActivityTree) { var ActivityCollection = Backbone.Collection.extend({ model: ActivityModel, findByEventId: function(eventId) { return this.find(function(activity) { return activity.get('eventId') === eventId; }); }, filterByContextCid: function(cid) { return this.filter(function(activity) { return activity.get('context').cid == cid; }); }, filterByActionId: function(actionId) { return this.filter(function(activity) { return activity.get('actionId') === actionId; }); }, buildTree: function() { var tree = new ActivityTree(this); return tree.buildTree(); }, // Build entire tree and then prune using a depth-first (preorder) traversal. This allows for // leaves to be cleaned up first, then parents. The root will never be pruned. // arg filter {function} // arg node {object} // nid // nidPath // name // event // nodes // return truthy if node should remain in the tree buildTreePruned: function (filter) { var tree = this.buildTree(); ActivityCollection.pruneTree(tree, filter); return tree; }, }, { // Prune a tree in-place using a depth-first (preorder) traversal. This allows for leaves to // be cleaned up first, then parents. The root will never be pruned. // arg tree {object} Tree node // nid // nidPath // name // event // nodes // arg filter {function} // arg node {object} Tree node // return truthy if node should remain in the tree pruneTree: function (tree, filter) { // Prune my children _.each(tree.nodes, function (node, idx, nodes) { // Visit child first (depth-first) ActivityCollection.pruneTree(node, filter); if (!filter(node)) { // Use soft delete to avoid corrupting iterator nodes[idx] = undefined; } }); // Prevent sparse arrays (this may not be necessary) tree.nodes = _.compact(tree.nodes); } }); return ActivityCollection; });
{ "pile_set_name": "Github" }
.CodeMirror-search-match { background: gold; border-top: 1px solid orange; border-bottom: 1px solid orange; -moz-box-sizing: border-box; box-sizing: border-box; opacity: .5; }
{ "pile_set_name": "Github" }
<?php function hostxrd_init(&$a) { header('Access-Control-Allow-Origin: *'); header("Content-type: text/xml"); $tpl = get_markup_template('xrd_host.tpl'); $x = replace_macros(get_markup_template('xrd_host.tpl'), array( '$zhost' => $a->get_hostname(), '$zroot' => z_root() )); $arr = array('xrd' => $x); call_hooks('hostxrd',$arr); echo $arr['xrd']; killme(); }
{ "pile_set_name": "Github" }
# Copyright 2017-2020 TensorHub, Inc. # # 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. from __future__ import absolute_import from __future__ import division import click from guild import click_util @click.command("list, ls") @click.argument("terms", metavar="[TERM]...", nargs=-1) @click.option("-a", "--all", help="Show all installed Python packages.", is_flag=True) @click_util.use_args def list_packages(args): """List installed packages. Specify one or more `TERM` arguments to show packages matching any of the specified values. """ from . import packages_impl packages_impl.list_packages(args)
{ "pile_set_name": "Github" }
/* * Copyright (C) 2006 Apple Inc. All rights reserved. * Copyright (C) 2008 Alp Toker <[email protected]> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef JavaScript_h #define JavaScript_h #include <JavaScriptCore/JSBase.h> #include <JavaScriptCore/JSContextRef.h> #include <JavaScriptCore/JSStringRef.h> #include <JavaScriptCore/JSObjectRef.h> #include <JavaScriptCore/JSTypedArray.h> #include <JavaScriptCore/JSValueRef.h> #endif /* JavaScript_h */
{ "pile_set_name": "Github" }
// // WebViewDelegate.m // LocalRadio // // Created by Douglas Ward on 7/15/17. // Copyright © 2017-2020 ArkPhone LLC. All rights reserved. // #import "WebViewDelegate.h" #import "AppDelegate.h" @implementation WebViewDelegate - (void)loadMainPage { [self performSelectorOnMainThread:@selector(loadMainPageOnMainThread) withObject:NULL waitUntilDone:NO]; } -( void)loadMainPageOnMainThread { if (self.webView == NULL) { NSRect webViewFrame = self.webViewParentView.bounds; self.webView = [[WKWebView alloc] initWithFrame:webViewFrame]; [self.webViewParentView addSubview:self.webView]; self.webView.UIDelegate = self; self.webView.navigationDelegate = self; self.webView.customUserAgent = @"LocalRadio/1.0"; NSString * urlString = [self.appDelegate httpWebServerControllerURLString]; NSURL * url = [NSURL URLWithString:urlString]; NSURLRequest * urlRequest = [NSURLRequest requestWithURL:url]; [self.webView loadRequest:urlRequest]; } } - (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler { [self.appDelegate showInformationSheetWithMessage:@"LocalRadio" informativeText:message]; completionHandler(); } - (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL result))completionHandler { // this delegate method is called via JavaScript's confirm() function in localradio.js when a frequency or category record deletion is requested NSString * informativeText = @"Click OK button to delete the record."; NSAlert * alert = [[NSAlert alloc] init]; [alert setMessageText:message]; [alert setInformativeText:informativeText]; [alert addButtonWithTitle:@"OK"]; [alert addButtonWithTitle:@"Cancel"]; [alert setAlertStyle:NSAlertStyleWarning]; [alert beginSheetModalForWindow:self.webViewWindow completionHandler:^(NSModalResponse returnCode) { // return NSAlertFirstButtonReturn for OK button or // NSAlertSecondButtonReturn for Cancel button [[NSApplication sharedApplication] stopModalWithCode:returnCode]; BOOL result = NO; if (returnCode == NSAlertFirstButtonReturn) { result = YES; } completionHandler(result); }]; [NSApp runModalForWindow:self.webViewWindow]; } @end
{ "pile_set_name": "Github" }
package de.mukis import java.util.concurrent.{ Executors, TimeUnit } import java.nio.file.Files import java.nio.file.StandardOpenOption._ import java.nio.charset.Charset object MainApp extends App { println("Hello, World: " + args.mkString(" ")) }
{ "pile_set_name": "Github" }
/** * Copyright (C) 2011-2015 The XDocReport Team <[email protected]> * * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package fr.opensagres.xdocreport.document.docx; import fr.opensagres.xdocreport.converter.MimeMapping; /** * MS Word DOCX constants. */ public class DocxConstants { public static final String WORD_REGEXP = "word*"; public static final String WORD_DOCUMENT_XML_ENTRY = "word/document.xml"; public static final String WORD_STYLES_XML_ENTRY = "word/styles.xml"; public static final String WORD_HEADER_XML_ENTRY = "word/header*.xml"; public static final String WORD_FOOTER_XML_ENTRY = "word/footer*.xml"; public static final String CONTENT_TYPES_XML_ENTRY = "[Content_Types].xml"; public static final String WORD_RELS_XMLRELS_XML_ENTRY = "word/_rels/*.xml.rels"; public static final String WORD_FOOTNOTES_XML_ENTRY = "word/footnotes.xml"; public static final String WORD_ENDNOTES_XML_ENTRY = "word/endnotes.xml"; public static final String WORD_NUMBERING_XML_ENTRY = "word/numbering.xml"; public static final String W_NS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; public static final String WP_NS = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"; public static final String A_NS = "http://schemas.openxmlformats.org/drawingml/2006/main"; public static final String R_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"; public static final String RELATIONSHIPS_IMAGE_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"; public static final String RELATIONSHIPS_HYPERLINK_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"; public static final String RELATIONSHIPS_NUMBERING_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"; // Table element public static final String TBL_ELT = "tbl"; // Row element public static final String TR_ELT = "tr"; public static final String T_ELT = "t"; // w:r element public static final String R_ELT = "r"; // w:p element public static final String P_ELT = "p"; // Merge field fldSimple public static final String FLDSIMPLE_ELT = "fldSimple"; public static final String INSTR_ATTR = "instr"; // Merge field instrText public static final String INSTR_TEXT_ELT = "instrText"; // w:fldChar public static final String FLDCHAR_ELT = "fldChar"; public static final String FLDCHARTYPE_ATTR = "fldCharType"; // Bookmark public static final String BOOKMARK_START_ELT = "bookmarkStart"; public static final String BOOKMARK_END_ELT = "bookmarkEnd"; // blip public static final String BLIP_ELT = "blip"; public static final String EMBED_ATTR = "embed"; public static final String EXTENT_ELT = "extent"; public static final String EXT_ELT = "ext"; public static final String CX_ATTR = "cx"; public static final String CY_ATTR = "cy"; public static final String DRAWING_ELT = "drawing"; // hyperlink public static final String HYPERLINK_ELT = "hyperlink"; public static final String RFONTS_ELT = "rFonts"; public static final String ABSTRACT_NUM_ELT = "abstractNum"; public static final String ABSTRACT_NUM_ID_ELT = "abstractNumId"; public static final String NUMBERING_ELT = "numbering"; public static final String NUM_FMT_ELT = "numFmt"; public static final String NUM_ELT = "num"; public static final String ID_ATTR = "id"; public static final String TYPE_ATTR = "type"; public static final String FOOTNOTE_ELT = "footnote"; public static final String FOOTNOTE_REFERENCE_ELT = "footnoteReference"; public static final String ENDNOTE_ELT = "endnote"; public static final String ENDNOTE_REFERENCE_ELT = "endnoteReference"; // [Content_Types].xml public static final String CONTENT_TYPES_XML = "[Content_Types].xml"; public static final String WORDPROCESSINGML_DOCUMENT = "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"; public static final String DOCX_EXTENSION = "docx"; public static final String NAME_ATTR = "name"; // word/_rels/document.xml.rels public static final String RELATIONSHIPS_ELT = "Relationships"; public static final String RELATIONSHIP_ELT = "Relationship"; public static final String RELATIONSHIP_ID_ATTR = "Id"; public static final String RELATIONSHIP_TYPE_ATTR = "Type"; public static final String RELATIONSHIP_TARGET_ATTR = "Target"; public static final String RELATIONSHIP_TARGET_MODE_ATTR = "TargetMode"; public static final String TARGET_MODE_EXTERNAL = "External"; // Mime mapping public static final MimeMapping MIME_MAPPING = new MimeMapping( DOCX_EXTENSION, WORDPROCESSINGML_DOCUMENT ); // Meta data for discovery public static final String ID_DISCOVERY = "docx"; public static final String DESCRIPTION_DISCOVERY = "Manage Microsoft Office docx document."; }
{ "pile_set_name": "Github" }
//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // <strstream> // class strstreambuf // streambuf* setbuf(char* s, streamsize n); #include <strstream> #include <cassert> int main() { { char buf[] = "0123456789"; std::strstreambuf sb(buf, 0); assert(sb.pubsetbuf(0, 0) == &sb); assert(sb.str() == std::string("0123456789")); } }
{ "pile_set_name": "Github" }
#include <iostream> #include <fstream> #include <iomanip> #include <cstdlib> #include <string> #include <sstream> #include <cassert> struct R2 { double x,y; }; typedef int Tab[1000]; typedef Tab TTab[100]; typedef R2 TR2[1000]; using namespace std; int dump(int l,int *t, ostream & cc=cout) { cc.precision(20); cc << " { " ; for (int i=0;i<l;i++) { cc << t[i] << " " << ( i < l-1 ? ',' : '}' ); } return 0; } int dump2(int l,Tab lx,Tab ly,int k, ostream & cc=cout) { cc << " { " ; for (int i=0;i<l;i++) { cc << " \t R2( " << lx[i] << "/" << k << ". , " << ly[i] << "/" << k << ". ) " << ( i < l-1 ? ',' : '}' ) << " \n"; } return 0; } int dump(int l,int ll,TTab t, ostream & cc=cout) { cc << " { \n" ; for (int i=0;i<l;i++) { cc << "\t\t"; dump(ll, t[i], cc); cc << " " << ( i < l-1 ? ',' : '}' ) << endl; } return 0; } int f(int k,int *nn, int * aa, int l0,int l1,int l2) { int L[3]={l0,l1,l2}; int i=1; for (int j=0;j<k;j++) { i*=(L[nn[j]]-aa[j]); cout << L[nn[j]] << " - " << aa[j] << " = " << (L[nn[j]]-aa[j]) << "; "; } return i; } int main(int argc,const char ** argv) { if(argc<2) return 1; int k=atoi(argv[1]); const char * prefix=""; if(argc>2) prefix=argv[2]; int i=0; Tab num,num1,cc,ff; Tab il,jl,kl; TR2 Pt; // fonction_i = $\Pi_{j=0,k-1} (\Lambda_{nn[i][j]} - aa[i][j]) $ TTab aa,nn; ostream * cf = 0; ofstream * ccf=0; if(argc>3) cf = ccf = new ofstream(argv[3]); string s[1000]; int e0=2; int e1=e0+k-1; int e2=e1+k-1; int t =e2+k; ostringstream si; for (int ii=0;ii<=k;ii++) { int cc=1; ostringstream sj; for (int jj=0;jj+ii<=k;jj++) { ostringstream sk; for(int kk=0;ii+jj+kk<k;kk++) sk << "*(L2-"<< kk << ")"; int kk = k-ii-jj; int l; if ( ii==k ) l=0; else if ( jj==k ) l=1; else if ( kk==k ) l=2; else if ( ii==0 ) l=e0+kk; else if ( jj==0 ) l=e1+ii; else if ( kk==0 ) l=e2+jj; else l=t++; num1[l]=100*ii+10*jj+kk; num[l]=i++; il[l]=ii; jl[l]=jj; kl[l]=kk; Pt[l].x= (double) jj/k; Pt[l].y= (double) kk/k; s[l]=si.str()+sj.str()+sk.str(); sj << "*(L1-"<< jj << ")"; // l=i-1; { int i=0; for (int j=0;j<ii;j++) aa[l][i]=j,nn[l][i++]=0; for (int j=0;j<jj;j++) aa[l][i]=j,nn[l][i++]=1; for (int j=0;j<kk;j++) aa[l][i]=j,nn[l][i++]=2; assert(i==k); } } si << "*(L0-"<< ii << ")"; } cout << i << endl; for (int l=0;l<i;l++) { ff[l]=f(k,nn[l],aa[l],il[l],jl[l],kl[l]); cout << il[l] << " " << jl[l] << " " << kl[l] << " : " ; for(int j=0;j<k;j++) cout << "( L_" << nn[l][j]<< " - " << aa[l][j] << " ) "; cout << "/ " << ff[l] << endl; } for (int l=0;l<i;l++) cout << setw(3) << num1[l] << " -> " << num[l] << " " << s[l] << endl; for (int l=0;l<i;l++) cout << num[l] << ", "; cout << endl; if(cf ==0) cf = & cout; *cf << prefix <<"nn[" << i << "][" << k << "] = " ; dump(i,k,nn,*cf); *cf << ";\n"; *cf << prefix <<"aa[" << i << "][" << k << "] = " ; dump(i,k,aa,*cf); *cf << ";\n"; *cf << prefix <<"ff[" << i << "] = " ; dump(i,ff,*cf); *cf << ";\n"; *cf << prefix <<"il[" << i << "] = " ; dump(i,il,*cf); *cf << ";\n"; *cf << prefix <<"jl[" << i << "] = " ; dump(i,jl,*cf); *cf << ";\n"; *cf << prefix <<"kl[" << i << "] = " ; dump(i,kl,*cf); *cf << ";\n"; *cf << prefix <<"R2 Pt[" << i << "] = " ; dump2(i,jl,kl,k,*cf); *cf << ";\n"; if(ccf) delete ccf; // close file }
{ "pile_set_name": "Github" }
# /* Copyright (C) 2001 # * Housemarque Oy # * http://www.housemarque.com # * # * Distributed under the Boost Software License, Version 1.0. (See # * accompanying file LICENSE_1_0.txt or copy at # * http://www.boost.org/LICENSE_1_0.txt) # */ # # /* Revised by Paul Mensonides (2002) */ # # /* See http://www.boost.org for most recent version. */ # # ifndef AUTOBOOST_PREPROCESSOR_COMPARISON_HPP # define AUTOBOOST_PREPROCESSOR_COMPARISON_HPP # # include <autoboost/preprocessor/comparison/equal.hpp> # include <autoboost/preprocessor/comparison/greater.hpp> # include <autoboost/preprocessor/comparison/greater_equal.hpp> # include <autoboost/preprocessor/comparison/less.hpp> # include <autoboost/preprocessor/comparison/less_equal.hpp> # include <autoboost/preprocessor/comparison/not_equal.hpp> # # endif
{ "pile_set_name": "Github" }
/* * Copyright (c) 2018, Intel Corporation * * 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. */ #include <cctype> #include <string> #include <stdio.h> #include "devconfig.h" #include "gtest/gtest.h" using namespace std; const char* g_driverPath; vector<Platform_t> g_platform; static bool ParseCmd(int argc, char *argv[]); int main(int argc, char *argv[]) { testing::InitGoogleTest(&argc, argv); if (ParseCmd(argc, argv) == false) { return -1; } return RUN_ALL_TESTS(); } static bool ParsePlatform(const char *str); static bool ParseDriverPath(const char *str); static bool ParseCmd(int argc, char *argv[]) { g_driverPath = nullptr; g_platform.clear(); for (int i = 1; i < argc; i++) { if (ParseDriverPath(argv[i]) == false && ParsePlatform(argv[i]) == false) { printf("ERROR\n Bad command line parameter!\n\n"); printf("USAGE\n devult [driver_path] [platform_name...]\n\n"); printf("DESCRIPTION\n [driver_path] : Use default driver relative path if not specify driver_path.\n" " [platform_name...]: Select zero or more items from {SKL, BXT, BDW}.\n\n"); printf("EXAMPLE\n devult\n" " devult ./build/media_driver/iHD_drv_video.so\n" " devult skl\n" " devult ./build/media_driver/iHD_drv_video.so skl\n" " devult ./build/media_driver/iHD_drv_video.so skl\n\n"); return false; } } return true; } static bool ParsePlatform(const char *str) { string tmpStr(str); for (auto i = tmpStr.begin(); i != tmpStr.end(); i++) { *i = toupper(*i); } for (int i = 0; i < (int)igfx_MAX; i++) { if (tmpStr.compare(g_platformName[i]) == 0) { g_platform.push_back((Platform_t)i); return true; } } return false; } static bool ParseDriverPath(const char *str) { if (g_driverPath == nullptr && strstr(str, "iHD_drv_video.so") != nullptr) { g_driverPath = str; return true; } return false; }
{ "pile_set_name": "Github" }
async function f2() { var y = await 20; return y; } f2();
{ "pile_set_name": "Github" }
{ "_class": "shapePath", "booleanOperation": -1, "clippingMaskMode": 0, "do_objectID": "E73DA06A-A66F-439B-9DA0-C38C1662FBC3", "edited": true, "exportOptions": { "_class": "exportOptions", "exportFormats": [ ], "includedLayerIds": [ ], "layerOptions": 0, "shouldTrim": false }, "frame": { "_class": "rect", "constrainProportions": false, "height": 6.859999999999999, "width": 75.655, "x": 0.9770000000000001, "y": 0.14 }, "hasClippingMask": true, "isClosed": true, "isFixedToViewport": false, "isFlippedHorizontal": false, "isFlippedVertical": false, "isLocked": false, "isVisible": true, "layerListExpandedType": 1, "name": "a", "nameIsFixed": false, "pointRadiusBehaviour": 1, "points": [ { "_class": "curvePoint", "cornerRadius": 0, "curveFrom": "{1, 1}", "curveMode": 1, "curveTo": "{1, 1}", "hasCurveFrom": false, "hasCurveTo": false, "point": "{1, 1}" }, { "_class": "curvePoint", "cornerRadius": 0, "curveFrom": "{0, 1}", "curveMode": 1, "curveTo": "{0, 1}", "hasCurveFrom": false, "hasCurveTo": false, "point": "{0, 1}" }, { "_class": "curvePoint", "cornerRadius": 0, "curveFrom": "{0, 0}", "curveMode": 1, "curveTo": "{0, 0}", "hasCurveFrom": false, "hasCurveTo": false, "point": "{0, 0}" }, { "_class": "curvePoint", "cornerRadius": 0, "curveFrom": "{1, 0}", "curveMode": 1, "curveTo": "{1, 0}", "hasCurveFrom": false, "hasCurveTo": false, "point": "{1, 0}" } ], "resizingConstraint": 63, "resizingType": 0, "rotation": 0, "shouldBreakMaskChain": false, "style": { "_class": "style", "endMarkerType": 0, "miterLimit": 10, "startMarkerType": 0, "windingRule": 1 }, "userInfo": { "com.animaapp.stc-sketch-plugin": { "kModelPropertiesKey": { } } } }
{ "pile_set_name": "Github" }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class OverlayAdjuster : MonoBehaviour { public float adjustSpeed = 12f; [Header("Checking Variables")] public LayerMask collisionLayer; public float checkRadius = 0.125f; public float checkDis = 1.25f; Vector3 localPos; public List<CameraAdjust> scopes; void Start() { localPos = transform.localPosition; } public void GetScopes() { scopes = new List<CameraAdjust>(); foreach (Camera cam in GetComponentsInChildren<Camera>()) { Transform camTrans = cam.transform; if (camTrans == this.transform) continue; CameraAdjust camAdj = new CameraAdjust(camTrans); scopes.Add(camAdj); } } public void AddCameraAdjust(Transform t) { CameraAdjust camAdj = new CameraAdjust(t); scopes.Add(camAdj); } // Update is called once per frame void Update() { Vector3 startPos = transform.parent.TransformPoint(localPos); Vector3 backedUpPos = localPos; float adjust = 0; if (Physics.SphereCast(startPos, checkRadius, transform.forward, out var hit, (checkDis - checkRadius), collisionLayer)) { adjust = (hit.point - startPos).magnitude - checkDis; Debug.DrawLine(hit.point, startPos); } backedUpPos.z += adjust; transform.localPosition = Vector3.Lerp(transform.localPosition, backedUpPos, Time.deltaTime * adjustSpeed); Vector3 dir = transform.parent.TransformDirection(localPos - backedUpPos); foreach(CameraAdjust adj in scopes) adj.UpdateAdjust(dir, adjustSpeed); } } [System.Serializable] public class CameraAdjust { public Transform camTrans; Vector3 localPos; public CameraAdjust(Transform t) { camTrans = t; localPos = camTrans.localPosition; } public void UpdateAdjust(Vector3 adjust, float adjustSpeed) { Vector3 backedUpPos = localPos; Vector3 dir = camTrans.parent.InverseTransformDirection(adjust); backedUpPos += dir; camTrans.localPosition = Vector3.Lerp(camTrans.localPosition, backedUpPos, Time.deltaTime * adjustSpeed); } }
{ "pile_set_name": "Github" }
/* Copyright The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Code generated by lister-gen. DO NOT EDIT. package v1beta1 import ( v1beta1 "k8s.io/api/storage/v1beta1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" "k8s.io/client-go/tools/cache" ) // CSINodeLister helps list CSINodes. type CSINodeLister interface { // List lists all CSINodes in the indexer. List(selector labels.Selector) (ret []*v1beta1.CSINode, err error) // Get retrieves the CSINode from the index for a given name. Get(name string) (*v1beta1.CSINode, error) CSINodeListerExpansion } // cSINodeLister implements the CSINodeLister interface. type cSINodeLister struct { indexer cache.Indexer } // NewCSINodeLister returns a new CSINodeLister. func NewCSINodeLister(indexer cache.Indexer) CSINodeLister { return &cSINodeLister{indexer: indexer} } // List lists all CSINodes in the indexer. func (s *cSINodeLister) List(selector labels.Selector) (ret []*v1beta1.CSINode, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { ret = append(ret, m.(*v1beta1.CSINode)) }) return ret, err } // Get retrieves the CSINode from the index for a given name. func (s *cSINodeLister) Get(name string) (*v1beta1.CSINode, error) { obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } if !exists { return nil, errors.NewNotFound(v1beta1.Resource("csinode"), name) } return obj.(*v1beta1.CSINode), nil }
{ "pile_set_name": "Github" }
//empty
{ "pile_set_name": "Github" }
/** * Copyright (C) 2001-2020 by RapidMiner and the contributors * * Complete list of developers available at our web site: * * http://rapidminer.com * * This program 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. * * 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 * 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/. */ package com.rapidminer.tools.math; /** * Window functions apply a weight to each value of a value series depending on the length of the * series. Window Functions like Hanning windows are usually applied before a Fourier * transformation. * * TODO: remove class and transfer calls to com.rapidminer.tools.math.function.window.WindowFunction * * @author Ingo Mierswa */ public class WindowFunction { /** The currently implemented window functions. */ public static final String[] FUNCTIONS = { "None", "Hanning", "Hamming", "Blackman", "Blackman-Harris", "Bartlett", "Rectangle" }; /** The constant for the function Hanning. */ public static final int NONE = 0; /** The constant for the function Hanning. */ public static final int HANNING = 1; /** The constant for the function Hamming. */ public static final int HAMMING = 2; /** The constant for the function Blackman. */ public static final int BLACKMAN = 3; /** The constant for the function Blackman-Harris. */ public static final int BLACKMAN_HARRIS = 4; /** The constant for the function Bartlett. */ public static final int BARTLETT = 5; /** The constant for the function Rectangle. */ public static final int RECTANGLE = 6; private int type; private int length; public WindowFunction(int type, int maxIndex) { this.type = type; this.length = maxIndex; } /** * Returns the weighting factor for the current value n in a window of the given length. The * calculation of this factor is done in dependance of the function type. */ public double getFactor(int n) { switch (type) { case HANNING: return 0.5 - 0.5 * Math.cos(2 * Math.PI * n / length); case HAMMING: return 0.54 - 0.46 * Math.cos(2 * Math.PI * n / length); case BLACKMAN: return 0.42 - 0.5 * Math.cos(2 * Math.PI * n / length) + 0.08 * Math.cos(4 * Math.PI * n / length); case BLACKMAN_HARRIS: return 0.35875 - 0.48829 * Math.cos(2 * Math.PI * n / length) + 0.14128 * Math.cos(4 * Math.PI * n / length) - 0.01168 * Math.cos(6 * Math.PI * n / length); case BARTLETT: return 1.0 - Math.abs(2 * (double) (n - length / 2) / length); default: return 1.0; } } }
{ "pile_set_name": "Github" }
<resources> <!-- Example customization of dimensions originally defined in res/values/dimens.xml (such as screen margins) for screens with more than 820dp of available width. This would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). --> <dimen name="activity_horizontal_margin">64dp</dimen> </resources>
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import <objc/NSObject.h> #import <Network/NWPrettyDescription-Protocol.h> @class NSString, NSUUID; @interface NWGenericNetworkAgent : NSObject <NWPrettyDescription> { struct netagent *_internalNetagent; } @property struct netagent *internalNetagent; // @synthesize internalNetagent=_internalNetagent; - (BOOL)supportsResolve; - (BOOL)requiresAssert; - (BOOL)supportsBrowse; - (BOOL)isNexusProvider; @property(readonly, nonatomic, getter=isNetworkProvider) BOOL networkProvider; @property(readonly, nonatomic, getter=isSpecificUseOnly) BOOL specificUseOnly; @property(readonly, nonatomic, getter=isVoluntary) BOOL voluntary; @property(readonly, nonatomic, getter=isUserActivated) BOOL userActivated; @property(readonly, nonatomic, getter=isKernelActivated) BOOL kernelActivated; @property(readonly, nonatomic, getter=isActive) BOOL active; @property(readonly, nonatomic) NSUUID *agentUUID; @property(readonly, nonatomic) NSString *agentDescription; @property(readonly, nonatomic) NSString *agentType; @property(readonly, nonatomic) NSString *agentDomain; @property(readonly, copy, nonatomic) NSString *privateDescription; - (id)description; - (id)descriptionWithIndent:(int)arg1 showFullContent:(BOOL)arg2; - (void)dealloc; - (id)initWithKernelAgent:(const struct netagent *)arg1; @end
{ "pile_set_name": "Github" }
#source: emit-relocs-302.s #ld: -T relocs.ld --defsym globala=0x11000 --defsym globalb=0x45000 --defsym globalc=0x1234 -e0 --emit-relocs #notarget: aarch64_be-*-* #objdump: -dr .*: +file format .* Disassembly of section .text: 0000000000010000 <\.text>: 10000: 580000e1 ldr x1, 1001c <\.text\+0x1c> 10004: 100000c2 adr x2, 1001c <\.text\+0x1c> 10008: 8b010041 add x1, x2, x1 1000c: d2a00000 movz x0, #0x0, lsl #16 1000c: R_AARCH64_MOVW_GOTOFF_G1 globala 10010: d2a00000 movz x0, #0x0, lsl #16 10010: R_AARCH64_MOVW_GOTOFF_G1 globalb 10014: d2a00000 movz x0, #0x0, lsl #16 10014: R_AARCH64_MOVW_GOTOFF_G1 globalc 10018: f8606820 ldr x0, \[x1, x0\] 1001c: 0000ffe4 \.word 0x0000ffe4 1001c: R_AARCH64_PREL64 _GLOBAL_OFFSET_TABLE_ 10020: 00000000 \.word 0x00000000
{ "pile_set_name": "Github" }
package jadx.tests.integration.others; import org.junit.jupiter.api.Test; import jadx.core.dex.nodes.ClassNode; import jadx.tests.api.IntegrationTest; import static jadx.tests.api.utils.JadxMatchers.containsOne; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; public class TestFieldInit3 extends IntegrationTest { public static class TestCls { public abstract static class A { public int field = 4; } public static final class B extends A { public B() { // IPUT for A.field super.field = 7; } } public static final class C extends A { public int other = 11; public C() { // IPUT for C.field not A.field !!! this.field = 9; } } public static final class D extends A { } public void check() { assertThat(new B().field, is(7)); assertThat(new C().field, is(9)); assertThat(new C().other, is(11)); assertThat(new D().field, is(4)); } } @Test public void test() { ClassNode cls = getClassNode(TestCls.class); String code = cls.getCode().toString(); assertThat(code, containsOne("public int field = 4;")); assertThat(code, containsOne("field = 7;")); assertThat(code, containsOne("field = 9;")); assertThat(code, containsOne("public int other = 11;")); } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 1982, 1986, 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94 * ip_icmp.c,v 1.7 1995/05/30 08:09:42 rgrimes Exp */ #include "slirp.h" #include "ip_icmp.h" /* The message sent when emulating PING */ /* Be nice and tell them it's just a pseudo-ping packet */ static const char icmp_ping_msg[] = "This is a pseudo-PING packet used by Slirp to emulate ICMP ECHO-REQUEST packets.\n"; /* list of actions for icmp_error() on RX of an icmp message */ static const int icmp_flush[19] = { /* ECHO REPLY (0) */ 0, 1, 1, /* DEST UNREACH (3) */ 1, /* SOURCE QUENCH (4)*/ 1, /* REDIRECT (5) */ 1, 1, 1, /* ECHO (8) */ 0, /* ROUTERADVERT (9) */ 1, /* ROUTERSOLICIT (10) */ 1, /* TIME EXCEEDED (11) */ 1, /* PARAMETER PROBLEM (12) */ 1, /* TIMESTAMP (13) */ 0, /* TIMESTAMP REPLY (14) */ 0, /* INFO (15) */ 0, /* INFO REPLY (16) */ 0, /* ADDR MASK (17) */ 0, /* ADDR MASK REPLY (18) */ 0 }; void icmp_init(Slirp *slirp) { slirp->icmp.so_next = slirp->icmp.so_prev = &slirp->icmp; slirp->icmp_last_so = &slirp->icmp; } void icmp_cleanup(Slirp *slirp) { while (slirp->icmp.so_next != &slirp->icmp) { icmp_detach(slirp->icmp.so_next); } } static int icmp_send(struct socket *so, struct mbuf *m, int hlen) { struct ip *ip = mtod(m, struct ip *); struct sockaddr_in addr; so->s = qemu_socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP); if (so->s == -1) { return -1; } so->so_m = m; so->so_faddr = ip->ip_dst; so->so_laddr = ip->ip_src; so->so_iptos = ip->ip_tos; so->so_type = IPPROTO_ICMP; so->so_state = SS_ISFCONNECTED; so->so_expire = curtime + SO_EXPIRE; addr.sin_family = AF_INET; addr.sin_addr = so->so_faddr; insque(so, &so->slirp->icmp); if (sendto(so->s, m->m_data + hlen, m->m_len - hlen, 0, (struct sockaddr *)&addr, sizeof(addr)) == -1) { DEBUG_MISC((dfd, "icmp_input icmp sendto tx errno = %d-%s\n", errno, strerror(errno))); icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno)); icmp_detach(so); } return 0; } void icmp_detach(struct socket *so) { closesocket(so->s); sofree(so); } /* * Process a received ICMP message. */ void icmp_input(struct mbuf *m, int hlen) { register struct icmp *icp; register struct ip *ip=mtod(m, struct ip *); int icmplen=ip->ip_len; Slirp *slirp = m->slirp; DEBUG_CALL("icmp_input"); DEBUG_ARG("m = %lx", (long )m); DEBUG_ARG("m_len = %d", m->m_len); /* * Locate icmp structure in mbuf, and check * that its not corrupted and of at least minimum length. */ if (icmplen < ICMP_MINLEN) { /* min 8 bytes payload */ freeit: m_free(m); goto end_error; } m->m_len -= hlen; m->m_data += hlen; icp = mtod(m, struct icmp *); if (cksum(m, icmplen)) { goto freeit; } m->m_len += hlen; m->m_data -= hlen; DEBUG_ARG("icmp_type = %d", icp->icmp_type); switch (icp->icmp_type) { case ICMP_ECHO: ip->ip_len += hlen; /* since ip_input subtracts this */ if (ip->ip_dst.s_addr == slirp->vhost_addr.s_addr) { icmp_reflect(m); } else if (slirp->restricted) { goto freeit; } else { struct socket *so; struct sockaddr_in addr; if ((so = socreate(slirp)) == NULL) goto freeit; if (icmp_send(so, m, hlen) == 0) { return; } if(udp_attach(so) == -1) { DEBUG_MISC((dfd,"icmp_input udp_attach errno = %d-%s\n", errno,strerror(errno))); sofree(so); m_free(m); goto end_error; } so->so_m = m; so->so_faddr = ip->ip_dst; so->so_fport = htons(7); so->so_laddr = ip->ip_src; so->so_lport = htons(9); so->so_iptos = ip->ip_tos; so->so_type = IPPROTO_ICMP; so->so_state = SS_ISFCONNECTED; /* Send the packet */ addr.sin_family = AF_INET; if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) == slirp->vnetwork_addr.s_addr) { /* It's an alias */ if (so->so_faddr.s_addr == slirp->vnameserver_addr.s_addr) { if (get_dns_addr(&addr.sin_addr) < 0) addr.sin_addr = loopback_addr; } else { addr.sin_addr = loopback_addr; } } else { addr.sin_addr = so->so_faddr; } addr.sin_port = so->so_fport; if(sendto(so->s, icmp_ping_msg, strlen(icmp_ping_msg), 0, (struct sockaddr *)&addr, sizeof(addr)) == -1) { DEBUG_MISC((dfd,"icmp_input udp sendto tx errno = %d-%s\n", errno,strerror(errno))); icmp_error(m, ICMP_UNREACH,ICMP_UNREACH_NET, 0,strerror(errno)); udp_detach(so); } } /* if ip->ip_dst.s_addr == alias_addr.s_addr */ break; case ICMP_UNREACH: /* XXX? report error? close socket? */ case ICMP_TIMXCEED: case ICMP_PARAMPROB: case ICMP_SOURCEQUENCH: case ICMP_TSTAMP: case ICMP_MASKREQ: case ICMP_REDIRECT: m_free(m); break; default: m_free(m); } /* swith */ end_error: /* m is m_free()'d xor put in a socket xor or given to ip_send */ return; } /* * Send an ICMP message in response to a situation * * RFC 1122: 3.2.2 MUST send at least the IP header and 8 bytes of header. MAY send more (we do). * MUST NOT change this header information. * MUST NOT reply to a multicast/broadcast IP address. * MUST NOT reply to a multicast/broadcast MAC address. * MUST reply to only the first fragment. */ /* * Send ICMP_UNREACH back to the source regarding msrc. * mbuf *msrc is used as a template, but is NOT m_free()'d. * It is reported as the bad ip packet. The header should * be fully correct and in host byte order. * ICMP fragmentation is illegal. All machines must accept 576 bytes in one * packet. The maximum payload is 576-20(ip hdr)-8(icmp hdr)=548 */ #define ICMP_MAXDATALEN (IP_MSS-28) void icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize, const char *message) { unsigned hlen, shlen, s_ip_len; register struct ip *ip; register struct icmp *icp; register struct mbuf *m; DEBUG_CALL("icmp_error"); DEBUG_ARG("msrc = %lx", (long )msrc); DEBUG_ARG("msrc_len = %d", msrc->m_len); if(type!=ICMP_UNREACH && type!=ICMP_TIMXCEED) goto end_error; /* check msrc */ if(!msrc) goto end_error; ip = mtod(msrc, struct ip *); #ifdef DEBUG { char bufa[20], bufb[20]; strcpy(bufa, inet_ntoa(ip->ip_src)); strcpy(bufb, inet_ntoa(ip->ip_dst)); DEBUG_MISC((dfd, " %.16s to %.16s\n", bufa, bufb)); } #endif if(ip->ip_off & IP_OFFMASK) goto end_error; /* Only reply to fragment 0 */ /* Do not reply to source-only IPs */ if ((ip->ip_src.s_addr & htonl(~(0xf << 28))) == 0) { goto end_error; } shlen=ip->ip_hl << 2; s_ip_len=ip->ip_len; if(ip->ip_p == IPPROTO_ICMP) { icp = (struct icmp *)((char *)ip + shlen); /* * Assume any unknown ICMP type is an error. This isn't * specified by the RFC, but think about it.. */ if(icp->icmp_type>18 || icmp_flush[icp->icmp_type]) goto end_error; } /* make a copy */ m = m_get(msrc->slirp); if (!m) { goto end_error; } { int new_m_size; new_m_size=sizeof(struct ip )+ICMP_MINLEN+msrc->m_len+ICMP_MAXDATALEN; if(new_m_size>m->m_size) m_inc(m, new_m_size); } memcpy(m->m_data, msrc->m_data, msrc->m_len); m->m_len = msrc->m_len; /* copy msrc to m */ /* make the header of the reply packet */ ip = mtod(m, struct ip *); hlen= sizeof(struct ip ); /* no options in reply */ /* fill in icmp */ m->m_data += hlen; m->m_len -= hlen; icp = mtod(m, struct icmp *); if(minsize) s_ip_len=shlen+ICMP_MINLEN; /* return header+8b only */ else if(s_ip_len>ICMP_MAXDATALEN) /* maximum size */ s_ip_len=ICMP_MAXDATALEN; m->m_len=ICMP_MINLEN+s_ip_len; /* 8 bytes ICMP header */ /* min. size = 8+sizeof(struct ip)+8 */ icp->icmp_type = type; icp->icmp_code = code; icp->icmp_id = 0; icp->icmp_seq = 0; memcpy(&icp->icmp_ip, msrc->m_data, s_ip_len); /* report the ip packet */ HTONS(icp->icmp_ip.ip_len); HTONS(icp->icmp_ip.ip_id); HTONS(icp->icmp_ip.ip_off); #ifdef DEBUG if(message) { /* DEBUG : append message to ICMP packet */ int message_len; char *cpnt; message_len=strlen(message); if(message_len>ICMP_MAXDATALEN) message_len=ICMP_MAXDATALEN; cpnt=(char *)m->m_data+m->m_len; memcpy(cpnt, message, message_len); m->m_len+=message_len; } #endif icp->icmp_cksum = 0; icp->icmp_cksum = cksum(m, m->m_len); m->m_data -= hlen; m->m_len += hlen; /* fill in ip */ ip->ip_hl = hlen >> 2; ip->ip_len = m->m_len; ip->ip_tos=((ip->ip_tos & 0x1E) | 0xC0); /* high priority for errors */ ip->ip_ttl = MAXTTL; ip->ip_p = IPPROTO_ICMP; ip->ip_dst = ip->ip_src; /* ip addresses */ ip->ip_src = m->slirp->vhost_addr; (void ) ip_output((struct socket *)NULL, m); end_error: return; } #undef ICMP_MAXDATALEN /* * Reflect the ip packet back to the source */ void icmp_reflect(struct mbuf *m) { register struct ip *ip = mtod(m, struct ip *); int hlen = ip->ip_hl << 2; int optlen = hlen - sizeof(struct ip ); register struct icmp *icp; /* * Send an icmp packet back to the ip level, * after supplying a checksum. */ m->m_data += hlen; m->m_len -= hlen; icp = mtod(m, struct icmp *); icp->icmp_type = ICMP_ECHOREPLY; icp->icmp_cksum = 0; icp->icmp_cksum = cksum(m, ip->ip_len - hlen); m->m_data -= hlen; m->m_len += hlen; /* fill in ip */ if (optlen > 0) { /* * Strip out original options by copying rest of first * mbuf's data back, and adjust the IP length. */ memmove((caddr_t)(ip + 1), (caddr_t)ip + hlen, (unsigned )(m->m_len - hlen)); hlen -= optlen; ip->ip_hl = hlen >> 2; ip->ip_len -= optlen; m->m_len -= optlen; } ip->ip_ttl = MAXTTL; { /* swap */ struct in_addr icmp_dst; icmp_dst = ip->ip_dst; ip->ip_dst = ip->ip_src; ip->ip_src = icmp_dst; } (void ) ip_output((struct socket *)NULL, m); } void icmp_receive(struct socket *so) { struct mbuf *m = so->so_m; struct ip *ip = mtod(m, struct ip *); int hlen = ip->ip_hl << 2; u_char error_code; struct icmp *icp; int id, len; m->m_data += hlen; m->m_len -= hlen; icp = mtod(m, struct icmp *); id = icp->icmp_id; len = qemu_recv(so->s, icp, m->m_len, 0); icp->icmp_id = id; m->m_data -= hlen; m->m_len += hlen; if (len == -1 || len == 0) { if (errno == ENETUNREACH) { error_code = ICMP_UNREACH_NET; } else { error_code = ICMP_UNREACH_HOST; } DEBUG_MISC((dfd, " udp icmp rx errno = %d-%s\n", errno, strerror(errno))); icmp_error(so->so_m, ICMP_UNREACH, error_code, 0, strerror(errno)); } else { icmp_reflect(so->so_m); so->so_m = NULL; /* Don't m_free() it again! */ } icmp_detach(so); }
{ "pile_set_name": "Github" }
// Boost.Geometry (aka GGL, Generic Geometry Library) // This file is manually converted from PROJ4 // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // This file was modified by Oracle on 2018. // Modifications copyright (c) 2018, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // This file is converted from PROJ4, http://trac.osgeo.org/proj // PROJ4 is originally written by Gerald Evenden (then of the USGS) // PROJ4 is maintained by Frank Warmerdam // PROJ4 is converted to Geometry Library by Barend Gehrels (Geodan, Amsterdam) // Original copyright notice: // 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. #ifndef BOOST_GEOMETRY_PROJECTIONS_PROJ_MDIST_HPP #define BOOST_GEOMETRY_PROJECTIONS_PROJ_MDIST_HPP #include <boost/geometry/srs/projections/exception.hpp> #include <boost/geometry/srs/projections/impl/pj_strerrno.hpp> #include <boost/geometry/util/math.hpp> namespace boost { namespace geometry { namespace projections { namespace detail { template <typename T> struct mdist { static const int static_size = 20; T es; T E; T b[static_size]; int nb; }; template <typename T> inline bool proj_mdist_ini(T const& es, mdist<T>& b) { T numf, numfi, twon1, denf, denfi, ens, t, twon; T den, El, Es; T E[mdist<T>::static_size]; int i, j; /* generate E(e^2) and its terms E[] */ ens = es; numf = twon1 = denfi = 1.; denf = 1.; twon = 4.; Es = El = E[0] = 1.; for (i = 1; i < mdist<T>::static_size ; ++i) { numf *= (twon1 * twon1); den = twon * denf * denf * twon1; t = numf/den; E[i] = t * ens; Es -= E[i]; ens *= es; twon *= 4.; denf *= ++denfi; twon1 += 2.; if (Es == El) /* jump out if no change */ break; El = Es; } b.nb = i - 1; b.es = es; b.E = Es; /* generate b_n coefficients--note: collapse with prefix ratios */ b.b[0] = Es = 1. - Es; numf = denf = 1.; numfi = 2.; denfi = 3.; for (j = 1; j < i; ++j) { Es -= E[j]; numf *= numfi; denf *= denfi; b.b[j] = Es * numf / denf; numfi += 2.; denfi += 2.; } return true; } template <typename T> inline T proj_mdist(T const& phi, T const& sphi, T const& cphi, mdist<T> const& b) { T sc, sum, sphi2, D; int i; sc = sphi * cphi; sphi2 = sphi * sphi; D = phi * b.E - b.es * sc / sqrt(1. - b.es * sphi2); sum = b.b[i = b.nb]; while (i) sum = b.b[--i] + sphi2 * sum; return(D + sc * sum); } template <typename T> inline T proj_inv_mdist(T const& dist, mdist<T> const& b) { static const T TOL = 1e-14; T s, t, phi, k; int i; k = 1./(1.- b.es); i = mdist<T>::static_size; phi = dist; while ( i-- ) { s = sin(phi); t = 1. - b.es * s * s; phi -= t = (proj_mdist(phi, s, cos(phi), b) - dist) * (t * sqrt(t)) * k; if (geometry::math::abs(t) < TOL) /* that is no change */ return phi; } /* convergence failed */ BOOST_THROW_EXCEPTION( projection_exception(error_non_conv_inv_meri_dist) ); } } // namespace detail }}} // namespace boost::geometry::projections #endif
{ "pile_set_name": "Github" }
<?php /** * PHPExcel_HashTable * * Copyright (c) 2006 - 2015 PHPExcel * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category PHPExcel * @package PHPExcel * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## */ class PHPExcel_HashTable { /** * HashTable elements * * @var array */ protected $items = array(); /** * HashTable key map * * @var array */ protected $keyMap = array(); /** * Create a new PHPExcel_HashTable * * @param PHPExcel_IComparable[] $pSource Optional source array to create HashTable from * @throws PHPExcel_Exception */ public function __construct($pSource = null) { if ($pSource !== null) { // Create HashTable $this->addFromSource($pSource); } } /** * Add HashTable items from source * * @param PHPExcel_IComparable[] $pSource Source array to create HashTable from * @throws PHPExcel_Exception */ public function addFromSource($pSource = null) { // Check if an array was passed if ($pSource == null) { return; } elseif (!is_array($pSource)) { throw new PHPExcel_Exception('Invalid array parameter passed.'); } foreach ($pSource as $item) { $this->add($item); } } /** * Add HashTable item * * @param PHPExcel_IComparable $pSource Item to add * @throws PHPExcel_Exception */ public function add(PHPExcel_IComparable $pSource = null) { $hash = $pSource->getHashCode(); if (!isset($this->items[$hash])) { $this->items[$hash] = $pSource; $this->keyMap[count($this->items) - 1] = $hash; } } /** * Remove HashTable item * * @param PHPExcel_IComparable $pSource Item to remove * @throws PHPExcel_Exception */ public function remove(PHPExcel_IComparable $pSource = null) { $hash = $pSource->getHashCode(); if (isset($this->items[$hash])) { unset($this->items[$hash]); $deleteKey = -1; foreach ($this->keyMap as $key => $value) { if ($deleteKey >= 0) { $this->keyMap[$key - 1] = $value; } if ($value == $hash) { $deleteKey = $key; } } unset($this->keyMap[count($this->keyMap) - 1]); } } /** * Clear HashTable * */ public function clear() { $this->items = array(); $this->keyMap = array(); } /** * Count * * @return int */ public function count() { return count($this->items); } /** * Get index for hash code * * @param string $pHashCode * @return int Index */ public function getIndexForHashCode($pHashCode = '') { return array_search($pHashCode, $this->keyMap); } /** * Get by index * * @param int $pIndex * @return PHPExcel_IComparable * */ public function getByIndex($pIndex = 0) { if (isset($this->keyMap[$pIndex])) { return $this->getByHashCode($this->keyMap[$pIndex]); } return null; } /** * Get by hashcode * * @param string $pHashCode * @return PHPExcel_IComparable * */ public function getByHashCode($pHashCode = '') { if (isset($this->items[$pHashCode])) { return $this->items[$pHashCode]; } return null; } /** * HashTable to array * * @return PHPExcel_IComparable[] */ public function toArray() { return $this->items; } /** * Implement PHP __clone to create a deep clone, not just a shallow copy. */ public function __clone() { $vars = get_object_vars($this); foreach ($vars as $key => $value) { if (is_object($value)) { $this->$key = clone $value; } } } }
{ "pile_set_name": "Github" }
using System; using System.Diagnostics; using System.IO; using System.IO.Pipelines; using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; namespace Pipelines.Sockets.Unofficial { public partial class SocketConnection { private SocketAwaitableEventArgs _readerArgs; /// <summary> /// The total number of bytes read from the socket /// </summary> public long BytesRead => Interlocked.Read(ref _totalBytesReceived); /// <summary> /// The number of bytes received in the last read /// </summary> public int LastReceived { get; private set; } private long _totalBytesReceived; long IMeasuredDuplexPipe.TotalBytesReceived => BytesRead; private async Task DoReceiveAsync() { Exception error = null; DebugLog("starting receive loop"); try { _readerArgs = new SocketAwaitableEventArgs(InlineReads ? null : _receiveOptions.WriterScheduler); while (true) { if (ZeroLengthReads && Socket.Available == 0) { DebugLog($"awaiting zero-length receive..."); Helpers.Incr(Counter.OpenReceiveReadAsync); DoReceive(Socket, _readerArgs, default, Name); Helpers.Incr(_readerArgs.IsCompleted ? Counter.SocketZeroLengthReceiveSync : Counter.SocketZeroLengthReceiveAsync); await _readerArgs; Helpers.Decr(Counter.OpenReceiveReadAsync); DebugLog($"zero-length receive complete; now {Socket.Available} bytes available"); // this *could* be because data is now available, or it *could* be because of // the EOF; we can't really trust Available, so now we need to do a non-empty // read to find out which } var buffer = _receiveFromSocket.Writer.GetMemory(1); DebugLog($"leased {buffer.Length} bytes from pipe"); try { DebugLog($"initiating socket receive..."); Helpers.Incr(Counter.OpenReceiveReadAsync); DoReceive(Socket, _readerArgs, buffer, Name); Helpers.Incr(_readerArgs.IsCompleted ? Counter.SocketReceiveSync : Counter.SocketReceiveAsync); DebugLog(_readerArgs.IsCompleted ? "receive is sync" : "receive is async"); var bytesReceived = await _readerArgs; LastReceived = bytesReceived; Helpers.Decr(Counter.OpenReceiveReadAsync); Debug.Assert(bytesReceived == _readerArgs.BytesTransferred); DebugLog($"received {bytesReceived} bytes ({_readerArgs.BytesTransferred}, {_readerArgs.SocketError})"); if (bytesReceived <= 0) { _receiveFromSocket.Writer.Advance(0); TrySetShutdown(PipeShutdownKind.ReadEndOfStream); break; } _receiveFromSocket.Writer.Advance(bytesReceived); Interlocked.Add(ref _totalBytesReceived, bytesReceived); } finally { // commit? } DebugLog("flushing pipe"); Helpers.Incr(Counter.OpenReceiveFlushAsync); var flushTask = _receiveFromSocket.Writer.FlushAsync(); Helpers.Incr(flushTask.IsCompleted ? Counter.SocketPipeFlushSync : Counter.SocketPipeFlushAsync); FlushResult result; if (flushTask.IsCompletedSuccessfully) { result = flushTask.Result; DebugLog("pipe flushed (sync)"); } else { result = await flushTask; DebugLog("pipe flushed (async)"); } Helpers.Decr(Counter.OpenReceiveFlushAsync); if (result.IsCompleted) { TrySetShutdown(PipeShutdownKind.ReadFlushCompleted); break; } if (result.IsCanceled) { TrySetShutdown(PipeShutdownKind.ReadFlushCanceled); break; } } } catch (SocketException ex) when (ex.SocketErrorCode == SocketError.ConnectionReset) { TrySetShutdown(PipeShutdownKind.ReadSocketError, ex.SocketErrorCode); DebugLog($"fail: {ex.SocketErrorCode}"); error = new ConnectionResetException(ex.Message, ex); } catch (SocketException ex) when (ex.SocketErrorCode == SocketError.OperationAborted || ex.SocketErrorCode == SocketError.ConnectionAborted || ex.SocketErrorCode == SocketError.Interrupted || ex.SocketErrorCode == SocketError.InvalidArgument) { TrySetShutdown(PipeShutdownKind.ReadSocketError, ex.SocketErrorCode); DebugLog($"fail: {ex.SocketErrorCode}"); if (!_receiveAborted) { // Calling Dispose after ReceiveAsync can cause an "InvalidArgument" error on *nix. error = new ConnectionAbortedException(); } } catch (SocketException ex) { TrySetShutdown(PipeShutdownKind.ReadSocketError, ex.SocketErrorCode); DebugLog($"fail: {ex.SocketErrorCode}"); error = ex; } catch (ObjectDisposedException) { TrySetShutdown(PipeShutdownKind.ReadDisposed); DebugLog($"fail: disposed"); if (!_receiveAborted) { error = new ConnectionAbortedException(); } } catch (IOException ex) { TrySetShutdown(PipeShutdownKind.ReadIOException); DebugLog($"fail - io: {ex.Message}"); error = ex; } catch (Exception ex) { TrySetShutdown(PipeShutdownKind.ReadException); DebugLog($"fail: {ex.Message}"); error = new IOException(ex.Message, ex); } finally { if (_receiveAborted) { error ??= new ConnectionAbortedException(); } try { DebugLog($"shutting down socket-receive"); Socket.Shutdown(SocketShutdown.Receive); } catch { } // close the *writer* half of the receive pipe; we won't // be writing any more, but callers can still drain the // pipe if they choose DebugLog($"marking {nameof(Input)} as complete"); try { _receiveFromSocket.Writer.Complete(error); } catch { } TrySetShutdown(error, this, PipeShutdownKind.InputWriterCompleted); var args = _readerArgs; _readerArgs = null; if (args != null) try { args.Dispose(); } catch { } } DebugLog(error == null ? "exiting with success" : $"exiting with failure: {error.Message}"); //return error; } #pragma warning disable RCS1231 // Make parameter ref read-only. private static void DoReceive(Socket socket, SocketAwaitableEventArgs args, Memory<byte> buffer, string name) #pragma warning restore RCS1231 // Make parameter ref read-only. { #if SOCKET_STREAM_BUFFERS args.SetBuffer(buffer); #else if (buffer.IsEmpty) { // zero-length; retain existing buffer if possible if (args.Buffer == null) { args.SetBuffer(Array.Empty<byte>(), 0, 0); } else { // it doesn't matter that the old buffer may still be in // use somewhere; we're reading zero bytes! args.SetBuffer(args.Offset, 0); } } else { var segment = buffer.GetArray(); args.SetBuffer(segment.Array, segment.Offset, segment.Count); } #endif Helpers.DebugLog(name, $"## {nameof(socket.ReceiveAsync)} <={buffer.Length}"); if (!socket.ReceiveAsync(args)) args.Complete(); } } }
{ "pile_set_name": "Github" }
import SwiftLintFramework import XCTest class DiscouragedObjectLiteralRuleTests: XCTestCase { func testWithDefaultConfiguration() { verifyRule(DiscouragedObjectLiteralRule.description) } func testWithImageLiteral() { let baseDescription = DiscouragedObjectLiteralRule.description let nonTriggeringExamples = baseDescription.nonTriggeringExamples + [ Example("let color = #colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)") ] let triggeringExamples = [ Example("let image = ↓#imageLiteral(resourceName: \"image.jpg\")") ] let description = baseDescription.with(nonTriggeringExamples: nonTriggeringExamples, triggeringExamples: triggeringExamples) verifyRule(description, ruleConfiguration: ["image_literal": true, "color_literal": false]) } func testWithColorLiteral() { let baseDescription = DiscouragedObjectLiteralRule.description let nonTriggeringExamples = baseDescription.nonTriggeringExamples + [ Example("let image = #imageLiteral(resourceName: \"image.jpg\")") ] let triggeringExamples = [ Example("let color = ↓#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)") ] let description = baseDescription.with(nonTriggeringExamples: nonTriggeringExamples, triggeringExamples: triggeringExamples) verifyRule(description, ruleConfiguration: ["image_literal": false, "color_literal": true]) } }
{ "pile_set_name": "Github" }
package history import ( "testing" sq "github.com/Masterminds/squirrel" "github.com/stellar/go/services/horizon/internal/db2" "github.com/stellar/go/services/horizon/internal/test" ) func TestOperationQueries(t *testing.T) { tt := test.Start(t).Scenario("base") defer tt.Finish() q := &Q{tt.HorizonSession()} // Test OperationByID op, transaction, err := q.OperationByID(false, 8589938689) if tt.Assert.NoError(err) { tt.Assert.Equal(int64(8589938689), op.ID) } tt.Assert.Nil(transaction) // Test Operations() ops, transactions, err := q.Operations(). ForAccount("GBXGQJWVLWOYHFLVTKWV5FGHA3LNYY2JQKM7OAJAUEQFU6LPCSEFVXON"). Fetch() if tt.Assert.NoError(err) { tt.Assert.Len(ops, 2) } tt.Assert.Len(transactions, 0) // ledger filter works ops, transactions, err = q.Operations().ForLedger(2).Fetch() if tt.Assert.NoError(err) { tt.Assert.Len(ops, 3) } tt.Assert.Len(transactions, 0) // tx filter works hash := "2374e99349b9ef7dba9a5db3339b78fda8f34777b1af33ba468ad5c0df946d4d" ops, transactions, err = q.Operations().ForTransaction(hash).Fetch() if tt.Assert.NoError(err) { tt.Assert.Len(ops, 1) } tt.Assert.Len(transactions, 0) // payment filter works tt.Scenario("pathed_payment") ops, transactions, err = q.Operations().OnlyPayments().Fetch() if tt.Assert.NoError(err) { tt.Assert.Len(ops, 10) } tt.Assert.Len(transactions, 0) // payment filter includes account merges tt.Scenario("account_merge") ops, transactions, err = q.Operations().OnlyPayments().Fetch() if tt.Assert.NoError(err) { tt.Assert.Len(ops, 3) } tt.Assert.Len(transactions, 0) } func TestOperationQueryBuilder(t *testing.T) { tt := test.Start(t).Scenario("base") defer tt.Finish() q := &Q{tt.HorizonSession()} opsQ := q.Operations().ForAccount("GBXGQJWVLWOYHFLVTKWV5FGHA3LNYY2JQKM7OAJAUEQFU6LPCSEFVXON").Page(db2.PageQuery{Cursor: "8589938689", Order: "asc", Limit: 10}) tt.Assert.NoError(opsQ.Err) got, _, err := opsQ.sql.ToSql() tt.Assert.NoError(err) // Operations for account queries will use hopp.history_operation_id in their predicates. want := "SELECT hop.id, hop.transaction_id, hop.application_order, hop.type, hop.details, hop.source_account, ht.transaction_hash, ht.tx_result, COALESCE(ht.successful, true) as transaction_successful FROM history_operations hop LEFT JOIN history_transactions ht ON ht.id = hop.transaction_id JOIN history_operation_participants hopp ON hopp.history_operation_id = hop.id WHERE hopp.history_account_id = ? AND hopp.history_operation_id > ? ORDER BY hopp.history_operation_id asc LIMIT 10" tt.Assert.EqualValues(want, got) opsQ = q.Operations().ForLedger(2).Page(db2.PageQuery{Cursor: "8589938689", Order: "asc", Limit: 10}) tt.Assert.NoError(opsQ.Err) got, _, err = opsQ.sql.ToSql() tt.Assert.NoError(err) // Other operation queries will use hop.id in their predicates. want = "SELECT hop.id, hop.transaction_id, hop.application_order, hop.type, hop.details, hop.source_account, ht.transaction_hash, ht.tx_result, COALESCE(ht.successful, true) as transaction_successful FROM history_operations hop LEFT JOIN history_transactions ht ON ht.id = hop.transaction_id WHERE hop.id >= ? AND hop.id < ? AND hop.id > ? ORDER BY hop.id asc LIMIT 10" tt.Assert.EqualValues(want, got) } // TestOperationSuccessfulOnly tests if default query returns operations in // successful transactions only. // If it's not enclosed in brackets, it may return incorrect result when mixed // with `ForAccount` or `ForLedger` filters. func TestOperationSuccessfulOnly(t *testing.T) { tt := test.Start(t).Scenario("failed_transactions") defer tt.Finish() q := &Q{tt.HorizonSession()} query := q.Operations(). ForAccount("GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2") operations, transactions, err := query.Fetch() tt.Assert.NoError(err) tt.Assert.Len(transactions, 0) tt.Assert.Equal(3, len(operations)) for _, operation := range operations { tt.Assert.True(operation.TransactionSuccessful) } sql, _, err := query.sql.ToSql() tt.Assert.NoError(err) // Note: brackets around `(ht.successful = true OR ht.successful IS NULL)` are critical! tt.Assert.Contains(sql, "WHERE hopp.history_account_id = ? AND (ht.successful = true OR ht.successful IS NULL)") } // TestOperationIncludeFailed tests `IncludeFailed` method. func TestOperationIncludeFailed(t *testing.T) { tt := test.Start(t).Scenario("failed_transactions") defer tt.Finish() q := &Q{tt.HorizonSession()} query := q.Operations(). ForAccount("GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2"). IncludeFailed() operations, transactions, err := query.Fetch() tt.Assert.NoError(err) tt.Assert.Len(transactions, 0) var failed, successful int for _, operation := range operations { if operation.TransactionSuccessful { successful++ } else { failed++ } } tt.Assert.Equal(3, successful) tt.Assert.Equal(1, failed) sql, _, err := query.sql.ToSql() tt.Assert.NoError(err) tt.Assert.Equal("SELECT hop.id, hop.transaction_id, hop.application_order, hop.type, hop.details, hop.source_account, ht.transaction_hash, ht.tx_result, COALESCE(ht.successful, true) as transaction_successful FROM history_operations hop LEFT JOIN history_transactions ht ON ht.id = hop.transaction_id JOIN history_operation_participants hopp ON hopp.history_operation_id = hop.id WHERE hopp.history_account_id = ?", sql) } // TestPaymentsSuccessfulOnly tests if default query returns payments in // successful transactions only. // If it's not enclosed in brackets, it may return incorrect result when mixed // with `ForAccount` or `ForLedger` filters. func TestPaymentsSuccessfulOnly(t *testing.T) { tt := test.Start(t).Scenario("failed_transactions") defer tt.Finish() q := &Q{tt.HorizonSession()} query := q.Operations(). OnlyPayments(). ForAccount("GBXGQJWVLWOYHFLVTKWV5FGHA3LNYY2JQKM7OAJAUEQFU6LPCSEFVXON") operations, transactions, err := query.Fetch() tt.Assert.NoError(err) tt.Assert.Len(transactions, 0) tt.Assert.Equal(2, len(operations)) for _, operation := range operations { tt.Assert.True(operation.TransactionSuccessful) } sql, _, err := query.sql.ToSql() tt.Assert.NoError(err) // Note: brackets around `(ht.successful = true OR ht.successful IS NULL)` are critical! tt.Assert.Contains(sql, "WHERE hop.type IN (?,?,?,?,?) AND hopp.history_account_id = ? AND (ht.successful = true OR ht.successful IS NULL)") } // TestPaymentsIncludeFailed tests `IncludeFailed` method. func TestPaymentsIncludeFailed(t *testing.T) { tt := test.Start(t).Scenario("failed_transactions") defer tt.Finish() q := &Q{tt.HorizonSession()} query := q.Operations(). OnlyPayments(). ForAccount("GBXGQJWVLWOYHFLVTKWV5FGHA3LNYY2JQKM7OAJAUEQFU6LPCSEFVXON"). IncludeFailed() operations, transactions, err := query.Fetch() tt.Assert.NoError(err) tt.Assert.Len(transactions, 0) var failed, successful int for _, operation := range operations { if operation.TransactionSuccessful { successful++ } else { failed++ } } tt.Assert.Equal(2, successful) tt.Assert.Equal(1, failed) sql, _, err := query.sql.ToSql() tt.Assert.NoError(err) tt.Assert.Equal("SELECT hop.id, hop.transaction_id, hop.application_order, hop.type, hop.details, hop.source_account, ht.transaction_hash, ht.tx_result, COALESCE(ht.successful, true) as transaction_successful FROM history_operations hop LEFT JOIN history_transactions ht ON ht.id = hop.transaction_id JOIN history_operation_participants hopp ON hopp.history_operation_id = hop.id WHERE hop.type IN (?,?,?,?,?) AND hopp.history_account_id = ?", sql) } func TestExtraChecksOperationsTransactionSuccessfulTrueResultFalse(t *testing.T) { tt := test.Start(t).Scenario("failed_transactions") defer tt.Finish() // successful `true` but tx result `false` _, err := tt.HorizonDB.Exec( `UPDATE history_transactions SET successful = true WHERE transaction_hash = 'aa168f12124b7c196c0adaee7c73a64d37f99428cacb59a91ff389626845e7cf'`, ) tt.Require.NoError(err) q := &Q{tt.HorizonSession()} query := q.Operations(). ForAccount("GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2"). IncludeFailed() _, _, err = query.Fetch() tt.Assert.Error(err) tt.Assert.Contains(err.Error(), "Corrupted data! `successful=true` but returned transaction is not success") } func TestExtraChecksOperationsTransactionSuccessfulFalseResultTrue(t *testing.T) { tt := test.Start(t).Scenario("failed_transactions") defer tt.Finish() // successful `false` but tx result `true` _, err := tt.HorizonDB.Exec( `UPDATE history_transactions SET successful = false WHERE transaction_hash = 'a2dabf4e9d1642722602272e178a37c973c9177b957da86192a99b3e9f3a9aa4'`, ) tt.Require.NoError(err) q := &Q{tt.HorizonSession()} query := q.Operations(). ForAccount("GBXGQJWVLWOYHFLVTKWV5FGHA3LNYY2JQKM7OAJAUEQFU6LPCSEFVXON"). IncludeFailed() _, _, err = query.Fetch() tt.Assert.Error(err) tt.Assert.Contains(err.Error(), "Corrupted data! `successful=false` but returned transaction is success") } func assertOperationMatchesTransaction(tt *test.T, operation Operation, transaction Transaction) { tt.Assert.Equal(operation.TransactionID, transaction.ID) tt.Assert.Equal(operation.TransactionHash, transaction.TransactionHash) tt.Assert.Equal(operation.TxResult, transaction.TxResult) tt.Assert.Equal(operation.TransactionSuccessful, transaction.Successful) } // TestOperationIncludeTransactions tests that transactions are included when fetching records from the db. func TestOperationIncludeTransactions(t *testing.T) { tt := test.Start(t).Scenario("failed_transactions") defer tt.Finish() accountID := "GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2" q := &Q{tt.HorizonSession()} query := q.Operations(). IncludeTransactions(). ForAccount(accountID) operations, transactions, err := query.Fetch() tt.Assert.NoError(err) tt.Assert.Len(transactions, 3) tt.Assert.Len(transactions, len(operations)) for i := range operations { operation := operations[i] transaction := transactions[i] assertOperationMatchesTransaction(tt, operation, transaction) } withoutTransactionsQuery := (&Q{tt.HorizonSession()}).Operations(). ForAccount(accountID) var expectedTransactions []Transaction err = (&Q{tt.HorizonSession()}).Transactions().ForAccount(accountID).Select(&expectedTransactions) tt.Assert.NoError(err) expectedOperations, _, err := withoutTransactionsQuery.Fetch() tt.Assert.NoError(err) tt.Assert.Equal(operations, expectedOperations) tt.Assert.Equal(transactions, expectedTransactions) op, transaction, err := q.OperationByID(true, expectedOperations[0].ID) tt.Assert.NoError(err) tt.Assert.Equal(op, expectedOperations[0]) tt.Assert.Equal(*transaction, expectedTransactions[0]) assertOperationMatchesTransaction(tt, op, *transaction) _, err = q.Exec(sq.Delete("history_transactions")) tt.Assert.NoError(err) _, _, err = q.OperationByID(true, 17179877377) tt.Assert.Error(err) } func TestValidateTransactionForOperation(t *testing.T) { tt := test.Start(t).Scenario("failed_transactions") selectTransactionCopy := selectTransaction defer func() { selectTransaction = selectTransactionCopy tt.Finish() }() selectTransaction = sq.Select( "ht.transaction_hash, " + "ht.tx_result, " + "COALESCE(ht.successful, true) as successful"). From("history_transactions ht") accountID := "GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2" q := &Q{tt.HorizonSession()} query := q.Operations(). IncludeTransactions(). ForAccount(accountID) _, _, err := query.Fetch() tt.Assert.Error(err) tt.Assert.EqualError(err, "transaction with id 17179877376 could not be found") _, _, err = q.OperationByID(true, 17179877377) tt.Assert.Error(err) tt.Assert.EqualError(err, "transaction id 0 does not match transaction id in operation 17179877376") selectTransaction = sq.Select( "ht.id, " + "ht.transaction_hash, " + "COALESCE(ht.successful, true) as successful"). From("history_transactions ht") query = q.Operations(). IncludeTransactions(). ForAccount(accountID) _, _, err = query.Fetch() tt.Assert.Error(err) tt.Assert.EqualError(err, "transaction result does not match transaction result in operation AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAA=") _, _, err = q.OperationByID(true, 17179877377) tt.Assert.Error(err) tt.Assert.EqualError(err, "transaction result does not match transaction result in operation AAAAAAAAAGQAAAAAAAAAAQAAAAAAAAABAAAAAAAAAAA=") selectTransaction = sq.Select( "ht.id, " + "ht.tx_result, " + "COALESCE(ht.successful, true) as successful"). From("history_transactions ht") query = q.Operations(). IncludeTransactions(). ForAccount(accountID) _, _, err = query.Fetch() tt.Assert.Error(err) tt.Assert.EqualError(err, "transaction hash does not match transaction hash in operation 1c454630267aa8767ec8c8e30450cea6ba660145e9c924abb75d7a6669b6c28a") _, _, err = q.OperationByID(true, 17179877377) tt.Assert.Error(err) tt.Assert.EqualError(err, "transaction hash does not match transaction hash in operation 1c454630267aa8767ec8c8e30450cea6ba660145e9c924abb75d7a6669b6c28a") selectTransaction = sq.Select( "ht.id, " + "ht.tx_result, " + "ht.transaction_hash"). From("history_transactions ht") query = q.Operations(). IncludeTransactions(). ForAccount(accountID) _, _, err = query.Fetch() tt.Assert.Error(err) tt.Assert.EqualError(err, "transaction successful flag false does not match transaction successful flag in operation true") _, _, err = q.OperationByID(true, 17179877377) tt.Assert.Error(err) tt.Assert.EqualError(err, "transaction successful flag false does not match transaction successful flag in operation true") }
{ "pile_set_name": "Github" }
/* Copyright 2016 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Package policy is for any kind of policy object. Suitable examples, even if // they aren't all here, are PodDisruptionBudget, PodSecurityPolicy, // NetworkPolicy, etc. package v1beta1
{ "pile_set_name": "Github" }
// RUN: %clang -target x86_64-apple-macosx10.13 -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // // RUN: %clang -target arm64-apple-ios10 -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // // RUN: %clang -target arm64-apple-tvos10 -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // // RUN: %clang -target thumbv7-apple-watchos3 -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // // RUN: %clang -target x86_64-apple-darwin -mios-simulator-version-min=10 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // // RUN: %clang -target x86_64-apple-darwin -mtvos-simulator-version-min=10 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // // RUN: %clang -target x86_64-apple-darwin -mwatchos-simulator-version-min=3 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=UNAVAILABLE // // UNAVAILABLE: "-faligned-alloc-unavailable" // RUN: %clang -target x86_64-apple-macosx10.14 -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // // RUN: %clang -target arm64-apple-ios11 -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // // RUN: %clang -target arm64-apple-tvos11 -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // // RUN: %clang -target armv7k-apple-watchos4 -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // // RUN: %clang -target x86_64-unknown-linux-gnu -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // // RUN: %clang -target x86_64-apple-darwin -mios-simulator-version-min=11 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // // RUN: %clang -target x86_64-apple-darwin -mtvos-simulator-version-min=11 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // // RUN: %clang -target x86_64-apple-darwin -mwatchos-simulator-version-min=4 \ // RUN: -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // // Check that passing -faligned-allocation or -fno-aligned-allocation stops the // driver from passing -faligned-alloc-unavailable to cc1. // // RUN: %clang -target x86_64-apple-macosx10.13 -faligned-allocation -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // // RUN: %clang -target x86_64-apple-macosx10.13 -fno-aligned-allocation -c -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=AVAILABLE // AVAILABLE-NOT: "-faligned-alloc-unavailable"
{ "pile_set_name": "Github" }
# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=6 DESCRIPTION="A simple, object-oriented, PHP Redmine API client" HOMEPAGE="https://github.com/kbsali/php-redmine-api" SRC_URI="https://github.com/kbsali/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" LICENSE="MIT" SLOT="0" KEYWORDS="amd64 x86" IUSE="test" RESTRICT="!test? ( test )" RDEPEND="dev-lang/php:*[curl,json,simplexml]" DEPEND="test? ( ${RDEPEND} <dev-php/phpunit-6 )" src_install() { insinto "/usr/share/php/${PN}" doins -r lib dodoc example.php README.markdown } src_test() { phpunit || die "test suite failed" } pkg_postinst() { elog "${PN} has been installed in /usr/share/php/${PN}/." elog "To use it in a script, require('${PN}/lib/autoload.php'), and then" elog "use the Redmine\\Client class normally. Most of the examples in the" elog "documentation should work without modification." }
{ "pile_set_name": "Github" }
//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // test bitset<N>& reset(size_t pos); #include <bitset> #include <cassert> #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wtautological-compare" template <std::size_t N> void test_reset_one() { std::bitset<N> v; try { v.set(); v.reset(50); if (50 >= v.size()) assert(false); for (unsigned i = 0; i < v.size(); ++i) if (i == 50) assert(!v[i]); else assert(v[i]); } catch (std::out_of_range&) { } } int main() { test_reset_one<0>(); test_reset_one<1>(); test_reset_one<31>(); test_reset_one<32>(); test_reset_one<33>(); test_reset_one<63>(); test_reset_one<64>(); test_reset_one<65>(); test_reset_one<1000>(); }
{ "pile_set_name": "Github" }
(define $ret3 (/ (+ (* 8 a (sin θ) y) (* -4 a^2 (sin θ) y) (* -4 (sin θ) y)) (* 45 '(+ 1 (* -1 y))^5))) (define $ret4 (- (let {[$θ π]} (/ (+ (* 8 a (sin θ) y) (* -4 a^2 (sin θ) y) (* -4 (sin θ) y)) (* 45 '(+ 1 (* -1 y))^5))) (let {[$θ 0]} (/ (+ (* 8 a (sin θ) y) (* -4 a^2 (sin θ) y) (* -4 (sin θ) y)) (* 45 '(+ 1 (* -1 y))^5))))) "ret4" ret4 ;(/ (+ (* 16 a y) (* -8 a^2 y) (* -8 y)) (* 45 '(+ 1 (* -1 y))^5)) (define $ret5 (d/d (/ (* 2 (+ 1 (* -1 a))^2 (- 1 (* 4 y))) (* 135 '(+ 1 (* -1 y))^4)) y)) "ret5" ret5 (define $ret6 (/ (expand-all' (numerator ret5)) (denominator ret5))) "ret6" ret6 (define $ret7 (/ (* 2 (+ 1 (* -1 a))^2 (- 1 (* 4 y))) (* 135 '(+ 1 (* -1 y))^4))) (define $y1 (* (/ 1 2) (+ 1 (* -1 λ) (* -1 (sqrt (- 1 (/ λ^2 3))))))) (define $y2 (+ y1 λ)) (let {[$y y2]} ret7) (let {[$y y1]} ret7) (define $ret8 (- (let {[$y y2]} (/ (* 2 (+ 1 (* -1 a))^2 (- 1 (* 4 y))) (* 135 '(+ 1 (* -1 y))^4))) (let {[$y y1]} (/ (* 2 (+ 1 (* -1 a))^2 (- 1 (* 4 y))) (* 135 '(+ 1 (* -1 y))^4))))) "ret8" ret8 ;(/ (+ (* -6 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 12 a '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 24 a λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -8 a (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -6 a^2 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 a^2 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 4 a^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 6 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 a '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 24 a λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 8 a (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 6 a^2 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 a^2 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -4 a^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)) (* 405 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)) (define $ret9 (let {[$a (- (* 3 y1^2) (* 2 y2^3))]} (/ (+ (* -6 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 12 a '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 24 a λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -8 a (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -6 a^2 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 a^2 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 4 a^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 6 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 a '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 24 a λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 8 a (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 6 a^2 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -12 a^2 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -4 a^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)) (* 405 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)))) "ret9" ret9 ;(/ (+ (* -324 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 54 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -108 λ (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 5742 λ^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -17793 λ^2 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 5544 λ^3 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 162 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -15390 λ^3 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 1548 λ^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 2808 λ^5 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 912 λ^6 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 360 λ^4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 96 λ^7 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -288 λ^5 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -32 λ^6 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -324 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -54 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -108 λ (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -5742 λ^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 17793 λ^2 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 2520 λ^3 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -162 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -6966 λ^3 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -8028 λ^4 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 216 λ^5 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 816 λ^6 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 1368 λ^4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 96 λ^7 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 288 λ^5 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 32 λ^6 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)) (* 21870 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)) (define $ret10 (let {[$λ (/ (* 3 q) (* 2 p))]} (/ (+ (* -324 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 54 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -108 λ (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 5742 λ^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -17793 λ^2 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 5544 λ^3 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 162 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -15390 λ^3 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 1548 λ^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 2808 λ^5 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 912 λ^6 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 360 λ^4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 96 λ^7 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -288 λ^5 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -32 λ^6 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -324 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -54 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -108 λ (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -5742 λ^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 17793 λ^2 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 2520 λ^3 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -162 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -6966 λ^3 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -8028 λ^4 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 216 λ^5 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 816 λ^6 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 1368 λ^4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 96 λ^7 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 288 λ^5 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 32 λ^6 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)) (* 21870 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)))) "ret10" ret10 (define $ret11 (let* {[$p 7] [$q 3] [$λ (/ (* 3 q) (* 2 p))]} (* (/ (+ (* -324 λ '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 54 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -108 λ (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 5742 λ^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -17793 λ^2 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 5544 λ^3 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 162 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -15390 λ^3 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 1548 λ^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 2808 λ^5 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 912 λ^6 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 360 λ^4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 96 λ^7 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -288 λ^5 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -32 λ^6 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -324 λ '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -54 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -108 λ (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -5742 λ^2 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 17793 λ^2 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 2520 λ^3 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -162 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -6966 λ^3 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* -8028 λ^4 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 216 λ^5 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 816 λ^6 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 1368 λ^4 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 96 λ^7 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 288 λ^5 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4) (* 32 λ^6 (sqrt (+ 9 (* -3 λ^2))) '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)) (* 21870 '(/ (+ 3 (* -3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4 '(/ (+ 3 (* 3 λ) (sqrt (+ 9 (* -3 λ^2)))) 6)^4)) (* 2^4 π^4 (/ q (+ (* 3 q^2) (* -2 p^2) (* p (sqrt (+ (* 4 p^2) (* -3 q^2)))))))))) (expand-all ret11) ;(/ (* -1849 π^4) 22050)
{ "pile_set_name": "Github" }