text
stringlengths
1
1.04M
language
stringclasses
25 values
<reponame>pabru/libgdx /******************************************************************************* * Copyright 2011 See AUTHORS file. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************/ package com.badlogic.gdx.graphics.g3d.model.data; import com.badlogic.gdx.math.Vector2; public class ModelTexture { public final static int USAGE_UNKNOWN = 0; public final static int USAGE_NONE = 1; public final static int USAGE_DIFFUSE = 2; public final static int USAGE_EMISSIVE = 3; public final static int USAGE_AMBIENT = 4; public final static int USAGE_SPECULAR = 5; public final static int USAGE_SHININESS = 6; public final static int USAGE_NORMAL = 7; public final static int USAGE_BUMP = 8; public final static int USAGE_TRANSPARENCY = 9; public final static int USAGE_REFLECTION = 10; public String id; public String fileName; public Vector2 uvTranslation; public Vector2 uvScaling; public int usage; }
java
<reponame>charles-halifax/recipes { "directions": [ "Heat the oil in a shallow skillet over medium heat; fry the chana dal in the hot oil for about 5 minutes. Stir the red chile peppers, garlic, curry leaves, coriander seeds, and cumin seeds into the dal and continue cooking until the spices are roasted and fragrant, about 3 minutes more. Spread the mixture onto some newspaper to cool to room temperature; grind into a find powder. Season with salt. The powder will keep in an airtight container on the shelf for a few months." ], "ingredients": [ "1 tablespoon cooking oil", "1/4 cup split Bengal gram (chana dal)", "8 dried red chile peppers", "5 cloves garlic", "1/2 cup fresh curry leaves", "1/4 cup coriander seeds", "2 tablespoons cumin seeds", "salt to taste" ], "language": "en-US", "source": "allrecipes.com", "tags": [], "title": "Dosa Podi with Garlic", "url": "http://allrecipes.com/recipe/212522/dosa-podi-with-garlic/" }
json
We're still a long way from September, which is when new iPhones are traditionally unveiled, but the rumors keep coming thick and fast. The latest speculation adds a new twist to a feature that's been talked about before: wireless charging. According to a new report from Macotakara, citing sources inside Apple's Asian operations, wireless charging is only going to appear on the most expensive iPhone 8, and you're going to need to buy a separate adapter on top of the cost of the phone. That contradicts what other analysts have said - that all three 2017 iPhones will come with wireless charging. Based on the anonymous tipsters speaking to Macotakara, you'll need to fork out for the most expensive iPhone and then purchase another adapter if you want to charge your Apple smartphone without wires. There are a few other nuggets of information to be had from the Macotakara report. Apparently the new phones won't come with a 3.5mm-to-Lightning port adapter, as the iPhone 7 and iPhone 7 Plus did, so you're going to have to think seriously about upgrading your wired headphones. The new article also floats the idea of a 5-inch iPhone being added to the line-up this year, and again that's something we've heard before. Several sources have now indicated that there are going to be three iPhones to pick from in 2017, with one possibly being a 'special edition' release to celebrate the tenth anniversary of the device's launch. Of course it's still early days for the next generation of iPhones and we've got another eight months to wait before Apple shows us what it's working on. If you're holding out for wireless charging though, you might want to start saving up. Get the hottest deals available in your inbox plus news, reviews, opinion, analysis, deals and more from the TechRadar team. Dave is a freelance tech journalist who has been writing about gadgets, apps and the web for more than two decades. Based out of Stockport, England, on TechRadar you'll find him covering news, features and reviews, particularly for phones, tablets and wearables. Working to ensure our breaking news coverage is the best in the business over weekends, David also has bylines at Gizmodo, T3, PopSci and a few other places besides, as well as being many years editing the likes of PC Explorer and The Hardware Handbook.
english
import { datamodelSingleTable, datamodelTableWithBlockId, datamodelTableWithBlockIdAndCompositeUnqiue, datamodelTableWithJsonDefault, datamodelTableWithOneCompositeUniqueIndex, datamodelTableWithSingleCompositeUniqueIndex, datamodelTableWithStringDefaults, datamodelTableWithThreeFieldsCompositeUniqueIndex, datamodelTableWithTwoCompositeUniqueIndex, datamodelTableWithMultiQuoteComment, } from './fixtures/table.datamodel'; import { generateDMMF } from './utils/generateDMMF'; import { generateTables } from '../src/generator/table'; describe('Tables', () => { test('generate a table', async () => { const dmmf = await generateDMMF(datamodelSingleTable); const expected = `Table User { id Int [pk, increment] name String [not null] age Int }`; const tables = generateTables(dmmf.datamodel.models); expect(tables.length).toEqual(1); expect(tables[0]).toMatch(expected); }); test('generate a table with empty string default', async () => { const dmmf = await generateDMMF(datamodelTableWithStringDefaults); const expected = `Table Post { id Int [pk, increment] title String [not null, default: ''] color String [not null, default: 'blue'] }`; const tables = generateTables(dmmf.datamodel.models); expect(tables.length).toEqual(1); expect(tables[0]).toMatch(expected); }); test('generate a table with single composite unique index', async () => { const dmmf = await generateDMMF( datamodelTableWithSingleCompositeUniqueIndex ); const expected = `Table A { id Int [pk, increment] b String [unique, not null] }`; const tables = generateTables(dmmf.datamodel.models); expect(tables.length).toEqual(1); expect(tables[0]).toMatch(expected); }); test('generate a table with three fields as composite unique index', async () => { const dmmf = await generateDMMF( datamodelTableWithThreeFieldsCompositeUniqueIndex ); const expected = `Table A { id Int [pk, increment] b String [not null] c Int [not null] d DateTime [not null] indexes { (d, b, c) [unique] } }`; const tables = generateTables(dmmf.datamodel.models); expect(tables.length).toEqual(1); expect(tables[0]).toMatch(expected); }); test('generate a table with one composite unique index', async () => { const dmmf = await generateDMMF(datamodelTableWithOneCompositeUniqueIndex); const expected = `Table Token { id Int [pk, increment] device String [not null] operatingSystem String [not null] indexes { (device, operatingSystem) [unique] } }`; const tables = generateTables(dmmf.datamodel.models); expect(tables.length).toEqual(1); expect(tables[0]).toMatch(expected); }); test('generate a table with two composite unique index', async () => { const dmmf = await generateDMMF(datamodelTableWithTwoCompositeUniqueIndex); const expected = `Table A { id Int [pk, increment] b String [not null] c String [not null] d Int [not null] e DateTime [not null] indexes { (b, d) [unique] (e, c) [unique] } }`; const tables = generateTables(dmmf.datamodel.models); expect(tables.length).toEqual(1); expect(tables[0]).toMatch(expected); }); test('generate a table with block id', async () => { const dmmf = await generateDMMF(datamodelTableWithBlockId); const expected = `Table User { firstName String [not null] lastName String [not null] email String [unique, not null] isAdmin Boolean [not null, default: false] indexes { (firstName, lastName) [pk] } }`; const tables = generateTables(dmmf.datamodel.models); expect(tables.length).toEqual(1); expect(tables[0]).toMatch(expected); }); test('generate a table with block id and composite unique index', async () => { const dmmf = await generateDMMF( datamodelTableWithBlockIdAndCompositeUnqiue ); const expected = `Table User { firstName String [not null] lastName String [not null] email String [not null] role String [not null] isAdmin Boolean [not null, default: false] indexes { (firstName, lastName) [pk] (email, role) [unique] } }`; const tables = generateTables(dmmf.datamodel.models); expect(tables.length).toEqual(1); expect(tables[0]).toMatch(expected); }); test('generate a table with comment with multiple quotes', async () => { const dmmf = await generateDMMF( datamodelTableWithMultiQuoteComment ); const expected = `Table Example { id String [pk] serial BigInt [not null, default: 0, note: '@FieldType({ name: \\'Scalars.GraphQLBigInt\\', from: \\'graphql-scalars\\', input: true, output: true })'] }`; const tables = generateTables(dmmf.datamodel.models); expect(tables.length).toEqual(1); expect(tables[0]).toMatch(expected); }); test('generate a table with json default', async () => { const dmmf = await generateDMMF( datamodelTableWithJsonDefault ); const expected = `Table Example { id String [pk] jsonField Json [not null, default: '{"example": 0.7}'] }`; const tables = generateTables(dmmf.datamodel.models); expect(tables.length).toEqual(1); expect(tables[0]).toMatch(expected); }); });
typescript
<reponame>Grayspot/Weathery<filename>node_modules/.cache/babel-webpack/c8a9b9bb528faaaba164f3e0bae01c73.json {"ast":null,"code":"import _classCallCheck from \"Z:/GIT REPOS/Weathery/node_modules/@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"Z:/GIT REPOS/Weathery/node_modules/@babel/runtime/helpers/esm/createClass\";\nimport _get from \"Z:/GIT REPOS/Weathery/node_modules/@babel/runtime/helpers/esm/get\";\nimport _getPrototypeOf from \"Z:/GIT REPOS/Weathery/node_modules/@babel/runtime/helpers/esm/getPrototypeOf\";\nimport _inherits from \"Z:/GIT REPOS/Weathery/node_modules/@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"Z:/GIT REPOS/Weathery/node_modules/@babel/runtime/helpers/esm/createSuper\";\nimport { AsyncAction } from './AsyncAction';\nexport var QueueAction = /*#__PURE__*/function (_AsyncAction) {\n _inherits(QueueAction, _AsyncAction);\n\n var _super = _createSuper(QueueAction);\n\n function QueueAction(scheduler, work) {\n var _this;\n\n _classCallCheck(this, QueueAction);\n\n _this = _super.call(this, scheduler, work);\n _this.scheduler = scheduler;\n _this.work = work;\n return _this;\n }\n\n _createClass(QueueAction, [{\n key: \"schedule\",\n value: function schedule(state) {\n var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n if (delay > 0) {\n return _get(_getPrototypeOf(QueueAction.prototype), \"schedule\", this).call(this, state, delay);\n }\n\n this.delay = delay;\n this.state = state;\n this.scheduler.flush(this);\n return this;\n }\n }, {\n key: \"execute\",\n value: function execute(state, delay) {\n return delay > 0 || this.closed ? _get(_getPrototypeOf(QueueAction.prototype), \"execute\", this).call(this, state, delay) : this._execute(state, delay);\n }\n }, {\n key: \"requestAsyncId\",\n value: function requestAsyncId(scheduler, id) {\n var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n\n if (delay !== null && delay > 0 || delay === null && this.delay > 0) {\n return _get(_getPrototypeOf(QueueAction.prototype), \"requestAsyncId\", this).call(this, scheduler, id, delay);\n }\n\n return scheduler.flush(this);\n }\n }]);\n\n return QueueAction;\n}(AsyncAction);","map":{"version":3,"sources":["../../../src/internal/scheduler/QueueAction.ts"],"names":[],"mappings":";;;;;;AAAA,SAAS,WAAT,QAA4B,eAA5B;AAUA,WAAa,WAAb;AAAA;;AAAA;;AAEE,uBAAsB,SAAtB,EACsB,IADtB,EACyE;AAAA;;AAAA;;AACvE,8BAAM,SAAN,EAAiB,IAAjB;AAFoB,UAAA,SAAA,GAAA,SAAA;AACA,UAAA,IAAA,GAAA,IAAA;AAAmD;AAExE;;AALH;AAAA;AAAA,WAOS,kBAAS,KAAT,EAAqC;AAAA,UAAjB,KAAiB,uEAAD,CAAC;;AAC1C,UAAI,KAAK,GAAG,CAAZ,EAAe;AACb,yFAAsB,KAAtB,EAA6B,KAA7B;AACD;;AACD,WAAK,KAAL,GAAa,KAAb;AACA,WAAK,KAAL,GAAa,KAAb;AACA,WAAK,SAAL,CAAe,KAAf,CAAqB,IAArB;AACA,aAAO,IAAP;AACD;AAfH;AAAA;AAAA,WAiBS,iBAAQ,KAAR,EAAkB,KAAlB,EAA+B;AACpC,aAAQ,KAAK,GAAG,CAAR,IAAa,KAAK,MAAnB,4EACS,KADT,EACgB,KADhB,IAEL,KAAK,QAAL,CAAc,KAAd,EAAqB,KAArB,CAFF;AAGD;AArBH;AAAA;AAAA,WAuBY,wBAAe,SAAf,EAA0C,EAA1C,EAAqE;AAAA,UAAjB,KAAiB,uEAAD,CAAC;;AAI7E,UAAK,KAAK,KAAK,IAAV,IAAkB,KAAK,GAAG,CAA3B,IAAkC,KAAK,KAAK,IAAV,IAAkB,KAAK,KAAL,GAAa,CAArE,EAAyE;AACvE,+FAA4B,SAA5B,EAAuC,EAAvC,EAA2C,KAA3C;AACD;;AAED,aAAO,SAAS,CAAC,KAAV,CAAgB,IAAhB,CAAP;AACD;AAhCH;;AAAA;AAAA,EAAoC,WAApC","sourcesContent":["import { AsyncAction } from './AsyncAction';\r\nexport class QueueAction extends AsyncAction {\r\n constructor(scheduler, work) {\r\n super(scheduler, work);\r\n this.scheduler = scheduler;\r\n this.work = work;\r\n }\r\n schedule(state, delay = 0) {\r\n if (delay > 0) {\r\n return super.schedule(state, delay);\r\n }\r\n this.delay = delay;\r\n this.state = state;\r\n this.scheduler.flush(this);\r\n return this;\r\n }\r\n execute(state, delay) {\r\n return (delay > 0 || this.closed) ?\r\n super.execute(state, delay) :\r\n this._execute(state, delay);\r\n }\r\n requestAsyncId(scheduler, id, delay = 0) {\r\n if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {\r\n return super.requestAsyncId(scheduler, id, delay);\r\n }\r\n return scheduler.flush(this);\r\n }\r\n}\r\n//# sourceMappingURL=QueueAction.js.map"]},"metadata":{},"sourceType":"module"}
json
<filename>pubsublite-beam-io/src/main/java/com/google/cloud/pubsublite/beam/OffsetByteRange.java /* * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.cloud.pubsublite.beam; import com.google.auto.value.AutoValue; import org.apache.beam.sdk.coders.DefaultCoder; import org.apache.beam.sdk.io.range.OffsetRange; @AutoValue @DefaultCoder(OffsetByteRangeCoder.class) abstract class OffsetByteRange { abstract OffsetRange getRange(); abstract long getByteCount(); static OffsetByteRange of(OffsetRange range, long byteCount) { return new AutoValue_OffsetByteRange(range, byteCount); } static OffsetByteRange of(OffsetRange range) { return of(range, 0); } }
java
In the background of reported financial stress experienced by scheduled domestic airlines, DGCA has carried out financial surveillance from safety perspective of these airlines in December, 2011. Several findings have been noted with respect to backlog of flight crew training, Flight Operations Quality Assurance (FOQA) monitoring, shortage of operational crew, delay in disbursement of salaries etc. CEOs of all these airlines have been called for detailed examination of individual cases. There were apprehensions indicated about Kingfisher Airlines having a number of aircraft on ground for want of engines/spares due to which they were operating a truncated schedule. With regard to Air India Express, concern was expressed about some safety issues that remain pending and shortage of training captains. Airlines have been asked to submit their recovery plan with firm time lines next week. Financial Surveillance of Air India is proposed to be conducted by DGCA next Week.
english
package org.innovateuk.ifs.documentation; import org.innovateuk.ifs.application.builder.FundingNotificationResourceBuilder; import org.innovateuk.ifs.util.MapFunctions; import org.springframework.restdocs.payload.FieldDescriptor; import static org.innovateuk.ifs.application.builder.FundingNotificationResourceBuilder.newFundingNotificationResource; import static org.innovateuk.ifs.application.resource.FundingDecision.*; import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; public class FundingNotificationResourceDocs { public static final FieldDescriptor[] fundingNotificationResourceFields = { fieldWithPath("messageBody").description("The message body of the funding notification"), fieldWithPath("fundingDecisions").description("Map which holds the funding decision per application for which to notify the lead applicant"), }; public static final FundingNotificationResourceBuilder FUNDING_NOTIFICATION_RESOURCE_BUILDER = newFundingNotificationResource() .withMessageBody("message body") .withFundingDecisions(MapFunctions.asMap(1L, FUNDED, 2L, UNFUNDED, 3L, ON_HOLD)); }
java
<reponame>uniba-ub/dspace-angular /*import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { By } from '@angular/platform-browser'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TagComponent } from './tag.component'; import { Item } from '../../../../../../../core/shared/item.model'; import { tagMedataComponent } from '../../../../../../../shared/testing/tag-metadata-components.mock'; import { TranslateLoaderMock } from '../../../../../../../shared/mocks/translate-loader.mock'; import { DsDatePipe } from '../../../../../../pipes/ds-date.pipe'; import { SharedModule } from '../../../../../../../shared/shared.module'; import { UploaderService } from '../../../../../../../shared/uploader/uploader.service'; class TestItem { allMetadataValues(key: string): string[] { return ['HKU', 'ASDF']; } } describe('TagComponent', () => { let component: TagComponent; let fixture: ComponentFixture<TagComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ imports: [TranslateModule.forRoot({ loader: { provide: TranslateLoader, useClass: TranslateLoaderMock } }), BrowserAnimationsModule, SharedModule], declarations: [ TagComponent, DsDatePipe ], providers : [ { provide: UploaderService, useValue: {} }, ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(TagComponent); component = fixture.componentInstance; component.item = new TestItem() as Item; component.field = tagMedataComponent.rows[0].fields[0]; fixture.detectChanges(); }); it('should have the right label', (done) => { const spanLabelFound = fixture.debugElement.query(By.css('div.' + tagMedataComponent.rows[0].fields[0].style + ' > span')); expect(spanLabelFound.nativeElement.textContent.trim()).toBe(tagMedataComponent.rows[0].fields[0].label); done(); }); it('should have chips', () => { const chips = fixture.debugElement.query(By.css('ds-chips')); expect(chips).toBeTruthy(); }); it('should have the right chip values if it has no indexToBeRendered', (done) => { const chipLabelsFound = fixture.debugElement.queryAll(By.css('p.chip-label')); expect(chipLabelsFound[0].nativeElement.textContent).toContain((new TestItem()).allMetadataValues('')[0]); expect(chipLabelsFound[1].nativeElement.textContent).toContain((new TestItem()).allMetadataValues('')[1]); done(); }); it('should render single chip item if it has indexToBeRendered', (done) => { component.indexToBeRendered = 1; component.ngOnInit(); fixture.detectChanges(); const chipLabelsFound = fixture.debugElement.queryAll(By.css('p.chip-label')); expect(chipLabelsFound.length).toBe(1); expect(chipLabelsFound[0].nativeElement.textContent).toContain((new TestItem()).allMetadataValues('')[1]); done(); }); });*/
typescript
<filename>tests/test__event.py from pyformance.meters import Event, EventPoint from tests import TimedTestCase class EventTestCase(TimedTestCase): def setUp(self): super(EventTestCase, self).setUp() self.event = Event( clock=TimedTestCase.clock, key="test_event", tags={"name", "value"} ) def tearDown(self): super(EventTestCase, self).tearDown() def test_add_event_and_read_it(self): mock_values = {"value": 1} self.event.add(mock_values) events = self.event.get_events() self.assertEqual(events, [EventPoint( time=self.clock.time(), values=mock_values )]) def test_clear_event_clears_events(self): self.event.add({"value": 1}) self.event.clear() self.assertEqual(len(self.event.get_events()), 0) def test_get_event_returns_shallow_copy(self): mock_values = {"value": 1} self.event.add(mock_values) events = self.event.get_events() self.assertEqual(len(events), 1) # make sure the returned object is not a reference(important for thread safety) self.event.clear() self.assertEqual(len(events), 1)
python
Mumbai captain Prithvi Shaw, who is the leading run-getter in the ongoing Vijay Hazare Trophy, was carried off the field after being hit on the shin during the final against Uttar Pradesh on Sunday. The incident occurred in the 24th over of the innings when Prithvi, who was fielding in the first slip, got hit on the shin after Uttar Pradesh opener Madhav Kaushik slapped a shot off young leg-spinner Prashant Solanki. However, Shaw was back on the field after being treated for the injury. The ball hit Shaw on the left leg's shin and the diminutive right-handed opener, who had hit four centuries including an unbeaten double hundred in the tournament so far, looked in pain and was down on the ground. He was immediately taken off the field by the physio and his teammates. It is not yet known whether Shaw would come out to bat or not in the Mumbai innings.
english
Plagued by poor batting form for long, a jittery India will need to strike the right combination and lift the standard of their game as they strive to bring their ODI tri-series campaign back on track when they take on Sri Lanka at WACA on Wednesday. India let Australia off the hook in the opening match in Melbourne and missing out on an opportunity in Wednesday’s crucial clash would make the job very tough for them. India had opted to ‘rest’ Virender Sehwag in the first match and the team management has indicated that the dashing opener will come back into the team at the expense of a top order batsman. India’s bowling line-up is sure to have a new look on a bouncy WACA pitch. It would be not be prudent to include a spin-based attack. Either Ravinder Jadeja or Ravichandran Ashwin, or both, could make way for Umesh Yadav and possibly Zaheer Khan. In Australia, the two teams have clashed five times and India has an advantage of 2-1 over their southern neighbours, with two matches finishing with no result. India still feels the pain of their last visit to WACA last month when they lost the third Test to Australia in two and a half days by an innings margin. It’s record at this venue though isn’t too bad. It has won three games and lost five matches since 1980 when it first played New Zealand in a triangular and won by five runs. The fast outfield and less-than a steepling bounce enables big scores to be managed at this ground. Five wins each in the last 10 ODIs between the two sides might suggest an even battle between two sub-continental teams but ever so quietly, the young brigade has begun to make headlines for Sri Lanka in the last few months. The trio of Dinesh Chandimal, Lahiru Thirimanne and Thisara Perera are all 22-year-olds but are already seen as a very dangerous quotient in Sri Lanka’s resurgence who chased down two near 300-plus scores against South Africa last month. The Indians remember at least two of these three young men, all multidimensional cricketers, for wrong reasons. Chandimal, an admirer of swashbuckling Sri Lanka opener of 90s, Romesh Kaluwitharana, has a liking for Indian bowling. He made a one-day century against India in a triangular series in Zimbabwe two years ago. In 2007, he had given notice of his promise with a attacking century against India Under-19 team. The young wicketkeeper-batsman already has two hundreds and three fifties from 22 one-day internationals. Thisara Perera is a left-hand bat who bowls aggressive right-arm medium-fast stuff with a bustling run-up. India remembers this 22-year-old with remorse as well for his attacking batting was the reason India lost a match in Mirpur, Bangladesh in a triangular series two years ago. He had then smashed 36 off 15 balls with six fours and a six. He was part of Chennai Super Kings in IPL last year. There is then Lahiru Thirimanne who is widely regarded as the best young batsman in Sri Lanka. Thirimanne has a reputation as a tremendous finisher of a cricket match. His strike rate is 96 in one-dayers in his brief five-match career so far. He also has begun to make a mark in Test cricket. Keen to get its spin-bowling stock up, Sri Lanka has also introduced off-spinner Sachitra Senanayke in the mix. His economy rate of 5.42 in first two ODIs hasn’t gone without notice. His 297 scalps in 59 first class matches at 20-odd economy rate marks him as a bowler to watch. Sri Lanka has brought in these youngsters without losing its might in experience and class. Openers Tillakaratne Dilshan and Upul Tharanaga are a force to reckon with in ODI cricket. Mahela Jayawardene and Kumar Sangakkara, as ever, are the backbone of Sri Lankan batting. Then there is irrepressible Lasith Malinga, arguably the best one-day bowler in the world. With an opponent as strong in batting as Sri Lanka is, the Indians s unlikely to change its tactics of chasing a target in ODIs. Despite its failures against Australia this summer, the batting could expect to come good against the lesser firepower of Sri Lankan bowling.(PTI) India (Probable): Sachin Tendulkar, Virender Sehwag, Gautam Gambhir, Virat Kohli, Suresh Raina, Rohit Sharma, MS Dhoni (c/wk), Umesh Yadav, Praveen Kumar, Vinay Kumar, Ravichandran Ashwin, Umpires: Nigel Llong (Eng) and Paul Reiffel (Aus) Third umpire: Bruce Oxenford (Aus) Match referee: Andy Pycroft (Zim)
english
{"name": "see", "description": "dir for humans. A library for Python 2 and 3.", "license": {"key": "bsd-3-clause", "name": "BSD 3-clause \"New\" or \"Revised\" License", "spdx_id": "BSD-3-Clause", "url": "https://api.github.com/licenses/bsd-3-clause"}, "starNum": 221, "folkNum": 14, "watchNum": 221, "topic": ["developer-tools", "pypi", "python"]}
json
import { Observable, ObservableBase, ReadOnlyObservable } from "@anderjason/observable"; import { Actor } from "skytree"; import { Money } from "@anderjason/money"; export interface MoneyInputProps { parentElement: HTMLElement; value: Observable<Money>; allowEmpty?: boolean; errorLabel?: string | ObservableBase<string>; maxValue?: Money; persistentLabel?: string | ObservableBase<string>; placeholderLabel?: string | ObservableBase<string>; supportLabel?: string | ObservableBase<string>; } export declare function shouldRejectInput(input: string): boolean; export declare class MoneyInput extends Actor<MoneyInputProps> { private _textInput; get isFocused(): ReadOnlyObservable<boolean>; onActivate(): void; }
typescript
import ArtifactGenerator from ".."; let tk = ArtifactGenerator.Core.tk; let ArtifactCompiler = ArtifactGenerator.ArtifactCompiler; import{_} from 'lodash'; var idea_txt = document.getElementById("sample_text").innerText; var simple_text = document.getElementById("simple_example").innerText; try{ var artGen = new ArtifactCompiler(simple_text); let tokens = artGen.scanner.tokens; for (var i = 0; i < tokens.length; i++) { addMyTag(tokens[i].string, tokens[i].symbol, "tokens"); } let obj = artGen.generate(); let output = obj.export(); log(output, "success"); } catch(e){ log(e.message + e.callstack, "warn"); } function addMyTag(text, klass, parent){ text = text.replace(/\\n/g, "<br\>"); if(klass == tk.NEWLINE){ document.getElementById(parent).appendChild(document.createElement("br")); return; } let l = document.createElement("div", {class: klass.toString()}); l.innerHTML = text; document.getElementById(parent).appendChild(l); } export function log(text, level){ if(!level){ level = "log"; } if(!( text instanceof String)){ text = JSON.stringify(text); } text = text.replace(/\\n/g, "<br\>"); let l = document.createElement("div", {class: level}); l.innerHTML = text; document.getElementById("logger").appendChild(l); }
javascript
def import_code_query(path, project_name=None, language=None): if not path: raise Exception('An importCode query requires a project path') if project_name and language: fmt_str = u"""importCode(inputPath=\"%s\", projectName=\"%s\", language=\"%s\")""" return fmt_str % (path, project_name, language) if project_name and (language is None): fmt_str = u"""importCode(inputPath=\"%s\", projectName=\"%s\")""" return fmt_str % (path, project_name) return u"importCode(\"%s\")" % (path) def workspace_query(): return "workspace"
python
Spain will be one of the exciting teams to be seen in action in the World Cup. In fact, the Red Sticks have always been a side that provides thrills for the spectators with their ability to punch above their weight. But the dynamics of the team has changed in the recent times, especially due to the exit of 10 players after the 2016 Olympics. Nevertheless, being competitive has been the mantra of the team, which is now a mix of youth and experience. Head coach Frederic Soyez, a former French player, has been in charge of the Spanish side for the last four years and has guided the team to fifth place in 2016 Olympics and the European Championships and through qualification for this the World Cup, claiming fourth spot in the Hockey World League Semifinals in Johannesburg. Soyez expects his eighth-ranked side to surprise some of its opponents in Bhubaneswar as he believes the difference between the top four and the following eight is “not so big.” The two-time silver medallist — in 1971 and 1998 — and one-time bronze medal winner, in 2006, will be banking on experienced hands such as Quico Cortes, Sergi Enrique, Pau Quemada, Marc Salles, Miki Delas and Xavi Lleonart, and promising players including Quique Gonzalez de Castejon and Marc Bolto. Spain, which started its preparations in September with the squad playing thrice a week and scheduled some Test matches against quality European sides such as Netherlands, Germany and Belgium, was expected to land in Bhubaneswar six days prior to the World Cup. Even though Spain experienced similar conditions in the HWL Finals in the Odisha capital exactly a year ago, the week’s exposure would have helped in acclimatisation to the weather and familiarisation with the new-look stadium.
english
<filename>internal/cmd/cmd_gen_pbentity.go package cmd import ( "bytes" "context" "fmt" "strings" "github.com/gogf/gf-cli/v2/internal/consts" "github.com/gogf/gf-cli/v2/utility/mlog" "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gtag" "github.com/olekukonko/tablewriter" ) const ( cGenPbEntityConfig = `gfcli.gen.pbentity` cGenPbEntityBrief = `generate entity message files in protobuf3 format` cGenPbEntityEg = ` gf gen pbentity gf gen pbentity -l "mysql:root:12345678@tcp(127.0.0.1:3306)/test" gf gen pbentity -p ./protocol/demos/entity -t user,user_detail,user_login gf gen pbentity -r user_ ` cGenPbEntityAd = ` CONFIGURATION SUPPORT Options are also supported by configuration file. It's suggested using configuration file instead of command line arguments making producing. The configuration node name is "gf.gen.pbentity", which also supports multiple databases, for example(config.yaml): gfcli: gen: - pbentity: link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test" path: "protocol/demos/entity" tables: "order,products" package: "demos" - pbentity: link: "mysql:root:12345678@tcp(127.0.0.1:3306)/primary" path: "protocol/demos/entity" prefix: "primary_" tables: "user, userDetail" package: "demos" option: | option go_package = "protobuf/demos"; option java_package = "protobuf/demos"; option php_namespace = "protobuf/demos"; ` cGenPbEntityBriefPath = `directory path for generated files` cGenPbEntityBriefPackage = `package name for all entity proto files` cGenPbEntityBriefLink = `database configuration, the same as the ORM configuration of GoFrame` cGenPbEntityBriefTables = `generate models only for given tables, multiple table names separated with ','` cGenPbEntityBriefPrefix = `add specified prefix for all entity names and entity proto files` cGenPbEntityBriefRemovePrefix = `remove specified prefix of the table, multiple prefix separated with ','` cGenPbEntityBriefOption = `extra protobuf options` cGenPbEntityBriefGroup = ` specifying the configuration group name of database for generated ORM instance, it's not necessary and the default value is "default" ` cGenPbEntityBriefNameCase = ` case for message attribute names, default is "Camel": | Case | Example | |---------------- |--------------------| | Camel | AnyKindOfString | | CamelLower | anyKindOfString | default | Snake | any_kind_of_string | | SnakeScreaming | ANY_KIND_OF_STRING | | SnakeFirstUpper | rgb_code_md5 | | Kebab | any-kind-of-string | | KebabScreaming | ANY-KIND-OF-STRING | ` cGenPbEntityBriefJsonCase = ` case for message json tag, cases are the same as "nameCase", default "CamelLower". set it to "none" to ignore json tag generating. ` ) type ( cGenPbEntityInput struct { g.Meta `name:"pbentity" config:"{cGenPbEntityConfig}" brief:"{cGenPbEntityBrief}" eg:"{cGenPbEntityEg}" ad:"{cGenPbEntityAd}"` Path string `name:"path" short:"p" brief:"{cGenPbEntityBriefPath}"` Package string `name:"package" short:"k" brief:"{cGenPbEntityBriefPackage}"` Link string `name:"link" short:"l" brief:"{cGenPbEntityBriefLink}"` Tables string `name:"tables" short:"t" brief:"{cGenPbEntityBriefTables}"` Prefix string `name:"prefix" short:"f" brief:"{cGenPbEntityBriefPrefix}"` RemovePrefix string `name:"removePrefix" short:"r" brief:"{cGenPbEntityBriefRemovePrefix}"` NameCase string `name:"nameCase" short:"n" brief:"{cGenPbEntityBriefNameCase}" d:"Camel"` JsonCase string `name:"jsonCase" short:"j" brief:"{cGenPbEntityBriefJsonCase}" d:"CamelLower"` Option string `name:"option" short:"o" brief:"{cGenPbEntityBriefOption}"` } cGenPbEntityOutput struct{} cGenPbEntityInternalInput struct { cGenPbEntityInput TableName string // TableName specifies the table name of the table. NewTableName string // NewTableName specifies the prefix-stripped name of the table. } ) func init() { gtag.Sets(g.MapStrStr{ `cGenPbEntityConfig`: cGenPbEntityConfig, `cGenPbEntityBrief`: cGenPbEntityBrief, `cGenPbEntityEg`: cGenPbEntityEg, `cGenPbEntityAd`: cGenPbEntityAd, `cGenPbEntityBriefPath`: cGenPbEntityBriefPath, `cGenPbEntityBriefPackage`: cGenPbEntityBriefPackage, `cGenPbEntityBriefLink`: cGenPbEntityBriefLink, `cGenPbEntityBriefTables`: cGenPbEntityBriefTables, `cGenPbEntityBriefPrefix`: cGenPbEntityBriefPrefix, `cGenPbEntityBriefRemovePrefix`: cGenPbEntityBriefRemovePrefix, `cGenPbEntityBriefGroup`: cGenPbEntityBriefGroup, `cGenPbEntityBriefNameCase`: cGenPbEntityBriefNameCase, `cGenPbEntityBriefJsonCase`: cGenPbEntityBriefJsonCase, `cGenPbEntityBriefOption`: cGenPbEntityBriefOption, }) } func (c cGen) PbEntity(ctx context.Context, in cGenPbEntityInput) (out *cGenPbEntityOutput, err error) { var ( config = g.Cfg() ) if config.Available(ctx) { v := config.MustGet(ctx, cGenPbEntityConfig) if v.IsSlice() { for i := 0; i < len(v.Interfaces()); i++ { doGenPbEntityForArray(ctx, i, in) } } else { doGenPbEntityForArray(ctx, -1, in) } } else { doGenPbEntityForArray(ctx, -1, in) } mlog.Print("done!") return } func doGenPbEntityForArray(ctx context.Context, index int, in cGenPbEntityInput) { var ( err error db gdb.DB ) if index >= 0 { err = g.Cfg().MustGet( ctx, fmt.Sprintf(`%s.%d`, cGenDaoConfig, index), ).Scan(&in) if err != nil { mlog.Fatalf(`invalid configuration of "%s": %+v`, cGenDaoConfig, err) } } if in.Package == "" { mlog.Fatal("package name should not be empty") } removePrefixArray := gstr.SplitAndTrim(in.RemovePrefix, ",") // It uses user passed database configuration. if in.Link != "" { var ( tempGroup = gtime.TimestampNanoStr() match, _ = gregex.MatchString(`([a-z]+):(.+)`, in.Link) ) if len(match) == 3 { gdb.AddConfigNode(tempGroup, gdb.ConfigNode{ Type: gstr.Trim(match[1]), Link: gstr.Trim(match[2]), }) db, _ = gdb.Instance(tempGroup) } } else { db = g.DB() } if db == nil { mlog.Fatal("database initialization failed") } tableNames := ([]string)(nil) if in.Tables != "" { tableNames = gstr.SplitAndTrim(in.Tables, ",") } else { tableNames, err = db.Tables(context.TODO()) if err != nil { mlog.Fatalf("fetching tables failed: \n %v", err) } } for _, tableName := range tableNames { newTableName := tableName for _, v := range removePrefixArray { newTableName = gstr.TrimLeftStr(newTableName, v, 1) } generatePbEntityContentFile(ctx, db, cGenPbEntityInternalInput{ cGenPbEntityInput: in, TableName: tableName, NewTableName: newTableName, }) } } // generatePbEntityContentFile generates the protobuf files for given table. func generatePbEntityContentFile(ctx context.Context, db gdb.DB, in cGenPbEntityInternalInput) { fieldMap, err := db.TableFields(ctx, in.TableName) if err != nil { mlog.Fatalf("fetching tables fields failed for table '%s':\n%v", in.TableName, err) } // Change the `newTableName` if `Prefix` is given. newTableName := "Entity_" + in.Prefix + in.NewTableName var ( tableNameCamelCase = gstr.CaseCamel(newTableName) tableNameSnakeCase = gstr.CaseSnake(newTableName) entityMessageDefine = generateEntityMessageDefinition(tableNameCamelCase, fieldMap, in) fileName = gstr.Trim(tableNameSnakeCase, "-_.") path = gfile.Join(in.Path, fileName+".proto") ) entityContent := gstr.ReplaceByMap(getTplPbEntityContent(""), g.MapStrStr{ "{PackageName}": in.Package, "{OptionContent}": in.Option, "{EntityMessage}": entityMessageDefine, }) if err := gfile.PutContents(path, strings.TrimSpace(entityContent)); err != nil { mlog.Fatalf("writing content to '%s' failed: %v", path, err) } else { mlog.Print("generated:", path) } } // generateEntityMessageDefinition generates and returns the message definition for specified table. func generateEntityMessageDefinition(entityName string, fieldMap map[string]*gdb.TableField, in cGenPbEntityInternalInput) string { var ( buffer = bytes.NewBuffer(nil) array = make([][]string, len(fieldMap)) names = sortFieldKeyForPbEntity(fieldMap) ) for index, name := range names { array[index] = generateMessageFieldForPbEntity(index+1, fieldMap[name], in) } tw := tablewriter.NewWriter(buffer) tw.SetBorder(false) tw.SetRowLine(false) tw.SetAutoWrapText(false) tw.SetColumnSeparator("") tw.AppendBulk(array) tw.Render() stContent := buffer.String() // Let's do this hack of table writer for indent! stContent = gstr.Replace(stContent, " #", "") buffer.Reset() buffer.WriteString(fmt.Sprintf("message %s {\n", entityName)) buffer.WriteString(stContent) buffer.WriteString("}") return buffer.String() } // generateMessageFieldForPbEntity generates and returns the message definition for specified field. func generateMessageFieldForPbEntity(index int, field *gdb.TableField, in cGenPbEntityInternalInput) []string { var ( typeName string comment string jsonTagStr string ) t, _ := gregex.ReplaceString(`\(.+\)`, "", field.Type) t = gstr.Split(gstr.Trim(t), " ")[0] t = gstr.ToLower(t) switch t { case "binary", "varbinary", "blob", "tinyblob", "mediumblob", "longblob": typeName = "bytes" case "bit", "int", "tinyint", "small_int", "smallint", "medium_int", "mediumint", "serial": if gstr.ContainsI(field.Type, "unsigned") { typeName = "uint32" } else { typeName = "int32" } case "int8", "big_int", "bigint", "bigserial": if gstr.ContainsI(field.Type, "unsigned") { typeName = "uint64" } else { typeName = "int64" } case "real": typeName = "float" case "float", "double", "decimal", "smallmoney": typeName = "double" case "bool": typeName = "bool" case "datetime", "timestamp", "date", "time": typeName = "int64" default: // Auto detecting type. switch { case strings.Contains(t, "int"): typeName = "int" case strings.Contains(t, "text") || strings.Contains(t, "char"): typeName = "string" case strings.Contains(t, "float") || strings.Contains(t, "double"): typeName = "double" case strings.Contains(t, "bool"): typeName = "bool" case strings.Contains(t, "binary") || strings.Contains(t, "blob"): typeName = "bytes" case strings.Contains(t, "date") || strings.Contains(t, "time"): typeName = "int64" default: typeName = "string" } } comment = gstr.ReplaceByArray(field.Comment, g.SliceStr{ "\n", " ", "\r", " ", }) comment = gstr.Trim(comment) comment = gstr.Replace(comment, `\n`, " ") comment, _ = gregex.ReplaceString(`\s{2,}`, ` `, comment) if jsonTagName := formatCase(field.Name, in.JsonCase); jsonTagName != "" { jsonTagStr = fmt.Sprintf(`[(gogoproto.jsontag) = "%s"]`, jsonTagName) // beautiful indent. if index < 10 { // 3 spaces jsonTagStr = " " + jsonTagStr } else if index < 100 { // 2 spaces jsonTagStr = " " + jsonTagStr } else { // 1 spaces jsonTagStr = " " + jsonTagStr } } return []string{ " #" + typeName, " #" + formatCase(field.Name, in.NameCase), " #= " + gconv.String(index) + jsonTagStr + ";", " #" + fmt.Sprintf(`// %s`, comment), } } func getTplPbEntityContent(tplEntityPath string) string { if tplEntityPath != "" { return gfile.GetContents(tplEntityPath) } return consts.TemplatePbEntityMessageContent } // formatCase call gstr.Case* function to convert the s to specified case. func formatCase(str, caseStr string) string { switch gstr.ToLower(caseStr) { case gstr.ToLower("Camel"): return gstr.CaseCamel(str) case gstr.ToLower("CamelLower"): return gstr.CaseCamelLower(str) case gstr.ToLower("Kebab"): return gstr.CaseKebab(str) case gstr.ToLower("KebabScreaming"): return gstr.CaseKebabScreaming(str) case gstr.ToLower("Snake"): return gstr.CaseSnake(str) case gstr.ToLower("SnakeFirstUpper"): return gstr.CaseSnakeFirstUpper(str) case gstr.ToLower("SnakeScreaming"): return gstr.CaseSnakeScreaming(str) case "none": return "" } return str } func sortFieldKeyForPbEntity(fieldMap map[string]*gdb.TableField) []string { names := make(map[int]string) for _, field := range fieldMap { names[field.Index] = field.Name } var ( result = make([]string, len(names)) i = 0 j = 0 ) for { if len(names) == 0 { break } if val, ok := names[i]; ok { result[j] = val j++ delete(names, i) } i++ } return result }
go
import dynet as dy class LinearTransform: def __init__(self,input_dim,output_dim,pc): self.W_param = pc.add_parameters((output_dim, input_dim)) #parameter object self.b_param = pc.add_parameters((output_dim)) #parameter object self.store_expressions() def store_expressions(self): self.W = dy.parameter(self.W_param) self.bias = dy.parameter(self.b_param) def apply(self,input_vec_expression): return self.W*input_vec_expression + self.bias
python
The reigning AEW Women's World Champion Thunder Rosa has voiced her desire to square off against Athena aka Ember Moon in a world title match. Rosa dethroned Britt Baker in a grueling steel cage match to clinch the AEW Women's Title at AEW Revolution on March 6. Former WWE Superstar Ember Moon made a name for herself in WWE with some stellar outings. Post her 6-year WWE stint, she has been quite active on the independent scene, wrestling as Athena. Thunder Rosa recently made an appearance on the Battleground Podcast. When asked which opponent, no matter if they were All Elite or not, she would like to defend her title against, here's what she had to say: "[I want to defend against] Athena. We had a 30-minute match on the independent scene to defend the Warrior Wrestling Championship when I was champion there. We went at it. It was really fun. ” (23. 29-23. 50) However, this is not the first time that Rosa has expressed her desire to face Athena. They clashed for the Warrior Wrestling Women's Championship back in February, where the exquisite match ended in a time-limit draw. Rosa has wrestled around the world from small indie shows to notable promotions like ROH, NWA and Tokyo Joshi Pro for 6 years before earning her AEW contract in 2020. Reflecting upon her hard work and difficult journey, Rosa said: “I have worked my a*s off for the last eight years, from bottom to top. Now that I'm on top, I'm working even harder to stay on top and to show everybody why am I the face of AEW. They can question that all they want, but when it comes down to me getting in the ring, they already know I put my face paint on and it’s a wrap, baby. " (15. 03-15. 31) Thunder Rosa is set to defend her AEW Women’s Title against Serena Deeb at the AEW Double or Nothing pay-per-view on May 29 in Las Vegas. This will be the champion's second defense of her title since defeating Nyla Rose last month. Please credit Battleground Podcast and give a H/T to Sportskeeda when using quotes from this article. What's next for The Bloodline? Poll : Will Thunder Rosa retain her World Title at the Double or Nothing pay-per-view?
english
As you have just noticed, Pioneer and Pandora are working to bring Pandora to your car with a device that costs a shocking $1200. This being a recession and all, we decided to save you the blood, sweat, and bankruptcy that would stem from that option, and present you with a much more budget-conscious solution. Do you have a relatively new car? It should have an auxiliary input in the stereo. If not, your costs just went up $40. Buy this cheap stereo deck, it has one. Now, buy a 1/8th inch stereo cable. This one costs a steep $6.49. Now, pull out your smartphone, turn on Pandora, plug the phone into the cable, and the cable into your car stereo. There you go, Pandora in your car. How hard was that? You just saved $1193.51, assuming you have a newer stereo. Take that Pioneer. Just to make it simpler, follow the simple steps below: Get the most important tech news in your inbox each week.
english
#pragma once #include <avr/io.hpp> #include <avr/wdt.hpp> namespace avr { namespace sleep { namespace mcu { namespace pwd { [[gnu::always_inline]] inline void on() { using namespace avr::io; set(se, sm1, sm0(off)); } [[gnu::always_inline]] inline void off() { using namespace avr::io; clear(se, sm1, sm0); } }//namespace pwd template<uint32_t Period> void check_if_period_is_multiple_of_prescaler() { static_assert( !(Period % 16) || !(Period % 32) || !(Period % 64) || !(Period % 125) || !(Period % 250) || !(Period % 500) || !(Period % 1000) || !(Period % 2000) || !(Period % 4000) || !(Period % 8000), "Period should be multiple of 16ms, 32ms, 64ms, 125ms, 500ms, " "1s, 2s, 2s or 8s."); } inline constexpr bool is_equal_to_prescaler(uint32_t period) { return period == 16 || period == 32 || period == 64 || period == 125 || period == 250 || period == 500 || period == 1000 || period == 2000 || period == 4000 || period == 8000; } inline constexpr uint32_t prescaler_to(uint32_t period) { return (!(period % 8000) && ((period / 8000) > 0)) ? 8000 : (!(period % 4000) && ((period / 4000) > 0)) ? 4000 : (!(period % 2000) && ((period / 2000) > 0)) ? 2000 : (!(period % 1000) && ((period / 1000) > 0)) ? 1000 : (!(period % 500) && ((period / 500) > 0)) ? 500 : (!(period % 250) && ((period / 250) > 0)) ? 250 : (!(period % 125) && ((period / 125) > 0)) ? 125 : (!(period % 64) && ((period / 64) > 0)) ? 64 : (!(period % 32) && ((period / 32) > 0)) ? 32 : 16; } inline void turn_on_wdt(uint32_t period) { using namespace wdt; if(period == 16) on(timeout::at_16ms, mode::interrupt, atomic_precondition::yes); else if(period == 32) on(timeout::at_32ms, mode::interrupt, atomic_precondition::yes); else if(period == 64) on(timeout::at_64ms, mode::interrupt, atomic_precondition::yes); else if(period == 125) on(timeout::at_125ms, mode::interrupt, atomic_precondition::yes); else if(period == 250) on(timeout::at_250ms, mode::interrupt, atomic_precondition::yes); else if(period == 500) on(timeout::at_500ms, mode::interrupt, atomic_precondition::yes); else if(period == 1000) on(timeout::at_1s, mode::interrupt, atomic_precondition::yes); else if(period == 2000) on(timeout::at_2s, mode::interrupt, atomic_precondition::yes); else if(period == 4000) on(timeout::at_4s, mode::interrupt, atomic_precondition::yes); else if(period == 8000) on(timeout::at_8s, mode::interrupt, atomic_precondition::yes); } }}}
cpp
<reponame>fokssss/mtlPages { "component": true, "usingComponents": { "approval-listpage": "./templates/approval/listpage/listpage", "approval-detailpage": "./templates/approval/detailpage/detailpage" }, "disableScroll": true }
json
Good news for liquor retailers and drinkers in Shillong as wine shops will not be shut down in the upcoming two-day lockdown being imposed by the Meghalaya government to contain the spread of COVID19. The deputy commissioner (excise), East Khasi Hills district, in an order, issued on Saturday, said the listed wine shops in East Khasi Hills district will remain open from Monday to Saturday between 10 AM and 8 PM with effect from July 13 until further orders. The two-day total lockdown will be enforced in the entire Shillong agglomeration on July 13 & 14. In the order, the deputy commissioner (excise) laid down strict conditions that sale of liquor shall not exceed three litres of foreign liquor or wine, and four litres of beer per customer. Owners of wine stores will utilize their own staff and they should personally be responsible to ensure social distancing of at least 6 feet is maintained between customers, respiratory etiquette and to strictly follow all directives and advisories issued by the health department with reference to COVID19 situation. “Owners of wine stores should utilize their own staff and they will be responsible to ensure that no overcrowding takes place via assembly of 5 or more persons in the vicinity of the shop and to strictly avoid overcrowding and congestion in one spot, staff of a particular wine store will disperse and direct the accumulating customers to other nearby wine stores within the same locality/village. Overcrowding of customers may invite further legal action,” the order stated. The order also said the owners of wine stores should provide hand sanitizers free of cost to customers and staff while handling the bottles and cash and the wine stores should limit their staff to the barest minimum and they are to wear masks at all time, without fail. It also said the wine stores should extend full cooperation and comply with the arrangements of district administration, police, excise and other authorities involved by the district administration for regulation and monitoring purposes. The deputy commissioner (excise) has also laid down conditions that only one person per household is allowed to visit the wine store for purchase, to maintain social distancing of at least six feet, respiratory etiquette and to strictly follow all directives and advisories issued by the health department with reference to COVID19 situation and customers are to avoid overcrowding and congestion in one location. The order said violation of these instructions including physical distancing norms, non-wearing of masks, non use of sanitizers, spitting in public places and other advisories of health department shall be strictly acted upon the owner of the wine stores and the customers alike, under Section 269 and Section 188 of IPC, Section 133 of CrPC and other relevant provisions of law. The deputy commissioner also said proprietors of wine stores shall mandatorily take appropriate measures to prevent people from crowding and breaking social distancing norms in their respective premises and failure to enforce the prescribed norms will warrant closure of the wine store. Further, the deputy commissioner directed district officers of excise department to enforce the prescribed norms with support from police and the concerned sub-divisional officers (civil), block development officers and zonal team leaders in East Khasi Hills district.
english
[{"namaKab":"LAHAT","originalFilename":"Idaman Foto perbaikan.jpg","namaPartai":"PARTAI AMANAT NASIONAL","id":116108,"noUrut":1,"nama":"IDAMAN","stringJenisKelamin":"Laki-Laki"},{"namaKab":"LAHAT","originalFilename":"Saryono Foto perbaikan.jpg","namaPartai":"PARTAI AMANAT NASIONAL","id":117465,"noUrut":2,"nama":"<NAME>","stringJenisKelamin":"Laki-Laki"},{"namaKab":"LAHAT","originalFilename":"Distarizah Foto perbaikan.jpg","namaPartai":"PARTAI AMANAT NASIONAL","id":209918,"noUrut":3,"nama":"DISTARIZAH","stringJenisKelamin":"Perempuan"},{"namaKab":"LAHAT","originalFilename":"Chana Foto perbaikan.jpg","namaPartai":"PARTAI AMANAT NASIONAL","id":47402,"noUrut":4,"nama":"<NAME>","stringJenisKelamin":"Laki-Laki"},{"namaKab":"LAHAT","originalFilename":"Della Foto perbaikan.jpg","namaPartai":"PARTAI AMANAT NASIONAL","id":200886,"noUrut":5,"nama":"<NAME>","stringJenisKelamin":"Perempuan"},{"namaKab":"K<NAME>","originalFilename":"Herwin Foto perbaikan.jpg","namaPartai":"PARTAI AMANAT NASIONAL","id":127339,"noUrut":6,"nama":"<NAME>","stringJenisKelamin":"Laki-Laki"},{"namaKab":"KOTA P<NAME>","originalFilename":"Nisdiarti Foto perbaikan.jpg","namaPartai":"PARTAI AMANAT NASIONAL","id":202470,"noUrut":7,"nama":"NISDIARTI","stringJenisKelamin":"Perempuan"},{"namaKab":"KOTA PAGAR ALAM","originalFilename":"RUDI FOTO perbaikan.jpg","namaPartai":"PART<NAME>","id":132614,"noUrut":8,"nama":"<NAME>","stringJenisKelamin":"Laki-Laki"}]
json
{ "name": "@betaweb/dom-images", "version": "1.0.0", "description": "A simple JS class to get, filter, handle images and catch their loading state on HTML document, HTML node, string and/or stylesheets.", "main": "index.js", "scripts": { "test": "jest --watchAll" }, "repository": { "type": "git", "url": "git+https://github.com/betaWeb/dom-images.git" }, "keywords": [ "dom", "images", "handle-images", "css", "stylesheets", "png", "svg", "jpg", "jpeg", "background-image", "src", "js", "javascript", "simple" ], "author": "<NAME> <<EMAIL>>", "license": "MIT", "bugs": { "url": "https://github.com/betaWeb/dom-images/issues" }, "homepage": "https://github.com/betaWeb/dom-images#readme", "devDependencies": { "jest": "^24.9.0" } }
json
The Indian cricket team decimated Bangladesh in the second semifinal of the ICC Champions Trophy 2017 by 9 wickets and entered the final for the fourth time in the history of the tournament. Chasing 265 for victory, Rohit Sharma, Shikhar Dhawan, and Virat Kohli took apart the Bangladeshi bowlers one by one and achieved the target with 10 overs to spare. In the process, Rohit Sharma scored his 11th century in ODI cricket and Virat Kohli became the fastest cricketer to reach 8000 runs going past AB de Villiers in the process. Unfortunately, Yuvraj Singh who was playing in his 300th ODI did not get to bat or bowl throughout the match. Earlier in the day, the Indian bowlers found an unlikely hero in Kedar Jadhav who took the vital wickets of Tamim Iqbal and Mushfiqur Rahim. He was complemented well by Jasprit Bumrah and Bhuvneshwar Kumar who bowled extremely well. India will now take on arch-rivals Pakistan in the final on June 18 at the Oval in London. Was a great knock, especially when it comes on a winning note. Trying to get a big one, in the last two games. Was quite determined today. Wicket was brilliant. I kept telling myself to bat as much as possible. We've been playing good cricket. One last hurdle, a big game against Pakistan. It felt like he was batting overnight (Virat Kohli). As a captain, he was brilliant. We could have scored 300, even 320, but our set batsmen getting out was a setback to us. Next time, we'll come back strongly. We need to learn. Skill-wise we're fine, but mentally we need to be stronger. Another complete game. We needed to have a clean, collective game. We didn't expect to win by nine wickets, but that's the quality of our top order. He's not a surprise package (Kedar Kadhav), he's a mart guy, he knows where to pitch the ball and see what the wicket is offering. it could have been close to 300. I wanted to give myself some time, 10-15 balls. Last time, we lost a wicket, so I had to adapt, I like those challenges. I grew in confidence. When you're coming onto the short ball, you know you're playing well. We're taking it as any other game, I know that's boring but that's our mindset. Never a worry when you're middle order isn't batting too much. Everyone is hitting the ball magnificently in practice.
english
<gh_stars>1-10 n = int(input()) s = set(map(int, input().split())) for i in range(int(input())): f = input().split() if (f[0] == "pop"): s.pop() elif (f[0] == "remove"): s.remove(int(f[-1])) else: s.discard(int(f[-1])) print(sum(s))
python
<filename>data/repec/7794.json { "id": 7794, "cites": 21, "cited_by": 0, "reference": [ "<NAME>., Labor comflict im the Umited States am emcyclopedia Garland reference library of social science, New York: Garland Publishing, 1990.", "<NAME>., Labor Umioms The Greenwood Encyclopedia of American Institutions, Westport, Connecticut: Greenwood Press, 1977.", "<NAME>., Imdnstrial Dispntes amd Federal Legislatiom, New York: Columbia University Press, 1940.", "<NAME>. and <NAME>, The Impact of the Percentage Organized on Union and Nonunion Wages, The Review of Ecomomics amd Statistics, November 1981, 63 (4), 561-572.", "<NAME>, Directory of U.S. Labor Orgamizatioms, Washington, D.C.: Bureau of National Affairs, Inc., 1999.", "<NAME>, Strikes: A Stndy im Qnamtatative Ecomomics, New York: Columbia University Press, 1939.", "Kramer, <NAME>. and <NAME>, The Economic Effect of Strikes on the Shareholders of Nonstruck Competitors, Imdnstrial amd Labor Relatioms Review, January 1996, ~9 (2), 213-222.", "<NAME>, An Epidemiological Model of Unions, Unpublished Manuscript, Massachusetts Institute of Technology, May 1999.", "<NAME>, A Competitive Theory of Monopoly Unionism, Amen cam Ecomomic Review, September 1983, 73 (4), 631-643.", "<NAME>., On the Estimation of Union Threat Effects, Americam Sociological Review, December 1989, 5~ (6), 1035-1047.", "<NAME>, Event studies in economics and finance, Jonrmal of Ecomomic Lit eratnre, March 1997, 35 (1), 13-39.", "MaCurdy, Thomas and <NAME>, Testing the Efficiency of Employment Contracts, Jonrmal of Political Ecomomy, 1986, 9~, 53-539.", "Nelson, Morton, <NAME>, and <NAME>, Impact of Labor Strikes on Equity Values: Canadian Evidence, Jonrmal of Ecomomics amd Bnsimess, 1994, ~6, 153-165.", "<NAME>., The Predictability of Strikes: Evidence from the Stock Market, Imdnstrial amd Labor Relatioms Review, July 1990, 33 (4), 535-535.", "Large Are the Losses?, Imdnstrial amd Labor Relatioms Review, January 1984, 37 (2), 197-211.", "Neumark, David and <NAME>, Union Threat Effects and Nonunion Industry Wage Differentials, Imdnstrial amd Labor Relatioms Review, 1995, ~8, 20-38.", "Persons, <NAME>., The Effects of Automobile Strikes on the Stock Value of Steel Suppliers, Imdnstrial amd Labor Relatioms Review, October 1995, ~9 (1), 78-87.", "<NAME>., The Ecomomics of Trade Umioms, Chicago: University of Chicago Press, 1977.", "Reynolds, <NAME>. and <NAME>, Trade Umiom Pnblicatioms: The Official Jonrmals, Comvemtiom Proceedimgs, amd Comstitntioms of Imtermatiomal Umioms amd Federatioms, 185O-19~1, Vol. 1, Baltimore: The Johns Hopkins Press, 1944.", "<NAME> and <NAME>, Unionization and Profitability: Evidence from the Capital Market, Jonrmal of Political Ecomomy, 1984, 9~, 1134-1157.", "<NAME>., Class Struggle American Style: Unions, Strikes, and Wages, Amen cam Sociological Review, October 1986, 51, 618-631." ] }
json
<gh_stars>10-100 { "name": "zero-hour-configuration-solver", "version": "1.0.0", "description": "A visual solver for the Destiny 2 Zero Hour configuration puzzle. Based on the spread sheet produced by Math Class.", "license": "MIT", "keywords": [], "main": "src/index.js", "homepage": "https://deedlefake.github.io/zero-hour-configuration-solver/", "devDependencies": { "colors.js": "1.2.4", "gh-pages": "^2.1.1", "prettier": "^1.18.2", "react": "16.11.0", "react-dom": "16.11.0", "react-scripts": "3.2.0", "rimraf": "^3.0.0" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", "clean": "rimraf build", "deploy": "gh-pages -d build", "prettier": "prettier --write package.json public/**/*.html src/**/*.js" }, "prettier": { "printWidth": 80, "tabWidth": 2, "useTabs": true, "semi": false, "singleQuote": true, "trailingComma": "all", "bracketSpacing": true, "jsxBracketSameLine": false, "arrowParens": "always" }, "browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ] }
json
<reponame>bilahepan/springboot-learning-example package demo.springboot.thread.countDownLatch.demo2; import java.util.Random; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; /** * @author: bilahepan * @date: 2018/10/19 下午6:15 */ public class Worker implements Runnable { private CountDownLatch downLatch; private String name; public Worker(CountDownLatch downLatch, String name) { this.downLatch = downLatch; this.name = name; } public void run() { try { this.doWork(); TimeUnit.SECONDS.sleep(new Random().nextInt(1)); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(this.name + "活干完了!"); this.downLatch.countDown(); } private void doWork() { System.out.println(this.name + "正在干活!"); } }
java
<reponame>lofung/Achilles-demo<gh_stars>0 {"PREVALENCE_BY_GENDER_AGE_YEAR":{"TRELLIS_NAME":["60-69","60-69"],"SERIES_NAME":["FEMALE","FEMALE"],"X_CALENDAR_YEAR":[2008,2009],"Y_PREVALENCE_1000PP":[0.02312,0.01937]},"PREVALENCE_BY_MONTH":{"X_CALENDAR_MONTH":201007,"Y_PREVALENCE_1000PP":0.00115},"PROCEDURE_FREQUENCY_DISTRIBUTION":{"Y_NUM_PERSONS":[0,0],"X_COUNT":[1,2]},"PROCEDURES_BY_TYPE":{"CONCEPT_NAME":"EHR order list entry","COUNT_VALUE":286},"AGE_AT_FIRST_OCCURRENCE":{"CATEGORY":["MALE","FEMALE"],"MIN_VALUE":[1,1],"P10_VALUE":[12,14],"P25_VALUE":[39,34],"MEDIAN_VALUE":[54,56],"P75_VALUE":[64,66],"P90_VALUE":[73,78],"MAX_VALUE":[86,92]}}
json
<gh_stars>0 { "id":"realip", "name":"RealIP", "version":"1.0", "description":"RealIP IP parsing capabilities for Velocity", "authors":[ "lhridder" ], "dependencies":[ ], "main":"nl.lucasridder.RealIP.velocity.RealIPVelocity" }
json
North America leads the world in 4G and smartphone adoption, with the rapid adoption of 5G poised to add significant value to the regional economy, according to a new report from the GSMA, the global wireless trade association. By 2025, according to the report, around half of the region's connections are expected to be running on 5G -- a far greater share than other key 5G global regions. North American mobile subscribers are "highly engaged digital consumers, using their smartphones to access a broad range of services and content," Mats Granryd, director general of the GSMA, said in a statement. They're expected to be early adopters of 5G services in areas like ultra-HD video, AR and VR, artificial intelligence and autonomous driving. By the end of 2016, North America had the world's highest smartphone adoption rate (78 percent), as well as the highest 4G adoption rate (63 percent). Smartphone usage is expected to reach 84 percent by 2020, while the 4G adoption rate is expected to reach 81 percent, the report says. The GSMA also predicts that the mobile ecosystem's contribution to the North American economy will grow to more than $1 trillion by 2020 -- equivalent to almost five percent of regional GDP. With so much money on the table, particularly for network operators, the GSMA has teamed up with its North American counterpart the CTIA to bring its annual conference, the Global World Congress (GWC) to the US for the first time this year. Around 30,000 people are expected to attend the first GWC Americas this week in San Francisco to discuss ways to accelerate network growth, scale out IOT and develop emerging technologies like connected cars. Mobile data traffic has increased soared in the US in recent years, increasing 9-fold from 2012 through 2016, the report says. North America overall should bring in $250 billion in revenue this year for mobile operators. What will it take to scale IOT globally? With $1.8 trillion in potential global IOT revenue on the table, mobile network operators seek to extend robust connectivity options while moving up the IOT value chain. The platform was built in tight coordination with Microsoft and AT&T plans to work with Microsoft to bring the platform to market.
english
<filename>src/components/userlist.js<gh_stars>0 import React, { Component } from "react"; import { bindActionCreators } from "redux"; import { connect } from "react-redux"; import { selectUser } from "../actions/index"; class UserList extends Component { constructor(props) { super(props); this.createUsers = this.createUsers.bind(this); } createUsers() { if (this.props.users) return this.props.users.map(user => { if (this.props.users) { return ( <li key={user.id} onClick={() => this.props.selectUser(user)} style={{ textDecoration: "underline", cursor: "pointer" }} > {user.name} </li> ); } else { return <li>Chumma</li>; } }); else { return <li>Oh no</li>; } } render() { return ( <div> <h1>Came in here{this.createUsers}</h1> {/* <ul>{this.createUsers}</ul> */} <ul>{this.createUsers()}</ul> {/* {this.createUsers} */} </div> ); } } function mapStateToProps(state) { return { users: state.users }; } function mapDispatchToProps(dispatch) { return bindActionCreators({ selectUser: selectUser }, dispatch); } export default connect( mapStateToProps, mapDispatchToProps )(UserList);
javascript
A free app for iPhone, by WISE OWL PTE. LTD.. A full version program for iPhone, by APP CENTRAL LTD. A free app for iPhone, by CHAUPAL GLOBAL PTE. LIMITED. A free program for iPhone, by Indian Oil Corporation Limited.
english
<filename>dist/src/index.js "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var sessions_1 = require("./sessions"); Object.defineProperty(exports, "login", { enumerable: true, get: function () { return sessions_1.login; } }); Object.defineProperty(exports, "logout", { enumerable: true, get: function () { return sessions_1.logout; } }); var users_1 = require("./users"); Object.defineProperty(exports, "getUser", { enumerable: true, get: function () { return users_1.getUser; } }); Object.defineProperty(exports, "createUser", { enumerable: true, get: function () { return users_1.createUser; } });
javascript
Vina del Mar (Chile): Lionel Messi may be quite used to pose for selfies, but even for him it was a first when Deshorn Brown requested the star to be clicked with the striker shortly after Argentina’s laboured 1-0 win over Jamaica in Copa America. Argentina progressed to the quarters as group toppers but their performance was far from satisfactory. Messi appeared less than satisfied after the win but was polite enough to pose for the picture when approached by Brown, who was visibly happy to be just near him. Jamaican footballers didn’t seem to mind the defeat. Messi also gave away his two match jerseys to Jamaican footballers, who asked for the prized memento. The left-handed batsman from Haryana is garnering praise from all quarters for the way he’s finishing games regularly in the most exciting IPL season. Gavaskar reckons Tewatia’s whirlwind knock in Sharjah (in IPL 2020) where he smashed West Indies pacer Sheldon Cottrell for five sixes in an over, gave him the confidence that he belongs to the big stage. Gavaskar has also nicknamed the 28-year-old cricketer the ‘ice-man’ and lauded Tewatia’s ability to remain unruffled during the tense moments.
english
Call of Duty fans will be excited to learn that progress is being made on the Project Aurora mobile game. Up to this point, the developers have been very careful about sharing any details of the game since it’s still in development. However, they recently shared some exciting news that shows where the process is currently. The developers shared an update regarding the upcoming Call of Duty mobile game, codenamed Project Aurora. The developers announced that this new title aims to bring family and friends together in a diverse community. The game will deliver a fast-paced, action-driven battle royal experience for all players. While whispers and rumors about the new game have been shared on Reddit and even YouTube, the developers were very clear that none of this is official yet. The reason that they haven’t made any of this information official yet is that the game is still in early development, and as such, nothing has been finalized. They haven’t even finalized the name of the game yet, hence the reason why a codename is being used. The developers did announce that they started with the first run of the gameplay test in the Project Aurora Closed Alpha. This closed alpha is a small group of specially selected candidates. This limited group of alpha testers aims to start improving the tuning, stress test the machines, identify and fix bugs, and collect feedback and insights on all aspects of the game as new features come online. Participants of the closed alpha aren’t allowed to share any information on the game, so you can read the latest news on their official news page if you want to keep informed. Also, make sure you don’t miss the Godzilla/Kong Kong action in Call of Duty: Warzone.
english
from __future__ import annotations from typing import Optional, cast from django.contrib.auth.models import AbstractBaseUser, BaseUserManager from django.db import models from model_utils.models import TimeStampedModel, UUIDModel class UserManager(BaseUserManager): def create_user( self, username: str, password: Optional[str] = None) -> User: if not username: raise ValueError('Users must have an user name') user = cast(User, self.model(username=username)) user.set_password(password) user.save(using=self._db) return user def create_superuser( self, username: str, password: Optional[str] = None) -> User: """ Creates and saves a superuser with the given user name and password. """ user = self.create_user( username, password=password, ) user.is_staff = True user.save(using=self._db) return user class User(AbstractBaseUser, UUIDModel, TimeStampedModel): username = models.CharField( verbose_name='ユーザ名', max_length=255, unique=True, ) is_active = models.BooleanField(default=True) is_staff = models.BooleanField(default=False) is_admin = models.BooleanField(default=False) objects = UserManager() USERNAME_FIELD = 'username' def has_perm(self, perm, obj=None): return self.is_admin def has_module_perms(self, label): return self.is_admin @property def is_superuser(self): return self.is_admin
python
extern crate cryptopals; use cryptopals::challenges::set_two::*; #[test] fn test_nine() { let unpadded = b"YELLOW SUBMARINE"; let padded = challenge_nine::pad_bytes(unpadded, 20, 0x04); assert_eq!("YELLOW SUBMARINE\x04\x04\x04\x04", String::from_utf8(padded).unwrap()); } #[test] fn challenge_ten() { let file = "resources/challenges/set_two/10.txt"; let ciphertext = cryptopals::utils::return_ciphertext(file); let key = "YELLOW SUBMARINE".as_bytes(); let iv = vec![0x00;16]; let decrypted = challenge_ten::decrypt_cbc(&ciphertext, &key, &iv).unwrap(); let plaintext = String::from_utf8(decrypted).unwrap(); assert_eq!("I'm back and I'm ringin' the bell", &plaintext[0..33]); }
rust
{{ define "main" }} {{ partial "navigation.html" . }} <section class="section pt-0"> <div class="container"> <div class="row"> {{ if gt (len (where .CurrentSection.Pages "Kind" "page")) 0 }} {{ range .CurrentSection.Pages }} {{ partial "product" . }} {{ end }} {{ else }} <div class="col blink-products-navigation"> Nothing here yet. </div> {{ end }} </div> </div> </section> {{ $currentSection := lower .CurrentSection.Title }} <section class="section pt-0"> <div class="container"> <div class="row"> <div class="col mb-3"> Similar products in category: {{ .CurrentSection.Title }} </div> </div> <div class="row"> {{ $cats := slice }} {{ if eq $currentSection "products" }} {{ $cats = $.Site.GetPage "categories" "all"}} {{ else }} {{ $cats = .Site.GetPage (printf "/categories/%s" $currentSection)}} {{ end }} {{ range $cats.Pages }} {{ partial "product" . }} {{ end }} </div> </div> </section> {{ end }}
html
Genshin Impact's Spiral Abyss in version 2. 7 has not gotten any easier for the players. In fact, the developers have placed two normal bosses on the second half of floor 12, increasing the difficulty and serving as yet another DPS check. Maguu Kenki and Perpetual Mechanical Array are arguably the main obstacles on floor 12, hindering players from completing the challenge within the time limit. Without a proper strategy, Travelers may not be able to collect the full 36 stars in the current phase of Spiral Abyss. Here's a handy guide to optimizing a strategy for 2. 7's Spiral Abyss. Floor 12 in the current Genshin Impact's Spiral Abyss is a DPS check requiring fewer AoE (Area of Effect) skills than the previous cycle. As a result, it's much easier to figure out how players should put their teams together. The focus is on maximizing 1-2 DPS characters and emphasizing shield breaking in the first half. Players are advised to avoid Cryo characters entirely in the first half in general. In the first half, two Cryo and one Electro Whopperflowers spawn in the first wave. Then, two Electro and one Cryo Whopperflower will spawn to the rear for the second wave. Finally, two Geovishaps spawn in front for the third wave. The one on the left infuses Cryo, while the one on the right infuses Electro. If players don't have an Anemo character in the team, they can move to the edge of the floor, and the enemies will teleport in front. This will prevent them from being knocked back too far. A Ruin Guard will spawn first for the second half, followed by a Ruin Grader once the former has died. Since this chamber contains a Cryo monolith in the center that infuses enemies with Cryo, it is recommended that players bring a Pyro unit to dispel the Cryo aura. Additionally, a shielder is recommended due to their Geo Aura, which causes the active character to suffer a lot of damage on the field. The Ruin Guard's weaknesses are their glowing eye and a small socket at the back. Genshin Impact players must hit these spots twice in a row to paralyze the enemy for a short time. On the other hand, Ruin Grader's weaknesses in Genshin Impact are its eye and legs. Two Cryo Slimes and three Cryo Mitachurls will spawn in the first wave of the first half. The second wave features a Cryo Slime in the front with an Ice Cage Aura that creates the cage every 12 seconds and lasts for 2 seconds. A Frostarm Lawachurl also spawns in the back with a Cryo aura that debuffs players with condensed Ice. Players are advised to focus on the Cryo Slime first in the second wave as the Ice Age will prevent them from moving, resulting in a quick death. All of the enemies in this chamber are weak to Pyro elements, so bringing any Pyro DPS in Genshin Impact will significantly benefit gamers. The second half only features one Maguu Kenki, so using the best damage dealer team available is best here. Note that after he reaches 70% health, he will stop taking damage and will launch a powerful attack, so either flee from his AOE or iframe this with a dodge or burst. There is only one wave in the first half of chamber 3, and it is made up of two Primordial Bathysmal Vishap Hatchlings. These two are easily knocked back, meaning that AoE damage dealers will save time. They have significantly stronger Hydro and Physical resistance, so players are recommended to use a four-piece Viridescent artifact set or Superconduct with Physical characters to lower it down. The last enemy on floor 12 will be the most challenging one, and that is the Perpetual Mechanical Array. This floor is a definite DPS check for every Genshin Impact player due to the high HP. Therefore, players should bring their best damage-dealing team here. The enemy's Defensive Mode will create a barrier and summon four Ruin Sentinels. Attack the highlighted Ruin Sentinel to paralyze the Perpetual Mechanical Array for 20 seconds. Avoid using a Physical team as the enemy has a 70% Physical Resistance. Instead, using an Elemental team is the best option here because when the Perpetual Mechanical Array is paralyzed, it will have -40% of all elements in Genshin Impact. Although floor 12 of Spiral Abyss in Genshin Impact is more of a DPS check, it doesn't mean players can challenge the chamber without no plans. In fact, players can finish the challenge with full 4-star characters, as long as they have the right equipment, team lineups, and strategy.
english
/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ import React, { useCallback } from 'react'; import { EuiFormRow, EuiFlexItem, EuiFlexGroup, EuiSuperSelectOption } from '@elastic/eui'; import styled from 'styled-components'; import { CasesConfigurationMapping, ThirdPartyField, CaseField, ActionType, } from '../../../../containers/case/configure/types'; import { FieldMappingRow } from './field_mapping_row'; import * as i18n from './translations'; import { defaultMapping } from '../../../../lib/connectors/config'; import { setActionTypeToMapping, setThirdPartyToMapping } from './utils'; const FieldRowWrapper = styled.div` margin-top: 8px; font-size: 14px; `; const supportedThirdPartyFields: Array<EuiSuperSelectOption<ThirdPartyField>> = [ { value: 'not_mapped', inputDisplay: <span>{i18n.FIELD_MAPPING_FIELD_NOT_MAPPED}</span>, 'data-test-subj': 'third-party-field-not-mapped', }, { value: 'short_description', inputDisplay: <span>{i18n.FIELD_MAPPING_FIELD_SHORT_DESC}</span>, 'data-test-subj': 'third-party-field-short-description', }, { value: 'comments', inputDisplay: <span>{i18n.FIELD_MAPPING_FIELD_COMMENTS}</span>, 'data-test-subj': 'third-party-field-comments', }, { value: 'description', inputDisplay: <span>{i18n.FIELD_MAPPING_FIELD_DESC}</span>, 'data-test-subj': 'third-party-field-description', }, ]; export interface FieldMappingProps { disabled: boolean; mapping: CasesConfigurationMapping[] | null; onChangeMapping: (newMapping: CasesConfigurationMapping[]) => void; } const FieldMappingComponent: React.FC<FieldMappingProps> = ({ disabled, mapping, onChangeMapping, }) => { const onChangeActionType = useCallback( (caseField: CaseField, newActionType: ActionType) => { const myMapping = mapping ?? defaultMapping; onChangeMapping(setActionTypeToMapping(caseField, newActionType, myMapping)); }, [mapping] ); const onChangeThirdParty = useCallback( (caseField: CaseField, newThirdPartyField: ThirdPartyField) => { const myMapping = mapping ?? defaultMapping; onChangeMapping(setThirdPartyToMapping(caseField, newThirdPartyField, myMapping)); }, [mapping] ); return ( <> <EuiFormRow fullWidth data-test-subj="case-configure-field-mapping-cols"> <EuiFlexGroup> <EuiFlexItem> <span className="euiFormLabel">{i18n.FIELD_MAPPING_FIRST_COL}</span> </EuiFlexItem> <EuiFlexItem> <span className="euiFormLabel">{i18n.FIELD_MAPPING_SECOND_COL}</span> </EuiFlexItem> <EuiFlexItem> <span className="euiFormLabel">{i18n.FIELD_MAPPING_THIRD_COL}</span> </EuiFlexItem> </EuiFlexGroup> </EuiFormRow> <FieldRowWrapper data-test-subj="case-configure-field-mapping-row-wrapper"> {(mapping ?? defaultMapping).map(item => ( <FieldMappingRow key={item.source} disabled={disabled} siemField={item.source} thirdPartyOptions={supportedThirdPartyFields} onChangeActionType={onChangeActionType} onChangeThirdParty={onChangeThirdParty} selectedActionType={item.actionType} selectedThirdParty={item.target ?? 'not_mapped'} /> ))} </FieldRowWrapper> </> ); }; export const FieldMapping = React.memo(FieldMappingComponent);
typescript
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include "hbase/test-util/test-util.h" #include <string.h> #include <folly/Format.h> #include "hbase/client/zk-util.h" using hbase::TestUtil; using folly::Random; std::string TestUtil::RandString(int len) { // Create the whole string. // Filling everything with z's auto s = std::string(len, 'z'); // Now pick a bunch of random numbers for (int i = 0; i < len; i++) { // use Folly's random to get the numbers // as I don't want to have to learn // all the cpp rand invocation magic. auto r = Random::rand32('a', 'z'); // Cast that to ascii. s[i] = static_cast<char>(r); } return s; } TestUtil::TestUtil() : temp_dir_(TestUtil::RandString()) {} TestUtil::~TestUtil() { if (mini_) { StopMiniCluster(); mini_ = nullptr; } } void TestUtil::StartMiniCluster(int32_t num_region_servers) { mini_ = std::make_unique<MiniCluster>(); mini_->StartCluster(num_region_servers); conf()->Set(ZKUtil::kHBaseZookeeperQuorum_, mini_->GetConfValue(ZKUtil::kHBaseZookeeperQuorum_)); conf()->Set(ZKUtil::kHBaseZookeeperClientPort_, mini_->GetConfValue(ZKUtil::kHBaseZookeeperClientPort_)); } void TestUtil::StopMiniCluster() { mini_->StopCluster(); } void TestUtil::CreateTable(const std::string &table, const std::string &family) { mini_->CreateTable(table, family); } void TestUtil::CreateTable(const std::string &table, const std::vector<std::string> &families) { mini_->CreateTable(table, families); } void TestUtil::CreateTable(const std::string &table, const std::string &family, const std::vector<std::string> &keys) { mini_->CreateTable(table, family, keys); } void TestUtil::CreateTable(const std::string &table, const std::vector<std::string> &families, const std::vector<std::string> &keys) { mini_->CreateTable(table, families, keys); } void TestUtil::MoveRegion(const std::string &region, const std::string &server) { mini_->MoveRegion(region, server); } void TestUtil::StartStandAloneInstance() { auto p = temp_dir_.path().string(); auto cmd = std::string{"bin/start-local-hbase.sh " + p}; auto res_code = std::system(cmd.c_str()); CHECK_EQ(res_code, 0); } void TestUtil::StopStandAloneInstance() { auto res_code = std::system("bin/stop-local-hbase.sh"); CHECK_EQ(res_code, 0); } void TestUtil::RunShellCmd(const std::string &command) { auto cmd_string = folly::sformat("echo \"{}\" | ../bin/hbase shell", command); auto res_code = std::system(cmd_string.c_str()); CHECK_EQ(res_code, 0); }
cpp
<gh_stars>0 { "members": [ { "name":"<NAME>", "role":"Web & Graphics Head" , "department":"", "imageUrl":"https://svitprakarsh.github.io/PrakarshGraphics/2020/teams/web/devarsh.webp", "instagramUrl":"https://www.instagram.com/devarsh.007/", "githubUrl":"https://www.github.io/letscodedev", "twitterUrl":"https://www.twitter.com/devarshpanchal", "linkedInUrl":"https://www.linkedin.com/in/devarsh-panchal" }, { "name":"<NAME>", "role":"Web Developer" , "department":"", "imageUrl":"https://svitprakarsh.github.io/PrakarshGraphics/2020/teams/web/dwij.webp", "facebookUrl":"https://m.facebook.com/dwij.bharodiya", "githubUrl":"https://github.com/ssd39", "twitterUrl":"https://twitter.com/ddl00690823", "linkedInUrl":"https://www.linkedin.com/in/dwij-patel-806a8b176/" }, { "name":"<NAME>", "role":"Web Developer" , "department":"", "imageUrl":"https://svitprakarsh.github.io/PrakarshGraphics/2020/teams/web/harsh_mauny.webp", "githubUrl":"https://github.com/harshmauny", "twitterUrl":"https://twitter.com/HMauny_29?s=09" , "linkedInUrl":"https://www.linkedin.com/in/harsh-mauny-2876b8153" } ] }
json
import chai from "chai" import { solidity } from "ethereum-waffle" import { BigNumber, Contract, Signer } from "ethers" import { deployments } from "hardhat" import { ALCHEMY_BASE_URL, CHAIN_ID } from "../../utils/network" import { GenericERC20, LPToken, MetaSwap, Swap } from "../../build/typechain/" import { asyncForEach, BIG_NUMBER_1E18, BIG_NUMBER_ZERO, impersonateAccount, MAX_UINT256, setEtherBalance, } from "../../test/testUtils" chai.use(solidity) const { expect } = chai const META_SWAP_ADDRESS = "0x824dcD7b044D60df2e89B1bB888e66D8BCf41491" const TOKEN_HOLDERS = [ "0xa5407eae9ba41422680e2e00537571bcc53efbfd", // AMM "0x691ef79e40d909c715be5e9e93738b3ff7d58534", // MiniChef ] const UNWRAPPED_POOLED_TOKEN_LENGTH = 4 const FORKING_JSON_RPC_URL = ALCHEMY_BASE_URL[CHAIN_ID.MAINNET] + process.env.ALCHEMY_API_KEY const DEPOSIT_AMOUNT = 1_000 interface SwapStorage { initialA: BigNumber futureA: BigNumber initialATime: BigNumber futureATime: BigNumber swapFee: BigNumber adminFee: BigNumber lpToken: string } describe("MetaSwap", async () => { let signers: Array<Signer> let users: string[] let metaSwap: MetaSwap let baseSwap: Swap let swapToken: LPToken const pooledTokens: GenericERC20[] = [] const pooledTokenDecimals: number[] = [] const baseTokens: GenericERC20[] = [] const baseTokenDecimals: number[] = [] let unwrappedTokenDecimals: number[] let owner: Signer let swapStorage: SwapStorage let depositAmounts: BigNumber[] const setupTest = deployments.createFixture( async ({ deployments, ethers }) => { await deployments.fixture([], { keepExistingDeployments: true, fallbackToGlobal: false, }) signers = await ethers.getSigners() users = await Promise.all( signers.map(async (signer) => await signer.getAddress()), ) await setEtherBalance(users[1], 1e20) // Try to get the swap contract at the address metaSwap = await ethers.getContractAt("MetaSwap", META_SWAP_ADDRESS) owner = await impersonateAccount(await metaSwap.owner()) await setEtherBalance(await owner.getAddress(), 1e20) // If it is paused, unpause it if (await metaSwap.paused()) { await metaSwap.connect(owner).unpause() } for (let i = 0; i < 10; i++) { try { pooledTokens.push( await ethers.getContractAt( "GenericERC20", await metaSwap.getToken(i), ), ) pooledTokenDecimals.push(await pooledTokens[i].decimals()) } catch (e) { break } } depositAmounts = pooledTokenDecimals.map((decimals) => { return BigNumber.from(10).pow(decimals).mul(DEPOSIT_AMOUNT) }) // Pooled tokens should be greater than 0. If not, its not a valid swap contract or its not initialized yet expect(pooledTokens.length).to.be.greaterThan(0) expect(pooledTokens.length).to.be.eq(TOKEN_HOLDERS.length) // Transfer pooled tokens from TOKEN_HOLDERS to users[1] for testing await asyncForEach(pooledTokens, async (token, i) => { const impersonatedSigner = await impersonateAccount(TOKEN_HOLDERS[i]) await setEtherBalance(await impersonatedSigner.getAddress(), 1e20) await token .connect(impersonatedSigner) .transfer(users[1], await token.balanceOf(TOKEN_HOLDERS[i])) // Check that the transfer was successful and the balance is greater than 0 expect(await token.balanceOf(users[1])).to.be.gt(0) await token.connect(signers[1]).approve(metaSwap.address, MAX_UINT256) }) swapStorage = await metaSwap.swapStorage() swapToken = (await ethers.getContractAt( "LPToken", swapStorage.lpToken, )) as LPToken // Add some liquidity to the swap contract and set up for tests await metaSwap .connect(signers[1]) .addLiquidity(depositAmounts, 0, MAX_UINT256) // Approve lp token to be burned for when removing liquidity await swapToken.connect(signers[1]).approve(metaSwap.address, MAX_UINT256) // Get base swap information baseSwap = (await ethers.getContractAt( "Swap", ( await (metaSwap as Contract as MetaSwap).metaSwapStorage() ).baseSwap, )) as Swap const baseSwapStorage = await baseSwap.swapStorage() const baseSwapToken = (await ethers.getContractAt( "LPToken", baseSwapStorage.lpToken, )) as LPToken // Approve base swap lp token to be burned for when removing liquidity await baseSwapToken .connect(signers[1]) .approve(baseSwap.address, MAX_UINT256) // Get base tokens and decimals. Then approve base tokens to be swapped using swapUnderlying for (let i = 0; i < 10; i++) { try { baseTokens.push( await ethers.getContractAt( "GenericERC20", await baseSwap.getToken(i), ), ) baseTokenDecimals.push(await baseTokens[i].decimals()) await baseTokens[i] .connect(signers[1]) .approve(metaSwap.address, MAX_UINT256) } catch (e) { break } } unwrappedTokenDecimals = [pooledTokenDecimals[0], ...baseTokenDecimals] }, ) beforeEach(async () => { await setupTest() }) describe("addLiquidity", () => { for (let i = 0; i < TOKEN_HOLDERS.length; i++) { it(`Virtual price doesn't decrease after depositing only one token at index ${i}`, async () => { const amounts = Array(depositAmounts.length).fill(BIG_NUMBER_ZERO) amounts[i] = depositAmounts[i] const virtualPriceBefore = await metaSwap.getVirtualPrice() await metaSwap.connect(signers[1]).addLiquidity(amounts, 0, MAX_UINT256) expect(await metaSwap.getVirtualPrice()).to.gte(virtualPriceBefore) }) } }) describe("removeLiquidity", () => { it("Virtual price doesn't decrease after removeLiquidity", async () => { const expectedAmounts = Array(depositAmounts.length).fill(BIG_NUMBER_ZERO) const virtualPriceBefore = await metaSwap.getVirtualPrice() await metaSwap .connect(signers[1]) .removeLiquidity(BIG_NUMBER_1E18, expectedAmounts, MAX_UINT256) expect(await metaSwap.getVirtualPrice()).to.gte(virtualPriceBefore) }) }) describe("removeLiquidityImbalance", () => { for (let i = 0; i < TOKEN_HOLDERS.length; i++) { it("Virtual price doesn't decrease after removeLiquidityImbalance", async () => { const amounts = [...depositAmounts.map((amount) => amount.div(2))] amounts[i] = BIG_NUMBER_ZERO const virtualPriceBefore = await metaSwap.getVirtualPrice() await metaSwap .connect(signers[1]) .removeLiquidityImbalance( amounts, await swapToken.balanceOf(users[1]), MAX_UINT256, ) expect(await metaSwap.getVirtualPrice()).to.gte(virtualPriceBefore) }) } }) describe("removeLiquidityOneToken", () => { for (let i = 0; i < TOKEN_HOLDERS.length; i++) { it(`Virtual price doesn't decrease after removeLiquidityOneToken at index ${i}`, async () => { const virtualPriceBefore = await metaSwap.getVirtualPrice() await metaSwap .connect(signers[1]) .removeLiquidityOneToken( BigNumber.from(10).pow(18), i, 0, MAX_UINT256, ) expect(await metaSwap.getVirtualPrice()).to.gte(virtualPriceBefore) }) } }) describe("swap", () => { const swapAmount = BIG_NUMBER_1E18 for (let i = 0; i < TOKEN_HOLDERS.length; i++) { for (let j = 0; j < TOKEN_HOLDERS.length; j++) { if (i === j) continue it(`Virtual price doesn't decrease after swap (${i} -> ${j})`, async () => { const virtualPriceBefore = await metaSwap.getVirtualPrice() await metaSwap .connect(signers[1]) .swap(i, j, swapAmount, 0, MAX_UINT256) expect(await metaSwap.getVirtualPrice()).to.gte(virtualPriceBefore) }) } } }) describe("swapUnderlying", () => { const swapAmount = 100 const removeBaseLiquidityAmount = BIG_NUMBER_1E18.mul(10000) for (let i = 0; i < UNWRAPPED_POOLED_TOKEN_LENGTH; i++) { for (let j = 0; j < UNWRAPPED_POOLED_TOKEN_LENGTH; j++) { if (i === j) continue it(`Virtual price doesn't decrease after swapUnderlying (${i} -> ${j})`, async () => { // Get some of the tokens by removing liquidity from the base pool const minBaseAmounts = Array(baseTokens.length).fill(BIG_NUMBER_ZERO) await baseSwap .connect(signers[1]) .removeLiquidity( removeBaseLiquidityAmount, minBaseAmounts, MAX_UINT256, ) const virtualPriceBefore = await metaSwap.getVirtualPrice() await metaSwap .connect(signers[1]) .swapUnderlying( i, j, BigNumber.from(10).pow(unwrappedTokenDecimals[i]).mul(swapAmount), 0, MAX_UINT256, ) expect(await metaSwap.getVirtualPrice()).to.gte(virtualPriceBefore) }) } } }) })
typescript
<filename>server/modules/db/mongoClient.js const MongoClient = require('mongodb').MongoClient; const assert = require('assert'); // Connection URL // const url = 'mongodb://localhost/off'; // "mongodb://root:<EMAIL>:59624/mongo-vietnam" const url = process.env.MONGO_URL || "mongodb://localhost/mongo-vietnam"; // Database Name const dbName = 'mongo-vietnam'; // Create a new MongoClient const client = new MongoClient(url); let db; client.connect((err) => { if (err) { console.error(err); } db = client.db(dbName); }); //TODO:: use on connection by function to ensure the connection is reset each time. //That would allow to not have to reboot server when connection is down for a few sec function listCollections() { return new Promise((resolve, reject) => { db.listCollections().toArray(function (err, collInfos) { if (err) { reject(err); } resolve(collInfos); }); }) } function insertMany(collection, documents) { return new Promise((resolve, reject) => { db.collection(collection) .insertMany(documents, (err, result) => { if (err) { reject(err); } resolve(result); }); }) } module.exports = { delete: (collection, id) => { return new Promise((resolve, reject) => db.collection(collection) .deleteOne({_id: id}, (err, res) => { if (!!err) { reject(err); } resolve(res); }) ) }, updateOne: (collection, id, newValue) => { return new Promise((resolve, reject) => db.collection(collection).update(id, {$set: newValue}, (err, res) => { if (!!err) { reject(err); } resolve(res); })); }, pushToOneArray: (collection, id, attr, newValue) => { const req = {}; req[attr] = newValue; return new Promise((resolve, reject) => db.collection(collection).update(id, {$push: req}, (err, res) => { if (!!err) { reject(err); } resolve(res); })); }, clean: () => { listCollections() .then(collections => { collections.forEach(collection => { db.collection(collection.name) .deleteMany({}); }) } ); }, init: (data) => { return listCollections() .then(collections => { if (collections.length === 0) { db.createCollection("france"); db.createCollection("user"); db.createCollection("recipes"); } insertMany("france", data.products); }); }, insertOne: (collection, document) => { return new Promise((resolve, reject) => { db.collection(collection) .insertOne(document, (err, result) => { if (err) { reject(err); } resolve(result); }); }) }, insertMany: (collection, documents) => { return insertMany(collection, documents); }, listCollections: () => { return listCollections(); }, findOneBy: (collection, criteria) => { return new Promise((resolve, reject) => { db.collection(collection).findOne(criteria, (mongoError, objects) => { if (mongoError) { reject(mongoError); } if (!objects) { reject({error: "Not Found."}) } resolve(objects); }) }) }, findBy: (collection, criteria) => { return new Promise((resolve, reject) => { db.collection(collection).find(criteria).toArray((mongoError, objects) => { if (mongoError) { reject(mongoError); } resolve(objects); }) }) }, findByRegex: (collection, object_key, regex, params) => { const criteria = {}; criteria[object_key] = {$regex: regex, $options: "i"}; // console.log(criteria); return new Promise((resolve, reject) => { (!!params.pageLength && !!params.pageNumber ? db.collection(collection).find(criteria).skip(params.pageLength * (params.pageNumber - 1)).limit(params.pageLength) : db.collection(collection).find(criteria) ).toArray((mongoError, objects) => { if (mongoError) { reject(mongoError); } resolve(objects); }) }) }, findAll: (collection, params) => { return new Promise((resolve, reject) => { (params && !!params.pageLength && !!params.pageNumber ? db.collection(collection).find({}).skip(params.pageLength * (params.pageNumber - 1)).limit(params.pageLength) : db.collection(collection).find({}) ).toArray((mongoError, objects) => { if (mongoError) { reject(mongoError); } resolve(objects); }) }) }, close: () => { client.close(); } };
javascript
<gh_stars>0 { "name": "@bkniffler/react-universally-dev", "version": "7.2.2", "description": "A starter kit giving you the minimum requirements for a production ready universal react application.", "main": "build/server/main.js", "scripts": { "clean": "rimraf build", "development": "node ./tools/development", "build": "npm run clean && webpack --config ./tools/webpack/client.config.js && webpack --config ./tools/webpack/universalMiddleware.config.js && webpack --config ./tools/webpack/server.config.js", "start": "node build/server", "lint": "eslint src", "typecheck": "flow", "typereport": "flow-coverage-report -i 'src/**/*.js' -t html -t json -t text", "removetypes": "node ./tools/flow/removeTypes.js && eslint --fix src" }, "repository": { "type": "git", "url": "git+https://github.com/ctrlplusb/react-universally.git" }, "keywords": [ "react", "boilerplate", "starter kit", "universal", "javascript", "express", "webpack" ], "author": "<NAME> <<EMAIL>>", "license": "MIT", "bugs": { "url": "https://github.com/ctrlplusb/react-universally/issues" }, "homepage": "https://github.com/ctrlplusb/react-universally#readme", "dependencies": { "assets-webpack-plugin": "3.5.0", "babel-cli": "6.18.0", "babel-core": "6.18.0", "babel-eslint": "7.0.0", "babel-loader": "6.2.5", "babel-plugin-transform-class-properties": "6.18.0", "babel-plugin-transform-es2015-destructuring": "6.18.0", "babel-plugin-transform-object-rest-spread": "6.16.0", "babel-preset-latest": "6.16.0", "babel-preset-react": "6.16.0", "babel-preset-react-optimize": "^1.0.1", "chokidar": "1.6.1", "colors": "1.1.2", "css-loader": "0.25.0", "dotenv": "2.0.0", "eslint": "3.8.1", "eslint-config-airbnb": "12.0.0", "eslint-plugin-flowtype": "2.25.0", "eslint-plugin-import": "1.16.0", "eslint-plugin-jsx-a11y": "2.2.3", "eslint-plugin-react": "6.4.1", "extract-text-webpack-plugin": "2.0.0-beta.4", "file-loader": "0.9.0", "flow-bin": "0.33.0", "flow-coverage-report": "0.1.0", "flow-remove-types": "1.0.4", "glob": "7.1.1", "happypack": "2.2.1", "json-loader": "0.5.4", "less": "^2.7.1", "less-loader": "^2.2.3", "md5": "2.2.1", "node-notifier": "4.6.1", "react-hot-loader": "3.0.0-beta.6", "regenerator-runtime": "0.9.5", "rimraf": "2.5.4", "style-loader": "0.13.1", "url-loader": "0.5.7", "webpack": "2.1.0-beta.25", "webpack-dev-middleware": "1.8.4", "webpack-hot-middleware": "2.13.0", "webpack-md5-hash": "0.0.5", "webpack-node-externals": "1.5.4" } }
json
<reponame>wuzhiming/wuzhiming<gh_stars>0 enum FruitType { apple, blueberry, pear, strawberry } abstract class Fruit { type: FruitType; abstract toString(): string; } class BlueBerry extends Fruit { constructor() { super(); this.type = FruitType.blueberry; } toString(): string { return 'blueberry'; } } class Apple extends Fruit { constructor() { super(); this.type = FruitType.apple; } toString(): string { return 'apple'; } } class Pear extends Fruit { constructor() { super(); this.type = FruitType.pear; } toString(): string { return 'pear'; } } class StrawBerry extends Fruit { constructor() { super(); this.type = FruitType.strawberry; } toString(): string { return 'strawberry'; } } /** * 简单工厂,虽然他不算是设计模式,但是还是很经常被用来抽离代码 */ class SimpleFactory { public createFruit(type): Fruit { let fruit: Fruit; switch (type) { case FruitType.apple: fruit = new Apple(); break; case FruitType.blueberry: fruit = new BlueBerry(); break; case FruitType.pear: fruit = new Pear(); break; case FruitType.strawberry: fruit = new StrawBerry(); break; default: fruit = new Apple(); } return fruit; } } class Drink { fruits: Fruit[] = []; constructor(fruit: Fruit[]) { this.fruits = fruit; } public description(): string { let str: string = ''; this.fruits.forEach((item: Fruit) => { str += item.toString() + ','; }); return str; } } abstract class Store { drink: Drink; public abstract genJuice(type: FruitType): Drink; } class XiamenStore extends Store { public genJuice(type: FruitType): Drink { switch (type) { case FruitType.apple: this.drink = new Drink([new BlueBerry(), new Pear(), new Apple()]); break; case FruitType.blueberry: this.drink = new Drink([new StrawBerry(), new BlueBerry()]); break; case FruitType.strawberry: this.drink = new Drink([new StrawBerry(), new Pear()]); break; case FruitType.pear: this.drink = new Drink([new StrawBerry(), new Apple()]); break; } return this.drink } } class ZhangzhouStore extends Store { public genJuice(type: FruitType): Drink { switch (type) { case FruitType.apple: this.drink = new Drink([new BlueBerry(), new Apple()]); break; case FruitType.blueberry: this.drink = new Drink([new Apple(), new StrawBerry(), new BlueBerry()]); break; case FruitType.strawberry: this.drink = new Drink([new StrawBerry(), new Pear(), new Apple()]); break; case FruitType.pear: this.drink = new Drink([new Apple(), new Pear()]); break; } return this.drink } } /** * 简单工厂示例 * @constructor */ function SimpleFactoryMain() { let factory: SimpleFactory = new SimpleFactory(); let fruit1: Fruit = factory.createFruit(FruitType.apple); let fruit2: Fruit = factory.createFruit(FruitType.blueberry); } SimpleFactoryMain(); function FactoryMethodMain() { let xmStore: Store = new XiamenStore(); let zzStore: Store = new ZhangzhouStore(); let xmDrink: Drink = xmStore.genJuice(FruitType.pear); let zzDrink: Drink = zzStore.genJuice(FruitType.pear); console.log(xmDrink.description()); console.log(zzDrink.description()); } FactoryMethodMain();
typescript
Realme 10 4G Leak Reveals Helio G99 SoC; How Will This 4G Phone Compete in 5G Era? The upcoming Realme 10 series is tipped to include many variants, including 4G models. A new leak has revealed key features of the upcoming Realme 10 4G, including the Helio G99 SoC and dual cameras. But can this 4G phone compete with affordable 5G phones in India? Popular tipster Paras Gulgani has leaked important features of the upcoming Realme 10 4G. Previously, the alleged renders of the 4G smartphone surfaced online, giving us an idea of what to expect. An official announcement from Realme Global confirms that the new series will launch in November. Going into the details, the tipster states that the new Realme 10 4G will flaunt a 6. 5-inch IPS LCD screen with an FHD+ resolution of 2400 x 1800 pixels. The display is rumored to offer a 180Hz touch sampling rate along with Panda Glass protection. Under the hood, the alleged Realme 10 4G will be backed by LPDDR4x RAM support and UFS 2. 2 storage support. Plus, the upcoming 4G phone will also offer up to 5GB of virtual RAM. However, the tipster hasn't revealed the RAM and storage specification of the Realme phone. At the rear, the Realme 10 4G will allegedly pack in a dual-camera setup with a 50MP main lens and a 2MP macro shooter. A 16MP front camera is also expected for the new 4G smartphone. The tipster suggests the Realme 10 4G will offer a 5,000 mAh battery paired with 33W fast charging support. Realme 10 4G in India: How Will It Compete With 5G Phones? Additionally, the tipster states the Realme 10 4G will be priced between Rs. 17,000 and Rs. 19,000 in India. With inaugural offers, the phone could be available for around Rs. 15,000. However, this is quite expensive for a 4G phone in the era of 5G. In fact, one can get a 5G smartphone for the same price. So how will the new Realme 10 4G run in the Indian market? Will Realme launch this phone for a lesser price tag? The complete features and other details will be officially announced soon, giving us an idea of what to expect. Until then, it's best to take this information with a grain of salt.
english
As the Very Severe Cyclonic Storm, ‘Bulbul’ which is about 100 km East Southeast of Paradip and 275 km South-Southwest of Kolkata as on 05:30 AM on 09 Nov 19, Eastern Naval Command(ENC) is closely monitoring the movement of the Cyclonic Storm which is presently moving northwards. Presently, the maximum sustained winds around the system are approximate of the order of 65 -70 Kn and the Severe Cyclonic Storm is expected to make landfall at West Bengal and Bangladesh coasts between Sagar Island (WB) and Khepupara (Bangladesh) across Sunderban delta by tonight. Naval Aircraft deployed in the Bay of Bengal have been warning fishing boats about the impinging cyclone and advising them to return to the nearest harbour for shelter. Three IN Ships at Visakhapatnam are standby with relief material embarked for immediate deployment to the most affected areas to undertake Humanitarian Assistance and Disaster Relief (HADR) operation. Additionally, ten diving and medical teams are also kept ready for augmenting rescue and relief efforts in Odisha and West Bengal. Naval aircraft are kept ready at Naval Air Station, INS Dega to undertake aerial survey of the most affected areas, casualty evacuation and airdrop of relief material as required. Naval Officers-in-Charge, West Bengal and Odisha are in constant liaison with respective State Administrations for rendering assistance as required.
english
<filename>resources/_gen/assets/js/js/academic.min.js_187be290e8222f6bb644052568a2fb6d.json {"Target":"js/academic.min.d56b50ec0aa059cb20b58b1153e8854a.js","MediaType":"application/javascript","Data":{"Integrity":"md5-1WtQ7AqgWcsgtYsRU+iFSg=="}}
json
Microsoft has been teasing big changes to Microsoft Edge for nearly a year. Two years ago, the company announced that Edge would move to rely on the same Chromium code base as Google’s Chrome. Then came alphas, and betas, and even a build for macOS that I quite liked. The new version of Edge, which kills the ereader but becomes significantly better at reading the web, launches today. And with it, one of the last vestiges of Internet Explorer dies. Internet Explorer and Edge might not have shared a name but they share the same logo—a shiny blue E that’s come to be a joke for a whole generation of computer users. Until today, Internet Explorer and Edge also shared an engine. All web browsers have one. It’s how they communicate with the internet. Firefox relies on Gecko, while Safari relies on Webkit. Edge, until today, ran on EdgeHTML, a fork of Trident, the engine behind Internet Explorer. When Microsoft decided to use EdgeHTML, it made sense. Internet Explorer had once been the biggest web browser around and consequently, lots of web page designers focused their energies on making their sites work for IE. But Chrome had a foothold when Edge launched and Microsoft’s new browser just never gained the popularity it needed. Instead, more and more web page designers focused on making the best looking sites the could—for Chrome. Chrome uses the Blink engine and the source code originates with the open-source Chromium project. The Edge that launches today will rely on Blink and Chromium too. That means Edge users will find far fewer broken websites. It also means that as the reach of Blink expands Google will be there too, overseeing the engine that most of us will use to browse the web. The new version of Microsoft’s primary web browser can be found at microsoftedge.com right now. I’m told it’s essentially the exact same thing as Beta Build 79, which has been in the wild November 4, 2019. I’m also told it will ingest data from the previous version of Edge (or IE), but will not replace them. It will also be able to import data from Chrome, Safari, Firefox, or other browsers. Though it will still require a Microsoft Account to sync data across multiple instances of the Edge browser. If you’re ready to ditch the old Edge and try out the new one, you can go download it and start using it right now. Automatic updates to current Edge users (so anyone on Windows 10) will begin next week. The initial automatic update will roll out to a super tiny portion of current Edge users—think 1-percent of the total install base. The process to move the total install base to the new Microsoft Edge is expected to take four to six weeks. The exception will be people using an enterprise-focused version of Windows 10. They’ll have to wait until their IT person is ready. Most IT professionals nowadays prefer to have control over when their users upgrade. Besides making them feel very powerful (I’m sure), delayed updates controlled by IT mean more time for IT to work out any bugs related specifically to the workflow of their company. Got an archaic Internet Explorer-only web portal? IT probably doesn’t want you upgrading to the new Edge!
english
<reponame>harrinry/QRPortal .qrp_list_area{ width: 60vw; display: flex; max-height: calc(100vh - 139px); overflow-x: hidden;overflow-y: hidden; flex-direction: row; -webkit-box-shadow: 6px 3px 75px 27px rgba(0,0,0,0.10);-moz-box-shadow: 1px 4px 56px 5px rgba(0,0,0,0.10);box-shadow: 1px 4px 56px 5px rgba(0,0,0,0.10);} .qrp_details_area{ display: block; width: 40vw; max-height: calc(100vh - 139px); overflow-x: hidden; overflow-y: auto; border-top: 1px solid rgba(0,0,0,0.05)} .qrp_contentSpace{ width: 100%; height: 100%; } .qrp_menuNav_height{ max-height: 100vh } .qrp_maxtileNav_height{ max-height: calc(100vh - 146px)} .qrp_bcontentCntr{ display: flex; } .qrp_contentBody{ overflow-x: hidden; overflow-y: auto; }
css
<reponame>xanthian/variant_sticks_and_stuff { "parent": "minecraft:item/generated", "textures": { "layer0": "vsas:item/arrows/warped_arrow" } }
json
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package runtime import "github.com/c12o16h1/go/src/internal/cpu" const ( hwcap_FP = 1 << 0 hwcap_ASIMD = 1 << 1 hwcap_EVTSTRM = 1 << 2 hwcap_AES = 1 << 3 hwcap_PMULL = 1 << 4 hwcap_SHA1 = 1 << 5 hwcap_SHA2 = 1 << 6 hwcap_CRC32 = 1 << 7 hwcap_ATOMICS = 1 << 8 hwcap_FPHP = 1 << 9 hwcap_ASIMDHP = 1 << 10 hwcap_CPUID = 1 << 11 hwcap_ASIMDRDM = 1 << 12 hwcap_JSCVT = 1 << 13 hwcap_FCMA = 1 << 14 hwcap_LRCPC = 1 << 15 hwcap_DCPOP = 1 << 16 hwcap_SHA3 = 1 << 17 hwcap_SM3 = 1 << 18 hwcap_SM4 = 1 << 19 hwcap_ASIMDDP = 1 << 20 hwcap_SHA512 = 1 << 21 hwcap_SVE = 1 << 22 hwcap_ASIMDFHM = 1 << 23 ) func getisar0() uint64 func getisar1() uint64 func getpfr0() uint64 // no hwcap support on FreeBSD aarch64, we need to retrieve the info from // ID_AA64ISAR0_EL1, ID_AA64ISAR1_EL1 and ID_AA64PFR0_EL1 func archauxv(tag, val uintptr) { var isar0, isar1, pfr0 uint64 isar0 = getisar0() isar1 = getisar1() pfr0 = getpfr0() // ID_AA64ISAR0_EL1 switch extractBits(isar0, 4, 7) { case 1: cpu.HWCap |= hwcap_AES case 2: cpu.HWCap |= hwcap_PMULL | hwcap_AES } switch extractBits(isar0, 8, 11) { case 1: cpu.HWCap |= hwcap_SHA1 } switch extractBits(isar0, 12, 15) { case 1: cpu.HWCap |= hwcap_SHA2 case 2: cpu.HWCap |= hwcap_SHA2 | hwcap_SHA512 } switch extractBits(isar0, 16, 19) { case 1: cpu.HWCap |= hwcap_CRC32 } switch extractBits(isar0, 20, 23) { case 2: cpu.HWCap |= hwcap_ATOMICS } switch extractBits(isar0, 28, 31) { case 1: cpu.HWCap |= hwcap_ASIMDRDM } switch extractBits(isar0, 32, 35) { case 1: cpu.HWCap |= hwcap_SHA3 } switch extractBits(isar0, 36, 39) { case 1: cpu.HWCap |= hwcap_SM3 } switch extractBits(isar0, 40, 43) { case 1: cpu.HWCap |= hwcap_SM4 } switch extractBits(isar0, 44, 47) { case 1: cpu.HWCap |= hwcap_ASIMDDP } // ID_AA64ISAR1_EL1 switch extractBits(isar1, 0, 3) { case 1: cpu.HWCap |= hwcap_DCPOP } switch extractBits(isar1, 12, 15) { case 1: cpu.HWCap |= hwcap_JSCVT } switch extractBits(isar1, 16, 19) { case 1: cpu.HWCap |= hwcap_FCMA } switch extractBits(isar1, 20, 23) { case 1: cpu.HWCap |= hwcap_LRCPC } // ID_AA64PFR0_EL1 switch extractBits(pfr0, 16, 19) { case 0: cpu.HWCap |= hwcap_FP case 1: cpu.HWCap |= hwcap_FP | hwcap_FPHP } switch extractBits(pfr0, 20, 23) { case 0: cpu.HWCap |= hwcap_ASIMD case 1: cpu.HWCap |= hwcap_ASIMD | hwcap_ASIMDHP } switch extractBits(pfr0, 32, 35) { case 1: cpu.HWCap |= hwcap_SVE } } func extractBits(data uint64, start, end uint) uint { return (uint)(data>>start) & ((1 << (end - start + 1)) - 1) } //go:nosplit func cputicks() int64 { // Currently cputicks() is used in blocking profiler and to seed fastrand(). // nanotime() is a poor approximation of CPU ticks that is enough for the profiler. return nanotime() }
go
use crate::parser::expected_node; use crate::{ parser::{expected_any, ToDiagnostic}, CompletedMarker, Parser, }; use rome_diagnostics::{Diagnostic, Span}; use rome_rowan::TextRange; pub(crate) fn expected_ts_enum_member(p: &Parser, range: TextRange) -> Diagnostic { expected_any(&["identifier", "string literal", "computed name"], range).to_diagnostic(p) } pub(crate) fn unexpected_abstract_member_with_body(p: &Parser, range: TextRange) -> Diagnostic { p.err_builder("abstract members should not have a body") .primary(range, "") } pub(crate) fn abstract_member_cannot_be_async(p: &Parser, range: &TextRange) -> Diagnostic { p.err_builder("async members cannot be abstract") .primary(range, "") } pub(crate) fn ts_member_cannot_be( p: &Parser, range: impl Span, member_type_name: &str, modifier_name: &str, ) -> Diagnostic { let msg = format!("{} members cannot be {}", member_type_name, modifier_name); p.err_builder(&msg).primary(range, "") } pub(crate) fn ts_modifier_cannot_appear_on_a_constructor_declaration( p: &Parser, modifier_range: TextRange, ) -> Diagnostic { let modifier = p.source(modifier_range); p.err_builder(&format!( "'{modifier}' cannot appear on a constructor declaration." )) .primary(modifier_range, "") } pub(crate) fn ts_modifier_cannot_appear_on_a_parameter( p: &Parser, modifier_range: TextRange, ) -> Diagnostic { let modifier = p.source(modifier_range); p.err_builder(&format!("'{modifier}' cannot appear on a parameter.")) .primary(modifier_range, "") } pub(crate) fn ts_accessibility_modifier_already_seen( p: &Parser, second_range: TextRange, first_range: TextRange, ) -> Diagnostic { p.err_builder("Accessibility modifier already seen.") .primary(second_range, "duplicate modifier") .secondary(first_range, "first modifier") } pub(crate) fn ts_only_syntax_error(p: &Parser, syntax: &str, range: TextRange) -> Diagnostic { p.err_builder(&format!("{} are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.", syntax)) .primary(range, "TypeScript only syntax") } pub(crate) fn ts_accessor_type_parameters_error( p: &Parser, type_parameters: &CompletedMarker, ) -> Diagnostic { p.err_builder("An accessor cannot have type parameters.") .primary(type_parameters.range(p), "") } pub(crate) fn ts_constructor_type_parameters_error( p: &Parser, type_parameters: &CompletedMarker, ) -> Diagnostic { p.err_builder("constructors cannot have type parameters.") .primary(type_parameters.range(p), "") } pub(crate) fn ts_set_accessor_return_type_error( p: &Parser, type_annotation: &CompletedMarker, ) -> Diagnostic { p.err_builder("A 'set' accessor cannot have a return type annotation.") .primary(type_annotation.range(p), "") } pub(crate) fn expected_ts_type(p: &Parser, range: TextRange) -> Diagnostic { expected_node("type", range).to_diagnostic(p) } pub(crate) fn expected_ts_type_parameter(p: &Parser, range: TextRange) -> Diagnostic { expected_node("type parameter", range).to_diagnostic(p) }
rust
# [Turing Complete](https://turingcomplete.game/) Dynamic Assembler --- This program is designed as a more performant assembler for the game Turing Complete than the built in assembler. It works by having you define each instruction group and how it maps to a binary output. This is then used to parse a text file you provide the program and it then will write the compiled data into the game's directory so that it can be used by the computer you designed within the game. ## NOTE: This is no longer maintained since https://github.com/hlorenzi/customasm has more features and already does what this aimed to do --- ## Features - Dynamic instruction length architectures - Arbitrarily sized instructions and integers - Arbitrarily aligned instruction segments - Dependent bit fields - Optional mnemonics --- ## NOTE: There are likely still bugs in here and the error messages are very unhelpful I plan to fix this soon but, as long as you define your language file correctly and don't have any typos in your program, it should work fine. --- ## How to run this program 1. Install python 3.9+ (3.6 and above might work fine, but I wrote this with 3.9 installed on my system) 2. Clone this git repo 3. Run `python -m pip install -r requirements.txt` from a terminal window 4. If you're on linux or mac, you should be able to directly run the program with `./main.py [arguments]` 1. Otherwise you can run it with `python main.py [arguments]` --- ## Program Arguments - You are required to either pass in a config file that lists the language specification inside or directly specify the language specification from the command line. - You are required to use the assembly program file as the last argument - The architecture, level, and program name CAN be defined in the config or passed in directly, but they are not required since the program will ask for them once it's compiled the assembly program ``` usage: main.py [-h] [-a ARCHITECTURE] [-c CONFIG] [-l LANGUAGE] [-m MAP] [-n NAME] file DynamicAssembler for Turing Complete positional arguments: file file to be assembled by the assembler optional arguments: -h, --help show this help message and exit -a ARCHITECTURE, --architecture ARCHITECTURE name of your architecture -c CONFIG, --config CONFIG config file for the parser -l LANGUAGE, --language LANGUAGE language definition file -m MAP, --map MAP map/level the program is for -n NAME, --name NAME name of your program ```
markdown
<reponame>jameshibbard/nodegui import addon from "../../core/addon"; import { NodeWidget } from "../QWidget"; import { BaseWidgetEvents } from "../../core/EventWidget"; import { NativeElement } from "../../core/Component"; import { QAbstractScrollArea } from "../QAbstractScrollArea"; export const QPlainTextEditEvents = Object.freeze({ ...BaseWidgetEvents, textChanged: "textChanged" }); export class QPlainTextEdit extends QAbstractScrollArea { native: NativeElement; constructor(parent?: NodeWidget) { let native; if (parent) { native = new addon.QPlainTextEdit(parent.native); } else { native = new addon.QPlainTextEdit(); } super(native); this.native = native; this.parent = parent; // bind member functions this.setPlainText.bind(this); this.toPlainText.bind(this); this.clear.bind(this); } setPlainText(text: string | number) { this.native.setPlainText(`${text}`); } toPlainText() { return this.native.toPlainText(); } clear() { this.native.clear(); } }
typescript
<reponame>windystrife/UnrealEngine_NVIDIAGameWork<gh_stars>1-10 #include "utilities/Utilities.h" #include <NvCloth/Range.h> TEST_LEAK_FIXTURE(Range) TEST_F(Range, Constructor) { nv::cloth::Range<char> char_range; EXPECT_EQ(char_range.size(), 0); EXPECT_NULLPTR(char_range.begin()); EXPECT_NULLPTR(char_range.end()); nv::cloth::Range<char> a((char*)0x123, (char*)0x456); nv::cloth::Range<char> b(a); EXPECT_EQ(b.begin(), a.begin()); EXPECT_EQ(b.end(), a.end()); } TEST_F(Range, Size) { std::vector<char> char_array; char_array.resize(100); nv::cloth::Range<char> char_range(&char_array[0], &char_array[0] + char_array.size()); EXPECT_EQ(char_array.size(), char_range.size()); std::vector<float> float_array; float_array.resize(100); nv::cloth::Range<float> float_range(&float_array[0], &float_array[0] + float_array.size()); EXPECT_EQ(float_array.size(), float_range.size()); } TEST_F(Range, Empty) { { nv::cloth::Range<char> char_range; EXPECT_TRUE(char_range.empty()); nv::cloth::Range<float> float_range; EXPECT_TRUE(float_range.empty()); } { std::vector<char> char_array; char_array.resize(100); nv::cloth::Range<char> char_range = CreateRange(char_array); EXPECT_FALSE(char_range.empty()); std::vector<float> float_array; float_array.resize(100); nv::cloth::Range<float> float_range = CreateRange(float_array); EXPECT_FALSE(float_range.empty()); } } TEST_F(Range, Pop) { std::vector<char> char_array; char_array.resize(100); nv::cloth::Range<char> char_range(&char_array[0], &char_array[0] + char_array.size()); EXPECT_EQ(&char_array.front(), &char_range.front()); EXPECT_EQ(&char_array.back(), &char_range.back()); char_range.popBack(); EXPECT_EQ(&char_array.back() - 1, &char_range.back()); char_range.popFront(); EXPECT_EQ(&char_array.front() + 1, &char_range.front()); std::vector<float> float_array; float_array.resize(100); nv::cloth::Range<float> float_range(&float_array[0], &float_array[0] + float_array.size()); EXPECT_EQ(&float_array.front(), &float_range.front()); EXPECT_EQ(&float_array.back(), &float_range.back()); float_range.popBack(); EXPECT_EQ(&float_array.back() - 1, &float_range.back()); float_range.popFront(); EXPECT_EQ(&float_array.front() + 1, &float_range.front()); } TEST_F(Range, BeginEnd) { std::vector<char> char_array; char_array.resize(100); nv::cloth::Range<char> char_range(&char_array[0], &char_array[0]+char_array.size()); EXPECT_EQ(&char_array[0], char_range.begin()); EXPECT_EQ(&char_array[0] + char_array.size(), char_range.end()); std::vector<float> float_array; float_array.resize(100); nv::cloth::Range<float> float_range(&float_array[0], &float_array[0] + float_array.size()); EXPECT_EQ(&float_array[0], float_range.begin()); EXPECT_EQ(&float_array[0] + float_array.size(), float_range.end()); } TEST_F(Range, FrontBack) { std::vector<char> char_array; char_array.resize(100); nv::cloth::Range<char> char_range(&char_array[0], &char_array[0] + char_array.size()); EXPECT_EQ(&char_array.front(), &char_range.front()); EXPECT_EQ(&char_array.back(), &char_range.back()); std::vector<float> float_array; float_array.resize(100); nv::cloth::Range<float> float_range(&float_array[0], &float_array[0] + float_array.size()); EXPECT_EQ(&float_array.front(), &float_range.front()); EXPECT_EQ(&float_array.back(), &float_range.back()); } TEST_F(Range, ArrayOperator) { std::vector<char> char_array; char_array.resize(100); nv::cloth::Range<char> char_range(&char_array[0], &char_array[0] + char_array.size()); EXPECT_EQ(&char_array[0], &char_range[0]); EXPECT_EQ(&char_array[99], &char_range[99]); std::vector<float> float_array; float_array.resize(100); nv::cloth::Range<float> float_range(&float_array[0], &float_array[0] + float_array.size()); EXPECT_EQ(&float_array[0], &float_range[0]); EXPECT_EQ(&float_array[99], &float_range[99]); }
cpp
There are numerous people who love to cook and they are very keen about it. They will spend hours within the kitchen cooking for their household or pals. However how are you aware that your meals is going to be good? Well, you probably have been cooking for some time then you'd know that there are some common mistakes that you may make when cooking. The most typical mistake is over cooking the food. What is Pligg? Pligg is an open source content management system that lets you easily create your own user-powered website.
english
<gh_stars>0 package kube import ( "bytes" "context" "encoding/json" "fmt" "io/ioutil" "os/exec" "strings" "sync" "github.com/pkg/errors" log "github.com/sirupsen/logrus" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" "k8s.io/client-go/dynamic" "k8s.io/client-go/rest" ) type Kubectl interface { ApplyResource(config *rest.Config, obj *unstructured.Unstructured, namespace string, dryRun, force bool) (string, error) ConvertToVersion(obj *unstructured.Unstructured, group, version string) (*unstructured.Unstructured, error) DeleteResource(config *rest.Config, obj *unstructured.Unstructured, namespace string) error WatchResources(ctx context.Context, config *rest.Config, namespace string, selector func(kind schema.GroupVersionKind) metav1.ListOptions) (chan watch.Event, error) } type KubectlCmd struct{} // WatchResources Watches all the existing resources with the provided label name in the provided namespace in the cluster provided by the config func (k KubectlCmd) WatchResources( ctx context.Context, config *rest.Config, namespace string, selector func(kind schema.GroupVersionKind) metav1.ListOptions) (chan watch.Event, error) { log.Infof("Start watching for resources changes with in cluster %s", config.Host) dynClientPool := dynamic.NewDynamicClientPool(config) disco, err := discovery.NewDiscoveryClientForConfig(config) if err != nil { return nil, err } serverResources, err := GetCachedServerResources(config.Host, disco) if err != nil { return nil, err } items := make([]struct { resource dynamic.ResourceInterface gvk schema.GroupVersionKind }, 0) for _, apiResourcesList := range serverResources { for i := range apiResourcesList.APIResources { apiResource := apiResourcesList.APIResources[i] watchSupported := false for _, verb := range apiResource.Verbs { if verb == watchVerb { watchSupported = true break } } if watchSupported && !isExcludedResourceGroup(apiResource) { dclient, err := dynClientPool.ClientForGroupVersionKind(schema.FromAPIVersionAndKind(apiResourcesList.GroupVersion, apiResource.Kind)) if err != nil { return nil, err } items = append(items, struct { resource dynamic.ResourceInterface gvk schema.GroupVersionKind }{resource: dclient.Resource(&apiResource, namespace), gvk: schema.FromAPIVersionAndKind(apiResourcesList.GroupVersion, apiResource.Kind)}) } } } ch := make(chan watch.Event) go func() { var wg sync.WaitGroup wg.Add(len(items)) for i := 0; i < len(items); i++ { item := items[i] go func() { defer wg.Done() w, err := item.resource.Watch(selector(item.gvk)) if err == nil { defer w.Stop() copyEventsChannel(ctx, w.ResultChan(), ch) } }() } wg.Wait() close(ch) log.Infof("Stop watching for resources changes with in cluster %s", config.ServerName) }() return ch, nil } // DeleteResource deletes resource func (k KubectlCmd) DeleteResource(config *rest.Config, obj *unstructured.Unstructured, namespace string) error { dynClientPool := dynamic.NewDynamicClientPool(config) disco, err := discovery.NewDiscoveryClientForConfig(config) if err != nil { return err } gvk := obj.GroupVersionKind() dclient, err := dynClientPool.ClientForGroupVersionKind(gvk) if err != nil { return err } apiResource, err := ServerResourceForGroupVersionKind(disco, gvk) if err != nil { return err } reIf := dclient.Resource(apiResource, namespace) propagationPolicy := metav1.DeletePropagationForeground return reIf.Delete(obj.GetName(), &metav1.DeleteOptions{PropagationPolicy: &propagationPolicy}) } // ApplyResource performs an apply of a unstructured resource func (k KubectlCmd) ApplyResource(config *rest.Config, obj *unstructured.Unstructured, namespace string, dryRun, force bool) (string, error) { log.Infof("Applying resource %s/%s in cluster: %s, namespace: %s", obj.GetKind(), obj.GetName(), config.Host, namespace) f, err := ioutil.TempFile(kubectlTempDir, "") if err != nil { return "", fmt.Errorf("Failed to generate temp file for kubeconfig: %v", err) } _ = f.Close() err = WriteKubeConfig(config, namespace, f.Name()) if err != nil { return "", fmt.Errorf("Failed to write kubeconfig: %v", err) } defer deleteFile(f.Name()) manifestBytes, err := json.Marshal(obj) if err != nil { return "", err } var out []string if obj.GetAPIVersion() == "rbac.authorization.k8s.io/v1" { outReconcile, err := runKubectl(f.Name(), namespace, []string{"auth", "reconcile"}, manifestBytes, dryRun) if err != nil { return "", err } out = append(out, outReconcile) } applyArgs := []string{"apply"} if force { applyArgs = append(applyArgs, "--force") } outApply, err := runKubectl(f.Name(), namespace, applyArgs, manifestBytes, dryRun) if err != nil { return "", err } out = append(out, outApply) return strings.Join(out, "\n"), nil } func runKubectl(kubeconfigPath string, namespace string, args []string, manifestBytes []byte, dryRun bool) (string, error) { cmdArgs := append(append([]string{"--kubeconfig", kubeconfigPath, "-n", namespace}, args...), "-f", "-") if dryRun { cmdArgs = append(cmdArgs, "--dry-run") } cmd := exec.Command("kubectl", cmdArgs...) log.Info(cmd.Args) cmd.Stdin = bytes.NewReader(manifestBytes) out, err := cmd.Output() if err != nil { if exErr, ok := err.(*exec.ExitError); ok { errMsg := cleanKubectlOutput(string(exErr.Stderr)) return "", errors.New(errMsg) } return "", err } return strings.TrimSpace(string(out)), nil } // ConvertToVersion converts an unstructured object into the specified group/version func (k KubectlCmd) ConvertToVersion(obj *unstructured.Unstructured, group, version string) (*unstructured.Unstructured, error) { gvk := obj.GroupVersionKind() if gvk.Group == group && gvk.Version == version { return obj.DeepCopy(), nil } manifestBytes, err := json.Marshal(obj) if err != nil { return nil, err } f, err := ioutil.TempFile(kubectlTempDir, "") if err != nil { return nil, fmt.Errorf("Failed to generate temp file for kubectl: %v", err) } _ = f.Close() if err := ioutil.WriteFile(f.Name(), manifestBytes, 0600); err != nil { return nil, err } defer deleteFile(f.Name()) outputVersion := fmt.Sprintf("%s/%s", group, version) cmd := exec.Command("kubectl", "convert", "--output-version", outputVersion, "-o", "json", "--local=true", "-f", f.Name()) cmd.Stdin = bytes.NewReader(manifestBytes) out, err := cmd.Output() if err != nil { if exErr, ok := err.(*exec.ExitError); ok { errMsg := cleanKubectlOutput(string(exErr.Stderr)) return nil, errors.New(errMsg) } return nil, fmt.Errorf("failed to convert %s/%s to %s/%s", obj.GetKind(), obj.GetName(), group, version) } // NOTE: when kubectl convert runs against stdin (i.e. kubectl convert -f -), the output is // a unstructured list instead of an unstructured object var convertedObj unstructured.Unstructured err = json.Unmarshal(out, &convertedObj) if err != nil { return nil, err } return &convertedObj, nil }
go
<gh_stars>0 package exported import ( "time" sdk "github.com/onomyprotocol/onomy-sdk/types" ) type Keeper interface { // DispatchActions executes the provided messages via authorization grants from the message signer to the grantee DispatchActions(ctx sdk.Context, grantee sdk.AccAddress, msgs []sdk.ServiceMsg) sdk.Result // Grants the provided authorization to the grantee on the granter's account with the provided expiration time // If there is an existing authorization grant for the same sdk.Msg type, this grant overwrites that. Grant(ctx sdk.Context, grantee sdk.AccAddress, granter sdk.AccAddress, authorization Authorization, expiration time.Time) error // Revokes any authorization for the provided message type granted to the grantee by the granter. Revoke(ctx sdk.Context, grantee sdk.AccAddress, granter sdk.AccAddress, msgType string) // Returns any Authorization (or nil), with the expiration time, // granted to the grantee by the granter for the provided msg type. // If the Authorization is expired already, it will revoke the authorization and return nil GetOrRevokeAuthorization(ctx sdk.Context, grantee sdk.AccAddress, granter sdk.AccAddress, msgType string) (cap Authorization, expiration time.Time) }
go
<!DOCTYPE html> <HTML><head><TITLE>Manpage of GNOME-SESSION</TITLE> <meta charset="utf-8"> <link rel="stylesheet" href="/css/main.css" type="text/css"> </head> <body> <header class="site-header"> <div class="wrap"> <div class="site-title"><a href="/manpages/index.html">linux manpages</a></div> <div class="site-description">{"type":"documentation"}</div> </div> </header> <div class="page-content"><div class="wrap"> <H1>GNOME-SESSION</H1> Section: User Commands (1)<BR>Updated: GNOME<BR><A HREF="#index">Index</A> <A HREF="/manpages/index.html">Return to Main Contents</A><HR> <A NAME="lbAB">&nbsp;</A> <H2>NAME</H2> gnome-session - Starts up the GNOME desktop environment <A NAME="lbAC">&nbsp;</A> <H2>SYNOPSIS</H2> <B>gnome-session [--autostart=DIR] [--default-session-key=KEY] [--failsafe|-f] [--debug]</B> <A NAME="lbAD">&nbsp;</A> <H2>DESCRIPTION</H2> The <I>gnome-session</I> program starts up the GNOME desktop environment. This command is typically executed by your login manager (either gdm, xdm, or from your X startup scripts). It will load either your saved session, or it will provide a default session for the user as defined by the system administrator (or the default GNOME installation on your system). <P> The default session is defined in the GConf keys under <B>/desktop/gnome/session</B>. When saving a session, <I>gnome-session</I> saves the currently running applications in the <B>$XDG_CONFIG_HOME/gnome-session/saved-session</B> directory. <P> <I>gnome-session</I> is an X11R6 session manager. It can manage GNOME applications as well as any X11R6 SM compliant. <A NAME="lbAE">&nbsp;</A> <H2>OPTIONS</H2> The following options are supported: <DL COMPACT> <DT><I>--autostart=DIR</I> <DD> Start all applications defined in <I>DIR</I>, instead of starting the applications defined in <B>/desktop/gnome/session/default_session</B>, or via the <I>--default-session-key</I> option. Multiple <I>--autostart</I> options can be passed. <DT><I>--default-session-key=KEY</I> <DD> Sets the GConf key from which applications running a default session should be read to <I>KEY</I>. If not specificed, <B>/desktop/gnome/session/default_session</B> will be used. <DT><I>--failsafe</I> <DD> <I>gnome-session</I> will run in fail-safe mode. User-specified applications will not be started. <DT><I>--debug</I> <DD> Enable debugging code. </DL> <A NAME="lbAF">&nbsp;</A> <H2>ENVIRONMENT</H2> <I>gnome-session</I> accepts all of the standard environment variables used by gnome programs, other than the SESSION_MANAGER environment variable. <I>gnome-session</I> also sets several environment variables for the use of its child processes. <P> <B>SESSION_MANAGER</B> <DL COMPACT> <DT><DD> This variable is used by session-manager aware clients to contact gnome-session. </DL> <P> <B>DISPLAY</B> <DL COMPACT> <DT><DD> This variable is set to the X display being used by <I>gnome-session</I>. Note that if the --display option is used this might be different from the setting of the environment variable when gnome-session is invoked. </DL> <A NAME="lbAG">&nbsp;</A> <H2>SEE ALSO</H2> <B><A HREF="/manpages/index.html?1+gnome-session-properties">gnome-session-properties</A>(1)</B> <B><A HREF="/manpages/index.html?1+gnome-session-save">gnome-session-save</A>(1)</B> <B><A HREF="/manpages/index.html?1+gnome-wm">gnome-wm</A>(1)</B> <A NAME="lbAH">&nbsp;</A> <H2>BUGS</H2> If you find bugs in the <I>gnome-session</I> program, please report these on <A HREF="http://bugzilla.gnome.org.">http://bugzilla.gnome.org.</A> <P> <HR> <A NAME="index">&nbsp;</A><H2>Index</H2> <DL> <DT><A HREF="#lbAB">NAME</A><DD> <DT><A HREF="#lbAC">SYNOPSIS</A><DD> <DT><A HREF="#lbAD">DESCRIPTION</A><DD> <DT><A HREF="#lbAE">OPTIONS</A><DD> <DT><A HREF="#lbAF">ENVIRONMENT</A><DD> <DT><A HREF="#lbAG">SEE ALSO</A><DD> <DT><A HREF="#lbAH">BUGS</A><DD> </DL> <HR> This document was created by <A HREF="/manpages/index.html">man2html</A>, using the manual pages.<BR> Time: 05:29:04 GMT, December 24, 2015 </div></div> </body> </HTML>
html
import { createSelector } from 'reselect'; const getAccountsList = (state) => state.sidebar.accounts; export const makegetAccountsList = () => createSelector( [getAccountsList], (accounts) => accounts ); const getAccountData = (state) => state.sidebar.account; export const makeGetAccountData = () => createSelector( [getAccountData], (account) => account ); const getSelectedDeposit = (state) => state.sidebar.deposit; export const makeGetSelectedDeposit = () => createSelector( [getSelectedDeposit], (deposit) => deposit ); const getDepositsList = (state) => state.sidebar.deposits; export const makeGetDepositsList = () => createSelector( [getDepositsList], (deposits) => deposits ); export default { makegetAccountsList, makeGetAccountData, makeGetSelectedDeposit, makeGetDepositsList, };
javascript
{"info": {"project": "facebook/react", "developers": 1, "edges": 1, "vertices": 2, "commits": 1, "id": 476, "agedays": 0, "refactorings": 1, "group": "Atomic", "language": "JavaScript", "level": "Function", "summary": ""}, "commits_list": ["f8062df1d"], "edges": [{"id": 584, "before": "src.renderers.dom.fiber.ReactDOMFiberEntry.js#shouldReuseContent", "lineB": 130, "after": "src.renderers.dom.fiber.ReactDOMFiberEntry.js#shouldHydrateDueToLegacyHeuristic", "lineA": 131, "ref": "RENAME", "sha1": "f8062df1d"}]}
json
<reponame>MakeShiftArtist/iFunnyNode import Client from "../../../src/objects/Client.js"; import { expect } from "chai"; const EMAIL = process.env["IFUNNY_NODE_EMAIL"] ?? ""; const PASSWORD = process.env["IFUNNY_NODE_PASSWORD"] ?? ""; let skip = false; const client = new Client(); let config = client.config; beforeEach(async () => { skip = false; if (EMAIL === "" || PASSWORD === "") { skip = true; } client.config = config; try { await client.login({ email: EMAIL, password: PASSWORD, }); } catch (err) { skip = true; } }); after(async () => { client.config = config; }); describe("client auth", async () => { it("headers use basic token", async () => { const new_client = new Client(); expect(new_client.headers["Authorization"]).to.match( /Basic [a-zA-Z0-9=]{156}/ ); }); it("uses token passed into constructor", async () => { let token = "<PASSWORD>"; const new_client = new Client({ token: token }); expect(new_client.headers["Authorization"]).to.equal(`Bearer ${token}`); }); it("rejects bad bearers", async () => { let token = "foo"; expect(() => new Client({ token: token })).to.throw( Error, `Invalid bearer token: ${token}` ); expect(() => (new Client().bearer = token)).to.throw( Error, `Invalid bearer token: ${token}` ); expect(() => (new Client().bearer = [token])).to.throw( TypeError, `Token must be a String, not ${typeof [token]}` ); }); it("update headers on login", async () => { client.on("login", async () => { expect(client.headers["Authorization"]).to.match( /Bearer [a-z0-9]{64}/ ); }); }); it("has valid headers", async () => { if (!client) { this.skip(); } let headers = client.headers; expect(headers["Ifunny-Project-Id"]).to.equal("iFunny"); expect(headers["accept"]).to.equal( "application/json,image/jpeg,image/webp,video/mp4" ); expect(headers["applicationstate"]).to.equal(1); expect(headers["accept-language"]).to.equal("en-US"); expect(headers["accept-encoding"]).to.equal("gzip"); expect(typeof headers["User-Agent"]).to.equal("string"); }); });
javascript
Notwithstanding the efforts made by the saffron lobby to pretend that Yakub Memon's religion had nothing to do with his hanging, the belief that the two are inextricably linked will not fade away. As a matter of fact, Tripura Governor Tathagata Roy, who was a member of the BJP before being chosen for the Raj Bhavan post, can be said to have let the cat out of the bag by saying that those who opposed Memon's hanging were potential terrorists. The governor's "insight" underlines two points. One is an inability of the follower of a semi-fascist ideology to understand the norms of a democracy, where it is allowed to hold views contrary not only to what the government says but even what the judiciary may pronounce. Moreover, the governor seems to believe that it is only Memon's co-religionists who were against the punishment meted out to him. But, there were many others, including Hindus, who petitioned the president against the execution. Surely, as a true saffronite, the governor would not like to categorize these Hindus as potential terrorists. His target, therefore, was obviously the Muslims, which is in keeping with the standard Hindutva view that although not all Muslims are terrorists, all terrorists are Muslims. It is but one step to go from identifying only a particularly community with terrorism to insinuate that all its members are potential terrorists. Incidentally, this blinkered outlook ignores the role of Hindu terrorists during the anti-foreigner agitation in Assam in the 1980s with which the United Liberation Front of Assam (ULFA) was associated, and in Sri Lanka, one of whom belonging to the Liberation Tigers of Tamil Eelam (LTTE) killed former Indian prime minister Rajiv Gandhi in 1991. The involvement of Hindutva supporters has also been seen in acts of terrorism such as the blasts in 2007 in the Samjhauta Express running between India and Pakistan. The train was travelling to Lahore, which was why there were many Muslims aboard. There were 68 deaths. There are other such cases of Hindu terrorism as well about which a public prosecutor has said that she has been asked by those in authority to go slow on them. The controversy over Memon related less to his culpability than to the belief that he may have surrendered to the Indian police and, as such, should be seen as an approver and, therefore, not sentenced to death. A newspaper article quoting a former Indian intelligence official fuelled this speculation, but since no definite conclusion was reached about whether Memon had surrendered or had been caught by the Nepal police and handed over to the Indian authorities, the execution went ahead as planned. What was remarkable about the episode was the protracted judicial process which preceded the 7. 35 a. m. hanging. The fact that the Supreme Court was in session till only about two hours before the death sentence was carried out would long be a matter of judicial and political history. Not surprisingly, Memon's fate had revived the debate about whether India should follow other "civilized" countries in banning capital punishment. There has been a large measure of support for such an initiative. But, two factors have made its implementation difficult. One is the continuing threat of terrorism from Pakistan and the fact that suicide bombers sneak in from across the border from time to time, as in Gurdaspur in Punjab recently, to kill at random. One such killer, Ajmal Kasab, was caught alive during the November 26-29, 2008, Mumbai murder and mayhem by Pakistani terrorists. He was hanged in 2012. It is obvious that as long as these acts of terror continue, it will be extremely difficult for any Indian government to ban capital punishment. The other deterrent is the continuing incidents of rape. As may be expected, there is widespread fear as well as revulsion about these incidents, which were seen at its most intense following the gang rape of a young medical student in Delhi in 2012. As long as these two factors vitiate the Indian scene, judicial executions will continue even if the Supreme Court has said that it will be exercised in the rarest or rare cases. It is possible, however, that while rapists may escape the maximum punishment, the Pakistani terrorists will not. Nor will home-grown ones like Afzal Guru, who was hanged in 2013. The BJP is making a mistake, however, by allegedly going slow on suspected Hindu terrorists and by insinuating that they were arrested by the former Congress-led government at the centre to curry favour with the Muslims. By articulating this line, Home Minister Rajnath Singh is bringing the question of religious affinity back into these criminal cases, which can make the BJP's detractors say that Memon's execution was at least partly due to his being a Muslim. Prime Minister Narendra Modi may have succeeded to a considerable extent in curbing the Hindutva hotheads who are longer indulging in their provocative ghar wapsi (home coming) and love jehad antics to urge Muslims to return to their "original" faith of Hinduism and accusing Muslim youths of wooing and marrying Hindu girls in order to convert them to Islam. But the prime minister is yet to ensure that people like Rajnath Singh and Tathagata Roy do not revive memories of RSS supremo Guru Golwalkar's (1906-73) categorization of Muslims as "internal enemies". (03. 08. 2015 - Amulya Ganguli is a political analyst. The views expressed are personal. He can be contacted at [email protected])
english
package xyz.upperlevel.uppercore.gui.action.actions; import com.google.common.collect.ImmutableMap; import lombok.Getter; import org.bukkit.Sound; import org.bukkit.entity.Player; import xyz.upperlevel.uppercore.config.ConfigConstructor; import xyz.upperlevel.uppercore.config.ConfigProperty; import xyz.upperlevel.uppercore.gui.action.Action; import xyz.upperlevel.uppercore.gui.action.BaseActionType; import xyz.upperlevel.uppercore.gui.action.Parser; import xyz.upperlevel.uppercore.placeholder.PlaceholderUtil; import xyz.upperlevel.uppercore.placeholder.PlaceholderValue; import java.util.Map; public class PlaySoundAction extends Action<PlaySoundAction> { public static final SoundActionType TYPE = new SoundActionType(); @Getter private final Sound sound; @Getter private final PlaceholderValue<Float> volume, pitch; @ConfigConstructor(inlineable = true) public PlaySoundAction( @ConfigProperty("sound") Sound sound, @ConfigProperty(value = "volume", optional = true) PlaceholderValue<Float> volume, @ConfigProperty(value = "pitch", optional = true) PlaceholderValue<Float> pitch ) { super(TYPE); this.sound = sound; this.volume = volume != null ? volume : PlaceholderValue.fake(1.0f); this.pitch = pitch != null ? volume : PlaceholderValue.fake(1.0f); } @Override public void run(Player player) { player.playSound(player.getLocation(), sound, volume.resolve(player), pitch.resolve(player)); } public static class SoundActionType extends BaseActionType<PlaySoundAction> { public SoundActionType() { super(PlaySoundAction.class, "play-sound"); setParameters( Parameter.of("sound", Parser.soundValue(), true), Parameter.of("volume", Parser.strValue(), "1.0", false), Parameter.of("pitch", Parser.strValue(), "1.0", false) ); } @Override public PlaySoundAction create(Map<String, Object> pars) { return new PlaySoundAction( (Sound) pars.get("sound"), PlaceholderUtil.parseFloat(pars.get("volume")), PlaceholderUtil.parseFloat(pars.get("pitch")) ); } @Override public Map<String, Object> read(PlaySoundAction action) { return ImmutableMap.of( "id", action.sound, "volume", action.volume.toString(), "pitch", action.pitch.toString() ); } } }
java
{ "include": ["./src/**/*"], "exclude": [ "**/*.spec.ts", "dist", "node_modules", "example/**/*", "tests/**/*" ], "compilerOptions": { "lib": ["es6"], "declaration": true, "moduleResolution": "node", // because classic "is mainly present for backward compatibility." - https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/Module%20Resolution.md#classic "baseUrl": "." } }
json
<gh_stars>0 import * as databaseService from './src/components/db'; import * as filesService from './src/components/files'; import * as iamService from './src/components/iam'; import * as notificationsService from './src/components/push'; import * as codeService from './src/components/code'; import * as paymentsService from './src/components/payments'; import configuration from './src/config'; export const db = databaseService; export const files = filesService; export const iam = iamService; export const notifications = notificationsService; export const code = codeService; export const payments = paymentsService; export const config = configuration;
javascript
/* * Copyright 2015-2016 USEF Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package nl.energieprojecthoogdalem.util; import info.usef.agr.dto.ConnectionPortfolioDto; import info.usef.agr.dto.UdiPortfolioDto; import info.usef.core.config.AbstractConfig; import nl.energieprojecthoogdalem.agr.devicemessages.ReservedDevice; import nl.energieprojecthoogdalem.forecastservice.element.ElementType; import org.codehaus.jackson.JsonNode; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.node.ObjectNode; import org.joda.time.LocalDate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.math.BigInteger; import java.text.SimpleDateFormat; import java.util.*; /** * utility to read | write reserved device messages * contents of RESERVED_MESSAGES_FILE * { * "key1": * { * "endpointName": * { * "startIndex": 50 * ,"period": "yyyy-MM-dd" * } * ,"endpointName": * { * "startIndex": 70 * ,"period": "yyyy-MM-dd" * } * ,... * } * * ,"key2": {} * * ,... * } * */ public class ReserveDeviceUtil { public static String PERIOD_STRING_FORMAT = "yyyy-MM-dd"; private static final Logger LOGGER = LoggerFactory.getLogger(ReserveDeviceUtil.class); private static String RESERVED_MESSAGES_FILE = AbstractConfig.getConfigurationFolder() + "reserved_messages.json" ; /** * reads the reservation using the specified key and returns the reserved map * @return a map containing shift requests (period, shifted start index per endpoint), a empty map if not found * @param key the key to search shift requests for * */ public static Map<String, ReservedDevice> readReservation(String key) { Map<String, ReservedDevice> reservations = new HashMap<>(); try { ObjectMapper mapper = new ObjectMapper(); mapper.setDateFormat(new SimpleDateFormat(PERIOD_STRING_FORMAT)); JsonNode root = readFile(); if(root != null) { JsonNode endpoints = root.get(key); if(endpoints == null) { LOGGER.error("Unable to find key {} in file", key); return reservations; } Iterator<Map.Entry<String, JsonNode>> deviceIteratior = endpoints.getFields(); while(deviceIteratior.hasNext()) { Map.Entry<String, JsonNode> entry = deviceIteratior.next(); reservations.put(entry.getKey(), mapper.treeToValue(entry.getValue(), ReservedDevice.class )); } } } catch(NullPointerException exception) { LOGGER.error("Uncaught nullpointer reading key {} in file, reason: ", key, exception); } catch (IOException exception) { LOGGER.error("unable to convert json in key to a ReservedDevice reason: ", exception); } return reservations; } /** * reads the json file and returns the root structure of the json file, * passes null when file can't be read * @return the root json node of the file or null if the file was not created * */ private static JsonNode readFile() { JsonNode root = null; try { ObjectMapper objectMapper = new ObjectMapper(); root = objectMapper.readTree(new FileInputStream(RESERVED_MESSAGES_FILE)); } catch (IOException exception) { LOGGER.warn("unable to read {}", RESERVED_MESSAGES_FILE); } return root; } /** * writes | appends the resevation map to a json file using the provided device map * @param key the key to write the device map to * @param deviceMap the map containing shift requests (period, shifted start index per endpoint) * */ public static void writeReservation(String key, Map<String, ReservedDevice> deviceMap) { ObjectMapper mapper = new ObjectMapper(); mapper.setDateFormat(new SimpleDateFormat(PERIOD_STRING_FORMAT)); ObjectNode root = (ObjectNode) readFile(); if(root == null) { try { ObjectNode devicesInReservation = mapper.createObjectNode(); devicesInReservation.put (key, (JsonNode) mapper.valueToTree(deviceMap)); mapper.writeValue(new File(RESERVED_MESSAGES_FILE), devicesInReservation); } catch (IllegalArgumentException exception) { LOGGER.error("unable to convert device map to json node, reason: ", exception); } catch(IOException exception) { LOGGER.error("Unable to write key {} to file, reason: ", key, exception); } } else { try { root.put(key, (JsonNode) mapper.valueToTree(deviceMap)); mapper.writeValue(new File(RESERVED_MESSAGES_FILE), root); } catch (IOException exception) { LOGGER.error("Unable to append key {} to file, reason: ", key, exception); } } } /** * deletes a specific reservation in the json file using the provided key * @param key the key to delete a reservation for * */ public static void deleteReservation(String key) { try { ObjectMapper mapper = new ObjectMapper(); ObjectNode root = (ObjectNode) readFile(); root.remove(key); mapper.writeValue(new File(RESERVED_MESSAGES_FILE), root); } catch (IOException exception) { LOGGER.error("unable to delete key {}, error writing new file, reason: ", exception); } } /** * deletes the json file where reservations will be written to * */ public static void deleteReservationFile() { File reservationFile = new File(RESERVED_MESSAGES_FILE); if(reservationFile.delete()) LOGGER.info("device reservation file deleted."); else LOGGER.info("device reservation file not deleted!"); } /** * reserves device messages for batteries depending on type, * iterates over every ptu index that needs to be shifted, * looks for an available battery, * writes a reservation in the device map * @param deviceMap map to add shift reservations per endpoint to * @param connections the connections to select battery udis from * @param shiftedPtuIndexes a list containing shifted ptu indexes * @param period the date when the devices will be shifted * @param type search for zih or nod udis using "BATTERY_ZIH" or "BATTERY_NOD" * */ public static void reserveDeviceMessages(Map<String, ReservedDevice> deviceMap, List<ConnectionPortfolioDto> connections , List<Integer> shiftedPtuIndexes, LocalDate period, String type) { Collections.sort(shiftedPtuIndexes); for(Integer shiftedPtuIdx : shiftedPtuIndexes) { Iterator<ConnectionPortfolioDto> connectionIterator = connections.iterator(); UdiPortfolioDto batteryUdi = null; while(connectionIterator.hasNext()) { ConnectionPortfolioDto connection = connectionIterator.next(); batteryUdi = findBatteryUdi(connection.getUdis(), type, shiftedPtuIdx); if(batteryUdi != null) { connectionIterator.remove(); break; } } if(batteryUdi != null) { ReservedDevice device = new ReservedDevice(shiftedPtuIdx , period.toString(PERIOD_STRING_FORMAT)); deviceMap.put(batteryUdi.getEndpoint(), device); } else LOGGER.error("Unable to find available {} udi for shifted ptu index {}!", type, shiftedPtuIdx); } } /** * filters the specific {@link UdiPortfolioDto} from the list using the type parameter name as filter, * checks if the potential flex for the shift index is greater then 0 * and returns the first matching argument otherwise null, * there is only one battery udi per connection * * @param udis the udis to filter from * @param type the udi type to search for * @param shiftIndex the shift index to check if the udi can be shifted * @return a battery udi that can be shifted or null if the battery cannot be shifted * */ private static UdiPortfolioDto findBatteryUdi(List<UdiPortfolioDto> udis, String type, int shiftIndex) { return udis.stream() .filter(udi -> type.equals(udi.getProfile())) .filter(udi -> { switch(type) { case ElementType.BATTERY_ZIH: return udi.getUdiPowerPerDTU().get(shiftIndex).getForecast().getPotentialFlexConsumption().compareTo(BigInteger.ZERO) > 0; case ElementType.BATTERY_NOD: return udi.getUdiPowerPerDTU().get(shiftIndex).getForecast().getPotentialFlexProduction().compareTo(BigInteger.ZERO) > 0; default: return false; } }) .findFirst() .orElse(null); } }
java
<gh_stars>0 package com.github.cbuschka.workspace_mechanic.integration_tests; public interface ScriptGenerator { String getExt(); String generate(String migrationName, String touchFilePath, boolean shallSucceed); }
java
This shows that terrorist activities in the country will only cease when Pakistan is completely wiped out from the map of world, otherwise, terrorists will act through some or the other medium ! The infiltrators and terrorists from Bangladesh have begun to show their true colours in India. The Government should take stringent measures against them, otherwise there will be terrible consequences in the future ! New Delhi – Indian intelligence agencies have received information that Pakistan’s Inter-Services Intelligence (ISI) is training 40 and more Rohingya Muslims in Bangladesh with the help of terror outfit Jamaat-ul Mujahideen Bangladesh (JMB) to carry out terrorist attacks in India. The Bangladeshi terrorist organisation JMB is funded by Pakistan’s ISI. The trained Rohingyas and a large number of refugee Rohingyas reside in the international border area, Cox’s Bazar, in Bangladesh. The funding for terror training is provided through Saudi Arabia and Malaysia. In the first instalment, JMB has received funds in Bangladeshi currency ‘one crore takas’, equivalent to Rs. 83,77,000, for terror training. Pakistan was unable to carry out terror attacks on the Indian border, thus it has adopted a new conspiracy. JMB is spreading its tentacles across India. Last year, the National Investigation Agency (NIA) had shared a list of 125 terrorists with all the States and asked security forces to be alert. The JMB had started its activities first in 2007, initially in Bengal and Assam, and in 4 years, JMB has set up 22 hideouts in Bengaluru alone. This terror organisation is trying to carry out its activities in States like Jharkhand, Bihar, Maharashtra, Karnataka, and Kerala in the guise of Bangladeshi illegal immigrants. The JMB even conducted a trial of rocket launchers in the Krishnagiri hills along the Karnataka border.
english
<filename>src/utils/fetchData.js const getOneCallAPI = (data) => { let lon = data.coord.lon let lat = data.coord.lat let oneCallAPI = process.env.WeatherOneCallAPI.replace("LAT", lat) oneCallAPI = oneCallAPI.replace("LON", lon) return oneCallAPI } const getData = async(API, component, flag) => { try{ let response = await fetch(API) let data = await response.json() let newAPI = getOneCallAPI(data) let newResponse = await fetch(newAPI) let newData = await newResponse.json() let superData = { ...data, ...newData } // console.log(superData) if(!flag){ return await superData } component.setState({ loading: false, data: superData }) }catch(error){ component.setState({ loading: false, error: error }) } } const getApi = (name) => { let regex = /\s/ name = name.replace(regex, "%20") let API = process.env.WeatherAPIName.replace("NAME", name) return API } const requestData = (lat, lon, component, name) => { let API if(name){ API = getApi(name) }else{ API = process.env.WeatherAPICoor.replace("LAT", lat) API = API.replace("LON", lon) } getData(API, component, true) } const fetchData = async (component, name) => { component.setState({ loading: true, error: null }) if(name){ let API = getApi(name) let data = await getData(API, component) requestData(data.coord.lat, data.coord.lon, component) }else{ let location = navigator.geolocation.getCurrentPosition(position => { let lon = position.coords.longitude let lat = position.coords.latitude requestData(lat, lon, component) }, positionError => { fetchData(component, "Mexico City") }) } } export default fetchData
javascript
The file-swapping technology associated with the original Napster era is being transformed to block unauthorized copying and take advantage of now-popular legal services. Thomson and Fraunhofer, the companies that license and own the patents behind the MP3 digital music technology, are in the midst of creating a new digital rights management add-on for the popular format, a Thomson executive said Tuesday. The move is aimed at pushing more deeply into the world of authorized music distribution through services such as Apple Computer's iTunes or the new Napster. All those new services sell music wrapped in digital locks--most in incompatible proprietary technologies by companies such as Apple, Microsoft or RealNetworks--while MP3 songs today are typically distributed free of copy controls. "Eventually, digital distribution will be a significant mass market," said Rocky Caldwell, Thomson's director of technology marketing. "We think it will be served well by (digital rights management) that is based on standards. No one else seems to be proposing that." The move is recognition of a dawning new era in digital music, in which pay-per-song services are beginning to gain ground on the anarchic file-swapping networks and in which CDs themselves may ultimately be overtaken by digital downloads. The first era in Internet audio belonged undeniably to MP3, an audio standard codified by the Moving Picture Experts Group (MPEG) a dozen years ago. Thomson and Fraunhofer, the German companies that hold patents in the MP3 technology, have long been collecting royalties from software and hardware companies that use the format. But the same features that made MP3 attractive to tens of millions of ordinary computer users made the big record labels deeply suspicious of the format. For years, they've been looking for a digital song format that would include tools to prevent people from making unauthorized copies or swapping tunes on networks like Kazaa. Microsoft, with its Windows Media and associated digital rights management technology, has been one big beneficiary of that, with its format used in Napster, Musicmatch and other song stores and bundled on physical CDs. Apple's own Fairplay copy protection tools have also won the big record labels' approval and form the heart of the company's iTunes Music Store. Thomson and Fraunhofer's rights management technology will be based in large part on open standards the MPEG group and the Open Mobile Alliance are adopting, Caldwell said. The companies will provide free use of the copy protection technology to anyone who licenses the MP3 format, he said. As with any other digital rights management format, the technology will have to be supported by software players and chipmakers before devices are able to play songs protected by it. The companies are in talks with chip manufacturers and music distribution services now, Caldwell said. Caldwell said he expected to see devices and services supporting the protected MP3 format by the end of 2004. The plans were first reported by the Los Angeles Times.
english
<gh_stars>1-10 import { Arrow } from '../../utils/icons/Index'; const Steps = () => { return ( <div className="my-2"> <h1 className="flex justify-center items-center text-3xl font-bold"> Want to record your own track? Do it in 3 simple steps </h1> <div className="flex flex-col justify-center items-center text-center"> <ul className="text-xl text-center my-2 font-bold"> <li className="border-2 my-1 py-2 px-4 rounded-lg bg-blue-400 text-white"> Go to the record page and Click on record </li> <Arrow /> <li className="border-2 my-1 py-2 px-4 rounded-lg bg-blue-400 text-white"> Download what you recorded </li> <Arrow /> <li className="border-2 my-1 py-2 px-4 rounded-lg bg-blue-400 text-white"> Upload it right there to our posts page </li> </ul> </div> </div> ); }; export default Steps;
typescript
I was there. I saw it all. The angel who told me I would carry God’s Son, and when he told me of his dream. The seemingly endless road to Bethlehem for the census, and journeys to Jerusalem to visit the Temple and see friends in the city. I saw him take his first steps and watched him fall over, Joseph and I taught him to read and after that he was always in the synagogue or following the Rabbi’s around asking questions and listening to their stories. Today was different though, was an agony. My boy was barely recognizable, they had treated him mercilessly. I don’t know where I found the strength to stand at the foot of the cross, but John was there with me and my son, he looked at me and asked me to care for John and for John to care for me. It’s hard to describe the love in his eyes but it filled my broken heart with hope. I remembered the gift of myrrh the travellers gave us, I remembered the promise of the angel and what my son said, so many times, to not be afraid. I don’t know what comes after today, after this horrible day, but I know that there is more, that there is still hope, that even his death in such a brutal way can have meaning and can save us all. O Lord, have mercy on us all. Please, pray with me, join me in these words: Glory be to the Father and to the Son and to the Holy Spirit, as it was in the beginning, is now and ever shall be, Amen. This monologue was originally used as part of a Good Friday Walk of Witness liturgy, use it and the scripture that inspired it to reflect on these two foundational events. Put yourself in Mary's place watching these events, contemplate her experience of this day and of the resurrection to come. Reflections on the events of Good Friday told by characters from the nativity stories. An imaginative exploration of the wonder of the nativity and the sacrifice of the crucifixion. Don’t I Need to Be Fixed Up?
english
// Copyright 2019 The Dawn Authors // Copyright 2021 The GPGMM Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "src/d3d12/ResourceHeapAllocatorD3D12.h" #include "src/common/IntegerTypes.h" #include "src/d3d12/HeapD3D12.h" #include "src/d3d12/ResourceAllocatorD3D12.h" namespace gpgmm { namespace d3d12 { ResourceHeapAllocator::ResourceHeapAllocator(ResourceAllocator* resourceAllocator, D3D12_HEAP_TYPE heapType, D3D12_HEAP_FLAGS heapFlags, DXGI_MEMORY_SEGMENT_GROUP memorySegment, uint64_t heapSize) : mResourceAllocator(resourceAllocator), mHeapType(heapType), mHeapFlags(heapFlags), mMemorySegment(memorySegment) { } std::unique_ptr<MemoryAllocation> ResourceHeapAllocator::AllocateMemory(uint64_t size, uint64_t alignment) { Heap* heap = nullptr; if (FAILED(mResourceAllocator->CreateResourceHeap(size, mHeapType, mHeapFlags, mMemorySegment, alignment, &heap))) { return nullptr; } AllocationInfo info = {}; info.mMethod = AllocationMethod::kStandalone; return std::make_unique<MemoryAllocation>(/*allocator*/ this, info, kInvalidOffset, heap); } void ResourceHeapAllocator::DeallocateMemory(MemoryAllocation* allocation) { ASSERT(allocation != nullptr); Heap* heap = static_cast<Heap*>(allocation->GetMemory()); mResourceAllocator->FreeResourceHeap(heap); } }} // namespace gpgmm::d3d12
cpp
<filename>manifest.json { "name": "remount", "description": "track plugins and automatically remount on changes or manually remount whenever", "author": "Xinos & slowstab", "version": "1.0.1", "license": "MIT" }
json
<gh_stars>10-100 {"template":{"small":"https://static-cdn.jtvnw.net/emoticons/v1/{image_id}/1.0","medium":"https://static-cdn.jtvnw.net/emoticons/v1/{image_id}/2.0","large":"https://static-cdn.jtvnw.net/emoticons/v1/{image_id}/3.0"},"channels":{"ladyhammer":{"title":"Ladyhammer","channel_id":76869088,"link":"http://twitch.tv/ladyhammer","desc":null,"plans":{"$4.99":"20579","$9.99":"49092","$24.99":"49093"},"id":"ladyhammer","first_seen":"2017-01-22 14:55:10","badge":"https://static-cdn.jtvnw.net/badges/v1/83c7f921-6dcc-4db6-a477-c92edd04dc08/1","badge_starting":"https://static-cdn.jtvnw.net/badges/v1/83c7f921-6dcc-4db6-a477-c92edd04dc08/3","badge_3m":"https://static-cdn.jtvnw.net/badges/v1/57e2877e-af41-46fb-9a9b-1265169de187/3","badge_6m":"https://static-cdn.jtvnw.net/badges/v1/c8dec710-0b8d-4fa1-aa43-2093503dc41f/3","badge_12m":null,"badge_24m":null,"badges":{"0":{"image_url_1x":"https://static-cdn.jtvnw.net/badges/v1/83c7f921-6dcc-4db6-a477-c92edd04dc08/1","image_url_2x":"https://static-cdn.jtvnw.net/badges/v1/83c7f921-6dcc-4db6-a477-c92edd04dc08/2","image_url_4x":"https://static-cdn.jtvnw.net/badges/v1/83c7f921-6dcc-4db6-a477-c92edd04dc08/3","description":"Subscriber","title":"Subscriber","click_action":"subscribe_to_channel","click_url":""},"3":{"image_url_1x":"https://static-cdn.jtvnw.net/badges/v1/57e2877e-af41-46fb-9a9b-1265169de187/1","image_url_2x":"https://static-cdn.jtvnw.net/badges/v1/57e2877e-af41-46fb-9a9b-1265169de187/2","image_url_4x":"https://static-cdn.jtvnw.net/badges/v1/57e2877e-af41-46fb-9a9b-1265169de187/3","description":"3-Month Subscriber","title":"3-Month Subscriber","click_action":"subscribe_to_channel","click_url":""},"6":{"image_url_1x":"https://static-cdn.jtvnw.net/badges/v1/c8dec710-0b8d-4fa1-aa43-2093503dc41f/1","image_url_2x":"https://static-cdn.jtvnw.net/badges/v1/c8dec710-0b8d-4fa1-aa43-2093503dc41f/2","image_url_4x":"https://static-cdn.jtvnw.net/badges/v1/c8dec710-0b8d-4fa1-aa43-2093503dc41f/3","description":"6-Month Subscriber","title":"6-Month Subscriber","click_action":"subscribe_to_channel","click_url":""}},"bits_badges":null,"cheermote1":"https://d3aqoihi2n8ty8.cloudfront.net/partner-actions/76869088/7b181601-01f6-4e21-89a0-e158d347efdb/1/light/animated/3/b06ecf8cc9b75f1ac6bbcb4189366ed031faa811.gif","cheermote100":"https://d3aqoihi2n8ty8.cloudfront.net/partner-actions/76869088/7b181601-01f6-4e21-89a0-e158d347efdb/100/light/animated/3/d9893d41d1be8da6d7f1510a2ff0c69593bb4365.gif","cheermote1000":"https://d3aqoihi2n8ty8.cloudfront.net/partner-actions/76869088/7b181601-01f6-4e21-89a0-e158d347efdb/1000/light/animated/3/541b9faca15011725f6d145b76208fd5bda50534.gif","cheermote5000":"https://d3aqoihi2n8ty8.cloudfront.net/partner-actions/76869088/7b181601-01f6-4e21-89a0-e158d347efdb/5000/light/animated/3/a50e613da9ea123e7d7ef65e5f096b97fc9485e7.gif","cheermote10000":"https://d3aqoihi2n8ty8.cloudfront.net/partner-actions/76869088/7b181601-01f6-4e21-89a0-e158d347efdb/10000/light/animated/3/3536883418acf2a9f8f9c370250f431ce0afad33.gif","set":20579,"emotes":[{"code":"ladyhamCry","image_id":142585,"set":20579},{"code":"ladyhamRAGE","image_id":142943,"set":20579},{"code":"ladyhamNotlikethis","image_id":161812,"set":20579},{"code":"ladyhamRip","image_id":138053,"set":20579},{"code":"ladyham10","image_id":137804,"set":20579},{"code":"ladyhamHype","image_id":137805,"set":20579},{"code":"ladyhamGasm","image_id":137806,"set":20579},{"code":"ladyhamLove","image_id":137807,"set":20579},{"code":"ladyhamLammy","image_id":177700,"set":20579},{"code":"ladyhamWave","image_id":177701,"set":20579},{"code":"ladyhamGG","image_id":207926,"set":49092},{"code":"ladyhamREKT","image_id":207927,"set":49093}]}}}
json
American rapper Cardi B has come forward with the revelation that her residence in Los Angeles is haunted, causing her to feel concerned for her safety. The Tenth Sunday after Trinity is August 13, 2023. Readings for Year A can be found here, as used for the Ninth Sunday after Trinity, Year A, in 2020. The U.S. military has been around for over 200 years. With that in mind, there is no doubt that many strange, spooky events have occurred throughout the decades. The following column is the opinion and analysis of the writer, Katharina Buczek.
english
{ "FROM_NAME": "Робот FastComments", "INTRO": "Привет <%= commenterName %>,", "BANNER_TEXT": "Подтвердите свой голос", "SUBJECT": "<%= commenterName %> - Подтвердите свой голос.", "LOOKS_LIKE_YOU_VOTED_HERE": "Похоже, вы проголосовали на пост <a href=\"<%= url %>\"> здесь </a>. Если вы нажмете ссылку «Подтверждение» ниже, это поможет нам знать, что это вы покинули этот голос.", "VERIFY_YOUR_VOTE_LINK": "Подтвердите свой голос", "WAS_YOU_IGNORE_THIS_EMAIL": "Если это не вы, проигнорируйте это письмо.", "THANKS_SO_MUCH": "Спасибо!", "UNSUBSCRIBE_HERE": "Войдите и откажитесь от подписки на эти электронные письма здесь" }
json
from base64 import urlsafe_b64encode import dash_core_components as dcc import dash_bootstrap_components as dbc import dash_html_components as html from dash.dependencies import Input, Output import dash_defer_js_import as dji import dash_table as dt from app import app, server from pages import single_ticker, portfolio_metrics with open('./README.md', 'r') as f: readme = f.read() with open('./documentation/gettingstarted.md', 'r') as f: docs = f.read() app.layout = dbc.Container( [ dcc.Location(id='url', refresh=False), dbc.NavbarSimple( children=[ dbc.NavItem( dbc.NavLink( 'Risk Dash Documentation', href='/docs', ), ), dbc.NavItem( dbc.NavLink( 'Portfolio Dashboard', href='/portfolio', ), ), dbc.NavItem( dbc.NavLink( 'Individual Security Dashboard', href='/single', ), ), ], brand='Risk Dash', brand_href='/', color='light', id='nav' ), dbc.Container(id='page_content',fluid=True), html.Div(dt.DataTable(data=[{}]), style={'display' : 'none'}), dji.Import(src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_SVG") ], fluid=True ) @app.callback( Output('page_content', 'children'), [Input('url', 'pathname')] ) def get_layout(url): if url != None: if url == '/portfolio': return(portfolio_metrics.layout) elif url == '/single': return(single_ticker.layout) elif url == '/docs': return(dcc.Markdown(docs)) else: return(dcc.Markdown(readme)) if __name__ == '__main__': print('Running') app.run_server()
python
package mongo import ( "time" "github.com/globalsign/mgo" "github.com/globalsign/mgo/bson" ) var ( //ErrNotFound 数据没有找到 ErrNotFound = mgo.ErrNotFound //connErr 连接错误 connErr error ) //M 自定义bson类型 type M = bson.M //Sort 自定义排序类型 type Sort []string //ObjectID 自定义ObjectID类型 type ObjectID = bson.ObjectId //Client mongodb连接结构体 type Client struct { session *mgo.Session } //Conn 连接mongodb func Conn(url string) *Client { defer func() { if r := recover(); r != nil { connErr = r.(error) } }() //[mongodb://][user:pass@]host1[:port1][,host2[:port2],...][/database][?options] session, err := mgo.Dial(url) if err != nil { panic(err) } connErr = nil session.SetSocketTimeout(24 * time.Hour) // Optional. Switch the session to a monotonic behavior. //session.SetMode(mgo.Monotonic, true) return &Client{ session: session, } } //Ping 监测数据库连接 func Ping() error { return connErr } //NewObjectID 返回一个新的唯一ObjectId func NewObjectID() ObjectID { return bson.NewObjectId() } //Hex 返回ObjectId的十六进制 func Hex(oid ObjectID) string { return oid.Hex() } //IsObjectIdHex 返回ObjectId是否为ObjectId的有效十六进制 func IsObjectIdHex(s string) bool { return bson.IsObjectIdHex(s) } //ObjectIDHex 将id转成十六进制表示返回ObjectId func ObjectIDHex(s string) ObjectID { return bson.ObjectIdHex(s) } //GetRow 返回一行数据 func (c *Client) GetRow(database, collection string, query M, result interface{}) error { if connErr != nil { return connErr } session := c.session.Copy() defer session.Close() conn := session.DB(database).C(collection) //query MongoDB return conn.Find(query).One(result) } //GetResult 返回多行结果集 func (c *Client) GetResult(database, collection string, query M, fields M, options M, result interface{}) error { if connErr != nil { return connErr } session := c.session.Copy() defer session.Close() conn := session.DB(database).C(collection) find := conn.Find(query).Select(fields) //排序 if options["Sort"] != "" { if sort, ok := options["Sort"].(Sort); ok { find.Sort(sort...) } } //分页 if options["Limit"] != "" { if limit, ok := options["Limit"].(int); ok { find.Limit(limit) } } //跳过 if options["Skip"] != "" { if skip, ok := options["Skip"].(int); ok { find.Skip(skip) } } return find.All(result) } //GetCount 返回统计条数 func (c *Client) GetCount(database, collection string, query M) (int, error) { if connErr != nil { return 0, connErr } session := c.session.Copy() defer session.Close() conn := session.DB(database).C(collection) //query MongoDB return conn.Find(query).Count() } //Insert 插入数据 func (c *Client) Insert(database, collection string, docs ...interface{}) error { if connErr != nil { return connErr } session := c.session.Copy() defer session.Close() conn := session.DB(database).C(collection) return conn.Insert(docs...) } //Update 更新数据,不存在报ErrNotFound func (c *Client) Update(database, collection string, selector M, update M) error { if connErr != nil { return connErr } session := c.session.Copy() defer session.Close() conn := session.DB(database).C(collection) return conn.Update(selector, update) } //UpdateAll 批量更新数据,不存在报ErrNotFound func (c *Client) UpdateAll(database, collection string, selector M, update M) (map[string]interface{}, error) { if connErr != nil { return map[string]interface{}{}, connErr } session := c.session.Copy() defer session.Close() conn := session.DB(database).C(collection) info, err := conn.UpdateAll(selector, update) if err != nil { return nil, err } return map[string]interface{}{"Matched": info.Matched, "Updated": info.Updated, "UpsertedId": info.UpsertedId}, nil } //Upsert 更新数据,不存在会新插入数据 func (c *Client) Upsert(database, collection string, selector M, update M) (map[string]interface{}, error) { if connErr != nil { return map[string]interface{}{}, connErr } session := c.session.Copy() defer session.Close() conn := session.DB(database).C(collection) info, err := conn.Upsert(selector, update) if err != nil { return nil, err } return map[string]interface{}{"Matched": info.Matched, "Updated": info.Updated, "UpsertedId": info.UpsertedId}, nil } //Remove 删除数据 func (c *Client) Remove(database, collection string, selector M) error { if connErr != nil { return connErr } session := c.session.Copy() defer session.Close() conn := session.DB(database).C(collection) return conn.Remove(selector) } //RemoveAll 批量删除数据 func (c *Client) RemoveAll(database, collection string, selector M) (int, error) { if connErr != nil { return 0, connErr } session := c.session.Copy() defer session.Close() conn := session.DB(database).C(collection) info, err := conn.RemoveAll(selector) var removed int if err == nil { removed = info.Removed } return removed, err } //FindAndModify 查找并修改数据 func (c *Client) FindAndModify(database, collection string, selector M, update M, upsert bool, result interface{}) (int, error) { if connErr != nil { return 0, connErr } session := c.session.Copy() defer func() { session.Close() }() change := mgo.Change{Update: update, Upsert: upsert, ReturnNew: true} conn := session.DB(database).C(collection) info, err := conn.Find(selector).Apply(change, result) var updated int if err == nil { updated = info.Updated } return updated, err } //FindAndRemove 查找并删除数据 func (c *Client) FindAndRemove(database, collection string, selector M, result interface{}) (int, error) { if connErr != nil { return 0, connErr } session := c.session.Copy() defer func() { session.Close() }() change := mgo.Change{Remove: true} conn := session.DB(database).C(collection) info, err := conn.Find(selector).Apply(change, result) var removed int if err == nil { removed = info.Removed } return removed, err } //GetPipeRow 使用管道进行聚合计算并返回一行数据 func (c *Client) GetPipeRow(database, collection string, pipeline []M, result *M) error { if connErr != nil { return connErr } session := c.session.Copy() defer func() { session.Close() }() conn := session.DB(database).C(collection) return conn.Pipe(pipeline).One(result) } //GetPipeResult 使用管道进行聚合计算并返回多行结果集 func (c *Client) GetPipeResult(database, collection string, pipeline []M, result *[]M) error { if connErr != nil { return connErr } session := c.session.Copy() defer func() { session.Close() }() conn := session.DB(database).C(collection) return conn.Pipe(pipeline).All(result) }
go
<gh_stars>0 { "name": "passport-local-dynamoose", "description": "Mongoose plugin that simplifies building username and password login with Passport", "version": "6.1.0", "main": "index.js", "repository": "saintedlama/passport-local-mongoose", "author": "<NAME> <<EMAIL>>", "license": "MIT", "keywords": [ "mongoose", "passport", "authentication", "login" ], "engines": { "node": ">= 8.0.0" }, "dependencies": { "generaterr": "^1.5.0", "passport-local": "^1.0.0", "scmp": "^2.1.0" }, "devDependencies": { "chai": "^4.3.4", "debug": "^4.3.2", "eslint": "^7.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^3.4.0", "mocha": "^9.0.1", "mocha-lcov-reporter": "^1.3.0", "nyc": "^15.1.0", "prettier": "^2.3.1", "standard-version": "^9.3.0" }, "scripts": { "test": "nyc --reporter=text-summary mocha --recursive --throw-deprecation", "test:ci": "nyc --reporter=lcov mocha --recursive --throw-deprecation", "lint": "eslint .", "lint:fix": "eslint . --fix", "release": "standard-version" } }
json
263 (60. 4 ov) 237 (52. 3 ov) 331/9 (50. 0 ov) 189 (43. 2 ov) Trent Boult said Ravindra Jadeja and MS Dhoni's partnership had his team concerned during their semifinal clash against India in Manchester. New Zealand head to Lord’s with a point to prove and believing they can achieve what they missed out on during the last World Cup. Williamson said their bowlers were successful in executing the plan of pitching the ball in the right areas. From 92/6, Jadeja and Dhoni batted out 17. 2 overs to bring India close to victory but it wasn't enough. With the victory, New Zealand have made it three wins from three games in the ICC World Cup 2019. Neesham joined Hadlee, Bond, Southee and Boult among New Zealand bowlers to take five-wicket hauls in a World Cup. Relive all the action from a thrilling finish at the Kennington Oval in London where New Zealand pulled off a thrilling two-wicket win over a fighting Bangladesh. Captain Kane Williamson and Taylor stitched together a 105-run partnership for the third wicket which turned out to be a match-defining one. Shakib, playing his 200th one-day international, was caught by wicketkeeper Tom Latham off the bowling of Colin de Grandhomme to leave his side on 151 for four in the 31st over. New Zealand mowed down Sri Lanka by 10 wickets by Bangladesh comprehensively defeated a beleaguered South Africa side.
english
// // Copyright 2016 <NAME> <EMAIL> // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // import { Keyboard, KeyCode } from "../util/keyboard"; import { Entity } from "./entities/entity"; import { Player } from "./entities/player"; import { Enemy } from "./entities/enemy"; import { Actor } from "../actors/actor"; import { ArenaActor } from "../actors/arena_actor"; import { CharacterActor } from "../actors/character_actor"; import { EnemyActor } from "../actors/enemy_actor"; import { MissileActor } from "../actors/missile_actor"; export class Game { //-------------------------------------------------------------------------- // Public members //-------------------------------------------------------------------------- // All of the drawable actors for the game public readonly actors: Actor[]; // The player's data object public readonly player: Player; // The enemy's data object public readonly enemy: Enemy; // All missile objects public readonly missiles: MissileActor[] = []; // Ground object public readonly ground: ArenaActor; public constructor(gl: WebGLRenderingContext, input: Keyboard) { this.gl = gl; let arenaActor = new ArenaActor(this.gl); let playerActor = new CharacterActor(this.gl); let enemyActor = new EnemyActor(this.gl); let missileCount = 10; for (let i = 0; i < missileCount; ++i) { this.missiles.push(new MissileActor(gl)); } this.player = new Player(playerActor, arenaActor); this.player.position[2] = -10; this.enemy = new Enemy(enemyActor, arenaActor, this.player, this.missiles); this.ground = arenaActor; this.actors = [ arenaActor, playerActor, enemyActor ]; this.actors = this.actors.concat(this.missiles); // Hook up player actions input.registerEvent(KeyCode.SPACE, () => this.player.jump()); } // Progresses the game state by one tick public tick(input: Keyboard) { this.time += 0.0166666; // Update the player's orientation this.player.orientMovement(this.enemy); // Move the player based on the current directional input let verticalInput = input.isKeyDown(KeyCode.UP) ? 1 : (input.isKeyDown(KeyCode.DOWN) ? -1 : 0); let horizontalInput = input.isKeyDown(KeyCode.LEFT) ? 1 : (input.isKeyDown(KeyCode.RIGHT) ? -1 : 0); this.player.setDirection(verticalInput, horizontalInput); this.player.tick(this.time); this.enemy.tick(this.time); } //-------------------------------------------------------------------------- // Private members //-------------------------------------------------------------------------- private readonly gl: WebGLRenderingContext; private time = 0; }
typescript
package brave.context.rxjava2; import brave.context.rxjava2.TraceContextSingle.Observer; import brave.propagation.CurrentTraceContext; import brave.propagation.CurrentTraceContext.Scope; import brave.propagation.TraceContext; import io.reactivex.Single; import io.reactivex.SingleObserver; import io.reactivex.SingleSource; import java.util.concurrent.Callable; final class TraceContextCallableSingle<T> extends Single<T> implements Callable<T> { final SingleSource<T> source; final CurrentTraceContext currentTraceContext; final TraceContext assemblyContext; TraceContextCallableSingle( SingleSource<T> source, CurrentTraceContext currentTraceContext, TraceContext assemblyContext) { this.source = source; this.currentTraceContext = currentTraceContext; this.assemblyContext = assemblyContext; } @Override protected void subscribeActual(SingleObserver<? super T> s) { try (Scope scope = currentTraceContext.maybeScope(assemblyContext)) { source.subscribe(new Observer<>(s, currentTraceContext, assemblyContext)); } } @SuppressWarnings("unchecked") @Override public T call() throws Exception { try (Scope scope = currentTraceContext.maybeScope(assemblyContext)) { return ((Callable<T>) source).call(); } } }
java
<reponame>pgfearo/monaco-editor-samples import * as monaco from 'monaco-editor'; export namespace xslThemeData { export const vsDark: monaco.editor.ITokenThemeRule[] = [ { token: 'attributeName', foreground: '#9CDCFE' }, { token: 'attributeEquals', foreground: '#808080' }, { token: 'attributeValue', foreground: '#ce9178' }, { token: 'xmlnsName', foreground: '#6A9955' }, { token: 'dtd', foreground: '#808080' }, { token: 'dtdEnd', foreground: '#808080' }, { token: 'elementName', foreground: '#4EC9B0' }, { token: 'elementValue', foreground: '#b5cea8' }, { token: 'processingInstrName', foreground: '#569cd6' }, { token: 'processingInstrValue', foreground: '#9CDCFE' }, { token: 'entityRef', foreground: '#DCDCAA' }, { token: 'xmlComment', foreground: '#6A9955' }, { token: 'xmlPunctuation', foreground: '#808080' }, { token: 'xslElementName', foreground: '#569cd6' }, { token: 'xmlText', foreground: '#b5cea8' }, // XPath tokens: { token: 'attributeNameTest', foreground: '#9CDCFE' }, { token: 'comment', foreground: '#6A9955' }, { token: 'number', foreground: '#b5cea8' }, { token: 'Unset', foreground: '#808080' }, { token: 'operator', foreground: '#d4d4d4' }, { token: 'variable', foreground: '#9CDCFE' }, { token: 'string', foreground: '#ce9178' }, { token: 'uriLiteral', foreground: '#569cd6' }, { token: 'nodeType', foreground: '#9CDCFE' }, { token: 'simpleType', foreground: '#9CDCFE' }, { token: 'axisName', foreground: '#d4d4d4' }, { token: 'nodeNameTest', foreground: '#4EC9B0' }, { token: 'functionNameTest', foreground: '#4EC9B0' }, { token: 'complexExpression', foreground: '#C586C0' }, { token: 'function', foreground: '#DCDCAA' }, { token: 'anonymousFunction', foreground: '#4FC1FF' }, { token: 'mapKey', foreground: '#C586C0' } ] }
typescript
{% extends "layout.html" %} {% block pageTitle %} Money, savings and investments - Pension Credit {% endblock %} {% block header %} {% include "includes/internal-header.html" %} {% endblock %} {% block content %} {% include "includes/js-back-link.html" %} <!----Headline----> <h1 class="govuk-heading-xl"> <span class="govuk-caption-m">Money, savings and investments</span> Bank current accounts summary<br> </h1> <!----Headline----> <form action="msic-bank-current-accounts-summary-router" method="post"> <h3 class="govuk-heading-m"> Accounts </h3> <br><br> {% set count = data["account-count"] or 0 %} {% for i in range(0, count) -%} <div class="govuk-grid-row"> <div class="govuk-grid-column-one-third"> <h3 class="govuk-heading-s"> {{ data["msic-bank-current-account-name-" + i] }} </h3> </div> <div class="govuk-grid-column-two-thirds"> {{ govukSummaryList({ rows: [ { key: { text: "Last four digits" }, value: { text: data['msic-bank-current-account-last-digits-' + i] }, actions: { items: [ { href: "msic-bank-current-account", text: "Change Remove", visuallyHiddenText: "XXX" } ] } }, { key: { text: "Total" }, value: { text: data['msic-bank-current-account-amount-' + i] | formatMoney }, actions: { items: [ { href: "msic-bank-current-account", text: "", visuallyHiddenText: "XXX" } ] } }, { key: { text: "Who's account?" }, value: { text: data['current-owner-' + i] }, actions: { items: [ { href: "msic-bank-current-account", text: "", visuallyHiddenText: "XXXX" } ] } }, { key: { text: "% stake in joint account" }, value: { text: data['msic-bank-current-account-stake-' + i] }, actions: { items: [ { href: "msic-bank-current-account-stake", text: "", visuallyHiddenText: "XXXX" } ] } } ] }) }} </div> </div> {%- endfor %} <!---------------------------------------------------------------------------------> <!----Break----> <div class="govuk-grid-row"> <div class="govuk-grid-column-full"> <hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible"> </div> </div> <!----Break----> <br><br> {{ govukRadios({ classes: "govuk-radios--inline", idPrefix: "add-another-current", name: "add-another-current", fieldset: { legend: { text: "Do you want to add another account?", isPageHeading: true, classes: "govuk-fieldset__legend--m" } }, hint: { text: "" }, items: [ { value: "yes", text: "Yes" }, { value: "no", text: "No" } ] }) }} {{ govukButton({ text: "Continue" }) }} <hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible"> <p class="govuk-body">Can't complete this page? <a href="task-list">Save and return later. (Mark as in-progress)</a></p> {% endblock %}
html
<filename>SensorKinect/Source/XnDDK/XnDDK.cpp /**************************************************************************** * * * PrimeSense Sensor 5.x Alpha * * Copyright (C) 2011 PrimeSense Ltd. * * * * This file is part of PrimeSense Sensor. * * * * PrimeSense Sensor is free software: you can redistribute it and/or modify* * it under the terms of the GNU Lesser General Public License as published * * by the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * PrimeSense Sensor is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>.* * * ****************************************************************************/ //--------------------------------------------------------------------------- // Includes //--------------------------------------------------------------------------- #include <XnDDK.h> #include <XnFormats/XnFormats.h> #include <XnOS.h> #include "XnDeviceManager.h" #include <XnUtils.h> // The following line is needed to be once in *ALL* of the high level shared library modules. DO NOT REMOVE!!! XN_API_EXPORT_INIT() //--------------------------------------------------------------------------- // Global Variables //--------------------------------------------------------------------------- static XnBool g_XnDDKWasInit = FALSE; //--------------------------------------------------------------------------- // Code //--------------------------------------------------------------------------- XN_DDK_API XnStatus XnDDKInit(const XnChar* strDevicesDir) { XnStatus nRetVal = XN_STATUS_OK; // Was the DDK subsystem already initialized? if (g_XnDDKWasInit == FALSE) { // Init the Formats library nRetVal = XnFormatsInit(); if (nRetVal != XN_STATUS_OK && nRetVal != XN_STATUS_ALREADY_INIT) return nRetVal; // Init DeviceManager nRetVal = XnDeviceManagerInit(strDevicesDir); XN_IS_STATUS_OK(nRetVal); g_XnDDKWasInit = TRUE; } else { // Trying to init twice... return (XN_STATUS_DDK_ALREADY_INIT); } // All is good... return (XN_STATUS_OK); } XN_DDK_API XnStatus XnDDKInitFromINIFile(const XnChar* cpINIFileName) { XnStatus nRetVal = XN_STATUS_OK; // Validate the input/output pointers (to make sure none of them is NULL) XN_VALIDATE_INPUT_PTR(cpINIFileName); // Was the DDK subsystem already initialized? if (g_XnDDKWasInit == FALSE) { // Init the Formats library nRetVal = XnFormatsInitFromINIFile(cpINIFileName); if (nRetVal != XN_STATUS_OK && nRetVal != XN_STATUS_ALREADY_INIT) return nRetVal; // read devices directory XnChar strDevicesDirectory[XN_INI_MAX_LEN] = ""; XnChar* pDir = NULL; if (XN_STATUS_OK == xnOSReadStringFromINI(cpINIFileName, "DDK", "DevicesDir", strDevicesDirectory, XN_INI_MAX_LEN)) { XN_VALIDATE_STR_APPEND(strDevicesDirectory, XN_FILE_DIR_SEP, XN_INI_MAX_LEN, nRetVal); pDir = strDevicesDirectory; } // Init DeviceManager nRetVal = XnDeviceManagerInit(pDir); if (nRetVal != XN_STATUS_OK && nRetVal != XN_STATUS_ALREADY_INIT) return nRetVal; g_XnDDKWasInit = TRUE; } else { // Trying to init twice... return (XN_STATUS_DDK_ALREADY_INIT); } // All is good... return (XN_STATUS_OK); } XN_DDK_API XnStatus XnDDKShutdown() { // Local function variables XnStatus nRetVal = XN_STATUS_OK; // Was the DDK subsystem initialized? if (g_XnDDKWasInit == TRUE) { // shutdown device manager nRetVal = XnDeviceManagerShutdown(); XN_IS_STATUS_OK(nRetVal); // shutdown the Formats library nRetVal = XnFormatsShutdown(); if (nRetVal != XN_STATUS_OK && nRetVal != XN_STATUS_FORMATS_NOT_INIT) return nRetVal; g_XnDDKWasInit = FALSE; } else { // Trying to shutdown without doing init... return (XN_STATUS_DDK_NOT_INIT); } // All is good... return (XN_STATUS_OK); } XnResolution OldResToOpenNIRes(XnResolutions res) { switch (res) { case XN_RESOLUTION_CUSTOM: return XN_RES_CUSTOM; case XN_RESOLUTION_QVGA: return XN_RES_QVGA; case XN_RESOLUTION_VGA: return XN_RES_VGA; case XN_RESOLUTION_SXGA: return XN_RES_SXGA; case XN_RESOLUTION_UXGA: return XN_RES_UXGA; case XN_RESOLUTION_QQVGA: return XN_RES_QQVGA; case XN_RESOLUTION_QCIF: return XN_RES_QCIF; case XN_RESOLUTION_240P: return XN_RES_240P; case XN_RESOLUTION_CIF: return XN_RES_CIF; case XN_RESOLUTION_WVGA: return XN_RES_WVGA; case XN_RESOLUTION_480P: return XN_RES_480P; case XN_RESOLUTION_800_448: return XN_RES_CUSTOM; case XN_RESOLUTION_SVGA: return XN_RES_SVGA; case XN_RESOLUTION_576P: return XN_RES_576P; case XN_RESOLUTION_DV: return XN_RES_DV; case XN_RESOLUTION_720P: return XN_RES_720P; case XN_RESOLUTION_1280_960: return XN_RES_CUSTOM; default: XN_ASSERT(FALSE); return XN_RES_CUSTOM; } } XnResolutions OpenNIResToOldRes(XnResolution res) { switch (res) { case XN_RES_CUSTOM: return XN_RESOLUTION_CUSTOM; case XN_RES_QQVGA: return XN_RESOLUTION_QQVGA; case XN_RES_CGA: return XN_RESOLUTION_CUSTOM; case XN_RES_QVGA: return XN_RESOLUTION_QVGA; case XN_RES_VGA: return XN_RESOLUTION_VGA; case XN_RES_SVGA: return XN_RESOLUTION_SVGA; case XN_RES_XGA: return XN_RESOLUTION_CUSTOM; case XN_RES_720P: return XN_RESOLUTION_720P; case XN_RES_SXGA: return XN_RESOLUTION_SXGA; case XN_RES_UXGA: return XN_RESOLUTION_UXGA; case XN_RES_1080P: return XN_RESOLUTION_CUSTOM; case XN_RES_QCIF: return XN_RESOLUTION_QCIF; case XN_RES_240P: return XN_RESOLUTION_240P; case XN_RES_CIF: return XN_RESOLUTION_CIF; case XN_RES_WVGA: return XN_RESOLUTION_WVGA; case XN_RES_480P: return XN_RESOLUTION_480P; case XN_RES_576P: return XN_RESOLUTION_576P; case XN_RES_DV: return XN_RESOLUTION_DV; default: XN_ASSERT(FALSE); return XN_RESOLUTION_CUSTOM; } } XN_DDK_API XnResolutions XnDDKGetResolutionFromXY(XnUInt32 nXRes, XnUInt32 nYRes) { // check if this is a known OpenNI resolution XnResolution res = xnResolutionGetFromXYRes(nXRes, nYRes); if (res == XN_RES_CUSTOM) { // check if this is one of our special resolutions if (nXRes == 800 && nYRes == 448) { return XN_RESOLUTION_800_448; } else if (nXRes == 1280 && nYRes == 960) { return XN_RESOLUTION_1280_960; } } return OpenNIResToOldRes(res); } XN_DDK_API XnBool XnDDKGetXYFromResolution(XnResolutions res, XnUInt32* pnXRes, XnUInt32* pnYRes) { // check if this is a known OpenNI resolution XnResolution openRes = OldResToOpenNIRes(res); if (openRes == XN_RES_CUSTOM) { // check if this is one of our special resolutions if (res == XN_RESOLUTION_800_448) { *pnXRes = 800; *pnYRes = 448; return TRUE; } else if (res == XN_RESOLUTION_1280_960) { *pnXRes = 1280; *pnYRes = 960; return TRUE; } else { return FALSE; } } else { *pnXRes = xnResolutionGetXRes(openRes); *pnYRes = xnResolutionGetYRes(openRes); return TRUE; } } XN_DDK_API const XnChar* XnDDKGetResolutionName(XnResolutions res) { // check if this is a known OpenNI resolution XnResolution openRes = OldResToOpenNIRes(res); if (openRes == XN_RES_CUSTOM) { // check if this is one of our special resolutions if (res == XN_RESOLUTION_800_448) { return "800x448"; } else if (res == XN_RESOLUTION_1280_960) { return "1280x960"; } else { return "Custom"; } } else { return xnResolutionGetName(openRes); } }
cpp
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.solr.analysis.author; import monty.solr.util.MontySolrQueryTestCase; import monty.solr.util.MontySolrSetup; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.DisjunctionMaxQuery; import org.apache.lucene.search.PrefixQuery; import org.apache.lucene.search.Query; import org.apache.lucene.search.WildcardQuery; import org.apache.lucene.search.spans.SpanPositionRangeQuery; import org.apache.solr.common.params.CommonParams; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.search.QParser; import org.junit.BeforeClass; import java.io.File; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Formatter; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.adsabs.solr.AdsConfig.F; /** * * Tests for all the author_ types defined in schema.xml * See: * http://labs.adsabs.harvard.edu/trac/ads-invenio/ticket/131 * http://labs.adsabs.harvard.edu/trac/ads-invenio/ticket/156 * * I would like to see a token processing which is crazier... * * IMPORTANT: this unittest was reviewed on 11-12-2012 by Alberto * and he found 1 (in words "ONE") problem, everything else was * fine. The problem is easily fixable, right now the * "synonym-upgrade" considers only names with initials for * expansion. Ie. * * "jones, c" =&gt; jones, christine; forman, c; forman, christine * * But Alberto wants that any short form produces the same effect, * ie. * * "jones," =&gt; jones, christine; forman, c; forman, christine * "jones, c" =&gt; jones, christine; forman, c; forman, christine * * 12-12-2012: Finished (I told Alberto, but we didn't review it again) * */ public class TestAdsabsTypeAuthorParsing extends MontySolrQueryTestCase { private String author_field = "author"; @BeforeClass public static void beforeClass() throws Exception { makeResourcesVisible(Thread.currentThread().getContextClassLoader(), new String[] { MontySolrSetup.getMontySolrHome() + "/contrib/examples/adsabs/server/solr/collection1/conf", MontySolrSetup.getSolrHome() + "/example/solr/collection1" }); System.setProperty("solr.allow.unsafe.resourceloading", "true"); schemaString = getSchemaFile(); configString = MontySolrSetup.getMontySolrHome() + "/contrib/examples/adsabs/server/solr/collection1/conf/solrconfig.xml"; initCore(configString, schemaString, MontySolrSetup.getSolrHome() + "/example/solr"); } public static String getSchemaFile() { /* * Make a copy of the schema.xml, and create our own synonym translation rules */ String schemaConfig = MontySolrSetup.getMontySolrHome() + "/contrib/examples/adsabs/server/solr/collection1/conf/schema.xml"; File newConfig; try { // hand-curated synonyms File curatedSynonyms = createTempFile(new String[]{ "ABBOT, <NAME>;ABBOTT, <NAME>", "<NAME>, A;BAKRY, A", "ACHUTBHAN, P;ACHUTHAN, P", "ADAMUT, I A;ADAMUTI, <NAME>", "ADJABSCHIRZADEH, A;ADJABSHIRZADEH, A", "<NAME>;AGGARWAL, S", "<NAME>;AGUILAR, <NAME>", "<NAME> A;AITMUKHAMBETOV, A A", "<NAME>, Y M; <NAME>", "ALEXEENKO, V V;ALEXEYENKO, V V", "<NAME>;ALFONSO-GARZON, JULIA", "<NAME>;ALLEN, R LYNNE;<NAME>;<NAME>", // until here copied from: /proj/ads/abstracts/config/author.syn.new "<NAME>, A;ARAGON-SALAMANCA, A;ARAGON, A;SALAMANCA, A", // copied from: /proj/ads/abstracts/config/author.syn "ADAMŠuk, m; ADAMGuk, m;ADAMČuk, m", // hand-made additions "<NAME>;<NAME>", "<NAME>;MÜLLER, BILL", "<NAME>;FORMAN, CHRISTINE", // the famous post-synonym expansion "DE ZEEUW, TIM=>DE ZEEUW, P TIM", "DE ZEEUW, P TIM=>DE ZEEUW, TIM;DE ZEEUW,", "grant, carolyn s; stern grant, carolyn; stern, carolyn p", "orlitova, ivana; stoklasova, ivana", "orlitova,; stoklasova," }); // automatically harvested variations of author names (collected during indexing) // it will be enriched by the indexing File generatedTransliterations = createTempFile(formatSynonyms(new String[]{ "wyrzykowsky, l=>wyrzykowski, l;wyrzykowski, ł", "ADAMCHuk, m => ADAMČuk, m", "ADAMCuk, m => ADAMČuk, m", "ADAMCZuk, m => ADAMČuk, m", //"ADAMCHuk, m K=> ADAMČuk, m K", => deactivated for test purposes, see <surname>, <1> <2> use case //"ADAMCuk, m K=> ADAMČuk, m K", => deactivated for test purposes, see <surname>, <1> <2> use case "ADAMCUK, A B=> ADAMČUK, A B", "ADAMCHUK, A B=> ADAMČUK, A B", "ADAMCZUK, A B=> ADAMČUK, A B", "ADAMCHuk, mOLJA => ADAMČuk, mOLJA", "ADAMCuk, mOLJA => ADAMČuk, mOLJA", "ADAMCZuk, mOLJA => ADAMČuk, mOLJA", "ADAMCHuk, mOLJA K=> ADAMČuk, mOLJA K", "ADAMCuk, mOLJA K=> ADAMČuk, mOLJA K", "ADAMCZuk, mOLJA K=> ADAMČuk, mOLJA K", "ADAMCHUK, => ADAMČUK,", "ADAMCUK,=> ADAMČUK,", "ADAMCZUK, => ADAMČUK,", // this one is added by hand (no automated transliteration) "<NAME> => MÜLLER, WILLIAM", "MUELLER, WILLIAM => MÜLLER, WILLIAM", "Boser,=>Böser,", "Boser, S=>Böser, S", "<NAME>,=><NAME>,", "<NAME>, E=>G<NAME>, E", "<NAME>, E=><NAME>, E", "Chyelkovae,=>Chýlková,", "stoklasova,=>stoklasová,", "orlitova,=>orlitová," } )); File newSchema = duplicateModify(new File(schemaConfig), "synonyms=\"author_curated.synonyms\"", "synonyms=\"" + curatedSynonyms.getAbsolutePath().replace('\\', '/') + "\"", "synonyms=\"author_generated.translit\"", "synonyms=\"" + generatedTransliterations.getAbsolutePath().replace('\\', '/') + "\"" ); return newSchema.getAbsolutePath(); } catch (IOException e) { e.printStackTrace(); throw new IllegalStateException(e.getMessage()); } } @Override public void setUp() throws Exception { super.setUp(); assertU(adoc(F.ID, "1", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamčuk,")); assertU(adoc(F.ID, "2", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamčuk, M.")); assertU(adoc(F.ID, "3", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamčuk, Marel")); assertU(adoc(F.ID, "4", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamčuk, Molja")); assertU(adoc(F.ID, "5", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamčuk, <NAME>")); assertU(adoc(F.ID, "6", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamčuk, <NAME>")); assertU(adoc(F.ID, "7", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamčuk, <NAME>")); assertU(adoc(F.ID, "8", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "9", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "10", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "11", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "20", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamcuk,")); assertU(adoc(F.ID, "21", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>.")); assertU(adoc(F.ID, "22", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "23", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "24", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamcuk, <NAME>")); assertU(adoc(F.ID, "25", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamcuk, <NAME>")); assertU(adoc(F.ID, "26", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "27", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "28", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamcuk, <NAME>")); assertU(adoc(F.ID, "29", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamcuk, <NAME>")); assertU(adoc(F.ID, "30", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "40", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamchuk,")); assertU(adoc(F.ID, "41", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>.")); assertU(adoc(F.ID, "42", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "43", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "44", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamchuk, <NAME>")); assertU(adoc(F.ID, "45", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamchuk, <NAME>")); assertU(adoc(F.ID, "46", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamchuk, <NAME>")); assertU(adoc(F.ID, "47", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamchuk, <NAME>")); assertU(adoc(F.ID, "48", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamchuk, <NAME>")); assertU(adoc(F.ID, "49", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "50", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "60", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamguk,")); assertU(adoc(F.ID, "61", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>.")); assertU(adoc(F.ID, "62", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "63", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "64", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "65", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "66", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "67", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "68", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "69", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "70", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "80", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamshuk,")); assertU(adoc(F.ID, "81", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>.")); assertU(adoc(F.ID, "82", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "83", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "84", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamshuk, <NAME>")); assertU(adoc(F.ID, "85", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamshuk, <NAME>")); assertU(adoc(F.ID, "86", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "87", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "88", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamshuk, <NAME>")); assertU(adoc(F.ID, "89", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Adamshuk, <NAME>")); assertU(adoc(F.ID, "90", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "100", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "101", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "110", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "111", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "112", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "113", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "114", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "115", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "116", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "117", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); //"<NAME>;<NAME>;<NAME>;<NAME>" assertU(adoc(F.ID, "120", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "121", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "122", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "123", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "124", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "125", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "126", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "127", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "130", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Author, A", F.AUTHOR, "Author, B", F.AUTHOR, "Author, C" )); assertU(adoc(F.ID, "200", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "201", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "202", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "203", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "210", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Pinilla-Alonso")); // just surname assertU(adoc(F.ID, "211", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Pinilla-Alonso,")); assertU(adoc(F.ID, "212", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Pinilla-Alonso, B")); assertU(adoc(F.ID, "213", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "214", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "215", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Pinilla-Alonso, Amer")); assertU(adoc(F.ID, "220", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "221", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>,")); assertU(adoc(F.ID, "222", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "223", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>, Hector")); assertU(adoc(F.ID, "224", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "225", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "230", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Böser", "first_author", "<NAME>")); assertU(adoc(F.ID, "231", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "232", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "233", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Boser,")); assertU(adoc(F.ID, "300", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Gopal-Krishna,")); assertU(adoc(F.ID, "301", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "302", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "400", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "401", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "402", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>. -S.")); assertU(adoc(F.ID, "403", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>.")); assertU(adoc(F.ID, "404", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "405", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>.")); assertU(adoc(F.ID, "406", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>.")); assertU(adoc(F.ID, "407", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "408", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "409", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "500", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "501", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>, E")); assertU(adoc(F.ID, "502", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "503", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "González-Alfonso, E")); assertU(adoc(F.ID, "504", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "505", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "506", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "507", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "508", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(adoc(F.ID, "600", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "Foo, Bar|Other, Name|" + '\u8349', F.AUTHOR, "Baz, Baz|\\u8349")); // 草 assertU(adoc(F.ID, "601", F.BIBCODE, "xxxxxxxxxxxxx", F.AUTHOR, "<NAME>")); assertU(commit()); //dumpDoc(null, "id", "author"); // persist the transliteration map after new docs were indexed // and reload synonym chain harvested during indexing Analyzer iAnalyzer = h.getCore().getLatestSchema().getIndexAnalyzer(); Analyzer qAnalyzer = h.getCore().getLatestSchema().getQueryAnalyzer(); TokenStream iAuthor = iAnalyzer.tokenStream("author", new StringReader("")); TokenStream qAuthor = qAnalyzer.tokenStream("author", new StringReader("")); iAuthor.close(); qAuthor.close(); // TODO: force reload of the synonym map //h.getCoreContainer().reload("collection1"); } public void xtestX() throws Exception { String expected = "author:adamčuk, molja k | author:adamčuk, molja k* " + "author:adamčuk, m k | author:adamčuk, m k* " + "author:adamčuk, molja " + // ! | author:adamčuk, molja * "author:adamčuk, m " + // ! | author:adamčuk, m* "author:adamčuk, " + "author:adamcuk, molja k | author:adamcuk, molja k* " + "author:adamcuk, m k | author:adamcuk, m k* " + "author:adamcuk, molja " + // ! | author:adamcuk, molja * "author:adamcuk, m " + // ! | author:adamcuk, m* "author:adamcuk, " + "author:adamchuk, molja k | author:adamchuk, molja k* " + "author:adamchuk, m k | author:adamchuk, m k* " + "author:adamchuk, molja " + // ! | author:adamchuk, molja * "author:adamchuk, m " + // ! | author:adamchuk, m* "author:adamchuk,"; testAuthorQuery("\"adamczuk, molja k\"", expected + " | author:adamczuk, molja k | author:adamczuk, molja k* | author:adamczuk, m k | author:adamczuk, m k* | author:adamczuk, molja | author:adamczuk, m | author:adamczuk,", "//*[@numFound='21']"); } public void testAuthorParsingUseCases() throws Exception { assertQueryEquals(req("q", "author:\"van dok*, h\""), "author:van dok*, h", WildcardQuery.class); assertQ(req("q", "author:\"van dok*, h\""), "//*[@numFound='1']", "//doc/int[@name='recid'][.='222']" ); assertQueryEquals(req("q", "author:\"^acco*\""), "spanPosRange(SpanMultiTermQueryWrapper(author:acco*), 0, 1)", SpanPositionRangeQuery.class); assertQueryEquals(req("q", "author:acco*"), "author:acco*", WildcardQuery.class); assertQueryEquals(req("q", "author:Adamč*"), "author:adamč*", WildcardQuery.class); testAuthorQuery("Adamč*", "adamč*", "//*[@numFound='11']"); // multiple synonyms in the file are separated with semicolon testAuthorQuery("\"wyrzykowsky, l\"", "wyrzykowski, | wyrzykowski, l | wyrzykowski, l* | wyrzykowski, ł | wyrzykowski, ł* | wyrzykowskii, | wyrzykowskii, l | wyrzykowskii, l* | wyrzykowskii, ł | wyrzykowskii, ł* | wyrzykowskij, | wyrzykowskij, l | wyrzykowskij, l* | wyrzykowskij, ł | wyrzykowskij, ł* | wyrzykowskiy, | wyrzykowskiy, l | wyrzykowskiy, l* | wyrzykowskiy, ł | wyrzykowskiy, ł* | wyrzykowsky, | wyrzykowsky, l | wyrzykowsky, l* | wyrzykowsky, ł | wyrzykowsky, ł* | wyrzykowskyi, | wyrzykowskyi, l | wyrzykowskyi, l* | wyrzykowskyi, ł | wyrzykowskyi, ł*", "//*[@numFound='1']"); // multiple names testAuthorQuery("\"other, name\"", "author:other, name | author:other, name * | author:other, n | author:other, n * | author:other,", "//*[@numFound='1']"); testAuthorQuery("\u8349", "author:cao,* | author: cao, | author:\u8349, | author:\u8349,*", // | author:草, | author:草,* "//*[@numFound='1']"); testAuthorQuery("\"baz, baz\"", "author:baz, baz | author:baz, baz * | author:baz, b | author:baz, b * | author:baz,", "//*[@numFound='1']"); // should not find anything, even though the names are there indexed next to each other assertQ(req("q", "author:\"foo, * other, *\""), "//*[@numFound='0']" ); assertQ(req("q", "author:\"foo, *\""), "//*[@numFound='1']", "//doc/int[@name='recid'][.='600']" ); assertQ(req("q", "author:\"other, *\""), "//*[@numFound='1']", "//doc/int[@name='recid'][.='600']" ); // 6-length author names; and in the second case of 'hillary' we should not allow m[^ ]* h[^ ]* d.* // but only m[^ ]* hillary d.* testAuthorQuery("\"<NAME>, <NAME>.\"", "author:<NAME>, m h d | author:<NAME>, m h d* | author:/<NAME>, m[^ ]*/ | author:/<NAME>, m[^ ]* h[^ ]*/ | author:/<NAME>, m[^ ]* h[^ ]* d.*/ | author:<NAME>, m | author:<NAME>,", "//*[@numFound='0']"); testAuthorQuery("\"<NAME>, <NAME>.\"", "author:<NAME>, m hillary d | author:<NAME>, m hillary d* | author:/<NAME>, m[^ ]*/ | author:/<NAME>, m[^ ]* hillary d.*/ | author:<NAME>, m h d | author:<NAME>, m h d* | author:/<NAME>, m[^ ]* h d.*/ | author:<NAME>, m | author:<NAME>,", "//*[@numFound='0']"); // stoklasova == orlitova == orlitová == stoklasová; it should produce the same query // wrong output (missing is "orlitová, *") // | author:stoklasova, | author:orlitova, ivana | author:stoklasova, i | author:stoklasova, ivana | author:orlitova, i | author:stoklasova,* | author:stoklasová, | author:stoklasová,* | author:stoklasovae, | author:stoklasovae,*", // expected: // | author:orlitova, | author:stoklasová,* | author:orlitova, ivana | author:orlitova, ivana * | author:stoklasova, i | author:stoklasova, i * | author:stoklasova, ivana | author:stoklasova, ivana * | author:orlitova, i | author:orlitova, i * | author:orlitova,* | author:stoklasova, | author:stoklasova,* | author:orlitová, | author:orlitová,* | author:orlitovae, | author:orlitovae,* | author:stoklasová, | author:stoklasovae, | author:stoklasovae,* // TODO: optimize the query, remove the clauses that match the doc twice testAuthorQuery("\"stoklasova\"", "author:orlitova, | author:stoklasová, | author:orlitova, ivana | author:stoklasova, i | author:stoklasova, ivana | author:orlitova, i | author:orlitova,* | author:stoklasova, | author:stoklasova,* | author:orlitová, | author:orlitová,* | author:orlitovae, | author:orlitovae,* | author:stoklasová,* | author:stoklasovae, | author:stoklasovae,*", "//*[@numFound='0']"); testAuthorQuery("\"orlitova\"", "author:orlitova, | author:stoklasová, | author:orlitova, ivana | author:stoklasova, i | author:stoklasova, ivana | author:orlitova, i | author:orlitova,* | author:stoklasova, | author:stoklasova,* | author:orlitová, | author:orlitová,* | author:orlitovae, | author:orlitovae,* | author:stoklasová,* | author:stoklasovae, | author:stoklasovae,*", "//*[@numFound='0']"); testAuthorQuery("\"orlitová\"", "author:orlitova, | author:stoklasová, | author:orlitova, ivana | author:stoklasova, i | author:stoklasova, ivana | author:orlitova, i | author:orlitova,* | author:stoklasova, | author:stoklasova,* | author:orlitová, | author:orlitová,* | author:orlitovae, | author:orlitovae,* | author:stoklasová,* | author:stoklasovae, | author:stoklasovae,*", "//*[@numFound='0']"); testAuthorQuery("\"stoklasová\"", "author:orlitova, | author:stoklasová, | author:orlitova, ivana | author:stoklasova, i | author:stoklasova, ivana | author:orlitova, i | author:orlitova,* | author:stoklasova, | author:stoklasova,* | author:orlitová, | author:orlitová,* | author:orlitovae, | author:orlitovae,* | author:stoklasová,* | author:stoklasovae, | author:stoklasovae,*", "//*[@numFound='0']"); // searching for ascii version finds also the utf (for hyphenated names) testAuthorQuery("\"chyelkovae\"", "author:chyelkovae, | author:chyelkovae,* | author:chýlková, | author:chýlková,* | author:chylkova, | author:chylkova,*", "//*[@numFound='0']"); testAuthorQuery("\"Gonzalez-Alfonso, E\"", "author:<NAME>, e | author:<NAME>, e* | author:<NAME>, | author:<NAME>, e | author:<NAME>, e* | author:<NAME>, | author:<NAME>, e | author:<NAME>, e* | author:<NAME>,", "//*[@numFound='6']"); testAuthorQuery("\"<NAME>, E\"", "author:<NAME>, e | author:<NAME>, e* | author:<NAME>, | author:<NAME>, e | author:<NAME>, e* | author:<NAME>, | author:<NAME>, e | author:<NAME>, e* | author:<NAME>,", "//*[@numFound='6']"); // issue #57: https://github.com/romanchyla/montysolr/issues/57 testAuthorQuery("\"<NAME>\"", "author:moon, dae sik | author:moon, dae sik * | author:moon, d sik | author:moon, d sik * | author:moon, dae s | author:moon, dae s * | author:moon, d s | author:moon, d s * | author:moon, dae | author:moon, d | author:moon,", "//*[@numFound='10']"); /** * will miss: Moon, Dae-Sik; Moon, Dae -Sik * * ie where both parts are fully spelled; but it will find 'dae, s' and 'd sik' * this logic seems defficient * */ testAuthorQuery("\"Moon, D. -S.\"", //"author:moon, d s | author:moon, d s* | author:/moon, d[^ ]* s/ | author:/moon, d[^ ]* s .*/ | author:moon, d | author:moon,", "author:moon, d s | author:moon, d s* | author:/moon, d[^ ]*/ | author:/moon, d[^ ]* s.*/ | author:moon, d | author:moon,", "//*[@numFound='10']"); // test the definition that is in the live synonym file // we use this for blackbox - to verify deployment is using // synonym translation testAuthorQuery( "\"grant, carolyn s\"", "author:grant, carolyn s " + "author:grant, carolyn s* " + "author:grant, c s " + "author:grant, c s* " + "author:grant, carolyn " + "author:grant, c " + "author:grant, " + "author:<NAME>, carolyn " + "author:<NAME>, c " + "author:<NAME>, " + "author:stern, carolyn p " + "author:stern, carolyn p* " + "author:stern, c p " + "author:stern, c p* " + "author:stern, carolyn " + "author:stern, c " + "author:stern,", "//*[@numFound='0']" ); testAuthorQuery( "Gopal-Krishna", "author:<NAME>, | author:<NAME>,*", "//*[@numFound='3']", "\"Gopal Krishna,\"", "author:<NAME>, | author:<NAME>,*", "//*[@numFound='3']", "\"<NAME>\"", "author:<NAME>, | author:<NAME>,* | author:krishna, gopal | author:krishna, gopal * | author:krishna, g | author:krishna, g * | author:krishna, | author:krishna,*", "//*[@numFound='3']" ); //#487 - these author names should parse the same; Maestro, V was // picked by the python name parser (V removed); Boyjian had problems // with expansion (python name parser was not applied there) testAuthorQuery( "Maestro\\,\\ V", "author:maestro, v | author:maestro, v* | author:maestro,", "//*[@numFound='0']", "V\\ Maestro", "author:v maestro, | author:v maestro,* | author:maestro, v | author:maestro, v* | author:maestro, v * | author:maestro, | author:maestro,*", //"author:maestro, v | author:maestro, v* | author:maestro,", "//*[@numFound='0']" ); testAuthorQuery( "Boyajian\\,\\ T", "author:boyajian, t | author:boyajian, t* | author:boyajian,", "//*[@numFound='0']", "T\\ Boyajian", "author:t boyajian, | author:t boyajian,* | author:boyajian, t | author:boyajian, t* | author:boyajian, t * | author:boyajian, | author:boyajian,*", "//*[@numFound='0']" ); // first is considered a title (but when the only thing we have, it will be searched as surname) testAuthorQuery( "first", "author:first, | author:first,*", "//*[@numFound='0']" ); testAuthorQuery( "goodman", "author:goodman, | author:goodman,*", "//*[@numFound='0']" ); // 'xxx' will be removed from the author (at least in the modified version) assertQueryEquals(req("defType", "aqp", "q", "author:\"accomazzi, alberto, xxx.\""), "author:accomazzi, alberto, xxx | author:accomazzi, alberto, xxx * | author:accomazzi, alberto | author:accomazzi, alberto * | author:accomazzi, a xxx | author:accomazzi, a xxx * | author:accomazzi, alberto, x | author:accomazzi, alberto, x * | author:accomazzi, a x | author:accomazzi, a x * | author:accomazzi, alberto, | author:accomazzi, alberto, * | author:accomazzi, a | author:accomazzi, a * | author:accomazzi,", DisjunctionMaxQuery.class); // #362 - smartly handle o' sulliva (done in the Pythonic name parser) // I'm not sure whether we should index the apostrophe, maybe it should // be replaced by space ? testAuthorQuery( "\"o' sullivan\"", "author:o sullivan, | author:o sullivan,*", "//*[@numFound='0']", "\"o'sullivan\"", "author:o sullivan, | author:o sullivan,*", "//*[@numFound='0']", "\"o' sullivan, ji\"", "author:o sullivan, ji | author:o sullivan, ji * | author:o sullivan, j | author:o sullivan, j * | author:o sullivan,", "//*[@numFound='0']" ); // funny author names testAuthorQuery( "\"o'sullivan\"", "author:o sullivan, | author:o sullivan,*", "//*[@numFound='0']", "\"o' sullivan\"", "author:o sullivan, | author:o sullivan,*", "//*[@numFound='0']" ); testAuthorQuery( "Dall\\'oglio", "author:<NAME>lio, | author:dall oglio,*", "//*[@numFound='0']", "Antonella\\ Dall\\'Oglio", "author:<NAME>, | author:<NAME> oglio,* | author:dall oglio, antonella | author:dall oglio, antonella * | author:dall oglio, a | author:dall oglio, a * | author:dall oglio, | author:dall oglio,*", "//*[@numFound='0']" ); testAuthorQuery( "\"t' Hooft, Sullivan\"", "author:t hooft, sullivan | author:t hooft, sullivan * | author:t hooft, s | author:t hooft, s * | author:t hooft,", "//*[@numFound='0']" ); // hmmm.. these regexes must be slow; we should not generate them // also, before #487, the first query would generate: //"author:kao, p ing tzu | author:kao, p ing tzu * | author:kao, p i tzu | author:kao, p i tzu * | author:kao, p ing t | author:kao, p ing t * | author:kao, p i t | author:kao, p i t * | author:kao, p | author:kao,", testAuthorQuery( "\"P'ING-TZU KAO\"", "author:p ing tzu kao, " + "author:p ing tzu kao,* " + "author:kao, p ing tzu " + "author:kao, p ing tzu * " + "author:/kao, p[^ ]*/ " + "author:/kao, p[^ ]* ing tzu/ " + "author:/kao, p[^ ]* ing tzu .*/ " + "author:kao, p i tzu " + "author:kao, p i tzu * " + "author:/kao, p[^ ]* i tzu/ " + "author:/kao, p[^ ]* i tzu .*/ " + "author:kao, p ing t " + "author:kao, p ing t * " + "author:/kao, p[^ ]* ing t/ " + "author:/kao, p[^ ]* ing t .*/ " + "author:kao, p i t " + "author:kao, p i t * " + "author:/kao, p[^ ]* i t/ " + "author:/kao, p[^ ]* i t .*/ " + "author:kao, p " + "author:kao, p * " + "author:kao, " + "author:kao,*", "//*[@numFound='0']" ); testAuthorQuery( "\"Kao, P'ing-Tzu\"", "author:kao, p ing tzu " + "author:kao, p ing tzu * " + "author:/kao, p[^ ]*/ " + "author:/kao, p[^ ]* ing tzu/ " + "author:/kao, p[^ ]* ing tzu .*/ " + "author:kao, p i tzu " + "author:kao, p i tzu * " + "author:/kao, p[^ ]* i tzu/ " + "author:/kao, p[^ ]* i tzu .*/ " + "author:kao, p ing t " + "author:kao, p ing t * " + "author:/kao, p[^ ]* ing t/ " + "author:/kao, p[^ ]* ing t .*/ " + "author:kao, p i t " + "author:kao, p i t * " + "author:/kao, p[^ ]* i t/ " + "author:/kao, p[^ ]* i t .*/ " + "author:kao, p | author:kao,", "//*[@numFound='0']" ); // what happens we receive very long string (non-author thing) testAuthorQuery( "\"purpose of this review is to bridge the gap between\"", "MatchNoDocsQuery(\"\")", "//*[@numFound='0']" ); // making sure also other fields are being parsed properly author_field = "first_author"; testAuthorQuery( "\"<NAME>\"", "first_author:boser, s | first_author:boser, s* | first_author:boser, | first_author:böser, s | first_author:böser, s* | first_author:böser, | first_author:boeser, s | first_author:boeser, s* | first_author:boeser,", "//*[@numFound='1']"); //setDebug(true); testAuthorQuery( "\"<NAME>\"", "first_author:böser, s | first_author:böser, s* | first_author:böser, | first_author:boeser, s | first_author:boeser, s* | first_author:boeser, | first_author:boser, s | first_author:boser, s* | first_author:boser,", "//*[@numFound='1']" ); // back to the standard: author author_field = "author"; testAuthorQuery( "\"<NAME>\"", "author:böser, s | author:böser, s* | author:böser, | author:boeser, s | author:boeser, s* | author:boeser, | author:boser, s | author:boser, s* | author:boser,", "//*[@numFound='4']", "\"Böser, S\"", "author:böser, s | author:böser, s* | author:böser, | author:boeser, s | author:boeser, s* | author:boeser, | author:boser, s | author:boser, s* | author:boser,", "//*[@numFound='4']" ); // reported by Alex // [author:"<NAME>" bibstem:"Natur" | author:"Conroy" ] // doesn't return any results, even though it should yield 2010Natur.468..940V. testAuthorQuery( "\"<NAME>\"", "author:<NAME>, | author:<NAME>,*", "//*[@numFound='6']", // "<NAME>" numFound=6 // 220 <NAME> 221 <NAME>, 222 <NAME>, H // 223 <NAME>, Hector 224 <NAME>, Hiatus 225 <NAME>, Romulus "\"<NAME>,\"", "author:<NAME>, | author:<NAME>,*", "//*[@numFound='6']", // "<NAME>," numFound=6 // 220 <NAME> 221 <NAME>, 222 <NAME>, H // 223 <NAME>, Hector 224 <NAME>, Hiatus 225 <NAME>, Romulus "\"<NAME>\"", "author:<NAME>, h | author:<NAME>, h* | author:<NAME>,", "//*[@numFound='5']", // "<NAME>, H" numFound=5 // 220 <NAME> 221 <NAME>, 222 <NAME>, H // 223 <NAME>, Hector 224 <NAME>, Hiatus "\"<NAME>.\"", "author:<NAME>, h | author:<NAME>, h* | author:<NAME>,", "//*[@numFound='5']", // "<NAME>." numFound=5 // 220 <NAME> 221 <NAME>, 222 <NAME> // 223 <NAME> 224 <NAME>, Hiatus "\"<NAME>\"", "author:<NAME>, romulus | author:<NAME>, romulus * | author:<NAME>, r | author:<NAME>, r * | author:<NAME>,", "//*[@numFound='3']" // "<NAME>" numFound=3 // 220 <NAME> 221 <NAME>, 225 <NAME> ); //bug #324 testAuthorQuery( "Pinilla-Alonso", "author:<NAME>, | author:<NAME>,*", "//*[@numFound='6']", // Pinilla-Alonso numFound=6 // 210 Pinilla-Alonso 211 Pinilla-Alonso, 212 Pinilla-Alonso, B // 213 Pinilla-Alonso, Brava 214 Pinilla-Alonso, Borat 215 Pinilla-Alonso, Amer "\"<NAME>\"", "author:pinilla alonso, | author:<NAME>,* | author:alonso, pinilla | author:alonso, pinilla * | author:alonso, p | author:alonso, p * | author:alonso, | author:alonso,*", "//*[@numFound='6']", // Pinilla-Alonso numFound=6 // 210 Pinilla-Alonso 211 Pinilla-Alonso, 212 Pinilla-Alonso, B // 213 Pinilla-Alonso, Brava 214 Pinilla-Alonso, Borat 215 Pinilla-Alonso, Amer "\"Pinilla Alonso,\"", "author:<NAME>, | author:<NAME>so,*", "//*[@numFound='6']", // Pinilla-Alonso numFound=6 // 210 Pinilla-Alonso 211 Pinilla-Alonso, 212 Pinilla-Alonso, B // 213 Pinilla-Alonso, Brava 214 Pinilla-Alonso, Borat 215 Pinilla-Alonso, Amer "\"Pinilla-Alonso, B\"", "author:<NAME>, b | author:<NAME>, b* | author:<NAME>,", "//*[@numFound='5']", // Pinilla-Alonso numFound=6 // 210 Pinilla-Alonso 211 Pinilla-Alonso, 212 Pinilla-Alonso, B // 213 Pinilla-Alonso, Brava 214 Pinilla-Alonso, Borat "\"Pinilla Alonso, B.\"", "author:<NAME>, b | author:<NAME>, b* | author:<NAME>,", "//*[@numFound='5']", // Pinilla-Alonso numFound=6 // 210 Pinilla-Alonso 211 Pinilla-Alonso, 212 Pinilla-Alonso, B // 213 Pinilla-Alonso, Brava 214 Pinilla-Alonso, Borat "\"Pinilla-Alonso, Brava\"", "author:pin<NAME>, brava | author:pinilla alonso, brava * | author:pinilla alonso, b | author:pinilla alonso, b * | author:pinilla alonso,", "//*[@numFound='4']" // Pinilla-Alonso, Brava numFound=4 // 210 Pinilla-Alonso 211 Pinilla-Alonso, 212 Pinilla-Alonso, B // 213 Pinilla-Alonso, Brava ); // bug: #255 testAuthorQuery( "\"Lee, H-C\"", "author:lee, h c | author:lee, h c* | author:/lee, h[^ ]*/ | author:/lee, h[^ ]* c.*/ | author:lee, h | author:lee,", "//*[@numFound='4']", // Lee, H-C numFound=4 // 200 Lee, H C 201 Lee, H-C 202 Lee, Harwin-C // 203 Lee, Harwin-Costa "\"Lee, H C\"", "author:lee, h c | author:lee, h c* | author:/lee, h[^ ]*/ | author:/lee, h[^ ]* c.*/ | author:lee, h | author:lee,", "//*[@numFound='4']", // "Lee, H-C" numFound=4 // 200 Lee, H C 201 Lee, H-C 202 Lee, Harwin-C // 203 Lee, Harwin-Costa "\"Lee, Harwin C\"", "author:lee, harwin c | author:lee, harwin c* | author:lee, h c | author:lee, h c* | author:lee, harwin | author:lee, h | author:lee,", "//*[@numFound='4']", // Lee, Harwin C numFound=4 // 200 Lee, H C 201 Lee, H-C 202 Lee, Harwin-C // 203 Lee, Harwin-Costa "\"Lee, Harwin-*\"", "author:lee, harwin-*", "//*[@numFound='0']", // Lee, Harwin-* numFound=0 "\"Lee, Harwin*\"", "author:lee, harwin*", "//*[@numFound='2']", // Lee, Harwin* numFound=2 // 202 Lee, Harwin-C 203 Lee, Harwin-Costa "\"Lee, H*\"", "author:lee, h | author:lee, h* | author:lee,", "//*[@numFound='4']" // Lee, Harwin-C numFound=4 // 200 Lee, H C 201 Lee, H-C 202 Lee, Harwin-C // 203 Lee, Harwin-Costa ); // test proper order of authors - ticket: #98 //System.out.println(h.query(req("q", String.format("%s:130", F.ID)))); assertQ(req("q", String.format("%s:130", F.ID), "fl", "author"), "//*[@numFound='1']"); assert h.query(req("q", String.format("%s:130", F.ID), "indent", "false")) .contains("<arr name=\"author\"><str>Author, A</str><str>Author, B</str><str>Author, C</str></arr>"); } public void testAuthorParsingMainLogic() throws Exception { /** * For ADS there are these rules: * What gets indexed: Normalized author name (always lowercase!) * What gets searched: By default, the author name is * * example: <NAME> * * 1. normalized (sztaufczik, piotr) * 2. enriched with name variants (sztaufczik, pjotr) * 3. enriched with synonyms (konrad, pjotr) * * The different tokenizer chains serve for situations, when we want * to search for the author name but DE-activate some of the steps * above. The NORMALIZATION happens ALWAYS (because we index things * that way). Combinations are: * * author_exact = 1 + 3 * author_nosyn = 1 + 2 * author_exact_nosyn = 1 * * * As a general rule, the ADS is trying to get more rather than less. * Here are the examples: * * <pre> * query: expanded into: * =============================================================== * * kurtz, <NAME> -> kurtz, <NAME> * kurtz, <NAME> * * kurtz, michael j * kurtz, <NAME> * * kurtz, m j * kurtz, m j * * kurtz, m julian * kurtz, m julian * * kurtz, michael (<- libation to gods of recall) * kurtz, m (<- dtto) * kurtz, (<- libation #2) * * kurtz, michael j -> kurtz, michael j* * kurtz, michael j * * kurtz, m j* * kurtz, * kurtz, michael * kurtz, m * * kurtz, m julian -> kurtz, m julian * kurtz, m julian * * kurtz, m j * * kurtz, m j * kurtz, m * kurtz, * kurtz, m\w* julian (<- happens only for one-letter initials) * kurtz, m\w* julian .* (dtto) * kurtz, m\w* j (dtto) * kurtz, m\w* j .* (dtto) * * kurtz, michael -> kurtz, michael * kurtz, michael * * kurtz, m * kurtz, m * * kurtz, * * kurtz, m -> kurtz, m * kurtz, m* (in fact, these two can become just: kurtz, m*) * kurtz, * * kurtz, mi* -> kurtz, mi* * kurtz, * * * * </pre> */ /* * ============================================================ * Here comes the bloodiest part of the author parsing unittest * ============================================================ * * Each test case has two branches, one representing the full utf-8 form (with ascii chars), the other the ascii downgraded form. No matter which, the query must be expanded in both cases equally for each testcase Test-cases: <surname> <surname>, <surname>, <1> <surname>, <1name> <surname>, <1name> <2> <surname>, <1name> <2name> <surname>, <1> <2name> <surname>, <1> <2> <surname>, <2> <surname>, <2name> <surname>, <2name> <1> <surname>, <2name> <1name> <surname>, <2> <1name> <surname>, <2> <1> <surname>, <1n*> <surname>, <1*> <surname>, <2n*> <surname>, <2*> - transliteration: adamčuk, m --> adamchuk, m;adamcuk, m - synonym expansion for: ADAMŠuk, m;ADAMGuk, m;ADAMČuk, m */ //testAuthorQuery("\"<NAME>\"", "xxx", "//*[@numFound='']"); String expected; String expected0; expected = "author:adamčuk, | author:adamčuk,* " + // query variants added by parser "| author:adamchuk, | author:adamchuk,* " + "| author:adamcuk, | author:adamcuk,*"; /** * <surname> * * upgraded && transliterated * synonym adamšuk IS NOT FOUND because there is no entry for "adam(č|c|ch)uk" the syn list */ testAuthorQuery( //"adAMčuk" "adAM\u010duk", expected + " | author:adamguk, m | author:adamčuk, m | author:adamšuk, m", "//*[@numFound='34']" // adamčuk numFound=34 // 1 Adamčuk, 2 <NAME>. 3 Adamčuk, Marel // 4 <NAME> 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> // 7 Adamčuk, <NAME> 8 Adamčuk, <NAME> 9 Adamčuk, <NAME> // 10 Adamčuk, <NAME> 11 <NAME> 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 Adamcuk, Molja // 24 Adamcuk, <NAME> 25 Adamcuk, <NAME> 26 Adamcuk, <NAME> // 27 Adamcuk, <NAME> 28 Adamcuk, <NAME> 29 Adamcuk, <NAME> // 30 Adamcuk, <NAME> 40 Adamchuk, 41 <NAME>. // 42 Adamchuk, Marel 43 Adamchuk, Molja 44 Adamchuk, <NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, <NAME> 47 Adamchuk, M K // 48 Adamchuk, <NAME> 49 Adamchuk, <NAME> 50 Adamchuk, K Molja // 61 <NAME>. ); testAuthorQuery( "adAMcuk", expected, "//*[@numFound='33']" // adamcuk numFound=33 // 1 Adamčuk, 2 <NAME>. 3 <NAME> // 4 Adamčuk, Molja 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> // 7 Adamčuk, <NAME> 8 Adamčuk, <NAME> 9 Adamčuk, <NAME> // 10 Adamčuk, <NAME> 11 <NAME> 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 <NAME> // 24 Adamcuk, <NAME> 25 Adamcuk, <NAME> 26 Adamcuk, <NAME> // 27 Adamcuk, <NAME> 28 Adamcuk, <NAME> 29 Adamcuk, <NAME> // 30 Adamcuk, <NAME> 40 Adamchuk, 41 <NAME>. // 42 Adamchuk, Marel 43 <NAME> 44 Adamchuk, <NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, <NAME> 47 Adamchuk, M K // 48 Adamchuk, <NAME> 49 Adamchuk, <NAME> 50 Adamchuk, <NAME> ); testAuthorQuery( "adAMchuk", expected , "//*[@numFound='33']" // adamchuk numFound=33 // 1 Adamčuk, 2 <NAME>. 3 <NAME> // 4 Adamčuk, Molja 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> // 7 Adamčuk, <NAME> 8 Adamčuk, M K 9 Adamčuk, <NAME> // 10 Adamčuk, <NAME> 11 Adamčuk, <NAME> 20 Adamcuk, // 21 <NAME>. 22 Adamcuk, Marel 23 Adamcuk, Molja // 24 Adamcuk, <NAME> 25 Adamcuk, <NAME> 26 Adamcuk, <NAME> // 27 Adamcuk, <NAME> 28 Adamcuk, <NAME> 29 Adamcuk, <NAME> // 30 Adamcuk, <NAME> 40 Adamchuk, 41 <NAME>. // 42 Adamchuk, Marel 43 <NAME> 44 Adamchuk, <NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, <NAME> 47 Adamchuk, <NAME> // 48 Adamchuk, <NAME> 49 Adamchuk, <NAME> 50 Adamchuk, <NAME> ); testAuthorQuery( "adAMczuk", expected + " | author:adamczuk, | author:adamczuk,*", "//*[@numFound='33']" // adamczuk numFound=33 // 1 Adamčuk, 2 <NAME>. 3 Adamčuk, Marel // 4 Adamčuk, Molja 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> // 7 Adamčuk, <NAME> 8 Adamčuk, <NAME> 9 Adamčuk, <NAME> // 10 Adamčuk, <NAME> 11 <NAME> 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 Adamcuk, Molja // 24 Adamcuk, <NAME> 25 Adamcuk, <NAME> 26 Adamcuk, <NAME> // 27 Adamcuk, <NAME> 28 Adamcuk, <NAME> 29 Adamcuk, <NAME> // 30 Adamcuk, <NAME> 40 Adamchuk, 41 <NAME>. // 42 Adamchuk, Marel 43 <NAME> 44 Adamchuk, <NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, <NAME> 47 Adamchuk, <NAME> // 48 Adamchuk, <NAME> 49 Adamchuk, <NAME> 50 <NAME> ); testAuthorQuery( //"adAMšuk" "adAM\u0161uk", "author:adamšuk, | author:adamšuk,* " + "| author:adamshuk, | author:adamshuk,* " + "| author:adamsuk, | author:adamsuk,* " + "| author:adamguk, m | author:adamčuk, m | author:adamšuk, m", "//*[@numFound='13']" // adamšuk numFound=13 // 2 <NAME>. 61 <NAME>. 80 Adamshuk, // 81 <NAME>. 82 <NAME> 83 <NAME> // 84 Adamshuk, <NAME> 85 Adamshuk, <NAME> 86 Adamshuk, <NAME> // 87 Adamshuk, <NAME> 88 Adamshuk, <NAME> 89 Adamshuk, <NAME> // 90 Adamshuk, <NAME> ); testAuthorQuery( "adAMguk", "(author:adamguk, | author:adamguk,* " + "| author:adamguk, m | author:adamčuk, m | author:adamšuk, m)", "//*[@numFound='12']" // adamguk numFound=12 // 2 <NAME>. 60 Adamguk, 61 <NAME>. // 62 Adamguk, Marel 63 Adamguk, Molja 64 Adamguk, <NAME> // 65 Adamguk, <NAME> 66 Adamguk, Mol<NAME> 67 Adamguk, M K // 68 Adamguk, <NAME> 69 Adamguk, <NAME> 70 Adamguk, <NAME> ); /** * <surname>, * * upgraded && transliterated * synonym adamšuk IS NOT FOUND because there is no entry for "adam(č|c|ch)uk" the syn list */ testAuthorQuery( "\"adamčuk,\"", expected + " | author:adamguk, m | author:adamčuk, m | author:adamšuk, m", "//*[@numFound='34']", // adamčuk numFound=34 // 1 Adamčuk, 2 <NAME>. 3 Adamčuk, Marel // 4 <NAME> 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> // 7 Adamčuk, <NAME> 8 Adamčuk, <NAME> 9 Adamčuk, <NAME> // 10 Adamčuk, <NAME> 11 <NAME> 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 <NAME> // 24 Adamcuk, <NAME> 25 Adamcuk, <NAME> 26 Adamcuk, Molja K // 27 Adamcuk, <NAME> 28 Adamcuk, <NAME> 29 Adamcuk, K<NAME> // 30 Adamcuk, <NAME> 40 Adamchuk, 41 Adamchuk, M. // 42 Adamchuk, Marel 43 Adamchuk, Molja 44 Adamchuk, Mol<NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, Molja K 47 Adamchuk, M K // 48 Adamchuk, <NAME> 49 Adamchuk, <NAME> 50 Adamchuk, <NAME> // 61 <NAME>. "\"adamcuk,\"", expected, "//*[@numFound='33']", // adamcuk numFound=33 // 1 Adamčuk, 2 <NAME>. 3 <NAME> // 4 Adamčuk, Molja 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> // 7 Adamčuk, <NAME> 8 Adamčuk, M K 9 Adamčuk, <NAME> // 10 Adamčuk, <NAME> 11 <NAME> 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 Adamcuk, Molja // 24 Adamcuk, <NAME> 25 Adamcuk, <NAME> 26 Adamcuk, <NAME> // 27 Adamcuk, <NAME> 28 Adamcuk, <NAME> 29 Adamcuk, <NAME> // 30 Adamcuk, <NAME> 40 Adamchuk, 41 <NAME>. // 42 Adamchuk, Marel 43 Adamchuk, Molja 44 Adamchuk, Mol<NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, Mol<NAME> 47 Adamchuk, M K // 48 Adamchuk, <NAME> 49 Adamchuk, <NAME> 50 Adamchuk, <NAME> "\"adamchuk,\"", expected, "//*[@numFound='33']", // adamchuk numFound=33 // 1 Adamčuk, 2 <NAME>. 3 Adamčuk, Marel // 4 <NAME> 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> // 7 Adamčuk, <NAME> 8 Adamčuk, <NAME> 9 Adamčuk, <NAME> // 10 Adamčuk, <NAME> 11 <NAME> 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 <NAME> // 24 Adamcuk, <NAME> 25 Adamcuk, <NAME> 26 Adamcuk, Mol<NAME> // 27 Adamcuk, <NAME> 28 Adamcuk, <NAME> 29 Adamcuk, <NAME> // 30 Adamcuk, <NAME> 40 Adamchuk, 41 Adamchuk, M. // 42 Adamchuk, Marel 43 Adamchuk, Molja 44 Adamchuk, <NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, <NAME> 47 Adamchuk, M K // 48 Adamchuk, <NAME> 49 Adamchuk, <NAME> 50 <NAME> "\"adamczuk,\"", expected + "author:adamczuk, | author:adamczuk,*", "//*[@numFound='33']", // adamczuk numFound=33 // 1 Adamčuk, 2 <NAME>. 3 Adamčuk, Marel // 4 Adamčuk, Molja 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> // 7 Adamčuk, <NAME> 8 Adamčuk, M K 9 Adamčuk, Karel Molja // 10 Adamčuk, <NAME> 11 Adamčuk, K Molja 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 Adamcuk, Molja // 24 Adamcuk, <NAME> 25 Adamcuk, <NAME> 26 Adamcuk, <NAME> // 27 Adamcuk, <NAME> 28 Adamcuk, <NAME> 29 Adamcuk, <NAME> // 30 Adamcuk, <NAME> 40 Adamchuk, 41 <NAME>. // 42 Adamchuk, Marel 43 Adamchuk, Molja 44 Adamchuk, Mol<NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, Mol<NAME> 47 Adamchuk, M K // 48 Adamchuk, <NAME> 49 Adamchuk, <NAME> 50 Adamchuk, K Molja "\"adamšuk,\"", "author:adamšuk, | author:adamšuk,* " + "author:adamshuk, | author:adamshuk,* " + "author:adamsuk, | author:adamsuk,* " + "author:adamguk, m | author:adamčuk, m | author:adamšuk, m", "//*[@numFound='13']", // adamšuk numFound=13 // 2 <NAME>. 61 <NAME>. 80 Adamshuk, // 81 <NAME>. 82 Adamshuk, Marel 83 Adamshuk, Molja // 84 Adamshuk, <NAME> 85 Adamshuk, M Karel 86 Adamshuk, Molja K // 87 Adamshuk, M K 88 Adamshuk, Karel Molja 89 Adamshuk, Karel M // 90 Adamshuk, K Molja "\"adamguk,\"", "author:adamguk, | author:adamguk,* " + "author:adamguk, m | author:adamčuk, m | author:adamšuk, m", "//*[@numFound='12']" // adamguk numFound=12 // 2 <NAME>. 60 Adamguk, 61 <NAME>. // 62 <NAME> 63 Adamguk, Molja 64 Adamguk, Mol<NAME> // 65 Adamguk, <NAME> 66 Adamguk, Molja K 67 Adamguk, M K // 68 Adamguk, <NAME> 69 Adamguk, K<NAME> 70 Adamguk, K Molja ); /** * <surname>, <1> * * expanded && upgraded && transliterated && expanded * synonym "adamšuk, m" IS FOUND because there is entry for "adamčuk, m" the syn list, notice * this works even if we type "adamchuk, m" or "adamcuk, m" * * question: the chain correctly finds the synonym "adamšuk, m", and this synonym is * then transliterated: adamshuk, m;adamsuk, m (is this desirable?) I think yes. */ expected = "author:adamšuk, m | author:adamšuk, m* | author:adamšuk, " + "| author:adamsuk, m | author:adamsuk, m* | author:adamsuk, " + "| author:adamshuk, m | author:adamshuk, m* | author:adamshuk, " + "| author:adamguk, m | author:adamguk, m* | author:adamguk, " + "| author:adamčuk, m | author:adamčuk, m* | author:adamčuk, " + "| author:adamchuk, m | author:adamchuk, m* | author:adamchuk, " + "| author:adamcuk, m | author:adamcuk, m* | author:adamcuk,"; testAuthorQuery( "\"adamčuk, m\"", expected, "//*[@numFound='40']", // "adamčuk, m" numFound=40 // 1 Adamčuk, 2 <NAME>. 3 <NAME> // 4 <NAME> 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> // 7 <NAME> 8 Adamčuk, M K 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 Adamcuk, Molja // 24 Adamcuk, <NAME> 25 <NAME> 26 Adamcuk, Molja K // 27 Adamcuk, M K 40 Adamchuk, 41 Adamchuk, M. // 42 <NAME> 43 Adamchuk, Molja 44 Adamchuk, <NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, Mol<NAME> 47 Adamchuk, M K // 60 Adamguk, 61 <NAME>. 62 Adamguk, Marel // 63 Adamguk, Molja 64 Adamguk, Mol<NAME> 65 Adamguk, <NAME> // 66 Adamguk, Molja K 67 Adamguk, M K 80 Adamshuk, // 81 <NAME>. 82 <NAME> 83 Adamshuk, Molja // 84 Adamshuk, Mol<NAME> 85 Adamshuk, <NAME> 86 Adamshuk, Molja K // 87 Adamshuk, M K "\"adamcuk, m\"", expected, "//*[@numFound='40']", // "adamcuk, m" numFound=40 // 1 Adamčuk, 2 <NAME>. 3 <NAME> // 4 <NAME> 5 <NAME> 6 Adamčuk, <NAME> // 7 Adamčuk, <NAME> 8 <NAME> 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 Adamcuk, Molja // 24 Adamcuk, <NAME> 25 <NAME> 26 Adamcuk, Mol<NAME> // 27 Adamcuk, M K 40 Adamchuk, 41 Adamchuk, M. // 42 <NAME> 43 Adamchuk, Molja 44 Adamchuk, Mol<NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, Mol<NAME> 47 Adamchuk, M K // 60 Adamguk, 61 <NAME>. 62 <NAME> // 63 <NAME> 64 Adamguk, <NAME> 65 Adamguk, M Karel // 66 Adamguk, Molja K 67 Adamguk, M K 80 Adamshuk, // 81 <NAME>. 82 Adamshuk, Marel 83 Adamshuk, Molja // 84 Adamshuk, <NAME> 85 Adamshuk, M Karel 86 Adamshuk, Molja K // 87 Adamshuk, M K "\"adamchuk, m\"", expected, "//*[@numFound='40']", // "adamchuk, m" numFound=40 // 1 Adamčuk, 2 <NAME>. 3 <NAME> // 4 <NAME> 5 <NAME> 6 Adamčuk, <NAME> // 7 Adamčuk, <NAME> 8 <NAME> 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 Adamcuk, Molja // 24 <NAME> 25 Adamcuk, <NAME> 26 Adamcuk, <NAME> // 27 Adamcuk, <NAME> 40 Adamchuk, 41 <NAME>. // 42 Adamchuk, Marel 43 Adamchuk, Molja 44 Adamchuk, Mol<NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, Mol<NAME> 47 Adamchuk, M K // 60 Adamguk, 61 <NAME>. 62 <NAME> // 63 Adamguk, Molja 64 <NAME> 65 Adamguk, M Karel // 66 Adamguk, <NAME> 67 Adamguk, M K 80 Adamshuk, // 81 <NAME>. 82 Adamshuk, Marel 83 Adamshuk, Molja // 84 Adamshuk, <NAME> 85 Adamshuk, <NAME> 86 Adamshuk, Molja K // 87 Adamshuk, M K "\"adamczuk, m\"", expected + "author:adamczuk, m | author:adamczuk, m* | author:adamczuk,", "//*[@numFound='40']", // "adamczuk, m" numFound=40 // 1 Adamčuk, 2 <NAME>. 3 <NAME> // 4 <NAME> 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> // 7 Adamčuk, <NAME> 8 Adamčuk, <NAME> 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 <NAME> // 24 Adamcuk, <NAME> 25 Adamcuk, <NAME> 26 Adamcuk, <NAME> // 27 Adamcuk, M K 40 Adamchuk, 41 <NAME>. // 42 <NAME> 43 <NAME> 44 Adamchuk, Mol<NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, <NAME> 47 Adamchuk, M K // 60 Adamguk, 61 <NAME>. 62 <NAME> // 63 <NAME> 64 <NAME> 65 Adamguk, <NAME> // 66 Adamguk, <NAME> 67 Adamguk, M K 80 Adamshuk, // 81 <NAME>. 82 Adamshuk, Marel 83 Adamshuk, Molja // 84 Adamshuk, <NAME> 85 Adamshuk, <NAME> 86 Adamshuk, Molja K // 87 Adamshuk, M K "\"adamšuk, m\"", expected, "//*[@numFound='40']", // "adamšuk, m" numFound=40 // 1 Adamčuk, 2 <NAME>. 3 <NAME> // 4 <NAME> 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> // 7 Adamčuk, <NAME> 8 <NAME> 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 <NAME> // 24 Adamcuk, <NAME> 25 <NAME> 26 Adamcuk, Mol<NAME> // 27 Adamcuk, <NAME> 40 Adamchuk, 41 <NAME>. // 42 <NAME> 43 <NAME> 44 Adamchuk, <NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, <NAME> 47 Adamchuk, M K // 60 Adamguk, 61 <NAME>. 62 <NAME> // 63 Adamguk, Molja 64 Adamguk, <NAME> 65 Adamguk, <NAME> // 66 Adamguk, <NAME> 67 Adamguk, <NAME> 80 Adamshuk, // 81 <NAME>. 82 <NAME> 83 Adamshuk, Molja // 84 Adamshuk, <NAME> 85 Adamshuk, <NAME> 86 Adamshuk, Molja K // 87 Adamshuk, M K "\"adamguk, m\"", expected, "//*[@numFound='40']", // "adamguk, m" numFound=40 // 1 Adamčuk, 2 <NAME>. 3 <NAME> // 4 <NAME> 5 <NAME> 6 <NAME> // 7 Adamčuk, <NAME> 8 <NAME> 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 <NAME> // 24 Adamcuk, <NAME> 25 <NAME> 26 <NAME> // 27 <NAME> 40 Adamchuk, 41 <NAME>. // 42 <NAME> 43 <NAME> 44 Adamchuk, <NAME> // 45 Adamchuk, <NAME> 46 <NAME> 47 Adamchuk, M K // 60 Adamguk, 61 <NAME>. 62 <NAME> // 63 <NAME> 64 <NAME> 65 Adamguk, <NAME> // 66 Adamguk, Mol<NAME> 67 Adamguk, <NAME> 80 Adamshuk, // 81 <NAME>. 82 Adamshuk, Marel 83 Adamshuk, Molja // 84 Adamshuk, <NAME> 85 Adamshuk, <NAME> 86 Adamshuk, <NAME> // 87 Adamshuk, <NAME> "\"AdAmČuk, m\"", expected, "//*[@numFound='40']", // just for fun "\"ADAMŠuk, m\"", expected, "//*[@numFound='40']", "\"AdAmGuk, M\"", expected, "//*[@numFound='40']" ); /** * <surname>, <1name> * * upgraded && transliterated && expanded * synonym "adamšuk, m" IS FOUND because of the query variation for "adamčuk, m" the syn list */ // base part, must be present in all expected0 = "author:adamčuk, m | author:adamčuk, m * | author:adamčuk, " + "author:adamcuk, m | author:adamcuk, m * | author:adamcuk, " + "author:adamchuk, m | author:adamchuk, m * | author:adamchuk, " + "author:adamšuk, m | author:adamšuk, m * | author:adamšuk, " + "author:adamsuk, m | author:adamsuk, m * | author:adamsuk, " + "author:adamshuk, m | author:adamshuk, m * | author:adamshuk, " + "author:adamguk, m | author:adamguk, m * | author:adamguk, "; expected = expected0 + "author:adamčuk, molja | author:adamčuk, molja * " + "author:adamchuk, molja | author:adamchuk, molja * " + "author:adamcuk, molja | author:adamcuk, molja *" ; testAuthorQuery( "\"adamčuk, molja\"", expected, "//*[@numFound='29']", // "adamčuk, molja" numFound=29 // 1 Adamčuk, 2 <NAME>. 4 Adamčuk, Molja // 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> 7 Adamčuk, Mol<NAME> // 8 Adamčuk, M K 20 Adamcuk, 21 Adamcuk, M. // 23 Adamcuk, Molja 24 <NAME> 25 Adamcuk, <NAME> // 26 Adamcuk, <NAME> 27 Adamcuk, M K 40 Adamchuk, // 41 <NAME>. 43 <NAME> 44 <NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, Mol<NAME> 47 Adamchuk, <NAME> // 60 Adamguk, 61 <NAME>. 65 <NAME> // 67 Adamguk, M K 80 Adamshuk, 81 <NAME>. // 85 Adamshuk, <NAME> 87 Adamshuk, <NAME> "\"adamcuk, molja\"", expected, "//*[@numFound='29']", // "adamcuk, molja" numFound=29 // 1 Adamčuk, 2 <NAME>. 4 <NAME> // 5 Adamčuk, <NAME> 6 <NAME> 7 Adamčuk, Mol<NAME> // 8 Adamčuk, <NAME> 20 Adamcuk, 21 <NAME>. // 23 Adamcuk, Molja 24 <NAME> 25 Adamcuk, M Karel // 26 Adamcuk, <NAME> 27 Adamcuk, M K 40 Adamchuk, // 41 <NAME>. 43 Adamchuk, Molja 44 Adamchuk, <NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, Mol<NAME> 47 Adamchuk, M K // 60 Adamguk, 61 <NAME>. 65 Adamguk, <NAME> // 67 Adamguk, M K 80 Adamshuk, 81 <NAME>. // 85 Adamshuk, <NAME> 87 Adamshuk, M K "\"adamchuk, molja\"", expected, "//*[@numFound='29']", // "adamchuk, molja" numFound=29 // 1 Adamčuk, 2 <NAME>. 4 <NAME> // 5 Adamčuk, <NAME> 6 <NAME> 7 Adamčuk, <NAME> // 8 Adamčuk, M K 20 Adamcuk, 21 <NAME>. // 23 <NAME> 24 <NAME> 25 Adamcuk, <NAME> // 26 Adamcuk, <NAME> 27 Adamcuk, M K 40 Adamchuk, // 41 <NAME>. 43 Adamchuk, Molja 44 Adamchuk, <NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, Mol<NAME> 47 Adamchuk, M K // 60 Adamguk, 61 <NAME>. 65 <NAME> // 67 Adamguk, M K 80 Adamshuk, 81 <NAME>. // 85 Adamshuk, M Karel 87 Adamshuk, M K "\"adamczuk, molja\"", expected + "author:adamczuk, molja | author:adamczuk, molja * | author:adamczuk, m | author:adamczuk, m * | author:adamczuk,", "//*[@numFound='29']", // "adamczuk, molja" numFound=29 // 1 Adamčuk, 2 <NAME>. 4 Adamčuk, Molja // 5 Adamčuk, <NAME> 6 <NAME> 7 Adamčuk, Molja K // 8 <NAME> 20 Adamcuk, 21 <NAME>. // 23 <NAME> 24 <NAME> 25 <NAME> // 26 Adamcuk, <NAME> 27 Adamcuk, <NAME> 40 Adamchuk, // 41 <NAME>. 43 Adamchuk, Molja 44 Adamchuk, Mol<NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, Mol<NAME> 47 Adamchuk, M K // 60 Adamguk, 61 <NAME>. 65 Adamguk, M Karel // 67 Adamguk, M K 80 Adamshuk, 81 <NAME>. // 85 <NAME> 87 Adamshuk, M K // "adamčuk, molja" is not there (and cannot be, because it is not in // synonym map, but synonym "adamšuk, m" is found correctly) "\"adamšuk, molja\"", expected0 + "author:adamšuk, molja | author:adamšuk, molja * " + "author:adamshuk, molja | author:adamshuk, molja * " + "author:adamsuk, molja | author:adamsuk, molja *", "//*[@numFound='23']", // shorter by two variants, because "adamguk, molja" is already ascii form // it doesn't generate: "author:adamshuk, molja | author:adamsuk, molja" // that is correct, because "adamšuk, m" is found and transliterated // "adamšuk, molja" simply isn't in any synonym list and we tehrefore cannot have it // "adamšuk, molja" numFound=23 // 1 Adamčuk, 2 <NAME>. 6 <NAME> // 8 <NAME> 20 Adamcuk, 21 <NAME>. // 25 <NAME> 27 Adamcuk, <NAME> 40 Adamchuk, // 41 <NAME>. 45 <NAME> 47 Adamchuk, M K // 60 Adamguk, 61 <NAME>. 65 Adamguk, <NAME> // 67 Adamguk, M K 80 Adamshuk, 81 <NAME>. // 83 <NAME> 84 Adamshuk, Molja Karel 85 Adamshuk, M Karel // 86 Adamshuk, Molja K 87 Adamshuk, M K "\"adamguk, molja\"", expected0 + "author:adamguk, molja | author:adamguk, molja *", "//*[@numFound='23']" // "adamguk, molja" numFound=23 // 1 Adamčuk, 2 <NAME>. 6 Adamčuk, <NAME> // 8 Adamčuk, M K 20 Adamcuk, 21 <NAME>. // 25 Adamcuk, <NAME> 27 Adamcuk, M K 40 Adamchuk, // 41 Adamchuk, M. 45 Adamchuk, <NAME> 47 Adamchuk, M K // 60 Adamguk, 61 Adamguk, M. 63 Adamguk, Molja // 64 Adamguk, Mol<NAME> 65 Adamguk, <NAME> 66 Adamguk, Molja K // 67 Adamguk, M K 80 Adamshuk, 81 <NAME>. // 85 Adamshuk, <NAME> 87 Adamshuk, <NAME> ); /** * <surname>, <1name> <2> * * upgraded && transliterated && expanded * synonym adamšuk IS NOT FOUND because there is no entry for "adamčuk, molja k" nor * there is any "adamčuk, m k" in the syn list * * NOTE: if you think that "adamšuk" should be found in our model, then you are wrong * because "adamcuk, m k" is a different name than "adamcuk, m" * We are not goign to do any magic to find the surname mapping, in other words: * we are not going to replace defficient synonym file. Because the correct translation * CAN WORK if "adamcuk, m k" and "adamcuk, m" are named as synonymous (see the example * case of "adamczuk, m k k") */ expected = "author:adamčuk, molja k | author:adamčuk, molja k* " + "author:adamčuk, m k | author:adamčuk, m k* " + "author:adamčuk, molja " + // ! | author:adamčuk, molja * "author:adamčuk, m " + // ! | author:adamčuk, m* "author:adamčuk, " + "author:adamcuk, molja k | author:adamcuk, molja k* " + "author:adamcuk, m k | author:adamcuk, m k* " + "author:adamcuk, molja " + // ! | author:adamcuk, molja * "author:adamcuk, m " + // ! | author:adamcuk, m* "author:adamcuk, " + "author:adamchuk, molja k | author:adamchuk, molja k* " + "author:adamchuk, m k | author:adamchuk, m k* " + "author:adamchuk, molja " + // ! | author:adamchuk, molja * "author:adamchuk, m " + // ! | author:adamchuk, m* "author:adamchuk,"; testAuthorQuery( "\"adamčuk, molja k\"", expected, "//*[@numFound='21']", // "adamčuk, molja k" numFound=21 // 1 Adamčuk, 2 <NAME>. 4 Adamčuk, Molja // 5 Adamčuk, <NAME> 6 <NAME> 7 Adamčuk, Molja K // 8 Adamčuk, M K 20 Adamcuk, 21 <NAME>. // 23 Adamcuk, Molja 24 Adamcuk, Molja Karel 25 Adamcuk, M Karel // 26 Adamcuk, Molja K 27 Adamcuk, M K 40 Adamchuk, // 41 <NAME>. 43 Adamchuk, Molja 44 Adamchuk, Molja Karel // 45 Adamchuk, <NAME> 46 Adamchuk, Mol<NAME> 47 Adamchuk, M K "\"adamcuk, molja k\"", expected, "//*[@numFound='21']", // "adamcuk, molja k" numFound=21 // 1 Adamčuk, 2 <NAME>. 4 Adamčuk, Molja // 5 Adamčuk, <NAME> 6 <NAME> 7 Adamčuk, Molja K // 8 Adamčuk, M K 20 Adamcuk, 21 Adamcuk, M. // 23 Adamcuk, Molja 24 Adamcuk, <NAME> 25 Adamcuk, <NAME> // 26 Adamcuk, <NAME> 27 Adamcuk, M K 40 Adamchuk, // 41 <NAME>. 43 <NAME> 44 Adamchuk, <NAME> // 45 <NAME> 46 Adamchuk, <NAME> 47 Adamchuk, <NAME> "\"adamchuk, molja k\"", expected, "//*[@numFound='21']", // this contains 4 more entries because by default, the // transliteration produces only adam(c|ch)uk // "adamchuk, molja k" numFound=21 // 1 Adamčuk, 2 <NAME>. 4 <NAME> // 5 Adamčuk, <NAME> 6 <NAME> 7 Adamčuk, Mol<NAME> // 8 Adamčuk, M K 20 Adamcuk, 21 <NAME>. // 23 <NAME> 24 <NAME> 25 Adamcuk, <NAME> // 26 Adamcuk, <NAME> 27 Adamcuk, M K 40 Adamchuk, // 41 <NAME>. 43 Adamchuk, Molja 44 Adamchuk, Molja Karel // 45 Adamchuk, M Karel 46 Adamchuk, Molja K 47 Adamchuk, M K "\"adamczuk, molja k\"", expected + " | author:adamczuk, molja k | author:adamczuk, molja k* | author:adamczuk, m k | author:adamczuk, m k* | author:adamczuk, molja | author:adamczuk, m | author:adamczuk,", "//*[@numFound='21']", // "adamczuk, molja k" numFound=21 // 1 Adamčuk, 2 <NAME>. 4 Adamčuk, Molja // 5 Adamčuk, <NAME> 6 <NAME> 7 Adamčuk, Molja K // 8 Adamčuk, <NAME> 20 Adamcuk, 21 <NAME>. // 23 <NAME> 24 <NAME> 25 Adamcuk, M Karel // 26 Adamcuk, Mol<NAME> 27 Adamcuk, M K 40 Adamchuk, // 41 <NAME>. 43 Adamchuk, Molja 44 Adamchuk, Molja Karel // 45 Adamchuk, <NAME> 46 Adamchuk, Molja K 47 Adamchuk, M K "\"adamšuk, molja k\"", "author:adamšuk, molja k | author:adamšuk, molja k* " + "author:adamšuk, m k | author:adamšuk, m k* " + "author:adamšuk, molja " + "author:adamšuk, m " + "author:adamšuk, " + "author:adamsuk, molja k | author:adamsuk, molja k* " + "author:adamsuk, m k | author:adamsuk, m k* " + "author:adamsuk, molja " + "author:adamsuk, m " + "author:adamsuk, " + "author:adamshuk, molja k | author:adamshuk, molja k* " + "author:adamshuk, m k | author:adamshuk, m k* " + "author:adamshuk, molja " + "author:adamshuk, m " + "author:adamshuk,", "//*[@numFound='7']", // "adamšuk, molja k" numFound=7 // 80 Adamshuk, 81 <NAME>. 83 Adamshuk, Molja // 84 Adamshuk, Molja Karel 85 Adamshuk, M Karel 86 Adamshuk, Molja K // 87 Adamshuk, M K "\"adamguk, molja k\"", "author:adamguk, molja k | author:adamguk, molja k* " + "author:adamguk, m k | author:adamguk, m k* " + "author:adamguk, molja " + "author:adamguk, m " + "author:adamguk,", "//*[@numFound='7']" // "adamguk, molja k" numFound=7 // 60 Adamguk, 61 <NAME>. 63 Adamguk, Molja // 64 Adamguk, Molja Karel 65 Adamguk, M Karel 66 Adamguk, Molja K // 67 Adamguk, M K ); /** * <surname>, <1name> <2name> * * It works as above with the addition that the VARIATIONS of the initials/full names * are produced, ie. Aaaa B Ccccc will produce * Aaaa B C * A B C, A B Cccc * Aaaa B Cccc * * And through these variations, we find the upgraded form "adamčuk, molja k" * * This has the benefit of us finding the combination of name/initials even if * we didn't encounter them during indexing. HOWEVER, to avoid false hits these * combinations are found only for names that have certain number of parts, * default >= 3 */ // we expect the same results as above (the difference is in the "..., k k *") // plus whathever comes out of the original input transliteration/combination expected0 = "author:adamčuk, molja k | author:adamčuk, molja k * " + "author:adamčuk, m k | author:adamčuk, m k * " + "author:adamčuk, molja " + // <- in my opinion this is wrong (too much recall), but it was requested "author:adamčuk, m " + "author:adamčuk, " + "author:adamcuk, molja k | author:adamcuk, molja k * " + "author:adamcuk, m k | author:adamcuk, m k * " + "author:adamcuk, molja " + // dtto "author:adamcuk, m " + "author:adamcuk, " + "author:adamchuk, molja k | author:adamchuk, molja k * " + "author:adamchuk, m k | author:adamchuk, m k * " + "author:adamchuk, molja " + //dtto "author:adamchuk, m " + "author:adamchuk,"; //dumpDoc(null, "id", "author"); testAuthorQuery( "\"adamčuk, molja karel\"", expected0 + " " + "author:adamčuk, molja karel | author:adamčuk, molja karel * " + "author:adamčuk, m karel | author:adamčuk, m karel * " + "author:adamchuk, molja karel | author:adamchuk, molja karel * " + "author:adamchuk, m karel | author:adamchuk, m karel * " + "author:adamcuk, molja karel | author:adamcuk, molja karel * " + "author:adamcuk, m karel | author:adamcuk, m karel *", "//*[@numFound='21']", // "adamčuk, molja karel" numFound=21 // 1 Adamčuk, 2 <NAME>. 4 Adamčuk, Molja // 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> 7 Adamčuk, Molja K // 8 Adamčuk, M K 20 Adamcuk, 21 <NAME>. // 23 <NAME> 24 <NAME> 25 Adamcuk, <NAME> // 26 Adamcuk, <NAME> 27 Adamcuk, M K 40 Adamchuk, // 41 <NAME>. 43 <NAME> 44 Adamchuk, Mol<NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, Molja K 47 Adamchuk, M K "\"adamcuk, molja karel\"", expected0 + " " + "author:adamcuk, molja karel | author:adamcuk, molja karel * " + "author:adamcuk, m karel | author:adamcuk, m karel *", "//*[@numFound='17']", // because adamcuk, m\w* k\w* is not searched // "adamcuk, molja karel" numFound=17 // 1 Adamčuk, 2 <NAME>. 4 <NAME> // 7 Adamčuk, <NAME> 8 Adamčuk, M K 20 Adamcuk, // 21 <NAME>. 23 Adamcuk, Molja 24 Adamcuk, Molja Karel // 25 Adamcuk, M Karel 26 Adamcuk, Molja K 27 Adamcuk, M K // 40 Adamchuk, 41 <NAME>. 43 Adamchuk, Molja // 46 Adamchuk, Molja K 47 Adamchuk, M K "\"adamchuk, molja karel\"", expected0 + " " + "author:adamchuk, <NAME> | author:adamchuk, molja karel * " + "author:adamchuk, m karel | author:adamchuk, m karel *", "//*[@numFound='17']", // "adamchuk, molja karel" numFound=17 // 1 Adamčuk, 2 <NAME>. 4 Adamčuk, Molja // 7 Adamčuk, Molja K 8 Adamčuk, M K 20 Adamcuk, // 21 <NAME>. 23 Adamcuk, Molja 26 Adamcuk, Molja K // 27 Adamcuk, M K 40 Adamchuk, 41 Adamchuk, M. // 43 Adamchuk, Molja 44 Adamchuk, Molja Karel 45 Adamchuk, M Karel // 46 Adamchuk, Molja K 47 Adamchuk, M K "\"adamczuk, molja karel\"", expected0 + " " + "author:adamczuk, molja karel | author:adamczuk, molja karel * " + "author:adamczuk, m karel | author:adamczuk, m karel * " + "author:adamczuk, molja k | author:adamczuk, molja k * " + "author:adamczuk, m k | author:adamczuk, m k * " + "author:adamczuk, molja | author:adamczuk, m " + "author:adamczuk,", "//*[@numFound='15']",//-3 because "č"->"cz" normally doesn't exist // "adamczuk, molja karel" numFound=15 // 1 Adamčuk, 2 <NAME>. 4 Adamčuk, Molja // 7 Adamčuk, Molja K 8 Adamčuk, M K 20 Adamcuk, // 21 <NAME>. 23 Adamcuk, Molja 26 Adamcuk, Molja K // 27 Adamcuk, M K 40 Adamchuk, 41 <NAME>. // 43 <NAME> 46 Adamchuk, Molja K 47 Adamchuk, M K // almost exactly the same as above, the only difference must be the space before * "\"adamšuk, molja karel\"", "author:adamšuk, molja k | author:adamšuk, molja k * " + "author:adamšuk, m k | author:adamšuk, m k * " + "author:adamšuk, molja " + "author:adamšuk, m " + "author:adamšuk, " + "author:adamsuk, molja k | author:adamsuk, molja k * " + "author:adamsuk, m k | author:adamsuk, m k * " + "author:adamsuk, molja " + "author:adamsuk, m " + "author:adamsuk, " + "author:adamshuk, molja k | author:adamshuk, molja k * " + "author:adamshuk, m k | author:adamshuk, m k * " + "author:adamshuk, molja " + "author:adamshuk, m " + "author:adamshuk, " + // plus variants with karel "author:adamšuk, molja karel | author:adamšuk, molja karel * " + "author:adamšuk, m karel | author:adamšuk, m karel * " + "author:adamshuk, molja karel | author:adamshuk, molja karel * " + "author:adamshuk, m karel | author:adamshuk, m karel * " + "author:adamsuk, molja karel | author:adamsuk, molja karel * " + "author:adamsuk, m karel | author:adamsuk, m karel *", "//*[@numFound='7']", // "adamšuk, molja karel" numFound=7 // 80 Adamshuk, 81 <NAME>. 83 Adamshuk, Molja // 84 Adamshuk, Molja Karel 85 Adamshuk, M Karel 86 Adamshuk, Molja K // 87 Adamshuk, M K "\"adamguk, molja karel\"", "author:adamguk, molja k | author:adamguk, molja k * " + "author:adamguk, m k | author:adamguk, m k * " + "author:adamguk, molja " + "author:adamguk, m " + "author:adamguk, " + // plus variants with karel "author:adamguk, molja karel | author:adamguk, molja karel * " + "author:adamguk, m karel | author:adamguk, m karel *", "//*[@numFound='7']" // "adamguk, molja karel" numFound=7 // 60 Adamguk, 61 <NAME>. 63 Adamguk, Molja // 64 Adamguk, Molja Karel 65 Adamguk, <NAME> 66 Adamguk, <NAME> // 67 Adamguk, <NAME> ); /* * TODO: * * Also make sure we test that the expanding algorithm doesn't have unwanted consequences * and doesn't include too much, ie. that search for "adamčuk, mos" doesn't get * transformed into "adam(c|ch)uk, m" */ //TODO: show that the translation works properly when the synonym is in the synonym list // ie "adamčuk, m k;adamšuk, m k" /** * <surname>, <1> <2name> * * Speciality of this patter is that we want to search for regular * expression * * <surname>, <1>\w* <2> * <surname>, <1>\w* <2name> * * The following expansion will not find the synonyms and will not find * the upgrade. I am listing this example here specifically to show what * happens when the synonym list is missing some values (in real life, * the correct mapping will be generated IFF we encounter one of these * during indexing: * * adamčuk, m karel * adamčuk, mxxxx karel * * */ //dumpDoc(null, "id", "author"); testAuthorQuery( "\"adamčuk, <NAME>\"", "author:adamčuk, m karel | author:adamčuk, m karel * " + "author:/adamčuk, m[^ ]*/ " + "author:adamčuk, m k | author:adamčuk, m k * " + "author:adamčuk, m " + "author:adamčuk, " + "author:adamcuk, m karel | author:adamcuk, m karel * " + "author:adamcuk, m k | author:adamcuk, m k * " + "author:adamcuk, m " + "author:adamcuk, " + "author:adamchuk, m karel | author:adamchuk, m karel * " + "author:adamchuk, m k | author:adamchuk, m k * " + "author:adamchuk, m " + "author:adamchuk, " + "author:/adamčuk, m[^ ]* karel/ " + "author:/adamčuk, m[^ ]* karel .*/ " + "author:/adamčuk, m[^ ]* k/ " + "author:/adamčuk, m[^ ]* k .*/ " + "author:/adamcuk, m[^ ]* karel/ " + "author:/adamcuk, m[^ ]* karel .*/ " + "author:/adamcuk, m[^ ]* k/ " + "author:/adamcuk, m[^ ]* k .*/ " + "author:/adamchuk, m[^ ]* karel/ " + "author:/adamchuk, m[^ ]* karel .*/ " + "author:/adamchuk, m[^ ]* k/ " + "author:/adamchuk, m[^ ]* k .*/ " + "author:/adamchuk, m[^ ]*/ | author:/adamcuk, m[^ ]*/", "//*[@numFound='24']" // "adamčuk, m karel" numFound=24 // 1 Adamčuk, 2 <NAME>. 3 <NAME> // 4 Adamčuk, Molja 5 Adamčuk, <NAME> 6 <NAME> // 7 Adamčuk, <NAME> 8 Adamčuk, M K 20 Adamcuk, // 21 <NAME>. 22 <NAME> 23 Adamcuk, Molja // 24 Adamcuk, <NAME> 25 <NAME> 26 Adamcuk, <NAME> // 27 Adamcuk, M K 40 Adamchuk, 41 <NAME>. // 42 Adamchuk, Marel 43 Adamchuk, Molja 44 Adamchuk, Mol<NAME>arel // 45 Adamchuk, <NAME> 46 Adamchuk, Molja K 47 Adamchuk, M K ); testAuthorQuery( "\"adamcuk, m karel\"", "author:adamcuk, m karel | author:adamcuk, m karel * " + "author:/adamcuk, m[^ ]*/ " + "author:/adamcuk, m[^ ]* karel/ | author:/adamcuk, m[^ ]* karel .*/ " + "author:adamcuk, m k | author:adamcuk, m k * " + "author:/adamcuk, m[^ ]* k/ | author:/adamcuk, m[^ ]* k .*/ " + "author:adamcuk, m | author:adamcuk," , "//*[@numFound='8']" // If you wonder why it is not the same as above, then know it is because of the // special setup - we are testing various situations (study the synonym and ascii // upgrade setup to understand details) // "adamcuk, m karel" numFound=8 // 20 Adamcuk, 21 <NAME>. 24 Adamcuk, <NAME> // 25 Adamcuk, <NAME> 26 Adamcuk, Mol<NAME> 27 Adamcuk, M K ); testAuthorQuery( "\"adamchuk, m karel\"", "author:adamchuk, m karel | author:adamchuk, m karel * " + "author:/adamchuk, m[^ ]*/ " + "author:/adamchuk, m[^ ]* karel/ | author:/adamchuk, m[^ ]* karel .*/ " + "author:adamchuk, m k | author:adamchuk, m k * " + "author:/adamchuk, m[^ ]* k/ | author:/adamchuk, m[^ ]* k .*/ " + "author:adamchuk, m | author:adamchuk," , "//*[@numFound='8']" // "adamchuk, <NAME>" numFound=8 // 40 Adamchuk, 41 <NAME>. 44 Adamchuk, <NAME> // 45 Adamchuk, <NAME> 46 Adamchuk, <NAME> 47 Adamchuk, M K ); testAuthorQuery( "\"adamczuk, <NAME>\"", "author:adamczuk, m karel | author:adamczuk, m karel * " + "author:/adamczuk, m[^ ]*/ " + "author:/adamczuk, m[^ ]* karel/ | author:/adamczuk, m[^ ]* karel .*/ " + "author:adamczuk, m k | author:adamczuk, m k * " + "author:/adamczuk, m[^ ]* k/ | author:/adamczuk, m[^ ]* k .*/ " + "author:adamczuk, m | author:adamczuk," , "//*[@numFound='0']" ); testAuthorQuery( "\"adamšuk, <NAME>\"", "author:adamšuk, m karel | author:adamšuk, m karel * " + "author:/adamšuk, m[^ ]*/ | author:/adamshuk, m[^ ]*/ | author:/adamsuk, m[^ ]*/" + "author:/adamšuk, m[^ ]* karel/ | author:/adamšuk, m[^ ]* karel .*/ " + "author:adamšuk, m k | author:adamšuk, m k * " + "author:/adamšuk, m[^ ]* k/ | author:/adamšuk, m[^ ]* k .*/ " + "author:adamšuk, m " + "author:adamšuk, " + "author:adamsuk, m karel | author:adamsuk, m karel * " + "author:/adamsuk, m[^ ]* karel/ | author:/adamsuk, m[^ ]* karel .*/ " + "author:adamsuk, m k | author:adamsuk, m k * " + "author:/adamsuk, m[^ ]* k/ | author:/adamsuk, m[^ ]* k .*/ " + "author:adamsuk, m " + "author:adamsuk, " + "author:adamshuk, m karel | author:adamshuk, m karel * " + "author:/adamshuk, m[^ ]* karel/ | author:/adamshuk, m[^ ]* karel .*/ " + "author:adamshuk, m k | author:adamshuk, m k * " + "author:/adamshuk, m[^ ]* k/ | author:/adamshuk, m[^ ]* k .*/ " + "author:adamshuk, m " + "author:adamshuk,", "//*[@numFound='8']" // "adamšuk, m karel" numFound=8 // 80 Adamshuk, 81 <NAME>. 82 <NAME> // 83 <NAME> 84 Adamshuk, Mol<NAME>arel 85 Adamshuk, M Karel // 86 Adamshuk, <NAME> 87 Adamshuk, M K ); testAuthorQuery( "\"adamguk, m karel\"", "author:adamguk, m karel | author:adamguk, m karel * " + "author:/adamguk, m[^ ]*/ " + "author:/adamguk, m[^ ]* karel/ | author:/adamguk, m[^ ]* karel .*/ " + "author:adamguk, m k | author:adamguk, m k * " + "author:/adamguk, m[^ ]* k/ | author:/adamguk, m[^ ]* k .*/ " + "author:adamguk, m | author:adamguk," , "//*[@numFound='8']" // "adamguk, m karel" numFound=8 // 60 Adamguk, 61 Adamguk, M. 62 Adamguk, Marel // 63 Adamguk, Molja 64 Adamguk, Molja Karel 65 Adamguk, M Karel // 66 Adamguk, Molja K 67 Adamguk, M K ); /** * <surname>, <1> <2> * * Speciality of this patter is that we want to search for regular * expression * * <surname>, <1>\w* <2> * * The following expansion will not find the synonyms and will not find * the upgrade. I am listing this example here specifically to show what * happens when the synonym list is missing some values (in real life, * the correct mapping will be generated IFF we encounter one of these * during indexing: * * adamčuk, m karel * adamčuk, mxxxx karel * * */ expected = "author:adamčuk, a b | author:adamčuk, a b* " + "author:/adamčuk, a[^ ]*/ | author:/adamčuk, a[^ ]* b.*/ " + "author:adamčuk, a " + "author:adamčuk, " + "author:adamchuk, a b | author:adamchuk, a b* " + "author:/adamchuk, a[^ ]*/ | author:/adamchuk, a[^ ]* b.*/ " + "author:adamchuk, a " + "author:adamchuk, " + "author:adamcuk, a b | author:adamcuk, a b* " + "author:/adamcuk, a[^ ]*/ | author:/adamcuk, a[^ ]* b.*/ " + "author:adamcuk, a " + "author:adamcuk," ; testAuthorQuery( "\"adamčuk, a b\"", expected , "//*[@numFound='3']", // "adamčuk, a b" numFound=3 // 1 Adamčuk, 20 Adamcuk, 40 Adamchuk, "\"adamcuk, a b\"", expected , "//*[@numFound='3']", // "adamcuk, a b" numFound=3 // 1 Adamčuk, 20 Adamcuk, 40 Adamchuk, "\"adamchuk, a b\"", expected , "//*[@numFound='3']", // "adamchuk, a b" numFound=3 // 1 Adamčuk, 20 Adamcuk, 40 Adamchuk, "\"adamczuk, a b\"", expected + "author:adamczuk, a b | author:adamczuk, a b* | author:/adamczuk, a[^ ]*/ | author:/adamczuk, a[^ ]* b.*/ | author:adamczuk, a | author:adamczuk,", "//*[@numFound='3']", // "adamczuk, a b" numFound=3 // 1 Adamčuk, 20 Adamcuk, 40 Adamchuk, "\"adamšuk, m k\"", "author:adam\u0161uk, m k | author:adam\u0161uk, m k* " + "author:/adam\u0161uk, m[^ ]*/ | author:/adam\u0161uk, m[^ ]* k.*/ " + "author:adam\u0161uk, m " + "author:adam\u0161uk, " + "author:adamsuk, m k | author:adamsuk, m k* " + "author:/adamsuk, m[^ ]*/ | author:/adamsuk, m[^ ]* k.*/ " + "author:adamsuk, m " + "author:adamsuk, " + "author:adamshuk, m k | author:adamshuk, m k* " + "author:/adamshuk, m[^ ]*/ | author:/adamshuk, m[^ ]* k.*/ " + "author:adamshuk, m " + "author:adamshuk,", "//*[@numFound='8']", // "adamšuk, m k" numFound=8 // 80 Adamshuk, 81 <NAME>. 82 Adamshuk, Marel // 83 Adamshuk, Molja 84 Adamshuk, Molja Karel 85 Adamshuk, M Karel // 86 Adamshuk, Molja K 87 Adamshuk, M K "\"adamguk, m k\"", "author:adamguk, m k | author:adamguk, m k* " + "author:/adamguk, m[^ ]*/ | author:/adamguk, m[^ ]* k.*/ " + "author:adamguk, m " + "author:adamguk," , "//*[@numFound='8']" // "adamguk, m k" numFound=8 // 60 Adamguk, 61 <NAME>. 62 Adamguk, Marel // 63 Adamguk, Molja 64 Adamguk, Molja Karel 65 Adamguk, M Karel // 66 Adamguk, Molja K 67 Adamguk, M K ); /** * <surname>, <2> * * No expansion, because of the gap. Only transliteration * */ testAuthorQuery( "\"adamčuk, k\"", "author:adamčuk, k | author:adamčuk, k* | author:adamčuk, " + "author:adamchuk, k | author:adamchuk, k* | author:adamchuk, " + "author:adamcuk, k | author:adamcuk, k* | author:adamcuk,", "//*[@numFound='12']", // "adamčuk, k" numFound=12 // 1 Adamčuk, 9 Adamčuk, <NAME> 10 Adamčuk, Karel M // 11 Adamčuk, K Molja 20 Adamcuk, 28 Adamcuk, Karel Molja // 29 Adamcuk, Karel M 30 Adamcuk, K Molja 40 Adamchuk, // 48 Adamchuk, Karel Molja 49 Adamchuk, Karel M 50 Adamchuk, K Molja "\"adamcuk, k\"", "author:adamcuk, k | author:adamcuk, k* | author:adamcuk,", "//*[@numFound='4']", // "adamcuk, k" numFound=4 // 20 Adamcuk, 28 Adamcuk, <NAME> 29 Adamcuk, <NAME> // 30 Adamcuk, K Molja "\"adamchuk, k\"", "author:adamchuk, k | author:adamchuk, k* | author:adamchuk,", "//*[@numFound='4']", // "adamchuk, k" numFound=4 // 40 Adamchuk, 48 Adamchuk, <NAME> 49 Adamchuk, Karel M // 50 Adamchuk, K Molja "\"adamczuk, k\"", "author:adamczuk, k | author:adamczuk, k* | author:adamczuk,", "//*[@numFound='0']", // "adamczuk, k" numFound=0 "\"adamšuk, k\"", "author:adamšuk, k | author:adamšuk, k* | author:adamšuk, " + "author:adamsuk, k | author:adamsuk, k* | author:adamsuk, " + "author:adamshuk, k | author:adamshuk, k* | author:adamshuk,", "//*[@numFound='4']" // "adamšuk, k" numFound=4 // 80 Adamshuk, 88 Adamshuk, <NAME> 89 Adamshuk, <NAME> // 90 Adamshuk, K Molja , "\"adamguk, k\"", "author:adamguk, k | author:adamguk, k* | author:adamguk,", "//*[@numFound='4']" // "adamguk, k" numFound=4 // 60 Adamguk, 68 Adamguk, Karel Molja 69 Adamguk, Karel M // 70 Adamguk, K Molja ); /** * <surname>, <2name> * * No expansion, because of the gap. Only transliteration * */ testAuthorQuery( "\"adamčuk, karel\"", "author:adamčuk, karel | author:adamčuk, karel * " + "author:adamčuk, k | author:adamčuk, k * | author:adamčuk, " + "author:adamcuk, karel | author:adamcuk, karel * " + "author:adamcuk, k | author:adamcuk, k * | author:adamcuk, " + "author:adamchuk, karel | author:adamchuk, karel * " + "author:adamchuk, k | author:adamchuk, k * | author:adamchuk,", "//*[@numFound='12']", // "adamčuk, karel" numFound=12 // 1 Adamčuk, 9 Adamčuk, <NAME> 10 Adamčuk, <NAME> // 11 Adamčuk, <NAME> 20 Adamcuk, 28 Adamcuk, <NAME> // 29 Adamcuk, <NAME> 30 Adamcuk, K Molja 40 Adamchuk, // 48 Adamchuk, <NAME> 49 Adamchuk, Karel M 50 Adamchuk, K Molja "\"adamcuk, karel\"", "author:adamcuk, karel | author:adamcuk, karel * " + "author:adamcuk, k | author:adamcuk, k * | author:adamcuk,", "//*[@numFound='4']", // "adamcuk, karel" numFound=4 // 20 Adamcuk, 28 Adamcuk, Karel Molja 29 Adamcuk, Karel M // 30 Adamcuk, K Molja "\"adamchuk, karel\"", "author:adamchuk, karel | author:adamchuk, karel * " + "author:adamchuk, k | author:adamchuk, k * | author:adamchuk,", "//*[@numFound='4']", // "adamchuk, karel" numFound=4 // 40 Adamchuk, 48 Adamchuk, Karel Molja 49 Adamchuk, Karel M // 50 Adamchuk, K Molja "\"adamczuk, karel\"", "author:adamczuk, karel | author:adamczuk, karel * " + "author:adamczuk, k | author:adamczuk, k * | author:adamczuk,", "//*[@numFound='0']", // "adamczuk, karel" numFound=0 "\"adamšuk, karel\"", "author:adamšuk, karel | author:adamšuk, karel * " + "author:adamšuk, k | author:adamšuk, k * | author:adamšuk, " + "author:adamshuk, karel | author:adamshuk, karel * " + "author:adamshuk, k | author:adamshuk, k * | author:adamshuk, " + "author:adamsuk, karel | author:adamsuk, karel * " + "author:adamsuk, k | author:adamsuk, k * | author:adamsuk,", "//*[@numFound='4']", // "adamšuk, karel" numFound=4 // 80 Adamshuk, 88 Adamshuk, Karel Molja 89 Adamshuk, Karel M // 90 Adamshuk, K Molja "\"adamguk, karel\"", "author:adamguk, karel | author:adamguk, karel * " + "author:adamguk, k | author:adamguk, k * | author:adamguk,", "//*[@numFound='4']" // "adamguk, karel" numFound=4 // 60 Adamguk, 68 Adamguk, <NAME> 69 Adamguk, <NAME> // 70 Adamguk, K Molja ); /** * <surname>, <2name> <1> * * The order is not correct, therefore no expansion. Only transliteration * */ testAuthorQuery( "\"adamčuk, k<NAME>\"", "author:adamčuk, karel m | author:adamčuk, karel m* " + "author:adamčuk, k m | author:adamčuk, k m* | author:adamčuk, karel " + "author:adamčuk, k | author:adamčuk, | author:adamchuk, karel m " + "author:adamchuk, karel m* | author:adamchuk, k m " + "author:adamchuk, k m* | author:adamchuk, karel | author:adamchuk, k " + "author:adamchuk, | author:adamcuk, karel m | author:adamcuk, karel m* " + "author:adamcuk, k m | author:adamcuk, k m* | author:adamcuk, karel " + "author:adamcuk, k | author:adamcuk,", "//*[@numFound='12']", // "adamčuk, karel m" numFound=12 // 1 Adamčuk, 9 Adamčuk, Karel Molja 10 Adamčuk, Karel M // 11 Adamčuk, K Molja 20 Adamcuk, 28 Adamcuk, Karel Molja // 29 Adamcuk, Karel M 30 Adamcuk, K Molja 40 Adamchuk, // 48 Adamchuk, Karel Molja 49 Adamchuk, Karel M 50 Adamchuk, K Molja "\"adamcuk, karel m\"", "author:adamcuk, karel m | author:adamcuk, karel m* | author:adamcuk, k m " + "author:adamcuk, k m* | author:adamcuk, karel | author:adamcuk, k | author:adamcuk,", "//*[@numFound='4']", // "adamcuk, karel m" numFound=4 // 20 Adamcuk, 28 Adamcuk, Karel Molja 29 Adamcuk, Karel M // 30 Adamcuk, K Molja "\"adamchuk, karel m\"", "author:adamchuk, karel m | author:adamchuk, karel m* | author:adamchuk, k m " + "author:adamchuk, k m* | author:adamchuk, karel | author:adamchuk, k | author:adamchuk,", "//*[@numFound='4']", // "adamchuk, karel m" numFound=4 // 40 Adamchuk, 48 Adamchuk, <NAME>ja 49 Adamchuk, Karel M // 50 Adamchuk, K Molja "\"adamczuk, karel m\"", "author:adamczuk, karel m | author:adamczuk, karel m* | author:adamczuk, k m " + "author:adamczuk, k m* | author:adamczuk, karel | author:adamczuk, k | author:adamczuk,", "//*[@numFound='0']", // "adamczuk, karel m" numFound=0 "\"adamšuk, karel m\"", "author:adamšuk, karel m | author:adamšuk, karel m* | author:adamšuk, k m " + "author:adamšuk, k m* | author:adamšuk, karel | author:adamšuk, k | author:adamšuk, " + "author:adamsuk, karel m | author:adamsuk, karel m* | author:adamsuk, k m " + "author:adamsuk, k m* | author:adamsuk, karel | author:adamsuk, k | author:adamsuk, " + "author:adamshuk, karel m | author:adamshuk, karel m* | author:adamshuk, k m " + "author:adamshuk, k m* | author:adamshuk, karel | author:adamshuk, k " + "author:adamshuk,", "//*[@numFound='4']", // "adamšuk, karel m" numFound=4 // 80 Adamshuk, 88 Adamshuk, Karel Molja 89 Adamshuk, Karel M // 90 Adamshuk, K Molja "\"adamguk, karel m\"", "author:adamguk, karel m | author:adamguk, karel m* | author:adamguk, k m " + "author:adamguk, k m* | author:adamguk, karel | author:adamguk, k | author:adamguk,", "//*[@numFound='4']" // "adamguk, karel m" numFound=4 // 60 Adamguk, 68 Adamguk, <NAME> 69 Adamguk, <NAME> // 70 Adamguk, K Molja ); /** * <surname>, <2name> <1name> * * The order is not correct. Only transliteration * */ testAuthorQuery( "\"adamčuk, <NAME>\"", "author:adamčuk, karel molja | author:adamčuk, karel molja * " + "author:adamčuk, k molja | author:adamčuk, k molja * | author:adamčuk, karel m " + "author:adamčuk, karel m * | author:adamčuk, k m | author:adamčuk, k m * " + "author:adamčuk, karel | author:adamčuk, k | author:adamčuk, " + "author:adamcuk, karel molja | author:adamcuk, karel molja * " + "author:adamcuk, k molja | author:adamcuk, k molja * | author:adamcuk, karel m " + "author:adamcuk, karel m * | author:adamcuk, k m | author:adamcuk, k m * " + "author:adamcuk, karel | author:adamcuk, k | author:adamcuk, " + "author:adamchuk, karel molja | author:adamchuk, karel molja * " + "author:adamchuk, k molja | author:adamchuk, k molja * " + "author:adamchuk, karel m | author:adamchuk, karel m * " + "author:adamchuk, k m | author:adamchuk, k m * " + "author:adamchuk, karel | author:adamchuk, k | author:adamchuk,", "//*[@numFound='12']", // "adamčuk, karel molja" numFound=12 // 1 Adamčuk, 9 Adamčuk, <NAME> 10 Adamčuk, Karel M // 11 Adamčuk, K Molja 20 Adamcuk, 28 Adamcuk, Karel Molja // 29 Adamcuk, Karel M 30 Adamcuk, K Molja 40 Adamchuk, // 48 Adamchuk, Karel Molja 49 Adamchuk, Karel M 50 Adamchuk, K Molja "\"adamcuk, karel molja\"", "author:adamcuk, karel molja | author:adamcuk, karel molja * " + "author:adamcuk, k molja | author:adamcuk, k molja * " + "author:adamcuk, karel m | author:adamcuk, karel m * " + "author:adamcuk, k m | author:adamcuk, k m * | author:adamcuk, karel " + "author:adamcuk, k | author:adamcuk,", "//*[@numFound='4']", // "adamcuk, karel molja" numFound=4 // 20 Adamcuk, 28 Adamcuk, <NAME> 29 Adamcuk, Karel M // 30 Adamcuk, K Molja "\"adamchuk, karel molja\"", "author:adamchuk, karel molja | author:adamchuk, karel molja * " + "author:adamchuk, k molja | author:adamchuk, k molja * " + "author:adamchuk, karel m | author:adamchuk, karel m * " + "author:adamchuk, k m | author:adamchuk, k m * | author:adamchuk, karel " + "author:adamchuk, k | author:adamchuk,", "//*[@numFound='4']", // "adamchuk, karel molja" numFound=4 // 40 Adamchuk, 48 Adamchuk, <NAME> 49 Adamchuk, <NAME> // 50 Adamchuk, K Molja "\"adamczuk, karel molja\"", "author:adamczuk, karel molja | author:adamczuk, karel molja * " + "author:adamczuk, k molja | author:adamczuk, k molja * " + "author:adamczuk, karel m | author:adamczuk, karel m * " + "author:adamczuk, k m | author:adamczuk, k m * " + "author:adamczuk, karel | author:adamczuk, k | author:adamczuk,", "//*[@numFound='0']", "\"adamšuk, karel molja\"", "author:adamšuk, karel molja | author:adamšuk, karel molja * " + "author:adamšuk, k molja | author:adamšuk, k molja * " + "author:adamšuk, karel m | author:adamšuk, karel m * " + "author:adamšuk, k m | author:adamšuk, k m * " + "author:adamšuk, karel | author:adamšuk, k | author:adamšuk, " + "author:adamsuk, karel molja | author:adamsuk, karel molja * " + "author:adamsuk, k molja | author:adamsuk, k molja * " + "author:adamsuk, karel m | author:adamsuk, karel m * " + "author:adamsuk, k m | author:adamsuk, k m * | author:adamsuk, karel " + "author:adamsuk, k | author:adamsuk, | author:adamshuk, karel molja " + "author:adamshuk, karel molja * | author:adamshuk, k molja " + "author:adamshuk, k molja * | author:adamshuk, karel m " + "author:adamshuk, karel m * | author:adamshuk, k m " + "author:adamshuk, k m * | author:adamshuk, karel " + "author:adamshuk, k | author:adamshuk,", "//*[@numFound='4']", // "adamšuk, karel molja" numFound=4 // 80 Adamshuk, 88 Adamshuk, Karel Molja 89 Adamshuk, Karel M // 90 Adamshuk, K Molja "\"adamguk, karel molja\"", "author:adamguk, karel molja | author:adamguk, karel molja * " + "author:adamguk, k molja | author:adamguk, k molja * " + "author:adamguk, karel m | author:adamguk, karel m * " + "author:adamguk, k m | author:adamguk, k m * " + "author:adamguk, karel | author:adamguk, k " + "author:adamguk,", "//*[@numFound='4']" // "adamguk, karel molja" numFound=4 // 60 Adamguk, 68 Adamguk, Karel Molja 69 Adamguk, Karel M // 70 Adamguk, K Molja ); /** * <surname>, <2> <1> * * The order is not correct, therefore no expansion. Only transliteration * */ testAuthorQuery( "\"adamčuk, k m\"", "author:adamčuk, k m | author:adamčuk, k m* " + "author:/adamčuk, k[^ ]*/ | author:/adamčuk, k[^ ]* m.*/ " + "author:adamčuk, k | author:adamčuk, " + "author:adamchuk, k m | author:adamchuk, k m* " + "author:/adamchuk, k[^ ]*/ | author:/adamchuk, k[^ ]* m.*/ " + "author:adamchuk, k | author:adamchuk, " + "author:adamcuk, k m | author:adamcuk, k m* " + "author:/adamcuk, k[^ ]*/ | author:/adamcuk, k[^ ]* m.*/ " + "author:adamcuk, k | author:adamcuk,", "//*[@numFound='12']" // "adamčuk, k m" numFound=12 // 1 Adamčuk, 9 Adamčuk, <NAME> 10 Adamčuk, <NAME> // 11 Adamčuk, <NAME> 20 Adamcuk, 28 Adamcuk, <NAME> // 29 Adamcuk, <NAME> 30 Adamcuk, K Molja 40 Adamchuk, // 48 Adamchuk, <NAME> 49 Adamchuk, <NAME> 50 Adamchuk, K Molja ); testAuthorQuery( "\"adamcuk, k m\"", "author:adamcuk, k m | author:adamcuk, k m* " + "author:/adamcuk, k[^ ]*/ | author:/adamcuk, k[^ ]* m.*/ " + "author:adamcuk, k | author:adamcuk,", "//*[@numFound='4']" // "adamcuk, k m" numFound=4 // 20 Adamcuk, 29 Adamcuk, <NAME> 30 Adamcuk, K Molja // 28 Adamcuk, <NAME> ); testAuthorQuery( "\"adamchuk, k m\"", "author:adamchuk, k m | author:adamchuk, k m* " + "author:/adamchuk, k[^ ]*/ | author:/adamchuk, k[^ ]* m.*/ " + "author:adamchuk, k | author:adamchuk,", "//*[@numFound='4']" // "adamchuk, k m" numFound=4 // 40 Adamchuk, 49 Adamchuk, Karel M 50 Adamchuk, K Molja // xx Adamchuk, <NAME> ); testAuthorQuery( "\"adamczuk, k m\"", "author:adamczuk, k m | author:adamczuk, k m* " + "author:/adamczuk, k[^ ]*/ | author:/adamczuk, k[^ ]* m.*/ " + "author:adamczuk, k | author:adamczuk,", "//*[@numFound='0']" // "adamczuk, k m" numFound=0 ); testAuthorQuery( "\"adamšuk, k m\"", "author:adamšuk, k m | author:adamšuk, k m* " + "author:/adamšuk, k[^ ]*/ | author:/adamšuk, k[^ ]* m.*/ " + "author:adamšuk, k | author:adamšuk, " + "author:adamshuk, k m | author:adamshuk, k m* " + "author:/adamshuk, k[^ ]*/ | author:/adamshuk, k[^ ]* m.*/ " + "author:adamshuk, k | author:adamshuk, " + "author:adamsuk, k m | author:adamsuk, k m* " + "author:/adamsuk, k[^ ]*/ | author:/adamsuk, k[^ ]* m.*/ " + "author:adamsuk, k | author:adamsuk,", "//*[@numFound='4']" // "adamšuk, k m" numFound=4 // 80 Adamshuk, 89 Adamshuk, <NAME> 90 Adamshuk, K Molja // xx Adamshuk, Karel Molja ); testAuthorQuery( "\"adamguk, k m\"", "author:adamguk, k m | author:adamguk, k m* " + "author:/adamguk, k[^ ]*/ | author:/adamguk, k[^ ]* m.*/ " + "author:adamguk, k | author:adamguk,", "//*[@numFound='4']" // "adamguk, k m" numFound=4 // 60 Adamguk, 69 Adamguk, <NAME> 70 Adamguk, K Molja // xx Adamguk, Karel Molja ); /** * <surname>, <2> <1name> * * The order is not correct, therefore no expansion. Only transliteration * */ testAuthorQuery( "\"adamčuk, k molja\"", "author:adamčuk, k molja | author:adamčuk, k molja * " + "author:/adamčuk, k[^ ]*/ | author:/adamčuk, k[^ ]* molja/ | author:/adamčuk, k[^ ]* molja .*/ " + "author:adamčuk, k m | author:adamčuk, k m * " + "author:/adamčuk, k[^ ]* m/ | author:/adamčuk, k[^ ]* m .*/ " + "author:adamčuk, k | author:adamčuk, | author:adamchuk, k molja | author:adamchuk, k molja * " + "author:/adamchuk, k[^ ]*/ | author:/adamchuk, k[^ ]* molja/ | author:/adamchuk, k[^ ]* molja .*/ " + "author:adamchuk, k m | author:adamchuk, k m * " + "author:/adamchuk, k[^ ]* m/ | author:/adamchuk, k[^ ]* m .*/ " + "author:adamchuk, k | author:adamchuk, | author:adamcuk, k molja | author:adamcuk, k molja * " + "author:/adamcuk, k[^ ]*/ | author:/adamcuk, k[^ ]* molja/ | author:/adamcuk, k[^ ]* molja .*/ " + "author:adamcuk, k m | author:adamcuk, k m * " + "author:/adamcuk, k[^ ]* m/ | author:/adamcuk, k[^ ]* m .*/ " + "author:adamcuk, k | author:adamcuk,", "//*[@numFound='12']" // "adamčuk, k molja" numFound=12 // 1 Adamčuk, 9 Adamčuk, <NAME> 10 Adamčuk, <NAME> // 11 Adamčuk, <NAME> 20 Adamcuk, 28 Adamcuk, <NAME> // 29 Adamcuk, <NAME> 30 Adamcuk, <NAME> 40 Adamchuk, // 48 Adamchuk, <NAME> 49 Adamchuk, <NAME> 50 Adamchuk, K Molja ); testAuthorQuery( "\"adamcuk, k molja\"", "author:adamcuk, k molja | author:adamcuk, k molja * " + "author:/adamcuk, k[^ ]*/ | author:/adamcuk, k[^ ]* molja/ | author:/adamcuk, k[^ ]* molja .*/ " + "author:adamcuk, k m | author:adamcuk, k m * " + "author:/adamcuk, k[^ ]* m/ | author:/adamcuk, k[^ ]* m .*/ " + "author:adamcuk, k | author:adamcuk,", "//*[@numFound='4']" // "adamcuk, k molja" numFound=4 // 20 Adamcuk, 28 Adamcuk, <NAME> 29 Adamcuk, <NAME> // 30 Adamcuk, K Molja ); testAuthorQuery( "\"adamchuk, k molja\"", "author:adamchuk, k molja | author:adamchuk, k molja * " + "author:/adamchuk, k[^ ]*/ | author:/adamchuk, k[^ ]* molja/ | author:/adamchuk, k[^ ]* molja .*/ " + "author:adamchuk, k m | author:adamchuk, k m * " + "author:/adamchuk, k[^ ]* m/ | author:/adamchuk, k[^ ]* m .*/ " + "author:adamchuk, k | author:adamchuk,", "//*[@numFound='4']" // "adamchuk, k molja" numFound=4 // 40 Adamchuk, 48 Adamchuk, <NAME> 49 Adamchuk, <NAME> // 50 Adamchuk, K Molja ); testAuthorQuery( "\"adamczuk, k molja\"", "author:adamczuk, k molja | author:adamczuk, k molja * " + "author:/adamczuk, k[^ ]*/ | author:/adamczuk, k[^ ]* molja/ | author:/adamczuk, k[^ ]* molja .*/ " + "author:adamczuk, k m | author:adamczuk, k m * " + "author:/adamczuk, k[^ ]* m/ | author:/adamczuk, k[^ ]* m .*/ " + "author:adamczuk, k | author:adamczuk,", "//*[@numFound='0']" // "adamczuk, k molja" numFound=0 ); testAuthorQuery( "\"adamšuk, k molja\"", "author:adamšuk, k molja | author:adamšuk, k molja * " + "author:/adamšuk, k[^ ]*/ | author:/adamšuk, k[^ ]* molja/ | author:/adamšuk, k[^ ]* molja .*/ " + "author:adamšuk, k m | author:adamšuk, k m * | author:/adamšuk, k[^ ]* m/ " + "author:/adamšuk, k[^ ]* m .*/ | author:adamšuk, k | author:adamšuk, " + "author:adamsuk, k molja | author:adamsuk, k molja * " + "author:/adamsuk, k[^ ]*/ | author:/adamsuk, k[^ ]* molja/ | author:/adamsuk, k[^ ]* molja .*/ " + "author:adamsuk, k m | author:adamsuk, k m * | author:/adamsuk, k[^ ]* m/ " + "author:/adamsuk, k[^ ]* m .*/ | author:adamsuk, k | author:adamsuk, " + "author:adamshuk, k molja | author:adamshuk, k molja * " + "author:/adamshuk, k[^ ]*/ | author:/adamshuk, k[^ ]* molja/ | author:/adamshuk, k[^ ]* molja .*/ " + "author:adamshuk, k m | author:adamshuk, k m * | author:/adamshuk, k[^ ]* m/ " + "author:/adamshuk, k[^ ]* m .*/ | author:adamshuk, k | author:adamshuk,", "//*[@numFound='4']" // "adamšuk, k molja" numFound=4 // 80 Adamshuk, 88 Adamshuk, Karel Molja 89 Adamshuk, Karel M // 90 Adamshuk, K Molja ); testAuthorQuery( "\"adamguk, k molja\"", "author:adamguk, k molja | author:adamguk, k molja * " + "author:/adamguk, k[^ ]*/ | author:/adamguk, k[^ ]* molja/ | author:/adamguk, k[^ ]* molja .*/ " + "author:adamguk, k m | author:adamguk, k m * " + "author:/adamguk, k[^ ]* m/ | author:/adamguk, k[^ ]* m .*/ " + "author:adamguk, k | author:adamguk,", "//*[@numFound='4']" // "adamguk, k molja" numFound=4 // 60 Adamguk, 68 Adamguk, <NAME> 69 Adamguk, Karel M // 70 Adamguk, K Molja ); /** * <surname>, <1*> * <surname>, <1n*> * * No expansion should happen if the <part*> has more than 2 characters, otherwise * it should work as if <surname>, <1> was specified * */ expected = "author:adamšuk, m | author:adamšuk, m* | author:adamšuk, " + "author:adamsuk, m | author:adamsuk, m* | author:adamsuk, " + "author:adamshuk, m | author:adamshuk, m* | author:adamshuk, " + "author:adamguk, m | author:adamguk, m* | author:adamguk, " + "author:adamčuk, m | author:adamčuk, m* | author:adamčuk, " + "author:adamchuk, m | author:adamchuk, m* | author:adamchuk, " + "author:adamcuk, m | author:adamcuk, m* | author:adamcuk,"; testAuthorQuery( "\"adamčuk, m*\"", expected, "//*[@numFound='40']" // "adamčuk, m*" numFound=40 // 1 Adamčuk, 2 <NAME>. 3 Adamčuk, Marel // 4 Adamčuk, Molja 5 Adamčuk, <NAME> 6 Adamčuk, <NAME> // 7 Adamčuk, <NAME> 8 Adamčuk, M K 20 Adamcuk, // 21 <NAME>. 22 Adamcuk, Marel 23 Adamcuk, Molja // 24 Adamcuk, <NAME> 25 Adamcuk, <NAME> 26 Adamcuk, <NAME> // 27 Adamcuk, M K 40 Adamchuk, 41 <NAME>. // 42 Adamchuk, Marel 43 <NAME> 44 Adamchuk, <NAME> // 45 Adamchuk, <NAME> 46 <NAME> 47 Adamchuk, M K // 60 Adamguk, 61 <NAME>. 62 <NAME> // 63 Adamguk, Molja 64 Adamguk, <NAME> 65 Adamguk, <NAME> // 66 Adamguk, <NAME> 67 Adamguk, M K 80 Adamshuk, // 81 <NAME>. 82 <NAME> 83 Adamshuk, Molja // 84 Adamshuk, <NAME> 85 Adamshuk, <NAME> 86 Adamshuk, <NAME> // 87 Adamshuk, M K ); testAuthorQuery( "\"adamcuk, m*\"", expected, "//*[@numFound='40']", "\"adamchuk, m*\"", expected, "//*[@numFound='40']" ); testAuthorQuery( "\"adamczuk, m*\"", expected + " | author:adamczuk, m | author:adamczuk, m* | author:adamczuk,", "//*[@numFound='40']", "\"adamšuk, m*\"", expected, "//*[@numFound='40']", "\"adamguk, m*\"", expected, "//*[@numFound='40']", "\"adamčuk, mo*\"", "author:adamčuk, mo*", "//*[@numFound='3']", // "adamčuk, mo*" numFound=3 // 4 Adamčuk, Molja 5 Adamčuk, Mol<NAME> 7 Adamčuk, Molja K "\"adamcuk, mo*\"", "author:adamcuk, mo*", "//*[@numFound='3']", // "adamcuk, mo*" numFound=3 // 23 Adamcuk, Molja 24 Adamcuk, Molja Karel 26 Adamcuk, Molja K "\"adamchuk, mo*\"", "author:adamchuk, mo*", "//*[@numFound='3']", // "adamchuk, mo*" numFound=3 // 43 Adamchuk, Molja 44 Adamchuk, <NAME> 46 Adamchuk, Mol<NAME> "\"adamczuk, mo*\"", "author:adamczuk, mo*", "//*[@numFound='0']", // "adamczuk, mo*" numFound=0 "\"adamšuk, mo*\"", "author:adamšuk, mo*", "//*[@numFound='0']", // "adamšuk, mo*" numFound=0 "\"adamguk, mo*\"", "author:adamguk, mo*", "//*[@numFound='3']" // "adamguk, mo*" numFound=3 // 63 Adamguk, Molja 64 Adamguk, Molja Karel 66 Adamguk, Molja K ); /** * <surname>, <2*> * <surname>, <2n*> * * No expansion should happen if the <part*> has more than 2 characters, otherwise * it should work only if such a patter is in the synonym list (and there is none) * */ testAuthorQuery( "\"adamčuk, k*\"", "author:adamčuk, k | author:adamčuk, k* | author:adamčuk, " + "author:adamchuk, k | author:adamchuk, k* | author:adamchuk, " + "author:adamcuk, k | author:adamcuk, k* | author:adamcuk,", "//*[@numFound='12']", // "adamčuk, k*" numFound=12 // 1 Adamčuk, 9 Adamčuk, <NAME> 10 Adamčuk, <NAME> // 11 Adamčuk, K Molja 20 Adamcuk, 28 Adamcuk, Karel Molja // 29 Adamcuk, <NAME> 30 Adamcuk, K Molja 40 Adamchuk, // 48 Adamchuk, <NAME>ja 49 Adamchuk, <NAME> 50 Adamchuk, K Molja "\"adamcuk, k*\"", "author:adamcuk, k | author:adamcuk, k* | author:adamcuk,", "//*[@numFound='4']", // because there is no synonym mapping for "a, k" (but there is one for "a, m"!) // "adamcuk, k*" numFound=4 // 20 Adamcuk, 28 Adamcuk, <NAME> 29 Adamcuk, <NAME> // 30 Adamcuk, K Molja "\"adamchuk, k*\"", "author:adamchuk, k | author:adamchuk, k* | author:adamchuk,", "//*[@numFound='4']", // "adamchuk, k*" numFound=4 // 40 Adamchuk, 48 Adamchuk, <NAME> 49 Adamchuk, <NAME> // 50 Adamchuk, K Molja "\"adamczuk, k*\"", "author:adamczuk, k | author:adamczuk, k* | author:adamczuk,", "//*[@numFound='0']", "\"adamšuk, k*\"", "author:adamšuk, k | author:adamšuk, k* | author:adamšuk, " + "author:adamsuk, k | author:adamsuk, k* | author:adamsuk, " + "author:adamshuk, k | author:adamshuk, k* | author:adamshuk,", "//*[@numFound='4']", // "adamšuk, k*" numFound=4 // 80 Adamshuk, 88 Adamshuk, Karel Molja 89 Adamshuk, Karel M // 90 Adamshuk, K Molja "\"adamguk, k*\"", "author:adamguk, k | author:adamguk, k* | author:adamguk,", "//*[@numFound='4']", // "adamguk, k*" numFound=4 // 60 Adamguk, 68 Adamguk, <NAME> 69 Adamguk, K<NAME> // 70 Adamguk, K Molja "\"adamčuk, ka*\"", "author:adamčuk, ka*", "//*[@numFound='2']", // 9 Adamčuk, <NAME> 10 Adamčuk, <NAME> "\"adamcuk, ka*\"", "author:adamcuk, ka*", "//*[@numFound='2']", // "adamcuk, ka*" numFound=2 // 28 Adamcuk, Karel Molja 29 Adamcuk, Karel M "\"adamchuk, ka*\"", "author:adamchuk, ka*", "//*[@numFound='2']", // "adamchuk, ka*" numFound=2 // 48 Adamchuk, Karel Molja 49 Adamchuk, Karel M "\"adamczuk, ka*\"", "author:adamczuk, ka*", "//*[@numFound='0']", "\"adamšuk, ka*\"", "author:adamšuk, ka*", "//*[@numFound='0']", // "adamšuk, ka*" numFound=0 "\"adamguk, ka*\"", "author:adamguk, ka*", "//*[@numFound='2']" // "adamguk, ka*" numFound=2 // 28 Adamguk, <NAME> 29 Adamguk, <NAME> ); /** * * The special case of synonym expansion called "semantic upgrade" * Basically, if the user input is too short - eg. "jones, c" * and our synonym file contains only these entries * "jones, christine; forman,christine" * * Then we want to be able to find that "jones, c" corresponds to * "jones, christine" and add the "forman, christine" and * "forman, c" to the expanded synonyms. However, WE DO NOT want * "forman, c*" search, but we want "jones, c*" search * */ testAuthorQuery( //must NOT have "jones*", must have "jones, c;jones, christine" "forman", "author:forman, | author:forman, c | author:jones, christine | author:jones, c " + "author:forman, christine | author:forman,*", "//*[@numFound='7']", // forman numFound=7 // 110 <NAME> 111 <NAME> 112 <NAME> // 113 Forman, C 115 <NAME> 116 <NAME> // 117 Forman, C //must NOT have "forman*", must have "forman, c;forman, christine" // PLUS - must have other jones's and allen's "jones", "author:jones, | author:jones, l | author:allen, l | author:allen, r l " + "author:allen, lynne | author:jones, r l | author:jones, r lynne | author:jones, lynne " + "author:allen, r lynne | author:forman, c | author:jones, christine | author:jones, c " + "author:forman, christine | author:jones,*", "//*[@numFound='15']", // jones numFound=15 // 110 <NAME> 111 <NAME> 112 <NAME> // 113 Forman, C 114 <NAME> 115 <NAME> // 117 Forman, C 120 <NAME> 121 <NAME> // 122 <NAME> 123 Allen, R L 124 <NAME> // 125 <NAME> 126 <NAME> 127 <NAME> //must NOT have "jones, c*", must have "jones, christine" "\"forman, c\"", "author:forman, c | author:forman, christine | author:forman, c* | author:forman," + "author:jones, christine | author:jones, c", "//*[@numFound='7']", // "forman, c" numFound=7 // 110 <NAME> 111 <NAME> 112 <NAME> // 113 Forman, C 115 <NAME> 116 <NAME> // 117 Forman, C //must NOT have "forman, c*", must have "forman, christine" "\"jones, c\"", "author:jones, c | author:jones, christine | author:jones, c* | author:jones," + "author:forman, christine | author:forman, c", "//*[@numFound='7']", // "jones, c" numFound=7 // 110 <NAME>ine 111 <NAME> 112 Forman, Christine // 113 Forman, C 114 <NAME> 115 Jones, C // 117 Forman, C "\"jones, christine\"", "author:jones, christine | author:jones, christine * | author:jones, c " + "author:jones, c * | author:jones, | author:forman, christine " + "author:forman, christine * | author:forman, c | author:forman, c * " + "author:forman,", "//*[@numFound='6']", // "jones, christine" numFound=6 // 110 <NAME> 111 <NAME> 112 Forman, Christine // 113 Forman, C 115 <NAME> 117 Forman, C "\"forman, christine\"", "author:jones, christine | author:jones, christine * | author:jones, c " + "author:jones, c * | author:jones, | author:forman, christine | author:forman, christine * " + "author:forman, c | author:forman, c * | author:forman,", "//*[@numFound='6']" ); /** * THE OLD STYLE, SO THAT I CAN COMPARE assertQueryEquals(req("qt", "aqp", "q", "author:\"Adamčuk, m\""), //"author:adamčuk, m | author:adamcuk, m | author:adamchuk, m | author:adamčuk, | author:adamčuk, m* | author:adamchuk, marel | author:adamčuk, marel | author:adamcuk, molja | author:adamcuk, marel | author:adamčuk, molja | author:adamchuk, molja | author:adamchuk, m* | author:adamchuk, | author:adamcuk, | author:adamcuk, m*", "author:adamčuk, m | author:adamcuk, m | author:adamchuk, m | author:adamčuk, | author:adamčuk, m* | author:adamchuk, m* | author:adamchuk, | author:adamcuk, | author:adamcuk, m*", BooleanQuery.class); assertQueryEquals(req("qt", "aqp", "q", "author:\"ADAMČuk, m\""), //"author:adamčuk, m | author:adamcuk, m | author:adamchuk, m | author:adamčuk, | author:adamčuk, m* | author:adamchuk, marel | author:adamčuk, marel | author:adamcuk, molja | author:adamcuk, marel | author:adamčuk, molja | author:adamchuk, molja | author:adamchuk, m* | author:adamchuk, | author:adamcuk, | author:adamcuk, m*", "author:adamčuk, m | author:adamcuk, m | author:adamchuk, m | author:adamčuk, | author:adamčuk, m* | author:adamchuk, m* | author:adamchuk, | author:adamcuk, | author:adamcuk, m*", BooleanQuery.class); assertQueryEquals(req("qt", "aqp", "q", "author:\"adamchuk, m\""), //"author:adamchuk, m | author:adamcuk, m | author:adamčuk, m | author:adamchuk, m* | author:adamchuk, marel | author:adamčuk, marel | author:adamcuk, molja | author:adamcuk, marel | author:adamchuk, molja | author:adamčuk, molja | author:adamchuk,", "author:adamchuk, m | author:adamcuk, m | author:adamčuk, m | author:adamchuk, m* | author:adamchuk,", BooleanQuery.class); **/ assertQueryEquals(req("defType", "aqp", "q", "author:\"<NAME>\""), // this was the old-style result, note "muller, w*" //"author:muller, w | author:muller, w* | author:muller, william | author:müller, william | author:mueller, william | author:muller,", "author:müller, william | author:müller, william * " + "| author:müller, w | author:müller, w * " + "| author:müller, " + "| author:muller, william | author:muller, william * " + "| author:muller, w | author:muller, w * " + "| author:muller, " + "| author:mueller, william | author:mueller, william * " + "| author:mueller, w | author:mueller, w * " + "| author:mueller, " + "| author:müller, bill | author:müller, bill * " + "| author:müller, b | author:müller, b * " + "| author:mueller, bill | author:mueller, bill * " + "| author:mueller, b | author:mueller, b * " + "| author:muller, bill | author:muller, bill * " + "| author:muller, b | author:muller, b *", DisjunctionMaxQuery.class); /* * TODO: assertQ(req("q", "author:\"<NAME>\""), "//*[@numFound='1']"); assertQ(req("q", "author:\"<NAME>\""), "//*[@numFound='1']"); assertQ(req("q", "author:\"Barabási, A\""), "//*[@numFound='1']"); assertQ(req("q", "author:\"Barabaesi, A\""), "//*[@numFound='1']"); assertQ(req("q", "author:\"<NAME>\""), "//*[@numFound='1']"); assertQ(req("q", "author:\"<NAME>\""), "//*[@numFound='1']"); assertQ(req("q", "author:Sellgren"), "//*[@numFound='1']"); assertQ(req("q", "author:\"<NAME>\""), "//*[@numFound='1']"); assertQ(req("q", "author:\"<NAME>.\""), "//*[@numFound='1']"); assertQ(req("q", "author:\"<NAME>\""), "//*[@numFound='1']"); assertQ(req("q", "author:\"<NAME>.\""), "//*[@numFound='1']"); assertQ(req("q", "author:\"<NAME>\""), "//*[@numFound='1']"); */ /* * Test we are not mixing/concatenating fields - Ticket #346 */ assertQueryEquals(req("q", "author:\"obama,\" boooo", "df", "all"), "+(author:obama, | author:obama,*) +all:boooo", BooleanQuery.class); } private void testAuthorQuery(String...vals) throws Exception { assert vals.length%3==0; for (int i=0;i<vals.length;i=i+3) { System.out.println(escapeUnicode(vals[i])); boolean failed = true; try { assertQueryEquals(req("defType", "aqp", "q", author_field + ":" + vals[i]), vals[i+1], null); assertQ(req("fl", "id," + author_field, "rows", "100", "q", author_field + ":" + vals[i]), vals[i+2].split(";")); failed = false; } finally { if (failed) { System.out.println(escapeUnicode(vals[i])); System.out.println("Running test for " + author_field + ":" + vals[i]); String response = h.query(req("fl", "id,author", "rows", "100", "defType", "aqp", "q", String.format("%s:%s", author_field, vals[i]))); ArrayList<String> out = new ArrayList<String>(); Matcher m = Pattern.compile("numFound=\\\"(\\d+)").matcher(response); Matcher m2 = Pattern.compile("<doc><str name=\\\"id\\\">(\\d+)</str><arr name=\\\"" + author_field + "\\\"><str>([^<]*)</str></arr></doc>").matcher(response); m.find(); String numFound = m.group(1); while (m2.find()) { out.add(String.format("%0$3s\t%2$-23s", m2.group(1), m2.group(2))); } Collections.sort(out); System.out.print(" // " + vals[i] + " numFound=" + numFound); int j=0; for (String s: out) { if (j%3==0) { System.out.print("\n // "); } System.out.print(s); j++; } System.out.println(); QParser qParser = getParser(req("fl", "id," + author_field, "rows", "100", "q", author_field + ":" + vals[i])); Query q = qParser.parse(); String actual = q.toString("field"); System.out.println("Offending test case: " + escapeUnicode(vals[i]) + "\nexpected vs actual: \n" + escapeUnicode(vals[i+1]) + "\n" + escapeUnicode(actual)); } } } } // Uniquely for Junit 3 public static junit.framework.Test suite() { return new junit.framework.JUnit4TestAdapter(TestAdsabsTypeAuthorParsing.class); } /* XXX:rca - it was not used, to remove? * * public void assertQ(String message, SolrQueryRequest req, String... tests) { try { String m = (null == message) ? "" : message + " "; String response = h.query(req); String results = h.validateXPath(response, tests); if (null != results) { tp.debugFail(m + "query failed XPath: " + results + "\n xml response was: " + response + "\n request was: " + req.getParamString()); } } catch (XPathExpressionException e1) { throw new RuntimeException("XPath is invalid", e1); } catch (Exception e2) { throw new RuntimeException("Exception during query", e2); } } */ public Query assertQueryEquals(SolrQueryRequest req, String expected, Class<?> clazz) throws Exception { QParser qParser = getParser(req); String query = req.getParams().get(CommonParams.Q); Query q = qParser.parse(); String actual = q.toString("field"); if (expected.startsWith("(")) expected = expected.substring(1, expected.length()-1); if (actual.startsWith("(")) actual = actual.substring(1, actual.length()-1); String[] ex = expected.split("(\\s\\|\\s|\\s)*[a-z_]+\\:"); Arrays.sort(ex); String[] ac = actual.split("(\\s\\|\\s|\\s)*[a-z_]+\\:"); Arrays.sort(ac); StringBuffer exs = new StringBuffer(); for (String s: ex) { if (s.trim().equals("")) continue; if (exs.length() > 0) exs.append(" | "); exs.append(s.trim()); } StringBuffer acs = new StringBuffer(); for (String s: ac) { if (s.trim().equals("")) continue; if (acs.length() > 0) acs.append(" | "); acs.append(s.trim()); } if (!acs.toString().equals(exs.toString())) { //assertArrayEquals(ac, ex); //tp.debugFail(query, expected, actual); tp.debugFail(query, exs.toString(), acs.toString()); } if (clazz != null) { if (!q.getClass().isAssignableFrom(clazz)) { tp.debugFail("Query is not: " + clazz + " but: " + q.getClass()); } } return q; } public String escapeUnicode(String input) { StringBuilder b = new StringBuilder(input.length()); Formatter f = new Formatter(b); for (char c : input.toCharArray()) { if (c < 128) { b.append(c); } else { f.format("\\u%04x", (int) c); } } return b.toString(); } }
java
<gh_stars>10-100 --- title: "Hugo標準のショートコード表示サンプル" description: "" date: 2021-09-11T23:09:41+09:00 lastmod: 2021-09-11T23:09:41+09:00 draft: false tags: ["Hugo", "ショートコード"] categories: "サンプル" share: true toc: true comment: true archives: ["2021年9月"] --- Hugoで用意されているショートコード使用時の表示サンプルです ## figure {{< figure src="suica.png" title="スイカの画像" >}} ## gist {{< gist spf13 7896402 >}} ## highlight {{< highlight html >}} <section id="main"> <div> <h1 id="title">{{ .Title }}</h1> {{ range .Pages }} {{ .Render "summary"}} {{ end }} </div> </section> {{< /highlight >}} ## instagram **Instagramのdeveloperアカウントが必要です。自前で用意する必要あり** ## tweet {{< tweet user="SanDiegoZoo" id="1453110110599868418" >}} ## vimeo {{< vimeo 146022717 >}} ## youtube {{< youtube w7Ft2ymGmfc >}}
markdown
Films with Scorsese: What are some of the major film festivals? Can You Guess the Movie by the Scene? Do We Really Swallow Spiders in Our Sleep? Why Do We Drop a Ball on New Year’s Eve? Why Was Frederick Douglass’s Marriage to Helen Pitts Controversial? Why Doesn’t the U.S. Use the Metric System? Robert De Niro, 2019. (1980), directed by Martin Scorsese. (1976), directed by Martin Scorsese. © 1976 Columbia Pictures Industries, Inc. All rights reserved. Universal Pictures Company, Inc. © 1990 Warner Brothers, Inc. in these related Britannica articles:
english
<reponame>Yukaii/kanahei-wallpapers<gh_stars>1-10 const kanaheiWallpapers: KanaheiWallpaper = require('../data/kanahei.json') type DefaultCollection = { name: string, images: string[] } type KanaheiWallpaper = Array<{ images: string[] }> export const defaultCollections: DefaultCollection[] = [{ name: 'カナヘイ', images: kanaheiWallpapers.map(w => w.images[w.images.length - 1]) }, { name: 'Snoopy', images: require('../data/snoopy.json') }, { name: 'Doraemon', images: require('../data/doraemon.json') }, { name: 'ちびまる子ちゃん', images: require('../data/chibimaruko.json') }, { name: 'Elmo', images: require('../data/elmo.json') } ] export function firstLoadRandomWallpaper (): string { const wallpaper = kanaheiWallpapers[Math.floor(Math.random() * kanaheiWallpapers.length)]; // load lowest resolution for the first time const image = wallpaper.images[0] return image }
typescript
<filename>package.json<gh_stars>1-10 { "name": "BMC", "version": "1.0.0", "description": "Business Model Canvas By Nick", "author": "<NAME>", "private": true, "scripts": { "dev": "nuxt", "build": "nuxt build", "start": "nuxt start", "generate": "nuxt generate", "deploy": "push-dir --dir=dist --branch=gh-pages --cleanup", "build:gh-pages": "cross-env DEPLOY_ENV=GH_PAGES nuxt build", "generate:gh-pages": "cross-env DEPLOY_ENV=GH_PAGES nuxt generate" }, "dependencies": { "cookie-universal-nuxt": "^2.0.14", "element-ui": "^2.7.0", "nuxt": "^2.4.0", "nuxt-element-ui": "^1.0.10", "vuedraggable": "^2.20.0", "cross-env": "^5.2.0" }, "devDependencies": { "nodemon": "^1.18.9" } }
json
163 Written Answers Declaration of National Highway in Assam 949. SHRI N. TOMBI SINGH: Will the Minister of SURFACE TRANSPORT be pleased to state: (a) whether there is any proposal for opening another National Highway to run between a point on the Imphal-Tameng-long Road and a point in Assam without touching Nagaland area so as to reduce the pressure of traffic on Imphal-Dimapur National Highway; and (b) if so, the details thereof? THE MINISTER OF WATER RESOURCES AND MINISTER OF SURFACE TRANSPORT (SHRI MANUBHAI KOTADIA): (a) No, Sir. (b) Does not arise. Refuelling Facilities to Military Aircrafts of Foreign Countries SHRI KAMAL NATH: DR. CHINTA MOHAN: SHRI A. VIJAYARAGHAVAN: SHRI KALPNATH SONKAR: Will the Minister of EXTERNAL AFFAIRS be pleased to state: (a) the total number of military aircrafts of foreign countries which were provided refuelling facilities in the country during the last six months; (b) the places from where these facilities were provided; Written Answers 164 aircraft at various airports during the above period; (c) whether Government have ascertained the quantity of fuel given to these (d) if so, the details thereof; (e) whether any clarification was sought by India's permanent representative in United Nations from the U.N. Secretary-General regarding the provisions of the U.N. Charter under which permission to refuel can be sought; (f) whether the Government propose to stop the refuelling facilities and use of India's air space by foreign military aircraft; and (g) if not, the reasons therefor? THE MINISTER OF STATE IN THE PRIME MINISTER'S OFFICE (SHRI KAMAL MORARKA): (a) to (g). Information is being collected and will be laid on the table of the House. Director of Telephones for Sikkim 951. SHRI NANDU THAPA: Will the Minister of COMMUNICATIONS be pleased to state: (a) whether the post of Director of Telephones for Sikkim has been created; and (b) if so, when the office of the Director of Telephones will start functioning in Sikkim? THE DEPUTY MINISTER IN THE MINISTRY OF PETROLEUM AND CHEMICALS AND DEPUTY MINISTER IN THE MINISTRY OF COMMUNICATIONS (SHRI JAI PARKASH): (a) Yes, Sir. The post of Telecom. District Manager for Sikkim has been sanctioned. (b) The office of Telecom. District Manager in Sikkim is expected to start functioning soon.
english
#include "stdafx.h" #include "ServiceBase.h" #include <cassert> ServiceBase * ServiceBase::m_serviceInstance = NULL; ServiceBase::ServiceBase(void) { } ServiceBase::~ServiceBase(void) { } ServiceBase::ServiceBase(const CString & name, const CString & displayName, DWORD dwStartType, DWORD dwErrCtrlType, DWORD dwAcceptedCmds, const CString & depends, const CString & account, const CString & password) : m_name(name) , m_displayName(displayName) , m_dwStartType(dwStartType) , m_dwErrorCtrlType(dwErrCtrlType) , m_dwAcceptedCmds(dwAcceptedCmds) , m_depends(depends) , m_account(account) , m_password(password) , m_svcStatusHandle(NULL) { m_hasPass = !m_depends.IsEmpty(); m_hasAcc = !m_account.IsEmpty(); m_hasPass = !m_password.IsEmpty(); m_svcStatus.dwControlsAccepted = dwAcceptedCmds; m_svcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; m_svcStatus.dwCurrentState = SERVICE_START_PENDING; m_svcStatus.dwServiceSpecificExitCode = 0; m_svcStatus.dwWin32ExitCode = NO_ERROR; m_svcStatus.dwCheckPoint = 0; m_svcStatus.dwWaitHint = 0; } void ServiceBase::SetStatus(DWORD dwState, DWORD dwErrCode /* = NO_ERROR */, DWORD dwWait /* = 0 */) { m_svcStatus.dwCurrentState = dwState; m_svcStatus.dwWin32ExitCode = dwErrCode; m_svcStatus.dwWaitHint = dwWait; m_svcStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN | SERVICE_ACCEPT_SESSIONCHANGE; ::SetServiceStatus(m_svcStatusHandle, &m_svcStatus); } void ServiceBase::WriteEventLog(const CString & msg, WORD type /* = EVENTLOG_INFORMATION_TYPE */) { if(msg.IsEmpty()) return; HANDLE hSource = RegisterEventSource(NULL, m_name); if(hSource) { const TCHAR * msgData[2] = {m_name, msg}; ReportEvent(hSource, type, 0, 0, NULL, 2, 0, msgData, NULL); DeregisterEventSource(hSource); } } void WINAPI ServiceBase::SvcMain(DWORD argc, TCHAR * argv[]) { assert(m_serviceInstance); m_serviceInstance->m_svcStatusHandle = ::RegisterServiceCtrlHandlerEx(m_serviceInstance->GetName(), ServiceCtrlHandler, NULL); if (!m_serviceInstance->m_svcStatusHandle) { m_serviceInstance->WriteEventLog(_T("Can't set service control handler."), EVENTLOG_ERROR_TYPE); return; } m_serviceInstance->Start(argc, argv); } DWORD WINAPI ServiceBase::ServiceCtrlHandler(DWORD ctrlCode, DWORD evtType, void *evtData, void *context) { switch (ctrlCode) { case SERVICE_CONTROL_STOP: m_serviceInstance->Stop(); break; case SERVICE_CONTROL_PAUSE: m_serviceInstance->Suspend(); break; case SERVICE_CONTROL_CONTINUE: m_serviceInstance->Resume(); break; case SERVICE_CONTROL_SHUTDOWN: m_serviceInstance->Shutdown(); break; case SERVICE_CONTROL_PRESHUTDOWN: m_serviceInstance->PerShutDown(); break; case SERVICE_CONTROL_SESSIONCHANGE: m_serviceInstance->SessionChange(evtType, reinterpret_cast<WTSSESSION_NOTIFICATION*>(evtData)); break; default: break; } return 0; } bool ServiceBase::RunService(ServiceBase * svc) { m_serviceInstance = svc; TCHAR * svnName = const_cast<CString&> (m_serviceInstance->GetName()).GetBuffer(); SERVICE_TABLE_ENTRY tableEntry[] = { { svnName, SvcMain }, { NULL, NULL } }; return ::StartServiceCtrlDispatcher(tableEntry) == TRUE; } void ServiceBase::Start(DWORD argc, TCHAR * argv[]) { SetStatus(SERVICE_START_PENDING); bool bResult = OnStart(argc, argv); if(!bResult) { SetStatus(SERVICE_STOPPED); return; } SetStatus(SERVICE_RUNNING); } void ServiceBase::Stop() { SetStatus(SERVICE_STOP_PENDING); OnStop(); SetStatus(SERVICE_STOPPED); } void ServiceBase::Suspend() { SetStatus(SERVICE_PAUSE_PENDING); OnSuspend(); SetStatus(SERVICE_PAUSED); } void ServiceBase::Resume() { SetStatus(SERVICE_CONTINUE_PENDING); OnResume(); SetStatus(SERVICE_RUNNING); } void ServiceBase::Shutdown() { SetStatus(SERVICE_STOP_PENDING); OnShutdown(); SetStatus(SERVICE_STOPPED); } void ServiceBase::PerShutDown() { OnPerShutdown(); } void ServiceBase::SessionChange(DWORD evtType, WTSSESSION_NOTIFICATION * notification) { OnSessionChange(evtType, notification); } void ServiceBase::NetBindChange(DWORD evtType) { OnNetBindChange(evtType); }
cpp