text
stringlengths 1
22.8M
|
|---|
```python
Following PEP 8 styling guideline.
A simple way to select a random item from a `list/tuple` data stucture
Using a `list` as a `stack`
`bytes` type
Enhance your `tuple`s
```
|
```cuda
// your_sha256_hash-------------------------
// NVEnc by rigaya
// your_sha256_hash-------------------------
//
//
//
// 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.
//
// your_sha256_hash--------------------------
#include <map>
#include <array>
#include "convert_csp.h"
#include "NVEncFilterOverlay.h"
#include "NVEncParam.h"
#pragma warning (push)
#pragma warning (disable: 4819)
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#pragma warning (pop)
#include "rgy_cuda_util_kernel.h"
template<typename Type, int bit_depth>
__global__ void kernel_run_overlay_plane(
uint8_t *__restrict__ pDst, const int dstPitch,
const uint8_t *__restrict__ pSrc, const int srcPitch, const int width, const int height,
const uint8_t *__restrict__ pOverlay, const int overlayPitch,
const uint8_t *__restrict__ pAlpha, const int alphaPitch, const int overlayWidth, const int overlayHeight,
const int overlayPosX, const int overlayPosY) {
const int ix = blockIdx.x * blockDim.x + threadIdx.x;
const int iy = blockIdx.y * blockDim.y + threadIdx.y;
if (ix < width && iy < height) {
int ret = *(Type *)(pSrc + iy * srcPitch + ix * sizeof(Type));
if ( overlayPosX <= ix && ix < overlayPosX + overlayWidth
&& overlayPosY <= iy && iy < overlayPosY + overlayHeight) {
const int overlaySrc = *(Type *)(pOverlay + (iy - overlayPosY) * overlayPitch + (ix - overlayPosX) * sizeof(Type) );
const int overlayAlpha = *(uint8_t *)(pAlpha + (iy - overlayPosY) * alphaPitch + (ix - overlayPosX) * sizeof(uint8_t));
const float overlayAlphaF = overlayAlpha / 255.0f;
float blend = overlaySrc * overlayAlphaF + ret * (1.0f - overlayAlphaF);
ret = (int)(blend + 0.5f);
}
Type *ptr = (Type *)(pDst + iy * dstPitch + ix * sizeof(Type));
ptr[0] = (Type)clamp(ret, 0, (1 << bit_depth) - 1);
}
}
template<typename Type, int bit_depth>
RGY_ERR run_overlay_plane(
uint8_t *pDst, const int dstPitch,
const uint8_t *pSrc, const int srcPitch, const int width, const int height,
const uint8_t *pOverlay, const int overlayPitch,
const uint8_t *pAlpha, const int alphaPitch, const int overlayWidth, const int overlayHeight,
const int overlayPosX, const int overlayPosY,
cudaStream_t stream) {
dim3 blockSize(64, 8);
dim3 gridSize(divCeil(width, blockSize.x), divCeil(height, blockSize.y));
kernel_run_overlay_plane<Type, bit_depth> << <gridSize, blockSize, 0, stream >> > (
pDst, dstPitch,
pSrc, srcPitch, width, height,
pOverlay, overlayPitch,
pAlpha, alphaPitch, overlayWidth, overlayHeight,
overlayPosX, overlayPosY);
return err_to_rgy(cudaGetLastError());
}
RGY_ERR NVEncFilterOverlay::overlayFrame(RGYFrameInfo *pOutputFrame, const RGYFrameInfo *pInputFrame, cudaStream_t stream) {
auto prm = std::dynamic_pointer_cast<NVEncFilterParamOverlay>(m_param);
if (!prm) {
AddMessage(RGY_LOG_ERROR, _T("Invalid parameter type.\n"));
return RGY_ERR_INVALID_PARAM;
}
static const std::map<RGY_CSP, decltype(run_overlay_plane<uint8_t, 8>)*> func_list = {
{ RGY_CSP_YV12, run_overlay_plane<uint8_t, 8> },
{ RGY_CSP_YV12_16, run_overlay_plane<uint16_t, 16> },
{ RGY_CSP_YUV444, run_overlay_plane<uint8_t, 8> },
{ RGY_CSP_YUV444_16, run_overlay_plane<uint16_t, 16> },
};
if (func_list.count(pInputFrame->csp) == 0) {
AddMessage(RGY_LOG_ERROR, _T("unsupported csp %s.\n"), RGY_CSP_NAMES[pInputFrame->csp]);
return RGY_ERR_UNSUPPORTED;
}
for (int iplane = 0; iplane < RGY_CSP_PLANES[pInputFrame->csp]; iplane++) {
const auto planeTarget = (RGY_PLANE)iplane;
auto planeOut = getPlane(pOutputFrame, planeTarget);
const auto planeIn = getPlane(pInputFrame, planeTarget);
const auto planeFrame = getPlane(m_frame.inputPtr, planeTarget);
const auto planeAlpha = getPlane(m_alpha.inputPtr, planeTarget);
const auto posX = (planeTarget != RGY_PLANE_Y && RGY_CSP_CHROMA_FORMAT[pInputFrame->csp] == RGY_CHROMAFMT_YUV420) ? prm->overlay.posX >> 1 : prm->overlay.posX;
const auto posY = (planeTarget != RGY_PLANE_Y && RGY_CSP_CHROMA_FORMAT[pInputFrame->csp] == RGY_CHROMAFMT_YUV420) ? prm->overlay.posY >> 1 : prm->overlay.posY;
auto sts = func_list.at(pInputFrame->csp)(
planeOut.ptr[0], planeOut.pitch[0],
planeIn.ptr[0], planeIn.pitch[0], planeIn.width, planeIn.height,
planeFrame.ptr[0], planeFrame.pitch[0],
planeAlpha.ptr[0], planeAlpha.pitch[0], planeAlpha.width, planeAlpha.height,
posX, posY, stream);
if (sts != RGY_ERR_NONE) {
AddMessage(RGY_LOG_ERROR, _T("error at overlay(%s): %s.\n"),
RGY_CSP_NAMES[pInputFrame->csp],
get_err_mes(sts));
return sts;
}
}
return RGY_ERR_NONE;
}
```
|
```xml
import { basename } from 'path';
import { Node, Project, SyntaxKind } from 'ts-morph';
/**
* For Hydrogen v2, the `server.ts` file exports a signature like:
*
* ```
* export default {
* async fetch(
* request: Request,
* env: Env,
* executionContext: ExecutionContext,
* ): Promise<Response>;
* }
* ```
*
* Here we parse the AST of that file so that we can:
*
* 1. Convert the signature to be compatible with Vercel Edge functions
* (i.e. `export default (res: Response): Promise<Response>`).
*
* 2. Track usages of the `env` parameter which (which gets removed),
* so that we can create that object based on `process.env`.
*/
export function patchHydrogenServer(
project: Project,
serverEntryPoint: string
) {
const sourceFile = project.addSourceFileAtPath(serverEntryPoint);
const defaultExportSymbol = sourceFile.getDescendantsOfKind(
SyntaxKind.ExportAssignment
)[0];
const envProperties: string[] = [];
if (!defaultExportSymbol) {
console.log(
`WARN: No default export found in "${basename(serverEntryPoint)}"`
);
return;
}
const objectLiteral = defaultExportSymbol.getFirstChildByKind(
SyntaxKind.ObjectLiteralExpression
);
if (!Node.isObjectLiteralExpression(objectLiteral)) {
console.log(
`WARN: Default export in "${basename(
serverEntryPoint
)}" does not conform to Oxygen syntax`
);
return;
}
const fetchMethod = objectLiteral.getProperty('fetch');
if (!fetchMethod || !Node.isMethodDeclaration(fetchMethod)) {
console.log(
`WARN: Default export in "${basename(
serverEntryPoint
)}" does not conform to Oxygen syntax`
);
return;
}
const parameters = fetchMethod.getParameters();
// Find usages of the env object within the fetch method
const envParam = parameters[1];
const envParamName = envParam.getName();
if (envParam) {
fetchMethod.forEachDescendant(node => {
if (
Node.isPropertyAccessExpression(node) &&
node.getExpression().getText() === envParamName
) {
envProperties.push(node.getName());
}
});
}
// Vercel does not support the Web Cache API, so find
// and replace `caches.open()` calls with `undefined`
fetchMethod.forEachDescendant(node => {
if (
Node.isCallExpression(node) &&
node.getExpression().getText() === 'caches.open'
) {
node.replaceWithText(`undefined /* ${node.getText()} */`);
}
});
// Remove the 'env' parameter to match Vercel's Edge signature
parameters.splice(1, 1);
// Construct the new function with the parameters and body of the original fetch method
const newFunction = `export default async function(${parameters
.map(p => p.getText())
.join(', ')}) ${fetchMethod.getBody()!.getText()}`;
defaultExportSymbol.replaceWithText(newFunction);
const defaultEnvVars = {
SESSION_SECRET: 'foobar',
PUBLIC_STORE_DOMAIN: 'mock.shop',
};
const envCode = `const env = { ${envProperties
.map(name => `${name}: process.env.${name}`)
.join(', ')} };\n${Object.entries(defaultEnvVars)
.map(
([k, v]) =>
`if (!env.${k}) { env.${k} = ${JSON.stringify(
v
)}; console.warn('Warning: ${JSON.stringify(
k
)} env var not set - using default value ${JSON.stringify(v)}'); }`
)
.join('\n')}`;
const updatedCodeString = sourceFile.getFullText();
return `${envCode}\n${updatedCodeString}`;
}
```
|
Alec Ewart Glassey (29 December 1887 – 26 June 1970) was a British Liberal politician. He was Member of Parliament for East Dorset from 1929 to 1931.
Early life
Glassey was born at Normanton, Yorkshire, the son of the Reverend William Glassey, a Congregational Minister. He was educated at Penistone Grammar School. In 1910 he married Mary Longbottom. They had three daughters, Margaret, Gwen and Marianne. He served in the British Army throughout the First World War as a subaltern in the Highland Light Infantry and was mentioned in despatches.
Liberal Member of Parliament
Glassey contested East Dorset at the 1924 general election coming second behind the Conservative. The Liberals were not well organised nationally in 1924 and no longer had the uniting issue of Free Trade to provide an anti-Conservative focus as they had in 1923. Garry Tregidga comments that "...except for individuals like Lloyd George [the Liberals] fail[ed] to provide an inspiring programme for office..." However he also identifies Glassey as a local exception to this poor showing, who against the regional and national trends raised the party's share of the vote in a three-cornered contest. In contrast to many Liberal candidates, Glassey fought a vigorous and positive campaign. His election addresses concentrated on social issues and drew on Lloyd George's plans to develop the coal and power industries. This foreshadowed the policy issues the Liberal Party would put forward in the 1929 general election when Glassey fought the seat again, this time beating the sitting Tory MP, Gordon Ralph Hall Caine, albeit by the narrow majority of 277. One of the political issues which Glassey supported was the unification of the three service ministries, the War Office, the Admiralty and the Air Ministry into a single Ministry of Defence, although this did not come about until as late as 1964. Glassey saw unification as a positive step on the road to disarmament and to promote economy. In 1931 Glassey became a minister in the National Government, a Lord Commissioner of the Treasury in effect a government whip.
Liberal National
In the Liberal split of September 1931, when Sir John Simon formed the Liberal National group in Parliament to continue giving support to the National Government, Glassey decided at a late stage to come down on the Liberal National side, a fact that was surprising in the light of his earlier loyalty to the leadership of Sir Herbert Samuel – indeed one historian describes Glassey as a Samuelite even at the time of the general election and in the face of his description of himself as "THE National Government candidate". In fact Glassey proposed to stand as a candidate without reference to any party in 1931 and he received a message of support from Prime Minister Ramsay MacDonald before the election. Glassey said he stood as a National Government candidate endorsing every word in the Prime Minister's manifesto. The likely explanation for his choosing in the end actually to join the Liberal Nationals is that he realised his majority was vulnerable to the Conservative revival and was hoping the Unionists would stand aside for him as a supporter of the National Government. His wife spoke at election meetings on behalf of Samuelite candidates in other West Country constituencies and once the election was over, Glassey himself returned to the Liberals, becoming Chairman of the Western Counties Federation. In fact the decision of the Conservatives to oppose Glassey caused some dissension in local Tory ranks as the Conservative Party at national level had agreed to support National Government candidates but not enough to prevent the former MP Hall Caine standing against him. Against the trend for National successes in 1931 across the country and the West Country, Glassey lost his seat back to Hall Caine.
Outside Parliament
Outside Parliament Glassey was an important figure in the Congregational Church. He was Chairman of the Congregational Union of England and Wales from 1941 to 1942, Co-Treasurer from 1953 to 1957 and a Member of the Church Council. He was a member of the Commonwealth Missionary Society from 1945 to 1947. From 1961 to 1962 he was Director of Congregational Insurance Co. Ltd and as part of his work for the Church he oversaw the collection of over £500,000 for re-building bombed churches. He also served as a Justice of the Peace in Poole, Dorset.
He was also the uncle of author David Cornwell, whose pen name was John le Carré.
References
External links
1887 births
1970 deaths
Liberal Party (UK) MPs for English constituencies
UK MPs 1929–1931
Politicians from Normanton, West Yorkshire
British Army personnel of World War I
Highland Light Infantry officers
English Congregationalists
People educated at Penistone Grammar School
|
The Utah sucker (Catostomus ardens) is a species of freshwater fish in the family Catostomidae found in the upper Snake River and the Lake Bonneville areas of western North America where it lives in a wide range of habitats. It is a large sucker growing up to long. It is generally blackish above, vaguely streaked and blotched, with a white belly. A narrow rosy lateral band extends backwards from the head. The mouth has thick lips and is on the underside of the head. Some populations are in decline because of anthropogenic factors but overall this fish is not threatened.
Description
This is a large fish that can grow up to 25.5" (65 cm) in length. Relatively elongate for a sucker, the back area between the head and dorsal fin is somewhat elevated. The mouth is entirely under the snout, with thick lips, of which the upper lip has eight rows of coarse papillae, the second and third rows from the inside being significantly larger. Color is generally blackish above, with a faint pattern of blotches or spots, a narrow rosy band on the anterior part of each side, while the underside is white. The long anal fin is placed well back, the tip reaching as far back as the base of the caudal fin. The anal fin has seven rays, while the dorsal has 13 rays. Recent genetic studies have revealed deep, but morphologically cryptic, population subdivision (about 4.5% sequence divergence) between drainages of the ancient Snake River and the Bonneville Basin.
Distribution
The Utah sucker is native to the upper Snake River and the Lake Bonneville areas of western North America. It lives in a variety of habitats in its range, being found in lakes, rivers, and streams, in warm or cold water, and over substrates of silt, sand, gravel, or rocks, preferably in the vicinity of vegetation.
Status
Some populations are in decline due to anthropogenic factors, including habitat destruction, water-flow diversion, migration barriers, chemical pollutants, and competition with exotic species.
In 1881, David Starr Jordan and Charles Henry Gilbert observed that this sucker "occurs in Utah Lake in numbers which are simply enormous"; the population seems to have boomed and crashed several times since then.
Taxonomic nomenclature for this species is disputable, with Catostomus ardens in Utah Lake being confused with the June sucker, Chasmistes liorus, and the name Catostomus fecundus being used for a time.
References
Ira La Rivers, Fishes and Fisheries of Nevada (University of Nevada Press, 1994), pp. 344–349
Geographic patterns of genetic variation in Utah sucker. Utah sucker genetics.
Utah sucker
Endemic fish of the United States
Fish of the Western United States
Freshwater fish of the United States
Fauna of the Northwestern United States
Fauna of the Rocky Mountains
Fish described in 1881
Taxa named by David Starr Jordan
Taxa named by Charles Henry Gilbert
|
Transmembrane channel like 3 is a protein that in humans is encoded by the TMC3 gene.
References
Further reading
|
```python
# -*- coding: utf-8 -*-
"""
flask.ext
~~~~~~~~~
Redirect imports for extensions. This module basically makes it possible
for us to transition from flaskext.foo to flask_foo without having to
force all extensions to upgrade at the same time.
When a user does ``from flask.ext.foo import bar`` it will attempt to
import ``from flask_foo import bar`` first and when that fails it will
try to import ``from flaskext.foo import bar``.
We're switching from namespace packages because it was just too painful for
everybody involved.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
def setup():
from ..exthook import ExtensionImporter
importer = ExtensionImporter(['flask_%s', 'flaskext.%s'], __name__)
importer.install()
setup()
del setup
```
|
```html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Stream Types</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Beast">
<link rel="up" href="../using_io.html" title="Using I/O">
<link rel="prev" href="asio_refresher.html" title="Asio Refresher">
<link rel="next" href="buffer_types.html" title="Buffer Types">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="path_to_url">People</a></td>
<td align="center"><a href="path_to_url">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="asio_refresher.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../using_io.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="buffer_types.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="beast.using_io.stream_types"></a><a class="link" href="stream_types.html" title="Stream Types">Stream Types</a>
</h3></div></div></div>
<p>
A <a class="link" href="../concepts/streams.html" title="Streams"><span class="bold"><strong>Stream</strong></span></a>
is a communication channel where data is transferred as an ordered sequence
of octet buffers. Streams are either synchronous or asynchronous, and may
allow reading, writing, or both. Note that a particular type may model more
than one concept. For example, the Asio types <a href="../../../../../../doc/html/boost_asio/reference/ip__tcp/socket.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">ip</span><span class="special">::</span><span class="identifier">tcp</span><span class="special">::</span><span class="identifier">socket</span></code></a>
and <a href="../../../../../../doc/html/boost_asio/reference/ssl__stream.html" target="_top"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">ssl</span><span class="special">::</span><span class="identifier">stream</span></code></a>
support both <a class="link" href="../concepts/streams.html#beast.concepts.streams.SyncStream"><span class="bold"><strong>SyncStream</strong></span></a> and <a class="link" href="../concepts/streams.html#beast.concepts.streams.AsyncStream"><span class="bold"><strong>AsyncStream</strong></span></a>. All stream algorithms in Beast
are declared as template functions using these concepts:
</p>
<div class="table">
<a name="beast.using_io.stream_types.stream_concepts"></a><p class="title"><b>Table 1.2. Stream Concepts</b></p>
<div class="table-contents"><table class="table" summary="Stream Concepts">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Concept
</p>
</th>
<th>
<p>
Description
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<a href="../../../../../../doc/html/boost_asio/reference/SyncReadStream.html" target="_top"><span class="bold"><strong>SyncReadStream</strong></span></a>
</p>
</td>
<td>
<p>
Supports buffer-oriented blocking reads.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a href="../../../../../../doc/html/boost_asio/reference/SyncWriteStream.html" target="_top"><span class="bold"><strong>SyncWriteStream</strong></span></a>
</p>
</td>
<td>
<p>
Supports buffer-oriented blocking writes.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../concepts/streams.html#beast.concepts.streams.SyncStream"><span class="bold"><strong>SyncStream</strong></span></a>
</p>
</td>
<td>
<p>
A stream supporting buffer-oriented blocking reads and writes.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a href="../../../../../../doc/html/boost_asio/reference/AsyncReadStream.html" target="_top"><span class="bold"><strong>AsyncReadStream</strong></span></a>
</p>
</td>
<td>
<p>
Supports buffer-oriented asynchronous reads.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a href="../../../../../../doc/html/boost_asio/reference/AsyncWriteStream.html" target="_top"><span class="bold"><strong>AsyncWriteStream</strong></span></a>
</p>
</td>
<td>
<p>
Supports buffer-oriented asynchronous writes.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../concepts/streams.html#beast.concepts.streams.AsyncStream"><span class="bold"><strong>AsyncStream</strong></span></a>
</p>
</td>
<td>
<p>
A stream supporting buffer-oriented asynchronous reads and writes.
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>
These template metafunctions check whether a given type meets the requirements
for the various stream concepts, and some additional useful utilities. The
library uses these type checks internally and also provides them as public
interfaces so users may use the same techniques to augment their own code.
The use of these type checks helps provide more concise errors during compilation:
</p>
<div class="table">
<a name="beast.using_io.stream_types.stream_type_checks"></a><p class="title"><b>Table 1.3. Stream Type Checks</b></p>
<div class="table-contents"><table class="table" summary="Stream Type Checks">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Name
</p>
</th>
<th>
<p>
Description
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<a class="link" href="../ref/boost__beast__get_lowest_layer.html" title="get_lowest_layer"><code class="computeroutput"><span class="identifier">get_lowest_layer</span></code></a>
</p>
</td>
<td>
<p>
Returns <code class="computeroutput"><span class="identifier">T</span><span class="special">::</span><span class="identifier">lowest_layer_type</span></code> if it exists,
else returns <code class="computeroutput"><span class="identifier">T</span></code>.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ref/boost__beast__has_get_executor.html" title="has_get_executor"><code class="computeroutput"><span class="identifier">has_get_executor</span></code></a>
</p>
</td>
<td>
<p>
Determine if the <code class="computeroutput"><span class="identifier">get_executor</span></code>
member function is present.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ref/boost__beast__is_async_read_stream.html" title="is_async_read_stream"><code class="computeroutput"><span class="identifier">is_async_read_stream</span></code></a>
</p>
</td>
<td>
<p>
Determine if a type meets the requirements of <a href="../../../../../../doc/html/boost_asio/reference/AsyncReadStream.html" target="_top"><span class="bold"><strong>AsyncReadStream</strong></span></a>.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ref/boost__beast__is_async_stream.html" title="is_async_stream"><code class="computeroutput"><span class="identifier">is_async_stream</span></code></a>
</p>
</td>
<td>
<p>
Determine if a type meets the requirements of both <a href="../../../../../../doc/html/boost_asio/reference/AsyncReadStream.html" target="_top"><span class="bold"><strong>AsyncReadStream</strong></span></a> and <a href="../../../../../../doc/html/boost_asio/reference/AsyncWriteStream.html" target="_top"><span class="bold"><strong>AsyncWriteStream</strong></span></a>.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ref/boost__beast__is_async_write_stream.html" title="is_async_write_stream"><code class="computeroutput"><span class="identifier">is_async_write_stream</span></code></a>
</p>
</td>
<td>
<p>
Determine if a type meets the requirements of <a href="../../../../../../doc/html/boost_asio/reference/AsyncWriteStream.html" target="_top"><span class="bold"><strong>AsyncWriteStream</strong></span></a>.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ref/boost__beast__is_completion_handler.html" title="is_completion_handler"><code class="computeroutput"><span class="identifier">is_completion_handler</span></code></a>
</p>
</td>
<td>
<p>
Determine if a type meets the requirements of <a href="../../../../../../doc/html/boost_asio/reference/CompletionHandler.html" target="_top"><span class="bold"><strong>CompletionHandler</strong></span></a>, and is callable
with a specified signature.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ref/boost__beast__is_sync_read_stream.html" title="is_sync_read_stream"><code class="computeroutput"><span class="identifier">is_sync_read_stream</span></code></a>
</p>
</td>
<td>
<p>
Determine if a type meets the requirements of <a href="../../../../../../doc/html/boost_asio/reference/SyncReadStream.html" target="_top"><span class="bold"><strong>SyncReadStream</strong></span></a>.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ref/boost__beast__is_sync_stream.html" title="is_sync_stream"><code class="computeroutput"><span class="identifier">is_sync_stream</span></code></a>
</p>
</td>
<td>
<p>
Determine if a type meets the requirements of both <a href="../../../../../../doc/html/boost_asio/reference/SyncReadStream.html" target="_top"><span class="bold"><strong>SyncReadStream</strong></span></a> and <a href="../../../../../../doc/html/boost_asio/reference/SyncWriteStream.html" target="_top"><span class="bold"><strong>SyncWriteStream</strong></span></a>.
</p>
</td>
</tr>
<tr>
<td>
<p>
<a class="link" href="../ref/boost__beast__is_sync_write_stream.html" title="is_sync_write_stream"><code class="computeroutput"><span class="identifier">is_sync_write_stream</span></code></a>
</p>
</td>
<td>
<p>
Determine if a type meets the requirements of <a href="../../../../../../doc/html/boost_asio/reference/SyncWriteStream.html" target="_top"><span class="bold"><strong>SyncWriteStream</strong></span></a>.
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>
Using the type checks with <code class="computeroutput"><span class="keyword">static_assert</span></code>
on function or class template types will provide users with helpful error
messages and prevent undefined behaviors. This example shows how a template
function which writes to a synchronous stream may check its argument:
</p>
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">SyncWriteStream</span><span class="special">></span>
<span class="keyword">void</span> <span class="identifier">write_string</span><span class="special">(</span><span class="identifier">SyncWriteStream</span><span class="special">&</span> <span class="identifier">stream</span><span class="special">,</span> <span class="identifier">string_view</span> <span class="identifier">s</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">static_assert</span><span class="special">(</span><span class="identifier">is_sync_write_stream</span><span class="special"><</span><span class="identifier">SyncWriteStream</span><span class="special">>::</span><span class="identifier">value</span><span class="special">,</span>
<span class="string">"SyncWriteStream requirements not met"</span><span class="special">);</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">write</span><span class="special">(</span><span class="identifier">stream</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">const_buffer</span><span class="special">(</span><span class="identifier">s</span><span class="special">.</span><span class="identifier">data</span><span class="special">(),</span> <span class="identifier">s</span><span class="special">.</span><span class="identifier">size</span><span class="special">()));</span>
<span class="special">}</span>
</pre>
</div>
<table xmlns:rev="path_to_url~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
file LICENSE_1_0.txt or copy at <a href="path_to_url" target="_top">path_to_url
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="asio_refresher.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../using_io.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="buffer_types.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
```
|
Charles M. Nes Jr. (1906–1989) was an American architect in practice in Baltimore from 1936 to 1988. He was president of the American Institute of Architects for the year 1966–67.
Life and career
Charles Motier Nes Jr. was born October 19, 1906, in York, Pennsylvania, to Charles Motier Nes and Ethel (Billmeyer) Nes. He was educated in the York public schools and Princeton University, earning a BA in 1928 and an MArch in 1930. After graduation he joined Palmer & Lamdin, the Baltimore architecture firm of Edward L. Palmer Jr. and William D. Lamdin, and was made a junior partner in 1936. Nes worked with Palmer & Lamdin until the outbreak of World War II, enlisting in the United States Army Air Forces in 1942. He served until 1945, and was awarded the Bronze Star Medal and the Croix de Guerre. As Nes returned to Baltimore, William D. Lamdin died. Palmer then formed a new partnership with Nes and two other senior employees, L. McLane Fisher and Carroll R. Williams Jr., in the reorganized Palmer, Fisher, Williams & Nes. In 1953, following Palmer's 1952 death, the firm became Fisher, Williams, Nes & Campbell, and later Fisher, Nes, Campbell & Associates and Fisher, Nes, Campbell & Partners. In 1972 Fisher retired and the firm was split into two: Nes, Campbell & Partners and Richter Cornbrooks Matthai Hopkins. The firm soon moved its offices to suburban Towson and was incorporated as NCP in 1980. Nes retired from practice in 1988, shortly before his death. The firm did not last long after his death, and was forfeited in 1995.
Nes and his partner Fisher, both Princeton graduates, designed the Architecture Building at the university, completed in 1963. Nes also served on the advisory committee to the school of architecture from 1969 to 1971.
Fisher joined the American Institute of Architects in 1935 as a member of the Baltimore chapter. He served as chapter president from 1949 to 1951 and as Middle Atlantic regional director from 1963 to 1965 before being elected president for the year 1966–67. He was elected a Fellow in 1955, was a Benjamin Franklin fellow of the Royal Society of Arts and an honorary member of the Royal Architectural Institute of Canada and the Society of Architects of Mexico.
Personal life
Nes was married in 1948 to Kathleen Garnham New. They had two children, Charles M. Nes III and Ethel Nes. He died April 30, 1989, in Cockeysville, Maryland.
Architectural works
State Roads Building and State Office Building, 300 and 301 W Preston St, Baltimore (1958–59)
Architecture Building, Princeton University, Princeton, New Jersey (1960–63)
Basic science building, Johns Hopkins University, Baltimore (1960)
Baltimore Gas and Electric Company Building extension, 39 W Lexington St, Baltimore (1966)
George H. Fallon Federal Building, 31 Hopkins Plz, Baltimore (1967)
Bel Air Middle School, 99 Idlewild St, Bel Air, Maryland (1968)
Joppatowne High School, 555 Joppa Farm Rd, Joppatowne, Maryland (1969)
Maryland Science Center, 601 Light St, Baltimore (1976)
Notes
References
Architects from Pennsylvania
Architects from Baltimore
20th-century American architects
Fellows of the American Institute of Architects
Presidents of the American Institute of Architects
Princeton University alumni
People from York, Pennsylvania
1906 births
1989 deaths
|
State Route 348 (SR 348) is a state highway in western Greene County, Tennessee. It serves the town of Mosheim and the communities of Midway, McDonald, Mohawk and Warrensburg.
Route description
SR 348 begins at an intersection with SR 340 (Fish Hatchery Road) in extreme western Greene County. It begins as McDonald Road and goes east toward Midway and like most roads in eastern Tennessee it is rather curvy. Before the route reaches Midway it passes through a small community called McDonald, it has only a volunteer fire department and an elementary School and of course some houses. In Midway SR 348 comes to an intersection with Midway Railroad Street which goes east and SR 348 turns south for a very short time and comes to a three-way intersection at which McDonald Road ends, Little Chuckey Road goes south and SR 348 turns east onto Midway Road. In Midway the route passes through Midway's "downtown" area. SR 348 passes over a railroad line and enters Mosheim city limits and passes West Greene High School and comes to an end at an intersection with US 11E/SR 34.
Major intersections
References
External links
Transportation in Greene County, Tennessee
348
|
```java
/*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*
*/
package easymvp.annotation;
import android.os.Bundle;
import android.view.View;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Annotation to inject the presenter that already defined in a {@link ActivityView#presenter()},
* a {@link FragmentView#presenter()} or a {@link CustomView#presenter()}.
* <p>
* It must be applied into the view implementation classes (<code>Activity</code>, <code>Fragment</code> or <code>Custom View</code>),
* otherwise it won't work.
* <p>
* You have access to the presenter instance after super call in {@link android.app.Activity#onCreate(Bundle)},
* {@link android.app.Fragment#onActivityCreated(Bundle)} and {@link View#onAttachedToWindow} methods.
* Also during configuration changes, same instance of presenter will be injected.
* <p>
* Here is an example:
* <pre class="prettyprint">
* {@literal @}FragmentView(presenter = MyPresenter.class)
* public class MyFragment extends Fragment{
* {@literal @}Presenter
* MyPresenter presenter;
*
* }
*
* public class MyPresenter extends AbstractPresenter<MyView>{
*
* public MyPresenter(){
*
* }
* }
*
* interface MyView{
*
* }
* </pre>
* <p>
* By default you can't pass any objects to the constructor of presenters,
* but you can use <a href="path_to_url">Dagger</a> to inject presenters.
* <p>
* Here is an example of using dagger:
* <pre class="prettyprint">
* {@literal @}FragmentView(presenter = MyPresenter.class)
* public class MyFragment extends Fragment{
*
* {@literal @}Inject
* {@literal @}Presenter
* MyPresenter presenter;
*
* {@literal @}Override
* void onCreate(Bundle b){
* SomeComponent.injectTo(this);
* }
* }
*
* public class MyPresenter extends AbstractPresenter<MyView>{
*
* public MyPresenter(){
*
* }
* }
* interface MyView{
*
* }
* </pre>
* @author Saeed Masoumi (saeed@6thsolution.com)
*/
@Retention(value = RUNTIME)
@Target(value = FIELD)
public @interface Presenter {
}
```
|
```c++
/**
* @file memfs.cpp
*
* @copyright 2015-2024 Bill Zissimopoulos
*/
/*
* This file is part of WinFsp.
*
* You can redistribute it and/or modify it under the terms of the GNU
* Foundation.
*
* in accordance with the commercial license agreement provided in
* conjunction with the software. The terms and conditions of any such
* commercial license agreement shall govern, supersede, and render
* ineffective any application of the GPLv3 license to this software,
* notwithstanding of any reference thereto in the software or
* associated repository.
*/
#undef _DEBUG
#include "memfs.h"
#include <sddl.h>
#include <VersionHelpers.h>
#include <cassert>
#include <map>
#include <unordered_map>
/* SLOWIO */
#include <thread>
#define MEMFS_MAX_PATH 512
FSP_FSCTL_STATIC_ASSERT(MEMFS_MAX_PATH > MAX_PATH,
"MEMFS_MAX_PATH must be greater than MAX_PATH.");
/*
* Define the MEMFS_STANDALONE macro when building MEMFS as a standalone file system.
* This macro should be defined in the Visual Studio project settings, Makefile, etc.
*/
//#define MEMFS_STANDALONE
/*
* Define the MEMFS_DISPATCHER_STOPPED macro to include DispatcherStopped support.
*/
#define MEMFS_DISPATCHER_STOPPED
/*
* Define the MEMFS_NAME_NORMALIZATION macro to include name normalization support.
*/
#define MEMFS_NAME_NORMALIZATION
/*
* Define the MEMFS_REPARSE_POINTS macro to include reparse points support.
*/
#define MEMFS_REPARSE_POINTS
/*
* Define the MEMFS_NAMED_STREAMS macro to include named streams support.
*/
#define MEMFS_NAMED_STREAMS
/*
* Define the MEMFS_DIRINFO_BY_NAME macro to include GetDirInfoByName.
*/
#define MEMFS_DIRINFO_BY_NAME
/*
* Define the MEMFS_SLOWIO macro to include delayed I/O response support.
*/
#define MEMFS_SLOWIO
/*
* Define the MEMFS_CONTROL macro to include DeviceControl support.
*/
#define MEMFS_CONTROL
/*
* Define the MEMFS_EA macro to include extended attributes support.
*/
#define MEMFS_EA
/*
* Define the MEMFS_WSL macro to include WSLinux support.
*/
#define MEMFS_WSL
/*
* Define the MEMFS_REJECT_EARLY_IRP macro to reject IRP's sent
* to the file system prior to the dispatcher being started.
*/
#if defined(MEMFS_STANDALONE)
#define MEMFS_REJECT_EARLY_IRP
#endif
/*
* Define the DEBUG_BUFFER_CHECK macro on Windows 8 or above. This includes
* a check for the Write buffer to ensure that it is read-only.
*
* Since ProcessBuffer support in the FSD, this is no longer a guarantee.
*/
#if !defined(NDEBUG)
//#define DEBUG_BUFFER_CHECK
#endif
#define MEMFS_SECTOR_SIZE 512
#define MEMFS_SECTORS_PER_ALLOCATION_UNIT 1
/*
* Large Heap Support
*/
typedef struct
{
DWORD Options;
SIZE_T InitialSize;
SIZE_T MaximumSize;
SIZE_T Alignment;
} LARGE_HEAP_INITIALIZE_PARAMS;
static INIT_ONCE LargeHeapInitOnce = INIT_ONCE_STATIC_INIT;
static HANDLE LargeHeap;
static SIZE_T LargeHeapAlignment;
static BOOL WINAPI LargeHeapInitOnceF(
PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context)
{
LARGE_HEAP_INITIALIZE_PARAMS *Params = (LARGE_HEAP_INITIALIZE_PARAMS *)Parameter;
LargeHeap = HeapCreate(Params->Options, Params->InitialSize, Params->MaximumSize);
LargeHeapAlignment = 0 != Params->Alignment ?
FSP_FSCTL_ALIGN_UP(Params->Alignment, 4096) :
16 * 4096;
return TRUE;
}
static inline
BOOLEAN LargeHeapInitialize(
DWORD Options,
SIZE_T InitialSize,
SIZE_T MaximumSize,
SIZE_T Alignment)
{
LARGE_HEAP_INITIALIZE_PARAMS Params;
Params.Options = Options;
Params.InitialSize = InitialSize;
Params.MaximumSize = MaximumSize;
Params.Alignment = Alignment;
InitOnceExecuteOnce(&LargeHeapInitOnce, LargeHeapInitOnceF, &Params, 0);
return 0 != LargeHeap;
}
static inline
PVOID LargeHeapAlloc(SIZE_T Size)
{
return HeapAlloc(LargeHeap, 0, FSP_FSCTL_ALIGN_UP(Size, LargeHeapAlignment));
}
static inline
PVOID LargeHeapRealloc(PVOID Pointer, SIZE_T Size)
{
if (0 != Pointer)
{
if (0 != Size)
return HeapReAlloc(LargeHeap, 0, Pointer, FSP_FSCTL_ALIGN_UP(Size, LargeHeapAlignment));
else
return HeapFree(LargeHeap, 0, Pointer), 0;
}
else
{
if (0 != Size)
return HeapAlloc(LargeHeap, 0, FSP_FSCTL_ALIGN_UP(Size, LargeHeapAlignment));
else
return 0;
}
}
static inline
VOID LargeHeapFree(PVOID Pointer)
{
if (0 != Pointer)
HeapFree(LargeHeap, 0, Pointer);
}
/*
* MEMFS
*/
static inline
UINT64 MemfsGetSystemTime(VOID)
{
FILETIME FileTime;
GetSystemTimeAsFileTime(&FileTime);
return ((PLARGE_INTEGER)&FileTime)->QuadPart;
}
static inline
unsigned MemfsUpperChar(unsigned c)
{
/*
* Bit-twiddling upper case char:
*
* - Let signbit(x) = x & 0x100 (treat bit 0x100 as "signbit").
* - 'A' <= c && c <= 'Z' <=> s = signbit(c - 'A') ^ signbit(c - ('Z' + 1)) == 1
* - c >= 'A' <=> c - 'A' >= 0 <=> signbit(c - 'A') = 0
* - c <= 'Z' <=> c - ('Z' + 1) < 0 <=> signbit(c - ('Z' + 1)) = 1
* - Bit 0x20 = 0x100 >> 3 toggles uppercase to lowercase and vice-versa.
*
* This is actually faster than `(c - 'a' <= 'z' - 'a') ? (c & ~0x20) : c`, even
* when compiled using cmov conditional moves at least on this system (i7-1065G7).
*
* See path_to_url
*/
unsigned s = ((c - 'a') ^ (c - ('z' + 1))) & 0x100;
return c & ~(s >> 3);
}
static inline
int MemfsWcsnicmp(const wchar_t *s0, const wchar_t *t0, int n)
{
/* Use fast loop for ASCII and fall back to CompareStringW for general case. */
const wchar_t *s = s0;
const wchar_t *t = t0;
int v = 0;
for (const void *e = t + n; e > (const void *)t; ++s, ++t)
{
unsigned sc = *s, tc = *t;
if (0xffffff80 & (sc | tc))
{
v = CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, s0, n, t0, n);
if (0 != v)
return v - 2;
else
return _wcsnicmp(s, t, n);
}
if (0 != (v = MemfsUpperChar(sc) - MemfsUpperChar(tc)) || !tc)
break;
}
return v;/*(0 < v) - (0 > v);*/
}
static inline
int MemfsFileNameCompare(PWSTR a, int alen, PWSTR b, int blen, BOOLEAN CaseInsensitive)
{
PWSTR p, endp, partp, q, endq, partq;
WCHAR c, d;
int plen, qlen, len, res;
if (-1 == alen)
alen = lstrlenW(a);
if (-1 == blen)
blen = lstrlenW(b);
for (p = a, endp = p + alen, q = b, endq = q + blen; endp > p && endq > q;)
{
c = d = 0;
for (; endp > p && (L':' == *p || L'\\' == *p); p++)
c = *p;
for (; endq > q && (L':' == *q || L'\\' == *q); q++)
d = *q;
if (L':' == c)
c = 1;
else if (L'\\' == c)
c = 2;
if (L':' == d)
d = 1;
else if (L'\\' == d)
d = 2;
res = c - d;
if (0 != res)
return res;
for (partp = p; endp > p && L':' != *p && L'\\' != *p; p++)
;
for (partq = q; endq > q && L':' != *q && L'\\' != *q; q++)
;
plen = (int)(p - partp);
qlen = (int)(q - partq);
len = plen < qlen ? plen : qlen;
if (CaseInsensitive)
res = MemfsWcsnicmp(partp, partq, len);
else
res = wcsncmp(partp, partq, len);
if (0 == res)
res = plen - qlen;
if (0 != res)
return res;
}
return -(endp <= p) + (endq <= q);
}
static inline
BOOLEAN MemfsFileNameHasPrefix(PWSTR a, PWSTR b, BOOLEAN CaseInsensitive)
{
int alen = (int)wcslen(a);
int blen = (int)wcslen(b);
return alen >= blen && 0 == MemfsFileNameCompare(a, blen, b, blen, CaseInsensitive) &&
(alen == blen || (1 == blen && L'\\' == b[0]) ||
#if defined(MEMFS_NAMED_STREAMS)
(L'\\' == a[blen] || L':' == a[blen]));
#else
(L'\\' == a[blen]));
#endif
}
#if defined(MEMFS_EA)
static inline
int MemfsEaNameCompare(PSTR a, PSTR b)
{
/* EA names are always case-insensitive in MEMFS (to be inline with NTFS) */
int res;
res = CompareStringA(LOCALE_INVARIANT, NORM_IGNORECASE, a, -1, b, -1);
if (0 != res)
res -= 2;
else
res = _stricmp(a, b);
return res;
}
struct MEMFS_FILE_NODE_EA_LESS
{
MEMFS_FILE_NODE_EA_LESS()
{
}
bool operator()(PSTR a, PSTR b) const
{
return 0 > MemfsEaNameCompare(a, b);
}
};
typedef std::map<PSTR, FILE_FULL_EA_INFORMATION *, MEMFS_FILE_NODE_EA_LESS> MEMFS_FILE_NODE_EA_MAP;
#endif
typedef struct _MEMFS_FILE_NODE
{
WCHAR FileName[MEMFS_MAX_PATH];
FSP_FSCTL_FILE_INFO FileInfo;
SIZE_T FileSecuritySize;
PVOID FileSecurity;
PVOID FileData;
#if defined(MEMFS_REPARSE_POINTS)
SIZE_T ReparseDataSize;
PVOID ReparseData;
#endif
#if defined(MEMFS_EA)
MEMFS_FILE_NODE_EA_MAP *EaMap;
#endif
volatile LONG RefCount;
#if defined(MEMFS_NAMED_STREAMS)
struct _MEMFS_FILE_NODE *MainFileNode;
#endif
} MEMFS_FILE_NODE;
struct MEMFS_FILE_NODE_LESS
{
MEMFS_FILE_NODE_LESS(BOOLEAN CaseInsensitive) : CaseInsensitive(CaseInsensitive)
{
}
bool operator()(PWSTR a, PWSTR b) const
{
return 0 > MemfsFileNameCompare(a, -1, b, -1, CaseInsensitive);
}
BOOLEAN CaseInsensitive;
};
typedef std::map<PWSTR, MEMFS_FILE_NODE *, MEMFS_FILE_NODE_LESS> MEMFS_FILE_NODE_MAP;
typedef struct _MEMFS
{
FSP_FILE_SYSTEM *FileSystem;
MEMFS_FILE_NODE_MAP *FileNodeMap;
ULONG MaxFileNodes;
ULONG MaxFileSize;
#ifdef MEMFS_SLOWIO
ULONG SlowioMaxDelay;
ULONG SlowioPercentDelay;
ULONG SlowioRarefyDelay;
volatile LONG SlowioThreadsRunning;
#endif
UINT16 VolumeLabelLength;
WCHAR VolumeLabel[32];
} MEMFS;
static inline
NTSTATUS MemfsFileNodeCreate(PWSTR FileName, MEMFS_FILE_NODE **PFileNode)
{
static UINT64 IndexNumber = 1;
MEMFS_FILE_NODE *FileNode;
*PFileNode = 0;
FileNode = (MEMFS_FILE_NODE *)malloc(sizeof *FileNode);
if (0 == FileNode)
return STATUS_INSUFFICIENT_RESOURCES;
memset(FileNode, 0, sizeof *FileNode);
wcscpy_s(FileNode->FileName, sizeof FileNode->FileName / sizeof(WCHAR), FileName);
FileNode->FileInfo.CreationTime =
FileNode->FileInfo.LastAccessTime =
FileNode->FileInfo.LastWriteTime =
FileNode->FileInfo.ChangeTime = MemfsGetSystemTime();
FileNode->FileInfo.IndexNumber = IndexNumber++;
*PFileNode = FileNode;
return STATUS_SUCCESS;
}
#if defined(MEMFS_EA)
static inline
VOID MemfsFileNodeDeleteEaMap(MEMFS_FILE_NODE *FileNode)
{
if (0 != FileNode->EaMap)
{
for (MEMFS_FILE_NODE_EA_MAP::iterator p = FileNode->EaMap->begin(), q = FileNode->EaMap->end();
p != q; ++p)
free(p->second);
delete FileNode->EaMap;
FileNode->EaMap = 0;
FileNode->FileInfo.EaSize = 0;
}
}
#endif
static inline
VOID MemfsFileNodeDelete(MEMFS_FILE_NODE *FileNode)
{
#if defined(MEMFS_EA)
MemfsFileNodeDeleteEaMap(FileNode);
#endif
#if defined(MEMFS_REPARSE_POINTS)
free(FileNode->ReparseData);
#endif
LargeHeapFree(FileNode->FileData);
free(FileNode->FileSecurity);
free(FileNode);
}
static inline
VOID MemfsFileNodeReference(MEMFS_FILE_NODE *FileNode)
{
InterlockedIncrement(&FileNode->RefCount);
}
static inline
VOID MemfsFileNodeDereference(MEMFS_FILE_NODE *FileNode)
{
if (0 == InterlockedDecrement(&FileNode->RefCount))
MemfsFileNodeDelete(FileNode);
}
static inline
VOID MemfsFileNodeGetFileInfo(MEMFS_FILE_NODE *FileNode, FSP_FSCTL_FILE_INFO *FileInfo)
{
#if defined(MEMFS_NAMED_STREAMS)
if (0 == FileNode->MainFileNode)
*FileInfo = FileNode->FileInfo;
else
{
*FileInfo = FileNode->MainFileNode->FileInfo;
FileInfo->FileAttributes &= ~FILE_ATTRIBUTE_DIRECTORY;
/* named streams cannot be directories */
FileInfo->AllocationSize = FileNode->FileInfo.AllocationSize;
FileInfo->FileSize = FileNode->FileInfo.FileSize;
}
#else
*FileInfo = FileNode->FileInfo;
#endif
}
#if defined(MEMFS_EA)
static inline
NTSTATUS MemfsFileNodeGetEaMap(MEMFS_FILE_NODE *FileNode, MEMFS_FILE_NODE_EA_MAP **PEaMap)
{
#if defined(MEMFS_NAMED_STREAMS)
if (0 != FileNode->MainFileNode)
FileNode = FileNode->MainFileNode;
#endif
*PEaMap = FileNode->EaMap;
if (0 != *PEaMap)
return STATUS_SUCCESS;
try
{
*PEaMap = FileNode->EaMap = new MEMFS_FILE_NODE_EA_MAP(MEMFS_FILE_NODE_EA_LESS());
return STATUS_SUCCESS;
}
catch (...)
{
*PEaMap = 0;
return STATUS_INSUFFICIENT_RESOURCES;
}
}
static inline
NTSTATUS MemfsFileNodeSetEa(
FSP_FILE_SYSTEM *FileSystem, PVOID Context,
PFILE_FULL_EA_INFORMATION Ea)
{
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)Context;
MEMFS_FILE_NODE_EA_MAP *EaMap;
FILE_FULL_EA_INFORMATION *FileNodeEa = 0;
MEMFS_FILE_NODE_EA_MAP::iterator p;
ULONG EaSizePlus = 0, EaSizeMinus = 0;
NTSTATUS Result;
Result = MemfsFileNodeGetEaMap(FileNode, &EaMap);
if (!NT_SUCCESS(Result))
return Result;
if (0 != Ea->EaValueLength)
{
EaSizePlus = FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) +
Ea->EaNameLength + 1 + Ea->EaValueLength;
FileNodeEa = (FILE_FULL_EA_INFORMATION *)malloc(EaSizePlus);
if (0 == FileNodeEa)
return STATUS_INSUFFICIENT_RESOURCES;
memcpy(FileNodeEa, Ea, EaSizePlus);
FileNodeEa->NextEntryOffset = 0;
EaSizePlus = FspFileSystemGetEaPackedSize(Ea);
}
p = EaMap->find(Ea->EaName);
if (p != EaMap->end())
{
EaSizeMinus = FspFileSystemGetEaPackedSize(Ea);
free(p->second);
EaMap->erase(p);
}
if (0 != Ea->EaValueLength)
{
try
{
EaMap->insert(MEMFS_FILE_NODE_EA_MAP::value_type(FileNodeEa->EaName, FileNodeEa));
}
catch (...)
{
free(FileNodeEa);
return STATUS_INSUFFICIENT_RESOURCES;
}
}
FileNode->FileInfo.EaSize = FileNode->FileInfo.EaSize + EaSizePlus - EaSizeMinus;
return STATUS_SUCCESS;
}
static inline
BOOLEAN MemfsFileNodeNeedEa(MEMFS_FILE_NODE *FileNode)
{
#if defined(MEMFS_NAMED_STREAMS)
if (0 != FileNode->MainFileNode)
FileNode = FileNode->MainFileNode;
#endif
if (0 != FileNode->EaMap)
{
for (MEMFS_FILE_NODE_EA_MAP::iterator p = FileNode->EaMap->begin(), q = FileNode->EaMap->end();
p != q; ++p)
if (0 != (p->second->Flags & FILE_NEED_EA))
return TRUE;
}
return FALSE;
}
static inline
BOOLEAN MemfsFileNodeEnumerateEa(MEMFS_FILE_NODE *FileNode,
BOOLEAN (*EnumFn)(PFILE_FULL_EA_INFORMATION Ea, PVOID), PVOID Context)
{
#if defined(MEMFS_NAMED_STREAMS)
if (0 != FileNode->MainFileNode)
FileNode = FileNode->MainFileNode;
#endif
if (0 != FileNode->EaMap)
{
for (MEMFS_FILE_NODE_EA_MAP::iterator p = FileNode->EaMap->begin(), q = FileNode->EaMap->end();
p != q; ++p)
if (!EnumFn(p->second, Context))
return FALSE;
}
return TRUE;
}
#endif
static inline
VOID MemfsFileNodeMapDump(MEMFS_FILE_NODE_MAP *FileNodeMap)
{
for (MEMFS_FILE_NODE_MAP::iterator p = FileNodeMap->begin(), q = FileNodeMap->end(); p != q; ++p)
FspDebugLog("%c %04lx %6lu %S\n",
FILE_ATTRIBUTE_DIRECTORY & p->second->FileInfo.FileAttributes ? 'd' : 'f',
(ULONG)p->second->FileInfo.FileAttributes,
(ULONG)p->second->FileInfo.FileSize,
p->second->FileName);
}
static inline
BOOLEAN MemfsFileNodeMapIsCaseInsensitive(MEMFS_FILE_NODE_MAP *FileNodeMap)
{
return FileNodeMap->key_comp().CaseInsensitive;
}
static inline
NTSTATUS MemfsFileNodeMapCreate(BOOLEAN CaseInsensitive, MEMFS_FILE_NODE_MAP **PFileNodeMap)
{
*PFileNodeMap = 0;
try
{
*PFileNodeMap = new MEMFS_FILE_NODE_MAP(MEMFS_FILE_NODE_LESS(CaseInsensitive));
return STATUS_SUCCESS;
}
catch (...)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
}
static inline
VOID MemfsFileNodeMapDelete(MEMFS_FILE_NODE_MAP *FileNodeMap)
{
for (MEMFS_FILE_NODE_MAP::iterator p = FileNodeMap->begin(), q = FileNodeMap->end(); p != q; ++p)
MemfsFileNodeDelete(p->second);
delete FileNodeMap;
}
static inline
SIZE_T MemfsFileNodeMapCount(MEMFS_FILE_NODE_MAP *FileNodeMap)
{
return FileNodeMap->size();
}
static inline
MEMFS_FILE_NODE *MemfsFileNodeMapGet(MEMFS_FILE_NODE_MAP *FileNodeMap, PWSTR FileName)
{
MEMFS_FILE_NODE_MAP::iterator iter = FileNodeMap->find(FileName);
if (iter == FileNodeMap->end())
return 0;
return iter->second;
}
#if defined(MEMFS_NAMED_STREAMS)
static inline
MEMFS_FILE_NODE *MemfsFileNodeMapGetMain(MEMFS_FILE_NODE_MAP *FileNodeMap, PWSTR FileName0)
{
WCHAR FileName[MEMFS_MAX_PATH];
wcscpy_s(FileName, sizeof FileName / sizeof(WCHAR), FileName0);
PWSTR StreamName = wcschr(FileName, L':');
if (0 == StreamName)
return 0;
StreamName[0] = L'\0';
MEMFS_FILE_NODE_MAP::iterator iter = FileNodeMap->find(FileName);
if (iter == FileNodeMap->end())
return 0;
return iter->second;
}
#endif
static inline
MEMFS_FILE_NODE *MemfsFileNodeMapGetParent(MEMFS_FILE_NODE_MAP *FileNodeMap, PWSTR FileName0,
PNTSTATUS PResult)
{
WCHAR Root[2] = L"\\";
PWSTR Remain, Suffix;
WCHAR FileName[MEMFS_MAX_PATH];
wcscpy_s(FileName, sizeof FileName / sizeof(WCHAR), FileName0);
FspPathSuffix(FileName, &Remain, &Suffix, Root);
MEMFS_FILE_NODE_MAP::iterator iter = FileNodeMap->find(Remain);
FspPathCombine(FileName, Suffix);
if (iter == FileNodeMap->end())
{
*PResult = STATUS_OBJECT_PATH_NOT_FOUND;
return 0;
}
if (0 == (iter->second->FileInfo.FileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
*PResult = STATUS_NOT_A_DIRECTORY;
return 0;
}
return iter->second;
}
static inline
VOID MemfsFileNodeMapTouchParent(MEMFS_FILE_NODE_MAP *FileNodeMap, MEMFS_FILE_NODE *FileNode)
{
NTSTATUS Result;
MEMFS_FILE_NODE *Parent;
if (L'\\' == FileNode->FileName[0] && L'\0' == FileNode->FileName[1])
return;
Parent = MemfsFileNodeMapGetParent(FileNodeMap, FileNode->FileName, &Result);
if (0 == Parent)
return;
Parent->FileInfo.LastAccessTime =
Parent->FileInfo.LastWriteTime =
Parent->FileInfo.ChangeTime = MemfsGetSystemTime();
}
static inline
NTSTATUS MemfsFileNodeMapInsert(MEMFS_FILE_NODE_MAP *FileNodeMap, MEMFS_FILE_NODE *FileNode,
PBOOLEAN PInserted)
{
*PInserted = 0;
try
{
*PInserted = FileNodeMap->insert(MEMFS_FILE_NODE_MAP::value_type(FileNode->FileName, FileNode)).second;
if (*PInserted)
{
MemfsFileNodeReference(FileNode);
MemfsFileNodeMapTouchParent(FileNodeMap, FileNode);
}
return STATUS_SUCCESS;
}
catch (...)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
}
static inline
VOID MemfsFileNodeMapRemove(MEMFS_FILE_NODE_MAP *FileNodeMap, MEMFS_FILE_NODE *FileNode)
{
if (FileNodeMap->erase(FileNode->FileName))
{
MemfsFileNodeMapTouchParent(FileNodeMap, FileNode);
MemfsFileNodeDereference(FileNode);
}
}
static inline
BOOLEAN MemfsFileNodeMapHasChild(MEMFS_FILE_NODE_MAP *FileNodeMap, MEMFS_FILE_NODE *FileNode)
{
BOOLEAN Result = FALSE;
WCHAR Root[2] = L"\\";
PWSTR Remain, Suffix;
MEMFS_FILE_NODE_MAP::iterator iter = FileNodeMap->upper_bound(FileNode->FileName);
for (; FileNodeMap->end() != iter; ++iter)
{
#if defined(MEMFS_NAMED_STREAMS)
if (0 != wcschr(iter->second->FileName, L':'))
continue;
#endif
FspPathSuffix(iter->second->FileName, &Remain, &Suffix, Root);
Result = 0 == MemfsFileNameCompare(Remain, -1, FileNode->FileName, -1,
MemfsFileNodeMapIsCaseInsensitive(FileNodeMap));
FspPathCombine(iter->second->FileName, Suffix);
break;
}
return Result;
}
static inline
BOOLEAN MemfsFileNodeMapEnumerateChildren(MEMFS_FILE_NODE_MAP *FileNodeMap, MEMFS_FILE_NODE *FileNode,
PWSTR PrevFileName0, BOOLEAN (*EnumFn)(MEMFS_FILE_NODE *, PVOID), PVOID Context)
{
WCHAR Root[2] = L"\\";
PWSTR Remain, Suffix;
MEMFS_FILE_NODE_MAP::iterator iter;
BOOLEAN IsDirectoryChild;
if (0 != PrevFileName0)
{
WCHAR PrevFileName[MEMFS_MAX_PATH + 256];
size_t Length0 = wcslen(FileNode->FileName);
size_t Length1 = 1 != Length0 || L'\\' != FileNode->FileName[0];
size_t Length2 = wcslen(PrevFileName0);
assert(MEMFS_MAX_PATH + 256 > Length0 + Length1 + Length2);
memcpy(PrevFileName, FileNode->FileName, Length0 * sizeof(WCHAR));
memcpy(PrevFileName + Length0, L"\\", Length1 * sizeof(WCHAR));
memcpy(PrevFileName + Length0 + Length1, PrevFileName0, Length2 * sizeof(WCHAR));
PrevFileName[Length0 + Length1 + Length2] = L'\0';
iter = FileNodeMap->upper_bound(PrevFileName);
}
else
iter = FileNodeMap->upper_bound(FileNode->FileName);
for (; FileNodeMap->end() != iter; ++iter)
{
if (!MemfsFileNameHasPrefix(iter->second->FileName, FileNode->FileName,
MemfsFileNodeMapIsCaseInsensitive(FileNodeMap)))
break;
FspPathSuffix(iter->second->FileName, &Remain, &Suffix, Root);
IsDirectoryChild = 0 == MemfsFileNameCompare(Remain, -1, FileNode->FileName, -1,
MemfsFileNodeMapIsCaseInsensitive(FileNodeMap));
#if defined(MEMFS_NAMED_STREAMS)
IsDirectoryChild = IsDirectoryChild && 0 == wcschr(Suffix, L':');
#endif
FspPathCombine(iter->second->FileName, Suffix);
if (IsDirectoryChild)
{
if (!EnumFn(iter->second, Context))
return FALSE;
}
}
return TRUE;
}
#if defined(MEMFS_NAMED_STREAMS)
static inline
BOOLEAN MemfsFileNodeMapEnumerateNamedStreams(MEMFS_FILE_NODE_MAP *FileNodeMap, MEMFS_FILE_NODE *FileNode,
BOOLEAN (*EnumFn)(MEMFS_FILE_NODE *, PVOID), PVOID Context)
{
MEMFS_FILE_NODE_MAP::iterator iter = FileNodeMap->upper_bound(FileNode->FileName);
for (; FileNodeMap->end() != iter; ++iter)
{
if (!MemfsFileNameHasPrefix(iter->second->FileName, FileNode->FileName,
MemfsFileNodeMapIsCaseInsensitive(FileNodeMap)))
break;
if (L':' != iter->second->FileName[wcslen(FileNode->FileName)])
break;
if (!EnumFn(iter->second, Context))
return FALSE;
}
return TRUE;
}
#endif
static inline
BOOLEAN MemfsFileNodeMapEnumerateDescendants(MEMFS_FILE_NODE_MAP *FileNodeMap, MEMFS_FILE_NODE *FileNode,
BOOLEAN (*EnumFn)(MEMFS_FILE_NODE *, PVOID), PVOID Context)
{
WCHAR Root[2] = L"\\";
MEMFS_FILE_NODE_MAP::iterator iter = FileNodeMap->lower_bound(FileNode->FileName);
for (; FileNodeMap->end() != iter; ++iter)
{
if (!MemfsFileNameHasPrefix(iter->second->FileName, FileNode->FileName,
MemfsFileNodeMapIsCaseInsensitive(FileNodeMap)))
break;
if (!EnumFn(iter->second, Context))
return FALSE;
}
return TRUE;
}
typedef struct _MEMFS_FILE_NODE_MAP_ENUM_CONTEXT
{
BOOLEAN Reference;
MEMFS_FILE_NODE **FileNodes;
ULONG Capacity, Count;
} MEMFS_FILE_NODE_MAP_ENUM_CONTEXT;
static inline
BOOLEAN MemfsFileNodeMapEnumerateFn(MEMFS_FILE_NODE *FileNode, PVOID Context0)
{
MEMFS_FILE_NODE_MAP_ENUM_CONTEXT *Context = (MEMFS_FILE_NODE_MAP_ENUM_CONTEXT *)Context0;
if (Context->Capacity <= Context->Count)
{
ULONG Capacity = 0 != Context->Capacity ? Context->Capacity * 2 : 16;
PVOID P = realloc(Context->FileNodes, Capacity * sizeof Context->FileNodes[0]);
if (0 == P)
{
FspDebugLog(__FUNCTION__ ": cannot allocate memory; aborting\n");
abort();
}
Context->FileNodes = (MEMFS_FILE_NODE **)P;
Context->Capacity = Capacity;
}
Context->FileNodes[Context->Count++] = FileNode;
if (Context->Reference)
MemfsFileNodeReference(FileNode);
return TRUE;
}
static inline
VOID MemfsFileNodeMapEnumerateFree(MEMFS_FILE_NODE_MAP_ENUM_CONTEXT *Context)
{
if (Context->Reference)
{
for (ULONG Index = 0; Context->Count > Index; Index++)
{
MEMFS_FILE_NODE *FileNode = Context->FileNodes[Index];
MemfsFileNodeDereference(FileNode);
}
}
free(Context->FileNodes);
}
#ifdef MEMFS_SLOWIO
/*
* SLOWIO
*
* This is included for two uses:
*
* 1) For testing winfsp, by allowing memfs to act more like a non-ram file system,
* with some IO taking many milliseconds, and some IO completion delayed.
*
* 2) As sample code for how to use winfsp's STATUS_PENDING capabilities.
*
*/
static inline UINT64 Hash(UINT64 x)
{
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9ull;
x = (x ^ (x >> 27)) * 0x94d049bb133111ebull;
x = x ^ (x >> 31);
return x;
}
static inline ULONG PseudoRandom(ULONG to)
{
/* John Oberschelp's PRNG */
static UINT64 spin = 0;
InterlockedIncrement(&spin);
return Hash(spin) % to;
}
static inline BOOLEAN SlowioReturnPending(FSP_FILE_SYSTEM *FileSystem)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
if (0 == Memfs->SlowioMaxDelay)
return FALSE;
return PseudoRandom(100) < Memfs->SlowioPercentDelay;
}
static inline VOID SlowioSnooze(FSP_FILE_SYSTEM *FileSystem)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
if (0 == Memfs->SlowioMaxDelay)
return;
ULONG millis = PseudoRandom(Memfs->SlowioMaxDelay + 1) >> PseudoRandom(Memfs->SlowioRarefyDelay + 1);
Sleep(millis);
}
void SlowioReadThread(
FSP_FILE_SYSTEM *FileSystem,
MEMFS_FILE_NODE *FileNode,
PVOID Buffer,
UINT64 Offset,
UINT64 EndOffset,
UINT64 RequestHint)
{
SlowioSnooze(FileSystem);
memcpy(Buffer, (PUINT8)FileNode->FileData + Offset, (size_t)(EndOffset - Offset));
UINT32 BytesTransferred = (ULONG)(EndOffset - Offset);
FSP_FSCTL_TRANSACT_RSP ResponseBuf;
memset(&ResponseBuf, 0, sizeof ResponseBuf);
ResponseBuf.Size = sizeof ResponseBuf;
ResponseBuf.Kind = FspFsctlTransactReadKind;
ResponseBuf.Hint = RequestHint; // IRP that is being completed
ResponseBuf.IoStatus.Status = STATUS_SUCCESS;
ResponseBuf.IoStatus.Information = BytesTransferred; // bytes read
FspFileSystemSendResponse(FileSystem, &ResponseBuf);
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
InterlockedDecrement(&Memfs->SlowioThreadsRunning);
}
void SlowioWriteThread(
FSP_FILE_SYSTEM *FileSystem,
MEMFS_FILE_NODE *FileNode,
PVOID Buffer,
UINT64 Offset,
UINT64 EndOffset,
UINT64 RequestHint)
{
SlowioSnooze(FileSystem);
memcpy((PUINT8)FileNode->FileData + Offset, Buffer, (size_t)(EndOffset - Offset));
UINT32 BytesTransferred = (ULONG)(EndOffset - Offset);
FSP_FSCTL_TRANSACT_RSP ResponseBuf;
memset(&ResponseBuf, 0, sizeof ResponseBuf);
ResponseBuf.Size = sizeof ResponseBuf;
ResponseBuf.Kind = FspFsctlTransactWriteKind;
ResponseBuf.Hint = RequestHint; // IRP that is being completed
ResponseBuf.IoStatus.Status = STATUS_SUCCESS;
ResponseBuf.IoStatus.Information = BytesTransferred; // bytes written
MemfsFileNodeGetFileInfo(FileNode, &ResponseBuf.Rsp.Write.FileInfo);
FspFileSystemSendResponse(FileSystem, &ResponseBuf);
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
InterlockedDecrement(&Memfs->SlowioThreadsRunning);
}
void SlowioReadDirectoryThread(
FSP_FILE_SYSTEM *FileSystem,
ULONG BytesTransferred,
UINT64 RequestHint)
{
SlowioSnooze(FileSystem);
FSP_FSCTL_TRANSACT_RSP ResponseBuf;
memset(&ResponseBuf, 0, sizeof ResponseBuf);
ResponseBuf.Size = sizeof ResponseBuf;
ResponseBuf.Kind = FspFsctlTransactQueryDirectoryKind;
ResponseBuf.Hint = RequestHint; // IRP that is being completed
ResponseBuf.IoStatus.Status = STATUS_SUCCESS;
ResponseBuf.IoStatus.Information = BytesTransferred; // bytes of directory info read
FspFileSystemSendResponse(FileSystem, &ResponseBuf);
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
InterlockedDecrement(&Memfs->SlowioThreadsRunning);
}
#endif
/*
* FSP_FILE_SYSTEM_INTERFACE
*/
#if defined(MEMFS_REPARSE_POINTS)
static NTSTATUS GetReparsePointByName(
FSP_FILE_SYSTEM *FileSystem, PVOID Context,
PWSTR FileName, BOOLEAN IsDirectory, PVOID Buffer, PSIZE_T PSize);
#endif
static NTSTATUS SetFileSizeInternal(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0, UINT64 NewSize, BOOLEAN SetAllocationSize);
static NTSTATUS GetVolumeInfo(FSP_FILE_SYSTEM *FileSystem,
FSP_FSCTL_VOLUME_INFO *VolumeInfo)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
VolumeInfo->TotalSize = Memfs->MaxFileNodes * (UINT64)Memfs->MaxFileSize;
VolumeInfo->FreeSize = (Memfs->MaxFileNodes - MemfsFileNodeMapCount(Memfs->FileNodeMap)) *
(UINT64)Memfs->MaxFileSize;
VolumeInfo->VolumeLabelLength = Memfs->VolumeLabelLength;
memcpy(VolumeInfo->VolumeLabel, Memfs->VolumeLabel, Memfs->VolumeLabelLength);
return STATUS_SUCCESS;
}
static NTSTATUS SetVolumeLabel(FSP_FILE_SYSTEM *FileSystem,
PWSTR VolumeLabel,
FSP_FSCTL_VOLUME_INFO *VolumeInfo)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
Memfs->VolumeLabelLength = (UINT16)(wcslen(VolumeLabel) * sizeof(WCHAR));
if (Memfs->VolumeLabelLength > sizeof Memfs->VolumeLabel)
Memfs->VolumeLabelLength = sizeof Memfs->VolumeLabel;
memcpy(Memfs->VolumeLabel, VolumeLabel, Memfs->VolumeLabelLength);
VolumeInfo->TotalSize = Memfs->MaxFileNodes * Memfs->MaxFileSize;
VolumeInfo->FreeSize =
(Memfs->MaxFileNodes - MemfsFileNodeMapCount(Memfs->FileNodeMap)) * Memfs->MaxFileSize;
VolumeInfo->VolumeLabelLength = Memfs->VolumeLabelLength;
memcpy(VolumeInfo->VolumeLabel, Memfs->VolumeLabel, Memfs->VolumeLabelLength);
return STATUS_SUCCESS;
}
static NTSTATUS GetSecurityByName(FSP_FILE_SYSTEM *FileSystem,
PWSTR FileName, PUINT32 PFileAttributes,
PSECURITY_DESCRIPTOR SecurityDescriptor, SIZE_T *PSecurityDescriptorSize)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
MEMFS_FILE_NODE *FileNode;
NTSTATUS Result;
FileNode = MemfsFileNodeMapGet(Memfs->FileNodeMap, FileName);
if (0 == FileNode)
{
Result = STATUS_OBJECT_NAME_NOT_FOUND;
#if defined(MEMFS_REPARSE_POINTS)
if (FspFileSystemFindReparsePoint(FileSystem, GetReparsePointByName, 0,
FileName, PFileAttributes))
Result = STATUS_REPARSE;
else
#endif
MemfsFileNodeMapGetParent(Memfs->FileNodeMap, FileName, &Result);
return Result;
}
#if defined(MEMFS_NAMED_STREAMS)
UINT32 FileAttributesMask = ~(UINT32)0;
if (0 != FileNode->MainFileNode)
{
FileAttributesMask = ~(UINT32)FILE_ATTRIBUTE_DIRECTORY;
FileNode = FileNode->MainFileNode;
}
if (0 != PFileAttributes)
*PFileAttributes = FileNode->FileInfo.FileAttributes & FileAttributesMask;
#else
if (0 != PFileAttributes)
*PFileAttributes = FileNode->FileInfo.FileAttributes;
#endif
if (0 != PSecurityDescriptorSize)
{
if (FileNode->FileSecuritySize > *PSecurityDescriptorSize)
{
*PSecurityDescriptorSize = FileNode->FileSecuritySize;
return STATUS_BUFFER_OVERFLOW;
}
*PSecurityDescriptorSize = FileNode->FileSecuritySize;
if (0 != SecurityDescriptor)
memcpy(SecurityDescriptor, FileNode->FileSecurity, FileNode->FileSecuritySize);
}
return STATUS_SUCCESS;
}
static NTSTATUS Create(FSP_FILE_SYSTEM *FileSystem,
PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess,
UINT32 FileAttributes, PSECURITY_DESCRIPTOR SecurityDescriptor, UINT64 AllocationSize,
#if defined(MEMFS_EA) || defined(MEMFS_WSL)
PVOID ExtraBuffer, ULONG ExtraLength, BOOLEAN ExtraBufferIsReparsePoint,
#endif
PVOID *PFileNode, FSP_FSCTL_FILE_INFO *FileInfo)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
#if defined(MEMFS_NAME_NORMALIZATION)
WCHAR FileNameBuf[MEMFS_MAX_PATH];
#endif
MEMFS_FILE_NODE *FileNode;
MEMFS_FILE_NODE *ParentNode;
NTSTATUS Result;
BOOLEAN Inserted;
if (MEMFS_MAX_PATH <= wcslen(FileName))
return STATUS_OBJECT_NAME_INVALID;
if (CreateOptions & FILE_DIRECTORY_FILE)
AllocationSize = 0;
FileNode = MemfsFileNodeMapGet(Memfs->FileNodeMap, FileName);
if (0 != FileNode)
return STATUS_OBJECT_NAME_COLLISION;
ParentNode = MemfsFileNodeMapGetParent(Memfs->FileNodeMap, FileName, &Result);
if (0 == ParentNode)
return Result;
if (MemfsFileNodeMapCount(Memfs->FileNodeMap) >= Memfs->MaxFileNodes)
return STATUS_CANNOT_MAKE;
if (AllocationSize > Memfs->MaxFileSize)
return STATUS_DISK_FULL;
#if defined(MEMFS_NAME_NORMALIZATION)
if (MemfsFileNodeMapIsCaseInsensitive(Memfs->FileNodeMap))
{
WCHAR Root[2] = L"\\";
PWSTR Remain, Suffix;
size_t RemainLength, BSlashLength, SuffixLength;
FspPathSuffix(FileName, &Remain, &Suffix, Root);
assert(0 == MemfsFileNameCompare(Remain, -1, ParentNode->FileName, -1, TRUE));
FspPathCombine(FileName, Suffix);
RemainLength = wcslen(ParentNode->FileName);
BSlashLength = 1 < RemainLength;
SuffixLength = wcslen(Suffix);
if (MEMFS_MAX_PATH <= RemainLength + BSlashLength + SuffixLength)
return STATUS_OBJECT_NAME_INVALID;
memcpy(FileNameBuf, ParentNode->FileName, RemainLength * sizeof(WCHAR));
memcpy(FileNameBuf + RemainLength, L"\\", BSlashLength * sizeof(WCHAR));
memcpy(FileNameBuf + RemainLength + BSlashLength, Suffix, (SuffixLength + 1) * sizeof(WCHAR));
FileName = FileNameBuf;
}
#endif
Result = MemfsFileNodeCreate(FileName, &FileNode);
if (!NT_SUCCESS(Result))
return Result;
#if defined(MEMFS_NAMED_STREAMS)
FileNode->MainFileNode = MemfsFileNodeMapGetMain(Memfs->FileNodeMap, FileName);
#endif
FileNode->FileInfo.FileAttributes = (FileAttributes & FILE_ATTRIBUTE_DIRECTORY) ?
FileAttributes : FileAttributes | FILE_ATTRIBUTE_ARCHIVE;
if (0 != SecurityDescriptor)
{
FileNode->FileSecuritySize = GetSecurityDescriptorLength(SecurityDescriptor);
FileNode->FileSecurity = (PSECURITY_DESCRIPTOR)malloc(FileNode->FileSecuritySize);
if (0 == FileNode->FileSecurity)
{
MemfsFileNodeDelete(FileNode);
return STATUS_INSUFFICIENT_RESOURCES;
}
memcpy(FileNode->FileSecurity, SecurityDescriptor, FileNode->FileSecuritySize);
}
#if defined(MEMFS_EA) || defined(MEMFS_WSL)
if (0 != ExtraBuffer)
{
#if defined(MEMFS_EA)
if (!ExtraBufferIsReparsePoint)
{
Result = FspFileSystemEnumerateEa(FileSystem, MemfsFileNodeSetEa, FileNode,
(PFILE_FULL_EA_INFORMATION)ExtraBuffer, ExtraLength);
if (!NT_SUCCESS(Result))
{
MemfsFileNodeDelete(FileNode);
return Result;
}
}
#endif
#if defined(MEMFS_WSL)
if (ExtraBufferIsReparsePoint)
{
#if defined(MEMFS_REPARSE_POINTS)
FileNode->ReparseDataSize = ExtraLength;
FileNode->ReparseData = malloc(ExtraLength);
if (0 == FileNode->ReparseData && 0 != ExtraLength)
{
MemfsFileNodeDelete(FileNode);
return STATUS_INSUFFICIENT_RESOURCES;
}
FileNode->FileInfo.FileAttributes |= FILE_ATTRIBUTE_REPARSE_POINT;
FileNode->FileInfo.ReparseTag = *(PULONG)ExtraBuffer;
/* the first field in a reparse buffer is the reparse tag */
memcpy(FileNode->ReparseData, ExtraBuffer, ExtraLength);
#else
MemfsFileNodeDelete(FileNode);
return STATUS_INVALID_PARAMETER;
#endif
}
#endif
}
#endif
FileNode->FileInfo.AllocationSize = AllocationSize;
if (0 != FileNode->FileInfo.AllocationSize)
{
FileNode->FileData = LargeHeapAlloc((size_t)FileNode->FileInfo.AllocationSize);
if (0 == FileNode->FileData)
{
MemfsFileNodeDelete(FileNode);
return STATUS_INSUFFICIENT_RESOURCES;
}
}
Result = MemfsFileNodeMapInsert(Memfs->FileNodeMap, FileNode, &Inserted);
if (!NT_SUCCESS(Result) || !Inserted)
{
MemfsFileNodeDelete(FileNode);
if (NT_SUCCESS(Result))
Result = STATUS_OBJECT_NAME_COLLISION; /* should not happen! */
return Result;
}
MemfsFileNodeReference(FileNode);
*PFileNode = FileNode;
MemfsFileNodeGetFileInfo(FileNode, FileInfo);
#if defined(MEMFS_NAME_NORMALIZATION)
if (MemfsFileNodeMapIsCaseInsensitive(Memfs->FileNodeMap))
{
FSP_FSCTL_OPEN_FILE_INFO *OpenFileInfo = FspFileSystemGetOpenFileInfo(FileInfo);
wcscpy_s(OpenFileInfo->NormalizedName, OpenFileInfo->NormalizedNameSize / sizeof(WCHAR),
FileNode->FileName);
OpenFileInfo->NormalizedNameSize = (UINT16)(wcslen(FileNode->FileName) * sizeof(WCHAR));
}
#endif
return STATUS_SUCCESS;
}
static NTSTATUS Open(FSP_FILE_SYSTEM *FileSystem,
PWSTR FileName, UINT32 CreateOptions, UINT32 GrantedAccess,
PVOID *PFileNode, FSP_FSCTL_FILE_INFO *FileInfo)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
MEMFS_FILE_NODE *FileNode;
NTSTATUS Result;
if (MEMFS_MAX_PATH <= wcslen(FileName))
return STATUS_OBJECT_NAME_INVALID;
FileNode = MemfsFileNodeMapGet(Memfs->FileNodeMap, FileName);
if (0 == FileNode)
{
Result = STATUS_OBJECT_NAME_NOT_FOUND;
MemfsFileNodeMapGetParent(Memfs->FileNodeMap, FileName, &Result);
return Result;
}
#if defined(MEMFS_EA)
/* if the OP specified no EA's check the need EA count, but only if accessing main stream */
if (0 != (CreateOptions & FILE_NO_EA_KNOWLEDGE)
#if defined(MEMFS_NAMED_STREAMS)
&& (0 == FileNode->MainFileNode)
#endif
)
{
if (MemfsFileNodeNeedEa(FileNode))
{
Result = STATUS_ACCESS_DENIED;
return Result;
}
}
#endif
MemfsFileNodeReference(FileNode);
*PFileNode = FileNode;
MemfsFileNodeGetFileInfo(FileNode, FileInfo);
#if defined(MEMFS_NAME_NORMALIZATION)
if (MemfsFileNodeMapIsCaseInsensitive(Memfs->FileNodeMap))
{
FSP_FSCTL_OPEN_FILE_INFO *OpenFileInfo = FspFileSystemGetOpenFileInfo(FileInfo);
wcscpy_s(OpenFileInfo->NormalizedName, OpenFileInfo->NormalizedNameSize / sizeof(WCHAR),
FileNode->FileName);
OpenFileInfo->NormalizedNameSize = (UINT16)(wcslen(FileNode->FileName) * sizeof(WCHAR));
}
#endif
return STATUS_SUCCESS;
}
static NTSTATUS Overwrite(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0, UINT32 FileAttributes, BOOLEAN ReplaceFileAttributes, UINT64 AllocationSize,
#if defined(MEMFS_EA)
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength,
#endif
FSP_FSCTL_FILE_INFO *FileInfo)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
NTSTATUS Result;
#if defined(MEMFS_NAMED_STREAMS)
MEMFS_FILE_NODE_MAP_ENUM_CONTEXT Context = { TRUE };
ULONG Index;
MemfsFileNodeMapEnumerateNamedStreams(Memfs->FileNodeMap, FileNode,
MemfsFileNodeMapEnumerateFn, &Context);
for (Index = 0; Context.Count > Index; Index++)
{
LONG RefCount = FspInterlockedLoad32((INT32 *)&Context.FileNodes[Index]->RefCount);
if (2 >= RefCount)
MemfsFileNodeMapRemove(Memfs->FileNodeMap, Context.FileNodes[Index]);
}
MemfsFileNodeMapEnumerateFree(&Context);
#endif
#if defined(MEMFS_EA)
MemfsFileNodeDeleteEaMap(FileNode);
if (0 != Ea)
{
Result = FspFileSystemEnumerateEa(FileSystem, MemfsFileNodeSetEa, FileNode, Ea, EaLength);
if (!NT_SUCCESS(Result))
return Result;
}
#endif
Result = SetFileSizeInternal(FileSystem, FileNode, AllocationSize, TRUE);
if (!NT_SUCCESS(Result))
return Result;
if (ReplaceFileAttributes)
FileNode->FileInfo.FileAttributes = FileAttributes | FILE_ATTRIBUTE_ARCHIVE;
else
FileNode->FileInfo.FileAttributes |= FileAttributes | FILE_ATTRIBUTE_ARCHIVE;
FileNode->FileInfo.FileSize = 0;
FileNode->FileInfo.LastAccessTime =
FileNode->FileInfo.LastWriteTime =
FileNode->FileInfo.ChangeTime = MemfsGetSystemTime();
MemfsFileNodeGetFileInfo(FileNode, FileInfo);
return STATUS_SUCCESS;
}
static VOID Cleanup(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0, PWSTR FileName, ULONG Flags)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
#if defined(MEMFS_NAMED_STREAMS)
MEMFS_FILE_NODE *MainFileNode = 0 != FileNode->MainFileNode ?
FileNode->MainFileNode : FileNode;
#else
MEMFS_FILE_NODE *MainFileNode = FileNode;
#endif
assert(0 != Flags); /* FSP_FSCTL_VOLUME_PARAMS::PostCleanupWhenModifiedOnly ensures this */
if (Flags & FspCleanupSetArchiveBit)
{
if (0 == (MainFileNode->FileInfo.FileAttributes & FILE_ATTRIBUTE_DIRECTORY))
MainFileNode->FileInfo.FileAttributes |= FILE_ATTRIBUTE_ARCHIVE;
}
if (Flags & (FspCleanupSetLastAccessTime | FspCleanupSetLastWriteTime | FspCleanupSetChangeTime))
{
UINT64 SystemTime = MemfsGetSystemTime();
if (Flags & FspCleanupSetLastAccessTime)
MainFileNode->FileInfo.LastAccessTime = SystemTime;
if (Flags & FspCleanupSetLastWriteTime)
MainFileNode->FileInfo.LastWriteTime = SystemTime;
if (Flags & FspCleanupSetChangeTime)
MainFileNode->FileInfo.ChangeTime = SystemTime;
}
if (Flags & FspCleanupSetAllocationSize)
{
UINT64 AllocationUnit = MEMFS_SECTOR_SIZE * MEMFS_SECTORS_PER_ALLOCATION_UNIT;
UINT64 AllocationSize = (FileNode->FileInfo.FileSize + AllocationUnit - 1) /
AllocationUnit * AllocationUnit;
SetFileSizeInternal(FileSystem, FileNode, AllocationSize, TRUE);
}
if ((Flags & FspCleanupDelete) && !MemfsFileNodeMapHasChild(Memfs->FileNodeMap, FileNode))
{
#if defined(MEMFS_NAMED_STREAMS)
MEMFS_FILE_NODE_MAP_ENUM_CONTEXT Context = { FALSE };
ULONG Index;
MemfsFileNodeMapEnumerateNamedStreams(Memfs->FileNodeMap, FileNode,
MemfsFileNodeMapEnumerateFn, &Context);
for (Index = 0; Context.Count > Index; Index++)
MemfsFileNodeMapRemove(Memfs->FileNodeMap, Context.FileNodes[Index]);
MemfsFileNodeMapEnumerateFree(&Context);
#endif
MemfsFileNodeMapRemove(Memfs->FileNodeMap, FileNode);
}
}
static VOID Close(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
MemfsFileNodeDereference(FileNode);
}
static NTSTATUS Read(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0, PVOID Buffer, UINT64 Offset, ULONG Length,
PULONG PBytesTransferred)
{
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
UINT64 EndOffset;
if (Offset >= FileNode->FileInfo.FileSize)
return STATUS_END_OF_FILE;
EndOffset = Offset + Length;
if (EndOffset > FileNode->FileInfo.FileSize)
EndOffset = FileNode->FileInfo.FileSize;
#ifdef MEMFS_SLOWIO
if (SlowioReturnPending(FileSystem))
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
try
{
InterlockedIncrement(&Memfs->SlowioThreadsRunning);
std::thread(SlowioReadThread,
FileSystem, FileNode, Buffer, Offset, EndOffset,
FspFileSystemGetOperationContext()->Request->Hint).
detach();
return STATUS_PENDING;
}
catch (...)
{
InterlockedDecrement(&Memfs->SlowioThreadsRunning);
}
}
SlowioSnooze(FileSystem);
#endif
memcpy(Buffer, (PUINT8)FileNode->FileData + Offset, (size_t)(EndOffset - Offset));
*PBytesTransferred = (ULONG)(EndOffset - Offset);
return STATUS_SUCCESS;
}
static NTSTATUS Write(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0, PVOID Buffer, UINT64 Offset, ULONG Length,
BOOLEAN WriteToEndOfFile, BOOLEAN ConstrainedIo,
PULONG PBytesTransferred, FSP_FSCTL_FILE_INFO *FileInfo)
{
#if defined(DEBUG_BUFFER_CHECK)
SYSTEM_INFO SystemInfo;
GetSystemInfo(&SystemInfo);
for (PUINT8 P = (PUINT8)Buffer, EndP = P + Length; EndP > P; P += SystemInfo.dwPageSize)
__try
{
*P = *P | 0;
assert(!IsWindows8OrGreater());
/* only on Windows 8 we can make the buffer read-only! */
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
/* ignore! */
}
#endif
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
UINT64 EndOffset;
NTSTATUS Result;
if (ConstrainedIo)
{
if (Offset >= FileNode->FileInfo.FileSize)
return STATUS_SUCCESS;
EndOffset = Offset + Length;
if (EndOffset > FileNode->FileInfo.FileSize)
EndOffset = FileNode->FileInfo.FileSize;
}
else
{
if (WriteToEndOfFile)
Offset = FileNode->FileInfo.FileSize;
EndOffset = Offset + Length;
if (EndOffset > FileNode->FileInfo.FileSize)
{
Result = SetFileSizeInternal(FileSystem, FileNode, EndOffset, FALSE);
if (!NT_SUCCESS(Result))
return Result;
}
}
#ifdef MEMFS_SLOWIO
if (SlowioReturnPending(FileSystem))
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
try
{
InterlockedIncrement(&Memfs->SlowioThreadsRunning);
std::thread(SlowioWriteThread,
FileSystem, FileNode, Buffer, Offset, EndOffset,
FspFileSystemGetOperationContext()->Request->Hint).
detach();
return STATUS_PENDING;
}
catch (...)
{
InterlockedDecrement(&Memfs->SlowioThreadsRunning);
}
}
SlowioSnooze(FileSystem);
#endif
memcpy((PUINT8)FileNode->FileData + Offset, Buffer, (size_t)(EndOffset - Offset));
*PBytesTransferred = (ULONG)(EndOffset - Offset);
MemfsFileNodeGetFileInfo(FileNode, FileInfo);
return STATUS_SUCCESS;
}
NTSTATUS Flush(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0,
FSP_FSCTL_FILE_INFO *FileInfo)
{
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
/* nothing to flush, since we do not cache anything */
if (0 != FileNode)
{
#if 0
#if defined(MEMFS_NAMED_STREAMS)
if (0 != FileNode->MainFileNode)
FileNode->MainFileNode->FileInfo.LastAccessTime =
FileNode->MainFileNode->FileInfo.LastWriteTime =
FileNode->MainFileNode->FileInfo.ChangeTime = MemfsGetSystemTime();
else
#endif
FileNode->FileInfo.LastAccessTime =
FileNode->FileInfo.LastWriteTime =
FileNode->FileInfo.ChangeTime = MemfsGetSystemTime();
#endif
MemfsFileNodeGetFileInfo(FileNode, FileInfo);
}
return STATUS_SUCCESS;
}
static NTSTATUS GetFileInfo(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0,
FSP_FSCTL_FILE_INFO *FileInfo)
{
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
MemfsFileNodeGetFileInfo(FileNode, FileInfo);
return STATUS_SUCCESS;
}
static NTSTATUS SetBasicInfo(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0, UINT32 FileAttributes,
UINT64 CreationTime, UINT64 LastAccessTime, UINT64 LastWriteTime, UINT64 ChangeTime,
FSP_FSCTL_FILE_INFO *FileInfo)
{
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
#if defined(MEMFS_NAMED_STREAMS)
if (0 != FileNode->MainFileNode)
FileNode = FileNode->MainFileNode;
#endif
if (INVALID_FILE_ATTRIBUTES != FileAttributes)
FileNode->FileInfo.FileAttributes = FileAttributes;
if (0 != CreationTime)
FileNode->FileInfo.CreationTime = CreationTime;
if (0 != LastAccessTime)
FileNode->FileInfo.LastAccessTime = LastAccessTime;
if (0 != LastWriteTime)
FileNode->FileInfo.LastWriteTime = LastWriteTime;
if (0 != ChangeTime)
FileNode->FileInfo.ChangeTime = ChangeTime;
MemfsFileNodeGetFileInfo(FileNode, FileInfo);
return STATUS_SUCCESS;
}
static NTSTATUS SetFileSizeInternal(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0, UINT64 NewSize, BOOLEAN SetAllocationSize)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
if (SetAllocationSize)
{
if (FileNode->FileInfo.AllocationSize != NewSize)
{
if (NewSize > Memfs->MaxFileSize)
return STATUS_DISK_FULL;
PVOID FileData = LargeHeapRealloc(FileNode->FileData, (size_t)NewSize);
if (0 == FileData && 0 != NewSize)
return STATUS_INSUFFICIENT_RESOURCES;
FileNode->FileData = FileData;
FileNode->FileInfo.AllocationSize = NewSize;
if (FileNode->FileInfo.FileSize > NewSize)
FileNode->FileInfo.FileSize = NewSize;
}
}
else
{
if (FileNode->FileInfo.FileSize != NewSize)
{
if (FileNode->FileInfo.AllocationSize < NewSize)
{
UINT64 AllocationUnit = MEMFS_SECTOR_SIZE * MEMFS_SECTORS_PER_ALLOCATION_UNIT;
UINT64 AllocationSize = (NewSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit;
NTSTATUS Result = SetFileSizeInternal(FileSystem, FileNode, AllocationSize, TRUE);
if (!NT_SUCCESS(Result))
return Result;
}
if (FileNode->FileInfo.FileSize < NewSize)
memset((PUINT8)FileNode->FileData + FileNode->FileInfo.FileSize, 0,
(size_t)(NewSize - FileNode->FileInfo.FileSize));
FileNode->FileInfo.FileSize = NewSize;
}
}
return STATUS_SUCCESS;
}
static NTSTATUS SetFileSize(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0, UINT64 NewSize, BOOLEAN SetAllocationSize,
FSP_FSCTL_FILE_INFO *FileInfo)
{
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
NTSTATUS Result;
Result = SetFileSizeInternal(FileSystem, FileNode0, NewSize, SetAllocationSize);
if (!NT_SUCCESS(Result))
return Result;
MemfsFileNodeGetFileInfo(FileNode, FileInfo);
return STATUS_SUCCESS;
}
static NTSTATUS CanDelete(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0, PWSTR FileName)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
if (MemfsFileNodeMapHasChild(Memfs->FileNodeMap, FileNode))
return STATUS_DIRECTORY_NOT_EMPTY;
return STATUS_SUCCESS;
}
static NTSTATUS Rename(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0,
PWSTR FileName, PWSTR NewFileName, BOOLEAN ReplaceIfExists)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
MEMFS_FILE_NODE *NewFileNode, *DescendantFileNode;
MEMFS_FILE_NODE_MAP_ENUM_CONTEXT Context = { TRUE };
ULONG Index, FileNameLen, NewFileNameLen;
BOOLEAN Inserted;
NTSTATUS Result;
NewFileNode = MemfsFileNodeMapGet(Memfs->FileNodeMap, NewFileName);
if (0 != NewFileNode && FileNode != NewFileNode)
{
if (!ReplaceIfExists)
{
Result = STATUS_OBJECT_NAME_COLLISION;
goto exit;
}
if (NewFileNode->FileInfo.FileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
Result = STATUS_ACCESS_DENIED;
goto exit;
}
}
MemfsFileNodeMapEnumerateDescendants(Memfs->FileNodeMap, FileNode,
MemfsFileNodeMapEnumerateFn, &Context);
FileNameLen = (ULONG)wcslen(FileNode->FileName);
NewFileNameLen = (ULONG)wcslen(NewFileName);
for (Index = 0; Context.Count > Index; Index++)
{
DescendantFileNode = Context.FileNodes[Index];
if (MEMFS_MAX_PATH <= wcslen(DescendantFileNode->FileName) - FileNameLen + NewFileNameLen)
{
Result = STATUS_OBJECT_NAME_INVALID;
goto exit;
}
}
if (0 != NewFileNode)
{
MemfsFileNodeReference(NewFileNode);
MemfsFileNodeMapRemove(Memfs->FileNodeMap, NewFileNode);
MemfsFileNodeDereference(NewFileNode);
}
for (Index = 0; Context.Count > Index; Index++)
{
DescendantFileNode = Context.FileNodes[Index];
MemfsFileNodeMapRemove(Memfs->FileNodeMap, DescendantFileNode);
memmove(DescendantFileNode->FileName + NewFileNameLen,
DescendantFileNode->FileName + FileNameLen,
(wcslen(DescendantFileNode->FileName) + 1 - FileNameLen) * sizeof(WCHAR));
memcpy(DescendantFileNode->FileName, NewFileName, NewFileNameLen * sizeof(WCHAR));
Result = MemfsFileNodeMapInsert(Memfs->FileNodeMap, DescendantFileNode, &Inserted);
if (!NT_SUCCESS(Result))
{
FspDebugLog(__FUNCTION__ ": cannot insert into FileNodeMap; aborting\n");
abort();
}
assert(Inserted);
}
Result = STATUS_SUCCESS;
exit:
MemfsFileNodeMapEnumerateFree(&Context);
return Result;
}
static NTSTATUS GetSecurity(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0,
PSECURITY_DESCRIPTOR SecurityDescriptor, SIZE_T *PSecurityDescriptorSize)
{
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
#if defined(MEMFS_NAMED_STREAMS)
if (0 != FileNode->MainFileNode)
FileNode = FileNode->MainFileNode;
#endif
if (FileNode->FileSecuritySize > *PSecurityDescriptorSize)
{
*PSecurityDescriptorSize = FileNode->FileSecuritySize;
return STATUS_BUFFER_OVERFLOW;
}
*PSecurityDescriptorSize = FileNode->FileSecuritySize;
if (0 != SecurityDescriptor)
memcpy(SecurityDescriptor, FileNode->FileSecurity, FileNode->FileSecuritySize);
return STATUS_SUCCESS;
}
static NTSTATUS SetSecurity(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0,
SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor)
{
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
PSECURITY_DESCRIPTOR NewSecurityDescriptor, FileSecurity;
SIZE_T FileSecuritySize;
NTSTATUS Result;
#if defined(MEMFS_NAMED_STREAMS)
if (0 != FileNode->MainFileNode)
FileNode = FileNode->MainFileNode;
#endif
Result = FspSetSecurityDescriptor(
FileNode->FileSecurity,
SecurityInformation,
ModificationDescriptor,
&NewSecurityDescriptor);
if (!NT_SUCCESS(Result))
return Result;
FileSecuritySize = GetSecurityDescriptorLength(NewSecurityDescriptor);
FileSecurity = (PSECURITY_DESCRIPTOR)malloc(FileSecuritySize);
if (0 == FileSecurity)
{
FspDeleteSecurityDescriptor(NewSecurityDescriptor, (NTSTATUS (*)())FspSetSecurityDescriptor);
return STATUS_INSUFFICIENT_RESOURCES;
}
memcpy(FileSecurity, NewSecurityDescriptor, FileSecuritySize);
FspDeleteSecurityDescriptor(NewSecurityDescriptor, (NTSTATUS (*)())FspSetSecurityDescriptor);
free(FileNode->FileSecurity);
FileNode->FileSecuritySize = FileSecuritySize;
FileNode->FileSecurity = FileSecurity;
return STATUS_SUCCESS;
}
typedef struct _MEMFS_READ_DIRECTORY_CONTEXT
{
PVOID Buffer;
ULONG Length;
PULONG PBytesTransferred;
} MEMFS_READ_DIRECTORY_CONTEXT;
static BOOLEAN AddDirInfo(MEMFS_FILE_NODE *FileNode, PWSTR FileName,
PVOID Buffer, ULONG Length, PULONG PBytesTransferred)
{
UINT8 DirInfoBuf[sizeof(FSP_FSCTL_DIR_INFO) + sizeof FileNode->FileName];
FSP_FSCTL_DIR_INFO *DirInfo = (FSP_FSCTL_DIR_INFO *)DirInfoBuf;
WCHAR Root[2] = L"\\";
PWSTR Remain, Suffix;
if (0 == FileName)
{
FspPathSuffix(FileNode->FileName, &Remain, &Suffix, Root);
FileName = Suffix;
FspPathCombine(FileNode->FileName, Suffix);
}
memset(DirInfo->Padding, 0, sizeof DirInfo->Padding);
DirInfo->Size = (UINT16)(sizeof(FSP_FSCTL_DIR_INFO) + wcslen(FileName) * sizeof(WCHAR));
DirInfo->FileInfo = FileNode->FileInfo;
memcpy(DirInfo->FileNameBuf, FileName, DirInfo->Size - sizeof(FSP_FSCTL_DIR_INFO));
return FspFileSystemAddDirInfo(DirInfo, Buffer, Length, PBytesTransferred);
}
static BOOLEAN ReadDirectoryEnumFn(MEMFS_FILE_NODE *FileNode, PVOID Context0)
{
MEMFS_READ_DIRECTORY_CONTEXT *Context = (MEMFS_READ_DIRECTORY_CONTEXT *)Context0;
return AddDirInfo(FileNode, 0,
Context->Buffer, Context->Length, Context->PBytesTransferred);
}
static NTSTATUS ReadDirectory(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0, PWSTR Pattern, PWSTR Marker,
PVOID Buffer, ULONG Length, PULONG PBytesTransferred)
{
assert(0 == Pattern);
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
MEMFS_FILE_NODE *ParentNode;
MEMFS_READ_DIRECTORY_CONTEXT Context;
NTSTATUS Result;
Context.Buffer = Buffer;
Context.Length = Length;
Context.PBytesTransferred = PBytesTransferred;
if (L'\0' != FileNode->FileName[1])
{
/* if this is not the root directory add the dot entries */
ParentNode = MemfsFileNodeMapGetParent(Memfs->FileNodeMap, FileNode->FileName, &Result);
if (0 == ParentNode)
return Result;
if (0 == Marker)
{
if (!AddDirInfo(FileNode, L".", Buffer, Length, PBytesTransferred))
return STATUS_SUCCESS;
}
if (0 == Marker || (L'.' == Marker[0] && L'\0' == Marker[1]))
{
if (!AddDirInfo(ParentNode, L"..", Buffer, Length, PBytesTransferred))
return STATUS_SUCCESS;
Marker = 0;
}
}
if (MemfsFileNodeMapEnumerateChildren(Memfs->FileNodeMap, FileNode, Marker,
ReadDirectoryEnumFn, &Context))
FspFileSystemAddDirInfo(0, Buffer, Length, PBytesTransferred);
#ifdef MEMFS_SLOWIO
if (SlowioReturnPending(FileSystem))
{
try
{
InterlockedIncrement(&Memfs->SlowioThreadsRunning);
std::thread(SlowioReadDirectoryThread,
FileSystem, *PBytesTransferred,
FspFileSystemGetOperationContext()->Request->Hint).
detach();
return STATUS_PENDING;
}
catch (...)
{
InterlockedDecrement(&Memfs->SlowioThreadsRunning);
}
}
SlowioSnooze(FileSystem);
#endif
return STATUS_SUCCESS;
}
#if defined(MEMFS_DIRINFO_BY_NAME)
static NTSTATUS GetDirInfoByName(FSP_FILE_SYSTEM *FileSystem,
PVOID ParentNode0, PWSTR FileName,
FSP_FSCTL_DIR_INFO *DirInfo)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
MEMFS_FILE_NODE *ParentNode = (MEMFS_FILE_NODE *)ParentNode0;
MEMFS_FILE_NODE *FileNode;
WCHAR FileNameBuf[MEMFS_MAX_PATH];
size_t ParentLength, BSlashLength, FileNameLength;
WCHAR Root[2] = L"\\";
PWSTR Remain, Suffix;
ParentLength = wcslen(ParentNode->FileName);
BSlashLength = 1 < ParentLength;
FileNameLength = wcslen(FileName);
if (MEMFS_MAX_PATH <= ParentLength + BSlashLength + FileNameLength)
return STATUS_OBJECT_NAME_NOT_FOUND; //STATUS_OBJECT_NAME_INVALID?
memcpy(FileNameBuf, ParentNode->FileName, ParentLength * sizeof(WCHAR));
memcpy(FileNameBuf + ParentLength, L"\\", BSlashLength * sizeof(WCHAR));
memcpy(FileNameBuf + ParentLength + BSlashLength, FileName, (FileNameLength + 1) * sizeof(WCHAR));
FileName = FileNameBuf;
FileNode = MemfsFileNodeMapGet(Memfs->FileNodeMap, FileName);
if (0 == FileNode)
return STATUS_OBJECT_NAME_NOT_FOUND;
FspPathSuffix(FileNode->FileName, &Remain, &Suffix, Root);
FileName = Suffix;
FspPathCombine(FileNode->FileName, Suffix);
//memset(DirInfo->Padding, 0, sizeof DirInfo->Padding);
DirInfo->Size = (UINT16)(sizeof(FSP_FSCTL_DIR_INFO) + wcslen(FileName) * sizeof(WCHAR));
DirInfo->FileInfo = FileNode->FileInfo;
memcpy(DirInfo->FileNameBuf, FileName, DirInfo->Size - sizeof(FSP_FSCTL_DIR_INFO));
return STATUS_SUCCESS;
}
#endif
#if defined(MEMFS_REPARSE_POINTS)
static NTSTATUS ResolveReparsePoints(FSP_FILE_SYSTEM *FileSystem,
PWSTR FileName, UINT32 ReparsePointIndex, BOOLEAN ResolveLastPathComponent,
PIO_STATUS_BLOCK PIoStatus, PVOID Buffer, PSIZE_T PSize)
{
return FspFileSystemResolveReparsePoints(FileSystem, GetReparsePointByName, 0,
FileName, ReparsePointIndex, ResolveLastPathComponent,
PIoStatus, Buffer, PSize);
}
static NTSTATUS GetReparsePointByName(
FSP_FILE_SYSTEM *FileSystem, PVOID Context,
PWSTR FileName, BOOLEAN IsDirectory, PVOID Buffer, PSIZE_T PSize)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
MEMFS_FILE_NODE *FileNode;
#if defined(MEMFS_NAMED_STREAMS)
/* GetReparsePointByName will never receive a named stream */
assert(0 == wcschr(FileName, L':'));
#endif
FileNode = MemfsFileNodeMapGet(Memfs->FileNodeMap, FileName);
if (0 == FileNode)
return STATUS_OBJECT_NAME_NOT_FOUND;
if (0 == (FileNode->FileInfo.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT))
return STATUS_NOT_A_REPARSE_POINT;
if (0 != Buffer)
{
if (FileNode->ReparseDataSize > *PSize)
return STATUS_BUFFER_TOO_SMALL;
*PSize = FileNode->ReparseDataSize;
memcpy(Buffer, FileNode->ReparseData, FileNode->ReparseDataSize);
}
return STATUS_SUCCESS;
}
static NTSTATUS GetReparsePoint(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0,
PWSTR FileName, PVOID Buffer, PSIZE_T PSize)
{
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
#if defined(MEMFS_NAMED_STREAMS)
if (0 != FileNode->MainFileNode)
FileNode = FileNode->MainFileNode;
#endif
if (0 == (FileNode->FileInfo.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT))
return STATUS_NOT_A_REPARSE_POINT;
if (FileNode->ReparseDataSize > *PSize)
return STATUS_BUFFER_TOO_SMALL;
*PSize = FileNode->ReparseDataSize;
memcpy(Buffer, FileNode->ReparseData, FileNode->ReparseDataSize);
return STATUS_SUCCESS;
}
static NTSTATUS SetReparsePoint(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0,
PWSTR FileName, PVOID Buffer, SIZE_T Size)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
PVOID ReparseData;
NTSTATUS Result;
#if defined(MEMFS_NAMED_STREAMS)
if (0 != FileNode->MainFileNode)
FileNode = FileNode->MainFileNode;
#endif
if (MemfsFileNodeMapHasChild(Memfs->FileNodeMap, FileNode))
return STATUS_DIRECTORY_NOT_EMPTY;
if (0 != FileNode->ReparseData)
{
Result = FspFileSystemCanReplaceReparsePoint(
FileNode->ReparseData, FileNode->ReparseDataSize,
Buffer, Size);
if (!NT_SUCCESS(Result))
return Result;
}
ReparseData = realloc(FileNode->ReparseData, Size);
if (0 == ReparseData && 0 != Size)
return STATUS_INSUFFICIENT_RESOURCES;
FileNode->FileInfo.FileAttributes |= FILE_ATTRIBUTE_REPARSE_POINT;
FileNode->FileInfo.ReparseTag = *(PULONG)Buffer;
/* the first field in a reparse buffer is the reparse tag */
FileNode->ReparseDataSize = Size;
FileNode->ReparseData = ReparseData;
memcpy(FileNode->ReparseData, Buffer, Size);
return STATUS_SUCCESS;
}
static NTSTATUS DeleteReparsePoint(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0,
PWSTR FileName, PVOID Buffer, SIZE_T Size)
{
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
NTSTATUS Result;
#if defined(MEMFS_NAMED_STREAMS)
if (0 != FileNode->MainFileNode)
FileNode = FileNode->MainFileNode;
#endif
if (0 != FileNode->ReparseData)
{
Result = FspFileSystemCanReplaceReparsePoint(
FileNode->ReparseData, FileNode->ReparseDataSize,
Buffer, Size);
if (!NT_SUCCESS(Result))
return Result;
}
else
return STATUS_NOT_A_REPARSE_POINT;
free(FileNode->ReparseData);
FileNode->FileInfo.FileAttributes &= ~FILE_ATTRIBUTE_REPARSE_POINT;
FileNode->FileInfo.ReparseTag = 0;
FileNode->ReparseDataSize = 0;
FileNode->ReparseData = 0;
return STATUS_SUCCESS;
}
#endif
#if defined(MEMFS_NAMED_STREAMS)
typedef struct _MEMFS_GET_STREAM_INFO_CONTEXT
{
PVOID Buffer;
ULONG Length;
PULONG PBytesTransferred;
} MEMFS_GET_STREAM_INFO_CONTEXT;
static BOOLEAN AddStreamInfo(MEMFS_FILE_NODE *FileNode,
PVOID Buffer, ULONG Length, PULONG PBytesTransferred)
{
UINT8 StreamInfoBuf[sizeof(FSP_FSCTL_STREAM_INFO) + sizeof FileNode->FileName];
FSP_FSCTL_STREAM_INFO *StreamInfo = (FSP_FSCTL_STREAM_INFO *)StreamInfoBuf;
PWSTR StreamName;
StreamName = wcschr(FileNode->FileName, L':');
if (0 != StreamName)
StreamName++;
else
StreamName = L"";
StreamInfo->Size = (UINT16)(sizeof(FSP_FSCTL_STREAM_INFO) + wcslen(StreamName) * sizeof(WCHAR));
StreamInfo->StreamSize = FileNode->FileInfo.FileSize;
StreamInfo->StreamAllocationSize = FileNode->FileInfo.AllocationSize;
memcpy(StreamInfo->StreamNameBuf, StreamName, StreamInfo->Size - sizeof(FSP_FSCTL_STREAM_INFO));
return FspFileSystemAddStreamInfo(StreamInfo, Buffer, Length, PBytesTransferred);
}
static BOOLEAN GetStreamInfoEnumFn(MEMFS_FILE_NODE *FileNode, PVOID Context0)
{
MEMFS_GET_STREAM_INFO_CONTEXT *Context = (MEMFS_GET_STREAM_INFO_CONTEXT *)Context0;
return AddStreamInfo(FileNode,
Context->Buffer, Context->Length, Context->PBytesTransferred);
}
static NTSTATUS GetStreamInfo(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0, PVOID Buffer, ULONG Length,
PULONG PBytesTransferred)
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
MEMFS_GET_STREAM_INFO_CONTEXT Context;
if (0 != FileNode->MainFileNode)
FileNode = FileNode->MainFileNode;
Context.Buffer = Buffer;
Context.Length = Length;
Context.PBytesTransferred = PBytesTransferred;
if (0 == (FileNode->FileInfo.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
!AddStreamInfo(FileNode, Buffer, Length, PBytesTransferred))
return STATUS_SUCCESS;
if (MemfsFileNodeMapEnumerateNamedStreams(Memfs->FileNodeMap, FileNode, GetStreamInfoEnumFn, &Context))
FspFileSystemAddStreamInfo(0, Buffer, Length, PBytesTransferred);
/* ???: how to handle out of response buffer condition? */
return STATUS_SUCCESS;
}
#endif
#if defined(MEMFS_CONTROL)
static NTSTATUS Control(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode, UINT32 ControlCode,
PVOID InputBuffer, ULONG InputBufferLength,
PVOID OutputBuffer, ULONG OutputBufferLength, PULONG PBytesTransferred)
{
/* MEMFS also supports encryption! See below :) */
if (CTL_CODE(0x8000 + 'M', 'R', METHOD_BUFFERED, FILE_ANY_ACCESS) == ControlCode)
{
if (OutputBufferLength != InputBufferLength)
return STATUS_INVALID_PARAMETER;
for (PUINT8 P = (PUINT8)InputBuffer, Q = (PUINT8)OutputBuffer, EndP = P + InputBufferLength;
EndP > P; P++, Q++)
{
if (('A' <= *P && *P <= 'M') || ('a' <= *P && *P <= 'm'))
*Q = *P + 13;
else
if (('N' <= *P && *P <= 'Z') || ('n' <= *P && *P <= 'z'))
*Q = *P - 13;
else
*Q = *P;
}
*PBytesTransferred = InputBufferLength;
return STATUS_SUCCESS;
}
return STATUS_INVALID_DEVICE_REQUEST;
}
#endif
#if defined(MEMFS_EA)
typedef struct _MEMFS_GET_EA_CONTEXT
{
PFILE_FULL_EA_INFORMATION Ea;
ULONG EaLength;
PULONG PBytesTransferred;
} MEMFS_GET_EA_CONTEXT;
static BOOLEAN GetEaEnumFn(PFILE_FULL_EA_INFORMATION Ea, PVOID Context0)
{
MEMFS_GET_EA_CONTEXT *Context = (MEMFS_GET_EA_CONTEXT *)Context0;
return FspFileSystemAddEa(Ea,
Context->Ea, Context->EaLength, Context->PBytesTransferred);
}
static NTSTATUS GetEa(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0,
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength, PULONG PBytesTransferred)
{
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
MEMFS_GET_EA_CONTEXT Context;
Context.Ea = Ea;
Context.EaLength = EaLength;
Context.PBytesTransferred = PBytesTransferred;
if (MemfsFileNodeEnumerateEa(FileNode, GetEaEnumFn, &Context))
FspFileSystemAddEa(0, Ea, EaLength, PBytesTransferred);
return STATUS_SUCCESS;
}
static NTSTATUS SetEa(FSP_FILE_SYSTEM *FileSystem,
PVOID FileNode0,
PFILE_FULL_EA_INFORMATION Ea, ULONG EaLength,
FSP_FSCTL_FILE_INFO *FileInfo)
{
MEMFS_FILE_NODE *FileNode = (MEMFS_FILE_NODE *)FileNode0;
NTSTATUS Result;
Result = FspFileSystemEnumerateEa(FileSystem, MemfsFileNodeSetEa, FileNode, Ea, EaLength);
if (!NT_SUCCESS(Result))
return Result;
MemfsFileNodeGetFileInfo(FileNode, FileInfo);
return STATUS_SUCCESS;
}
#endif
#if defined(MEMFS_DISPATCHER_STOPPED)
static VOID DispatcherStopped(FSP_FILE_SYSTEM *FileSystem,
BOOLEAN Normally)
{
FspFileSystemStopServiceIfNecessary(FileSystem, Normally);
}
#endif
static FSP_FILE_SYSTEM_INTERFACE MemfsInterface =
{
GetVolumeInfo,
SetVolumeLabel,
GetSecurityByName,
#if defined(MEMFS_EA) || defined(MEMFS_WSL)
0,
#else
Create,
#endif
Open,
#if defined(MEMFS_EA)
0,
#else
Overwrite,
#endif
Cleanup,
Close,
Read,
Write,
Flush,
GetFileInfo,
SetBasicInfo,
SetFileSize,
CanDelete,
Rename,
GetSecurity,
SetSecurity,
ReadDirectory,
#if defined(MEMFS_REPARSE_POINTS)
ResolveReparsePoints,
GetReparsePoint,
SetReparsePoint,
DeleteReparsePoint,
#else
0,
0,
0,
0,
#endif
#if defined(MEMFS_NAMED_STREAMS)
GetStreamInfo,
#else
0,
#endif
#if defined(MEMFS_DIRINFO_BY_NAME)
GetDirInfoByName,
#else
0,
#endif
#if defined(MEMFS_CONTROL)
Control,
#else
0,
#endif
0,
#if defined(MEMFS_EA) || defined(MEMFS_WSL)
Create,
#endif
#if defined(MEMFS_EA)
Overwrite,
GetEa,
SetEa,
#else
0,
0,
0,
#endif
0,
#if defined(MEMFS_DISPATCHER_STOPPED)
DispatcherStopped,
#else
0,
#endif
};
/*
* Public API
*/
NTSTATUS MemfsCreateFunnel(
ULONG Flags,
ULONG FileInfoTimeout,
ULONG MaxFileNodes,
ULONG MaxFileSize,
ULONG SlowioMaxDelay,
ULONG SlowioPercentDelay,
ULONG SlowioRarefyDelay,
PWSTR FileSystemName,
PWSTR VolumePrefix,
PWSTR RootSddl,
MEMFS **PMemfs)
{
NTSTATUS Result;
FSP_FSCTL_VOLUME_PARAMS VolumeParams;
BOOLEAN CaseInsensitive = !!(Flags & MemfsCaseInsensitive);
BOOLEAN FlushAndPurgeOnCleanup = !!(Flags & MemfsFlushAndPurgeOnCleanup);
BOOLEAN SupportsPosixUnlinkRename = !(Flags & MemfsLegacyUnlinkRename);
PWSTR DevicePath = MemfsNet == (Flags & MemfsDeviceMask) ?
L"" FSP_FSCTL_NET_DEVICE_NAME : L"" FSP_FSCTL_DISK_DEVICE_NAME;
UINT64 AllocationUnit;
MEMFS *Memfs;
MEMFS_FILE_NODE *RootNode;
PSECURITY_DESCRIPTOR RootSecurity;
ULONG RootSecuritySize;
BOOLEAN Inserted;
*PMemfs = 0;
Result = MemfsHeapConfigure(0, 0, 0);
if (!NT_SUCCESS(Result))
return Result;
if (0 == RootSddl)
RootSddl = L"O:BAG:BAD:P(A;;FA;;;SY)(A;;FA;;;BA)(A;;FA;;;WD)";
if (!ConvertStringSecurityDescriptorToSecurityDescriptorW(RootSddl, SDDL_REVISION_1,
&RootSecurity, &RootSecuritySize))
return FspNtStatusFromWin32(GetLastError());
Memfs = (MEMFS *)malloc(sizeof *Memfs);
if (0 == Memfs)
{
LocalFree(RootSecurity);
return STATUS_INSUFFICIENT_RESOURCES;
}
memset(Memfs, 0, sizeof *Memfs);
Memfs->MaxFileNodes = MaxFileNodes;
AllocationUnit = MEMFS_SECTOR_SIZE * MEMFS_SECTORS_PER_ALLOCATION_UNIT;
Memfs->MaxFileSize = (ULONG)((MaxFileSize + AllocationUnit - 1) / AllocationUnit * AllocationUnit);
#ifdef MEMFS_SLOWIO
Memfs->SlowioMaxDelay = SlowioMaxDelay;
Memfs->SlowioPercentDelay = SlowioPercentDelay;
Memfs->SlowioRarefyDelay = SlowioRarefyDelay;
#endif
Result = MemfsFileNodeMapCreate(CaseInsensitive, &Memfs->FileNodeMap);
if (!NT_SUCCESS(Result))
{
free(Memfs);
LocalFree(RootSecurity);
return Result;
}
memset(&VolumeParams, 0, sizeof VolumeParams);
VolumeParams.Version = sizeof FSP_FSCTL_VOLUME_PARAMS;
VolumeParams.SectorSize = MEMFS_SECTOR_SIZE;
VolumeParams.SectorsPerAllocationUnit = MEMFS_SECTORS_PER_ALLOCATION_UNIT;
VolumeParams.VolumeCreationTime = MemfsGetSystemTime();
VolumeParams.VolumeSerialNumber = (UINT32)(MemfsGetSystemTime() / (10000 * 1000));
VolumeParams.FileInfoTimeout = FileInfoTimeout;
VolumeParams.CaseSensitiveSearch = !CaseInsensitive;
VolumeParams.CasePreservedNames = 1;
VolumeParams.UnicodeOnDisk = 1;
VolumeParams.PersistentAcls = 1;
VolumeParams.ReparsePoints = 1;
VolumeParams.ReparsePointsAccessCheck = 0;
#if defined(MEMFS_NAMED_STREAMS)
VolumeParams.NamedStreams = 1;
#endif
VolumeParams.PostCleanupWhenModifiedOnly = 1;
VolumeParams.PostDispositionWhenNecessaryOnly = 1;
#if defined(MEMFS_DIRINFO_BY_NAME)
VolumeParams.PassQueryDirectoryFileName = 1;
#endif
VolumeParams.FlushAndPurgeOnCleanup = FlushAndPurgeOnCleanup;
#if defined(MEMFS_CONTROL)
VolumeParams.DeviceControl = 1;
#endif
#if defined(MEMFS_EA)
VolumeParams.ExtendedAttributes = 1;
#endif
#if defined(MEMFS_WSL)
VolumeParams.WslFeatures = 1;
#endif
VolumeParams.AllowOpenInKernelMode = 1;
#if defined(MEMFS_REJECT_EARLY_IRP)
VolumeParams.RejectIrpPriorToTransact0 = 1;
#endif
VolumeParams.SupportsPosixUnlinkRename = SupportsPosixUnlinkRename;
if (0 != VolumePrefix)
wcscpy_s(VolumeParams.Prefix, sizeof VolumeParams.Prefix / sizeof(WCHAR), VolumePrefix);
wcscpy_s(VolumeParams.FileSystemName, sizeof VolumeParams.FileSystemName / sizeof(WCHAR),
0 != FileSystemName ? FileSystemName : L"-MEMFS");
Result = FspFileSystemCreate(DevicePath, &VolumeParams, &MemfsInterface, &Memfs->FileSystem);
if (!NT_SUCCESS(Result))
{
MemfsFileNodeMapDelete(Memfs->FileNodeMap);
free(Memfs);
LocalFree(RootSecurity);
return Result;
}
Memfs->FileSystem->UserContext = Memfs;
Memfs->VolumeLabelLength = sizeof L"MEMFS" - sizeof(WCHAR);
memcpy(Memfs->VolumeLabel, L"MEMFS", Memfs->VolumeLabelLength);
#if 0
FspFileSystemSetOperationGuardStrategy(Memfs->FileSystem,
FSP_FILE_SYSTEM_OPERATION_GUARD_STRATEGY_COARSE);
#endif
/*
* Create root directory.
*/
Result = MemfsFileNodeCreate(L"\\", &RootNode);
if (!NT_SUCCESS(Result))
{
MemfsDelete(Memfs);
LocalFree(RootSecurity);
return Result;
}
RootNode->FileInfo.FileAttributes = FILE_ATTRIBUTE_DIRECTORY;
RootNode->FileSecurity = malloc(RootSecuritySize);
if (0 == RootNode->FileSecurity)
{
MemfsFileNodeDelete(RootNode);
MemfsDelete(Memfs);
LocalFree(RootSecurity);
return STATUS_INSUFFICIENT_RESOURCES;
}
RootNode->FileSecuritySize = RootSecuritySize;
memcpy(RootNode->FileSecurity, RootSecurity, RootSecuritySize);
Result = MemfsFileNodeMapInsert(Memfs->FileNodeMap, RootNode, &Inserted);
if (!NT_SUCCESS(Result))
{
MemfsFileNodeDelete(RootNode);
MemfsDelete(Memfs);
LocalFree(RootSecurity);
return Result;
}
LocalFree(RootSecurity);
*PMemfs = Memfs;
return STATUS_SUCCESS;
}
VOID MemfsDelete(MEMFS *Memfs)
{
FspFileSystemDelete(Memfs->FileSystem);
MemfsFileNodeMapDelete(Memfs->FileNodeMap);
free(Memfs);
}
NTSTATUS MemfsStart(MEMFS *Memfs)
{
#ifdef MEMFS_SLOWIO
Memfs->SlowioThreadsRunning = 0;
#endif
return FspFileSystemStartDispatcher(Memfs->FileSystem, 0);
}
VOID MemfsStop(MEMFS *Memfs)
{
FspFileSystemStopDispatcher(Memfs->FileSystem);
#ifdef MEMFS_SLOWIO
while (Memfs->SlowioThreadsRunning)
Sleep(1);
#endif
}
FSP_FILE_SYSTEM *MemfsFileSystem(MEMFS *Memfs)
{
return Memfs->FileSystem;
}
NTSTATUS MemfsHeapConfigure(SIZE_T InitialSize, SIZE_T MaximumSize, SIZE_T Alignment)
{
return LargeHeapInitialize(0, InitialSize, MaximumSize, LargeHeapAlignment) ?
STATUS_SUCCESS : STATUS_INSUFFICIENT_RESOURCES;
}
```
|
```java
/*
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package org.apache.shardingsphere.encrypt.rewrite.token.generator.ddl;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.apache.shardingsphere.encrypt.constant.EncryptColumnDataType;
import org.apache.shardingsphere.encrypt.exception.metadata.EncryptColumnAlterException;
import org.apache.shardingsphere.encrypt.rewrite.token.pojo.EncryptAlterTableToken;
import org.apache.shardingsphere.encrypt.rewrite.token.pojo.EncryptColumnToken;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.encrypt.rule.column.EncryptColumn;
import org.apache.shardingsphere.encrypt.rule.column.item.AssistedQueryColumnItem;
import org.apache.shardingsphere.encrypt.rule.column.item.LikeQueryColumnItem;
import org.apache.shardingsphere.encrypt.rule.table.EncryptTable;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
import org.apache.shardingsphere.infra.binder.context.statement.ddl.AlterTableStatementContext;
import org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.rewrite.sql.token.common.generator.CollectionSQLTokenGenerator;
import org.apache.shardingsphere.infra.rewrite.sql.token.common.pojo.SQLToken;
import org.apache.shardingsphere.infra.rewrite.sql.token.common.pojo.Substitutable;
import org.apache.shardingsphere.infra.rewrite.sql.token.common.pojo.generic.RemoveToken;
import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.column.ColumnDefinitionSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.column.alter.AddColumnDefinitionSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.column.alter.ChangeColumnDefinitionSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.column.alter.DropColumnDefinitionSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.column.alter.ModifyColumnDefinitionSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.column.position.ColumnPositionSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
/**
* Alter table token generator for encrypt.
*/
@RequiredArgsConstructor
@Setter
public final class EncryptAlterTableTokenGenerator implements CollectionSQLTokenGenerator<AlterTableStatementContext> {
private final EncryptRule encryptRule;
@Override
public boolean isGenerateSQLToken(final SQLStatementContext sqlStatementContext) {
return sqlStatementContext instanceof AlterTableStatementContext;
}
@Override
public Collection<SQLToken> generateSQLTokens(final AlterTableStatementContext sqlStatementContext) {
String tableName = sqlStatementContext.getSqlStatement().getTable().getTableName().getIdentifier().getValue();
EncryptTable encryptTable = encryptRule.getEncryptTable(tableName);
Collection<SQLToken> result = new LinkedList<>(getAddColumnTokens(encryptTable, sqlStatementContext.getSqlStatement().getAddColumnDefinitions()));
result.addAll(getModifyColumnTokens(encryptTable, sqlStatementContext.getSqlStatement().getModifyColumnDefinitions()));
result.addAll(getChangeColumnTokens(encryptTable, sqlStatementContext.getSqlStatement().getChangeColumnDefinitions()));
List<SQLToken> dropColumnTokens = getDropColumnTokens(encryptTable, sqlStatementContext.getSqlStatement().getDropColumnDefinitions());
String databaseName = sqlStatementContext.getDatabaseType().getType();
if ("SQLServer".equals(databaseName)) {
result.addAll(mergeDropColumnStatement(dropColumnTokens, "", ""));
} else if ("Oracle".equals(databaseName)) {
result.addAll(mergeDropColumnStatement(dropColumnTokens, "(", ")"));
} else {
result.addAll(dropColumnTokens);
}
return result;
}
private Collection<SQLToken> getAddColumnTokens(final EncryptTable encryptTable, final Collection<AddColumnDefinitionSegment> segments) {
Collection<SQLToken> result = new LinkedList<>();
for (AddColumnDefinitionSegment each : segments) {
result.addAll(getAddColumnTokens(encryptTable, each));
}
return result;
}
private Collection<SQLToken> getAddColumnTokens(final EncryptTable encryptTable, final AddColumnDefinitionSegment segment) {
Collection<SQLToken> result = new LinkedList<>();
for (ColumnDefinitionSegment each : segment.getColumnDefinitions()) {
String columnName = each.getColumnName().getIdentifier().getValue();
if (encryptTable.isEncryptColumn(columnName)) {
result.addAll(getAddColumnTokens(encryptTable.getEncryptColumn(columnName), segment, each));
}
}
getAddColumnPositionToken(encryptTable, segment).ifPresent(result::add);
return result;
}
private Collection<SQLToken> getAddColumnTokens(final EncryptColumn encryptColumn,
final AddColumnDefinitionSegment addColumnDefinitionSegment, final ColumnDefinitionSegment columnDefinitionSegment) {
Collection<SQLToken> result = new LinkedList<>();
result.add(new RemoveToken(columnDefinitionSegment.getStartIndex(), columnDefinitionSegment.getStopIndex()));
result.add(new EncryptColumnToken(columnDefinitionSegment.getStopIndex() + 1, columnDefinitionSegment.getStopIndex(),
encryptColumn.getCipher().getName(), EncryptColumnDataType.DEFAULT_DATA_TYPE));
encryptColumn.getAssistedQuery().map(optional -> new EncryptColumnToken(addColumnDefinitionSegment.getStopIndex() + 1,
addColumnDefinitionSegment.getStopIndex(), ", ADD COLUMN " + optional.getName(), EncryptColumnDataType.DEFAULT_DATA_TYPE)).ifPresent(result::add);
encryptColumn.getLikeQuery().map(optional -> new EncryptColumnToken(addColumnDefinitionSegment.getStopIndex() + 1,
addColumnDefinitionSegment.getStopIndex(), ", ADD COLUMN " + optional.getName(), EncryptColumnDataType.DEFAULT_DATA_TYPE)).ifPresent(result::add);
return result;
}
private Optional<SQLToken> getAddColumnPositionToken(final EncryptTable encryptTable, final AddColumnDefinitionSegment segment) {
Optional<ColumnPositionSegment> columnPositionSegment = segment.getColumnPosition().filter(optional -> null != optional.getColumnName());
if (columnPositionSegment.isPresent()) {
String columnName = columnPositionSegment.get().getColumnName().getIdentifier().getValue();
if (encryptTable.isEncryptColumn(columnName)) {
return Optional.of(getPositionColumnToken(encryptTable.getEncryptColumn(columnName), segment.getColumnPosition().get()));
}
}
return Optional.empty();
}
private EncryptAlterTableToken getPositionColumnToken(final EncryptColumn encryptColumn, final ColumnPositionSegment segment) {
return new EncryptAlterTableToken(segment.getColumnName().getStartIndex(), segment.getStopIndex(), encryptColumn.getCipher().getName(), null);
}
private Collection<SQLToken> getModifyColumnTokens(final EncryptTable encryptTable, final Collection<ModifyColumnDefinitionSegment> segments) {
Collection<SQLToken> result = new LinkedList<>();
for (ModifyColumnDefinitionSegment each : segments) {
String columnName = each.getColumnDefinition().getColumnName().getIdentifier().getValue();
ShardingSpherePreconditions.checkState(!encryptTable.isEncryptColumn(columnName), () -> new UnsupportedOperationException("Unsupported operation 'modify' for the cipher column"));
each.getColumnPosition().flatMap(optional -> getColumnPositionToken(encryptTable, optional)).ifPresent(result::add);
}
return result;
}
private Optional<SQLToken> getColumnPositionToken(final EncryptTable encryptTable, final ColumnPositionSegment segment) {
if (null == segment.getColumnName()) {
return Optional.empty();
}
String columnName = segment.getColumnName().getIdentifier().getValue();
return encryptTable.isEncryptColumn(columnName) ? Optional.of(getPositionColumnToken(encryptTable.getEncryptColumn(columnName), segment)) : Optional.empty();
}
private Collection<SQLToken> getChangeColumnTokens(final EncryptTable encryptTable, final Collection<ChangeColumnDefinitionSegment> segments) {
Collection<SQLToken> result = new LinkedList<>();
for (ChangeColumnDefinitionSegment each : segments) {
String columnName = each.getPreviousColumn().getIdentifier().getValue();
ShardingSpherePreconditions.checkState(!encryptTable.isEncryptColumn(columnName), () -> new UnsupportedOperationException("Unsupported operation 'change' for the cipher column"));
result.addAll(getChangeColumnTokens(encryptTable, each));
each.getColumnPosition().flatMap(optional -> getColumnPositionToken(encryptTable, optional)).ifPresent(result::add);
}
return result;
}
private Collection<SQLToken> getChangeColumnTokens(final EncryptTable encryptTable, final ChangeColumnDefinitionSegment segment) {
String previousColumnName = segment.getPreviousColumn().getIdentifier().getValue();
String columnName = segment.getColumnDefinition().getColumnName().getIdentifier().getValue();
isSameEncryptColumn(encryptTable, previousColumnName, columnName);
if (!encryptTable.isEncryptColumn(columnName) || !encryptTable.isEncryptColumn(previousColumnName)) {
return Collections.emptyList();
}
Collection<SQLToken> result = new LinkedList<>();
EncryptColumn previousEncryptColumn = encryptTable.getEncryptColumn(previousColumnName);
EncryptColumn encryptColumn = encryptTable.getEncryptColumn(columnName);
result.addAll(getPreviousColumnTokens(previousEncryptColumn, segment));
result.addAll(getColumnTokens(previousEncryptColumn, encryptColumn, segment));
return result;
}
private void isSameEncryptColumn(final EncryptTable encryptTable, final String previousColumnName, final String columnName) {
Optional<EncryptAlgorithm> previousEncryptor = encryptTable.findEncryptor(previousColumnName);
Optional<EncryptAlgorithm> currentEncryptor = encryptTable.findEncryptor(columnName);
if (!previousEncryptor.isPresent() && !currentEncryptor.isPresent()) {
return;
}
ShardingSpherePreconditions.checkState(previousEncryptor.equals(currentEncryptor) && checkPreviousAndAfterHasSameColumnNumber(encryptTable, previousColumnName, columnName),
() -> new EncryptColumnAlterException(encryptTable.getTable(), columnName, previousColumnName));
}
private boolean checkPreviousAndAfterHasSameColumnNumber(final EncryptTable encryptTable, final String previousColumnName, final String columnName) {
EncryptColumn previousEncryptColumn = encryptTable.getEncryptColumn(previousColumnName);
EncryptColumn encryptColumn = encryptTable.getEncryptColumn(columnName);
if (previousEncryptColumn.getAssistedQuery().isPresent() && !encryptColumn.getAssistedQuery().isPresent()) {
return false;
}
if (previousEncryptColumn.getLikeQuery().isPresent() && !encryptColumn.getLikeQuery().isPresent()) {
return false;
}
return previousEncryptColumn.getAssistedQuery().isPresent() || !encryptColumn.getAssistedQuery().isPresent();
}
private Collection<SQLToken> getPreviousColumnTokens(final EncryptColumn previousEncryptColumn, final ChangeColumnDefinitionSegment segment) {
Collection<SQLToken> result = new LinkedList<>();
result.add(new RemoveToken(segment.getPreviousColumn().getStartIndex(), segment.getPreviousColumn().getStopIndex()));
result.add(new EncryptAlterTableToken(segment.getPreviousColumn().getStopIndex() + 1, segment.getPreviousColumn().getStopIndex(), previousEncryptColumn.getCipher().getName(), null));
return result;
}
private Collection<SQLToken> getColumnTokens(final EncryptColumn previousEncryptColumn, final EncryptColumn encryptColumn, final ChangeColumnDefinitionSegment segment) {
Collection<SQLToken> result = new LinkedList<>();
result.add(new RemoveToken(segment.getColumnDefinition().getColumnName().getStartIndex(), segment.getColumnDefinition().getStopIndex()));
result.add(new EncryptColumnToken(segment.getColumnDefinition().getStopIndex() + 1, segment.getColumnDefinition().getStopIndex(),
encryptColumn.getCipher().getName(), EncryptColumnDataType.DEFAULT_DATA_TYPE));
previousEncryptColumn.getAssistedQuery().map(optional -> new EncryptColumnToken(segment.getStopIndex() + 1, segment.getStopIndex(),
", CHANGE COLUMN " + optional.getName() + " " + encryptColumn.getAssistedQuery().map(AssistedQueryColumnItem::getName).orElse(""),
EncryptColumnDataType.DEFAULT_DATA_TYPE)).ifPresent(result::add);
previousEncryptColumn.getLikeQuery().map(optional -> new EncryptColumnToken(segment.getStopIndex() + 1, segment.getStopIndex(),
", CHANGE COLUMN " + optional.getName() + " " + encryptColumn.getLikeQuery().map(LikeQueryColumnItem::getName).orElse(""),
EncryptColumnDataType.DEFAULT_DATA_TYPE)).ifPresent(result::add);
return result;
}
private List<SQLToken> getDropColumnTokens(final EncryptTable encryptTable, final Collection<DropColumnDefinitionSegment> segments) {
List<SQLToken> result = new ArrayList<>();
for (DropColumnDefinitionSegment each : segments) {
result.addAll(getDropColumnTokens(encryptTable, each));
}
return result;
}
private Collection<SQLToken> getDropColumnTokens(final EncryptTable encryptTable, final DropColumnDefinitionSegment segment) {
Collection<SQLToken> result = new LinkedList<>();
for (ColumnSegment each : segment.getColumns()) {
ShardingSpherePreconditions.checkState(!encryptTable.isEncryptColumn(each.getQualifiedName()),
() -> new UnsupportedOperationException("Unsupported operation 'drop' for the cipher column"));
}
return result;
}
private Collection<SQLToken> mergeDropColumnStatement(final List<SQLToken> dropSQLTokens, final String leftJoiner, final String rightJoiner) {
Collection<SQLToken> result = new LinkedList<>();
Collection<String> dropColumns = new LinkedList<>();
int lastStartIndex = -1;
for (int i = 0; i < dropSQLTokens.size(); i++) {
SQLToken token = dropSQLTokens.get(i);
if (token instanceof RemoveToken) {
result.add(0 == i ? token : new RemoveToken(lastStartIndex, ((RemoveToken) token).getStopIndex()));
} else {
EncryptAlterTableToken encryptAlterTableToken = (EncryptAlterTableToken) token;
dropColumns.add(encryptAlterTableToken.getColumnName());
if (i == dropSQLTokens.size() - 1) {
result.add(new EncryptAlterTableToken(token.getStartIndex(), encryptAlterTableToken.getStopIndex(), leftJoiner + String.join(",", dropColumns) + rightJoiner, "DROP COLUMN"));
}
}
lastStartIndex = ((Substitutable) token).getStartIndex();
}
return result;
}
}
```
|
Colin Egan (born 1989 in Belmont, County Offaly, Ireland) is an Irish sportsperson. He plays hurling with his local club Belmont and has been a member of the Offaly senior inter-county team since 2011.
Playing career
Club
Egan plays his club hurling with Belmont.
Inter-county
Egan has lined out in all grades for Offaly. He started in 2007 as a member of the county's minor hurling team before subsequently joining the Offaly under-21 team. In 2008 he lined out in the Leinster under-21 decider, however, Kilkenny won that game easily.
Egan was just out of the under-21 grade when he joined the Offaly senior hurling team in 2011. He made his debut as a substitute in a National Hurling League game against Kilkenny, however, he failed to secure a place on the starting fifteen. Egan made his championship debut at wing-forward against Dublin in 2011.
Media career
In 2016, Egan and his family competed in the fourth series of the popular RTÉ reality competition, Ireland's Fittest Family. They were eliminated in the first round of the competition.
References
1989 births
Living people
Belmont hurlers
Offaly inter-county hurlers
|
```objective-c
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google LLC 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 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 contains Pthread-related functions not provided by the Android NDK
// but required by the Breakpad unit test. The functions are inlined here
// in a C++ anonymous namespace in order to keep the build files simples.
#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_TESTING_PTHREAD_FIXES_H
#define GOOGLE_BREAKPAD_COMMON_ANDROID_TESTING_PTHREAD_FIXES_H
#include <pthread.h>
namespace {
// Android doesn't provide pthread_barrier_t for now.
#ifndef PTHREAD_BARRIER_SERIAL_THREAD
// Anything except 0 will do here.
#define PTHREAD_BARRIER_SERIAL_THREAD 0x12345
typedef struct {
pthread_mutex_t mutex;
pthread_cond_t cond;
unsigned count;
} pthread_barrier_t;
int pthread_barrier_init(pthread_barrier_t* barrier,
const void* /* barrier_attr */,
unsigned count) {
barrier->count = count;
pthread_mutex_init(&barrier->mutex, NULL);
pthread_cond_init(&barrier->cond, NULL);
return 0;
}
int pthread_barrier_wait(pthread_barrier_t* barrier) {
// Lock the mutex
pthread_mutex_lock(&barrier->mutex);
// Decrement the count. If this is the first thread to reach 0, wake up
// waiters, unlock the mutex, then return PTHREAD_BARRIER_SERIAL_THREAD.
if (--barrier->count == 0) {
// First thread to reach the barrier
pthread_cond_broadcast(&barrier->cond);
pthread_mutex_unlock(&barrier->mutex);
return PTHREAD_BARRIER_SERIAL_THREAD;
}
// Otherwise, wait for other threads until the count reaches 0, then
// return 0 to indicate this is not the first thread.
do {
pthread_cond_wait(&barrier->cond, &barrier->mutex);
} while (barrier->count > 0);
pthread_mutex_unlock(&barrier->mutex);
return 0;
}
int pthread_barrier_destroy(pthread_barrier_t* barrier) {
barrier->count = 0;
pthread_cond_destroy(&barrier->cond);
pthread_mutex_destroy(&barrier->mutex);
return 0;
}
#endif // defined(PTHREAD_BARRIER_SERIAL_THREAD)
} // namespace
#endif // GOOGLE_BREAKPAD_COMMON_ANDROID_TESTING_PTHREAD_FIXES_H
```
|
Horná Seč () is a village and municipality in the Levice District in the Nitra Region of Slovakia.
History
In historical records the village was first mentioned in 1355.
Geography
The village lies at an altitude of 158 metres and covers an area of 8.303 km². It has a population of about 490 people.
Ethnicity
The village is approximately 75% Slovak, 23% Magyar and 2% Czech.
Facilities
The village has a public library and a football pitch.
Genealogical resources
The records for genealogical research are available at the state archive "Statny Archiv in Nitra, Slovakia"
Roman Catholic church records (births/marriages/deaths): 1726-1771 (parish B)
Lutheran church records (births/marriages/deaths): 1845-1898 (parish B)
Reformated church records (births/marriages/deaths): 1827-1945 (parish B)
See also
List of municipalities and towns in Slovakia
External links
https://web.archive.org/web/20080111223415/http://www.statistics.sk/mosmis/eng/run.html
Surnames of living people in Horna Sec
Villages and municipalities in Levice District
|
```c++
// This file was automatically generated on Fri May 15 12:45:15 2009
// by libs/config/tools/generate.cpp
// Use, modification and distribution are subject to the
// LICENSE_1_0.txt or copy at path_to_url
// See path_to_url for the most recent version.//
// Revision $Id$
//
// Test file for macro BOOST_NO_CXX11_HDR_THREAD
// This file should compile, if it does not then
// BOOST_NO_CXX11_HDR_THREAD should be defined.
// See file boost_no_cxx11_hdr_thread.ipp for details
// Must not have BOOST_ASSERT_CONFIG set; it defeats
// the objective of this file:
#ifdef BOOST_ASSERT_CONFIG
# undef BOOST_ASSERT_CONFIG
#endif
#include <boost/config.hpp>
#include "test.hpp"
#ifndef BOOST_NO_CXX11_HDR_THREAD
#include "boost_no_cxx11_hdr_thread.ipp"
#else
namespace boost_no_cxx11_hdr_thread = empty_boost;
#endif
int main( int, char *[] )
{
return boost_no_cxx11_hdr_thread::test();
}
```
|
```c++
/*==============================================================================
file LICENSE_1_0.txt or copy at path_to_url
==============================================================================*/
#ifndef BOOST_PHOENIX_SUPPORT_ITERATE_HPP
#define BOOST_PHOENIX_SUPPORT_ITERATE_HPP
#include <boost/preprocessor/iteration/iterate.hpp>
#define BOOST_PHOENIX_IS_ITERATING 0
#define BOOST_PHOENIX_ITERATE() \
<boost/phoenix/support/detail/iterate.hpp>
#include <boost/phoenix/support/detail/iterate_define.hpp>
#endif
```
|
```shell
Using tags for version control
What is stored in a commit?
Remote repositories: fetching and pushing
Recover lost code
Ignore files in git
```
|
```c++
/*=============================================================================
file LICENSE_1_0.txt or copy at path_to_url
==============================================================================*/
#if !defined(BOOST_FUSION_SEQUENCE_EMPTY_IMPL_HPP_INCLUDED)
#define BOOST_FUSION_SEQUENCE_EMPTY_IMPL_HPP_INCLUDED
#include <boost/fusion/support/config.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/fusion/container/list/nil.hpp>
namespace boost { namespace fusion
{
struct cons_tag;
struct nil_;
template <typename Car, typename Cdr>
struct cons;
namespace extension
{
template <typename Tag>
struct empty_impl;
template <>
struct empty_impl<cons_tag>
{
template <typename Sequence>
struct apply
: boost::is_convertible<Sequence, nil_>
{};
};
}
}}
#endif
```
|
```less
/**
* path_to_url#custom-mq
* rem font-size font-size px
* JavaScript breakpoint.less CSS
*
* xs=0px
* sm: <600px
* md>=600px & <840px
* lg>=840px & <1080px
* xl>=1080px & < 1920px
* xxl>=1920px
*/
@custom-media --mdui-viewport-xs (min-width: 0) and (max-width: 599.98px);
@custom-media --mdui-viewport-sm-down (max-width: 599.98px);
@custom-media --mdui-viewport-sm (min-width: 600px) and (max-width: 839.98px);
@custom-media --mdui-viewport-sm-up (min-width: 600px);
@custom-media --mdui-viewport-md-down (max-width: 839.98px);
@custom-media --mdui-viewport-md (min-width: 840px) and (max-width: 1079.98px);
@custom-media --mdui-viewport-md-up (min-width: 840px);
@custom-media --mdui-viewport-lg-down (max-width: 1079.98px);
@custom-media --mdui-viewport-lg (min-width: 1080px) and (max-width: 1439.98px);
@custom-media --mdui-viewport-lg-up (min-width: 1080px);
@custom-media --mdui-viewport-xl-down (max-width: 1439.98px);
@custom-media --mdui-viewport-xl (min-width: 1440px) and (max-width: 1919.98px);
@custom-media --mdui-viewport-xl-up (min-width: 1440px);
@custom-media --mdui-viewport-xxl-down (max-width: 1919.98px);
@custom-media --mdui-viewport-xxl (min-width: 1920px);
@custom-media --mdui-viewport-xxl-up (min-width: 1920px);
```
|
```go
// Code generated by counterfeiter. DO NOT EDIT.
package fake
import (
"sync"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/orderer"
"github.com/hyperledger/fabric/common/deliverclient/orderers"
"github.com/hyperledger/fabric/common/deliverclient/blocksprovider"
)
type DeliverClientRequester struct {
ConnectStub func(*common.Envelope, *orderers.Endpoint) (orderer.AtomicBroadcast_DeliverClient, func(), error)
connectMutex sync.RWMutex
connectArgsForCall []struct {
arg1 *common.Envelope
arg2 *orderers.Endpoint
}
connectReturns struct {
result1 orderer.AtomicBroadcast_DeliverClient
result2 func()
result3 error
}
connectReturnsOnCall map[int]struct {
result1 orderer.AtomicBroadcast_DeliverClient
result2 func()
result3 error
}
SeekInfoHeadersFromStub func(uint64) (*common.Envelope, error)
seekInfoHeadersFromMutex sync.RWMutex
seekInfoHeadersFromArgsForCall []struct {
arg1 uint64
}
seekInfoHeadersFromReturns struct {
result1 *common.Envelope
result2 error
}
seekInfoHeadersFromReturnsOnCall map[int]struct {
result1 *common.Envelope
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *DeliverClientRequester) Connect(arg1 *common.Envelope, arg2 *orderers.Endpoint) (orderer.AtomicBroadcast_DeliverClient, func(), error) {
fake.connectMutex.Lock()
ret, specificReturn := fake.connectReturnsOnCall[len(fake.connectArgsForCall)]
fake.connectArgsForCall = append(fake.connectArgsForCall, struct {
arg1 *common.Envelope
arg2 *orderers.Endpoint
}{arg1, arg2})
stub := fake.ConnectStub
fakeReturns := fake.connectReturns
fake.recordInvocation("Connect", []interface{}{arg1, arg2})
fake.connectMutex.Unlock()
if stub != nil {
return stub(arg1, arg2)
}
if specificReturn {
return ret.result1, ret.result2, ret.result3
}
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
}
func (fake *DeliverClientRequester) ConnectCallCount() int {
fake.connectMutex.RLock()
defer fake.connectMutex.RUnlock()
return len(fake.connectArgsForCall)
}
func (fake *DeliverClientRequester) ConnectCalls(stub func(*common.Envelope, *orderers.Endpoint) (orderer.AtomicBroadcast_DeliverClient, func(), error)) {
fake.connectMutex.Lock()
defer fake.connectMutex.Unlock()
fake.ConnectStub = stub
}
func (fake *DeliverClientRequester) ConnectArgsForCall(i int) (*common.Envelope, *orderers.Endpoint) {
fake.connectMutex.RLock()
defer fake.connectMutex.RUnlock()
argsForCall := fake.connectArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *DeliverClientRequester) ConnectReturns(result1 orderer.AtomicBroadcast_DeliverClient, result2 func(), result3 error) {
fake.connectMutex.Lock()
defer fake.connectMutex.Unlock()
fake.ConnectStub = nil
fake.connectReturns = struct {
result1 orderer.AtomicBroadcast_DeliverClient
result2 func()
result3 error
}{result1, result2, result3}
}
func (fake *DeliverClientRequester) ConnectReturnsOnCall(i int, result1 orderer.AtomicBroadcast_DeliverClient, result2 func(), result3 error) {
fake.connectMutex.Lock()
defer fake.connectMutex.Unlock()
fake.ConnectStub = nil
if fake.connectReturnsOnCall == nil {
fake.connectReturnsOnCall = make(map[int]struct {
result1 orderer.AtomicBroadcast_DeliverClient
result2 func()
result3 error
})
}
fake.connectReturnsOnCall[i] = struct {
result1 orderer.AtomicBroadcast_DeliverClient
result2 func()
result3 error
}{result1, result2, result3}
}
func (fake *DeliverClientRequester) SeekInfoHeadersFrom(arg1 uint64) (*common.Envelope, error) {
fake.seekInfoHeadersFromMutex.Lock()
ret, specificReturn := fake.seekInfoHeadersFromReturnsOnCall[len(fake.seekInfoHeadersFromArgsForCall)]
fake.seekInfoHeadersFromArgsForCall = append(fake.seekInfoHeadersFromArgsForCall, struct {
arg1 uint64
}{arg1})
stub := fake.SeekInfoHeadersFromStub
fakeReturns := fake.seekInfoHeadersFromReturns
fake.recordInvocation("SeekInfoHeadersFrom", []interface{}{arg1})
fake.seekInfoHeadersFromMutex.Unlock()
if stub != nil {
return stub(arg1)
}
if specificReturn {
return ret.result1, ret.result2
}
return fakeReturns.result1, fakeReturns.result2
}
func (fake *DeliverClientRequester) SeekInfoHeadersFromCallCount() int {
fake.seekInfoHeadersFromMutex.RLock()
defer fake.seekInfoHeadersFromMutex.RUnlock()
return len(fake.seekInfoHeadersFromArgsForCall)
}
func (fake *DeliverClientRequester) SeekInfoHeadersFromCalls(stub func(uint64) (*common.Envelope, error)) {
fake.seekInfoHeadersFromMutex.Lock()
defer fake.seekInfoHeadersFromMutex.Unlock()
fake.SeekInfoHeadersFromStub = stub
}
func (fake *DeliverClientRequester) SeekInfoHeadersFromArgsForCall(i int) uint64 {
fake.seekInfoHeadersFromMutex.RLock()
defer fake.seekInfoHeadersFromMutex.RUnlock()
argsForCall := fake.seekInfoHeadersFromArgsForCall[i]
return argsForCall.arg1
}
func (fake *DeliverClientRequester) SeekInfoHeadersFromReturns(result1 *common.Envelope, result2 error) {
fake.seekInfoHeadersFromMutex.Lock()
defer fake.seekInfoHeadersFromMutex.Unlock()
fake.SeekInfoHeadersFromStub = nil
fake.seekInfoHeadersFromReturns = struct {
result1 *common.Envelope
result2 error
}{result1, result2}
}
func (fake *DeliverClientRequester) SeekInfoHeadersFromReturnsOnCall(i int, result1 *common.Envelope, result2 error) {
fake.seekInfoHeadersFromMutex.Lock()
defer fake.seekInfoHeadersFromMutex.Unlock()
fake.SeekInfoHeadersFromStub = nil
if fake.seekInfoHeadersFromReturnsOnCall == nil {
fake.seekInfoHeadersFromReturnsOnCall = make(map[int]struct {
result1 *common.Envelope
result2 error
})
}
fake.seekInfoHeadersFromReturnsOnCall[i] = struct {
result1 *common.Envelope
result2 error
}{result1, result2}
}
func (fake *DeliverClientRequester) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.connectMutex.RLock()
defer fake.connectMutex.RUnlock()
fake.seekInfoHeadersFromMutex.RLock()
defer fake.seekInfoHeadersFromMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *DeliverClientRequester) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ blocksprovider.DeliverClientRequester = new(DeliverClientRequester)
```
|
Ferdinand Emery Kuhn (September 3, 1861 – March 17, 1930) was a shoe merchant known as the "Father of the Knights of Columbus in the South." He was also president of the 1908 Southern Association champion Nashville Vols baseball team.
Early years
Kuhn was born in Nashville, Tennessee, on September 3, 1861, to German immigrants from the Kingdom of Württemberg, Ferdinand and Barbara (Müller) Kuhn. He was the youngest of eight children. His father was a brewer who ran the Rock City Brewery shortly after the end of the Civil War.
Studies
Kuhn attended the local parochial and public high schools, graduating from Hume High School, then went to the University of Notre Dame, where he was a member of the University Baseball Association and the "Lemonnier Boat Club", a boat and rowing club on Saint Joseph's Lake. He graduated in 1883 with a BSc, a classmate of aeronautical expert Albert Francis Zahm. Kuhn received his Masters in 1885, and while pursuing that degree would present the gold medal given to the best science undergraduate at Notre Dame.
Personal
Kuhn was married to Katherine "Kate" Wall on April 15, 1885, in her hometown of Springfield, Kentucky. The marriage was performed by Joseph A. Hogarty, whose father sculpted the Henry Clay monument in Lexington. Kate Wall had attended Saint Mary's Academy, and was born in Wall, Pennsylvania, named for her father Frank Wall, a wealthy farmer and steamboat engineer from Ireland.
They had nine children; six boys and three girls. Kuhn was the father of prominent Vanderbilt quarterback Doc Kuhn and, through another son, violinist Casper, the grandfather of NBC radio and television announcer Dick Dudley. He named one son Richard Dudley after Richard Houston Dudley.
Kuhn's house from 1898 until his death is now called Frassati House, and is the building on Vanderbilt's campus that houses the University's Catholic campus ministry. Kuhn was an active member of the Cathedral of the Incarnation. His mother had also attended the Church of the Assumption.
Board of Public Works
Kuhn's first job out of college was as the private secretary to Mayor Claiborne Hooper Phillips. His brother Casper was city auditor. Ferdinand Kuhn was then a secretary and city recorder for the Board of Public Works and Affairs from 1884 until 1903. Upon his resignation he was dubbed "beyond question the most capable man that (sic) ever served the Board".
Knights of Columbus
Initiation
Kuhn was initiated into the Knights of Columbus, a Catholic fraternal service organization, in Louisville, Kentucky, on July 1, 1899. He was one of the first five from south of Louisville to be initiated on that day. The other four were: Messrs. H. J. Grimes, Will J. Varley, William Smith, and Michael M. McCormack.
Southern expansion
Ferdinand Kuhn was one of the Nashville Catholics who had advocated expansion into Tennessee. The 1900 compromise allowed for the formation of Nashville Council No. 544. Kuhn, who became Tennessee's first State Deputy, succeeded Daniel J. Callahan as the master ceremonialist, presiding at the institution ceremonies of councils in Florida (1900), Alabama (1902), Louisiana (1902), and Georgia (1902). His degree work at the opening of New Orleans Council No. 714 in November 1902 was long remembered as 'something out of this world'.
He was appointed Supreme Knight Hearn as the first Territorial Deputy of Tennessee, and in that capacity organized councils in Memphis, Knoxville, and Chattanooga in Tennessee; Atlanta and Augusta in Georgia; Birmingham, Mobile, and Huntsville in Alabama; Meridian, Mississippi; New Orleans, Louisiana; Little Rock and Fort Smith in Arkansas. He was once Master of the Fourth Degree for Georgia, Alabama, Mississippi, Louisiana, and Arkansas, Later he remained Master of the Fourth Degree for Tennessee. He is known as the "Father of the Knights of Columbus in the South."
State deputy
Kuhn was the first state deputy of Tennessee from 1902 to 1908. Since 1903, the F. E.Kuhn sword has passed from State Deputy to State Deputy. In 1920 Kuhn was Grand Knight of Nashville Council 544.
Shoe merchant
Kuhn was president and treasurer of the Kuhn, Cooper, Geary & Company shoe store, founded in 1903 with Ed P. Cooper and P. J. Geary. The store was located on North Summer Street (Fifth Avenue North), Nashville.
It was once the largest retail shoe store in the South, and earned a reputation as the premiere footwear store in downtown Nashville. The most up-to-date electric lighting and holophone reflectors provided lighting for the store. Its front window displayed shoes on revolving pedestals. The inside walls were marble lined, and inlaid mirrors ran along the back wall.
Kuhn was the president of the Retail Shoe Dealers' Association in 1906, and of the Retail Credit Men's Association in 1920. In 1921 he was awarded a trophy for his work in gaining members as chairman in Tennessee for the Retail Credit Men's Association.
Nashville Vols
Kuhn was the president of the Nashville Vols baseball club from 1908 to 1910, including the 1908 Southern Association championship team.
He was preceded in that capacity by Bradley Walker. Kuhn was head of a group of men who purchased the team after a last place finish in 1907. Along with Kuhn the group consisted of: James B. Carr (president of B. H. Stief Jewelry Co.); Thomas James Tyne (lawyer and state legislator); J. T. Connor (real estate); James A. Bowling (contractor); Robert L. Bolling (lawyer); Rufus E. Fort (physician); and William G. Hirsig (automobile and tire dealer). Well known attorney S. A. Champion supplied legal services. The group envisioned an ambitious project of stadium renovations at Sulphur Dell, and managed to cull $50,000. Kuhn was selected to head the Board of Directors. He went on a trip to Ponce de Leon Park in Atlanta to observe a modern park and plan renovations.
1908–1910
Kuhn hired Bill Bernhard as manager. In 1908 the team won the Southern pennant by beating the New Orleans Pelicans in the last game, described by Grantland Rice as the "greatest game ever played in Dixie".
Nashville entered the final day of that season on September 19 with an opportunity to win the league pennant. The championship would be decided by the last game of the season at Sulphur Dell. Both teams had the same number of losses (56), but the Pelicans were in first place with 76 wins to the Vols' second-place 74. A crowd of 11,000 spectators, including Kuhn, who sat next to Mayor James Stephens Brown, saw Carl Sitton hurl a three-hit, 1–0 shutout, giving Nashville their third Southern Association pennant by 0.1 percentage points (57.25% to 57.14%). Ted Breitenstein was New Orleans's pitcher.
One account reads: "By one run, by one point, Nashville has won the Southern League pennant, nosing New Orleans out literally by an eyelash. Saturday's game, which was the deciding one, between Nashville and New Orleans was the greatest exhibition of the national game ever seen in the south and the finish in the league race probably sets a record in baseball history."
The championship banner was presented to Kuhn by league president William Marmaduke Kavanaugh, and it hung over the window of Kuhn's shoe store until the banner raising ceremony on Opening Day, 1909.
Kuhn also invented a kind of electric scoreboard. In the 1909 season, New Orleans, Mobile, Montgomery, Memphis, and Atlanta used his design. John Heisman was president of the 1909 champion Atlanta team.
Following the 1910 season, Kuhn resigned as the team's president. He was succeeded by Hirsig. Kuhn was always careful with the team's money, and one newspaper called it the end of the "tightwad" regime.
Hub Perdue, former pitcher for the 1908 Nashville Volunteers, worked briefly at Kuhn's shoe store in 1921.
Other community service
He was once president of Tennessee's state Anti-Tuberculosis League, established in 1906. He was also on the Board of Directors of the Tennessee Association for the Relief of Ex-Convicts, established in 1917.
Notes
References
1861 births
1930 deaths
Businesspeople from Nashville, Tennessee
American people of German descent
Secretaries
Baseball people
Catholics from Tennessee
|
```smalltalk
using System.IO;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Http;
public static class AbpFormFileExtensions
{
public static byte[] GetAllBytes(this IFormFile file)
{
using (var stream = file.OpenReadStream())
{
return stream.GetAllBytes();
}
}
public static async Task<byte[]> GetAllBytesAsync(this IFormFile file)
{
using (var stream = file.OpenReadStream())
{
return await stream.GetAllBytesAsync();
}
}
}
```
|
```javascript
import { getLogger } from '@jitsi/logger';
import $ from 'jquery';
import { $iq } from 'strophe.js';
import ConnectionPlugin from './ConnectionPlugin';
const logger = getLogger(__filename);
const RAYO_XMLNS = 'urn:xmpp:rayo:1';
/**
*
*/
export default class RayoConnectionPlugin extends ConnectionPlugin {
/**
*
* @param connection
*/
init(connection) {
super.init(connection);
this.connection.addHandler(
this.onRayo.bind(this), RAYO_XMLNS, 'iq', 'set', null, null);
}
/**
*
* @param iq
*/
onRayo(iq) {
logger.info('Rayo IQ', iq);
}
/* eslint-disable max-params */
/**
*
* @param to
* @param from
* @param roomName
* @param roomPass
* @param focusMucJid
*/
dial(to, from, roomName, roomPass, focusMucJid) {
return new Promise((resolve, reject) => {
if (!focusMucJid) {
reject(new Error('Internal error!'));
return;
}
const req = $iq({
type: 'set',
to: focusMucJid
});
req.c('dial', {
xmlns: RAYO_XMLNS,
to,
from
});
req.c('header', {
name: 'JvbRoomName',
value: roomName
}).up();
if (roomPass && roomPass.length) {
req.c('header', {
name: 'JvbRoomPassword',
value: roomPass
}).up();
}
this.connection.sendIQ(
req,
result => {
logger.info('Dial result ', result);
// eslint-disable-next-line newline-per-chained-call
const resource = $(result).find('ref').attr('uri');
this.callResource = resource.substr('xmpp:'.length);
logger.info(`Received call resource: ${this.callResource}`);
resolve();
},
error => {
logger.info('Dial error ', error);
reject(error);
});
});
}
/* eslint-enable max-params */
/**
*
*/
hangup() {
return new Promise((resolve, reject) => {
if (!this.callResource) {
reject(new Error('No call in progress'));
logger.warn('No call in progress');
return;
}
const req = $iq({
type: 'set',
to: this.callResource
});
req.c('hangup', {
xmlns: RAYO_XMLNS
});
this.connection.sendIQ(req, result => {
logger.info('Hangup result ', result);
this.callResource = null;
resolve();
}, error => {
logger.info('Hangup error ', error);
this.callResource = null;
reject(new Error('Hangup error '));
});
});
}
}
```
|
```smalltalk
using SixLabors.ImageSharp.Formats.Tiff;
using SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation;
using SixLabors.ImageSharp.PixelFormats;
namespace SixLabors.ImageSharp.Tests.Formats.Tiff.PhotometricInterpretation;
[Trait("Format", "Tiff")]
public class BlackIsZeroTiffColorTests : PhotometricInterpretationTestBase
{
private static readonly Rgba32 Gray000 = new(0, 0, 0, 255);
private static readonly Rgba32 Gray128 = new(128, 128, 128, 255);
private static readonly Rgba32 Gray255 = new(255, 255, 255, 255);
private static readonly Rgba32 Gray0 = new(0, 0, 0, 255);
private static readonly Rgba32 Gray8 = new(136, 136, 136, 255);
private static readonly Rgba32 GrayF = new(255, 255, 255, 255);
private static readonly Rgba32 Bit0 = new(0, 0, 0, 255);
private static readonly Rgba32 Bit1 = new(255, 255, 255, 255);
private static readonly byte[] BilevelBytes4X4 =
{
0b01010000,
0b11110000,
0b01110000,
0b10010000
};
private static readonly Rgba32[][] BilevelResult4X4 =
{
new[] { Bit0, Bit1, Bit0, Bit1 },
new[] { Bit1, Bit1, Bit1, Bit1 },
new[] { Bit0, Bit1, Bit1, Bit1 },
new[] { Bit1, Bit0, Bit0, Bit1 }
};
private static readonly byte[] BilevelBytes12X4 =
{
0b01010101, 0b01010000,
0b11111111, 0b11111111,
0b01101001, 0b10100000,
0b10010000, 0b01100000
};
private static readonly Rgba32[][] BilevelResult12X4 =
{
new[] { Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1, Bit0, Bit1 },
new[] { Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1, Bit1 },
new[] { Bit0, Bit1, Bit1, Bit0, Bit1, Bit0, Bit0, Bit1, Bit1, Bit0, Bit1, Bit0 },
new[] { Bit1, Bit0, Bit0, Bit1, Bit0, Bit0, Bit0, Bit0, Bit0, Bit1, Bit1, Bit0 }
};
private static readonly byte[] Grayscale4Bytes4X4 =
{
0x8F, 0x0F,
0xFF, 0xFF,
0x08, 0x8F,
0xF0, 0xF8
};
private static readonly Rgba32[][] Grayscale4Result4X4 =
{
new[] { Gray8, GrayF, Gray0, GrayF },
new[] { GrayF, GrayF, GrayF, GrayF },
new[] { Gray0, Gray8, Gray8, GrayF },
new[] { GrayF, Gray0, GrayF, Gray8 }
};
private static readonly byte[] Grayscale4Bytes3X4 =
{
0x8F, 0x00,
0xFF, 0xF0,
0x08, 0x80,
0xF0, 0xF0
};
private static readonly Rgba32[][] Grayscale4Result3X4 =
{
new[] { Gray8, GrayF, Gray0 },
new[] { GrayF, GrayF, GrayF },
new[] { Gray0, Gray8, Gray8 },
new[] { GrayF, Gray0, GrayF }
};
private static readonly byte[] Grayscale8Bytes4X4 =
{
128, 255, 000, 255,
255, 255, 255, 255,
000, 128, 128, 255,
255, 000, 255, 128
};
private static readonly Rgba32[][] Grayscale8Result4X4 =
{
new[] { Gray128, Gray255, Gray000, Gray255 },
new[] { Gray255, Gray255, Gray255, Gray255 },
new[] { Gray000, Gray128, Gray128, Gray255 },
new[] { Gray255, Gray000, Gray255, Gray128 }
};
public static IEnumerable<object[]> BilevelData
{
get
{
yield return new object[] { BilevelBytes4X4, 1, 0, 0, 4, 4, BilevelResult4X4 };
yield return new object[] { BilevelBytes4X4, 1, 0, 0, 4, 4, Offset(BilevelResult4X4, 0, 0, 6, 6) };
yield return new object[] { BilevelBytes4X4, 1, 1, 0, 4, 4, Offset(BilevelResult4X4, 1, 0, 6, 6) };
yield return new object[] { BilevelBytes4X4, 1, 0, 1, 4, 4, Offset(BilevelResult4X4, 0, 1, 6, 6) };
yield return new object[] { BilevelBytes4X4, 1, 1, 1, 4, 4, Offset(BilevelResult4X4, 1, 1, 6, 6) };
yield return new object[] { BilevelBytes12X4, 1, 0, 0, 12, 4, BilevelResult12X4 };
yield return new object[] { BilevelBytes12X4, 1, 0, 0, 12, 4, Offset(BilevelResult12X4, 0, 0, 18, 6) };
yield return new object[] { BilevelBytes12X4, 1, 1, 0, 12, 4, Offset(BilevelResult12X4, 1, 0, 18, 6) };
yield return new object[] { BilevelBytes12X4, 1, 0, 1, 12, 4, Offset(BilevelResult12X4, 0, 1, 18, 6) };
yield return new object[] { BilevelBytes12X4, 1, 1, 1, 12, 4, Offset(BilevelResult12X4, 1, 1, 18, 6) };
}
}
public static IEnumerable<object[]> Grayscale4_Data
{
get
{
yield return new object[] { Grayscale4Bytes4X4, 4, 0, 0, 4, 4, Grayscale4Result4X4 };
yield return new object[] { Grayscale4Bytes4X4, 4, 0, 0, 4, 4, Offset(Grayscale4Result4X4, 0, 0, 6, 6) };
yield return new object[] { Grayscale4Bytes4X4, 4, 1, 0, 4, 4, Offset(Grayscale4Result4X4, 1, 0, 6, 6) };
yield return new object[] { Grayscale4Bytes4X4, 4, 0, 1, 4, 4, Offset(Grayscale4Result4X4, 0, 1, 6, 6) };
yield return new object[] { Grayscale4Bytes4X4, 4, 1, 1, 4, 4, Offset(Grayscale4Result4X4, 1, 1, 6, 6) };
yield return new object[] { Grayscale4Bytes3X4, 4, 0, 0, 3, 4, Grayscale4Result3X4 };
yield return new object[] { Grayscale4Bytes3X4, 4, 0, 0, 3, 4, Offset(Grayscale4Result3X4, 0, 0, 6, 6) };
yield return new object[] { Grayscale4Bytes3X4, 4, 1, 0, 3, 4, Offset(Grayscale4Result3X4, 1, 0, 6, 6) };
yield return new object[] { Grayscale4Bytes3X4, 4, 0, 1, 3, 4, Offset(Grayscale4Result3X4, 0, 1, 6, 6) };
yield return new object[] { Grayscale4Bytes3X4, 4, 1, 1, 3, 4, Offset(Grayscale4Result3X4, 1, 1, 6, 6) };
}
}
public static IEnumerable<object[]> Grayscale8_Data
{
get
{
yield return new object[] { Grayscale8Bytes4X4, 8, 0, 0, 4, 4, Grayscale8Result4X4 };
yield return new object[] { Grayscale8Bytes4X4, 8, 0, 0, 4, 4, Offset(Grayscale8Result4X4, 0, 0, 6, 6) };
yield return new object[] { Grayscale8Bytes4X4, 8, 1, 0, 4, 4, Offset(Grayscale8Result4X4, 1, 0, 6, 6) };
yield return new object[] { Grayscale8Bytes4X4, 8, 0, 1, 4, 4, Offset(Grayscale8Result4X4, 0, 1, 6, 6) };
yield return new object[] { Grayscale8Bytes4X4, 8, 1, 1, 4, 4, Offset(Grayscale8Result4X4, 1, 1, 6, 6) };
}
}
[Theory]
[MemberData(nameof(BilevelData))]
[MemberData(nameof(Grayscale4_Data))]
[MemberData(nameof(Grayscale8_Data))]
public void Decode_WritesPixelData(byte[] inputData, ushort bitsPerSample, int left, int top, int width, int height, Rgba32[][] expectedResult)
=> AssertDecode(
expectedResult,
pixels => new BlackIsZeroTiffColor<Rgba32>(new TiffBitsPerSample(bitsPerSample, 0, 0)).Decode(inputData, pixels, left, top, width, height));
[Theory]
[MemberData(nameof(BilevelData))]
public void Decode_WritesPixelData_Bilevel(byte[] inputData, int bitsPerSample, int left, int top, int width, int height, Rgba32[][] expectedResult)
=> AssertDecode(expectedResult, pixels => new BlackIsZero1TiffColor<Rgba32>().Decode(inputData, pixels, left, top, width, height));
[Theory]
[MemberData(nameof(Grayscale4_Data))]
public void Decode_WritesPixelData_4Bit(byte[] inputData, int bitsPerSample, int left, int top, int width, int height, Rgba32[][] expectedResult)
=> AssertDecode(
expectedResult,
pixels => new BlackIsZero4TiffColor<Rgba32>().Decode(inputData, pixels, left, top, width, height));
[Theory]
[MemberData(nameof(Grayscale8_Data))]
public void Decode_WritesPixelData_8Bit(byte[] inputData, int bitsPerSample, int left, int top, int width, int height, Rgba32[][] expectedResult)
=> AssertDecode(expectedResult, pixels => new BlackIsZero8TiffColor<Rgba32>(Configuration.Default).Decode(inputData, pixels, left, top, width, height));
}
```
|
North Carolina's 38th Senate district is one of 50 districts in the North Carolina Senate. It has been represented by Democrat Mujtaba Mohammed since 2019.
Geography
Since 2003, the district has covered part of Mecklenburg County. The district overlaps with the 99th, 100th, 102nd, 106th, and 107th state house districts.
District officeholders since 1993
Election results
2022
2020
2018
2016
2014
2012
2010
2008
2006
2004
2002
2000
References
North Carolina Senate districts
Mecklenburg County, North Carolina
|
```xml
import { Checkbox, Input, InputNumber, Radio, Switch } from 'antd';
import generatePicker from 'antd/es/date-picker/generatePicker/index.js';
import type { Dayjs } from 'dayjs';
import dayjs from 'dayjs';
import * as React from 'react';
import type { ValueEditorProps } from 'react-querybuilder';
import { getFirstOption, joinWith, standardClassnames, useValueEditor } from 'react-querybuilder';
import dayjsGenerateConfig from './dayjs';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type AntDValueEditorProps = ValueEditorProps & { extraProps?: Record<string, any> };
const DatePicker = generatePicker(dayjsGenerateConfig);
export const AntDValueEditor = (allProps: AntDValueEditorProps) => {
const {
fieldData,
operator,
value,
handleOnChange,
title,
className,
type,
inputType,
values = [],
listsAsArrays,
parseNumbers,
separator,
valueSource: _vs,
disabled,
testID,
selectorComponent: SelectorComponent = allProps.schema.controls.valueSelector,
extraProps,
...props
} = allProps;
const { valueAsArray, multiValueHandler } = useValueEditor({
handleOnChange,
inputType,
operator,
value,
type,
listsAsArrays,
parseNumbers,
values,
});
if (operator === 'null' || operator === 'notNull') {
return null;
}
const placeHolderText = fieldData?.placeholder ?? '';
const inputTypeCoerced = ['in', 'notIn'].includes(operator) ? 'text' : inputType || 'text';
if (
(operator === 'between' || operator === 'notBetween') &&
(type === 'select' || type === 'text') &&
// Date ranges are handled differently in AntD--see below
inputTypeCoerced !== 'date' &&
inputTypeCoerced !== 'datetime-local'
) {
const editors = ['from', 'to'].map((key, i) => {
if (type === 'text') {
if (inputTypeCoerced === 'time') {
return (
<DatePicker.TimePicker
key={key}
value={valueAsArray[i] ? dayjs(valueAsArray[i], 'HH:mm:ss') : null}
className={standardClassnames.valueListItem}
disabled={disabled}
placeholder={placeHolderText}
onChange={d => multiValueHandler(d?.format('HH:mm:ss') ?? '', i)}
{...extraProps}
/>
);
} else if (inputTypeCoerced === 'number') {
return (
<InputNumber
key={key}
type={inputTypeCoerced}
value={valueAsArray[i] ?? ''}
className={standardClassnames.valueListItem}
disabled={disabled}
placeholder={placeHolderText}
onChange={v => multiValueHandler(v, i)}
{...extraProps}
/>
);
}
return (
<Input
key={key}
type={inputTypeCoerced}
value={valueAsArray[i] ?? ''}
className={standardClassnames.valueListItem}
disabled={disabled}
placeholder={placeHolderText}
onChange={e => multiValueHandler(e.target.value, i)}
{...extraProps}
/>
);
}
return (
<SelectorComponent
{...props}
key={key}
className={standardClassnames.valueListItem}
handleOnChange={v => multiValueHandler(v, i)}
disabled={disabled}
value={valueAsArray[i] ?? getFirstOption(values)}
options={values}
listsAsArrays={listsAsArrays}
/>
);
});
return (
<span data-testid={testID} className={className} title={title}>
{editors[0]}
{separator}
{editors[1]}
</span>
);
}
switch (type) {
case 'select':
case 'multiselect':
return (
<SelectorComponent
{...props}
className={className}
handleOnChange={handleOnChange}
options={values}
value={value}
title={title}
disabled={disabled}
multiple={type === 'multiselect'}
listsAsArrays={listsAsArrays}
{...extraProps}
/>
);
case 'textarea':
return (
<Input.TextArea
value={value}
title={title}
className={className}
disabled={disabled}
placeholder={placeHolderText}
onChange={e => handleOnChange(e.target.value)}
{...extraProps}
/>
);
case 'switch':
return (
<Switch
checked={!!value}
title={title}
className={className}
disabled={disabled}
onChange={v => handleOnChange(v)}
{...extraProps}
/>
);
case 'checkbox':
return (
<span title={title} className={className}>
<Checkbox
type="checkbox"
disabled={disabled}
onChange={e => handleOnChange(e.target.checked)}
checked={!!value}
{...extraProps}
/>
</span>
);
case 'radio':
return (
<span className={className} title={title}>
{values.map(v => (
<Radio
key={v.name}
value={v.name}
checked={value === v.name}
disabled={disabled}
onChange={e => handleOnChange(e.target.value)}
{...extraProps}>
{v.label}
</Radio>
))}
</span>
);
}
switch (inputTypeCoerced) {
case 'date':
case 'datetime-local': {
if (operator === 'between' || operator === 'notBetween') {
const dayjsArray = valueAsArray.slice(0, 2).map(dayjs) as [Dayjs, Dayjs];
return (
<DatePicker.RangePicker
value={dayjsArray.every(d => d.isValid()) ? dayjsArray : undefined}
showTime={inputTypeCoerced === 'datetime-local'}
className={className}
disabled={disabled}
placeholder={[placeHolderText, placeHolderText]}
// TODO: the function below is currently untested (see the
// "should render a date range picker" test in ./AntD.test.tsx)
onChange={
/* istanbul ignore next */
dates => {
const timeFormat = inputTypeCoerced === 'datetime-local' ? 'THH:mm:ss' : '';
const format = `YYYY-MM-DD${timeFormat}`;
const dateArray = dates?.map(d => (d?.isValid() ? d.format(format) : undefined));
handleOnChange(
dateArray ? (listsAsArrays ? dateArray : joinWith(dateArray, ',')) : dates
);
}
}
{...extraProps}
/>
);
}
const dateValue = dayjs(value);
return (
<DatePicker
value={dateValue.isValid() ? dateValue : undefined}
showTime={inputTypeCoerced === 'datetime-local'}
className={className}
disabled={disabled}
placeholder={placeHolderText}
onChange={(_d, dateString) => handleOnChange(dateString)}
{...extraProps}
/>
);
}
case 'time': {
const dateValue = dayjs(value, 'HH:mm:ss');
return (
<DatePicker.TimePicker
value={dateValue.isValid() ? dateValue : undefined}
className={className}
disabled={disabled}
placeholder={placeHolderText}
onChange={d => handleOnChange(d?.format('HH:mm:ss') ?? '')}
{...extraProps}
/>
);
}
case 'number': {
return (
<InputNumber
type={inputTypeCoerced}
value={value}
title={title}
className={className}
disabled={disabled}
placeholder={placeHolderText}
onChange={handleOnChange}
{...extraProps}
/>
);
}
}
return (
<Input
type={inputTypeCoerced}
value={value}
title={title}
className={className}
disabled={disabled}
placeholder={placeHolderText}
onChange={e => handleOnChange(e.target.value)}
{...extraProps}
/>
);
};
```
|
São Francisco de Itabapoana () is a municipality located in the Brazilian state of Rio de Janeiro. Its population was 42,210 (2020) and its area is 1,111 km².
See also
Itabapoana River
References
Populated coastal places in Rio de Janeiro (state)
Municipalities in Rio de Janeiro (state)
|
```c++
// Add extra initialization here.
// Add 20 items to the combo box. The Resource Editor
// has already been used to set the style of the combo
// box to CBS_SORT.
CString str;
for (int i = 1; i <= 20; i++)
{
str.Format(_T("Item %2d"), i);
m_combobox.AddString(str);
}
// Set the minimum visible item
m_combobox.SetMinVisibleItems(10);
// Set the cue banner
m_combobox.SetCueBanner(_T("Select an item..."));
// End of extra initialization.
```
|
```c++
/// Source : path_to_url
/// Author : liuyubobobo
/// Time : 2019-09-07
#include <iostream>
#include <vector>
#include <map>
#include <set>
using namespace std;
/// Memory Search
/// Time Complexity: O(n*m*logm)
/// Space Complexity: O(n*m)
class Solution {
private:
int MAX;
public:
int makeArrayIncreasing(vector<int>& arr1, vector<int>& arr2) {
set<int> set;
for(int e: arr2) set.insert(e);
arr2 = vector<int>(set.begin(), set.end());
MAX = arr2.size() + 1;
vector<vector<int>> dp(arr1.size(), vector<int>(arr2.size() + 1, -1));
int res = go(arr1, arr2, 0, 0, dp);
for(int j = 0; j < arr2.size(); j ++)
res = min(res, (arr1[0] != arr2[0]) + go(arr1, arr2, 0, j + 1, dp));
return res >= MAX ? -1 : res;
}
private:
int go(const vector<int>& arr1, const vector<int>& arr2, int i, int j,
vector<vector<int>>& dp){
if(i + 1 == arr1.size()) return 0;
if(dp[i][j] != -1) return dp[i][j];
int last = j == 0 ? arr1[i] : arr2[j - 1];
int res = MAX;
if(arr1[i + 1] > last)
res = min(res, go(arr1, arr2, i + 1, 0, dp));
vector<int>::const_iterator iter = upper_bound(arr2.begin(), arr2.end(), last);
if(iter != arr2.end()){
int jj = iter - arr2.begin();
res = min(res, 1 + go(arr1, arr2, i + 1, jj + 1, dp));
}
return dp[i][j] = res;
}
};
int main() {
vector<int> a1 = {1, 5, 3, 6, 7}, b1 = {1, 3, 2, 4};
cout << Solution().makeArrayIncreasing(a1, b1) << endl;
// 1
vector<int> a2 = {1, 5, 3, 6, 7}, b2 = {4, 3, 1};
cout << Solution().makeArrayIncreasing(a2, b2) << endl;
// 2
vector<int> a3 = {1, 5, 3, 6, 7}, b3 = {1, 6, 3, 3};
cout << Solution().makeArrayIncreasing(a3, b3) << endl;
// -1
return 0;
}
```
|
The Philippines' National Food Authority (, abbreviated as NFA), is an agency of the Philippine government under the Department of Agriculture responsible for ensuring the food security of the Philippines and the stability of supply and price of rice, the Philippines' staple grain.
History
The National Food Authority was created by President Ferdinand Marcos through Presidential Decree No. 4 dated September 26, 1972, under the name National Grains Authority (NGA) with the mission of promoting the integrated growth and development of the grains industry covering rice, corn, feed grains and other grains like sorghum, mung beans, and peanuts. This decree abolished two agencies, namely, the Rice and Corn Board (RICOB) and the Rice and Corn Administration (RCA) and absorbed their respective functions into the NFA. The former was then regulating the rice and corn retail trade and was tasked to nationalize it within a target date. The latter was marketed and distributed government low-priced rice especially during lean months. In addition, the new agency was vested with additional functions aimed at developing post-harvest systems and processes.
Among others, the NGA supported the paddy production program of the government referred to as the Masagana 99 agricultural program, which was geared toward rice self-sufficiency. It engaged in massive paddy procurement at government support prices, and with limited volume, the country joined the family of rice exporting countries from 1977 to 1981. Economists generally acknowledge Masagana 99 to have failed because the supervised credit scheme it offered to farmers proved unsustainable.
On January 14, 1981, Presidential Decree No. 1770 renamed the NGA and established the National Food Authority (NFA), further widening the agency's social responsibilities and commodity coverage to include, in addition to grains, other food items like raw or fresh fruits and vegetables and fish and marine, manufactured, processed, or packaged food products, and these were collectively referred to as non-grains commodities. This law was the basis of the Kadiwa stores or government retail stores, which sold low-priced basic food and household items which were established within the National Capital Region and in all the provinces of the Philippines.
On May 31, 1985, Executive Order No. 1028 provided for the deregulation of NFA's non-grains marketing activities, specifically terminating NFA's non-grains trading activities, returning feed grains and wheat importation to the private sector, and lifting price controls on rice and corn. As such, at the end of 1986, all the Kadiwa Stores had sold or closed.
Today, the National Food Authority is charge with ensuring the food security of the country and the stability of supply and price of the staple grain-rice. It performs these functions through various activities and strategies, which include procurement of paddy from individual farmers and their organizations, buffer stocking, processing activities, dispersal of paddy and milled rice to strategic locations and distribution of the staple grain to various marketing outlets at appropriate times of the year.
In recent years, in response to globalization and to the efforts to reduce the national budget deficit, the government has been looking into the possibility of restructuring, streamlining or privatizing certain activities of the NFA.
On May 5, 2014, Executive Order No. 165 signed by President Benigno Aquino III reassigned the National Food Authority and three other agencies to the Office of the President, with oversight responsibilities for the four agencies given to Francis Pangilinan in the newly created post of Presidential Assistant for Food Security and Agricultural Modernization. Then-NFA administrator Orlan Calayag stepped down in what he described as a "courtesy resignation" so that Pangilinan could appoint his own preferred candidate to head the NFA.
On July 4, 2016, NFA was among the 12 agencies, formerly from the Office of the President reassigned to the Office of the Cabinet Secretary, based on Executive Order No. 1 issued by President Rodrigo Duterte. It was restored to the Department of Agriculture, along with the Philippine Coconut Authority and the Fertilizer and Pesticide Authority, by Executive Order No. 62 issued in September 2018.
See also
Food Terminal, Inc.
References
External links
NFA Philippines homepage
Government-owned and controlled corporations of the Philippines
Establishments by Philippine presidential decree
|
```javascript
Weak vs Strict equality operator
Types of numbers
Using assignment operators
Double and single quotes
Infinity
```
|
Colpach-Bas (, ) is a village in the commune of Ell, in western Luxembourg. , the village has a population of 105.
Colpach Castle dates from the beginning of the 14th century when it was a stronghold. It was adapted as a manor house in the 18th century. Today it is a convalescent centre run by the Red Cross.
References
Redange (canton)
Villages in Luxembourg
|
Joe Waskom (born 12 April 2001) is an American track and field athlete who competes as a middle-distance runner.
Early life
From Snoqualmie, Washington he attended Mount Si High School. Running for the Washington Huskies, Waskom initially competed as a steeplechaser. He won the NCAA Division 1 title in the 1500m in 2022.
Career
Waskom finished second in the 1500m at the US national championships in July 2023 in Eugene, Oregon. That month he also set new personal best time of 3:34.64 in Lignano Sabbiadoro, Italy. He was selected for the 2023 World Athletics Championships in Budapest in August 2023.
Personal bests
800 metres – 1:44.67 (Barcelona 2023)
800 metres indoor – 1:52.20 (Zaragoza 2022)
1500 metres – 3:34.64 (Lignano Sabbiadoro 2023)
1500 metres indoor – 3:39.53 (Boston 2023)
Mile – 3:51.90 (Seattle 2023)
Mile indoor – 3:56.43 (Fayetteville 2021)
3000 metres steeplechase – 8:35.71 (Los Angeles 2022)
References
2001 births
Living people
Washington Huskies men's track and field athletes
American male middle-distance runners
21st-century American people
Track and field athletes from Washington (state)
|
The following is List of Universities and Colleges in Liaoning.
References
List of Chinese Higher Education Institutions — Ministry of Education
List of Chinese universities, including official links
Liaoning Institutions Admitting International Students
Liaoning
|
```smalltalk
using System.Threading.Tasks;
namespace AspectCore.DynamicProxy
{
[NonAspect]
public interface IAspectActivator
{
TResult Invoke<TResult>(AspectActivatorContext activatorContext);
Task<TResult> InvokeTask<TResult>(AspectActivatorContext activatorContext);
ValueTask<TResult> InvokeValueTask<TResult>(AspectActivatorContext activatorContext);
}
}
```
|
```c++
//
// gettsc.inl
//
// gives access to the Pentium's (secret) cycle counter
//
// This software was written by Leonard Janke (janke@unixg.ubc.ca)
// in 1996-7 and is entered, by him, into the public domain.
#if defined(__WATCOMC__)
void GetTSC(unsigned long&);
#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
#elif defined(__GNUC__)
inline
void GetTSC(unsigned long& tsc)
{
asm volatile(".byte 15, 49\n\t"
: "=eax" (tsc)
:
: "%edx", "%eax");
}
#elif defined(_MSC_VER)
inline
void GetTSC(unsigned long& tsc)
{
unsigned long a;
__asm _emit 0fh
__asm _emit 31h
__asm mov a, eax;
tsc=a;
}
#endif
#include <stdio.h>
#include <stdlib.h>
#include <openssl/rc4.h>
void main(int argc,char *argv[])
{
unsigned char buffer[1024];
RC4_KEY ctx;
unsigned long s1,s2,e1,e2;
unsigned char k[16];
unsigned long data[2];
unsigned char iv[8];
int i,num=64,numm;
int j=0;
if (argc >= 2)
num=atoi(argv[1]);
if (num == 0) num=256;
if (num > 1024-16) num=1024-16;
numm=num+8;
for (j=0; j<6; j++)
{
for (i=0; i<10; i++) /**/
{
RC4(&ctx,numm,buffer,buffer);
GetTSC(s1);
RC4(&ctx,numm,buffer,buffer);
GetTSC(e1);
GetTSC(s2);
RC4(&ctx,num,buffer,buffer);
GetTSC(e2);
RC4(&ctx,num,buffer,buffer);
}
printf("RC4 (%d bytes) %d %d (%d) - 8 bytes\n",num,
e1-s1,e2-s2,(e1-s1)-(e2-s2));
}
}
```
|
The Marsh Railway () is a main line in the state of Schleswig-Holstein in Germany that links the stations of Elmshorn in the south and Westerland on the island of Sylt in the north. It is part of long route from Hamburg-Altona to Westerland (Sylt) and is listed in the Deutsche Bahn timetables as . The first part of it was opened in 1845 and is one of the oldest lines in Germany.
Route
The Marsh Railway, as its name suggests, mainly runs through marshlands. There are also some sections of the line that run through the higher-lying geest. The line branches off the Hamburg-Altona-Kiel railway line in Elmshorn. From Elmshorn, it runs in an arc via Glückstadt to Itzehoe. The line then crosses the Kiel Canal on the high Hochdonn High Bridge. The bridge's total length is and its main span over the channel is long. There is also a bascule bridge north of Husum station. Between Klanxbüll and Morsum stations the line runs across the Hindenburgdamm (causeway) through the North Frisian mudflats.
History
The first section of the current Marsh Railway was built by the Glückstadt-Elmshorn Railway Company (Glückstadt-Elmshorner Eisenbahn-Gesellschaft) shortly after the opening of the Altona–Kiel line on 18 September 1844. The company opened a line from Elmshorn to Glückstadt port station on 20 July 1845. Twelve years later, on 15 October 1857, the line was realigned in Glückstadt and extended to the edge of the Stör river in Itzehoe. In 1878, a swing bridge was built across the Stör—which was replaced in 1910 during the duplication of the line by two bascule bridges—and the line was extended to the Heide station of the Neumünster–Heide–Karolinenkoog line, which opened on 22 August 1877.
On 1 January 1879 the Glückstadt-Elmshorn Railway Company became the Holstein Marsh Railway Company (Holsteinische Marschbahn-Gesellschaft). In 1888, this company was acquired by the Schleswig-Holstein Marsh Railway Company (Schleswig-Holsteinische Marschbahn-Gesellschaft). On 1 July 1890, the company was acquired by the Prussian government and it became part of the Prussian State Railways.
In 1886 construction began on an extension and on 1 September 1886 the line was opened via Lunden and a bridge over the Eider near Friedrichstadt to Husum, where it connected with the Flensburg–Husum–Tönning line. The line was extended further north to Bredstedt on 17 October 1887 and to Niebüll on 15 November 1887. The line was subsequently extended further north to Tønder, connecting to branch lines to Tinglev and Højer Sluse, which was the port for a ferry connection to Sylt. The line was extended to Bredebro, Scherrebek, Ribe and Bramming, where it connected with the Danish rail network.
1920-1926
In 1920 northern Schleswig became part of Denmark, and the border was established between Niebüll and Tønder. This meant that traffic to Sylt had to cross the German-Danish border twice, although the Danish authorities allowed sealed transit trains to operate, avoiding customs inspections of passengers. The operation of transit trains and the Hoyer–Sylt ferry ended with the inauguration of the Hindenburg causeway in 1927.
Originally, the Marsh Railway ran from Wilster directly to St. Michaelisdonn. During the construction of the Kiel Canal a swing bridge was built on the line at Taterpfahl near St. Margarethen. During the widening of the canal in 1920, a new non-opening high bridge was built on the geest at Hochdonn on a 5.8 km long bypass route. The new train route with the new bridge was originally planned directly from Itzehoe to Meldorf, but because of protests from Wilster and Sankt Michaelisdonn, the line was elongated and rerouted to include these towns. The old track was rebuilt to run from Wilster to Brunsbüttelkoog and on the north side to Brunsbüttel Nord.
1927-1948
Significant changes took place on 1 June 1927 with the opening of Hindenburg causeway, which was prepared in 1922 by prolonging the line from Niebüll to Klanxbüll to enable material transports. Deutsche Reichsbahn (German State Railways) opened a new station at Westerland together with the connecting part of the line. The Sylt Island Railway lost its traffic between Munkmarsch and Westerland, because the ferry service between Hoyer and Sylt had been closed. The Island Railway built a station next to the Reichsbahn station, with a simple reception building.
1948–1993
After World War II many (often long) express trains ran to Westerland, especially in the summer season. Most trains ran beyond Hamburg towards Cologne and the Ruhr, some went to southern Germany. Daily service also operated as interzonal trains from Berlin (running without stopping in the former East Germany), which were augmented in the summer at weekends by a second pair of trains.
Until the 1970s, these services were hauled by class 01.10 locomotives. These were replaced by class 218 diesels.
A significant improvement of services on the Marsh line occurred with the timetable of summer 1978. Regular interval Intercity (IC) trains were introduced between Cologne and Hamburg, with some first and second class carriages running beyond Hamburg to Westerland. A year later IC connections from Westerland to Frankfurt am Main and Munich were added.
Clock-face timetable since 1991
The 1991 there was a complete transformation of the passenger transport services on the Marsh line and in Schleswig–Holstein. New two-hourly express trains were introduced that ran between Hamburg and Heide making even fewer stops than IC trains. These trains were aimed at offering travel times of less than two and a half hours from Hamburg to North Sea resorts, such as Büsum via Heide, Dagebüll via Niebüll and Sankt Peter-Ording via Husum. Hourly local trains were introduced, stopping at all stations to Husum. Trains were added during peak hours from Pinneberg to Itzehoe.
Notes
References
External links
The Marschbahn
Route description
The last days of the DB-RBSH on the Marsh Railway
Photo reports at Bahnfotokiste about the Marsh Railway by Jan Borchers
Photo gallery of the block section by Jan-Geert Lukner
route overview and kilometrage
Railway lines in Schleswig-Holstein
Railway lines in Denmark
Railway lines opened in 1845
Establishments in Schleswig-Holstein in 1845
Buildings and structures in Pinneberg (district)
Rail transport in the Region of Southern Denmark
Steinburg
Dithmarschen
Buildings and structures in Nordfriesland
Sylt
|
```yaml
commonfields:
id: ConvertToSingleElementArray
version: -1
name: ConvertToSingleElementArray
script: ''
type: python
tags:
- transformer
- entirelist
comment: Converts a single string to an array of that string.
enabled: true
args:
- name: value
default: true
description: The string to convert to an array of that string.
isArray: true
scripttarget: 0
subtype: python3
runas: DBotWeakRole
fromversion: 5.0.0
tests:
- No tests (auto formatted)
dockerimage: demisto/python3:3.10.13.83255
```
|
The Philippine Institute for Development Studies (PIDS) is a government-owned and controlled corporation of the Philippine National Government. It was established in September 1977 to conduct research to help government planners. Its primary client is the National Economic and Development Authority. PIDS was established by Presidential Decree No. 1201.
About the Institute
Roles and Goals
To develop and implement a comprehensive and integrated research program. The Institute will provide the research materials and studies required to formulate national development plans and policies;
To serve as a common link between the government and researching institutes;
To establish a repository for economic research information and other related activities.
Programs and Activities
To carry out its mandate, the Institute has maintained three basic programs, namely
Research Program
Outreach Program
Dissemination and Research Utilization Program.
The Policy Research Agenda for 2005-2009 include the following themes
Economic Policy Choices
Policies for Sustainable Human Development
Institutional Development and Good Governance
The Philippine Institute for Development Studies (PIDS) has developed various websites and online databases from socioeconomic indicators and agricultural statistics to economic-related bills.
Publications
Policy Notes: observations/analyses written by PIDS researchers on policy issues.
Development Research News: a bimonthly publication of the Institute which highlights findings and recommendations culled from PIDS-sponsored research and fora. This newsletter also includes articles on key national and current issues as well as news on PIDS activities participated in by the staff.
Discussion Papers: preliminary, unedited and unreviewed papers circulated on a limited basis for the purpose of eliciting critical comments and suggestions for refinement of the studies. They may eventually graduate into any of the Institute's regular publication series.
Economic Issue of the Day: a two-page publication which deals with concepts behind economic issues. Aims to define and explain in simple terms basic economic concepts as they relate to current and everyday economics-related matters.
Philippine Journal of Development: (formerly Journal of Philippine Development) is a professional journal published twice a year which focuses on Philippine development. This is particularly on economy, business, public administration, foreign relations, sociology, political dynamics and other topics which have policy implications for Philippine concerns.
Research Paper Series: a formal publication meant to promote research, stimulate discussion and encourage the use of study results.
References
External links
Philippine Institute for Development Studies
Government-owned and controlled corporations of the Philippines
Development organizations
1977 establishments in the Philippines
Establishments by Philippine presidential decree
|
Yuraq Yaku (Quechua yuraq white, yaku water, "white water", also spelled Yuraj Yaco) is a mountain in the Bolivian Andes. It is located in the Cochabamba Department, Quillacollo Province, Sipe Sipe Municipality. Yuraq Yaku lies southeast of Inka Laqaya.
References
Mountains of Cochabamba Department
|
```java
/**
*
*
* A Processing/Java library for high performance GPU-Computing (GLSL).
*
*/
package com.thomasdiewald.pixelflow.java.fluid;
import com.jogamp.opengl.GL2ES2;
import com.thomasdiewald.pixelflow.java.DwPixelFlow;
import com.thomasdiewald.pixelflow.java.dwgl.DwGLSLProgram;
import com.thomasdiewald.pixelflow.java.dwgl.DwGLTexture;
import processing.core.PConstants;
import processing.core.PImage;
import processing.opengl.PGraphics2D;
public class DwFluidParticleSystem2D{
public DwGLSLProgram shader_particleInit ;
public DwGLSLProgram shader_particleUpdate;
public DwGLSLProgram shader_particleRender;
public DwGLTexture.TexturePingPong tex_particles = new DwGLTexture.TexturePingPong();
public DwPixelFlow context;
public int particles_x;
public int particles_y;
public Param param = new Param();
static public class Param{
public float dissipation = 0.8f;
public float inertia = 0.2f;
}
public DwFluidParticleSystem2D(){
}
public DwFluidParticleSystem2D(DwPixelFlow context, int num_particels_x, int num_particels_y){
context.papplet.registerMethod("dispose", this);
this.resize(context, num_particels_x, num_particels_y);
}
public void dispose(){
release();
}
public void release(){
tex_particles.release();
}
public void resize(DwPixelFlow context_, int num_particels_x, int num_particels_y){
context = context_;
context.begin();
release();
this.particles_x = num_particels_x;
this.particles_y = num_particels_y;
// System.out.println("ParticelSystem: size = "+particles_x+"/"+particles_y +" ("+particles_x*particles_y+" objects)");
String dir = DwPixelFlow.SHADER_DIR+"ParticleSystem/";
// create shader
shader_particleInit = context.createShader(dir+"particleInit.frag");
shader_particleUpdate = context.createShader(dir+"particleUpdate.frag");
shader_particleRender = context.createShader(dir+"particleRender.glsl", dir+"particleRender.glsl");
shader_particleRender.vert.setDefine("SHADER_VERT", 1);
shader_particleRender.frag.setDefine("SHADER_FRAG", 1);
// allocate texture
tex_particles.resize(context, GL2ES2.GL_RGBA32F, particles_x, particles_y, GL2ES2.GL_RGBA, GL2ES2.GL_FLOAT, GL2ES2.GL_NEAREST, 4, 4);
tex_particles.src.clear(0);
tex_particles.dst.clear(0);
init();
context.end("ParticleSystem.resize");
}
public void reset(){
init();
}
public void init(){
context.begin();
context.beginDraw(tex_particles.dst);
shader_particleInit.begin();
shader_particleInit.uniform2f("wh", particles_x, particles_y);
shader_particleInit.drawFullScreenQuad();
shader_particleInit.end();
context.endDraw();
context.end("ParticleSystem.init");
tex_particles.swap();
}
public void update(DwFluid2D fluid){
context.begin();
context.beginDraw(tex_particles.dst);
shader_particleUpdate.begin();
shader_particleUpdate.uniform2f ("wh_fluid" , fluid.fluid_w, fluid.fluid_h);
shader_particleUpdate.uniform2f ("wh_particles" , particles_x, particles_y);
shader_particleUpdate.uniform1f ("timestep" , fluid.param.timestep);
shader_particleUpdate.uniform1f ("rdx" , 1.0f / fluid.param.gridscale);
shader_particleUpdate.uniform1f ("dissipation" , param.dissipation);
shader_particleUpdate.uniform1f ("inertia" , param.inertia);
shader_particleUpdate.uniformTexture("tex_particles", tex_particles.src);
shader_particleUpdate.uniformTexture("tex_velocity" , fluid.tex_velocity.src);
shader_particleUpdate.uniformTexture("tex_obstacles", fluid.tex_obstacleC.src);
shader_particleUpdate.drawFullScreenQuad();
shader_particleUpdate.end();
context.endDraw();
context.end("ParticleSystem.update");
tex_particles.swap();
}
public void render(PGraphics2D dst, PImage sprite, int display_mode){
int[] sprite_tex_handle = new int[1];
if(sprite != null){
sprite_tex_handle[0] = dst.getTexture(sprite).glName;
}
int w = dst.width;
int h = dst.height;
dst.beginDraw();
// dst.blendMode(PConstants.BLEND);
dst.blendMode(PConstants.ADD);
context.begin();
shader_particleRender.begin();
shader_particleRender.uniform2f ("wh_viewport", w, h);
shader_particleRender.uniform2i ("num_particles", particles_x, particles_y);
shader_particleRender.uniformTexture("tex_particles", tex_particles.src);
shader_particleRender.uniformTexture("tex_sprite" , sprite_tex_handle[0]);
shader_particleRender.uniform1i ("display_mode" , display_mode); // 0 ... 1px points, 1 = sprite texture, 2 ... falloff points
shader_particleRender.drawFullScreenPoints(particles_x * particles_y);
shader_particleRender.end();
context.end("ParticleSystem.render");
dst.endDraw();
}
}
```
|
```scss
@function inner-border-spread($width) {
$top: top($width);
$right: right($width);
$bottom: bottom($width);
$left: left($width);
@return min(($top + $bottom) / 2, ($left + $right) / 2);
}
@function inner-border-hoff($width, $spread) {
$left: left($width);
$right: right($width);
@if $right <= 0 {
@return $left - $spread;
}
@else {
@return $spread - $right;
}
}
@function inner-border-voff($width, $spread) {
$top: top($width);
$bottom: bottom($width);
@if $bottom <= 0 {
@return $top - $spread;
}
@else {
@return $spread - $bottom;
}
}
@function even($number) {
@return ceil($number / 2) == ($number / 2);
}
@function odd($number) {
@return ceil($number / 2) != ($number / 2);
}
@function inner-border-usesingle-width($width) {
$top: top($width);
$right: right($width);
$bottom: bottom($width);
$left: left($width);
@if $top == 0 {
@if $left + $right == 0 {
@return true;
}
@if $bottom >= $left + $right {
@return true;
}
}
@if $bottom == 0 {
@if $left + $right == 0 {
@return true;
}
@if $top >= $left + $right {
@return true;
}
}
@if $left == 0 {
@if $top + $bottom == 0 {
@return true;
}
@if $right >= $top + $bottom {
@return true;
}
}
@if $right == 0 {
@if $top + $bottom == 0 {
@return true;
}
@if $left >= $top + $bottom {
@return true;
}
}
@if $top + $bottom == $left + $right and even($top) == even($bottom) and even($left) == even($right) {
@return true;
}
@return false;
}
@function inner-border-usesingle-color($color) {
$top: top($color);
$right: right($color);
$bottom: bottom($color);
$left: left($color);
@if $top == $right == $bottom == $left {
@return true;
}
@return false;
}
@function inner-border-usesingle($width, $color) {
@if inner-border-usesingle-color($color) and inner-border-usesingle-width($width) {
@return true;
}
@return false;
}
@mixin inner-border($width: 1px, $color: #fff, $blur: 0px) {
@if max($width) == 0 {
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
} @else if inner-border-usesingle($width, $color) {
$spread: inner-border-spread($width);
$hoff: inner-border-hoff($width, $spread);
$voff: inner-border-voff($width, $spread);
@include single-box-shadow($color-top, $hoff, $voff, $blur, $spread, true);
}
@else {
$width-top: top($width);
$width-right: right($width);
$width-bottom: bottom($width);
$width-left: left($width);
$color-top: top($color);
$color-right: right($color);
$color-bottom: bottom($color);
$color-left: left($color);
$shadow-top: false;
$shadow-right: false;
$shadow-bottom: false;
$shadow-left: false;
@if $width-top > 0 {
$shadow-top: $color-top 0 $width-top $blur 0 inset;
}
@if $width-right > 0 {
$shadow-right: $color-right (-1 * $width-right) 0 $blur 0 inset;
}
@if $width-bottom > 0 {
$shadow-bottom: $color-bottom 0 (-1 * $width-bottom) $blur 0 inset;
}
@if $width-left > 0 {
$shadow-left: $color-left $width-left 0 $blur 0 inset;
}
@include box-shadow($shadow-top, $shadow-bottom, $shadow-right, $shadow-left);
}
}
```
|
```javascript
import React from 'react';
import { render, screen } from '@testing-library/react';
import { Badge } from '../';
describe('Badge', () => {
it('should render a span by default', () => {
render(<Badge>Yo!</Badge>);
expect(screen.getByText('Yo!').tagName).toBe('SPAN');
});
it('should render an anchor when when href is provided', () => {
render(<Badge href="#">Yo!</Badge>);
expect(screen.getByText('Yo!').tagName).toBe('A');
});
it('should render a custom tag when provided', () => {
render(<Badge tag="main">Yo!</Badge>);
expect(screen.getByText('Yo!').tagName).toBe('MAIN');
});
it('should render children', () => {
render(<Badge>Yo!</Badge>);
expect(screen.getByText('Yo!').innerHTML).toBe('Yo!');
});
it('should render badges with secondary color', () => {
render(<Badge>Badge</Badge>);
expect(screen.getByText('Badge').classList.contains('badge-secondary')).toBe(true);
});
it('should render Badges with other colors', () => {
render(<Badge color="danger">Danger Badge</Badge>);
expect(screen.getByText('Danger Badge').classList.contains('badge-danger')).toBe(true);
});
it('should render Badges as pills', () => {
render(<Badge pill>Pill Badge</Badge>);
expect(screen.getByText('Pill Badge').classList.contains('badge-pill')).toBe(true);
});
});
```
|
```python
import json
v1_metrics_path = "./V1_Metrics.json"
v2_metrics_path = "./V2_Metrics.json"
with open(v1_metrics_path, 'r') as file:
v1_metrics = json.load(file)
with open(v2_metrics_path, 'r') as file:
v2_metrics = json.load(file)
# Extract names and labels of the metrics
def extract_metrics_with_labels(metrics, strip_prefix=None):
result = {}
for metric in metrics:
name = metric['name']
if strip_prefix and name.startswith(strip_prefix):
name = name[len(strip_prefix):]
labels = {}
if 'metrics' in metric and 'labels' in metric['metrics'][0]:
labels = metric['metrics'][0]['labels']
result[name] = labels
return result
v1_metrics_with_labels = extract_metrics_with_labels(v1_metrics)
v2_metrics_with_labels = extract_metrics_with_labels(
v2_metrics, strip_prefix="otelcol_")
# Compare the metrics names and labels
common_metrics = {}
v1_only_metrics = {}
v2_only_metrics = {}
for name, labels in v1_metrics_with_labels.items():
if name in v2_metrics_with_labels:
common_metrics[name] = labels
elif not name.startswith("jaeger_agent"):
v1_only_metrics[name] = labels
for name, labels in v2_metrics_with_labels.items():
if name not in v1_metrics_with_labels:
v2_only_metrics[name] = labels
differences = {
"common_metrics": common_metrics,
"v1_only_metrics": v1_only_metrics,
"v2_only_metrics": v2_only_metrics
}
# Write the differences to a new JSON file
differences_path = "./differences.json"
with open(differences_path, 'w') as file:
json.dump(differences, file, indent=4)
print(f"Differences written to {differences_path}")
```
|
```c++
//
//
// accompanying file LICENSE_1_0.txt or copy at
// path_to_url
//
#ifndef BOOST_LOCALE_UTF_HPP_INCLUDED
#define BOOST_LOCALE_UTF_HPP_INCLUDED
#include <boost/cstdint.hpp>
namespace boost {
namespace locale {
///
/// \brief Namespace that holds basic operations on UTF encoded sequences
///
/// All functions defined in this namespace do not require linking with Boost.Locale library
///
namespace utf {
/// \cond INTERNAL
#ifdef __GNUC__
# define BOOST_LOCALE_LIKELY(x) __builtin_expect((x),1)
# define BOOST_LOCALE_UNLIKELY(x) __builtin_expect((x),0)
#else
# define BOOST_LOCALE_LIKELY(x) (x)
# define BOOST_LOCALE_UNLIKELY(x) (x)
#endif
/// \endcond
///
/// \brief The integral type that can hold a Unicode code point
///
typedef uint32_t code_point;
///
/// \brief Special constant that defines illegal code point
///
static const code_point illegal = 0xFFFFFFFFu;
///
/// \brief Special constant that defines incomplete code point
///
static const code_point incomplete = 0xFFFFFFFEu;
///
/// \brief the function checks if \a v is a valid code point
///
inline bool is_valid_codepoint(code_point v)
{
if(v>0x10FFFF)
return false;
if(0xD800 <=v && v<= 0xDFFF) // surragates
return false;
return true;
}
#ifdef BOOST_LOCALE_DOXYGEN
///
/// \brief UTF Traits class - functions to convert UTF sequences to and from Unicode code points
///
template<typename CharType,int size=sizeof(CharType)>
struct utf_traits {
///
/// The type of the character
///
typedef CharType char_type;
///
/// Read one code point from the range [p,e) and return it.
///
/// - If the sequence that was read is incomplete sequence returns \ref incomplete,
/// - If illegal sequence detected returns \ref illegal
///
/// Requirements
///
/// - Iterator is valid input iterator
///
/// Postconditions
///
/// - p points to the last consumed character
///
template<typename Iterator>
static code_point decode(Iterator &p,Iterator e);
///
/// Maximal width of valid sequence in the code units:
///
/// - UTF-8 - 4
/// - UTF-16 - 2
/// - UTF-32 - 1
///
static const int max_width;
///
/// The width of specific code point in the code units.
///
/// Requirement: value is a valid Unicode code point
/// Returns value in range [1..max_width]
///
static int width(code_point value);
///
/// Get the size of the trail part of variable length encoded sequence.
///
/// Returns -1 if C is not valid lead character
///
static int trail_length(char_type c);
///
/// Returns true if c is trail code unit, always false for UTF-32
///
static bool is_trail(char_type c);
///
/// Returns true if c is lead code unit, always true of UTF-32
///
static bool is_lead(char_type c);
///
/// Convert valid Unicode code point \a value to the UTF sequence.
///
/// Requirements:
///
/// - \a value is valid code point
/// - \a out is an output iterator should be able to accept at least width(value) units
///
/// Returns the iterator past the last written code unit.
///
template<typename Iterator>
static Iterator encode(code_point value,Iterator out);
///
/// Decodes valid UTF sequence that is pointed by p into code point.
///
/// If the sequence is invalid or points to end the behavior is undefined
///
template<typename Iterator>
static code_point decode_valid(Iterator &p);
};
#else
template<typename CharType,int size=sizeof(CharType)>
struct utf_traits;
template<typename CharType>
struct utf_traits<CharType,1> {
typedef CharType char_type;
static int trail_length(char_type ci)
{
unsigned char c = ci;
if(c < 128)
return 0;
if(BOOST_LOCALE_UNLIKELY(c < 194))
return -1;
if(c < 224)
return 1;
if(c < 240)
return 2;
if(BOOST_LOCALE_LIKELY(c <=244))
return 3;
return -1;
}
static const int max_width = 4;
static int width(code_point value)
{
if(value <=0x7F) {
return 1;
}
else if(value <=0x7FF) {
return 2;
}
else if(BOOST_LOCALE_LIKELY(value <=0xFFFF)) {
return 3;
}
else {
return 4;
}
}
static bool is_trail(char_type ci)
{
unsigned char c=ci;
return (c & 0xC0)==0x80;
}
static bool is_lead(char_type ci)
{
return !is_trail(ci);
}
template<typename Iterator>
static code_point decode(Iterator &p,Iterator e)
{
if(BOOST_LOCALE_UNLIKELY(p==e))
return incomplete;
unsigned char lead = *p++;
// First byte is fully validated here
int trail_size = trail_length(lead);
if(BOOST_LOCALE_UNLIKELY(trail_size < 0))
return illegal;
//
// Ok as only ASCII may be of size = 0
// also optimize for ASCII text
//
if(trail_size == 0)
return lead;
code_point c = lead & ((1<<(6-trail_size))-1);
// Read the rest
unsigned char tmp;
switch(trail_size) {
case 3:
if(BOOST_LOCALE_UNLIKELY(p==e))
return incomplete;
tmp = *p++;
if (!is_trail(tmp))
return illegal;
c = (c << 6) | ( tmp & 0x3F);
case 2:
if(BOOST_LOCALE_UNLIKELY(p==e))
return incomplete;
tmp = *p++;
if (!is_trail(tmp))
return illegal;
c = (c << 6) | ( tmp & 0x3F);
case 1:
if(BOOST_LOCALE_UNLIKELY(p==e))
return incomplete;
tmp = *p++;
if (!is_trail(tmp))
return illegal;
c = (c << 6) | ( tmp & 0x3F);
}
// Check code point validity: no surrogates and
// valid range
if(BOOST_LOCALE_UNLIKELY(!is_valid_codepoint(c)))
return illegal;
// make sure it is the most compact representation
if(BOOST_LOCALE_UNLIKELY(width(c)!=trail_size + 1))
return illegal;
return c;
}
template<typename Iterator>
static code_point decode_valid(Iterator &p)
{
unsigned char lead = *p++;
if(lead < 192)
return lead;
int trail_size;
if(lead < 224)
trail_size = 1;
else if(BOOST_LOCALE_LIKELY(lead < 240)) // non-BMP rare
trail_size = 2;
else
trail_size = 3;
code_point c = lead & ((1<<(6-trail_size))-1);
switch(trail_size) {
case 3:
c = (c << 6) | ( static_cast<unsigned char>(*p++) & 0x3F);
case 2:
c = (c << 6) | ( static_cast<unsigned char>(*p++) & 0x3F);
case 1:
c = (c << 6) | ( static_cast<unsigned char>(*p++) & 0x3F);
}
return c;
}
template<typename Iterator>
static Iterator encode(code_point value,Iterator out)
{
if(value <= 0x7F) {
*out++ = static_cast<char_type>(value);
}
else if(value <= 0x7FF) {
*out++ = static_cast<char_type>((value >> 6) | 0xC0);
*out++ = static_cast<char_type>((value & 0x3F) | 0x80);
}
else if(BOOST_LOCALE_LIKELY(value <= 0xFFFF)) {
*out++ = static_cast<char_type>((value >> 12) | 0xE0);
*out++ = static_cast<char_type>(((value >> 6) & 0x3F) | 0x80);
*out++ = static_cast<char_type>((value & 0x3F) | 0x80);
}
else {
*out++ = static_cast<char_type>((value >> 18) | 0xF0);
*out++ = static_cast<char_type>(((value >> 12) & 0x3F) | 0x80);
*out++ = static_cast<char_type>(((value >> 6) & 0x3F) | 0x80);
*out++ = static_cast<char_type>((value & 0x3F) | 0x80);
}
return out;
}
}; // utf8
template<typename CharType>
struct utf_traits<CharType,2> {
typedef CharType char_type;
// See RFC 2781
static bool is_first_surrogate(uint16_t x)
{
return 0xD800 <=x && x<= 0xDBFF;
}
static bool is_second_surrogate(uint16_t x)
{
return 0xDC00 <=x && x<= 0xDFFF;
}
static code_point combine_surrogate(uint16_t w1,uint16_t w2)
{
return ((code_point(w1 & 0x3FF) << 10) | (w2 & 0x3FF)) + 0x10000;
}
static int trail_length(char_type c)
{
if(is_first_surrogate(c))
return 1;
if(is_second_surrogate(c))
return -1;
return 0;
}
///
/// Returns true if c is trail code unit, always false for UTF-32
///
static bool is_trail(char_type c)
{
return is_second_surrogate(c);
}
///
/// Returns true if c is lead code unit, always true of UTF-32
///
static bool is_lead(char_type c)
{
return !is_second_surrogate(c);
}
template<typename It>
static code_point decode(It ¤t,It last)
{
if(BOOST_LOCALE_UNLIKELY(current == last))
return incomplete;
uint16_t w1=*current++;
if(BOOST_LOCALE_LIKELY(w1 < 0xD800 || 0xDFFF < w1)) {
return w1;
}
if(w1 > 0xDBFF)
return illegal;
if(current==last)
return incomplete;
uint16_t w2=*current++;
if(w2 < 0xDC00 || 0xDFFF < w2)
return illegal;
return combine_surrogate(w1,w2);
}
template<typename It>
static code_point decode_valid(It ¤t)
{
uint16_t w1=*current++;
if(BOOST_LOCALE_LIKELY(w1 < 0xD800 || 0xDFFF < w1)) {
return w1;
}
uint16_t w2=*current++;
return combine_surrogate(w1,w2);
}
static const int max_width = 2;
static int width(code_point u)
{
return u>=0x10000 ? 2 : 1;
}
template<typename It>
static It encode(code_point u,It out)
{
if(BOOST_LOCALE_LIKELY(u<=0xFFFF)) {
*out++ = static_cast<char_type>(u);
}
else {
u -= 0x10000;
*out++ = static_cast<char_type>(0xD800 | (u>>10));
*out++ = static_cast<char_type>(0xDC00 | (u & 0x3FF));
}
return out;
}
}; // utf16;
template<typename CharType>
struct utf_traits<CharType,4> {
typedef CharType char_type;
static int trail_length(char_type c)
{
if(is_valid_codepoint(c))
return 0;
return -1;
}
static bool is_trail(char_type /*c*/)
{
return false;
}
static bool is_lead(char_type /*c*/)
{
return true;
}
template<typename It>
static code_point decode_valid(It ¤t)
{
return *current++;
}
template<typename It>
static code_point decode(It ¤t,It last)
{
if(BOOST_LOCALE_UNLIKELY(current == last))
return boost::locale::utf::incomplete;
code_point c=*current++;
if(BOOST_LOCALE_UNLIKELY(!is_valid_codepoint(c)))
return boost::locale::utf::illegal;
return c;
}
static const int max_width = 1;
static int width(code_point /*u*/)
{
return 1;
}
template<typename It>
static It encode(code_point u,It out)
{
*out++ = static_cast<char_type>(u);
return out;
}
}; // utf32
#endif
} // utf
} // locale
} // boost
#endif
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
```
|
```xml
import {ViewEngine} from "../decorators/viewEngine.js";
import {Engine} from "./Engine.js";
@ViewEngine("atpl")
export class AtplEngine extends Engine {}
```
|
Santa Lucia Airport refers to Felipe Ángeles International Airport (IATA: NLU), an air force base and site of the new airport for Mexico City after cancellation of the Texcoco airport project, Tecámac, State of Mexico, or it may refer to:
Hewanorra International Airport (IATA: UVF, ICAO: TLPL), near Vieux Fort, Saint Lucia
Joaquín de Agüero Airport (ICAO: MUSL) near Santa Lucia, Camagüey province, Cuba
Santa Lucía Airport (Chile), in Santa Lucía, Chile
|
East River Park, also called John V. Lindsay East River Park, is public park located on the Lower East Side of Manhattan, administered by the New York City Department of Parks and Recreation. Bisected by the Williamsburg Bridge, it stretches along the East River from Montgomery Street up to 12th Street on the east side of the FDR Drive. Its now-demolished amphitheater, built in 1941 just south of Grand Street, had been reconstructed and was often used for public performances. The park includes football, baseball, and soccer fields; tennis, basketball, and handball courts; a running track; and bike paths, including the East River Greenway, all of which are to be demolished. Fishing is another popular activity, for now.
The park and the surrounding neighborhood were flooded during Hurricane Sandy in 2012 prompting the city officials to consider flood mitigation plans that would alter it. In December 2019, the New York City Council voted to approve the controversial $1.45 billion East Side Coastal Resiliency project, involving the park's complete demolition and subsequent renovation, and is slated for completion in 2026. A New York Harbor Storm-Surge Barrier is also under consideration, which would also demolish and rebuild this and other parks.
History
Conceived in the early 1930s by Robert Moses, East River Park opened on July 27, 1939. Prior to this time, the East River waterfront had been an active shipping yard and later became home to many of the city's poorest immigrants.
The park became the largest open green space on the Lower East Side. Since that time, the park has been encroached upon by various developments such as the widening of the FDR Drive and the extension of South Street. Still, the park provides a respite for residents of the area, particularly in summer months when there are refreshing breezes from the river.
In 1998, through an agreement with the New York City Parks Department, the Lower East Side Ecology Center became the steward of the park. For 20 years, this local environmental nonprofit has been the park's caretaker and had its offices and education center inside the Fire Boat House, located in the park near the Williamsburg Bridge. Each year the Ecology Center led thousands of volunteers in up-keeping the park, tending to garden beds, and enhancing the park by planting hundreds of thousands of native plants and bulbs.
After the September 11, 2001 attacks, the city rebuilt the amphitheater, which had fallen into disrepair. A new soccer field was also built at this time. Companies throughout the U.S. donated materials for the reconstruction, and the project was finished in record time and dedicated to those children who lost parents in the attacks. In December 2001, East River Park was renamed after former New York City Mayor John Lindsay.
In 2008 the City Parks Foundation brought free music, dance, and theater arts programming to the amphitheater in an effort to further engage the surrounding communities in the revitalization of the park. The first performance held was a music concert by Fiery Furnaces which drew an audience of 1,500. KRS-One and Willie Colón also performed that year, drawing crowds upward of 3,000 people.
Hurricane Sandy and changes
Hurricane Sandy flooded the East River Park and the Lower East Side in 2012 prompting city officials to consider flood mitigation plans that would alter the park. In June 2013, U.S. Department of Housing and Urban Development (HUD) secretary Shaun Donovan launched Rebuild by Design, a competition which called for experts to develop solutions for neighborhoods disproportionately impacted by Hurricane Sandy. Ten of the 150 proposals were selected as finalists, and seven received a total of $930 million in federal grants. The largest grant, totaling $335 million, was given to the "Big U" proposal, a berm surrounding Lower Manhattan. One of the largest segments of the Big U was known as the East Side Coastal Resiliency project, and promised to improve the resiliency of the park and the surrounding Lower East Side neighborhood. The resulting plan, supported by local residents, elected officials, and advocacy groups, included an 8-foot berm along FDR Drive from East 23rd Street to Montgomery Street, which would decrease the severity of flooding in the surrounded area. From 2015 to 2018 city agencies continued the process of participatory design that the Big U's designers had commenced.
Starting in early 2018 the City underwent a months-long internal "value engineering review", in which they met with designers and planners to determine the feasibility of the proposal. A FOIA request for documentation of this review process revealed several obstacles to the original plan, including concerns about flooding and the location of high-voltage Con-Edison power lines. In September 2018 the office of Mayor Bill de Blasio announced that, based on the findings of the internal value engineering review, the proposed berm would be completely removed and the whole park would be raised. It was claimed that the new plan would be faster and less disruptive, moving the bulk of the construction away from residents directly alongside FDR Drive, instead placing the improvements alongside the water. The new plan was referred to by its engineers as the "Value Alternative LI-29" plan.” The review determined that this plan would be not only be more effective but also cheaper and faster, a concern that addressed the 2022 deadline associated with HUD funding (now extended to 2023).
Following their announcement, the plan had to be approved by Community Boards 3 and 6, and then the New York City Council. In July 2019, the new plan was presented to Community Board 3 by the Department of Design and Construction (DDC), following several months of public consultation with residents. The City Council typically defers to incumbent councilmembers regarding land-use decisions in their districts; in the East River Park decision, these were councilmembers Margaret Chin of District 1 and Carlina Rivera of District 2. Both secured concessions from the city. Original plans called for closing the park entirely from 2020 to 2023, but after protests from residents, the plans were modified in late 2019 to a partial five-year closure. In December 2019, the City Council voted to approve the $1.45 billion East Side Coastal Resiliency project, which would involve a complete demolition of the park and subsequent renovation that will elevate it by ; the project is slated for completion in 2025.
In early 2022, construction on the southern half of the park commenced, beginning with the demolition of athletic fields, the amphitheater, and a section of the East River Esplanade. Work is expected to last until 2026, during which time significant sections of the park will be closed.
Asbestos was found in a sub-basement structure under the amphitheater in late August 2022, and has raised concerns from activists. The city announced that it had completed asbestos abatement in October 2022, nine months after the demolition of the amphitheater.
Criticism
Critics of the current renovation plan have voiced concerns over the cost, oversight, lack of resident involvement, destruction of plants (including more than 1,000 mature trees), and animal habitats. One alternative presented by critics was a plan for storm barriers along the FDR. Community members also argue that the park closure will primarily impact low-income NYCHA residents and that, in reality, the renovation project will leave the Lower East Side especially vulnerable to storm surge during the renovation.
Supporters of the current plan include Councilwoman Rivera, other Democratic politicians, and Good Old Lower East Side (GOLES).
In February 2020, a dozen groups and 75 individuals, including members of East River Park Action, sued the city to stop the ESCR based on the grounds that the plan constitutes park alienation and requires approval from the state legislature. State Supreme Court Justice Melissa Crane ruled against opposition groups and in August 2020, the city was given approval to begin park demolition.
The demolition began in December 2021, prompting protests and court orders against the work. State Assemblymember for the district Yuh-Line Niou and incoming city councilman for the Lower East Side and the East Village Christopher Marte expressed support for the protesters.
See also
List of New York City parks
East River Esplanade
References
External links
NYC Department of Parks & Recreation info for the park
East River Park Action's website
Forgotten-NY profile of East River Park
Parks in Manhattan
East River
Robert Moses projects
Lower East Side
Manhattan Waterfront Greenway
|
Pierre Coudrin, SS.CC (1 March 1768 – 1837) was a French Catholic priest who founded the Picpus Fathers, a religious institute of the Catholic Church known for its missionary work in Hawaii, Africa, Europe, Central America and the Pacific Islands.
Life
Marie-Joseph-Pierre Coudrin was born on 1 March 1768, at Coussay-les-Bois, near Poitiers. His parents were farmers. His uncle was a parish priest in a neighboring village. Pierre spent his vacations with him during the years of his primary education, and his uncle prepared him for first communion. He completed his secondary studies in 1785 at Châtellerault, and at 17 years of age, entered the University of Poitiers.
He was only a deacon when the persecution, directed against the clergy, dispersed the students of the seminary of Poitiers, where he was being trained. Having learned that Mgr de Bonal, Bishop of Clermont, was in Paris and would confer Holy Orders upon him, he set out for that city, and on 4 March 1792, was ordained priest in the Irish Seminary just as France was becoming embroiled in the Revolution. The ordination took place secretly in the library, because the revolutionaries had seized the chapel to hold their meetings.
Vision
After ordination he returned to Coursay, but the violence of the persecution soon compelled him to go into hiding. Coudrin hid in an attic of the granary of the Chateau d'Usseau where he remained for six months. He reported that, during this time, he awoke one evening surrounded by an apparition of priests, brothers and nuns illuminated in white albs. He took the vision to be a divine calling to establish a religious institute that would become the Congregation of the Sacred Hearts of Jesus and Mary. Coudrin quickly left the granary and traveled to Poitiers to begin an underground ministry, waiting for the right moment to start his group. During October of the same year, he also labored disguised in the Diocese of Tours.
During his underground ministry in 1794, Coudrin met Henriette Aymer de Chevalerie, a young aristocrat. She and her mother had been imprisoned for a time, accused of hiding a priest. She told Coudrin of a heaven-sent vision she had while in prison calling her to service to God. Coudrin and Henriette Aymer de Chevalerie shared with each other their visions of creating a religious institute in the midst of danger for Roman Catholics in France.
Congregation of the Sacred Hearts of Jesus and Mary
Coudrin gathered around him a few companions, to whom he communicated his views to promote devotion to the Sacred Hearts of Jesus and of Mary, and who were also willing to assist him in his great work. On October 20, 1800 Henriette made her first vows with four companions. On Christmas night, 1800, Pierre solemnly made his religious vows, devoting himself entirely to the "love of the Sacred Hearts".
During the year 1805 Coudrin bought some dilapidated houses in the Rue Picpus in Paris, and there established himself with a few of his religious. A college for the training of youths and a seminary were soon started. "The Good Father", as his religious used to call him, governed his congregation with tact and prudence, and in spite of many difficulties, his work prospered. Several new monasteries and colleges were founded and opened in various towns. Pope Pius VII approved the Congregation in 1817 with the Bull Pastor Aeternus. The institute was composed of two branches of religious, one male and the other female.
In 1826, Coudrin was appointed vicar general of Gustave Maximilien Juste de Croÿ-Solre, Archbishop of Rouen. In 1829, he accompanied de Croy to Rome for the 1829 conclave.
The original members of the Congregation of the Sacred Hearts of Jesus and Mary founded new schools for poor children, seminaries to train the priesthood of their institute and parish missions throughout Europe. At the time of Coudrin's death in 1837, the Congregation of the Sacred Hearts of Jesus and Mary had 276 fathers and brothers and 1125 sisters.
In 2016, there were over 1500 in the congregation made up of priests, brothers and sisters and an increasing number of lay associate members in over 30 countries.
Veneration
Coudrin's spiritual writings were approved by theologians on 12 March 1930. He was later declared a Servant of God.
See also
Henriette Aymer de Chevalerie
Notes
External links
Official website of the Congregation of Picpus
1768 births
1837 deaths
19th-century French Roman Catholic priests
18th-century French Roman Catholic priests
French Roman Catholic missionaries
Picpus Fathers
Founders of Catholic religious communities
Roman Catholic missionaries in Hawaii
Congregation of the Sacred Hearts of Jesus and Mary
People from Vienne
Servants of God
|
```javascript
/*
* Forked from TodoMVC
* path_to_url
*
*/
/*jshint laxbreak:true */
(function (window) {
'use strict'
let htmlEscapes = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
'\'': ''',
'`': '`',
}
let escapeHtmlChar = function (chr) {
return htmlEscapes[chr]
}
let reUnescapedHtml = /[&<>"'`]/g
let reHasUnescapedHtml = new RegExp(reUnescapedHtml.source)
let escape = function (string) {
return (string && reHasUnescapedHtml.test(string))
? string.replace(reUnescapedHtml, escapeHtmlChar)
: string
}
/**
* Sets up defaults for all the Template methods such as a default template
*
* @constructor
*/
function Template () {
this.defaultTemplate
= '<li data-id="{{id}}" class="{{completed}}">'
+ '<div class="view">'
+ '<input class="toggle" type="checkbox" {{checked}}>'
+ '<label>{{title}}</label>'
+ '<button class="destroy todo-button"></button>'
+ '</div>'
+ '</li>'
}
/**
* Creates an <li> HTML string and returns it for placement in your app.
*
* NOTE: In real life you should be using a templating engine such as Mustache
* or Handlebars, however, this is a vanilla JS example.
*
* @param {object} data The object containing keys you want to find in the
* template to replace.
* @returns {string} HTML String of an <li> element
*
* @example
* view.show({
* id: 1,
* title: "Hello World",
* completed: 0,
* });
*/
Template.prototype.show = function (data) {
let i; let l
let view = ''
for (i = 0, l = data.length; i < l; i++) {
let template = this.defaultTemplate
let completed = ''
let checked = ''
if (data[i].completed) {
completed = 'completed'
checked = 'checked'
}
template = template.replace('{{id}}', data[i].id)
template = template.replace('{{title}}', escape(data[i].title))
template = template.replace('{{completed}}', completed)
template = template.replace('{{checked}}', checked)
view = view + template
}
return view
}
/**
* Displays a counter of how many to dos are left to complete
*
* @param {number} activeTodos The number of active todos.
* @returns {string} String containing the count
*/
Template.prototype.itemCounter = function (activeTodos) {
let plural = activeTodos === 1 ? '' : 's'
return `<strong>${activeTodos}</strong> item${plural} left`
}
/**
* Updates the text within the "Clear completed" button
*
* @param {[type]} completedTodos The number of completed todos.
* @returns {string} String containing the count
*/
Template.prototype.clearCompletedButton = function (completedTodos) {
if (completedTodos > 0) {
return 'Clear completed'
}
return ''
}
// Export to window
window.app = window.app || {}
window.app.Template = Template
})(window)
```
|
Kim Brooks is a university professor and administrator who currently serves as the became the President and vice-chancellor of Dalhousie University. She was previously the university's acting Provost and Vice-President Academic, as well as the Dean of the Faculty of Management at the university. Prior to this she served as the Dean of the university's Schulich School of Law and as the endowed H. Heward Stikeman Chair in Law of Taxation at the McGill University Faculty of Law.
Education
Kim Brooks received her BA from the University of Toronto, an LLB the University of British Columbia, LLM from Osgoode Hall Law School at York University. In between her law degree and LLM, she worked as a tax lawyer with the firm Stikeman Elliott. Later in her career, he earned a PhD from the University of Western Australia.
Academic career
Kim Brooks began her career as a law professor at Queen's University and the University of British Columbia. She then became a professor of law at McGill University, where she was a recipient of the 3M Teaching Fellowship. At McGill she was appointed to the H. Heward Stikeman Chair in Law of Taxation. Her research focus is on tax law, and she has also been an advocate for university community inclusiveness. Brooks served as the Dean of the Schulich School of Law at Dalhousie, before becoming Dean of the Dalhousie University's Faculty of Management. She is also a past-President of the Canadian Association of Law Teachers.
On January 1, 2023 Brooks became the acting Provost and Vice-President Academic of Dalhousie University, and on August 14, 2023, she became the President of Dalhousie University. She is the first woman and openly-queer person to hold the position at Dalhousie. Brooks has also served as co-chair of the National Association of Women and the Law, the Chair of the Women's Legal Education and Action Fund, and the managing editor of the Canadian Journal of Women and the Law.
Government work
In 2016 Brooks was brought in by the Revenue Minister of the Government of Canada to act as an independent reviewer of accused tax malfeasance of KPMG advisors and the handling of the file by the Canada Revenue Agency. Following her review, she was appointed as the vice chair of the agency's offshore advisory committee.
References
Academic staff of the Dalhousie University
Academic staff of the McGill University Faculty of Law
Osgoode Hall Law School alumni
University of Toronto alumni
Peter A. Allard School of Law alumni
Year of birth missing (living people)
Living people
Heads of universities and colleges
University of Western Australia alumni
|
```xml
<!--
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~
~ path_to_url
~
~ Unless required by applicable law or agreed to in writing, software
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-->
<dataset>
<metadata>
<column name="constraint_catalog" />
<column name="constraint_schema" />
<column name="constraint_name" />
<column name="table_catalog" />
<column name="table_schema" />
<column name="table_name" />
<column name="column_name" />
<column name="ordinal_position" />
<column name="position_in_unique_constraint" />
</metadata>
</dataset>
```
|
Telangana Fiber Grid or T-Fiber is a flagship program by Government of Telangana to provide high speed Internet across the state. It is expected to be completed by end of 2019. The project will help connect 23 million people with government to government, government to citizens services and the range of other applications.
History
It started in 2017 with pilot project started in Maheshwaram Mandal in Rangareddy district by IT minister, K. T. Rama Rao. It provides internet access to improve health and education by bringing telemedicine and educational opportunities to more people in rural areas.
The project
The project is accomplished by laying 62,000 miles of fiber optic cable in more than 22,000 villages. The fiber optic line along with drinking water project, Mission Bhagiratha. The large black pipe is for water and a blue pipe has fiber optic cable.
References
External links
Government of Telangana
Fiber optics
E-government in India
|
```haskell
module T7312 where
-- this works
mac :: Double -> (Double->Double) -> (Double-> Double)
mac ac m = \ x -> ac + x * m x
-- this doesn't
mac2 :: Double -> (->) Double Double -> (->) Double Double
mac2 ac m = \ x -> ac + x * m x
```
|
Tornike Grigalashvili (; born 28 January 1993) is a Georgian football player, currently playing for Dila Gori.
Club career
Grigalashvili began his career in Zestafoni. He spent a single season in Germany as well, playing for Schwarz-Weiß Rehden.
International
Grigalashvili made his debut for the Georgia national football team on 25 January 2017 in a friendly against Jordan.
External links
References
1993 births
Living people
Men's footballers from Georgia (country)
Georgia (country) men's international footballers
Men's association football defenders
FC Zestafoni players
FC Dila Gori players
Erovnuli Liga players
Footballers from Kutaisi
|
```xml
<?xml version="1.0" ?><!DOCTYPE TS><TS version="2.1" language="fa_IR">
<context>
<name>about_ui_tr</name>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="294"/>
<source>About Persepolis</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="237"/>
<source>Persepolis Download Manager</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="240"/>
<source><a href=path_to_url
<comment>TRANSLATORS NOTE: YOU REALLY DON'T NEED TO TRANSLATE THIS PART!</comment>
<translation>path_to_url
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="244"/>
<source><a href=path_to_url
<comment>TRANSLATORS NOTE: YOU REALLY DON'T NEED TO TRANSLATE THIS PART!</comment>
<translation>path_to_url
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="248"/>
<source><a href=path_to_url
<comment>TRANSLATORS NOTE: YOU REALLY DON'T NEED TO TRANSLATE THIS PART!</comment>
<translation>path_to_url
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="295"/>
<source>Developers</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="298"/>
<source>Translators</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="299"/>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="302"/>
<source>OK</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="259"/>
<source>Special thanks to:</source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="255"/>
<source>
AliReza AmirSamimi
Mohammadreza Abdollahzadeh
Sadegh Alirezaie
Mostafa Asadi
Jafar Akhondali
Kia Hamedi
H.Rostami
Ehsan Titish
MohammadAmin Vahedinia</source>
<comment>TRANSLATORS NOTE: YOU REALLY DON'T NEED TO TRANSLATE THIS PART!</comment>
<translation>
.
</translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="264"/>
<source>Acknowledgments:</source>
<translation>:</translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="266"/>
<source><a href=path_to_url project</a></source>
<translation><a href=path_to_url project</a></translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="268"/>
<source><a href=path_to_url project</a></source>
<translation><a href=path_to_url project</a></translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="270"/>
<source><a href=path_to_url project</a></source>
<translation><a href=path_to_url project</a></translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="274"/>
<source><a href=path_to_url project</a></source>
<translation><a href=path_to_url project</a></translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="296"/>
<source>Acknowledgments</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="272"/>
<source><a href=path_to_url to http proxy project</a></source>
<translation><a href=path_to_url socks http </a></translation>
</message>
<message>
<location filename="../../persepolis/gui/about_ui.py" line="238"/>
<source>Version 4.3.0</source>
<comment>TRANSLATORS NOTE: YOU REALLY DON'T NEED TO TRANSLATE THIS PART!</comment>
<translation> ..</translation>
</message>
</context>
<context>
<name>addlink_ui_tr</name>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="429"/>
<source>Add to category: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="469"/>
<source>Proxy</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="436"/>
<source>IP: </source>
<translation>:</translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="438"/>
<source>Port:</source>
<translation> : </translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="448"/>
<source>Change Download Folder</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="450"/>
<source>Download Folder: </source>
<translation> : </translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="461"/>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="462"/>
<source>OK</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="466"/>
<source>Link</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="472"/>
<source>More Options</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="475"/>
<source>Advanced Options</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="478"/>
<source>Referrer: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="480"/>
<source>Header: </source>
<translation>: </translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="482"/>
<source>Load cookies: </source>
<translation>:</translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="484"/>
<source>User agent: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="425"/>
<source>Add Download Link</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="427"/>
<source>Download link: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="431"/>
<source>Change file name: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="433"/>
<source>Detect System Proxy Settings</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="435"/>
<source>Proxy password: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="437"/>
<source>Proxy username: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="444"/>
<source>Download username and password</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="445"/>
<source>Download username: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="446"/>
<source>Download password: </source>
<translation> : </translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="314"/>
<source>Remember this path</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="452"/>
<source>Start time</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="453"/>
<source>End time</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="455"/>
<source>Limit speed</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="459"/>
<source>Number of connections:</source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/addlink_ui.py" line="464"/>
<source>Download Later</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="305"/>
<source>HTTP</source>
<translation>HTTP</translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="306"/>
<source>HTTPS</source>
<translation>HTTPS</translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="307"/>
<source>SOCKS5</source>
<translation>SOCKS5</translation>
</message>
</context>
<context>
<name>after_download_src_ui_tr</name>
<message>
<location filename="../../persepolis/scripts/after_download.py" line="68"/>
<source><b>File name</b>: </source>
<translation><b> </b>: </translation>
</message>
<message>
<location filename="../../persepolis/scripts/after_download.py" line="76"/>
<source><b>Size</b>: </source>
<translation><b> </b>:</translation>
</message>
</context>
<context>
<name>after_download_ui_tr</name>
<message>
<location filename="../../persepolis/gui/after_download_ui.py" line="53"/>
<source>Persepolis Download Manager</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/after_download_ui.py" line="113"/>
<source> Open File </source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/after_download_ui.py" line="114"/>
<source>Open Download Folder</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/after_download_ui.py" line="115"/>
<source> OK </source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/after_download_ui.py" line="116"/>
<source>Don't show this message again.</source>
<translation> .</translation>
</message>
<message>
<location filename="../../persepolis/gui/after_download_ui.py" line="118"/>
<source><b>Download Completed!</b></source>
<translation><b> </b></translation>
</message>
<message>
<location filename="../../persepolis/gui/after_download_ui.py" line="119"/>
<source><b>Save as</b>: </source>
<translation><b> </b>:</translation>
</message>
<message>
<location filename="../../persepolis/gui/after_download_ui.py" line="120"/>
<source><b>Link</b>: </source>
<translation><b></b>:</translation>
</message>
</context>
<context>
<name>log_window_ui_tr</name>
<message>
<location filename="../../persepolis/gui/log_window_ui.py" line="98"/>
<source>Persepolis Log</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/log_window_ui.py" line="101"/>
<source>Report Issue</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/log_window_ui.py" line="99"/>
<source>Close</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/log_window_ui.py" line="100"/>
<source>Copy Selected to Clipboard</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/log_window_ui.py" line="102"/>
<source>Refresh Log Messages</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/log_window_ui.py" line="103"/>
<source>Clear Log Messages</source>
<translation> </translation>
</message>
</context>
<context>
<name>mainwindow_src_ui_tr</name>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1071"/>
<source>Persepolis</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1030"/>
<source>Queue Stopped!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2240"/>
<source>Persepolis is shutting down</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2240"/>
<source>your system in 20 seconds</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1071"/>
<source>Queue completed!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3397"/>
<source>Show main Window</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1354"/>
<source>Please Wait...</source>
<translation> ...</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1732"/>
<source>Ready...</source>
<translation>...</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1745"/>
<source>Aria2 didn't respond! be patient! Persepolis tries again in 2 seconds!</source>
<translation> ! ! .</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1772"/>
<source>Error...</source>
<translation>...</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1773"/>
<source>Persepolis can not connect to Aria2</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1753"/>
<source>Check your network & Restart Persepolis</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1773"/>
<source>Restart Persepolis</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1779"/>
<source>Reconnecting Aria2...</source>
<translation> ... </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1797"/>
<source>Persepolis reconnected aria2 successfully</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1979"/>
<source>Error: </source>
<translation>:</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2076"/>
<source><b>Link</b>: </source>
<translation><b></b>:</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2090"/>
<source><b>Downloaded</b>: </source>
<translation><b> :</b></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2098"/>
<source><b>Transfer rate</b>: </source>
<translation><b>:</b></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2104"/>
<source><b>Estimated time left</b>: </source>
<translation><b> :</b></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2110"/>
<source><b>Connections</b>: </source>
<translation><b> </b></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2130"/>
<source><b>Status</b>: </source>
<translation><b>:</b></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2183"/>
<source>Download Stopped</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2204"/>
<source>Error - </source>
<translation> - </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2259"/>
<source>Download Complete</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2734"/>
<source><b><center>This link has been added before! Are you sure you want to add it again?</center></b></source>
<translation><b><center> ! </center></b></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="5974"/>
<source>Download Starts</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2846"/>
<source>Download Scheduled</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="6157"/>
<source>Operation was not successful.</source>
<translation> .</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="6157"/>
<source>Please resume the following category: </source>
<translation> : </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3047"/>
<source>Aria2 disconnected!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3008"/>
<source>Persepolis is trying to connect!be patient!</source>
<translation> ! !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3052"/>
<source>Aria2 did not respond!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2901"/>
<source>Try again!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2954"/>
<source>Aria2 did not respond</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2954"/>
<source>Try again</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3027"/>
<source>Please stop the following category: </source>
<translation> : </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3047"/>
<source>Persepolis is trying to connect! be patient!</source>
<translation> ! !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3052"/>
<source>Please try again.</source>
<translation> .</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3408"/>
<source>Minimize to system tray</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3868"/>
<source>Not Found</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3815"/>
<source>Operation was not successful!</source>
<translation> .</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3604"/>
<source>Operation was not successful! Please stop the following category first: </source>
<translation> ! : </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3655"/>
<source>Please stop the following download first: </source>
<translation> : </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3715"/>
<source><b><center>This operation will delete downloaded files from your hard disk<br>PERMANENTLY!</center></b></source>
<translation><b><center> <br> </b> </center></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="4925"/>
<source><center>Do you want to continue?</center></source>
<translation><center> </center></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3765"/>
<source>Please stop the following category first: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="4388"/>
<source></b>" already exists!</source>
<translation></b> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="4770"/>
<source>Send selected downloads to</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="4773"/>
<source>Send to</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="4899"/>
<source>Sort by</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="4922"/>
<source><b><center>This operation will remove all download items in this queue<br>from "All Downloads" list!</center></b></source>
<translation><b><center> </center></b></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="4947"/>
<source><b>Sorry! You can't remove default queue!</b></source>
<translation><b> !</b></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="5168"/>
<source>Some items didn't transferred successfully!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="5168"/>
<source>Please stop download progress first.</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="5198"/>
<source>Hide options</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="5202"/>
<source>Show options</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="5788"/>
<source>Stop all downloads first!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1266"/>
<source>Moving is</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1266"/>
<source>finished!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3787"/>
<source>Download is in progress by video finder!</source>
<translation> .</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3787"/>
<source>be patient!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="3815"/>
<source>Stop the following download first: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="5836"/>
<source>ffmpeg is not installed!</source>
<translation>ffmpeg !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="6130"/>
<source>Not enough free space in:</source>
<translation> : </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="6136"/>
<source>muxing error</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="6136"/>
<source>an error occurred</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1830"/>
<source>Please update Persepolis.</source>
<translation> .</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="1979"/>
<source>There is not enough disk space available at the download folder! Please choose another one or clear some space.</source>
<translation> ! .</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="5831"/>
<source>yt-dlp is not installed!</source>
<translation>yt-dlp !</translation>
</message>
</context>
<context>
<name>mainwindow_ui_tr</name>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="67"/>
<source>File</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="68"/>
<source>Edit</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="69"/>
<source>View</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="70"/>
<source>Download</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="71"/>
<source>Queue</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="72"/>
<source>Video Finder</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="732"/>
<source>Help</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="474"/>
<source>Sort by</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="479"/>
<source>Persepolis Download Manager</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="411"/>
<source>Category</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="512"/>
<source>File Name</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="410"/>
<source>Status</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="410"/>
<source>Size</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="410"/>
<source>Downloaded</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="410"/>
<source>Percentage</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="410"/>
<source>Connections</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="411"/>
<source>Link</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="465"/>
<source>&File</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="466"/>
<source>&Edit</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="467"/>
<source>&View</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="468"/>
<source>&Download</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="469"/>
<source>&Queue</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="471"/>
<source>&Help</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="537"/>
<source>Show/Hide system tray icon</source>
<translation>/ </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="563"/>
<source>Add New Download Link</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="586"/>
<source>Resume Download</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="592"/>
<source>Pause Download</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="598"/>
<source>Stop Download</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="598"/>
<source>Stop/Cancel Download</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="604"/>
<source>Properties</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="610"/>
<source>Progress</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="633"/>
<source>Exit</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="641"/>
<source>Clear all items in download list</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="673"/>
<source>Create new download queue</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="678"/>
<source>Remove this queue</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="683"/>
<source>Start this queue</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="689"/>
<source>Stop this queue</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="695"/>
<source>Move currently selected items up by one row</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="704"/>
<source>Move currently selected items down by one row</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="712"/>
<source>Preferences</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="717"/>
<source>About</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="722"/>
<source>Report an issue</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="745"/>
<source>Start Time</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="747"/>
<source>End Time</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="749"/>
<source>Download bottom of
the list first</source>
<translation>
</translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="752"/>
<source>Limit Speed</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="765"/>
<source>Apply</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="757"/>
<source>After download</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="758"/>
<source>Shut Down</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="470"/>
<source>V&ideo Finder</source>
<translation>& </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2542"/>
<source><b>Video file status: </b></source>
<translation><b> </b></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2523"/>
<source><b>Audio file status: </b></source>
<translation><b> : </b>,</translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2598"/>
<source><b>Status: </b></source>
<translation><b>: </b></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2601"/>
<source><b>Muxing status: </b></source>
<translation><b> : </b></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2542"/>
<source> downloaded</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2557"/>
<source>Active</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2587"/>
<source>Not Active</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2577"/>
<source>Started</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2580"/>
<source>Error</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2583"/>
<source>Complete</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="411"/>
<source>Transfer Rate</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="411"/>
<source>Estimated Time Left</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="522"/>
<source>First Try Date</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="527"/>
<source>Last Try Date</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="498"/>
<source>Find Video Links...</source>
<translation> ...</translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="498"/>
<source>Download video or audio from Youtube, Vimeo, etc.</source>
<translation> ...</translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="507"/>
<source>Stop All Active Downloads</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="517"/>
<source>File Size</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="532"/>
<source>Download Status</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="537"/>
<source>Show System Tray Icon</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="543"/>
<source>Show Menubar</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="549"/>
<source>Show Side Panel</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="555"/>
<source>Minimize to System Tray</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="563"/>
<source>Add New Download Link...</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="571"/>
<source>Import Links from Text File...</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="571"/>
<source>Create a text file and put links in it, line by line!</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="616"/>
<source>Open File...</source>
<translation> ...</translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="621"/>
<source>Open Download Folder</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="627"/>
<source>Open Default Download Folder</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="641"/>
<source>Clear Download List</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="646"/>
<source>Remove Selected Downloads from List</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="656"/>
<source>Delete Selected Download Files</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="666"/>
<source>Move Selected Download Files to Another Folder...</source>
<translation> ...</translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="666"/>
<source>Move Selected Download Files to Another Folder</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="673"/>
<source>Create New Queue...</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="678"/>
<source>Remove Queue</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="683"/>
<source>Start Queue</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="689"/>
<source>Stop Queue</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="695"/>
<source>Move Selected Items Up</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="704"/>
<source>Move Selected Items Down</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="722"/>
<source>Report an Issue</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="727"/>
<source>Show Log File</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="744"/>
<source>Hide Options</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="760"/>
<source>Keep System Awake!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="761"/>
<source><html><head/><body><p>This option will prevent the system from going to sleep. It is necessary if your power manager is suspending the system automatically. </p></body></html></source>
<translation><html><head/><body><p>
.</p></body></html></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="767"/>
<source>Start Mixing</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="769"/>
<source><b>Video File Status: </b></source>
<translation><b> </b></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="770"/>
<source><b>Audio File Status: </b></source>
<translation><b> : </b>,</translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="773"/>
<source><b>Mixing status: </b></source>
<translation><b> : </b></translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="580"/>
<source>Import Links from Clipboard...</source>
<translation> ...</translation>
</message>
<message>
<location filename="../../persepolis/gui/mainwindow_ui.py" line="580"/>
<source>Import Links From Clipboard</source>
<translation> </translation>
</message>
</context>
<context>
<name>progress_src_ui_tr</name>
<message>
<location filename="../../persepolis/scripts/progress.py" line="169"/>
<source>Aria2 disconnected!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/progress.py" line="169"/>
<source>Persepolis is trying to connect! be patient!</source>
<translation> ! !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/progress.py" line="150"/>
<source>Aria2 did not respond!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/progress.py" line="131"/>
<source>Please try again.</source>
<translation> .</translation>
</message>
<message>
<location filename="../../persepolis/scripts/progress.py" line="150"/>
<source>Try again!</source>
<translation> !</translation>
</message>
</context>
<context>
<name>progress_ui_tr</name>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="56"/>
<source>Persepolis Download Manager</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="207"/>
<source>Status: </source>
<translation>:</translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="208"/>
<source>Downloaded:</source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="209"/>
<source>Transfer rate: </source>
<translation>:</translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="210"/>
<source>Estimated time left:</source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="211"/>
<source>Number of connections: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="212"/>
<source>Download Information</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="215"/>
<source>After download</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="227"/>
<source>Apply</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="220"/>
<source>Shut Down</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="222"/>
<source>Download Options</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="224"/>
<source>Resume</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="225"/>
<source>Pause</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="226"/>
<source>Stop</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="206"/>
<source>Link: </source>
<translation>:</translation>
</message>
<message>
<location filename="../../persepolis/gui/progress_ui.py" line="214"/>
<source>Limit speed</source>
<translation> </translation>
</message>
</context>
<context>
<name>setting_src_ui_tr</name>
<message>
<location filename="../../persepolis/scripts/setting.py" line="1196"/>
<source><b><center>Restart Persepolis Please!</center></b><br><center>Some changes take effect after restarting Persepolis</center></source>
<translation><b><center> !</center></b><br><center> </center></translation>
</message>
<message>
<location filename="../../persepolis/scripts/setting.py" line="1198"/>
<source>Restart Persepolis!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/scripts/setting.py" line="455"/>
<source><b><center>This shortcut has been used before! Use another one!</center></b></source>
<translation><b><center> ! !</center></b></translation>
</message>
</context>
<context>
<name>setting_ui_tr</name>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="673"/>
<source>Preferences</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="559"/>
<source><html><head/><body><p>Set number of tries if download failed.</p></body></html></source>
<translation><html><head/><body><p> </p></body></html></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="558"/>
<source>Number of tries: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="565"/>
<source><html><head/><body><p>Set the seconds to wait between retries. Download manager will retry downloads when the HTTP server returns a 503 response.</p></body></html></source>
<translation><html><head/><body><p> </p></body></html></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="571"/>
<source><html><head/><body><p>Set timeout in seconds. </p></body></html></source>
<translation><html><head/><body><p> . </p></body></html></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="570"/>
<source>Timeout (seconds): </source>
<translation> ():</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="577"/>
<source><html><head/><body><p>Using multiple connections can help speed up your download.</p></body></html></source>
<translation><html><head/><body><p> ..</p></body></html></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="576"/>
<source>Number of connections: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="580"/>
<source>RPC port number: </source>
<translation> RPC: </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="581"/>
<source><html><head/><body><p> Specify a port number for JSON-RPC/XML-RPC server to listen to. Possible Values: 1024 - 65535 Default: 6801 </p></body></html></source>
<translation><html><head/><body><p> JSON-RPC/XML-RPC. : </p></body></html></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="595"/>
<source>Change Aria2 default path</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="607"/>
<source>Change</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="603"/>
<source>Download Options</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="618"/>
<source>Volume: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="620"/>
<source>Notifications</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="623"/>
<source>Style: </source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="624"/>
<source>Color scheme: </source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="625"/>
<source>Icons: </source>
<translation>:</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="629"/>
<source>Notification type: </source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="631"/>
<source>Font: </source>
<translation>:</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="632"/>
<source>Size: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="653"/>
<source>Run Persepolis at startup</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="655"/>
<source>Keep system awake!</source>
<translation> !</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="670"/>
<source><html><head/><body><p>Format HH:MM</p></body></html></source>
<translation><html><head/><body><p> :</p></body></html></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="678"/>
<source>File Name</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/video_finder_progress_ui.py" line="61"/>
<source>Status</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="680"/>
<source>Size</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="681"/>
<source>Downloaded</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="682"/>
<source>Percentage</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="683"/>
<source>Connections</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="688"/>
<source>Category</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="694"/>
<source>Video Finder Options</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="697"/>
<source>Maximum number of links to capture:<br/><small>(If browser sends multiple video links at a time)</small></source>
<translation> :<br/><small> ( )</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="701"/>
<source>Defaults</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="702"/>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="703"/>
<source>OK</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="80"/>
<source>Press new keys</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="497"/>
<source>Action</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="498"/>
<source>Shortcut</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="504"/>
<source>Shortcuts</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="507"/>
<source>Quit</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="634"/>
<source>Hide main window if close button clicked.</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="636"/>
<source><html><head/><body><p>This feature may not work in your operating system.</p></body></html></source>
<translation><html><head/><body><p> .</p></body></html></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="318"/>
<source>Language: </source>
<translation>:</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="508"/>
<source>Minimize to System Tray</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="509"/>
<source>Remove Download Items</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="510"/>
<source>Delete Download Items</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="511"/>
<source>Move Selected Items Up</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="512"/>
<source>Move Selected Items Down</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="513"/>
<source>Add New Download Link</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="514"/>
<source>Add New Video Link</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="515"/>
<source>Import Links from Text File</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="564"/>
<source>Wait period between retries (seconds): </source>
<translation> ( ):</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="584"/>
<source>Wait period between each download in queue:</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="587"/>
<source>Don't use certificate to verify the peers</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="588"/>
<source><html><head/><body><p>This option avoids SSL/TLS handshake failure. But use it at your own risk!</p></body></html></source>
<translation><html><head/><body><p> SSL/TLS </p></body></html></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="597"/>
<source><html><head/><body><p>Attention: Wrong path may cause problems! Do it carefully or don't change default setting!</p></body></html></source>
<translation><html><head/><body><p> : ! !</p></body></html></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="606"/>
<source>Download folder: </source>
<translation> : </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="609"/>
<source>Create subfolders for Music,Videos, ... in default download folder</source>
<translation> ... </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="612"/>
<source>Save As</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="615"/>
<source>Enable Notification Sounds</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="627"/>
<source>Toolbar icons size: </source>
<translation> : </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="639"/>
<source>If browser is opened, start Persepolis in system tray</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="642"/>
<source>Enable system tray icon</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="645"/>
<source>Show download complete dialog when download is finished</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="648"/>
<source>Show menubar</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="649"/>
<source>Show side panel</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="650"/>
<source>Show download progress window</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="656"/>
<source><html><head/><body><p>This option will prevent the system from going to sleep. It is necessary if your power manager is suspending the system automatically. </p></body></html></source>
<translation><html><head/><body><p>
.</p></body></html></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="677"/>
<source>Show these columns:</source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="684"/>
<source>Transfer Rate</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="685"/>
<source>Estimated Time Left</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="686"/>
<source>First Try Date</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="687"/>
<source>Last Try Date</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="690"/>
<source>Columns Customization</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="591"/>
<source>Remote time</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="592"/>
<source><html><head/><body><p>Retrieve timestamp of the remote file from the remote HTTP/FTP server and if it is available, apply it to the local file.</p></body></html></source>
<translation><html><head/><body><p> HTTP/FTP .</p></body></html></translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="660"/>
<source>Check system clipboard for copied links</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="661"/>
<source><html><head/><body><p>The program will automatically check the clipboard for copied links. </p></body></html></source>
<translation><html><head/><body><p> .</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="665"/>
<source>Download requests from the browser will be executed immediately.</source>
<translation> .</translation>
</message>
<message>
<location filename="../../persepolis/gui/setting_ui.py" line="666"/>
<source><html><head/><body><p>When a download request is sent from the browser extension, the download will start without showing the Add Link window. </p></body></html></source>
<translation><html><head/><body><p> Add Link .</p></body></html></translation>
</message>
</context>
<context>
<name>text_ui_tr</name>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="287"/>
<source>Persepolis Download Manager</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="289"/>
<source>Links</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="294"/>
<source>Select All</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="295"/>
<source>Deselect All</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="297"/>
<source>Add to queue: </source>
<translation> : </translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="299"/>
<source>Proxy</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="301"/>
<source>IP:</source>
<translation>:</translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="303"/>
<source>Port:</source>
<translation>:</translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="313"/>
<source>Change Download Folder</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="321"/>
<source>OK</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="322"/>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="291"/>
<source>Download Options</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="300"/>
<source>Proxy password: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="302"/>
<source>Proxy username: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="309"/>
<source>Download username and password</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="310"/>
<source>Download username: </source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="311"/>
<source>Download password: </source>
<translation> : </translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="315"/>
<source>Download folder: </source>
<translation> : </translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="317"/>
<source>Limit speed</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/gui/text_queue_ui.py" line="319"/>
<source>Number of connections:</source>
<translation> :</translation>
</message>
</context>
<context>
<name>video_finder_progress_ui_tr</name>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2043"/>
<source><b>Video file status: </b></source>
<translation><b> : </b></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2057"/>
<source><b>Audio file status: </b></source>
<translation><b> : </b></translation>
</message>
<message>
<location filename="../../persepolis/scripts/mainwindow.py" line="2067"/>
<source><b>Muxing status: </b></source>
<translation><b> : </b></translation>
</message>
<message>
<location filename="../../persepolis/gui/video_finder_progress_ui.py" line="58"/>
<source><b>Mixing status: </b></source>
<translation><b> : </b></translation>
</message>
</context>
<context>
<name>ytaddlink_src_ui_tr</name>
<message>
<location filename="../../persepolis/scripts/video_finder_addlink.py" line="172"/>
<source>Video Finder</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/video_finder_addlink.py" line="247"/>
<source>Fetch Media List</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/video_finder_addlink.py" line="248"/>
<source>Select a format</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/video_finder_addlink.py" line="333"/>
<source>Please enter a valid video link</source>
<translation> </translation>
</message>
<message>
<location filename="../../persepolis/scripts/video_finder_addlink.py" line="354"/>
<source>Fetching Media Info...</source>
<translation> ...</translation>
</message>
<message>
<location filename="../../persepolis/scripts/video_finder_addlink.py" line="250"/>
<source>Video format:</source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/scripts/video_finder_addlink.py" line="251"/>
<source>Audio format:</source>
<translation> :</translation>
</message>
<message>
<location filename="../../persepolis/scripts/video_finder_addlink.py" line="253"/>
<source>Advanced options</source>
<translation> </translation>
</message>
</context>
</TS>
```
|
See Sigeberht II of Essex for the Saxon ruler by that name.
Sigebert II (601–613) or Sigisbert II, was the illegitimate son of Theuderic II, from whom he inherited the kingdoms of Burgundy and Austrasia in 613. However, he fell under the influence of his great-grandmother, Brunhilda. Warnachar, mayor of the palace of Austrasia had Sigebert brought before a national assembly, where he was proclaimed king by the nobles over both his father's kingdoms. However, when the kingdom was invaded by Clotaire II of Neustria, Warnachar and Rado, mayor of the palace of Burgundy, betrayed Sigebert and Brunhilda and joined with Clotaire, recognising Clotaire as rightful regent and guardian of Sigebert and ordering the army not to oppose the Neustrians. Brunhilda and Sigebert met Clotaire's army on the Aisne, but the Patrician Aletheus, Duke Rocco, and Duke Sigvald deserted her host and Brunhilda and Sigebert were forced to flee, before being taken by Clotaire's men at Lake Neuchâtel. Brunhilda, little Sigebert and Sigebert's younger brother Corbo were executed by Clotaire's orders, and Austrasia and Neustria were reunited under Clotaire's rule, who now ruled the entire kingdom of the Franks.
References
Merovingian kings
601 births
613 deaths
Monarchs who died as children
Medieval child monarchs
7th-century murdered monarchs
7th-century Frankish kings
|
```go
/*
path_to_url
Unless required by applicable law or agreed to in writing, software
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1
import (
rest "k8s.io/client-go/rest"
)
// TokenReviewsGetter has a method to return a TokenReviewInterface.
// A group's client should implement this interface.
type TokenReviewsGetter interface {
TokenReviews() TokenReviewInterface
}
// TokenReviewInterface has methods to work with TokenReview resources.
type TokenReviewInterface interface {
TokenReviewExpansion
}
// tokenReviews implements TokenReviewInterface
type tokenReviews struct {
client rest.Interface
}
// newTokenReviews returns a TokenReviews
func newTokenReviews(c *AuthenticationV1Client) *tokenReviews {
return &tokenReviews{
client: c.RESTClient(),
}
}
```
|
```php
<?php
namespace MathPHP\Tests\SetTheory;
use MathPHP\SetTheory\Set;
use MathPHP\LinearAlgebra\Vector;
use MathPHP\LinearAlgebra\NumericMatrix;
class SetOperationsTest extends \PHPUnit\Framework\TestCase
{
/**
* @test
* @dataProvider dataProviderForAdd
*/
public function testAdd(array $A, $x, array $R)
{
// Given
$setA = new Set($A);
$setR = new Set($R);
// When
$setA->add($x);
// Then
$this->assertEquals($setR, $setA);
$this->assertEquals($setR->asArray(), $setA->asArray());
}
/**
* @test
* @dataProvider dataProviderForAdd
*/
public function testAddTwiceDoesNothing(array $A, $x, array $R)
{
// Given
$setA = new Set($A);
$setR = new Set($R);
// When
$setA->add($x);
$setA->add($x);
// Then
$this->assertEquals($setR, $setA);
}
public function dataProviderForAdd(): array
{
$vector = new Vector([1, 2, 3]);
return [
[
[],
null,
[null],
],
[
[],
new Set(),
['' => new Set()],
],
[
[],
1,
[1 => 1],
],
[
[1, 2, 3],
4,
[1, 2, 3, 4],
],
[
[1, 2, 3],
1,
[1, 2, 3],
],
[
[1, 2, 3],
'new',
[1, 2, 3, 'new'],
],
[
[1, 2, 3],
3.1,
[1, 2, 3, 3.1],
],
[
[1, 2, 3],
new Set(),
[1, 2, 3, ''],
],
[
[1, 2, 3],
new Set([4, 5]),
[1, 2, 3, 'Set{4, 5}'],
],
[
[1, 2, 3],
new Set([1, 2]),
[1, 2, 3, 'Set{1, 2}'],
],
[
[1, 2, 3],
-3,
[1, 2, 3, -3],
],
[
[1, 2, 3],
$vector,
[1, 2, 3, $vector],
],
];
}
/**
* When adding objects to a set, the key becomes to the objects hash.
* The object is stored as is as the value.
*/
public function testAddWithObjects()
{
// Given
$set = new Set([1, 2, 3]);
$vector = new Vector([1, 2, 3]);
$matrix = new NumericMatrix([[1,2,3],[2,3,4]]);
// When
$set->add($vector);
$set->add($matrix);
// Then
$this->assertEquals(5, count($set));
$this->assertEquals(5, count($set->asArray()));
$objects = 0;
foreach ($set as $key => $value) {
if ($value instanceof \MathPHP\LinearAlgebra\Vector) {
$objects++;
$vector_key = \get_class($value) . '(' . spl_object_hash($vector) . ')';
$this->assertEquals($vector_key, $key);
$this->assertEquals($vector, $value);
}
if ($value instanceof \MathPHP\LinearAlgebra\NumericMatrix) {
$objects++;
$matrix_key = \get_class($value) . '(' . spl_object_hash($matrix) . ')';
$this->assertEquals($matrix_key, $key);
$this->assertEquals($matrix, $value);
}
}
// There should have been two objects (vector and matrix)
$this->assertEquals(2, $objects);
}
public function testAddWithMultipleObjects()
{
// Given
$set = new Set([1, 2, 3]);
$vector1 = new Vector([1, 2, 3]);
$vector2 = new Vector([1, 2, 3]);
$vector3 = new Vector([4, 5, 6]);
$matrix = new NumericMatrix([[1,2,3],[2,3,4]]);
$std1 = new \StdClass();
$std2 = new \StdClass();
$std3 = $std2; // Same object so this wont get added
// When
$set->add($vector1);
$set->add($vector2);
$set->add($vector3);
$set->add($matrix);
$set->add($std1);
$set->add($std2);
$set->add($std3);
// Then
$this->assertEquals(9, count($set));
$this->assertEquals(9, count($set->asArray()));
$objects = 0;
foreach ($set as $key => $value) {
if ($value instanceof \MathPHP\LinearAlgebra\Vector) {
$objects++;
$this->assertInstanceOf(\MathPHP\LinearAlgebra\Vector::class, $value);
}
if ($value instanceof \MathPHP\LinearAlgebra\NumericMatrix) {
$objects++;
$this->assertInstanceOf(\MathPHP\LinearAlgebra\NumericMatrix::class, $value);
}
if ($value instanceof \StdClass) {
$objects++;
$this->assertInstanceOf(\StdClass::class, $value);
}
}
// There should have been four objects (3 vectors and 1 matrix)
$this->assertEquals(6, $objects);
}
public function testAddWithDuplicateObjects()
{
// Given
$set = new Set([1, 2, 3]);
$vector = new Vector([1, 2, 3]);
// When adding the same object twice.
$set->add($vector);
$set->add($vector);
// Then
$this->assertEquals(4, count($set));
$this->assertEquals(4, count($set->asArray()));
$objects = 0;
foreach ($set as $key => $value) {
if ($value instanceof \MathPHP\LinearAlgebra\Vector) {
$objects++;
$vector_key = \get_class($value) . '(' . spl_object_hash($vector) . ')';
$this->assertEquals($vector_key, $key);
$this->assertEquals($vector, $value);
}
}
// There should have only been one vector object.
$this->assertEquals(1, $objects);
}
/**
* In this case, we add an array that contains arrays.
* So each array element will be added, but with the implementation
* detail that they will be converted into ArrayObjects.
*/
public function testAddMultiWithArrayOfArrays()
{
// Given
$set = new Set([1, 2, 3]);
$array = [4, 5, [1, 2, 3]];
// When
$set->addMulti($array);
// Then
$this->assertEquals(6, count($set));
$this->assertEquals(6, count($set->asArray()));
$arrays = 0;
foreach ($set as $key => $value) {
if (\is_array($value)) {
$arrays++;
$this->assertEquals([1, 2, 3], $value);
$this->assertEquals(3, count($value));
$this->assertEquals(1, $value[0]);
$this->assertEquals(1, $value[0]);
$this->assertEquals(1, $value[0]);
}
}
// There should have only been one array.
$this->assertEquals(1, $arrays);
}
/**
* In this case, we add an array that contains arrays.
* So each array element will be added, but with the implementation
* detail that they will be converted into ArrayObjects.
*/
public function testAddMultiWithArrayOfArraysMultipleArraysAndDuplicates()
{
// Given
$set = new Set([1, 2, 3]);
$array = [4, 5, [1, 2, 3], [1, 2, 3], [5, 5, 5]];
// When
$set->addMulti($array);
// Then, only 7, because [1, 2, 3] was in there twice.
$this->assertEquals(7, count($set));
$this->assertEquals(7, count($set->asArray()));
$arrays = 0;
foreach ($set as $key => $value) {
if (\is_array($value)) {
$arrays++;
$this->assertEquals(3, count($value));
}
}
// There should have been 2 arrays.
$this->assertEquals(2, $arrays);
}
/**
* When adding resources to a set, the key becomes to the resource ID.
* The resource is stored as is as the value.
*/
public function testAddWithResources()
{
// Given
$set = new Set();
$fh = fopen(__FILE__, 'r');
// When
$set->add($fh);
$set->add($fh); // Should only get added once
// Then
$this->assertEquals(1, count($set));
$this->assertEquals(1, count($set->asArray()));
$resources = 0;
foreach ($set as $key => $value) {
if (\is_resource($value)) {
$resources++;
$vector_key = 'Resource(' . \strval($value) . ')';
$this->assertEquals($vector_key, $key);
$this->assertEquals($fh, $value);
}
}
// There should have been one resource
$this->assertEquals(1, $resources);
}
/**
* @test
* @dataProvider dataProviderForAddMulti
*/
public function testAddMulti(array $A, array $x, array $R)
{
// Given
$setA = new Set($A);
$setR = new Set($R);
// When
$setA->addMulti($x);
// Then
$this->assertEquals($setR, $setA);
$this->assertEquals($setR->asArray(), $setA->asArray());
}
public function dataProviderForAddMulti(): array
{
$vector = new Vector([1, 2, 3]);
return [
[
[],
[1],
[1],
],
[
[],
[1, 2],
[1, 2],
],
[
[1, 2, 3],
[],
[1, 2, 3],
],
[
[1, 2, 3],
[4],
[1, 2, 3, 4],
],
[
[1, 2, 3],
[4, 5],
[1, 2, 3, 4, 5],
],
[
[1, 2, 3],
[4, 5, 6],
[1, 2, 3, 4, 5, 6],
],
[
[1, 2, 3],
[1, 2, 3],
[1, 2, 3],
],
[
[1, 2, 3],
[1, 2, 3, 4],
[1, 2, 3, 4],
],
[
[1, 2, 3],
['new', 4],
[1, 2, 3, 'new', 4],
],
[
[1, 2, 3],
[3.1, 4],
[1, 2, 3, 3.1, 4],
],
[
[1, 2, 3],
[new Set()],
[1, 2, 3, ''],
],
[
[1, 2, 3],
[new Set([4, 5])],
[1, 2, 3, 'Set{4, 5}'],
],
[
[1, 2, 3],
[new Set([1, 2]), 4],
[1, 2, 3, 'Set{1, 2}', 4],
],
[
[1, 2, 3],
[new Set([1, 2]), 6, 7, new Set([1, 2]), new Set([3, 4])],
[1, 2, 3, 'Set{1, 2}', 6, 7, 'Set{3, 4}'],
],
[
[1, 2, 3],
[-3],
[1, 2, 3, -3],
],
[
[1, 2, 3],
[4, $vector],
[1, 2, 3, 4, $vector],
],
];
}
/**
* @test
* @dataProvider dataProviderForRemove
*/
public function testRemove(array $A, $x, array $R)
{
// Given
$setA = new Set($A);
$setR = new Set($R);
// When
$setA->remove($x);
// Then
$this->assertEquals($setR, $setA);
}
public function dataProviderForRemove(): array
{
$vector = new Vector([1, 2, 3]);
$fh = fopen(__FILE__, 'r');
return [
[
[],
null,
[],
],
[
[null],
null,
[],
],
[
[1],
1,
[],
],
[
[1, 2, 3],
1,
[2, 3],
],
[
[1, 2, 3],
2,
[1, 3],
],
[
[1, 2, 3],
3,
[1, 2],
],
[
[1, 2, 3],
5,
[1, 2, 3],
],
[
[1, 2, 3],
-1,
[1, 2, 3],
],
[
[1, 2, 3, -3],
-3,
[1, 2, 3],
],
[
[1, 2, 3, 4.5, 6.7],
4.5,
[1, 2, 3, 6.7],
],
[
[1, 2, 3, 'a', 'b', 'see'],
'b',
[1, 2, 3, 'a', 'see'],
],
[
[1, 2, 3, new Set([1, 2])],
1,
[2, 3, 'Set{1, 2}'],
],
[
[1, 2, 3, new Set([1, 2])],
new Set([1, 2]),
[1, 2, 3],
],
[
[1, 2, 3, new Set([1, 2])],
'Set{1, 2}',
[1, 2, 3],
],
[
[1, 2, 3, [1, 2, 3]],
[1, 2, 3],
[1, 2, 3],
],
[
[1, 2, 3, [1, 2, 3], [2, 3], [4, 5, 6]],
[2, 3],
[1, 2, 3, [1, 2, 3], [4, 5, 6]],
],
[
[1, 2, 3, [1, 2, 3], [2, 3], [4, 5, 6]],
[4, 5, 6],
[1, 2, 3, [1, 2, 3], [2, 3]],
],
[
[1, 2, 3, [1, 2, 3]],
[6, 7, 3],
[1, 2, 3, [1, 2, 3]],
],
[
[1, 2, 3, $vector],
$vector,
[1, 2, 3],
],
[
[1, 2, 3, $vector],
[$vector], // Array containing vector
[1, 2, 3, $vector],
],
[
[1, 2, 3, $vector],
[1, $vector], // array containing 1 and vector
[1, 2, 3, $vector],
],
[
[1, 2, 3, $fh],
$fh,
[1, 2, 3],
],
[
[1, 2, 3, $fh],
[1, $fh], // array containing 1 and f1
[1, 2, 3, $fh],
],
];
}
/**
* @test
* @dataProvider dataProviderForRemoveMulti
*/
public function testRemoveMulti(array $A, array $x, array $R)
{
// Given
$setA = new Set($A);
$setR = new Set($R);
// When
$setA->removeMulti($x);
// Then
$this->assertEquals($setR, $setA);
}
public function dataProviderForRemoveMulti(): array
{
$vector = new Vector([1, 2, 3]);
$fh = fopen(__FILE__, 'r');
return [
[
[],
[],
[],
],
[
[],
[null],
[],
],
[
[null],
[null],
[],
],
[
[1],
[1],
[],
],
[
[1],
[1],
[],
],
[
[1, 2, 3],
[1],
[2, 3],
],
[
[1, 2, 3],
[2],
[1, 3],
],
[
[1, 2, 3],
[3],
[1, 2],
],
[
[1, 2, 3],
[4],
[1, 2, 3],
],
[
[1, 2, 3],
[5, 6],
[1, 2, 3],
],
[
[1, 2, 3],
[3, 4, 5],
[1, 2],
],
[
[1, 2, 3],
[1, 2],
[3],
],
[
[1, 2, 3],
[2, 3],
[1],
],
[
[1, 2, 3],
[1, 3],
[2],
],
[
[1, 2, 3],
[5, 'a'],
[1, 2, 3],
],
[
[1, 2, 3],
[-1],
[1, 2, 3],
],
[
[1, 2, 3, -3],
[-3],
[1, 2, 3],
],
[
[1, 2, 3, 4.5, 6.7],
[4.5, 10],
[1, 2, 3, 6.7],
],
[
[1, 2, 3, 'a', 'b', 'see'],
['b', 'z'],
[1, 2, 3, 'a', 'see'],
],
[
[1, 2, 3, 'a', 'b', 'see'],
['b', 1, 'see', 5555],
[ 2, 3, 'a'],
],
[
[1, 2, 3, new Set([1, 2])],
[1],
[2, 3, 'Set{1, 2}'],
],
[
[1, 2, 3, new Set([1, 2])],
[new Set([1, 2])],
[1, 2, 3],
],
[
[1, 2, 3, new Set([1, 2])],
['Set{1, 2}'],
[1, 2, 3],
],
[
[1, 2, 3, [1, 2, 3]],
[1, 2, 3],
[[1, 2, 3]],
],
[
[1, 2, 3, [1, 2, 3], [2, 3], [4, 5, 6]],
[2, 3],
[1, [1, 2, 3], [2, 3], [4, 5, 6]],
],
[
[1, 2, 3, [1, 2, 3], [2, 3], [4, 5, 6]],
[4, 5, 6],
[1, 2, 3, [1, 2, 3], [2, 3], [4, 5, 6]],
],
[
[1, 2, 3, [1, 2, 3]],
[[1, 2, 3]],
[1, 2, 3],
],
[
[1, 2, 3, [1, 2, 3], [2, 3], [4, 5, 6]],
[[2, 3]],
[1, 2, 3, [1, 2, 3], [4, 5, 6]],
],
[
[1, 2, 3, [1, 2, 3], [2, 3], [4, 5, 6]],
[[4, 5, 6]],
[1, 2, 3, [1, 2, 3], [2, 3]],
],
[
[1, 2, 3, [1, 2, 3], [2, 3], [4, 5, 6]],
[[1, 2, 3], [4, 5, 6]],
[1, 2, 3, [2, 3]],
],
[
[1, 2, 3, [1, 2, 3], [2, 3], [4, 5, 6]],
[1, [4, 5, 6], 3],
[2, [1, 2, 3], [2, 3]],
],
[
[1, 2, 3, $vector],
[$vector, 9],
[1, 2, 3],
],
[
[1, 2, 3, $vector],
[$vector],
[1, 2, 3],
],
[
[1, 2, 3, $vector],
[1, $vector],
[2, 3],
],
[
[1, 2, 3, $fh],
[1, $fh],
[2, 3],
],
];
}
/**
* @test
* @dataProvider dataProviderForIsDisjoint
*/
public function testIsDisjoint(array $A, array $B)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
// Then
$this->assertTrue($setA->isDisjoint($setB));
}
public function dataProviderForIsDisjoint(): array
{
return [
[
[],
[2],
],
[
[1],
[],
],
[
[1],
[2],
],
[
[1, 2, 3],
[4, 5, 6],
],
[
[1, 2, 3,],
[1.1, 2.2, -3],
],
[
[1, 2, 3, 'a', 'b'],
[4, 5, 6, 'c', 'd'],
],
[
[1, 2, 3, new Set([1, 2])],
[4, 5, 6],
],
[
[1, 2, 3, new Set([1, 2])],
[4, 5, 6, new Set([2, 3])],
],
[
[new Set([1, 2])],
[new Set([2, 3])],
],
];
}
/**
* @test
* @dataProvider dataProviderForNotDisjoint
*/
public function testNotDisjoint(array $A, array $B)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
// Then
$this->assertFalse($setA->isDisjoint($setB));
}
public function dataProviderForNotDisjoint(): array
{
return [
[
[1],
[1],
],
[
[new Set()],
[new Set()],
],
[
[new Set([1, 2])],
[new Set([1, 2])],
],
[
[1, 2, 3],
[3, 4, 5],
],
];
}
/**
* @test
* @dataProvider dataProviderForIsSubsetSuperset
*/
public function testIsSubset(array $A, array $B)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
// Then
$this->assertTrue($setA->isSubset($setB));
}
public function dataProviderForIsSubsetSuperset(): array
{
return [
[
[],
[1],
],
[
[1],
[1],
],
[
[1, 2],
[1, 2],
],
[
[1, 2],
[1, 2, 3],
],
[
[1, 2, 'a'],
[1, 2, 3, 'a', 4.5, new Set([1, 2])],
],
[
[1, 2, 'a', new Set([1, 2])],
[1, 2, 3, 'a', 4.5, new Set([1, 2])],
],
[
[1, 2, 'a', new Set([1, 2]), -1, 2.4],
[1, 2, 3, 'a', 4.5, new Set([1, 2]), -1, -2, 2.4, 3.5],
],
];
}
/**
* @test
* @dataProvider dataProviderForIsNotSubset
*/
public function testIsNotSubset(array $A, array $B)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
// Then
$this->assertFalse($setA->isSubset($setB));
}
public function dataProviderForIsNotSubset(): array
{
return [
[
[1],
[],
],
[
[1, 2],
[1],
],
[
[1, 2, 3],
[1, 2],
],
[
[1, 2, 3, 4],
[1, 2, 3],
],
[
[1, 2, 'b'],
[1, 2, 3, 'a', 4.5, new Set([1, 2])],
],
[
[1, 2, 3, 'a', 4.5, new Set([1, 2])],
[1, 2, 'a', new Set([1, 2])],
],
[
[1, 2, 3, 'a', 4.5, new Set([1, 2]), -1, -2, 2.4, 3.5],
[1, 2, 'a', new Set([1, 2]), -1, 2.4],
],
];
}
/**
* @test
* @dataProvider dataProviderForIsProperSet
*/
public function testIsProperSubset(array $A, array $B)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
// Then
$this->assertTrue($setA->isProperSubset($setB));
}
/**
* @test
* @dataProvider dataProviderForIsProperSet
*/
public function testIsProperSuperset(array $A, array $B)
{
// Given
$setA = new Set($B);
$setB = new Set($A);
// Then
$this->assertFalse($setA->isProperSuperset($setB));
}
public function dataProviderForIsProperSet(): array
{
return [
[
[],
[],
],
[
[1],
[1],
],
[
[1, 2],
[1, 2],
],
[
[1, 3, 2],
[1, 2, 3],
],
[
[1, 2,'a', 3, 4.5, new Set([1, 2])],
[1, 2, 3, 'a', 4.5, new Set([1, 2])],
],
[
[1, 2, 3, 'a', 4.5, new Set([1, 2])],
[1, 2, 3, 'a', 4.5, new Set([1, 2])],
],
[
[1, 2, 3, 'a', 4.5, new Set([1, 2]), -1, -2, 2.4, 3.5],
[1, 2, 3, 'a', 4.5, new Set([1, 2]), -1, -2, 2.4, 3.5],
],
];
}
/**
* @test
* @dataProvider dataProviderForIsSubsetSuperset
*/
public function testIsSuperset(array $A, array $B)
{
// Given
$setA = new Set($B);
$setB = new Set($A);
// Then
$this->assertTrue($setA->isSuperset($setB));
}
/**
* @test
* @dataProvider dataProviderForUnion
*/
public function testUnion(array $A, array $B, array $AB, Set $R)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
$expected = new Set($AB);
// When
$union = $setA->union($setB);
$union_array = $union->asArray();
// Then
$this->assertEquals($R, $union);
$this->assertEquals($expected, $union);
$this->assertEquals(count($AB), count($union));
foreach ($AB as $member) {
$this->assertArrayHasKey("$member", $union_array);
}
foreach ($AB as $_ => $value) {
if ($value instanceof Set) {
$this->assertEquals($value, $union_array["$value"]);
} else {
$this->assertArrayHasKey((string) $value, $union_array);
}
}
}
public function dataProviderForUnion(): array
{
$setOneTwo = new Set([1, 2]);
return [
[
[],
[],
[],
new Set(),
],
[
[1],
[],
[1],
new Set([1]),
],
[
[],
[1],
[1],
new Set([1]),
],
[
[1],
[1],
[1],
new Set([1]),
],
[
[1],
[2],
[1, 2],
new Set([1, 2]),
],
[
[2],
[1],
[1, 2],
new Set([1, 2]),
],
[
[1],
[2],
[2, 1],
new Set([1, 2]),
],
[
[2],
[1],
[2, 1],
new Set([1, 2]),
],
[
[1, 2, 3, 'a', 'b'],
[1, 'a', 'k'],
[1, 2, 3, 'a', 'b', 'k'],
new Set([1, 2, 3, 'a', 'b', 'k']),
],
[
[1, 2, 3, 'a', 'b', $setOneTwo],
[1, 'a', 'k'],
[1, 2, 3, 'a', 'b', 'k', $setOneTwo],
new Set([1, 2, 3, 'a', 'b', 'k', $setOneTwo]),
],
[
[1, 2, 3, 'a', 'b'],
[1, 'a', 'k', $setOneTwo],
[1, 2, 3, 'a', 'b', 'k', $setOneTwo],
new Set([1, 2, 3, 'a', 'b', 'k', $setOneTwo]),
],
[
[1, 2, 3, 'a', 'b', new Set()],
[1, 'a', 'k', $setOneTwo],
[1, 2, 3, 'a', 'b', 'k', $setOneTwo, new Set()],
new Set([1, 2, 3, 'a', 'b', 'k', $setOneTwo, new Set()]),
],
[
[1, 2, 3, 'a', 'b', $setOneTwo],
[1, 'a', 'k', -2, '2.4', 3.5, $setOneTwo],
[1, 2, 3, 'a', 'b', 'k', -2, '2.4', 3.5, $setOneTwo],
new Set([1, 2, 3, 'a', 'b', 'k', -2, '2.4', 3.5, $setOneTwo]),
],
];
}
/**
* @test
* @dataProvider dataProviderForUnionMultipleSets
*/
public function testUnionMultipleSets(array $A, array $B, array $C, array $ABC, Set $R)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
$setC = new Set($C);
$expected = new Set($ABC);
// When
$union = $setA->union($setB, $setC);
$union_array = $union->asArray();
// Then
$this->assertEquals($R, $union);
$this->assertEquals($expected, $union);
$this->assertEquals(count($ABC), count($union));
foreach ($ABC as $member) {
$this->assertArrayHasKey("$member", $union_array);
}
foreach ($ABC as $_ => $value) {
if ($value instanceof Set) {
$this->assertEquals($value, $union_array["$value"]);
} else {
$this->assertArrayHasKey((string) $value, $union_array);
}
}
}
public function dataProviderForUnionMultipleSets(): array
{
return [
[
[1, 2, 3],
[2, 3, 4],
[3, 4, 5],
[1, 2, 3, 4, 5],
new Set([1, 2, 3, 4, 5]),
],
[
[1, 2, 3, -3, 3.4],
[2, 3, 4, new Set()],
[3, 4, 5, new Set([1, 2])],
[1, 2, 3, 4, 5, -3, 3.4, new Set(), new Set([1, 2])],
new Set([1, 2, 3, 4, 5, -3, 3.4, new Set(), new Set([1, 2])]),
],
];
}
public function testUnionWithArrays()
{
// Given
$A = new Set([1, 2, [1, 2, 3]]);
$B = new Set([2, 3, [2, 3, 4]]);
$expected = new Set([1, 2, [1, 2, 3], 3, [2, 3, 4]]);
// When
$AB = $A->union($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
public function testUnionWithArrays2()
{
// Given
$A = new Set([1, 2, [1, 2, 3]]);
$B = new Set([2, 3, [2, 3, 4], [1, 2, 3]]);
$expected = new Set([1, 2, [1, 2, 3], 3, [2, 3, 4]]);
// When
$AB = $A->union($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
public function testUnionWithObjects()
{
// Given
$vector1 = new Vector([1, 2, 3]);
$vector2 = new Vector([1, 2, 3]);
$A = new Set([1, 2, $vector1]);
$B = new Set([2, 3, $vector2]);
$expected = new Set([1, 2, $vector1, 3, $vector2]);
// When
$AB = $A->union($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
public function testUnionWithObjects2()
{
// Given
$vector1 = new Vector([1, 2, 3]);
$vector2 = new Vector([1, 2, 3]);
$A = new Set([1, 2, $vector1]);
$B = new Set([2, 3, $vector2, $vector1]);
$expected = new Set([1, 2, $vector1, 3, $vector2]);
// When
$AB = $A->union($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
/**
* @test
* @dataProvider dataProviderForIntersect
*/
public function testIntersect(array $A, array $B, array $AB, Set $R)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
$expected = new Set($AB);
// When
$intersection = $setA->intersect($setB);
$intersection_array = $intersection->asArray();
// Then
$this->assertEquals($R, $intersection);
$this->assertEquals($expected, $intersection);
$this->assertEquals(count($AB), count($intersection));
foreach ($AB as $member) {
$this->assertArrayHasKey("$member", $intersection_array);
$this->assertArrayHasKey("$member", $setA->asArray());
$this->assertArrayHasKey("$member", $setB->asArray());
$this->assertContains($member, $A);
$this->assertContains($member, $B);
}
foreach ($AB as $_ => $value) {
if ($value instanceof Set) {
$this->assertEquals($value, $intersection_array["$value"]);
} else {
$this->assertContains($value, $intersection_array);
}
}
}
public function dataProviderForIntersect(): array
{
$setOneTwo = new Set([1, 2]);
return [
[
[],
[],
[],
new Set(),
],
[
[1],
[],
[],
new Set(),
],
[
[],
[1],
[],
new Set(),
],
[
[1],
[1],
[1],
new Set([1]),
],
[
[1],
[2],
[],
new Set(),
],
[
[2],
[1],
[],
new Set(),
],
[
[2],
[2],
[2],
new Set([2]),
],
[
[1, 2],
[1, 2],
[1, 2],
new Set([1, 2]),
],
[
[1, 2],
[2, 1],
[1, 2],
new Set([1, 2]),
],
[
[1, 2, 3, 'a', 'b'],
[1, 'a', 'k'],
[1, 'a'],
new Set([1, 'a']),
],
[
[1, 2, 3, 'a', 'b', new Set([1, 2])],
[1, 'a', 'k'],
[1, 'a'],
new Set([1, 'a']),
],
[
[1, 2, 3, 'a', 'b'],
[1, 'a', 'k', new Set([1, 2])],
[1, 'a'],
new Set([1, 'a']),
],
[
[1, 2, 3, 'a', 'b', $setOneTwo],
[1, 'a', 'k', $setOneTwo],
[1, 'a', $setOneTwo],
new Set([1, 'a', $setOneTwo]),
],
[
[1, 2, 3, 'a', 'b', new Set()],
[1, 'a', 'k', $setOneTwo],
[1, 'a'],
new Set([1, 'a']),
],
[
[1, 2, 3, 'a', 'b', $setOneTwo],
[1, 'a', 'k', -2, '2.4', 3.5, $setOneTwo],
[1, 'a', $setOneTwo],
new Set([1, 'a', $setOneTwo]),
],
];
}
/**
* @test
* @dataProvider dataProviderForIntersectMultipleSets
*/
public function testIntersectMultipleSets(array $A, array $B, array $C, array $ABC, Set $R)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
$setC = new Set($C);
$expected = new Set($ABC);
// When
$intersection = $setA->intersect($setB, $setC);
$intersection_array = $intersection->asArray();
// Then
$this->assertEquals($R, $intersection);
$this->assertEquals($expected, $intersection);
$this->assertEquals(count($ABC), count($intersection));
foreach ($ABC as $member) {
$this->assertArrayHasKey("$member", $intersection_array);
$this->assertArrayHasKey("$member", $setA->asArray());
$this->assertArrayHasKey("$member", $setB->asArray());
$this->assertArrayHasKey("$member", $setC->asArray());
$this->assertContains($member, $A);
$this->assertContains($member, $B);
$this->assertContains($member, $C);
}
foreach ($ABC as $_ => $value) {
if ($value instanceof Set) {
$this->assertEquals($value, $intersection_array["$value"]);
} else {
$this->assertContains($value, $intersection_array);
}
}
}
public function dataProviderForIntersectMultipleSets(): array
{
$setOneTwo = new Set([1, 2]);
return [
[
[1, 2, 3, 4],
[2, 3, 4, 5],
[3, 4, 5, 6],
[3, 4],
new Set([3, 4]),
],
[
[1, 2, 3, 4, $setOneTwo],
[2, 3, 4, 5, $setOneTwo],
[3, 4, 5, 6, $setOneTwo],
[3, 4, $setOneTwo],
new Set([3, 4, $setOneTwo]),
],
];
}
public function testIntersectWithArrays()
{
// Given
$A = new Set([1, 2, [1, 2, 3]]);
$B = new Set([2, 3, [2, 3, 4]]);
$expected = new Set([2]);
// When
$AB = $A->intersect($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
public function testIntersectWithArrays2()
{
// Given
$A = new Set([1, 2, [1, 2, 3]]);
$B = new Set([2, 3, [2, 3, 4], [1, 2, 3]]);
$expected = new Set([2, [1, 2, 3]]);
// When
$AB = $A->intersect($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
public function testIntersectWithObjects()
{
// Given
$vector1 = new Vector([1, 2, 3]);
$vector2 = new Vector([1, 2, 3]);
$A = new Set([1, 2, $vector1]);
$B = new Set([2, 3, $vector2]);
$expected = new Set([2]);
// When
$AB = $A->intersect($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
public function testIntersectWithObjects2()
{
// Given
$vector1 = new Vector([1, 2, 3]);
$vector2 = new Vector([1, 2, 3]);
$A = new Set([1, 2, $vector1]);
$B = new Set([2, 3, $vector2, $vector1]);
$expected = new Set([2, $vector1]);
// When
$AB = $A->intersect($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
/**
* @test
* @dataProvider dataProviderForDifference
*/
public function testDifference(array $A, array $B, array $diff, Set $R)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
$expected = new Set($diff);
// When
$difference = $setA->difference($setB);
$difference_array = $difference->asArray();
// Then
$this->assertEquals($R, $difference);
$this->assertEquals($expected, $difference);
$this->assertEquals(count($diff), count($difference));
foreach ($diff as $member) {
$this->assertArrayHasKey("$member", $difference_array);
$this->assertArrayHasKey("$member", $setA->asArray());
$this->assertArrayNotHasKey("$member", $setB->asArray());
$this->assertContains($member, $A);
$this->assertNotContains("$member", $B);
}
foreach ($diff as $_ => $value) {
if ($value instanceof Set) {
$this->assertEquals($value, $difference_array["$value"]);
} else {
$this->assertContains($value, $difference_array);
}
}
}
public function dataProviderForDifference(): array
{
$emptySet = new Set();
$setOneTwo = new Set([1, 2]);
return [
[
[],
[],
[],
new Set(),
],
[
[1],
[1],
[],
new Set(),
],
[
[1, 2],
[1],
[2],
new Set([2]),
],
[
[1],
[1, 2],
[],
new Set(),
],
[
[1, 2, 3, 4],
[2, 3, 4, 5],
[1],
new Set([1]),
],
[
[1, 2, 3, 'a', 'b'],
[1, 'a', 'k'],
[2, 3, 'b'],
new Set([2, 3, 'b']),
],
[
[1, 2, 3, 'a', 'b', $setOneTwo],
[1, 'a', 'k'],
[2, 3, 'b',$setOneTwo],
new Set([2, 3, 'b', $setOneTwo]),
],
[
[1, 2, 3, 'a', 'b'],
[1, 'a', 'k', new Set([1, 2])],
[2, 3, 'b'],
new Set([2, 3, 'b']),
],
[
[1, 2, 3, 'a', 'b', $emptySet],
[1, 'a', 'k', new Set([1, 2])],
[2, 3, 'b', $emptySet],
new Set([2, 3, 'b', $emptySet]),
],
[
[1, 2, 3, 'a', 'b', new Set([1, 2])],
[1, 'a', 'k', -2, '2.4', 3.5, new Set([1, 2])],
[2, 3, 'b'],
new Set([2, 3, 'b']),
],
[
[1, 2,'a', 3, 4.5, new Set([1, 2])],
[1, 2, 3, 'a', 4.5, new Set([1, 2])],
[],
new Set(),
],
[
[1, 2, 3, 'a', 4.5, new Set([1, 2])],
[1, 2, 3, 'a', 4.5, new Set([1, 2])],
[],
new Set(),
],
[
[1, 2, 3, 'a', 4.5, new Set([1, 2]), -1, -2, 2.4, 3.5],
[1, 2, 3, 'a', 4.5, new Set([1, 2]), -1, -2, 2.4, 3.5],
[],
new Set(),
],
];
}
/**
* @test
* @dataProvider dataProviderForDifferenceMultiSet
*/
public function testDifferenceMultiSet(array $A, array $B, array $C, array $diff, Set $R)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
$setC = new Set($C);
$expected = new Set($diff);
// When
$difference = $setA->difference($setB, $setC);
$difference_array = $difference->asArray();
// Then
$this->assertEquals($R, $difference);
$this->assertEquals($expected, $difference);
$this->assertEquals(count($diff), count($difference));
foreach ($diff as $member) {
$this->assertArrayHasKey("$member", $difference_array);
$this->assertArrayHasKey("$member", $setA->asArray());
$this->assertArrayNotHasKey("$member", $setB->asArray());
$this->assertArrayNotHasKey("$member", $setC->asArray());
$this->assertContains($member, $A);
$this->assertNotContains("$member", $B);
$this->assertNotContains("$member", $C);
}
foreach ($diff as $_ => $value) {
if ($value instanceof Set) {
$this->assertEquals($value, $difference_array["$value"]);
} else {
$this->assertContains($value, $difference_array);
}
}
}
public function dataProviderForDifferenceMultiSet(): array
{
$setOneTwo = new Set([1, 2]);
return [
[
['1', '2', '3', '4'],
['2', '3', '4', '5'],
['3', '4', '5', '6'],
['1'],
new Set([1]),
],
[
['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
['2', '4', '6', '8', '10'],
['5', '10'],
['1', '3', '7', '9'],
new Set([1, 3, 7, 9]),
],
[
['1', '2', '3', '4', $setOneTwo],
['2', '3', '4', '5'],
['3', '4', '5', '6'],
['1', $setOneTwo],
new Set([1, $setOneTwo]),
],
[
['1', '2', '3', '4', new Set([1, 2])],
['2', '3', '4', '5'],
['3', '4', '5', '6', new Set([1, 2])],
['1'],
new Set([1]),
],
];
}
public function testDifferenceWithArrays()
{
// Given
$A = new Set([1, 2, [1, 2, 3]]);
$B = new Set([2, 3, [2, 3, 4]]);
$expected = new Set([1, [1, 2, 3]]);
// When
$AB = $A->difference($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
public function testDifferenceWithArrays2()
{
// Given
$A = new Set([1, 2, [1, 2, 3]]);
$B = new Set([2, 3, [2, 3, 4], [1, 2, 3]]);
$expected = new Set([1]);
// When
$AB = $A->difference($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
public function testDifferenceWithObjects()
{
// Given
$vector1 = new Vector([1, 2, 3]);
$vector2 = new Vector([1, 2, 3]);
$A = new Set([1, 2, $vector1]);
$B = new Set([2, 3, $vector2]);
$expected = new Set([1, $vector1]);
// When
$AB = $A->difference($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
public function testDifferenceWithObjects2()
{
// Given
$vector1 = new Vector([1, 2, 3]);
$vector2 = new Vector([1, 2, 3]);
$A = new Set([1, 2, $vector1]);
$B = new Set([2, 3, $vector2, $vector1]);
$expected = new Set([1]);
// When
$AB = $A->difference($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
/**
* @test
* @dataProvider dataProviderForSymmetricDifference
*/
public function testSymmetricDifference(array $A, array $B, array $diff, Set $R)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
$expected = new Set($diff);
// When
$difference = $setA->symmetricDifference($setB);
$difference_array = $difference->asArray();
// Then
$this->assertEquals($R, $difference);
$this->assertEquals($expected, $difference);
$this->assertEquals(count($diff), count($difference));
foreach ($diff as $member) {
$this->assertArrayHasKey("$member", $difference_array);
}
foreach ($diff as $_ => $value) {
if ($value instanceof Set) {
$this->assertEquals($value, $difference_array["$value"]);
} else {
$this->assertArrayHasKey((string) $value, $difference_array);
}
}
}
public function dataProviderForSymmetricDifference(): array
{
return [
[
[1, 2, 3],
[2, 3, 4],
[1, 4],
new Set([1, 4]),
],
[
[1, 2, 3, new Set()],
[2, 3, 4],
[1, 4, new Set()],
new Set([1, 4, new Set()]),
],
[
[1, 2, 3],
[2, 3, 4, new Set()],
[1, 4, new Set()],
new Set([1, 4, new Set()]),
],
[
[1, 2, 3, new Set()],
[2, 3, 4, new Set()],
[1, 4],
new Set([1, 4]),
],
[
[1, 3, 5, 7, 9],
[2, 4, 6, 8, 10],
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
new Set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
],
];
}
public function testSymmetricDifferenceWithArrays()
{
// Given
$A = new Set([1, 2, [1, 2, 3]]);
$B = new Set([2, 3, [2, 3, 4]]);
$expected = new Set([1, 3, [1, 2, 3], [2, 3, 4]]);
// When
$AB = $A->symmetricDifference($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
public function testSymmetricDifferenceWithArrays2()
{
// Given
$A = new Set([1, 2, [1, 2, 3]]);
$B = new Set([2, 3, [2, 3, 4], [1, 2, 3]]);
$expected = new Set([1, 3, [2, 3, 4]]);
// When
$AB = $A->symmetricDifference($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
public function testSymmetricDifferenceWithObjects()
{
// Given
$vector1 = new Vector([1, 2, 3]);
$vector2 = new Vector([1, 2, 3]);
$A = new Set([1, 2, $vector1]);
$B = new Set([2, 3, $vector2]);
$expected = new Set([1, 3, $vector1, $vector2]);
// When
$AB = $A->symmetricDifference($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
public function testSymmetricDifferenceWithObjects2()
{
// Given
$vector1 = new Vector([1, 2, 3]);
$vector2 = new Vector([1, 2, 3]);
$A = new Set([1, 2, $vector1]);
$B = new Set([2, 3, $vector2, $vector1]);
$expected = new Set([1, 3, $vector2]);
// When
$AB = $A->symmetricDifference($B);
// Then
$this->assertEquals($expected, $AB);
$this->assertEquals($expected->asArray(), $AB->asArray());
}
/**
* @test
* @dataProvider dataProviderForSingleSet
*/
public function testCopy(array $members)
{
// Given
$set = new Set($members);
$copy = $set->copy();
// When
$set_array = $set->asArray();
$copy_array = $copy->asArray();
// Then
$this->assertEquals($set, $copy);
$this->assertEquals($set_array, $copy_array);
$this->assertEquals(count($set), count($copy));
}
/**
* @test
* @dataProvider dataProviderForSingleSet
*/
public function testClear(array $members)
{
// Given
$set = new Set($members);
// When
$set->clear();
// Then
$this->assertTrue($set->isEmpty());
$this->assertEmpty($set->asArray());
$this->assertEquals($set, new Set());
}
/**
* @test
* @dataProvider dataProviderForCartesianProduct
*/
public function testCartesianProduct(array $A, array $B, array $AB, Set $R)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
// When
$setAB = $setA->cartesianProduct($setB);
$AB_array = $setAB->asArray();
// Then
$this->assertEquals($R, $setAB);
$this->assertEquals($AB, $AB_array);
$this->assertEquals(count($setAB), count($AB));
foreach ($setAB as $key => $value) {
$this->assertInstanceOf(Set::class, $value);
$this->assertEquals(2, count($value));
}
foreach ($AB_array as $key => $value) {
$this->assertInstanceOf(Set::class, $value);
$this->assertEquals(2, count($value));
}
}
public function dataProviderForCartesianProduct(): array
{
return [
[
[1, 2],
[3, 4],
['Set{1, 3}' => new Set([1, 3]), 'Set{1, 4}' => new Set([1, 4]), 'Set{2, 3}' => new Set([2, 3]), 'Set{2, 4}' => new Set([2, 4])],
new Set([new Set([1, 3]), new Set([1, 4]), new Set([2, 3]), new Set([2, 4])]),
],
[
[1, 2],
['red', 'white'],
['Set{1, red}' => new Set([1, 'red']), 'Set{1, white}' => new Set([1, 'white']), 'Set{2, red}' => new Set([2, 'red']), 'Set{2, white}' => new Set([2, 'white'])],
new Set([new Set([1, 'red']), new Set([1, 'white']), new Set([2, 'red']), new Set([2, 'white'])]),
],
[
[1, 2],
[],
[],
new Set(),
],
];
}
/**
* @test
* @dataProvider dataProviderForNaryCartesianProduct
*/
public function testNaryCartesianProduct(array $A, array $B, array $C, array $ABC, Set $R)
{
// Given
$setA = new Set($A);
$setB = new Set($B);
$setC = new Set($C);
// When
$setABC = $setA->cartesianProduct($setB, $setC);
$ABC_array = $setABC->asArray();
// Then
$this->assertEquals($R, $setABC);
$this->assertEquals($ABC, $ABC_array);
$this->assertEquals(count($setABC), count($ABC));
$this->assertEquals(count($setABC), count($setA) * count($setB) * count($setC));
foreach ($setABC as $key => $value) {
$this->assertInstanceOf(Set::class, $value);
$this->assertEquals(3, count($value));
}
foreach ($ABC_array as $key => $value) {
$this->assertInstanceOf(Set::class, $value);
$this->assertEquals(3, count($value));
}
}
public function dataProviderForNaryCartesianProduct(): array
{
return [
[
[1, 2],
[3, 4],
[5, 6],
[
'Set{1, 3, 5}' => new Set([1, 3, 5]),
'Set{1, 3, 6}' => new Set([1, 3, 6]),
'Set{1, 4, 5}' => new Set([1, 4, 5]),
'Set{1, 4, 6}' => new Set([1, 4, 6]),
'Set{2, 3, 5}' => new Set([2, 3, 5]),
'Set{2, 3, 6}' => new Set([2, 3, 6]),
'Set{2, 4, 5}' => new Set([2, 4, 5]),
'Set{2, 4, 6}' => new Set([2, 4, 6]),
],
new Set([
new Set([1, 3, 5]),
new Set([1, 3, 6]),
new Set([1, 4, 5]),
new Set([1, 4, 6]),
new Set([2, 3, 5]),
new Set([2, 3, 6]),
new Set([2, 4, 5]),
new Set([2, 4, 6]),
]),
],
[
[1, 2],
['red', 'white'],
['A', 'B'],
[
'Set{1, red, A}' => new Set([1, 'red', 'A']),
'Set{1, red, B}' => new Set([1, 'red', 'B']),
'Set{1, white, A}' => new Set([1, 'white', 'A']),
'Set{1, white, B}' => new Set([1, 'white', 'B']),
'Set{2, red, A}' => new Set([2, 'red', 'A']),
'Set{2, red, B}' => new Set([2, 'red', 'B']),
'Set{2, white, A}' => new Set([2, 'white', 'A']),
'Set{2, white, B}' => new Set([2, 'white', 'B']),
],
new Set([
new Set([1, 'red', 'A']),
new Set([1, 'red', 'B']),
new Set([1, 'white', 'A']),
new Set([1, 'white', 'B']),
new Set([2, 'red', 'A']),
new Set([2, 'red', 'B']),
new Set([2, 'white', 'A']),
new Set([2, 'white', 'B']),
]),
],
[
[1, 2],
[3],
[],
[],
new Set(),
],
];
}
/**
* @test
* @dataProvider dataProviderForPowerSet
*/
public function testPowerSet(Set $A, Set $expected)
{
// When
$PS = $A->powerSet();
// Then
$this->assertEquals($expected, $PS);
$this->assertEquals($expected->asArray(), $PS->asArray());
$this->assertEquals(count($expected), count($PS));
}
public function dataProviderForPowerSet(): array
{
return [
// P({}) = {}
[
new Set(),
new Set([
new Set(),
]),
],
// P({1}) = {{}, {1}}
[
new Set([1]),
new Set([
new Set(),
new Set([1]),
]),
],
// P({1, 2, 3}) = {, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}}
[
new Set([1, 2, 3]),
new Set([
new Set(),
new Set([1]),
new Set([2]),
new Set([3]),
new Set([1, 2]),
new Set([1, 3]),
new Set([2, 3]),
new Set([1, 2, 3]),
]),
],
// P({x, y, z}) = {, {x}, {y}, {z}, {x,y}, {x,z}, {y,z}, {x,y,z}}
[
new Set(['x', 'y', 'z']),
new Set([
new Set(),
new Set(['x']),
new Set(['y']),
new Set(['z']),
new Set(['x', 'y']),
new Set(['x', 'z']),
new Set(['y', 'z']),
new Set(['x', 'y', 'z']),
]),
],
// P({1, [1, 2]}) = {, {1}, {[1, 2]}, {1, [1, 2]}}
[
new Set([1, [1, 2]]),
new Set([
new Set(),
new Set([1]),
new Set([[1, 2]]),
new Set([1, [1, 2]]),
]),
],
];
}
public function dataProviderForSingleSet(): array
{
$fh = fopen(__FILE__, 'r');
$vector = new Vector([1, 2, 3]);
$func = function ($x) {
return $x * 2;
};
return [
[[]],
[[0]],
[[1]],
[[5]],
[[-5]],
[[1, 2]],
[[1, 2, 3]],
[[1, -2, 3]],
[[1, 2, 3, 4, 5, 6]],
[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]],
[[1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2, 2.01, 2.001, 2.15]],
[['a']],
[['a', 'b']],
[['a', 'b', 'c', 'd', 'e']],
[[1, 2, 'a', 'b', 3.14, 'hello', 'goodbye']],
[[1, 2, 3, new Set([1, 2]), 'a', 'b']],
[['a', 1, 'b', new Set([1, 'b'])]],
[['a', 1, 'b', new Set([1, 'b']), '4', 5]],
[['a', 1, 'b', new Set([1, 'b']), new Set([3, 4, 5]), '4', 5]],
[[1, 2, 3, [1, 2], [2, 3, 4]]],
[[1, 2, $fh, $vector, [4, 5], 6, 'a', $func, 12, new Set([4, 6, 7]), new Set(), 'sets']],
];
}
}
```
|
```python
# Use of this source code is governed by a MIT license
# that can be found in the LICENSE file.
from dokumentor import *
NamespaceDoc( "Window", """Window class.
It is not possible to create an instance of this class. 'global.window' is already available.""",
SeesDocs( "global|global.window|Window" ),
NO_Examples,
products=["Frontend"]
)
NamespaceDoc( "MouseEvent", "Class that describes mouse events.",
SeesDocs( "global.window|NMLEvent|Window|WindowEvent|keyEvent|TextInputEvent|MouseEvent|DragEvent" ),
NO_Examples
)
NamespaceDoc( "MouseDrag", "Class that describes drag events.",
SeesDocs( "global.window|NMLEvent|Window|WindowEvent|keyEvent|TextInputEvent|MouseEvent|DragEvent" ),
NO_Examples
)
NamespaceDoc( "WindowEvent", "Class that describes window events.",
SeesDocs( "global.window|NMLEvent|Window|WindowEvent|keyEvent|TextInputEvent|MouseEvent|DragEvent" ),
NO_Examples,
section="Window"
)
NamespaceDoc( "TextInputEvent", "Class that describes textinput events.",
SeesDocs( "global.window|NMLEvent|Window|WindowEvent|keyEvent|TextInputEvent|MouseEvent|DragEvent" ),
NO_Examples
)
NamespaceDoc( "keyEvent", "Class that describes key events.",
SeesDocs( "global.window|NMLEvent|Window|WindowEvent|keyEvent|TextInputEvent|MouseEvent|DragEvent" ),
NO_Examples
)
NamespaceDoc( "NMLEvent", "Class that describes events.",
SeesDocs( "global.window|NMLEvent|Window|WindowEvent|keyEvent|TextInputEvent|MouseEvent|DragEvent" ),
NO_Examples
)
EventDoc( "Window._onready", "Function that is called when the window is ready.",
SeesDocs( "global.window|Window|Window._onassetready|Window._onready|Window._onbeforeclose|Window._onfocus|Window._onblur|Window._onmousewheel|Window._onkeydown|Window._onkeyup|Window._ontextinput|Window._onsystemtrayclick|Window._onmousedown|Window._onmouseup|Window._onFileDragEnter|Window.onFileDragLeave|Window._onFileDrag|Window._onFileDrop|Window._onmousemove"),
NO_Examples,
[ ParamDoc( "event", "EventMessage", "WindowEvent", NO_Default, IS_Obligated ) ]
)
EventDoc( "Window._onclose", "Function that is called when the window will be closed.",
SeesDocs( "global.window|Window|Window._onassetready|Window._onready|Window._onbeforeclose|Window._onfocus|Window._onblur|Window._onmousewheel|Window._onkeydown|Window._onkeyup|Window._ontextinput|Window._onsystemtrayclick|Window._onmousedown|Window._onmouseup|Window._onFileDragEnter|Window.onFileDragLeave|Window._onFileDrag|Window._onFileDrop|Window._onmousemove"),
NO_Examples,
[ ParamDoc( "event", "EventMessage", "WindowEvent", NO_Default, IS_Obligated ) ]
)
EventDoc( "Window._onassetready", """Function that is called when the window has loaded all the assets.""",
SeesDocs( "global.window|Window|Window._onassetready|Window._onready|Window._onbeforeclose|Window._onfocus|Window._onblur|Window._onmousewheel|Window._onkeydown|Window._onkeyup|Window._ontextinput|Window._onsystemtrayclick|Window._onmousedown|Window._onmouseup|Window._onFileDragEnter|Window.onFileDragLeave|Window._onFileDrag|Window._onFileDrop|Window._onmousemove"),
NO_Examples,
[ ParamDoc( "event", "EventMessage", ObjectDoc([("data", "string in utf8 encoding", "string"),
("tag", "tag name", "string"),
("id", "id of the object", "string")]), NO_Default, IS_Obligated ) ]
)
EventDoc( "Window._onfocus", "Function that is called when the window receives the focus.",
SeesDocs( "global.window|Window|Window._onassetready|Window._onready|Window._onbeforeclose|Window._onfocus|Window._onblur|Window._onmousewheel|Window._onkeydown|Window._onkeyup|Window._ontextinput|Window._onsystemtrayclick|Window._onmousedown|Window._onmouseup|Window._onFileDragEnter|Window.onFileDragLeave|Window._onFileDrag|Window._onFileDrop|Window._onmousemove"),
NO_Examples,
NO_Params
)
EventDoc( "Window._onblur", "Function that is called when the window looses the focus.",
SeesDocs( "global.window|Window|Window._onassetready|Window._onready|Window._onbeforeclose|Window._onfocus|Window._onblur|Window._onmousewheel|Window._onkeydown|Window._onkeyup|Window._ontextinput|Window._onsystemtrayclick|Window._onmousedown|Window._onmouseup|Window._onFileDragEnter|Window.onFileDragLeave|Window._onFileDrag|Window._onFileDrop|Window._onmousemove"),
NO_Examples,
NO_Params
)
EventDoc( "Window._onmousewheel", """Function that is called when the window gets an mouse wheel event.""",
SeesDocs( "global.window|Window|Window._onassetready|Window._onready|Window._onbeforeclose|Window._onfocus|Window._onblur|Window._onmousewheel|Window._onkeydown|Window._onkeyup|Window._ontextinput|Window._onsystemtrayclick|Window._onmousedown|Window._onmouseup|Window._onFileDragEnter|Window.onFileDragLeave|Window._onFileDrag|Window._onFileDrop|Window._onmousemove"),
NO_Examples,
[ ParamDoc( "event", "EventMessage", ObjectDoc([("xrel", "x relative position", "integer"),
("yres", "x relative position", "integer"),
("x_pos", "x position", "integer"),
("y_pos", "y position", "integer")
]), NO_Default, IS_Obligated ) ]
)
for i in ["_onkeydown", "_onkeyup" ]:
EventDoc( "Window." + i, """Function that is called when the window gets an " + i + " event.""",
SeesDocs( "global.window|Window|Window._onassetready|Window._onready|Window._onbeforeclose|Window._onfocus|Window._onblur|Window._onmousewheel|Window._onkeydown|Window._onkeyup|Window._ontextinput|Window._onsystemtrayclick|Window._onmousedown|Window._onmouseup|Window._onFileDragEnter|Window.onFileDragLeave|Window._onFileDrag|Window._onFileDrop|Window._onmousemove"),
NO_Examples,
[ ParamDoc( "event", "EventMessage", ObjectDoc([ ("keyCode", "keycode used", "integer"),
("location", "location used", "integer"),
("altKey", "alt used", "boolean"),
("ctrlKey", "ctrl used", "boolean"),
("shiftKey", "shift used", "boolean"),
("metaKey", "meta used", "boolean"),
("spaceKey", "space used", "boolean"),
("repeat", "repeating", "boolean") ]), NO_Default, IS_Obligated ) ]
)
EventDoc( "Window._ontextinput", """function that is called when the window gets an " + i + " event.""",
SeesDocs( "global.window|Window|Window._onassetready|Window._onready|Window._onbeforeclose|Window._onfocus|Window._onblur|Window._onmousewheel|Window._onkeydown|Window._onkeyup|Window._ontextinput|Window._onsystemtrayclick|Window._onmousedown|Window._onmouseup|Window._onFileDragEnter|Window.onFileDragLeave|Window._onFileDrag|Window._onFileDrop|Window._onmousemove"),
NO_Examples,
[ ParamDoc( "event", "EventMessage", ObjectDoc([("val", "value (utf8)", "string")]), NO_Default, IS_Obligated ) ]
)
EventDoc( "Window._onsystemtrayclick", """Function that is called when the window gets an " + i + " event.""",
SeesDocs( "Window._onassetready|Window._onready|Window._onbeforeclose|Window._onfocus|Window._onblur|Window._onmousewheel|Window._onkeydown|Window._onkeyup|Window._ontextinput|Window._onsystemtrayclick|Window._onmousedown|Window._onmouseup|Window._onFileDragEnter|Window.onFileDragLeave|Window._onFileDrag|Window._onFileDrop|Window._onmousemove"),
NO_Examples,
[ ParamDoc( "event", "EventMessage", ObjectDoc([("id", "event id", "integer")]), NO_Default, IS_Obligated ) ]
)
for i in ["_onmousedown", "_onmouseup" ]:
EventDoc( "Window." + i, """Function that is called when the window gets an " + i + " event.""",
SeesDocs( "global.window|Window|Window._onassetready|Window._onready|Window._onbeforeclose|Window._onfocus|Window._onblur|Window._onmousewheel|Window._onkeydown|Window._onkeyup|Window._ontextinput|Window._onsystemtrayclick|Window._onmousedown|Window._onmouseup|Window._onFileDragEnter|Window.onFileDragLeave|Window._onFileDrag|Window._onFileDrop|Window._onmousemove"),
NO_Examples,
[ ParamDoc( "event", "EventMessage", ObjectDoc([ ("x_pos", "x position", "integer"),
("y_pos", "y position", "integer"),
("clientX", "client x position", "integer"),
("clientY", "client y position", "integer"),
("which", "mouse button", "integer") ]), NO_Default, IS_Obligated ) ]
)
for i in ["_onFileDragEnter", "_onFileDragLeave", "_onFileDrag", "_onFileDragDrop" ]:
EventDoc( "Window." + i, """function that is called when the window gets an " + i + " event. """,
SeesDocs( "global.window|Window|Window._onassetready|Window._onready|Window._onbeforeclose|Window._onfocus|Window._onblur|Window._onmousewheel|Window._onkeydown|Window._onkeyup|Window._ontextinput|Window._onsystemtrayclick|Window._onmousedown|Window._onmouseup|Window._onFileDragEnter|Window.onFileDragLeave|Window._onFileDrag|Window._onFileDrop|Window._onmousemove"),
NO_Examples,
[ ParamDoc( "event", "EventMessage", ObjectDoc([ ("x_pos", "x position", "integer"),
("y_pos", "y position", "integer"),
("clientX", "client x position", "integer"),
("clientY", "client y position", "integer"),
("files", "Array of filenames", "[string]") ]), NO_Default, IS_Obligated ) ]
)
EventDoc( "Window._onmousemove", """function that is called when the window gets an mousemovement event.""",
SeesDocs( "global.window|Window|Window._onassetready|Window._onready|Window._onbeforeclose|Window._onfocus|Window._onblur|Window._onmousewheel|Window._onkeydown|Window._onkeyup|Window._ontextinput|Window._onsystemtrayclick|Window._onmousedown|Window._onmouseup|Window._onFileDragEnter|Window.onFileDragLeave|Window._onFileDrag|Window._onFileDrop|Window._onmousemove"),
NO_Examples,
[ ParamDoc( "event", "EventMessage", ObjectDoc([ ("x_pos", "x position", "integer"),
("y_pos", "y position", "integer"),
("xrel", "relative x position", "integer"),
("yrel", "relative y position", "integer"),
("clientX", "client x position", "integer"),
("clientY", "client y position", "integer"),
("files", "Array of filenames", "[string]") ]), NO_Default, IS_Obligated ) ]
)
topics = {"left": "integer", "top": "integer", "innerWidth": "integer", "innerHeight": "integer", "outerHeight": "integer", "title": "string" }
for i,typed in topics.items():
FieldDoc( "Window." + i, "Set/Get the windows's " + i + " value.",
SeesDocs( "'" + "|".join( topics.keys() ) + "'" ),
NO_Examples,
IS_Static, IS_Public, IS_ReadWrite,
typed,
NO_Default
)
topics = { "cursor": "string", "titleBarColor": "integer", "titleBarControlOffsetX": "integer", "titleBarControlOffsetY": "integer" }
for i,typed in topics.items() :
expl = ""
if i == 'cursor':
expl = "\nAllowed values are 'default'|'arrow'|'beam'|'text'|'pointer'|'grabbing'|'drag'|'hidden'|'none'|'col-resize'"
FieldDoc( "Window." + i, "Set/Get the windows's " + i + " value.",
SeesDocs( "'" +"|".join( topics.keys() ) + "'" ),
NO_Examples,
IS_Static, IS_Public, IS_ReadWrite,
typed,
NO_Default
)
FunctionDoc( "Window.setSize", "Set the size of the window.",
SeesDocs( "Window.center|Window.setPosition|Window.setSize" ),
NO_Examples,
IS_Static, IS_Public, IS_Fast,
[ParamDoc( "width", "The width to set to", "integer", NO_Default, IS_Obligated ),
ParamDoc( "heigth", "The heigth to set to", "integer", NO_Default, IS_Obligated ) ],
NO_Returns
)
FunctionDoc( "Window.openURL", "Open an url in a new browser session.",
SeesDocs( "global.window|Window|Window.exec|Window.openURL|Window.open|Window.close|Window.quit" ),
NO_Examples,
IS_Static, IS_Public, IS_Slow,
[ParamDoc( "url", "The url to open", "string", NO_Default, IS_Obligated ) ],
NO_Returns
)
FunctionDoc( "Window.exec", "Executes a command in the background.",
SeesDocs( "global.window|Window|Window.exec|Window.openURL|Window.open|Window.close|Window.quit" ),
NO_Examples,
IS_Static, IS_Public, IS_Slow,
[ParamDoc( "cmd", "The cmd with its arguments", "string", NO_Default, IS_Obligated ) ],
NO_Returns
)
FunctionDoc( "Window.openDirDialog", "Opens a directory selection dialog.",
SeesDocs( "global.window|Window|Window.exec|Window.openURL|Window.open|Window.close|Window.quit" ),
NO_Examples,
IS_Static, IS_Public, IS_Slow,
[CallbackDoc( "fn", "The callback function", [ParamDoc( "list", "List of the selected items", "[string]", NO_Default, IS_Obligated ) ] ) ],
NO_Returns
)
FunctionDoc( "Window.openFileDialog", "Opens a file selection dialog.",
SeesDocs( "global.window|Window|Window.exec|Window.openURL|Window.open|Window.close|Window.quit" ),
NO_Examples,
IS_Static, IS_Public, IS_Slow,
[ParamDoc( "types", "list of allowed extensions or null", "[string]", NO_Default, IS_Obligated ),
CallbackDoc( "fn", "The callback function", [ParamDoc( "list", "List of the selected items", "[string]", NO_Default, IS_Obligated ) ] ) ],
NO_Returns
)
FunctionDoc( "Window.requestAnimationFrame", "Execute a callback for the next frame.",
SeesDocs( "global.window|Window|Window.requestAnimationFrame|Window.setFrame" ),
NO_Examples,
IS_Static, IS_Public, IS_Fast,
[ CallbackDoc( "fn", "The callback function", [ParamDoc( "list", "List of the selected items", "[string]", NO_Default, IS_Obligated ) ] ) ],
NO_Returns
)
FunctionDoc( "Window.center", "Positions the window in the center.",
SeesDocs( "global.window|Window|Window.center|Window.setPosition|Window.setSize" ),
NO_Examples,
IS_Static, IS_Public, IS_Fast,
NO_Params,
NO_Returns
)
FunctionDoc( "Window.center", "Positions the window in the center.",
SeesDocs( "global.window|Window|Window.center|Window.setPosition|Window.setSize" ),
NO_Examples,
IS_Static, IS_Public, IS_Fast,
[ParamDoc( "x_pos", "X position", "integer", 0, IS_Obligated ),
ParamDoc( "y_pos", "Y position", "integer", 0, IS_Obligated ) ],
NO_Returns
)
FunctionDoc( "Window.notify", "Send a notification to the systemtray.",
SeesDocs( "global.window|Window|Window.notify|Window.setSystemTray" ),
NO_Examples,
IS_Static, IS_Public, IS_Fast,
[ParamDoc( "title", "Title text", "string", NO_Default, IS_Obligated ),
ParamDoc( "body", "Body text", "string", NO_Default, IS_Obligated ),
ParamDoc( "sound", "Play sound", "boolean", 'false', IS_Optional ) ],
NO_Returns
)
FunctionDoc( "Window.quit", "Quits this window instance.",
SeesDocs( "global.window|Window|Window.exec|Window.openURL|Window.open|Window.close|Window.quit" ),
NO_Examples,
IS_Static, IS_Public, IS_Slow,
NO_Params,
NO_Returns
)
FunctionDoc( "Window.close", "Closes this window instance.",
SeesDocs( "Window.exec|Window.openURL|Window.open|Window.close|Window.quit" ),
NO_Examples,
IS_Static, IS_Public, IS_Slow,
NO_Params,
NO_Returns
)
FunctionDoc( "Window.notify", "Send a notification to the systemtray.",
SeesDocs( "global.window|Window|Window.notify|Window.setSystemTray" ),
NO_Examples,
IS_Static, IS_Public, IS_Fast,
[ParamDoc( "config", "Systemtray", ObjectDoc([("icon", "Icon name", 'string'),
("menu", "array of objects", ObjectDoc([('id', "identifier", "integer"),
("title", "name", "string")], IS_Array))
]), NO_Default, IS_Obligated ) ],
NO_Returns
)
FunctionDoc( "Window.setFrame", "Execute a callback for the next frame.",
SeesDocs( "global.window|Window|Window.requestAnimationFrame|Window.setFrame" ),
NO_Examples,
IS_Static, IS_Public, IS_Fast,
[ ParamDoc( "x_pos", "x position", "integer|string", '0|center', IS_Obligated ),
ParamDoc( "y_pos", "x position", "integer|string", '0|center', IS_Obligated ),
ParamDoc( "hh", "? position", "integer", '0', IS_Obligated ),
ParamDoc( "nn", "? position", "integer", '0', IS_Obligated ) ],
NO_Returns
)
FieldDoc( "Window.canvas", "The main canvas instance.",
SeesDocs( "global.window|Window|Canvas" ),
NO_Examples,
IS_Static, IS_Public, IS_ReadWrite,
'Canvas',
NO_Default
)
NamespaceDoc( "Navigator", "Navigator/browser description.",
SeesDocs("global.window|Window|Navigator|Window.navigator|Window.__nidium__"),
[ExampleDoc("console.log(JSON.stringify(window.navigator));")]
)
navigator = {"language": ('string', "The systems language. Currently fixed on 'us-en'."),
"vibrate": ('boolean', "Can this device vibrate (Currently fixed on 'false')."),
"appName": ('string', "The browser name (currently fixed on 'nidium')."),
"appVersion": ('string', "The browsers build version."),
"platform": ('string', "The systems version ('Win32'|'iPhone Simulator'|'iPhone'|'Macintosh'|'Mac'|'MacOSX'|'FreeBSD'|'DragonFly'|'Linux'|'Unix'|'Posix'|'Unknown')."),
"userAgent": ('string', 'The browser identification string.')
}
for i, details in navigator.items():
FieldDoc("Navigator." + i, "Details for this browser concerning: " + i + "\n" + details[1],
SeesDocs("global.window|Window|Navigator|Window.navigator"),
[ExampleDoc("console.log('" + i + " is now: ' + window.navigator." + i + ");")],
IS_Static, IS_Public, IS_Readonly,
details[0],
NO_Default
)
FieldDoc("Window.navigator", "Details for this browser.",
SeesDocs("global.window|Window|Navigator|Window.navigator|global.window"),
[ExampleDoc("console.log(JSON.stringify(window.navigator));")],
IS_Static, IS_Public, IS_Readonly,
"Navigator",
NO_Default
)
FieldDoc("Window.__nidium__", "Details for this browser's framework.",
SeesDocs("global.window|Window|Navigator|Window.navigator|Window.__nidium__|global.window"),
[ExampleDoc("console.log(JSON.stringify(window.navigator));")],
IS_Static, IS_Public, IS_Readonly,
ObjectDoc([("version", "The version of nidium", "string"),
("build", "The build identifier", "string"),
("revision", "The revision identifier", "string")]),
NO_Default
)
```
|
```ruby
# frozen_string_literal: true
module Decidim
class ReportUsersController < ApplicationController
include FormFactory
include NeedsPermission
before_action :authenticate_user!
def create
enforce_permission_to :create, :user_report
@form = form(Decidim::ReportForm).from_params(params)
CreateUserReport.call(@form, reportable) do
on(:ok) do
flash[:notice] = I18n.t("decidim.reports.create.success")
if @form.block?
redirect_to decidim_admin.new_user_block_path(user_id: reportable.id, hide: form.hide?)
else
redirect_back fallback_location: root_path
end
end
on(:invalid) do
flash[:alert] = I18n.t("decidim.reports.create.error")
redirect_back fallback_location: root_path
end
end
end
private
def reportable
@reportable ||= GlobalID::Locator.locate_signed params[:sgid]
end
def permission_class_chain
[Decidim::ReportUserPermissions, Decidim::Permissions]
end
def permission_scope
:public
end
end
end
```
|
Saint Philomena School is a private Catholic grammar school in Portsmouth, Rhode Island. The school has been designated a Blue Ribbon School of Excellence by the United States Department of Education. It is a member of the Sacred Heart Schools organization.
History
Saint Philomena School was founded in 1953 by the Sisters Faithful Companions of Jesus, and today boasts a student body of approximately 480. The school was originally located in a single building on the Narragansett Bay, but has grown over the years into a campus of five buildings, including a free-standing auditorium and a new, state-of-the-art classroom building.
Admissions
Admission is by application only, and each grade has fifty students or less. Tuition is $6,800 per year for grades K-5 and $8,250 for grades 6–8. Scholarships are available from the school and through the Roman Catholic Diocese of Providence.
Student body
Students come primarily from Aquidneck Island, Southeastern Massachusetts, and other parts of Rhode Island. Graduates of St. Philomena's go on to attend private and public high schools in Rhode Island and nearby Massachusetts, including the Portsmouth Abbey School, Bishop Connolly High School, Bishop Stang High School, St. George's School, the Wheeler School, and Moses Brown School, amongst many others.
References
External links
Diocese of Providence Catholic Schools
Diocese of Providence Blue Ribbon Schools
Private elementary schools in Rhode Island
Private middle schools in Rhode Island
Buildings and structures in Portsmouth, Rhode Island
Schools in Newport County, Rhode Island
Educational institutions established in 1953
1953 establishments in Rhode Island
|
Mahatma Mandir is a convention and exhibition centre located at sector 13 C in Gandhinagar, Gujarat, India. It is inspired from life and philosophy of Mahatma Gandhi. It is one of the biggest convention centre of India spread over an area of . It was developed by the Government of Gujarat. Business summits like Vibrant Gujarat Global Investor Summit 2011, 2013, 2015, 2017 and 2019 were organised here.
History
The Government of Gujarat wanted to develop Mahatma Mandir as a place of unity and development. Sand was brought in urns by representatives of all 18,066 villages of Gujarat and emptied in the foundation of the Mahatma Mandir. A time capsule was buried under Mahatma Mandir containing history of state in 2010 at the groundbreaking ceremony.
It was built by Larsen & Toubro (L&T) and Shapoorji Pallonji and Company Limited in two phases. The planning and design of the building is environment-friendly.
Phase 1 of Mahatma Mandir was constructed in nine months starting from May 2010 to January 2011 at cost of . It includes a convention centre, three large exhibition halls and some small halls having conferencing facility.
Phase 2 includes the construction of salt mound memorial, a garden, a suspension bridge, windmills and development of parking space at cost of .
Structures
Convention centre
A convention centre has column free air conditioned halls with capacity to accommodate over 15,000 people at a time. Its theatre style main hall have capacity of 6000 people. Exhibition halls are built over area. It has four seminar halls (three having seating capacity of 500 and one with capacity of 1000), seven high tech conference halls and a meeting room. The Mahatma Mandir Convention and Exhibition Centre by The Leela draws inspiration from the life and philosophy of Mahatma Gandhi. Spread across 34 acres, it is one of the biggest state-of-art facility in India, uniquely designed to combine a sense of aesthetics, functionality and flexibility. The 20,000 sq.m. of Convention and Exhibition area has an abundance of natural light and airy spaces and is equipped with energy efficient lighting and waste water management. The Leela Gandhinagar which is expected to be completed by early 2019 will be a 300-room 5 star hotel built inside the complex.
Memorial
A memorial dedicated to Mahatma Gandhi was constructed by Shapoorji Pallonji And Company Limited. A suspension bridge is built in memory of the Dandi March. A concrete dome structure is constructed representing salt mound houses a museum, library and research center. A sculpture garden with stone murals depicting the life of Mahatma Gandhi is also developed. A grand spinning wheel, Charkha, is installed also.
Central vista
The and road connecting Mahatma Mandir and Gujarat Legislative Assembly building was constructed. It has three lanes on both side with gardens between them. It is a broadest avenue in Gujarat.
Controversies
Total 356 families of slum dwellers were displaced by the project which resulted in controversy. They were later provided new accommodation. Some Gandhians protested against the project arguing that it did not befit philosophy of Mahatma Gandhi.
References
External links
Video of Mahatma Mandir
About Mahatma Mandir
Mahatma Mandir Photos
Convention centres in India
Gandhinagar
Buildings and structures in Gujarat
Memorials to Mahatma Gandhi
Buildings and structures in Gandhinagar
2011 establishments in Gujarat
Buildings and structures completed in 2013
|
John Curran (born September 11, 1960) is an American film director and screenwriter.
Life and career
Born in Utica, New York, Curran studied illustration and design at Syracuse University, then worked as an illustrator, graphic designer, and production designer in Manhattan before moving to Sydney, Australia in 1986. There he worked on television commercials before writing and directing the short film Down Rusty Down. For his debut feature film, the 1998 drama Praise, he was nominated for the Australian Film Institute Award for Best Direction and won the Film Critics Circle of Australia Award for Best Director and the International Critics' Award at the Toronto International Film Festival.
Six years passed before Curran tackled his next project, the independent film We Don't Live Here Anymore, for which he was nominated for the Grand Special Prize at the Deauville American Film Festival and the Grand Jury Prize at the Sundance Film Festival. He followed this two years later with The Painted Veil, the third screen adaptation of the 1925 novel by W. Somerset Maugham.
He wrote the screenplay for The Killer Inside Me, the second film adaptation of the 1952 novel by Jim Thompson. Directed by Michael Winterbottom and starring Jessica Alba, Kate Hudson, Casey Affleck, and Bill Pullman, it was filmed in Oklahoma. He also is set to direct The Beautiful and Damned, a Zelda and F. Scott Fitzgerald biopic starring Keira Knightley. In October 2012, he began filming an adaptation of Robyn Davidson's Tracks, starring Mia Wasikowska, in Australia.
He lives in Pittsford, New York.
Filmography
Feature films
Praise (1998) - Director
We Don't Live Here Anymore (2004) - Director
The Painted Veil (2006) - Director/Executive producer
The Killer Inside Me (2010) - Writer
Stone (2010) - Director
Tracks (2013) - Director
Chappaquiddick (2017) - Director
The Beautiful and the Damned (TBA) - Director
Mercy Road (2023) - Director
Short films
Down Rusty Down'' (1996) - Director
References
External links
Real Time/On Screen interview
American male screenwriters
Writers from Utica, New York
Syracuse University alumni
1960 births
Living people
People from Pittsford, New York
Film directors from New York (state)
Screenwriters from New York (state)
|
The 1973 Miami Beach firebombing occurred on February 2, 1973, when a man walked into the crowded Concord Cafeteria in Miami Beach, Florida. He poured gasoline out of a large jar, lit a match, ignited the gasoline, and ran out of the cafeteria. Three people were killed and 139 were injured, including many people who were severely burned.
Location
The Concord Cafeteria was located at 1921 Collins Avenue in Miami Beach. It was founded in 1947 by Morris Himelstein, who also owned and operated six Concord Cafeterias in New York City. It had 250 seats and served inexpensive, home style food to about 3000 diners a day, many of them retirees. It functioned as an informal social center as well as a restaurant.
The attack
On the night of February 2, 1973, a man walked into the cafeteria which was crowded with diners, poured gasoline out a jar, ignited it with a match, and ran out of the restaurant. Intense flames spread very rapidly. People attempted to escape but were obstructed by the turnstiles used to control access to the restaurant. A witness who was a worker at an adjoining restaurant said that he had "rushed out into the street and scores of old people were lying on the sidewalks and in the road moaning and screaming in lots of pain." Another witness said that he saw the interior of the restaurant in flames and "all the glass was broken and the front was gone." Victims were taken to four different hospitals suffering from burns and smoke inhalation, and fourteen people were in critical condition two days later. Three people died.
The aftermath
Twenty-two minutes after the fire began, 49 year old Charles Reardon of Bal Harbour, Florida walked into a police station, and said, "I've done something terrible. I've made a lot of people scream." After being questioned for 12 hours, Reardon was charged with arson and use of a destructive device. He was never prosecuted because he was found incompetent to be tried due to mental illness.
After several months of renovations, the Concord Cafeteria reopened. It was the last cafeteria in Miami Beach when it closed ten years later, in June, 1983.
Many lawsuits against the cafeteria were filed by victims, which were consolidated into a case called Concord Florida, Inc. v. Lewin. The trial court found the restaurant liable in 1975 and a district appeals court agreed in 1977, ruling that by "failing to adequately protect its patrons from fire by providing proper safety measures such as emergency exits and signs indicating the location of said exits, appellant-Concord assumed the foreseeable risk that fire might someday trap its patrons leaving them without an escape route."
References
Arson in Florida
Arson in the 1970s
Attacks on restaurants in North America
History of Miami Beach, Florida
|
```go
/*
path_to_url
Unless required by applicable law or agreed to in writing, software
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
package v1
import (
"strings"
"github.com/hashicorp/vault/api"
"github.com/libopenstorage/secrets"
"github.com/libopenstorage/secrets/vault"
)
var (
VaultTLSConnectionDetails = []string{api.EnvVaultCACert, api.EnvVaultClientCert, api.EnvVaultClientKey}
)
// IsEnabled return whether a KMS is configured
func (kms *KeyManagementServiceSpec) IsEnabled() bool {
return len(kms.ConnectionDetails) != 0
}
// IsTokenAuthEnabled return whether KMS token auth is enabled
func (kms *KeyManagementServiceSpec) IsTokenAuthEnabled() bool {
return kms.TokenSecretName != ""
}
// IsK8sAuthEnabled return whether KMS Kubernetes auth is enabled
func (kms *KeyManagementServiceSpec) IsK8sAuthEnabled() bool {
return getParam(kms.ConnectionDetails, vault.AuthMethod) == vault.AuthMethodKubernetes && kms.TokenSecretName == ""
}
// IsVaultKMS return whether Vault KMS is configured
func (kms *KeyManagementServiceSpec) IsVaultKMS() bool {
return getParam(kms.ConnectionDetails, "KMS_PROVIDER") == secrets.TypeVault
}
func (kms *KeyManagementServiceSpec) IsAzureMS() bool {
return getParam(kms.ConnectionDetails, "KMS_PROVIDER") == secrets.TypeAzure
}
// IsIBMKeyProtectKMS return whether IBM Key Protect KMS is configured
func (kms *KeyManagementServiceSpec) IsIBMKeyProtectKMS() bool {
return getParam(kms.ConnectionDetails, "KMS_PROVIDER") == "ibmkeyprotect"
}
// IsKMIPKMS return whether KMIP KMS is configured
func (kms *KeyManagementServiceSpec) IsKMIPKMS() bool {
return getParam(kms.ConnectionDetails, "KMS_PROVIDER") == "kmip"
}
// IsTLSEnabled return KMS TLS details are configured
func (kms *KeyManagementServiceSpec) IsTLSEnabled() bool {
for _, tlsOption := range VaultTLSConnectionDetails {
tlsSecretName := getParam(kms.ConnectionDetails, tlsOption)
if tlsSecretName != "" {
return true
}
}
return false
}
// getParam returns the value of the KMS config option
func getParam(kmsConfig map[string]string, param string) string {
if val, ok := kmsConfig[param]; ok && val != "" {
return strings.TrimSpace(val)
}
return ""
}
```
|
The four Mba languages form a small family of Ubangian languages scattered across the northern Democratic Republic of the Congo. The languages are,
Ma (A-Ma-Lo)
Dongo
Mba
Ndunga
The most populous is Mba itself, with about 40,000 speakers. Ma is the most divergent. The four Mba languages are not particularly closely related to each other and display considerable lexical diversity.
Language contact
The Mba languages have received significant influences from Bantu to the south, and from Zande languages to the north. For example, some Mba languages such as Ndunga have borrowed many noun prefixes from nearby Bantu languages (Pasch 1986, 1987, 1988).
Internal classification
Mba internal classification according to Pasch (1986):
Mba
A-Ma-Lo
Ndunga-Mba-'Dongo
'Dongo-ko
Ndunga-Mba
Ndunga-le
Mba-ne
References
Ubangian languages
|
```handlebars
<h2 class="widget__title">
{{t 'chart.duration.name'}}
</h2>
<div class="duration-widget__content chart__body"></div>
```
|
```java
/*
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing,
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* specific language governing permissions and limitations
*/
package org.apache.weex.uitest.TC_AG;
import org.apache.weex.WXPageActivity;
import org.apache.weex.util.TestFlow;
import java.util.TreeMap;
import org.junit.Before;
import org.junit.Test;
public class AG_Border_Text_Border_Bottom_Width extends TestFlow {
public AG_Border_Text_Border_Bottom_Width() {
super(WXPageActivity.class);
}
@Before
public void setUp() throws InterruptedException {
super.setUp();
TreeMap testMap = new <String, Object> TreeMap();
testMap.put("testComponet", "AG_Border");
testMap.put("testChildCaseInit", "AG_Border_Text_Border_Bottom_Width");
testMap.put("step1",new TreeMap(){
{
put("click", "0");
put("screenshot", "AG_Border_Text_Border_Bottom_Width_01_0");
}
});
testMap.put("step2",new TreeMap(){
{
put("click", "1");
put("screenshot", "AG_Border_Text_Border_Bottom_Width_02_1");
}
});
testMap.put("step3",new TreeMap(){
{
put("click", "3");
put("screenshot", "AG_Border_Text_Border_Bottom_Width_03_3");
}
});
super.setTestMap(testMap);
}
@Test
public void doTest(){
super.testByTestMap();
}
}
```
|
Pierre Lorrain (April 21, 1942 – December 24, 2004) was a lawyer and political figure in Quebec. He represented Saint-Jean in the Quebec National Assembly from 1985 to 1989 as a Liberal.
Early life and education
He was born in Farnham, Quebec, the son of Roch Lorrain and Jeanne Marcil, and was educated at the Collège Roussin and the . Lorrain was admitted to the Quebec bar in 1973 and practised law in Saint-Jean-sur-Richelieu.
Career
He was president and founder of the Haut-Richelieu Tourism bureau. Lorrain served as President of the National Assembly from 1985 to 1989. He did not run for reelection in 1989. In that year, he was named Quebec delegate-general to Brussels. Lorrain served as president of the Quebec Legal Services commission from 1994 to 1999 and for the Municipal commission from 1999 to 2004.
Personal life
Lorrain died in Saint-Jean-sur-Richelieu at the age of 62. He was survived by his wife, Johanne Desrochers.
References
1942 births
2004 deaths
French Quebecers
Quebec Liberal Party MNAs
Presidents of the National Assembly of Quebec
People from Montérégie
|
```objective-c
// planetgrid.h
//
// Longitude/latitude grids for ellipsoidal bodies.
//
// Initial version by Chris Laurel, claurel@gmail.com
//
// This program is free software; you can redistribute it and/or
// as published by the Free Software Foundation; either version 2
#pragma once
#include <celengine/referencemark.h>
#include <celrender/linerenderer.h>
class Body;
class Renderer;
class PlanetographicGrid : public ReferenceMark
{
public:
/*! Three different longitude conventions are in use for
* solar system bodies:
* Westward is for prograde rotators (rotation pole above the ecliptic)
* Eastward is for retrograde rotators
* EastWest measures longitude both east and west, and is used only
* for the Earth and Moon (strictly because of convention.)
*/
enum LongitudeConvention
{
EastWest,
Westward,
Eastward,
};
/*! NorthReversed indicates that the north pole for this body is /not/
* the rotation north. It should be set for retrograde rotators in
* order to conform with IAU conventions.
*/
enum NorthDirection
{
NorthNormal,
NorthReversed
};
PlanetographicGrid(const Body& _body);
~PlanetographicGrid() = default;
void render(Renderer* renderer,
const Eigen::Vector3f& pos,
float discSizeInPixels,
double tdb,
const Matrices& m) const override;
float boundingSphereRadius() const override;
void setIAULongLatConvention();
static void deinit();
private:
static celestia::render::LineRenderer *latitudeRenderer;
static celestia::render::LineRenderer *equatorRenderer;
static celestia::render::LineRenderer *longitudeRenderer;
static bool initialized;
static void InitializeGeometry(const Renderer&);
const Body& body;
float minLongitudeStep{ 10.0f };
float minLatitudeStep{ 10.0f };
LongitudeConvention longitudeConvention{ Westward };
NorthDirection northDirection{ NorthNormal };
};
```
|
The 1973 Cork Intermediate Football Championship was the 38th staging of the Cork Intermediate Football Championship since its establishment by the Cork County Board in 1909. The draw for the opening round fixtures took place on 28 January 1973.
The final was played on 5 August 1973 at the Athletic Grounds in Cork, between Canovee and Glanworth, in what was their first ever meeting in the final. Canovee won the match by 2-11 to 0-06 to claim their first ever championship title.
Results
Final
Championship statistics
Miscellaneous
Nine players on the Canovee team completed the double after they also lined out with Cloughduv who won the 1973 Cork IHC.
References
Cork Intermediate Football Championship
|
```xml
/*
* MTSwapChain.mm
*
*/
#include "MTSwapChain.h"
#include "MTTypes.h"
#include "RenderState/MTRenderPass.h"
#include "../TextureUtils.h"
#include "../../Core/Assertion.h"
#include <LLGL/Platform/NativeHandle.h>
#include <LLGL/TypeInfo.h>
#ifdef LLGL_OS_IOS
@implementation MTSwapChainViewDelegate
{
LLGL::Canvas* canvas_;
}
-(nonnull instancetype)initWithCanvas:(LLGL::Canvas&)canvas;
{
self = [super init];
if (self)
canvas_ = &canvas;
return self;
}
- (void)drawInMTKView:(nonnull MTKView *)view
{
if (canvas_)
canvas_->PostDraw();
}
- (void)mtkView:(nonnull MTKView *)view drawableSizeWillChange:(CGSize)size
{
// dummy
}
@end
#endif // /LLGL_OS_IOS
namespace LLGL
{
MTSwapChain::MTSwapChain(
id<MTLDevice> device,
const SwapChainDescriptor& desc,
const std::shared_ptr<Surface>& surface,
const RendererInfo& rendererInfo)
:
SwapChain { desc },
renderPass_ { device, desc }
{
/* Initialize surface for MetalKit view */
SetOrCreateSurface(surface, SwapChain::BuildDefaultSurfaceTitle(rendererInfo), desc.resolution, desc.fullscreen);
/* Allocate and initialize MetalKit view */
view_ = AllocMTKViewAndInitWithSurface(device, GetSurface());
/* Initialize color and depth buffer */
view_.framebufferOnly = NO; //TODO: make this optional with create/bind flag
view_.colorPixelFormat = renderPass_.GetColorAttachments()[0].pixelFormat;
view_.depthStencilPixelFormat = renderPass_.GetDepthStencilFormat();
view_.sampleCount = renderPass_.GetSampleCount();
/* Show default surface */
if (!surface)
ShowSurface();
}
bool MTSwapChain::IsPresentable() const
{
return true; //TODO
}
void MTSwapChain::Present()
{
/* Present backbuffer */
[view_ draw];
/* Release mutable render pass as the view's render pass changes between backbuffers */
if (nativeMutableRenderPass_ != nil)
{
[nativeMutableRenderPass_ release];
nativeMutableRenderPass_ = nil;
}
}
std::uint32_t MTSwapChain::GetCurrentSwapIndex() const
{
return 0; // dummy
}
std::uint32_t MTSwapChain::GetNumSwapBuffers() const
{
return 1; // dummy
}
std::uint32_t MTSwapChain::GetSamples() const
{
return static_cast<std::uint32_t>(renderPass_.GetSampleCount());
}
Format MTSwapChain::GetColorFormat() const
{
return MTTypes::ToFormat(view_.colorPixelFormat);
}
Format MTSwapChain::GetDepthStencilFormat() const
{
return MTTypes::ToFormat(view_.depthStencilPixelFormat);
}
const RenderPass* MTSwapChain::GetRenderPass() const
{
return (&renderPass_);
}
static NSInteger GetPrimaryDisplayRefreshRate()
{
constexpr NSInteger defaultRefreshRate = 60;
if (const Display* display = Display::GetPrimary())
return static_cast<NSInteger>(display->GetDisplayMode().refreshRate);
else
return defaultRefreshRate;
}
bool MTSwapChain::SetVsyncInterval(std::uint32_t vsyncInterval)
{
if (vsyncInterval > 0)
{
#ifdef LLGL_OS_MACOS
/* Enable display sync in CAMetalLayer */
[(CAMetalLayer*)[view_ layer] setDisplaySyncEnabled:YES];
#endif
/* Apply v-sync interval to display refresh rate */
view_.preferredFramesPerSecond = GetPrimaryDisplayRefreshRate() / static_cast<NSInteger>(vsyncInterval);
}
else
{
#ifdef LLGL_OS_MACOS
/* Disable display sync in CAMetalLayer */
[(CAMetalLayer*)[view_ layer] setDisplaySyncEnabled:NO];
#else
/* Set preferred frame rate to default value */
view_.preferredFramesPerSecond = GetPrimaryDisplayRefreshRate();
#endif
}
return true;
}
MTLRenderPassDescriptor* MTSwapChain::GetAndUpdateNativeRenderPass(
const MTRenderPass& renderPass,
std::uint32_t numClearValues,
const ClearValue* clearValues)
{
/* Create copy of native render pass descriptor for the first time */
if (nativeMutableRenderPass_ == nil)
nativeMutableRenderPass_ = [GetNativeRenderPass() copy];
/* Update mutable render pass with clear values */
if (renderPass.GetColorAttachments().size() == 1)
renderPass.UpdateNativeRenderPass(nativeMutableRenderPass_, numClearValues, clearValues);
return nativeMutableRenderPass_;
}
/*
* ======= Private: =======
*/
#ifndef LLGL_OS_IOS
static NSView* GetContentViewFromNativeHandle(const NativeHandle& nativeHandle)
{
if ([nativeHandle.responder isKindOfClass:[NSWindow class]])
{
/* Interpret responder as NSWindow */
return [(NSWindow*)nativeHandle.responder contentView];
}
if ([nativeHandle.responder isKindOfClass:[NSView class]])
{
/* Interpret responder as NSView */
return (NSView*)nativeHandle.responder;
}
LLGL_TRAP("NativeHandle::responder is neither of type NSWindow nor NSView for MTKView");
}
#endif
MTKView* MTSwapChain::AllocMTKViewAndInitWithSurface(id<MTLDevice> device, Surface& surface)
{
MTKView* mtkView = nullptr;
NativeHandle nativeHandle = {};
GetSurface().GetNativeHandle(&nativeHandle, sizeof(nativeHandle));
/* Create MetalKit view */
#ifdef LLGL_OS_IOS
LLGL_ASSERT_PTR(nativeHandle.view);
UIView* contentView = nativeHandle.view;
/* Allocate MetalKit view */
mtkView = [[MTKView alloc] initWithFrame:contentView.frame device:device];
/* Allocate view delegate to handle re-draw events */
viewDelegate_ = [[MTSwapChainViewDelegate alloc] initWithCanvas:CastTo<Canvas>(GetSurface())];
[viewDelegate_ mtkView:mtkView drawableSizeWillChange:mtkView.bounds.size];
[mtkView setDelegate:viewDelegate_];
#else // LLGL_OS_IOS
NSView* contentView = GetContentViewFromNativeHandle(nativeHandle);
/* Allocate MetalKit view */
CGRect contentViewRect = [contentView frame];
CGRect relativeViewRect = CGRectMake(0.0f, 0.0f, contentViewRect.size.width, contentViewRect.size.height);
mtkView = [[MTKView alloc] initWithFrame:relativeViewRect device:device];
#endif // /LLGL_OS_IOS
/* Add MTKView as subview and register rotate/resize layout constraints */
mtkView.translatesAutoresizingMaskIntoConstraints = NO;
NSDictionary* viewsDictionary = @{@"mtkView":mtkView};
[contentView addSubview:mtkView];
[contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|[mtkView]|" options:0 metrics:nil views:viewsDictionary]];
[contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[mtkView]|" options:0 metrics:nil views:viewsDictionary]];
return mtkView;
}
bool MTSwapChain::ResizeBuffersPrimary(const Extent2D& /*resolution*/)
{
/* Invoke a redraw to force an update on the resized multisampled framebuffer */
[view_ draw];
return true;
}
} // /namespace LLGL
// ================================================================================
```
|
```c++
/*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. 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 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.
*/
#include "config.h"
#include "core/html/parser/HTMLSrcsetParser.h"
#include "core/dom/Document.h"
#include "core/fetch/MemoryCache.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/frame/FrameConsole.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/UseCounter.h"
#include "core/html/parser/HTMLParserIdioms.h"
#include "core/inspector/ConsoleMessage.h"
#include "platform/ParsingUtilities.h"
namespace blink {
static bool compareByDensity(const ImageCandidate& first, const ImageCandidate& second)
{
return first.density() < second.density();
}
enum DescriptorTokenizerState {
TokenStart,
InParenthesis,
AfterToken,
};
struct DescriptorToken {
unsigned start;
unsigned length;
DescriptorToken(unsigned start, unsigned length)
: start(start)
, length(length)
{
}
unsigned lastIndex()
{
return start + length - 1;
}
template<typename CharType>
int toInt(const CharType* attribute, bool& isValid)
{
unsigned position = 0;
// Make sure the integer is a valid non-negative integer
// path_to_url#valid-non-negative-integer
unsigned lengthExcludingDescriptor = length - 1;
while (position < lengthExcludingDescriptor) {
if (!isASCIIDigit(*(attribute + start + position))) {
isValid = false;
return 0;
}
++position;
}
return charactersToIntStrict(attribute + start, lengthExcludingDescriptor, &isValid);
}
template<typename CharType>
float toFloat(const CharType* attribute, bool& isValid)
{
// Make sure the is a valid floating point number
// path_to_url#valid-floating-point-number
unsigned lengthExcludingDescriptor = length - 1;
if (lengthExcludingDescriptor > 0 && *(attribute + start) == '+') {
isValid = false;
return 0;
}
return charactersToFloat(attribute + start, lengthExcludingDescriptor, &isValid);
}
};
template<typename CharType>
static void appendDescriptorAndReset(const CharType* attributeStart, const CharType*& descriptorStart, const CharType* position, Vector<DescriptorToken>& descriptors)
{
if (position > descriptorStart)
descriptors.append(DescriptorToken(descriptorStart - attributeStart, position - descriptorStart));
descriptorStart = 0;
}
// The following is called appendCharacter to match the spec's terminology.
template<typename CharType>
static void appendCharacter(const CharType* descriptorStart, const CharType* position)
{
// Since we don't copy the tokens, this just set the point where the descriptor tokens start.
if (!descriptorStart)
descriptorStart = position;
}
template<typename CharType>
static bool isEOF(const CharType* position, const CharType* end)
{
return position >= end;
}
template<typename CharType>
static void tokenizeDescriptors(const CharType* attributeStart,
const CharType*& position,
const CharType* attributeEnd,
Vector<DescriptorToken>& descriptors)
{
DescriptorTokenizerState state = TokenStart;
const CharType* descriptorsStart = position;
const CharType* currentDescriptorStart = descriptorsStart;
while (true) {
switch (state) {
case TokenStart:
if (isEOF(position, attributeEnd)) {
appendDescriptorAndReset(attributeStart, currentDescriptorStart, attributeEnd, descriptors);
return;
}
if (isComma(*position)) {
appendDescriptorAndReset(attributeStart, currentDescriptorStart, position, descriptors);
++position;
return;
}
if (isHTMLSpace(*position)) {
appendDescriptorAndReset(attributeStart, currentDescriptorStart, position, descriptors);
currentDescriptorStart = position + 1;
state = AfterToken;
} else if (*position == '(') {
appendCharacter(currentDescriptorStart, position);
state = InParenthesis;
} else {
appendCharacter(currentDescriptorStart, position);
}
break;
case InParenthesis:
if (isEOF(position, attributeEnd)) {
appendDescriptorAndReset(attributeStart, currentDescriptorStart, attributeEnd, descriptors);
return;
}
if (*position == ')') {
appendCharacter(currentDescriptorStart, position);
state = TokenStart;
} else {
appendCharacter(currentDescriptorStart, position);
}
break;
case AfterToken:
if (isEOF(position, attributeEnd))
return;
if (!isHTMLSpace(*position)) {
state = TokenStart;
currentDescriptorStart = position;
--position;
}
break;
}
++position;
}
}
static void srcsetError(Document* document, String message)
{
if (document && document->frame()) {
StringBuilder errorMessage;
errorMessage.append("Failed parsing 'srcset' attribute value since ");
errorMessage.append(message);
document->frame()->console().addMessage(ConsoleMessage::create(OtherMessageSource, ErrorMessageLevel, errorMessage.toString()));
}
}
template<typename CharType>
static bool parseDescriptors(const CharType* attribute, Vector<DescriptorToken>& descriptors, DescriptorParsingResult& result, Document* document)
{
for (DescriptorToken& descriptor : descriptors) {
if (descriptor.length == 0)
continue;
CharType c = attribute[descriptor.lastIndex()];
bool isValid = false;
if (c == 'w') {
if (result.hasDensity() || result.hasWidth()) {
srcsetError(document, "it has multiple 'w' descriptors or a mix of 'x' and 'w' descriptors.");
return false;
}
int resourceWidth = descriptor.toInt(attribute, isValid);
if (!isValid || resourceWidth <= 0) {
srcsetError(document, "its 'w' descriptor is invalid.");
return false;
}
result.setResourceWidth(resourceWidth);
} else if (c == 'h') {
// This is here only for future compat purposes.
// The value of the 'h' descriptor is not used.
if (result.hasDensity() || result.hasHeight()) {
srcsetError(document, "it has multiple 'h' descriptors or a mix of 'x' and 'h' descriptors.");
return false;
}
int resourceHeight = descriptor.toInt(attribute, isValid);
if (!isValid || resourceHeight <= 0) {
srcsetError(document, "its 'h' descriptor is invalid.");
return false;
}
result.setResourceHeight(resourceHeight);
} else if (c == 'x') {
if (result.hasDensity() || result.hasHeight() || result.hasWidth()) {
srcsetError(document, "it has multiple 'x' descriptors or a mix of 'x' and 'w'/'h' descriptors.");
return false;
}
float density = descriptor.toFloat(attribute, isValid);
if (!isValid || density < 0) {
srcsetError(document, "its 'x' descriptor is invalid.");
return false;
}
result.setDensity(density);
} else {
srcsetError(document, "it has an unknown descriptor.");
return false;
}
}
bool res = !result.hasHeight() || result.hasWidth();
if (!res)
srcsetError(document, "it has an 'h' descriptor and no 'w' descriptor.");
return res;
}
static bool parseDescriptors(const String& attribute, Vector<DescriptorToken>& descriptors, DescriptorParsingResult& result, Document* document)
{
// FIXME: See if StringView can't be extended to replace DescriptorToken here.
if (attribute.is8Bit()) {
return parseDescriptors(attribute.characters8(), descriptors, result, document);
}
return parseDescriptors(attribute.characters16(), descriptors, result, document);
}
// path_to_url#parse-srcset-attr
template<typename CharType>
static void parseImageCandidatesFromSrcsetAttribute(const String& attribute, const CharType* attributeStart, unsigned length, Vector<ImageCandidate>& imageCandidates, Document* document)
{
const CharType* position = attributeStart;
const CharType* attributeEnd = position + length;
while (position < attributeEnd) {
// 4. Splitting loop: Collect a sequence of characters that are space characters or U+002C COMMA characters.
skipWhile<CharType, isHTMLSpaceOrComma<CharType>>(position, attributeEnd);
if (position == attributeEnd) {
// Contrary to spec language - descriptor parsing happens on each candidate, so when we reach the attributeEnd, we can exit.
break;
}
const CharType* imageURLStart = position;
// 6. Collect a sequence of characters that are not space characters, and let that be url.
skipUntil<CharType, isHTMLSpace<CharType>>(position, attributeEnd);
const CharType* imageURLEnd = position;
DescriptorParsingResult result;
// 8. If url ends with a U+002C COMMA character (,)
if (isComma(*(position - 1))) {
// Remove all trailing U+002C COMMA characters from url.
imageURLEnd = position - 1;
reverseSkipWhile<CharType, isComma>(imageURLEnd, imageURLStart);
++imageURLEnd;
// If url is empty, then jump to the step labeled splitting loop.
if (imageURLStart == imageURLEnd)
continue;
} else {
skipWhile<CharType, isHTMLSpace<CharType>>(position, attributeEnd);
Vector<DescriptorToken> descriptorTokens;
tokenizeDescriptors(attributeStart, position, attributeEnd, descriptorTokens);
// Contrary to spec language - descriptor parsing happens on each candidate.
// This is a black-box equivalent, to avoid storing descriptor lists for each candidate.
if (!parseDescriptors(attribute, descriptorTokens, result, document)) {
if (document) {
UseCounter::count(document, UseCounter::SrcsetDroppedCandidate);
if (document->frame())
document->frame()->console().addMessage(ConsoleMessage::create(OtherMessageSource, ErrorMessageLevel, String("Dropped srcset candidate ") + String(imageURLStart, imageURLEnd - imageURLStart)));
}
continue;
}
}
ASSERT(imageURLEnd > attributeStart);
unsigned imageURLStartingPosition = imageURLStart - attributeStart;
ASSERT(imageURLEnd > imageURLStart);
unsigned imageURLLength = imageURLEnd - imageURLStart;
imageCandidates.append(ImageCandidate(attribute, imageURLStartingPosition, imageURLLength, result, ImageCandidate::SrcsetOrigin));
// 11. Return to the step labeled splitting loop.
}
}
static void parseImageCandidatesFromSrcsetAttribute(const String& attribute, Vector<ImageCandidate>& imageCandidates, Document* document)
{
if (attribute.isNull())
return;
if (attribute.is8Bit())
parseImageCandidatesFromSrcsetAttribute<LChar>(attribute, attribute.characters8(), attribute.length(), imageCandidates, document);
else
parseImageCandidatesFromSrcsetAttribute<UChar>(attribute, attribute.characters16(), attribute.length(), imageCandidates, document);
}
static unsigned selectionLogic(Vector<ImageCandidate*>& imageCandidates, float deviceScaleFactor)
{
unsigned i = 0;
for (; i < imageCandidates.size() - 1; ++i) {
unsigned next = i + 1;
float nextDensity;
float currentDensity;
float geometricMean;
nextDensity = imageCandidates[next]->density();
if (nextDensity < deviceScaleFactor)
continue;
currentDensity = imageCandidates[i]->density();
geometricMean = sqrt(currentDensity * nextDensity);
if (((deviceScaleFactor <= 1.0) && (deviceScaleFactor > currentDensity)) || (deviceScaleFactor >= geometricMean))
return next;
break;
}
return i;
}
static unsigned avoidDownloadIfHigherDensityResourceIsInCache(Vector<ImageCandidate*>& imageCandidates, unsigned winner, Document* document)
{
if (!document)
return winner;
for (unsigned i = imageCandidates.size() - 1; i > winner; --i) {
KURL url = document->completeURL(stripLeadingAndTrailingHTMLSpaces(imageCandidates[i]->url()));
if (memoryCache()->resourceForURL(url, document->fetcher()->getCacheIdentifier()))
return i;
}
return winner;
}
static ImageCandidate pickBestImageCandidate(float deviceScaleFactor, float sourceSize, Vector<ImageCandidate>& imageCandidates, Document* document = nullptr)
{
const float defaultDensityValue = 1.0;
bool ignoreSrc = false;
if (imageCandidates.isEmpty())
return ImageCandidate();
// path_to_url#normalize-source-densities
for (ImageCandidate& image : imageCandidates) {
if (image.resourceWidth() > 0) {
image.setDensity((float)image.resourceWidth() / sourceSize);
ignoreSrc = true;
} else if (image.density() < 0) {
image.setDensity(defaultDensityValue);
}
}
std::stable_sort(imageCandidates.begin(), imageCandidates.end(), compareByDensity);
Vector<ImageCandidate*> deDupedImageCandidates;
float prevDensity = -1.0;
for (ImageCandidate& image : imageCandidates) {
if (image.density() != prevDensity && (!ignoreSrc || !image.srcOrigin()))
deDupedImageCandidates.append(&image);
prevDensity = image.density();
}
unsigned winner = selectionLogic(deDupedImageCandidates, deviceScaleFactor);
ASSERT(winner < deDupedImageCandidates.size());
winner = avoidDownloadIfHigherDensityResourceIsInCache(deDupedImageCandidates, winner, document);
float winningDensity = deDupedImageCandidates[winner]->density();
// 16. If an entry b in candidates has the same associated ... pixel density as an earlier entry a in candidates,
// then remove entry b
while ((winner > 0) && (deDupedImageCandidates[winner - 1]->density() == winningDensity))
--winner;
return *deDupedImageCandidates[winner];
}
ImageCandidate bestFitSourceForSrcsetAttribute(float deviceScaleFactor, float sourceSize, const String& srcsetAttribute, Document* document)
{
Vector<ImageCandidate> imageCandidates;
parseImageCandidatesFromSrcsetAttribute(srcsetAttribute, imageCandidates, document);
return pickBestImageCandidate(deviceScaleFactor, sourceSize, imageCandidates, document);
}
ImageCandidate bestFitSourceForImageAttributes(float deviceScaleFactor, float sourceSize, const String& srcAttribute, const String& srcsetAttribute, Document* document)
{
if (srcsetAttribute.isNull()) {
if (srcAttribute.isNull())
return ImageCandidate();
return ImageCandidate(srcAttribute, 0, srcAttribute.length(), DescriptorParsingResult(), ImageCandidate::SrcOrigin);
}
Vector<ImageCandidate> imageCandidates;
parseImageCandidatesFromSrcsetAttribute(srcsetAttribute, imageCandidates, document);
if (!srcAttribute.isEmpty())
imageCandidates.append(ImageCandidate(srcAttribute, 0, srcAttribute.length(), DescriptorParsingResult(), ImageCandidate::SrcOrigin));
return pickBestImageCandidate(deviceScaleFactor, sourceSize, imageCandidates, document);
}
String bestFitSourceForImageAttributes(float deviceScaleFactor, float sourceSize, const String& srcAttribute, ImageCandidate& srcsetImageCandidate)
{
if (srcsetImageCandidate.isEmpty())
return srcAttribute;
Vector<ImageCandidate> imageCandidates;
imageCandidates.append(srcsetImageCandidate);
if (!srcAttribute.isEmpty())
imageCandidates.append(ImageCandidate(srcAttribute, 0, srcAttribute.length(), DescriptorParsingResult(), ImageCandidate::SrcOrigin));
return pickBestImageCandidate(deviceScaleFactor, sourceSize, imageCandidates).toString();
}
}
```
|
```go
// Code generated by smithy-go-codegen DO NOT EDIT.
package ec2
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/service/ec2/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Describes the VPC endpoint connections to your VPC endpoint services, including
// any endpoints that are pending your acceptance.
func (c *Client) DescribeVpcEndpointConnections(ctx context.Context, params *DescribeVpcEndpointConnectionsInput, optFns ...func(*Options)) (*DescribeVpcEndpointConnectionsOutput, error) {
if params == nil {
params = &DescribeVpcEndpointConnectionsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeVpcEndpointConnections", params, optFns, c.addOperationDescribeVpcEndpointConnectionsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeVpcEndpointConnectionsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeVpcEndpointConnectionsInput struct {
// Checks whether you have the required permissions for the action, without
// actually making the request, and provides an error response. If you have the
// required permissions, the error response is DryRunOperation . Otherwise, it is
// UnauthorizedOperation .
DryRun *bool
// The filters.
//
// - ip-address-type - The IP address type ( ipv4 | ipv6 ).
//
// - service-id - The ID of the service.
//
// - vpc-endpoint-owner - The ID of the Amazon Web Services account ID that owns
// the endpoint.
//
// - vpc-endpoint-state - The state of the endpoint ( pendingAcceptance | pending
// | available | deleting | deleted | rejected | failed ).
//
// - vpc-endpoint-id - The ID of the endpoint.
Filters []types.Filter
// The maximum number of results to return for the request in a single page. The
// remaining results of the initial request can be seen by sending another request
// with the returned NextToken value. This value can be between 5 and 1,000; if
// MaxResults is given a value larger than 1,000, only 1,000 results are returned.
MaxResults *int32
// The token to retrieve the next page of results.
NextToken *string
noSmithyDocumentSerde
}
type DescribeVpcEndpointConnectionsOutput struct {
// The token to use to retrieve the next page of results. This value is null when
// there are no more results to return.
NextToken *string
// Information about the VPC endpoint connections.
VpcEndpointConnections []types.VpcEndpointConnection
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeVpcEndpointConnectionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
return err
}
err = stack.Serialize.Add(&awsEc2query_serializeOpDescribeVpcEndpointConnections{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsEc2query_deserializeOpDescribeVpcEndpointConnections{}, middleware.After)
if err != nil {
return err
}
if err := addProtocolFinalizerMiddlewares(stack, options, "DescribeVpcEndpointConnections"); err != nil {
return fmt.Errorf("add protocol finalizers: %v", err)
}
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
return err
}
if err = addSetLoggerMiddleware(stack, options); err != nil {
return err
}
if err = addClientRequestID(stack); err != nil {
return err
}
if err = addComputeContentLength(stack); err != nil {
return err
}
if err = addResolveEndpointMiddleware(stack, options); err != nil {
return err
}
if err = addComputePayloadSHA256(stack); err != nil {
return err
}
if err = addRetry(stack, options); err != nil {
return err
}
if err = addRawResponseToMetadata(stack); err != nil {
return err
}
if err = addRecordResponseTiming(stack); err != nil {
return err
}
if err = addClientUserAgent(stack, options); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
return err
}
if err = addTimeOffsetBuild(stack, c); err != nil {
return err
}
if err = addUserAgentRetryMode(stack, options); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeVpcEndpointConnections(options.Region), middleware.Before); err != nil {
return err
}
if err = addRecursionDetection(stack); err != nil {
return err
}
if err = addRequestIDRetrieverMiddleware(stack); err != nil {
return err
}
if err = addResponseErrorMiddleware(stack); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
return err
}
return nil
}
// DescribeVpcEndpointConnectionsPaginatorOptions is the paginator options for
// DescribeVpcEndpointConnections
type DescribeVpcEndpointConnectionsPaginatorOptions struct {
// The maximum number of results to return for the request in a single page. The
// remaining results of the initial request can be seen by sending another request
// with the returned NextToken value. This value can be between 5 and 1,000; if
// MaxResults is given a value larger than 1,000, only 1,000 results are returned.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeVpcEndpointConnectionsPaginator is a paginator for
// DescribeVpcEndpointConnections
type DescribeVpcEndpointConnectionsPaginator struct {
options DescribeVpcEndpointConnectionsPaginatorOptions
client DescribeVpcEndpointConnectionsAPIClient
params *DescribeVpcEndpointConnectionsInput
nextToken *string
firstPage bool
}
// NewDescribeVpcEndpointConnectionsPaginator returns a new
// DescribeVpcEndpointConnectionsPaginator
func NewDescribeVpcEndpointConnectionsPaginator(client DescribeVpcEndpointConnectionsAPIClient, params *DescribeVpcEndpointConnectionsInput, optFns ...func(*DescribeVpcEndpointConnectionsPaginatorOptions)) *DescribeVpcEndpointConnectionsPaginator {
if params == nil {
params = &DescribeVpcEndpointConnectionsInput{}
}
options := DescribeVpcEndpointConnectionsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeVpcEndpointConnectionsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeVpcEndpointConnectionsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeVpcEndpointConnections page.
func (p *DescribeVpcEndpointConnectionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeVpcEndpointConnectionsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
optFns = append([]func(*Options){
addIsPaginatorUserAgent,
}, optFns...)
result, err := p.client.DescribeVpcEndpointConnections(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
// DescribeVpcEndpointConnectionsAPIClient is a client that implements the
// DescribeVpcEndpointConnections operation.
type DescribeVpcEndpointConnectionsAPIClient interface {
DescribeVpcEndpointConnections(context.Context, *DescribeVpcEndpointConnectionsInput, ...func(*Options)) (*DescribeVpcEndpointConnectionsOutput, error)
}
var _ DescribeVpcEndpointConnectionsAPIClient = (*Client)(nil)
func newServiceMetadataMiddleware_opDescribeVpcEndpointConnections(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
OperationName: "DescribeVpcEndpointConnections",
}
}
```
|
The Neal Clothing Building is the oldest existing building on the central square of Lima, Ohio, United States. Built before the end of the Civil War, it has been recognized as historically significant as a representative of the city's earliest period.
Architecture
This two-story brick building lies on the northeastern corner of Public Square at the heart of the city. Among its distinctive architectural features are three rounded arch windows with sash panes, metal brackets, and multiple finials. Although some of the facade has been modified, an original metal awning covers the recessed entrance.
Historic context
The Neal Clothing Building is the sole surviving building from downtown Lima's earliest period, and it appears in even the oldest pictures of the northeastern corner of the square. At this time, the city's economy was dependent primarily on the agriculture of the surrounding countryside. During the 1870s, the city's commerce grew as railroads expanded into the area, and several large commercial buildings, including the still-standing Union Block, were built on Public Square during this time. Further growth occurred after petroleum was found in the city's vicinity in 1885; as Lima's population grew 300% from 1880 to 1900, the need for larger buildings was apparent, and many ornate commercial structures were erected in the city during this period. As the boom continued into the twentieth century, other significant buildings were erected on Public Square, including the First National Bank and Trust Building.
Historic landmark
In 1982, the Neal Clothing Building was listed on the National Register of Historic Places because of its historic architecture. Sixteen other downtown buildings, all newer, were added to the Register at the same time as part of the "Lima Multiple Resource Area," a collection of architecturally-significant buildings.
References
Commercial buildings completed in 1865
Buildings and structures in Lima, Ohio
National Register of Historic Places in Allen County, Ohio
Commercial buildings on the National Register of Historic Places in Ohio
Romanesque Revival architecture in Ohio
|
Faqirabad (, also Romanized as Faqīrābād; also known as Faghir Abad) is a village in Rud Ab-e Sharqi Rural District, Rud Ab District, Narmashir County, Kerman Province, Iran. At the 2006 census, its population was 387, in 96 families.
References
Populated places in Narmashir County
|
Somewhere is the second studio album by American indie pop band Sun June. It was released on February 5, 2021, by Run for Cover Records.
Release
On September 2, 2020, the band announced they had signed to Run for Cover Records, and released the first single "Singing". Speaking about the single, lead vocalist Laura Colwell explained: "Singing is our groundhog day song. It’s about being stuck in an old argument with your partner, wishing you both saw the world the same way. The video expands on that idea by cycling through various mundane ruts we can get caught in. We also explore around our Austin neighborhood, where they’re tearing stuff down and building stuff up."
The second single "Karen O" was released on October 13, 2020. The band said the single "is one of the only songs we've written that takes place over the course of a single night, and we hope we captured what it feels like when you're completely worn out but can't bring yourself to go home and go to sleep. It's about the kind of night you let heartache swallow you whole, and you find yourself heading straight toward the things you should be running away from."
The third single "Bad Girl" was released on December 10, 2020. Speaking to Paste, the band said of the single: "There’s something pushing and pulling between the lyrics and the beat, so we thought a dance video might draw out some internal tension. We filmed around Lockhart, Texas, where we recorded the album, because there are so many farms and fields out there that are unchanged despite the area’s growth."
On January 10, 2021, Sun June released their fourth single "Everything I Had".
Critical reception
Somewhere was met with "generally favorable" reviews from critics. At Metacritic, which assigns a weighted average rating out of 100 to reviews from mainstream publications, this release received an average score of 73 based on 7 reviews.
In a review for AllMusic, Marcy Donelson wrote: "With the feather-light vocals, sustained keyboard hum, and unadorned kick drum that open Somewhere, Sun June seem to pick up right where their stark and gentle 2018 debut, Years, left off. As it progresses, however, the sophomore album ventures into more-fully arranged, five-piece territory - potentially six with the touches of synths and percussion by producer Danny Reisch - a benchmark that wasn't reached on a debut recorded while some members were still learning their instruments." Hal Horowitz of American Songwriter said: "The eleven songs on the band’s second album stay on low boil as perfect vehicles for singer Laura Colwell’s airy, diffuse, often sexually charged, evocatively whispered vocals. The pensive music is a vehicle for haunting lyrics that examine love from the eyes of the participants who are caught up in the joy of newfound romance while somewhat leery and unsure about where it’s headed" Writing for The Line of Best Fit, Jay Singh gave the album an eight out of ten, praising "Colwell"s light, airy vocals", and the "heavenly melodies" of the guitars.
Track listing
Personnel
Musicians
Michael Bain − guitar
Stephen Salisbury – guitar
Justin Harris – bass
Laura Colwell – guitar, keyboards, vocals
Sarah Schultz – drums
Production
Danny Reisch – engineer, mixing, producer
Evan Kaspar – engineer
Matt Gerhard – engineer
References
External links
Somewhere at Run for Cover Records
2021 albums
Run for Cover Records albums
|
```html
<button
mat-button
color="accent"
(click)="openDraggableResizableWindowDialog()"
class="text-upper push-right-sm"
>
Open Draggable Resizable Window Dialog
</button>
```
|
Eretum (Greek: ), was an ancient town of the Sabines, situated on the Via Salaria, at its junction with the Via Nomentana, a short distance from the Tiber, and about from Rome.
History
Eretum lay near the frontier between Roman and Sabine territory in the regal period and early Republic. Solinus writes that it was established by Greeks in honor of Hera, and thus the name of the city (which he calls "Heretum") derives from her name. From the mention of its name by Virgil among the Sabine cities which joined in the war against Aeneas, we may presume that it was considered as an ancient town, and one of some importance in early times.
Eretum never bears any prominent part in history, though from its frontier position on the line by which the former people must advance upon Rome, it was the scene of repeated conflicts between the two nations. The first of these occurred in the reign of Tullus Hostilius, during the war of that monarch with the Sabines; his successor Tarquinius Priscus also defeated the Etruscans, who had taken advantage of the friendly disposition of the Sabines to advance through their territory, at Eretum; and Tarquinius Superbus gained a decisive victory over the Sabines in the same neighbourhood. Under the Roman republic also we find two victories recorded over the Sabines at the same place, the one by the consuls Postumius and Menenius in 503 BCE, the other by Gaius Nautius Rutilus in 458 BCE. During the decemvirate also the Sabines established their headquarters at Eretum, whence they ravaged the Roman territory. It is again mentioned in the Second Punic War as the place whence Hannibal diverged to attack the shrine of Feronia in Etruria, during his advance on Rome (or, according to others, on his retreat) by the Salarian Way. But though its position thus brings it frequently into notice, it is clear that it was, under the Roman dominion at least, a very inconsiderable place. Strabo says it was little more than a village, and Valerius Maximus terms it vicus Sabinae regionis. Pliny does not even mention it among the towns of the Sabines, nor is its name found in the Liber Coloniarum: hence it is almost certain that it did not enjoy municipal privileges, and was dependent on one of the neighbouring towns, probably Nomentum (modern Mentana). But its name is still found in the Itineraries as a station on the Salarian Way, and it must therefore have continued to exist as late as the fourth century. From this time all trace of it disappears.
Location
The position of Eretum has been a subject of much dispute, though the data furnished by ancient authorities are sufficiently precise. The Itineraries place it 18 Roman miles from Rome; and Dionysius in one passage calls it 140 stadia (ca. ) from the city, though in another place he gives the same distance at only 107 stadia. Strabo adds that it was situated at the point of junction of the Via Salaria and Via Nomentana; a circumstance which could leave no doubt as to its position, but that there is some difficulty in tracing the exact course of the Via Salaria, which appears to have undergone repeated changes in ancient times. Hence Abbé Capmartin De Chaupy was led to fix the site of Eretum at a place called Rimane, where there were some Roman ruins near a bridge called the Ponte di Casa Cotta, but this spot is not less than 21 miles from Rome; on the other hand, Monterotondo, the site chosen by Cluverius, is little more than 15 miles from Rome, and could never by possibility have been on the Via Nomentana. Grotta Marozza (a località of the comune of Mentana), on the left hand of the Via Nomentana, rather more than 3 miles beyond Nomentum, has therefore decidedly the best claim: it is 17.5 miles from Rome, and it is probable that the ancient Via Salaria did not follow the same line with the modern road of that name, but left the valley of the Tiber near Monte Rotondo, and joined the Via Nomentana near the spot above indicated. There are no ruins at Grotta Marozza, but the site is described as well-adapted for that of a town of small extent.
At a short distance from Grotta Marozza are some sulphureous springs now known as the Bagni di Grotta Marozza, which are in all probability those anciently known as the Aquae Labanae (the of Strabo, who describes them as situated in the neighbourhood of Eretum).
References
Sabine cities
Former populated places in Italy
|
The 2016–17 LSU Tigers basketball team represented Louisiana State University during the 2016–17 NCAA Division I men's basketball season. The team's head coach was Johnny Jones, who was in his fifth season at LSU. They played their home games at the Pete Maravich Assembly Center in Baton Rouge, Louisiana, as a member of the Southeastern Conference. They finished the season 10–21, 2–16 in SEC play to finish in a tie for 13th place. They lost in the First Round of the SEC tournament to Mississippi State.
On March 10, head coach Johnny Jones was fired. He finished at LSU with a five-year record of 90–72. On March 20, LSU hired VCU head coach Will Wade as their next head coach.
Previous season
The LSU Tigers finished the season 19–14, 11–7 in SEC play to finish in a three-way tie for third place. They defeated Tennessee in the quarterfinals of the 2016 SEC tournament to advance to the semifinals where they lost to Texas A&M. On March 13, the day after losing to Texas A&M by 33 points, they announced they would not participate in a postseason tournament.
Offseason
Departures
Incoming transfers
Class of 2016 signees
Class of 2017 signees
Roster
Schedule and results
|-
!colspan=12 style="background:#461D7C; color:white;"| Exhibition
|-
!colspan=12 style=|Regular season
|-
!colspan=12 style=| SEC Tournament
Source:
See also
2016–17 LSU Lady Tigers basketball team
References
LSU Tigers men's basketball seasons
Lsu
LSU
LSU
|
```go
//
// 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 encoding
import (
"fmt"
"math"
"testing"
"github.com/stretchr/testify/require"
)
func TestUint32(t *testing.T) {
tests := []struct {
x uint32
}{
{
x: 0,
},
{
x: 42,
},
{
x: math.MaxUint32,
},
}
for _, test := range tests {
name := fmt.Sprintf("Encode and Decode %d", test.x)
t.Run(name, func(t *testing.T) {
enc := NewEncoder(1024)
n := enc.PutUint32(test.x)
require.Equal(t, 4, n)
dec := NewDecoder(enc.Bytes())
actual, err := dec.Uint32()
require.NoError(t, err)
require.Equal(t, test.x, actual)
})
}
}
func TestUint64(t *testing.T) {
tests := []struct {
x uint64
}{
{
x: 0,
},
{
x: 42,
},
{
x: math.MaxUint64,
},
}
for _, test := range tests {
name := fmt.Sprintf("Encode and Decode %d", test.x)
t.Run(name, func(t *testing.T) {
enc := NewEncoder(1024)
n := enc.PutUint64(test.x)
require.Equal(t, 8, n)
dec := NewDecoder(enc.Bytes())
actual, err := dec.Uint64()
require.NoError(t, err)
require.Equal(t, test.x, actual)
})
}
}
func TestUvarint(t *testing.T) {
tests := []struct {
x uint64
n int
}{
{
x: 0,
n: 1,
},
{
x: 42,
n: 1,
},
{
x: math.MaxUint64,
n: 10,
},
}
for _, test := range tests {
name := fmt.Sprintf("Encode and Decode %d", test.n)
t.Run(name, func(t *testing.T) {
enc := NewEncoder(1024)
n := enc.PutUvarint(test.x)
require.Equal(t, test.n, n)
dec := NewDecoder(enc.Bytes())
actual, err := dec.Uvarint()
require.NoError(t, err)
require.Equal(t, test.x, actual)
})
}
}
func TestBytes(t *testing.T) {
tests := []struct {
name string
b []byte
n int
}{
{
name: "Encode and Decode Empty Byte Slice",
b: []byte(""),
n: 1,
},
{
name: "Encode and Decode Non-Empty Byte Slice",
b: []byte("foo bar baz"),
n: 12,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
enc := NewEncoder(1024)
n := enc.PutBytes(test.b)
require.Equal(t, test.n, n)
dec := NewDecoder(enc.Bytes())
actual, err := dec.Bytes()
require.NoError(t, err)
require.Equal(t, test.b, actual)
})
}
}
func TestEncoderLen(t *testing.T) {
enc := NewEncoder(1024)
enc.PutUint32(42)
require.Equal(t, 4, enc.Len())
enc.PutUint64(42)
require.Equal(t, 4+8, enc.Len())
enc.PutUvarint(42)
require.Equal(t, 4+8+1, enc.Len())
enc.PutBytes([]byte("42"))
require.Equal(t, 4+8+1+3, enc.Len())
}
func TestEncoderReset(t *testing.T) {
enc := NewEncoder(1024)
enc.PutUint32(42)
enc.Reset()
b := enc.Bytes()
require.Equal(t, 0, len(b))
}
func TestDecoderReset(t *testing.T) {
enc := NewEncoder(1024)
enc.PutUint32(42)
b := enc.Bytes()
dec := NewDecoder(nil)
dec.Reset(b)
require.Equal(t, b, dec.buf)
}
```
|
```c
/*
*
*/
#include <zephyr/ztest.h>
#include <zephyr/device.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/sys/timeutil.h>
#include <time.h>
#include <string.h>
/* Wed Dec 31 2025 23:59:55 GMT+0000 */
#define RTC_TEST_GET_SET_TIME (1767225595UL)
#define RTC_TEST_GET_SET_TIME_TOL (1UL)
static const struct device *rtc = DEVICE_DT_GET(DT_ALIAS(rtc));
ZTEST(rtc_api, test_set_get_time)
{
struct rtc_time datetime_set;
struct rtc_time datetime_get;
time_t timer_get;
time_t timer_set = RTC_TEST_GET_SET_TIME;
gmtime_r(&timer_set, (struct tm *)(&datetime_set));
datetime_set.tm_isdst = -1;
datetime_set.tm_nsec = 0;
memset(&datetime_get, 0xFF, sizeof(datetime_get));
zassert_equal(rtc_set_time(rtc, &datetime_set), 0, "Failed to set time");
zassert_equal(rtc_get_time(rtc, &datetime_get), 0,
"Failed to get time using rtc_time_get()");
zassert_true((datetime_get.tm_sec > -1) && (datetime_get.tm_sec < 60),
"Invalid tm_sec");
zassert_true((datetime_get.tm_min > -1) && (datetime_get.tm_min < 60),
"Invalid tm_min");
zassert_true((datetime_get.tm_hour > -1) && (datetime_get.tm_hour < 24),
"Invalid tm_hour");
zassert_true((datetime_get.tm_mday > 0) && (datetime_get.tm_mday < 32),
"Invalid tm_mday");
zassert_true((datetime_get.tm_year > 124) && (datetime_get.tm_year < 127),
"Invalid tm_year");
zassert_true((datetime_get.tm_wday > -2) && (datetime_get.tm_wday < 7),
"Invalid tm_wday");
zassert_true((datetime_get.tm_yday > -2) && (datetime_get.tm_yday < 366),
"Invalid tm_yday");
zassert_equal(datetime_get.tm_isdst, -1, "Invalid tm_isdst");
zassert_true((datetime_get.tm_nsec > -1) && (datetime_get.tm_yday < 1000000000),
"Invalid tm_yday");
timer_get = timeutil_timegm((struct tm *)(&datetime_get));
zassert_true((timer_get >= RTC_TEST_GET_SET_TIME) &&
(timer_get <= (RTC_TEST_GET_SET_TIME + RTC_TEST_GET_SET_TIME_TOL)),
"Got unexpected time");
}
```
|
```javascript
module.exports = function (api) {
api.cache(true);
return {
presets: [
[
require('@babel/preset-env'),
{
modules: false, // Disable the default `modules-commonjs`, to enable lazy evaluation
targets: {
node: '18.0.0',
},
},
],
require('@babel/preset-typescript'),
],
plugins: [
require('babel-plugin-dynamic-import-node'),
require('@babel/plugin-transform-export-namespace-from'),
[
require('@babel/plugin-transform-modules-commonjs'),
{
lazy: () => true,
},
],
],
};
};
```
|
Julien Ielsch (born 5 March 1983) is a French former professional footballer who played as a defender.
He played on the professional level in Swiss Super League for Neuchâtel Xamax and in Ligue 2 for Stade Reims.
External links
Julien Ielsch profile at Foot-National.com
1983 births
Living people
Sportspeople from Belfort
Footballers from the Territoire de Belfort
French men's footballers
Men's association football defenders
FC Sochaux-Montbéliard players
Neuchâtel Xamax FCS players
Stade de Reims players
Amiens SC players
Red Star F.C. players
Swiss Super League players
Ligue 1 players
Ligue 2 players
Championnat National players
French expatriate men's footballers
French expatriate sportspeople in Switzerland
Expatriate men's footballers in Switzerland
|
```c
/**
* @license Apache-2.0
*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
#include "stdlib/math/base/special/cosh.h"
#include <stdio.h>
int main( void ) {
const double x[] = { -5.0, -3.89, -2.78, -1.67, -0.56, 0.56, 1.67, 2.78, 3.89, 5.0 };
double v;
int i;
for ( i = 0; i < 10; i++ ) {
v = stdlib_base_cosh( x[ i ] );
printf( "cosh(%lf) = %lf\n", x[ i ], v );
}
}
```
|
Aleksandra Mitrofanovna Beļcova (, 17 March 1892 – 1 February 1981) was a Latvian-Russian painter.
Biography
Aleksandra Beļcova graduated women gymnasium in Novozybkov in 1912. Later she started studies in Penza city art school which she graduated in 1917. While in Penza she met several Latvian painters who studied there as a refugees. Among them were Jēkabs Kazaks, Konrāds Ubāns and Voldemārs Tone. Especially close relationships developed between her and Romans Suta, another Latvian painter who studied in Penza.
In 1917 she went to Petrograd and studied in State Free Art Workshop under Nathan Altman. It was in Petrograd where her first solo exhibition was held in 1919. Just after the exhibition she moved to Latvia along with Romans Suta and became a members of the Riga Artists Group. The couple married in 1922 in Riga and after marriage they visited Paris, Berlin and Dresden. In 1923 their daughter Tatiana was born in Paris. In 1925 she painted The White and the Black.
She was involved in the Roller group exhibitions and Riga Graphic Artists Association in the following years. Her paintings were mostly portraits and still lifes, beginning as a Cubist she turned to realism in later years. Her mediums were oil, watercolor, graphic arts and she also painted on porcelain.
Beļcova died on 1 February 1981.
The home of Aleksandra Belcova and Romans Suta in Elizabetes street 57A-26 in Riga is now turned into memorial museum and art gallery.
References
External links
Museum of Romans Suta and Aleksandra Belcova at Google Cultural Institute
1892 births
1981 deaths
People from Surazh
People from Chernigov Governorate
20th-century Russian painters
Russian women painters
20th-century Russian women artists
Latvian women painters
20th-century Latvian painters
20th-century Latvian women artists
|
Solana Shopping Park () is a large shopping complex in the north west corner of Chaoyang Park in Beijing's Chaoyang District.
The center was opened in December of 2008 and hosts more than 500 retailers and restaurants.
Solana Shopping Park is part of the Blue Harbor Commercial Facilities project, run by Beijing Blue Harbor Real Estate Co., Ltd. The parcel that includes the shopping park was purchased in 2004 for RMB 1.008 billion.
References
External links
Website (in Chinese)
Website (in English
2008 establishments in China
Buildings and structures in Chaoyang District, Beijing
Shopping malls in Beijing
Shopping malls established in 2008
|
```javascript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _withAndroidAdMob() {
const data = require("./withAndroidAdMob");
_withAndroidAdMob = function () {
return data;
};
return data;
}
function _withIosAdMob() {
const data = require("./withIosAdMob");
_withIosAdMob = function () {
return data;
};
return data;
}
function _createLegacyPlugin() {
const data = require("../createLegacyPlugin");
_createLegacyPlugin = function () {
return data;
};
return data;
}
var _default = exports.default = (0, _createLegacyPlugin().createLegacyPlugin)({
packageName: 'expo-ads-admob',
fallback: [_withAndroidAdMob().withAndroidAdMob, _withIosAdMob().withIosAdMob]
});
//# sourceMappingURL=expo-ads-admob.js.map
```
|
The core of the security and intelligence system of the Republic of Croatia consists of two security and intelligence agencies:
Security and Intelligence Agency (Croatian: Sigurnosno-obavještajna agencija or SOA),
Military Security and Intelligence Agency (Croatian: Vojna sigurnosno-obavještajna agencija or VSOA) and
These agencies conduct their activities in accordance with the Constitution, relevant national legislation, the National Security Strategy, the Defence Strategy and the Annual Guidelines for the Work of Security Services. Their work is subject to the scrutiny by the Croatian Parliament, the President of the Republic, the Government, the Office of the National Security Council and the Council for the civilian scrutiny of the security intelligence agencies.
The community of intelligence agencies, military and civilian, was established by Croatia during the Croatian war of Independence, becoming integral to the Croatian war effort against Yugoslav and Serbian forces. Their total estimated spending is $66,694,656.84.
Organization
According to the Constitution of Croatia, the President of the Republic and the Prime Minister cooperate in directing the operations of the security services. The appointment of directors of security agencies is counter-signed by the President and the Prime Minister, upon a prior opinion of the Domestic Policy and National Security Committee of the Croatian Parliament.
National Security Council
Tasks of cooperation between President of the Republic and the Prime Minister in directing the work of security and intelligence agencies, is within the competence of the National Security Council (Vijeće za nacionalnu sigurnost). Members of NSC are the President of the Republic, the President of the Government, Minister of Defense, Minister of the Interior, Minister of Foreign Affairs and European Integration, Minister of Justice, National Security Advisor to the President of the Republic, the Chief of the General Staff of the Armed Forces of the Republic of Croatia, the Head of UVNS, the Directors of SOA and VSOA, the President of the Parliament also takes part in its work, and if necessary other people as well.
Council for the Coordination of Security and Intelligence Services
The Council for the Coordination of Security Intelligence Services (Savjet za koordinaciju sigurnosno-obavještajnih agencija) is responsible for the operational coordination of the work of security intelligence agencies. Members of the Council are the Member of the Government responsible for national security, as the Chairperson of the Council; the National Security Advisor to the President of the Republic, as Deputy Chairperson; the Directors of security and intelligence agencies and the Head of UVNS. If necessary, other persons from judicial, police, inspection, oversight and other entities and institutions may take part in the meetings of the Council.
Office of the National Security Council
The Office of the National Security Council (Ured Vijeća za nacionalnu sigurost or UVNS) is the body of the Croatian security and intelligence system which provides support in the field of national security for major state institutions. The UVNS has three major duties: support for the National Security Council and Council for the Coordination of Security Services; analysis of the Agencies' reports and expert scrutiny of the work of the security and intelligence agencies and OTC; information security - NSA.
Security and Intelligence Agency
The Security and Intelligence Agency (SOA) systematically collects, analyzes and processes data significant for the national security. SOA endeavours to detect and prevent activities aimed at threatening the independence and sovereignty of the Republic of Croatia, violent subversion of state authorities, basic freedom and human rights guaranteed by the Constitution and other laws, and the basic economic system of the Republic of Croatia.
Abroad, SOA systematically collects, analyzes, processes and evaluates the political, economic, security and military data relating to foreign countries, international governmental and non-governmental organizations, political, military and economic alliances, groups and individuals exhibiting intentions, capabilities, covert plans and secret activities aimed at threatening the national security.
Military Security and Intelligence Agency
The Military Security and Intelligence Agency (VSOA) is a unit that falls within the Ministry of Defence. In its intelligence operations VSOA collects, analyzes, processes and evaluates data on military forces and defence systems of other countries, on external pressures which may influence the defence security, as well as on activities abroad, aimed at threatening the defence security of the country. VSOA, on the territory of the Republic of Croatia, collects, analyzes processes and evaluates data on the intentions, capabilities and plans made by persons, groups, and organizations in the country with the intention of threatening the defence power of the country; and takes necessary measures to detect, monitor and counteract these activities.
Information Systems Security Bureau
The Information Systems Security Bureau (Zavod za sigurnost informacijskih sustava or ZSIS) is the central state authority responsible for the technical areas of information security of the state bodies. The director of ZSIS is appointed by the Government, at the proposal of the Council for the Coordination of Security Intelligence Agencies.
Operational Technology Centre for the Surveillance of Telecommunications
The Operational Technology Centre for the Surveillance of Telecommunications ( or OTC) is a small agency in the frame of the Croatian intelligence and security community responsible for activation and management of the measures of secret surveillance of telecommunication services. The director of OTC is appointed by the Government, at the proposal of the Council for the Coordination of Security Intelligence Agencies.
Scrutiny
The work of security and intelligence agencies is subject to the scrutiny conducted by the Croatian Parliament (parliamentary scrutiny), the Office of the National Security Council (professional scrutiny) and the Council for the Civilian Scrutiny of Security and Intelligence Agencies (civilian scrutiny).
Aside the above-mentioned scrutiny there is within each agency a special organisational unit responsible for the scrutiny of the work of its employees.
Parliamentary scrutiny
The scrutiny of the Croatian Parliament over security intelligence agencies is conducted directly or through the Parliamentary Committee for Domestic Policy and National Security (), and the Council for the Civilian Scrutiny of the Security Intelligence Agencies.
Professional scrutiny
Professional scrutiny over the work of security intelligence agencies and of the OTC is performed by the Office of the National Security Council.
Civilian scrutiny
Croatia is one of few countries where the civilian scrutiny over the agencies work is conducted along with the parliamentary and professional scrutiny. For the purpose of ensuring of the civilian scrutiny over the work of security intelligence agencies in 2002 was established the Council for Civilian Scrutiny of Security and Intelligence Agencies () pursuant to the Security Services Act of 28 March 2002. The Council consists of a chairperson and six members, all of whom are appointed by the Croatian Parliament. The Council's chairperson and members are appointed for a term of four years, after which they may be re-appointed. The Council monitors the legality of the work of security agencies, monitors and oversees application of measures for confidential data gathering which limits constitutionally-guaranteed human rights and fundamental freedoms.
History
After the first democratic, multiparty elections held in 1990, the process of building state institutions commenced within the framework of newly-sovereign Croatia.
Early 1990s
On 27 May 1991, President Franjo Tuđman established the Bureau for the Protection of the Constitutional Order (Ured za zaštitu ustavnog poretka or UZUP). The scope of its work, and its primary task was providing advice and professional assistance, in the area of protection of the constitutional order, to competent authorities performing functions in the Ministry of Interior, the Ministry of Defence and the Ministry of Foreign Affairs. As a part of the system for the protection of constitutional order, the Bureau was responsible for coordinating and directing the system as a whole. The Service for the Protection of the Constitutional Order, in the framework of the MoI, the Security and Information Service in the MoD, and the Research and Documentation Service of the MFA were all obliged to report to the Bureau on their respective work and results. The Bureau reported to the President of the Republic and to the top state authorities. These authorities, i.e. their services, were the foundation of the system for the protection of the constitutional order.
1993-2002
The main tasks of the intelligence community in the 1990s included the protection of the sovereignty and territorial integrity of the Republic of Croatia (liberation of the occupied territories of Croatia), problems of regional security (resolution of the crises in Bosnia and Herzegovina), international terrorism and organized crime, counter-intelligence protection. From the beginning, the focus of the intelligence work of the intelligence community was the territorial integrity of Croatia and regional stability, and two thirds of the operations and projects was devoted to these goals. Only one third of the capacity was directed toward international terrorism, organized crime and counter-intelligence protection.
National Security Office
UZUP ceased to exist on 21 March 1993 when, by the decision of the President Tuđman, the National Security Office ( or UNS) was established as the executive state authority which coordinated, directed, and supervised the work of government services whose activities were connected to national security.
Two years later, on 17 May 1995, the Croatian Parliament adopted the National Security Office Act. In only 17 short articles, the tasks of UNS were outlined as were the details of its internal structure. According to that Act, three services were founded and fall under its jurisdiction:
Croatian Intelligence Service (Hrvatska izvještajna služba or HIS),
Security Headquarters (Stožer osiguranja),
Supervision Service (Nadzorna služba).
In order to perform the professional and technical activities of the National Security Office, the following services (or its organizational units) were formed:
National Center for Electronic Monitoring (Nacionalna služba elektroničkog izviđanja or NSEI), which was operationally linked to the Croatian Army's Central Signals Intelligence Service and provided both internal and external signals intelligence. The NSEI was directly responsible to the Director of the UNS and the Joint National Security Committee.
Intelligence Academy (Obavještajna akademija).
This two services were not regulated by any legislative acts, rather only by the acts on internal organization.
The Director of the UNS, appointed by the President, was responsible to the President of the Republic for the work of the UNS and the individual services of the National Security Office.
The Directors were:
Hrvoje Šarinić
Krunislav Olujić
Miroslav Tuđman – acting
Luka Bebić
Ivan Jarnjak
Tomislav Karamarko
Intelligence Community
The intelligence community goals and tasks were set by the Joint National Security Committee (SONS) and the Intelligence Community Coordination Committee (KOOZ). SONS was in charge of directing and coordinating state ministries in conducting national security operations, whereas KOOZ was responsible for the execution of tasks given by SONS.
The core of the intelligence community consisted of four intelligence agencies:
Croatian Intelligence Service (HIS), the foreign intelligence and analysis agency; it was the only agency authorized to conduct operations abroad, permitted to co-operate with the agencies of friendly nations.
Service for the Protection of the Constitutional Order (), the domestic intelligence and internal security agency. For a time it was the country's main agency for both internal and foreign intelligence.
Security Intelligence Service of the Ministry of Defence ()
Directorate of Intelligence Affairs of the Croatian Army Headquarters (ObU GSOSRH)
In addition, part of the community was the Ministry of Defence's Department of International Military Co-operation, which was not an intelligence agency as such but it collected intelligence data through official diplomatic and military contacts, as well as through official contacts through military envoys and attaches of Croatia's government.
The Croatian President provided guidelines for UNS and the Croatian intelligence community operations. The UNS director and state ministers assigned tasks to the services under their authority. The yearly operational plan of the intelligence community was prepared by KOOZ and it included projects and operative actions in which two or more services were required to take part. SONS approved the yearly operational plan of the intelligence community and supervised its implementation.
Aside from the above-mentioned UNS and the agencies, a wider security-system circle also included the Criminal Police, the Military Police, the Customs Service, and the Financial Police, whose representatives could be invited to participate in the KOOZ sessions.
During the 1990s, and especially after the war, the state used the intelligence agencies for political purposes-not only to harass the opposition but also - in the case of certain high-ranking members of the Croatian government - as a means of shoring up their own power against that of others within the inner circle. These services, chiefly the SZUP, the SIS, and the HIS (headed by Tuđman's son Miroslav Tuđman), were used for political manipulation, blackmail, and by insiders to facilitate lining their own pockets through insider knowledge of privatization deals. At one point, there were even allegations that the services were misused in a Croatian soccer championship to help the team favored by Tuđman, an ardent soccer fan.
The complete cadre of the SIS was taken from the former Socialist Republic of Croatia's Republička služba državne sigurnosti, commonly known as UDBA, whose orders were given by the Federal Service Center in Belgrade. The transfer was made thanks to its leader Josip Perković and his informal agreement with Franjo Tuđman. From Ministry of Internior, the Service went under jurisdiction of Croatian Ministry of Defence. It was initially politicized, supporting the ruling HDZ party and its control over the military. The SIS was restructured and de-politicized after the end of the war, diversifying its operations and departments to include the Croatian Navy and the Croatian Air Force, counterintelligence, criminal investigations and security for Croatia's military leaders. Although responsible solely for defense intelligence, the SIS was believed to have conducted intelligence gathering operations in foreign countries of importance to Croatia.
2002-2006
As parliamentary democracy developed in the Republic of Croatia, reforms in security system were continued. On 19 March 2002, the Croatian Parliament adopted the National Security Strategy. The new Strategy, which is oriented toward integration into NATO and the EU, recognized all the neighboring states, including the Federal Republic of Yugoslavia (now Serbia and Montenegro), as partners in development, not as sources of destabilization. Few days later, on 21 March, the Parliament passed the Security Services Act (). These laws formed the basis for reform of the Croatian intelligence community.
In accordance with Security Services Act three security and intelligence services were founded:
Intelligence Agency (Obavještajna agencija or OA), formerly HIS, the primary duties of which were stated in Chapter III., Paragraph a), Article 7, Subsection (1) of the Act: "The Intelligence Agency (OA) will, through its actions abroad, gather, analyze, process and evaluate information of political, economical, security and military nature in relation to foreign countries, international government and non-government organizations, political, military and economic alliances, groups and individuals, especially all those with the intention, the possibility, or those believed to be plotting plans and covert actions to jeopardize (Croatian) national security."
Counterintelligence Agency (Protuobavještajna agencija or POA), formerly SZUP,
Military Security Agency (Vojna sigurnosna agencija or VSA), formerly SIS.
To facilitate the cooperation between the Croatian President and the Prime Minister in directing security and intelligence services operations, the National Security Council was founded. Furthermore, in order for the operative coordination of the security and intelligence services operations to be realized, the Council for Coordination of Security and Intelligence Agencies was founded. The Office of the National Security Council was founded for the purpose of performing expert and administrative operations for the National Security Council and the Council for Coordination of Security and Intelligence Agencies.
The Ministry of Foreign Affairs retained its own department charged with security work, but it would only provide for security and the flow of information to Croatia's diplomatic offices abroad.
These changes did not fully resolve the problems of the agencies. After the new services were established, President Stipe Mesić proposed appointments for the directors of the agencies, but Prime Minister Ivica Račan refused to countersign the appointments. Additional problems were caused by a lack of coordination, since documents and files had to be transferred to the new agencies. Several days before the Office for National Security ceased to exist (on March 31), its outgoing head Tomislav Karamarko ordered all such materials to be moved to the Croatian State Archives. This gesture was a protest against the reorganization of the security and intelligence services. It also turned out to be a major scandal since the sensitive and confidential documents were not guarded at the archives, where they languished for several days before being taken to the Intelligence Agency.
The Directors of the Intelligence Agency were:
Damir Lončarić
Veselko Grubišić
From 2006
The Croatia's security intelligence system went again through reforms in mid-2006, when the Croatian Parliament passed the Security Intelligence System Act, which came into effect on 17 August 2006. The Act reorganised the existing intelligence system: the Intelligence Agency (OA) and Counterintelligence Agency (POA) were merged into the newly established Security and Intelligence Agency (SOA), while the pre-existing Military Security Agency (VSA) was renamed Military Security and Intelligence Agency (VSOA) with its jurisdiction expanded to include activities abroad.
References
External links
Office of the National Security Council
Security and Intelligence Agency
Information Systems Security Bureau
Intelligence communities
|
What a Wonderful World is the 36th studio album by country singer Willie Nelson released in March 1988.
Track listing
"Spanish Eyes" (Bert Kaempfert, Jerry Leiber, Charlie Singleton, Eddie Snyder, Phil Spector) - 3:33
duet with Julio Iglesias
"Moon River" (Henry Mancini, Johnny Mercer)- 3:10
"Some Enchanted Evening" (Oscar Hammerstein II, Richard Rodgers) - 3:40
"What a Wonderful World" (George Douglas/Bob Thiele, George David Weiss)- 2:14
"South of the Border" (Michael Carr, Jimmy Kenned) - 3:17
"Ole Buttermilk Sky" (Jack Brooks, Hoagy Carmichael) - 2:48
"The Song from Moulin Rouge (Where Is Your Heart?)" (Georges Auric, William Engvick) - 2:53
"To Each His Own" (Ray Evans, Jay Livingston) - 3:37
"Twilight Time" (Alan Dunn. Artie Dunn, Al Nevins. Morton Nevins, Buck Ram) - 2:50
"Ac-Cent-Tchu-Ate the Positive" (Harold Arlen, Johnny Mercer) - 2:01
Personnel
Willie Nelson - guitar, vocals
Julio Iglesias - vocals on "Spanish Eyes"
Gene Chrisman - drums
Johnny Christopher - guitar, vocals
Bobby Emmons - keyboards
Mike Leech - bass guitar
Chips Moman - guitar, producer, engineer
Monique Moman - vocals
Mickey Raphael - harmonica
Toni Wine - vocals
Bobby Wood - keyboards, vocals
Reggie Young - guitar
Charts
Weekly charts
Year-end charts
References
1988 albums
Willie Nelson albums
Albums produced by Chips Moman
Columbia Records albums
Traditional pop albums
Covers albums
|
```java
package org.lamport.tla.toolbox.tool.tla2tex;
import java.io.File;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.lamport.tla.toolbox.AbstractTLCActivator;
import org.lamport.tla.toolbox.tool.tla2tex.preference.ITLA2TeXPreferenceConstants;
import org.osgi.framework.BundleContext;
import com.abstratt.graphviz.GraphVizActivator;
import com.abstratt.graphviz.GraphVizActivator.DotMethod;
/**
* The activator class controls the plug-in life cycle
*/
public class TLA2TeXActivator extends AbstractTLCActivator {
// The plug-in ID
public static final String PLUGIN_ID = "org.lamport.tla.toolbox.tool.tlatex";
private static final boolean IS_WINDOWS = Platform.OS_WIN32.equals(Platform.getOS());
private static final String USR_LOCAL_BIN_PATH = "/usr/local/bin/dot";
// The shared instance
private static TLA2TeXActivator plugin;
// Listen to preference changes in the TLA2TexPreferencePage. If the value for
// dot command changes, we send the update to the GraphViz preference store.
// GraphViz reads the value from its own store instead of ours.
// Alternatively, we could instantiate GraphViz's own preference page, which
// writes to GraphViz's preference store. However, we don't want to clutter
// the Toolbox's preference with a dedicate GraphViz page.
// <page
// category="toolbox.ui.preferences.GeneralPreferencePage"
// class="com.abstratt.graphviz.ui.GraphVizPreferencePage"
// id="toolbox.ui.preferences.StateGraphPreferences"
// name="State Graph">
// </page>
private IPropertyChangeListener listener = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
if (ITLA2TeXPreferenceConstants.DOT_COMMAND.equals(event.getProperty())) {
configureGraphViz((String)event.getNewValue());
}
}
};
/**
* The constructor
*/
public TLA2TeXActivator() {
super(PLUGIN_ID);
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
final IPreferenceStore preferenceStore = getPreferenceStore();
preferenceStore.addPropertyChangeListener(listener);
configureGraphViz(preferenceStore.getString(ITLA2TeXPreferenceConstants.DOT_COMMAND));
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception
{
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static TLA2TeXActivator getDefault()
{
return plugin;
}
private void configureGraphViz(final String dotLocationPreferenceValue) {
// This will be blank if the user has never entered a value in the preference panel
String dotCommand = dotLocationPreferenceValue;
// Per GitHub #412
if (!IS_WINDOWS
&& ((dotCommand == null)
|| (dotCommand.trim().length() == 0)
|| "dot".equals(dotCommand))) {
final File f = new File(USR_LOCAL_BIN_PATH);
if (f.exists() && f.canExecute()) {
dotCommand = USR_LOCAL_BIN_PATH;
}
}
if ("dot".equals(dotCommand)) {
// Setting it to "dot" implies auto lookup.
logInfo("dot command set to automatic lookup.");
GraphVizActivator.getInstance().setDotSearchMethod(DotMethod.AUTO);
} else {
// Explicit path is given.
logInfo("dot command set to: " + dotCommand);
GraphVizActivator.getInstance().setDotSearchMethod(DotMethod.MANUAL);
GraphVizActivator.getInstance().setManualDotPath(dotCommand);
}
}
}
```
|
Andreas Ernst Gottfried Furtwängler (born 11 November 1944, Zürich) is a German classical archaeologist and numismatist, and professor of classical archeology at Martin-Luther-Universität Halle-Wittenberg. He is the son of the conductor Wilhelm Furtwängler and grandson of the archaeologist Adolf Furtwängler.
His work was celebrated by a Festschrift in 2009.
Life
He received his PhD in 1973 at Heidelberg University with a thesis on ancient Greek numismatics supervised by Herbert A. Cahn. He worked from 1976 to 1981 at the German Archaeological Institute at Athens. In 1991, he was habilitated at the University of Saarbrucken and since 1994. He is a corresponding member of the German Archaeological Institute at Athens.
From 1993 to 2003 he carried out excavations and surveys in Georgia, and since 2002 he has been involved in the Daisen Didyma project.
Selected publications
Monnaies grecques en Gaule. Le trésor d'Auriol et le monnayage de Massalia 525/520 - 460 av. J.C., Fribourg 1978 (Typos, 3) [= Dissertation]
with Hermann J. Kienast: Samos, 3. Der Nordbau im Heraion von Samos, Bonn 1989
with Thanassis Kalpaxes; Alain Schnapp: Eλεύθερνα, 2, 2. Éνα ελληνιστικό σπίτι (σπίτι A) στη θέση Nησί, Rethymnon 1994
with Gerhard Zimmer; G. Schneider: Demetrias, 6. Hellenistische Bronzegusswerkstätten in Demetrias. Lampenproduktion und -importe im hellenistischen Demetrias. Amphorenfunde in Demetrias., Würzburg 2003
References
External links
Institut für Kunstgeschichte und Europäische Archäologie
German classical scholars
German numismatists
Living people
1944 births
Scientists from Zürich
Academic staff of the Martin Luther University of Halle-Wittenberg
Heidelberg University alumni
Archaeologists from Berlin
Academic staff of Saarland University
|
Die Matie is a student newspaper at the University of Stellenbosch. Founded in 1941, Die Matie is published every second Wednesday during the academic term. The editorial content includes sections on news, student life, sport, arts and entertainment, current affairs and news from other campuses. The entire production of Die Matie – from photos, articles and advertisements to page layout and distribution – is managed by the editorial staff; all students.
History
On August 1, 1941, the first issue of Die Matie student newspaper was published in Stellenbosch.
Distribution
8,000 copies of the newspaper are distributed on the main campus of Stellenbosch, as well as on the three satellite campuses, the medical campus at Tygerberg, military campus at Saldanha and business school in Bellville. Die Matie has an estimated readership of 16 000 students, staff and Stellenbosch residents. In addition to print the paper is also published electronically though an online archive.
Structure
With every edition of Die Matie a pre-elected editorial team member has the responsibility of compiling a supplement, either on: motoring, lifestyle, travel, science & technology and health.
The editor of this supplement is expected to gather advertisements for the supplement (as ads pay for the printing of the supplement), the collection of editorial content, photos and for the layout of the supplement.
Financing
Although Die Matie receives a small subsidy from Stellenbosch University's Student Affairs Department, all printing costs and some of the office upkeep is covered by advertisements, which are the responsibility of Die Maties advertising manager (also a student and member of the editorial team).
See also
List of newspapers in South Africa
MFM 92.6, Stellenbosch University's radio station
External links
Official Homepage
Official Online Archive
Stellenbosch University Homepage
Student Representative Council
The full history
Student newspapers published in South Africa
Stellenbosch University
Afrikaans-language newspapers
Mass media in Stellenbosch
1941 establishments in South Africa
|
```go
/*
*/
package comm
import (
"bytes"
"context"
"crypto/hmac"
"crypto/sha256"
"crypto/tls"
"errors"
"fmt"
"io"
"math/rand"
"net"
"strconv"
"sync"
"sync/atomic"
"testing"
"time"
"github.com/hyperledger/fabric-lib-go/bccsp/factory"
"github.com/hyperledger/fabric-lib-go/common/flogging"
"github.com/hyperledger/fabric-lib-go/common/metrics/disabled"
cb "github.com/hyperledger/fabric-protos-go/common"
proto "github.com/hyperledger/fabric-protos-go/gossip"
"github.com/hyperledger/fabric/gossip/api"
"github.com/hyperledger/fabric/gossip/api/mocks"
gmocks "github.com/hyperledger/fabric/gossip/comm/mocks"
"github.com/hyperledger/fabric/gossip/common"
"github.com/hyperledger/fabric/gossip/identity"
"github.com/hyperledger/fabric/gossip/metrics"
"github.com/hyperledger/fabric/gossip/protoext"
"github.com/hyperledger/fabric/gossip/util"
"github.com/hyperledger/fabric/internal/pkg/comm"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
)
var r *rand.Rand
func init() {
util.SetupTestLogging()
r = rand.New(rand.NewSource(time.Now().UnixNano()))
factory.InitFactories(nil)
naiveSec.On("OrgByPeerIdentity", mock.Anything).Return(api.OrgIdentityType{})
}
var testCommConfig = CommConfig{
DialTimeout: 300 * time.Millisecond,
ConnTimeout: DefConnTimeout,
RecvBuffSize: DefRecvBuffSize,
SendBuffSize: DefSendBuffSize,
}
func acceptAll(msg interface{}) bool {
return true
}
var noopPurgeIdentity = func(_ common.PKIidType, _ api.PeerIdentityType) {
}
var (
naiveSec = &naiveSecProvider{}
hmacKey = []byte{0, 0, 0}
disabledMetrics = metrics.NewGossipMetrics(&disabled.Provider{}).CommMetrics
)
type naiveSecProvider struct {
mocks.SecurityAdvisor
}
func (nsp *naiveSecProvider) OrgByPeerIdentity(identity api.PeerIdentityType) api.OrgIdentityType {
return nsp.SecurityAdvisor.Called(identity).Get(0).(api.OrgIdentityType)
}
func (*naiveSecProvider) Expiration(peerIdentity api.PeerIdentityType) (time.Time, error) {
return time.Now().Add(time.Hour), nil
}
func (*naiveSecProvider) ValidateIdentity(peerIdentity api.PeerIdentityType) error {
return nil
}
// GetPKIidOfCert returns the PKI-ID of a peer's identity
func (*naiveSecProvider) GetPKIidOfCert(peerIdentity api.PeerIdentityType) common.PKIidType {
return common.PKIidType(peerIdentity)
}
// VerifyBlock returns nil if the block is properly signed,
// else returns error
func (*naiveSecProvider) VerifyBlock(channelID common.ChannelID, seqNum uint64, signedBlock *cb.Block) error {
return nil
}
// VerifyBlockAttestation returns nil if the block attestation is properly signed,
// else returns error
func (*naiveSecProvider) VerifyBlockAttestation(channelID string, signedBlock *cb.Block) error {
return nil
}
// Sign signs msg with this peer's signing key and outputs
// the signature if no error occurred.
func (*naiveSecProvider) Sign(msg []byte) ([]byte, error) {
mac := hmac.New(sha256.New, hmacKey)
mac.Write(msg)
return mac.Sum(nil), nil
}
// Verify checks that signature is a valid signature of message under a peer's verification key.
// If the verification succeeded, Verify returns nil meaning no error occurred.
// If peerCert is nil, then the signature is verified against this peer's verification key.
func (*naiveSecProvider) Verify(peerIdentity api.PeerIdentityType, signature, message []byte) error {
mac := hmac.New(sha256.New, hmacKey)
mac.Write(message)
expected := mac.Sum(nil)
if !bytes.Equal(signature, expected) {
return fmt.Errorf("Wrong certificate:%v, %v", signature, message)
}
return nil
}
// VerifyByChannel verifies a peer's signature on a message in the context
// of a specific channel
func (*naiveSecProvider) VerifyByChannel(_ common.ChannelID, _ api.PeerIdentityType, _, _ []byte) error {
return nil
}
func newCommInstanceOnlyWithMetrics(t *testing.T, commMetrics *metrics.CommMetrics, sec *naiveSecProvider,
gRPCServer *comm.GRPCServer, certs *common.TLSCertificates,
secureDialOpts api.PeerSecureDialOpts, dialOpts ...grpc.DialOption) Comm {
_, portString, err := net.SplitHostPort(gRPCServer.Address())
require.NoError(t, err)
endpoint := fmt.Sprintf("127.0.0.1:%s", portString)
id := []byte(endpoint)
identityMapper := identity.NewIdentityMapper(sec, id, noopPurgeIdentity, sec)
commInst, err := NewCommInstance(gRPCServer.Server(), certs, identityMapper, id, secureDialOpts,
sec, commMetrics, testCommConfig, dialOpts...)
require.NoError(t, err)
go func() {
err := gRPCServer.Start()
require.NoError(t, err)
}()
return &commGRPC{commInst.(*commImpl), gRPCServer}
}
type commGRPC struct {
*commImpl
gRPCServer *comm.GRPCServer
}
func (c *commGRPC) Stop() {
c.commImpl.Stop()
c.commImpl.idMapper.Stop()
c.gRPCServer.Stop()
}
func newCommInstanceOnly(t *testing.T, sec *naiveSecProvider,
gRPCServer *comm.GRPCServer, certs *common.TLSCertificates,
secureDialOpts api.PeerSecureDialOpts, dialOpts ...grpc.DialOption) Comm {
return newCommInstanceOnlyWithMetrics(t, disabledMetrics, sec, gRPCServer, certs, secureDialOpts, dialOpts...)
}
func newCommInstance(t *testing.T, sec *naiveSecProvider) (c Comm, port int) {
port, gRPCServer, certs, secureDialOpts, dialOpts := util.CreateGRPCLayer()
comm := newCommInstanceOnly(t, sec, gRPCServer, certs, secureDialOpts, dialOpts...)
return comm, port
}
type msgMutator func(*protoext.SignedGossipMessage) *protoext.SignedGossipMessage
type tlsType int
const (
none tlsType = iota
oneWayTLS
mutualTLS
)
func handshaker(port int, endpoint string, comm Comm, t *testing.T, connMutator msgMutator, connType tlsType) <-chan protoext.ReceivedMessage {
c := &commImpl{}
cert := GenerateCertificatesOrPanic()
tlsCfg := &tls.Config{
InsecureSkipVerify: true,
}
if connType == mutualTLS {
tlsCfg.Certificates = []tls.Certificate{cert}
}
ta := credentials.NewTLS(tlsCfg)
secureOpts := grpc.WithTransportCredentials(ta)
if connType == none {
secureOpts = grpc.WithTransportCredentials(insecure.NewCredentials())
}
acceptChan := comm.Accept(acceptAll)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
target := fmt.Sprintf("127.0.0.1:%d", port)
conn, err := grpc.DialContext(ctx, target, secureOpts, grpc.WithBlock())
require.NoError(t, err, "%v", err)
if err != nil {
return nil
}
cl := proto.NewGossipClient(conn)
stream, err := cl.GossipStream(context.Background())
require.NoError(t, err, "%v", err)
if err != nil {
return nil
}
var clientCertHash []byte
if len(tlsCfg.Certificates) > 0 {
clientCertHash = certHashFromRawCert(tlsCfg.Certificates[0].Certificate[0])
}
pkiID := common.PKIidType(endpoint)
require.NoError(t, err, "%v", err)
msg, _ := c.createConnectionMsg(pkiID, clientCertHash, []byte(endpoint), func(msg []byte) ([]byte, error) {
mac := hmac.New(sha256.New, hmacKey)
mac.Write(msg)
return mac.Sum(nil), nil
}, false)
// Mutate connection message to test negative paths
msg = connMutator(msg)
// Send your own connection message
stream.Send(msg.Envelope)
// Wait for connection message from the other side
envelope, err := stream.Recv()
if err != nil {
return acceptChan
}
require.NoError(t, err, "%v", err)
msg, err = protoext.EnvelopeToGossipMessage(envelope)
require.NoError(t, err, "%v", err)
require.Equal(t, []byte(target), msg.GetConn().PkiId)
require.Equal(t, extractCertificateHashFromContext(stream.Context()), msg.GetConn().TlsCertHash)
msg2Send := createGossipMsg()
nonce := uint64(r.Int())
msg2Send.Nonce = nonce
go stream.Send(msg2Send.Envelope)
return acceptChan
}
func TestMutualParallelSendWithAck(t *testing.T) {
// This test tests concurrent and parallel sending of many (1000) messages
// from 2 instances to one another at the same time.
msgNum := 1000
comm1, port1 := newCommInstance(t, naiveSec)
comm2, port2 := newCommInstance(t, naiveSec)
defer comm1.Stop()
defer comm2.Stop()
acceptData := func(o interface{}) bool {
m := o.(protoext.ReceivedMessage).GetGossipMessage()
return protoext.IsDataMsg(m.GossipMessage)
}
inc1 := comm1.Accept(acceptData)
inc2 := comm2.Accept(acceptData)
// Send a message from comm1 to comm2, to make the instances establish a preliminary connection
comm1.Send(createGossipMsg(), remotePeer(port2))
// Wait for the message to be received in comm2
<-inc2
for i := 0; i < msgNum; i++ {
go comm1.SendWithAck(createGossipMsg(), time.Second*5, 1, remotePeer(port2))
}
for i := 0; i < msgNum; i++ {
go comm2.SendWithAck(createGossipMsg(), time.Second*5, 1, remotePeer(port1))
}
go func() {
for i := 0; i < msgNum; i++ {
<-inc1
}
}()
for i := 0; i < msgNum; i++ {
<-inc2
}
}
func getAvailablePort(t *testing.T) (port int, endpoint string, ll net.Listener) {
ll, err := net.Listen("tcp", "127.0.0.1:0")
require.NoError(t, err)
endpoint = ll.Addr().String()
_, portS, err := net.SplitHostPort(endpoint)
require.NoError(t, err)
portInt, err := strconv.Atoi(portS)
require.NoError(t, err)
return portInt, endpoint, ll
}
func TestHandshake(t *testing.T) {
signer := func(msg []byte) ([]byte, error) {
mac := hmac.New(sha256.New, hmacKey)
mac.Write(msg)
return mac.Sum(nil), nil
}
mutator := func(msg *protoext.SignedGossipMessage) *protoext.SignedGossipMessage {
return msg
}
assertPositivePath := func(msg protoext.ReceivedMessage, endpoint string) {
expectedPKIID := common.PKIidType(endpoint)
require.Equal(t, expectedPKIID, msg.GetConnectionInfo().ID)
require.Equal(t, api.PeerIdentityType(endpoint), msg.GetConnectionInfo().Identity)
require.NotNil(t, msg.GetConnectionInfo().Auth)
sig, _ := (&naiveSecProvider{}).Sign(msg.GetConnectionInfo().Auth.SignedData)
require.Equal(t, sig, msg.GetConnectionInfo().Auth.Signature)
}
// Positive path 1 - check authentication without TLS
port, endpoint, ll := getAvailablePort(t)
s := grpc.NewServer()
id := []byte(endpoint)
idMapper := identity.NewIdentityMapper(naiveSec, id, noopPurgeIdentity, naiveSec)
inst, err := NewCommInstance(s, nil, idMapper, api.PeerIdentityType(endpoint), func() []grpc.DialOption {
return []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}
}, naiveSec, disabledMetrics, testCommConfig)
go s.Serve(ll)
require.NoError(t, err)
var msg protoext.ReceivedMessage
_, tempEndpoint, tempL := getAvailablePort(t)
acceptChan := handshaker(port, tempEndpoint, inst, t, mutator, none)
select {
case <-time.After(time.Second * 4):
require.FailNow(t, "Didn't receive a message, seems like handshake failed")
case msg = <-acceptChan:
}
require.Equal(t, common.PKIidType(tempEndpoint), msg.GetConnectionInfo().ID)
require.Equal(t, api.PeerIdentityType(tempEndpoint), msg.GetConnectionInfo().Identity)
sig, _ := (&naiveSecProvider{}).Sign(msg.GetConnectionInfo().Auth.SignedData)
require.Equal(t, sig, msg.GetConnectionInfo().Auth.Signature)
inst.Stop()
s.Stop()
ll.Close()
tempL.Close()
time.Sleep(time.Second)
comm, port := newCommInstance(t, naiveSec)
defer comm.Stop()
// Positive path 2: initiating peer sends its own certificate
_, tempEndpoint, tempL = getAvailablePort(t)
acceptChan = handshaker(port, tempEndpoint, comm, t, mutator, mutualTLS)
select {
case <-time.After(time.Second * 2):
require.FailNow(t, "Didn't receive a message, seems like handshake failed")
case msg = <-acceptChan:
}
assertPositivePath(msg, tempEndpoint)
tempL.Close()
// Negative path: initiating peer doesn't send its own certificate
_, tempEndpoint, tempL = getAvailablePort(t)
acceptChan = handshaker(port, tempEndpoint, comm, t, mutator, oneWayTLS)
time.Sleep(time.Second)
require.Equal(t, 0, len(acceptChan))
tempL.Close()
// Negative path, signature is wrong
_, tempEndpoint, tempL = getAvailablePort(t)
mutator = func(msg *protoext.SignedGossipMessage) *protoext.SignedGossipMessage {
msg.Signature = append(msg.Signature, 0)
return msg
}
acceptChan = handshaker(port, tempEndpoint, comm, t, mutator, mutualTLS)
time.Sleep(time.Second)
require.Equal(t, 0, len(acceptChan))
tempL.Close()
// Negative path, the PKIid doesn't match the identity
_, tempEndpoint, tempL = getAvailablePort(t)
mutator = func(msg *protoext.SignedGossipMessage) *protoext.SignedGossipMessage {
msg.GetConn().PkiId = []byte(tempEndpoint)
// Sign the message again
msg.Sign(signer)
return msg
}
_, tempEndpoint2, tempL2 := getAvailablePort(t)
acceptChan = handshaker(port, tempEndpoint2, comm, t, mutator, mutualTLS)
time.Sleep(time.Second)
require.Equal(t, 0, len(acceptChan))
tempL.Close()
tempL2.Close()
// Negative path, the cert hash isn't what is expected
_, tempEndpoint, tempL = getAvailablePort(t)
mutator = func(msg *protoext.SignedGossipMessage) *protoext.SignedGossipMessage {
msg.GetConn().TlsCertHash = append(msg.GetConn().TlsCertHash, 0)
msg.Sign(signer)
return msg
}
acceptChan = handshaker(port, tempEndpoint, comm, t, mutator, mutualTLS)
time.Sleep(time.Second)
require.Equal(t, 0, len(acceptChan))
tempL.Close()
// Negative path, no PKI-ID was sent
_, tempEndpoint, tempL = getAvailablePort(t)
mutator = func(msg *protoext.SignedGossipMessage) *protoext.SignedGossipMessage {
msg.GetConn().PkiId = nil
msg.Sign(signer)
return msg
}
acceptChan = handshaker(port, tempEndpoint, comm, t, mutator, mutualTLS)
time.Sleep(time.Second)
require.Equal(t, 0, len(acceptChan))
tempL.Close()
// Negative path, connection message is of a different type
_, tempEndpoint, tempL = getAvailablePort(t)
mutator = func(msg *protoext.SignedGossipMessage) *protoext.SignedGossipMessage {
msg.Content = &proto.GossipMessage_Empty{
Empty: &proto.Empty{},
}
msg.Sign(signer)
return msg
}
acceptChan = handshaker(port, tempEndpoint, comm, t, mutator, mutualTLS)
time.Sleep(time.Second)
require.Equal(t, 0, len(acceptChan))
tempL.Close()
// Negative path, the peer didn't respond to the handshake in due time
_, tempEndpoint, tempL = getAvailablePort(t)
mutator = func(msg *protoext.SignedGossipMessage) *protoext.SignedGossipMessage {
time.Sleep(time.Second * 5)
return msg
}
acceptChan = handshaker(port, tempEndpoint, comm, t, mutator, mutualTLS)
time.Sleep(time.Second)
require.Equal(t, 0, len(acceptChan))
tempL.Close()
}
func TestConnectUnexpectedPeer(t *testing.T) {
// Scenarios: In both scenarios, comm1 connects to comm2 or comm3.
// and expects to see a PKI-ID which is equal to comm4's PKI-ID.
// The connection attempt would succeed or fail based on whether comm2 or comm3
// are in the same org as comm4
identityByPort := func(port int) api.PeerIdentityType {
return api.PeerIdentityType(fmt.Sprintf("127.0.0.1:%d", port))
}
customNaiveSec := &naiveSecProvider{}
comm1Port, gRPCServer1, certs1, secureDialOpts1, dialOpts1 := util.CreateGRPCLayer()
comm2Port, gRPCServer2, certs2, secureDialOpts2, dialOpts2 := util.CreateGRPCLayer()
comm3Port, gRPCServer3, certs3, secureDialOpts3, dialOpts3 := util.CreateGRPCLayer()
comm4Port, gRPCServer4, certs4, secureDialOpts4, dialOpts4 := util.CreateGRPCLayer()
customNaiveSec.On("OrgByPeerIdentity", identityByPort(comm1Port)).Return(api.OrgIdentityType("O"))
customNaiveSec.On("OrgByPeerIdentity", identityByPort(comm2Port)).Return(api.OrgIdentityType("A"))
customNaiveSec.On("OrgByPeerIdentity", identityByPort(comm3Port)).Return(api.OrgIdentityType("B"))
customNaiveSec.On("OrgByPeerIdentity", identityByPort(comm4Port)).Return(api.OrgIdentityType("A"))
comm1 := newCommInstanceOnly(t, customNaiveSec, gRPCServer1, certs1, secureDialOpts1, dialOpts1...)
comm2 := newCommInstanceOnly(t, naiveSec, gRPCServer2, certs2, secureDialOpts2, dialOpts2...)
comm3 := newCommInstanceOnly(t, naiveSec, gRPCServer3, certs3, secureDialOpts3, dialOpts3...)
comm4 := newCommInstanceOnly(t, naiveSec, gRPCServer4, certs4, secureDialOpts4, dialOpts4...)
defer comm1.Stop()
defer comm2.Stop()
defer comm3.Stop()
defer comm4.Stop()
messagesForComm1 := comm1.Accept(acceptAll)
messagesForComm2 := comm2.Accept(acceptAll)
messagesForComm3 := comm3.Accept(acceptAll)
// Have comm4 send a message to comm1
// in order for comm1 to know comm4
comm4.Send(createGossipMsg(), remotePeer(comm1Port))
<-messagesForComm1
// Close the connection with comm4
comm1.CloseConn(remotePeer(comm4Port))
// At this point, comm1 knows comm4's identity and organization
t.Run("Same organization", func(t *testing.T) {
unexpectedRemotePeer := remotePeer(comm2Port)
unexpectedRemotePeer.PKIID = remotePeer(comm4Port).PKIID
comm1.Send(createGossipMsg(), unexpectedRemotePeer)
select {
case <-messagesForComm2:
case <-time.After(time.Second * 5):
require.Fail(t, "Didn't receive a message within a timely manner")
util.PrintStackTrace()
}
})
t.Run("Unexpected organization", func(t *testing.T) {
unexpectedRemotePeer := remotePeer(comm3Port)
unexpectedRemotePeer.PKIID = remotePeer(comm4Port).PKIID
comm1.Send(createGossipMsg(), unexpectedRemotePeer)
select {
case <-messagesForComm3:
require.Fail(t, "Message shouldn't have been received")
case <-time.After(time.Second * 5):
}
})
}
func TestGetConnectionInfo(t *testing.T) {
comm1, port1 := newCommInstance(t, naiveSec)
comm2, _ := newCommInstance(t, naiveSec)
defer comm1.Stop()
defer comm2.Stop()
m1 := comm1.Accept(acceptAll)
comm2.Send(createGossipMsg(), remotePeer(port1))
select {
case <-time.After(time.Second * 10):
t.Fatal("Didn't receive a message in time")
case msg := <-m1:
require.Equal(t, comm2.GetPKIid(), msg.GetConnectionInfo().ID)
require.NotNil(t, msg.GetSourceEnvelope())
}
}
func TestCloseConn(t *testing.T) {
comm1, port1 := newCommInstance(t, naiveSec)
defer comm1.Stop()
acceptChan := comm1.Accept(acceptAll)
cert := GenerateCertificatesOrPanic()
tlsCfg := &tls.Config{
InsecureSkipVerify: true,
Certificates: []tls.Certificate{cert},
}
ta := credentials.NewTLS(tlsCfg)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
target := fmt.Sprintf("127.0.0.1:%d", port1)
conn, err := grpc.DialContext(ctx, target, grpc.WithTransportCredentials(ta), grpc.WithBlock())
require.NoError(t, err, "%v", err)
cl := proto.NewGossipClient(conn)
stream, err := cl.GossipStream(context.Background())
require.NoError(t, err, "%v", err)
c := &commImpl{}
tlsCertHash := certHashFromRawCert(tlsCfg.Certificates[0].Certificate[0])
connMsg, _ := c.createConnectionMsg(common.PKIidType("pkiID"), tlsCertHash, api.PeerIdentityType("pkiID"), func(msg []byte) ([]byte, error) {
mac := hmac.New(sha256.New, hmacKey)
mac.Write(msg)
return mac.Sum(nil), nil
}, false)
require.NoError(t, stream.Send(connMsg.Envelope))
stream.Send(createGossipMsg().Envelope)
select {
case <-acceptChan:
case <-time.After(time.Second):
require.Fail(t, "Didn't receive a message within a timely period")
}
comm1.CloseConn(&RemotePeer{PKIID: common.PKIidType("pkiID")})
time.Sleep(time.Second * 10)
gotErr := false
msg2Send := createGossipMsg()
msg2Send.GetDataMsg().Payload = &proto.Payload{
Data: make([]byte, 1024*1024),
}
protoext.NoopSign(msg2Send.GossipMessage)
for i := 0; i < DefRecvBuffSize; i++ {
err := stream.Send(msg2Send.Envelope)
if err != nil {
gotErr = true
break
}
}
require.True(t, gotErr, "Should have failed because connection is closed")
}
// TestCommSend makes sure that enough messages get through
// eventually. Comm.Send() is both asynchronous and best-effort, so this test
// case assumes some will fail, but that eventually enough messages will get
// through that the test will end.
func TestCommSend(t *testing.T) {
sendMessages := func(c Comm, peer *RemotePeer, stopChan <-chan struct{}) {
ticker := time.NewTicker(time.Millisecond)
defer ticker.Stop()
for {
emptyMsg := createGossipMsg()
select {
case <-stopChan:
return
case <-ticker.C:
c.Send(emptyMsg, peer)
}
}
}
comm1, port1 := newCommInstance(t, naiveSec)
comm2, port2 := newCommInstance(t, naiveSec)
defer comm1.Stop()
defer comm2.Stop()
// Create the receive channel before sending the messages
ch1 := comm1.Accept(acceptAll)
ch2 := comm2.Accept(acceptAll)
// control channels for background senders
stopch1 := make(chan struct{})
stopch2 := make(chan struct{})
go sendMessages(comm1, remotePeer(port2), stopch1)
go sendMessages(comm2, remotePeer(port1), stopch2)
c1received := 0
c2received := 0
// hopefully in some runs we'll fill both send and receive buffers and
// drop overflowing messages, but still finish, because the endless
// stream of messages inexorably gets through unless something is very
// broken.
totalMessagesReceived := (DefSendBuffSize + DefRecvBuffSize) * 2
timer := time.NewTimer(30 * time.Second)
defer timer.Stop()
RECV:
for {
select {
case <-ch1:
c1received++
if c1received == totalMessagesReceived {
close(stopch2)
}
case <-ch2:
c2received++
if c2received == totalMessagesReceived {
close(stopch1)
}
case <-timer.C:
t.Fatalf("timed out waiting for messages to be received.\nc1 got %d messages\nc2 got %d messages", c1received, c2received)
default:
if c1received >= totalMessagesReceived && c2received >= totalMessagesReceived {
break RECV
}
}
}
t.Logf("c1 got %d messages\nc2 got %d messages", c1received, c2received)
}
type nonResponsivePeer struct {
*grpc.Server
port int
}
func newNonResponsivePeer(t *testing.T) *nonResponsivePeer {
port, gRPCServer, _, _, _ := util.CreateGRPCLayer()
nrp := &nonResponsivePeer{
Server: gRPCServer.Server(),
port: port,
}
proto.RegisterGossipServer(gRPCServer.Server(), nrp)
return nrp
}
func (bp *nonResponsivePeer) Ping(context.Context, *proto.Empty) (*proto.Empty, error) {
time.Sleep(time.Second * 15)
return &proto.Empty{}, nil
}
func (bp *nonResponsivePeer) GossipStream(stream proto.Gossip_GossipStreamServer) error {
return nil
}
func (bp *nonResponsivePeer) stop() {
bp.Server.Stop()
}
func TestNonResponsivePing(t *testing.T) {
c, _ := newCommInstance(t, naiveSec)
defer c.Stop()
nonRespPeer := newNonResponsivePeer(t)
defer nonRespPeer.stop()
s := make(chan struct{})
go func() {
c.Probe(remotePeer(nonRespPeer.port))
s <- struct{}{}
}()
select {
case <-time.After(time.Second * 10):
require.Fail(t, "Request wasn't cancelled on time")
case <-s:
}
}
func TestResponses(t *testing.T) {
comm1, port1 := newCommInstance(t, naiveSec)
comm2, _ := newCommInstance(t, naiveSec)
defer comm1.Stop()
defer comm2.Stop()
wg := sync.WaitGroup{}
msg := createGossipMsg()
wg.Add(1)
go func() {
inChan := comm1.Accept(acceptAll)
wg.Done()
for m := range inChan {
reply := createGossipMsg()
reply.Nonce = m.GetGossipMessage().Nonce + 1
m.Respond(reply.GossipMessage)
}
}()
expectedNOnce := msg.Nonce + 1
responsesFromComm1 := comm2.Accept(acceptAll)
ticker := time.NewTicker(10 * time.Second)
wg.Wait()
comm2.Send(msg, remotePeer(port1))
select {
case <-ticker.C:
require.Fail(t, "Haven't got response from comm1 within a timely manner")
break
case resp := <-responsesFromComm1:
ticker.Stop()
require.Equal(t, expectedNOnce, resp.GetGossipMessage().Nonce)
break
}
}
// TestAccept makes sure that accept filters work. The probability of the parity
// of all nonces being 0 or 1 is very low.
func TestAccept(t *testing.T) {
comm1, port1 := newCommInstance(t, naiveSec)
comm2, _ := newCommInstance(t, naiveSec)
evenNONCESelector := func(m interface{}) bool {
return m.(protoext.ReceivedMessage).GetGossipMessage().Nonce%2 == 0
}
oddNONCESelector := func(m interface{}) bool {
return m.(protoext.ReceivedMessage).GetGossipMessage().Nonce%2 != 0
}
evenNONCES := comm1.Accept(evenNONCESelector)
oddNONCES := comm1.Accept(oddNONCESelector)
var evenResults []uint64
var oddResults []uint64
out := make(chan uint64)
sem := make(chan struct{})
readIntoSlice := func(a *[]uint64, ch <-chan protoext.ReceivedMessage) {
for m := range ch {
*a = append(*a, m.GetGossipMessage().Nonce)
select {
case out <- m.GetGossipMessage().Nonce:
default: // avoid blocking when we stop reading from out
}
}
sem <- struct{}{}
}
go readIntoSlice(&evenResults, evenNONCES)
go readIntoSlice(&oddResults, oddNONCES)
stopSend := make(chan struct{})
go func() {
for {
select {
case <-stopSend:
return
default:
comm2.Send(createGossipMsg(), remotePeer(port1))
}
}
}()
waitForMessages(t, out, (DefSendBuffSize+DefRecvBuffSize)*2, "Didn't receive all messages sent")
close(stopSend)
comm1.Stop()
comm2.Stop()
<-sem
<-sem
t.Logf("%d even nonces received", len(evenResults))
t.Logf("%d odd nonces received", len(oddResults))
require.NotEmpty(t, evenResults)
require.NotEmpty(t, oddResults)
remainderPredicate := func(a []uint64, rem uint64) {
for _, n := range a {
require.Equal(t, n%2, rem)
}
}
remainderPredicate(evenResults, 0)
remainderPredicate(oddResults, 1)
}
func TestReConnections(t *testing.T) {
comm1, port1 := newCommInstance(t, naiveSec)
comm2, port2 := newCommInstance(t, naiveSec)
reader := func(out chan uint64, in <-chan protoext.ReceivedMessage) {
for {
msg := <-in
if msg == nil {
return
}
out <- msg.GetGossipMessage().Nonce
}
}
out1 := make(chan uint64, 10)
out2 := make(chan uint64, 10)
go reader(out1, comm1.Accept(acceptAll))
go reader(out2, comm2.Accept(acceptAll))
// comm1 connects to comm2
comm1.Send(createGossipMsg(), remotePeer(port2))
waitForMessages(t, out2, 1, "Comm2 didn't receive a message from comm1 in a timely manner")
// comm2 sends to comm1
comm2.Send(createGossipMsg(), remotePeer(port1))
waitForMessages(t, out1, 1, "Comm1 didn't receive a message from comm2 in a timely manner")
comm1.Stop()
comm1, port1 = newCommInstance(t, naiveSec)
out1 = make(chan uint64, 1)
go reader(out1, comm1.Accept(acceptAll))
comm2.Send(createGossipMsg(), remotePeer(port1))
waitForMessages(t, out1, 1, "Comm1 didn't receive a message from comm2 in a timely manner")
comm1.Stop()
comm2.Stop()
}
func TestProbe(t *testing.T) {
comm1, port1 := newCommInstance(t, naiveSec)
defer comm1.Stop()
comm2, port2 := newCommInstance(t, naiveSec)
time.Sleep(time.Duration(1) * time.Second)
require.NoError(t, comm1.Probe(remotePeer(port2)))
_, err := comm1.Handshake(remotePeer(port2))
require.NoError(t, err)
tempPort, _, ll := getAvailablePort(t)
defer ll.Close()
require.Error(t, comm1.Probe(remotePeer(tempPort)))
_, err = comm1.Handshake(remotePeer(tempPort))
require.Error(t, err)
comm2.Stop()
time.Sleep(time.Duration(1) * time.Second)
require.Error(t, comm1.Probe(remotePeer(port2)))
_, err = comm1.Handshake(remotePeer(port2))
require.Error(t, err)
comm2, port2 = newCommInstance(t, naiveSec)
defer comm2.Stop()
time.Sleep(time.Duration(1) * time.Second)
require.NoError(t, comm2.Probe(remotePeer(port1)))
_, err = comm2.Handshake(remotePeer(port1))
require.NoError(t, err)
require.NoError(t, comm1.Probe(remotePeer(port2)))
_, err = comm1.Handshake(remotePeer(port2))
require.NoError(t, err)
// Now try a deep probe with an expected PKI-ID that doesn't match
wrongRemotePeer := remotePeer(port2)
if wrongRemotePeer.PKIID[0] == 0 {
wrongRemotePeer.PKIID[0] = 1
} else {
wrongRemotePeer.PKIID[0] = 0
}
_, err = comm1.Handshake(wrongRemotePeer)
require.Error(t, err)
// Try a deep probe with a nil PKI-ID
endpoint := fmt.Sprintf("127.0.0.1:%d", port2)
id, err := comm1.Handshake(&RemotePeer{Endpoint: endpoint})
require.NoError(t, err)
require.Equal(t, api.PeerIdentityType(endpoint), id)
}
func TestPresumedDead(t *testing.T) {
comm1, _ := newCommInstance(t, naiveSec)
comm2, port2 := newCommInstance(t, naiveSec)
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
wg.Wait()
comm1.Send(createGossipMsg(), remotePeer(port2))
}()
ticker := time.NewTicker(time.Duration(10) * time.Second)
acceptCh := comm2.Accept(acceptAll)
wg.Done()
select {
case <-acceptCh:
ticker.Stop()
case <-ticker.C:
require.Fail(t, "Didn't get first message")
}
comm2.Stop()
go func() {
for i := 0; i < 5; i++ {
comm1.Send(createGossipMsg(), remotePeer(port2))
time.Sleep(time.Millisecond * 200)
}
}()
ticker = time.NewTicker(time.Second * time.Duration(3))
select {
case <-ticker.C:
require.Fail(t, "Didn't get a presumed dead message within a timely manner")
break
case <-comm1.PresumedDead():
ticker.Stop()
break
}
}
func TestReadFromStream(t *testing.T) {
stream := &gmocks.MockStream{}
stream.On("CloseSend").Return(nil)
stream.On("Recv").Return(&proto.Envelope{Payload: []byte{1}}, nil).Once()
stream.On("Recv").Return(nil, errors.New("stream closed")).Once()
conn := newConnection(nil, nil, stream, disabledMetrics, ConnConfig{1, 1})
conn.logger = flogging.MustGetLogger("test")
errChan := make(chan error, 2)
msgChan := make(chan *protoext.SignedGossipMessage, 1)
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
conn.readFromStream(errChan, msgChan)
}()
select {
case <-msgChan:
require.Fail(t, "malformed message shouldn't have been received")
case <-time.After(time.Millisecond * 100):
require.Len(t, errChan, 1)
}
conn.close()
wg.Wait()
}
func TestSendBadEnvelope(t *testing.T) {
comm1, port := newCommInstance(t, naiveSec)
defer comm1.Stop()
stream, err := establishSession(t, port)
require.NoError(t, err)
inc := comm1.Accept(acceptAll)
goodMsg := createGossipMsg()
err = stream.Send(goodMsg.Envelope)
require.NoError(t, err)
select {
case goodMsgReceived := <-inc:
require.Equal(t, goodMsg.Envelope.Payload, goodMsgReceived.GetSourceEnvelope().Payload)
case <-time.After(time.Minute):
require.Fail(t, "Didn't receive message within a timely manner")
return
}
// Next, we corrupt a message and send it until the stream is closed forcefully from the remote peer
start := time.Now()
for {
badMsg := createGossipMsg()
badMsg.Envelope.Payload = []byte{1}
err = stream.Send(badMsg.Envelope)
if err != nil {
require.Equal(t, io.EOF, err)
break
}
if time.Now().After(start.Add(time.Second * 30)) {
require.Fail(t, "Didn't close stream within a timely manner")
return
}
}
}
func establishSession(t *testing.T, port int) (proto.Gossip_GossipStreamClient, error) {
cert := GenerateCertificatesOrPanic()
secureOpts := grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{
InsecureSkipVerify: true,
Certificates: []tls.Certificate{cert},
}))
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
endpoint := fmt.Sprintf("127.0.0.1:%d", port)
conn, err := grpc.DialContext(ctx, endpoint, secureOpts, grpc.WithBlock())
require.NoError(t, err, "%v", err)
if err != nil {
return nil, err
}
cl := proto.NewGossipClient(conn)
stream, err := cl.GossipStream(context.Background())
require.NoError(t, err, "%v", err)
if err != nil {
return nil, err
}
clientCertHash := certHashFromRawCert(cert.Certificate[0])
pkiID := common.PKIidType([]byte{1, 2, 3})
c := &commImpl{}
require.NoError(t, err, "%v", err)
msg, _ := c.createConnectionMsg(pkiID, clientCertHash, []byte{1, 2, 3}, func(msg []byte) ([]byte, error) {
mac := hmac.New(sha256.New, hmacKey)
mac.Write(msg)
return mac.Sum(nil), nil
}, false)
// Send your own connection message
stream.Send(msg.Envelope)
// Wait for connection message from the other side
envelope, err := stream.Recv()
if err != nil {
return nil, err
}
require.NotNil(t, envelope)
return stream, nil
}
func createGossipMsg() *protoext.SignedGossipMessage {
msg, _ := protoext.NoopSign(&proto.GossipMessage{
Tag: proto.GossipMessage_EMPTY,
Nonce: uint64(r.Int()),
Content: &proto.GossipMessage_DataMsg{
DataMsg: &proto.DataMessage{},
},
})
return msg
}
func remotePeer(port int) *RemotePeer {
endpoint := fmt.Sprintf("127.0.0.1:%d", port)
return &RemotePeer{Endpoint: endpoint, PKIID: []byte(endpoint)}
}
func waitForMessages(t *testing.T, msgChan chan uint64, count int, errMsg string) {
c := 0
waiting := true
ticker := time.NewTicker(time.Duration(10) * time.Second)
for waiting {
select {
case <-msgChan:
c++
if c == count {
waiting = false
}
case <-ticker.C:
waiting = false
}
}
require.Equal(t, count, c, errMsg)
}
func TestConcurrentCloseSend(t *testing.T) {
var stopping int32
comm1, _ := newCommInstance(t, naiveSec)
comm2, port2 := newCommInstance(t, naiveSec)
m := comm2.Accept(acceptAll)
comm1.Send(createGossipMsg(), remotePeer(port2))
<-m
ready := make(chan struct{})
done := make(chan struct{})
go func() {
defer close(done)
comm1.Send(createGossipMsg(), remotePeer(port2))
close(ready)
for atomic.LoadInt32(&stopping) == int32(0) {
comm1.Send(createGossipMsg(), remotePeer(port2))
}
}()
<-ready
comm2.Stop()
atomic.StoreInt32(&stopping, int32(1))
<-done
}
```
|
Salomatin () is a rural locality (a khutor) in Filonovskoye Rural Settlement, Novoanninsky District, Volgograd Oblast, Russia. The population was 374 as of 2010. There are 9 streets.
Geography
Salomatin is located on the Khopyorsko-Buzulukskaya Plain, on the bank of the Buzuluk River, 22 km northeast of Novoanninsky (the district's administrative centre) by road. Rozhnovsky is the nearest rural locality.
References
Rural localities in Novoanninsky District
|
The list of ship decommissionings in 1992 includes a chronological list of all ships decommissioned in 1992.
See also
1992
Ship decommissionings
Ship
|
CLG Ghleann Fhinne (Glenfin) is a Gaelic games club in the Glenfin Parish, County Donegal, Republic of Ireland. The club's home ground is Páirc Taobhoige. The Club’s chairperson is Paddy Doherty.
History
Manager Liam Breen led the club to the 2018 Donegal IFC.
Notable players
Stephen McDermott — All-Ireland SFC semi-finalist: 2003
Frank McGlynn — 2012 All-Ireland SFC winner; five times Ulster SFC winner; a Donegal All Star
Managers
Honours
Football
Donegal Intermediate Football Championship: 1983, 2001, 2018
Ulster Intermediate Club Football Championship: 2001
Donegal Under-21 A Football Championship: 2002
Donegal Under-21 B Football Championship: 2015
Ladies' football
Donegal Senior Ladies Football Championship: 2011, 2017, 2018, 2020
Ulster Ladies Senior Club Football Championship runner-up: 2011, 2018
References
Gaelic games clubs in County Donegal
Gaelic football clubs in County Donegal
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.