text:
##A Pearl Worth Ten Million

Night fell.  I went to bed.  I slept pretty poorly.  Man-eaters played
a major role in my dreams.  And I found it more or less appropriate
that the French word for shark, requin, has its linguistic roots
in the word requiem.

The next day at four o'clock in the morning, I was awakened by
the steward whom Captain Nemo had placed expressly at my service.
I got up quickly, dressed, and went into the lounge.

Captain Nemo was waiting for me.

"Professor Aronnax," he said to me, "are you ready to start?"

"I'm ready."

"Kindly follow me."

"What about my companions, captain?"

"They've been alerted and are waiting for us."

"Aren't we going to put on our diving suits?"  I asked.

"Not yet.  I haven't let the Nautilus pull too near the coast,
and we're fairly well out from the Mannar oysterbank.
But I have the skiff ready, and it will take us to the exact spot
where we'll disembark, which will save us a pretty long trek.
It's carrying our diving equipment, and we'll suit up just before we
begin our underwater exploring."

Captain Nemo took me to the central companionway whose steps led
to the platform.  Ned and Conseil were there, enraptured with
the "pleasure trip" getting under way.  Oars in position,
five of the Nautilus's sailors were waiting for us aboard the skiff,
which was moored alongside.  The night was still dark.
Layers of clouds cloaked the sky and left only a few stars in view.
My eyes flew to the side where land lay, but I saw only a blurred line
covering three-quarters of the horizon from southwest to northwest.
Going up Ceylon's west coast during the night, the Nautilus lay
west of the bay, or rather that gulf formed by the mainland
and Mannar Island.  Under these dark waters there stretched
the bank of shellfish, an inexhaustible field of pearls more than
twenty miles long.

Captain Nemo, Conseil, Ned Land, and I found seats in the stern
of the skiff.  The longboat's coxswain took the tiller; his four
companions leaned into their oars; the moorings were cast off
and we pulled clear.

![Captain Nemo, Conseil, Ned Land, and I found seats in the stern of the skiff][1]

The skiff headed southward.  The oarsmen took their time.
I watched their strokes vigorously catch the water, and they
always waited ten seconds before rowing again, following the
practice used in most navies.  While the longboat coasted,
drops of liquid flicked from the oars and hit the dark troughs
of the waves, pitter-pattering like splashes of molten lead.
Coming from well out, a mild swell made the skiff roll gently,
and a few cresting billows lapped at its bow.

We were silent.  What was Captain Nemo thinking?  Perhaps that
this approaching shore was too close for comfort, contrary to
the Canadian's views in which it still seemed too far away.
As for Conseil, he had come along out of simple curiosity.

Near 5:30 the first glimmers of light on the horizon defined
the upper lines of the coast with greater distinctness.
Fairly flat to the east, it swelled a little toward the south.
Five miles still separated it from us, and its beach merged with
the misty waters.  Between us and the shore, the sea was deserted.
Not a boat, not a diver.  Profound solitude reigned over this
gathering place of pearl fishermen.  As Captain Nemo had commented,
we were arriving in these waterways a month too soon.

At six o'clock the day broke suddenly, with that speed unique
to tropical regions, which experience no real dawn or dusk.
The sun's rays pierced the cloud curtain gathered on the easterly horizon,
and the radiant orb rose swiftly.

I could clearly see the shore, which featured a few sparse trees
here and there.

The skiff advanced toward Mannar Island, which curved to the south.
Captain Nemo stood up from his thwart and studied the sea.

At his signal the anchor was lowered, but its chain barely ran
because the bottom lay no more than a meter down, and this locality
was one of the shallowest spots near the bank of shellfish.
Instantly the skiff wheeled around under the ebb tide's outbound thrust.

"Here we are, Professor Aronnax," Captain Nemo then said.
"You observe this confined bay?  A month from now in this very place,
the numerous fishing boats of the harvesters will gather,
and these are the waters their divers will ransack so daringly.
This bay is felicitously laid out for their type of fishing.
It's sheltered from the strongest winds, and the sea is never
very turbulent here, highly favorable conditions for diving work.
Now let's put on our underwater suits, and we'll begin our stroll."

I didn't reply, and while staring at these suspicious waves, I began
to put on my heavy aquatic clothes, helped by the longboat's sailors.
Captain Nemo and my two companions suited up as well.
None of the Nautilus's men were to go with us on this new excursion.

Soon we were imprisoned up to the neck in india-rubber clothing,
and straps fastened the air devices onto our backs.
As for the Ruhmkorff device, it didn't seem to be in the picture.
Before inserting my head into its copper capsule, I commented
on this to the captain.

"Our lighting equipment would be useless to us," the captain answered me.
"We won't be going very deep, and the sun's rays will be sufficient
to light our way.  Besides, it's unwise to carry electric lanterns
under these waves.  Their brightness might unexpectedly attract
certain dangerous occupants of these waterways."

As Captain Nemo pronounced these words, I turned to Conseil and
Ned Land.  But my two friends had already encased their craniums
in their metal headgear, and they could neither hear nor reply.

I had one question left to address to Captain Nemo.

"What about our weapons?"  I asked him.  "Our rifles?"

"Rifles!  What for?  Don't your mountaineers attack bears dagger in hand?
And isn't steel surer than lead?  Here's a sturdy blade.
Slip it under your belt and let's be off."

I stared at my companions.  They were armed in the same fashion,
and Ned Land was also brandishing an enormous harpoon he had stowed
in the skiff before leaving the Nautilus.

![Ned Land was also brandishing an enormous harpoon][2]

Then, following the captain's example, I let myself be crowned with my
heavy copper sphere, and our air tanks immediately went into action.

An instant later, the longboat's sailors helped us overboard one after
the other, and we set foot on level sand in a meter and a half of water.
Captain Nemo gave us a hand signal.  We followed him down a gentle
slope and disappeared under the waves.

There the obsessive fears in my brain left me.  I became surprisingly
calm again.  The ease with which I could move increased my confidence,
and the many strange sights captivated my imagination.

The sun was already sending sufficient light under these waves.
The tiniest objects remained visible.  After ten minutes of walking,
we were in five meters of water, and the terrain had become almost flat.

Like a covey of snipe over a marsh, there rose underfoot schools
of unusual fish from the genus Monopterus, whose members have no fin
but their tail.  I recognized the Javanese eel, a genuine eight-decimeter
serpent with a bluish gray belly, which, without the gold lines
over its flanks, could easily be confused with the conger eel.
From the butterfish genus, whose oval bodies are very flat,
I observed several adorned in brilliant colors and sporting a dorsal
fin like a sickle, edible fish that, when dried and marinated, make an
excellent dish known by the name "karawade"; then some sea poachers,
fish belonging to the genus Aspidophoroides, whose bodies are covered
with scaly armor divided into eight lengthwise sections.

Meanwhile, as the sun got progressively higher, it lit up the watery
mass more and more.  The seafloor changed little by little.
Its fine-grained sand was followed by a genuine causeway
of smooth crags covered by a carpet of mollusks and zoophytes.
Among other specimens in these two branches, I noted some windowpane
oysters with thin valves of unequal size, a type of ostracod unique
to the Red Sea and the Indian Ocean, then orange-hued lucina with
circular shells, awl-shaped auger shells, some of those Persian
murex snails that supply the Nautilus with such wonderful dye,
spiky periwinkles fifteen centimeters long that rose under the waves
like hands ready to grab you, turban snails with shells made of horn
and bristling all over with spines, lamp shells, edible duck clams
that feed the Hindu marketplace, subtly luminous jellyfish of the species
Pelagia panopyra, and finally some wonderful Oculina flabelliforma,
magnificent sea fans that fashion one of the most luxuriant tree
forms in this ocean.

In the midst of this moving vegetation, under arbors of water plants,
there raced legions of clumsy articulates, in particular some fanged
frog crabs whose carapaces form a slightly rounded triangle,
robber crabs exclusive to these waterways, and horrible
parthenope crabs whose appearance was repulsive to the eye.
One animal no less hideous, which I encountered several times,
was the enormous crab that Mr. Darwin observed, to which nature
has given the instinct and requisite strength to eat coconuts;
it scrambles up trees on the beach and sends the coconuts tumbling;
they fracture in their fall and are opened by its powerful pincers.
Here, under these clear waves, this crab raced around with
matchless agility, while green turtles from the species frequenting
the Malabar coast moved sluggishly among the crumbling rocks.

Near seven o'clock we finally surveyed the bank of shellfish,
where pearl oysters reproduce by the millions.  These valuable
mollusks stick to rocks, where they're strongly attached
by a mass of brown filaments that forbids their moving about.
In this respect oysters are inferior even to mussels, to whom nature
has not denied all talent for locomotion.

The shellfish Meleagrina, that womb for pearls whose valves are
nearly equal in size, has the shape of a round shell with thick
walls and a very rough exterior.  Some of these shells were furrowed
with flaky, greenish bands that radiated down from the top.
These were the young oysters.  The others had rugged black surfaces,
measured up to fifteen centimeters in width, and were ten or
more years old.

Captain Nemo pointed to this prodigious heap of shellfish, and I
saw that these mines were genuinely inexhaustible, since nature's
creative powers are greater than man's destructive instincts.
True to those instincts, Ned Land greedily stuffed the finest
of these mollusks into a net he carried at his side.

But we couldn't stop.  We had to follow the captain,
who headed down trails seemingly known only to himself.
The seafloor rose noticeably, and when I lifted my arms,
sometimes they would pass above the surface of the sea.
Then the level of the oysterbank would lower unpredictably.
Often we went around tall, pointed rocks rising like pyramids.
In their dark crevices huge crustaceans, aiming their long legs
like heavy artillery, watched us with unblinking eyes, while underfoot
there crept millipedes, bloodworms, aricia worms, and annelid worms,
whose antennas and tubular tentacles were incredibly long.

Just then a huge cave opened up in our path, hollowed from a
picturesque pile of rocks whose smooth heights were completely
hung with underwater flora.  At first this cave looked pitch-black
to me.  Inside, the sun's rays seemed to diminish by degrees.
Their hazy transparency was nothing more than drowned light.

Captain Nemo went in.  We followed him.  My eyes soon grew accustomed
to this comparative gloom.  I distinguished the unpredictably contoured
springings of a vault, supported by natural pillars firmly based on
a granite foundation, like the weighty columns of Tuscan architecture.
Why had our incomprehensible guide taken us into the depths of this
underwater crypt?  I would soon find out.

After going down a fairly steep slope, our feet trod the floor
of a sort of circular pit.  There Captain Nemo stopped, and his hand
indicated an object that I hadn't yet noticed.

It was an oyster of extraordinary dimensions, a titanic giant clam,
a holy-water font that could have held a whole lake, a basin
more than two meters wide, hence even bigger than the one adorning
the Nautilus's lounge.

![It was an oyster of extraordinary dimensions][3]

I approached this phenomenal mollusk.  Its mass of filaments attached
it to a table of granite, and there it grew by itself in the midst
of the cave's calm waters.  I estimated the weight of this giant clam
at 300 kilograms.  Hence such an oyster held fifteen kilos of meat,
and you'd need the stomach of King Gargantua to eat a couple dozen.

Captain Nemo was obviously familiar with this bivalve's existence.
This wasn't the first time he'd paid it a visit, and I thought
his sole reason for leading us to this locality was to show
us a natural curiosity.  I was mistaken.  Captain Nemo had an
explicit personal interest in checking on the current condition
of this giant clam.

The mollusk's two valves were partly open.  The captain approached
and stuck his dagger vertically between the shells to discourage
any ideas about closing; then with his hands he raised the fringed,
membrane-filled tunic that made up the animal's mantle.

There, between its leaflike folds, I saw a loose pearl as big as
a coconut.  Its globular shape, perfect clarity, and wonderful orient
made it a jewel of incalculable value.  Carried away by curiosity,
I stretched out my hand to take it, weigh it, fondle it!
But the captain stopped me, signaled no, removed his dagger in one
swift motion, and let the two valves snap shut.

I then understood Captain Nemo's intent.
With each passing year the mollusk's secretions added new
concentric layers.  The captain alone was familiar with the cave
where this wonderful fruit of nature was "ripening"; he alone
reared it, so to speak, in order to transfer it one day to his
dearly beloved museum.  Perhaps, following the examples of oyster
farmers in China and India, he had even predetermined the creation
of this pearl by sticking under the mollusk's folds some piece
of glass or metal that was gradually covered with mother-of-pearl.
In any case, comparing this pearl to others I already knew about,
and to those shimmering in the captain's collection, I estimated
that it was worth at least 10,000,000 francs.  It was a superb
natural curiosity rather than a luxurious piece of jewelry,
because I don't know of any female ear that could handle it.

Our visit to this opulent giant clam came to an end.
Captain Nemo left the cave, and we climbed back up the bank
of shellfish in the midst of these clear waters not yet disturbed
by divers at work.

We walked by ourselves, genuine loiterers stopping or straying
as our fancies dictated.  For my part, I was no longer worried
about those dangers my imagination had so ridiculously exaggerated.
The shallows drew noticeably closer to the surface of the sea,
and soon, walking in only a meter of water, my head passed well above
the level of the ocean.  Conseil rejoined me, and gluing his huge
copper capsule to mine, his eyes gave me a friendly greeting.
But this lofty plateau measured only a few fathoms, and soon we
reentered Our Element.  I think I've now earned the right to
dub it that.

Ten minutes later, Captain Nemo stopped suddenly.  I thought he'd
called a halt so that we could turn and start back.  No. With a gesture
he ordered us to crouch beside him at the foot of a wide crevice.
His hand motioned toward a spot within the liquid mass,
and I looked carefully.

Five meters away a shadow appeared and dropped to the seafloor.
The alarming idea of sharks crossed my mind.  But I was mistaken,
and once again we didn't have to deal with monsters of the deep.

It was a man, a living man, a black Indian fisherman, a poor devil
who no doubt had come to gather what he could before harvest time.
I saw the bottom of his dinghy, moored a few feet above his head.
He would dive and go back up in quick succession.  A stone cut
in the shape of a sugar loaf, which he gripped between his feet
while a rope connected it to his boat, served to lower him more
quickly to the ocean floor.  This was the extent of his equipment.
Arriving on the seafloor at a depth of about five meters, he fell
to his knees and stuffed his sack with shellfish gathered at random.
Then he went back up, emptied his sack, pulled up his stone, and started
all over again, the whole process lasting only thirty seconds.

This diver didn't see us.  A shadow cast by our crag hid us from
his view.  And besides, how could this poor Indian ever have guessed
that human beings, creatures like himself, were near him under
the waters, eavesdropping on his movements, not missing a single
detail of his fishing!

So he went up and down several times.  He gathered only about
ten shellfish per dive, because he had to tear them from
the banks where each clung with its tough mass of filaments.
And how many of these oysters for which he risked his life would
have no pearl in them!

I observed him with great care.  His movements were systematically
executed, and for half an hour no danger seemed to threaten him.
So I had gotten used to the sight of this fascinating fishing
when all at once, just as the Indian was kneeling on the seafloor,
I saw him make a frightened gesture, stand, and gather himself
to spring back to the surface of the waves.

I understood his fear.  A gigantic shadow appeared above the poor diver.
It was a shark of huge size, moving in diagonally, eyes ablaze,
jaws wide open!

I was speechless with horror, unable to make a single movement.

With one vigorous stroke of its fins, the voracious animal shot
toward the Indian, who jumped aside and avoided the shark's bite
but not the thrashing of its tail, because that tail struck him
across the chest and stretched him out on the seafloor.

This scene lasted barely a few seconds.  The shark returned,
rolled over on its back, and was getting ready to cut the Indian in half,
when Captain Nemo, who was stationed beside me, suddenly stood up.
Then he strode right toward the monster, dagger in hand, ready to
fight it at close quarters.

Just as it was about to snap up the poor fisherman, the man-eater
saw its new adversary, repositioned itself on its belly, and headed
swiftly toward him.

I can see Captain Nemo's bearing to this day.  Bracing himself,
he waited for the fearsome man-eater with wonderful composure,
and when the latter rushed at him, the captain leaped aside
with prodigious quickness, avoided a collision, and sank his
dagger into its belly.  But that wasn't the end of the story.
A dreadful battle was joined.

![A dreadful battle was joined][4]

The shark bellowed, so to speak.  Blood was pouring into the waves
from its wounds.  The sea was dyed red, and through this opaque
liquid I could see nothing else.

Nothing else until the moment when, through a rift in the clouds,
I saw the daring captain clinging to one of the animal's fins,
fighting the monster at close quarters, belaboring his
enemy's belly with stabs of the dagger yet unable to deliver
the deciding thrust, in other words, a direct hit to the heart.
In its struggles the man-eater churned the watery mass so furiously,
its eddies threatened to knock me over.

I wanted to run to the captain's rescue.  But I was transfixed
with horror, unable to move.

I stared, wild-eyed. I saw the fight enter a new phase.
The captain fell to the seafloor, toppled by the enormous mass
weighing him down.  Then the shark's jaws opened astoundingly wide,
like a pair of industrial shears, and that would have been
the finish of Captain Nemo had not Ned Land, quick as thought,
rushed forward with his harpoon and driven its dreadful point
into the shark's underside.

The waves were saturated with masses of blood.  The waters
shook with the movements of the man-eater, which thrashed about
with indescribable fury.  Ned Land hadn't missed his target.
This was the monster's death rattle.  Pierced to the heart,
it was struggling with dreadful spasms whose aftershocks knocked
Conseil off his feet.

Meanwhile Ned Land pulled the captain clear.  Uninjured, the latter
stood up, went right to the Indian, quickly cut the rope binding
the man to his stone, took the fellow in his arms, and with a vigorous
kick of the heel, rose to the surface of the sea.

The three of us followed him, and a few moments later, miraculously safe,
we reached the fisherman's longboat.

Captain Nemo's first concern was to revive this unfortunate man.
I wasn't sure he would succeed.  I hoped so, since the poor devil
hadn't been under very long.  But that stroke from the shark's tail
could have been his deathblow.

Fortunately, after vigorous massaging by Conseil and the captain,
I saw the nearly drowned man regain consciousness little by little.
He opened his eyes.  How startled he must have felt, how frightened even,
at seeing four huge, copper craniums leaning over him!

And above all, what must he have thought when Captain Nemo pulled
a bag of pearls from a pocket in his diving suit and placed it
in the fisherman's hands?  This magnificent benefaction from
the Man of the Waters to the poor Indian from Ceylon was accepted
by the latter with trembling hands.  His bewildered eyes indicated
that he didn't know to what superhuman creatures he owed both his
life and his fortune.

At the captain's signal we returned to the bank of shellfish,
and retracing our steps, we walked for half an hour until we encountered
the anchor connecting the seafloor with the Nautilus's skiff.

Back on board, the sailors helped divest us of our heavy copper carapaces.

Captain Nemo's first words were spoken to the Canadian.

"Thank you, Mr. Land," he told him.

"Tit for tat, captain," Ned Land replied.  "I owed it to you."

The ghost of a smile glided across the captain's lips, and that was all.

"To the Nautilus," he said.

The longboat flew over the waves.  A few minutes later we encountered
the shark's corpse again, floating.

From the black markings on the tips of its fins, I recognized
the dreadful Squalus melanopterus from the seas of the East Indies,
a variety in the species of sharks proper.  It was more than twenty-five
feet long; its enormous mouth occupied a third of its body.
It was an adult, as could be seen from the six rows of teeth forming
an isosceles triangle in its upper jaw.

Conseil looked at it with purely scientific fascination,
and I'm sure he placed it, not without good reason, in the class
of cartilaginous fish, order Chondropterygia with fixed gills,
family Selacia, genus Squalus.

While I was contemplating this inert mass, suddenly a dozen of these
voracious melanoptera appeared around our longboat; but, paying no
attention to us, they pounced on the corpse and quarreled over every
scrap of it.

By 8:30 we were back on board the Nautilus.

There I fell to thinking about the incidents that marked our excursion
over the Mannar oysterbank.  Two impressions inevitably stood out.
One concerned Captain Nemo's matchless bravery, the other his devotion
to a human being, a representative of that race from which he had
fled beneath the seas.  In spite of everything, this strange man
hadn't yet succeeded in completely stifling his heart.

When I shared these impressions with him, he answered me in a tone
touched with emotion:

"That Indian, professor, lives in the land of the oppressed,
and I am to this day, and will be until my last breath, a native
of that same land!"

[1]: source/verne_undersea/img/55.jpg
[2]: source/verne_undersea/img/56.jpg
[3]: source/verne_undersea/img/57.jpg
[4]: source/verne_undersea/img/58.jpg

repository: fursav/tidyclassics

repo_name: fursav/tidyclassics


text:
# Overview

Effective testing is the foundation for quality assurance. Testing applications in a fast and efficient way is an essential workflow for iterative development of applications.

# Test Classification

1. Functional testing
2. White box testing
3. Stability testing

# Test Methods

## Functional Testing

We offer two methods to test the function , one is to verify the voice interaction through the VUI, and the other is to verify by the mock tool.

> ❕ Note: Functional testing requires network status to be normal

### VUI

First, install the app to the device through the tool;

```bash
$ tools/runtime-install
```

Second, restart vui;

```bash
$ tools/runtime-op --vuid restart
```

Finally, start the interaction and perform a functional test.

```
For example: Rokid, I want to listen to children's songs.
```

### Mock Tool

The mock tool simulates the voice interaction function, and the mock interaction can be achieved through mock.

```bash
$ tools/mock --asr "I want to listen to children's songs"
```

## White Box Testing

White box testing for applications via the [yoda-mock](#yoda-mock-tool) test tool.

```js
'use strict'

var test = require('tape')
var mock = require('@yoda/mock')

test('test app request event', t => {
  var rt
  // start app
  mock.mockAppRuntime('/opt/apps/appdemo')
    .then(runtime => {
      // runtime instance
      rt = runtime
      t.strictEqual(Object.keys(rt.loader.appManifests).length, 1, 'mocked app runtime shall load expected app only')
      // mock ttsd speck method
      rt.mockService('tts', 'speck', (text) => {
        t.strictEqual(text, 'hello')
        t.end()
      })
      // emit app request event
      // @param {string} asr
      // @param {object} nlp
      // @param {object} action
      // @param {object} [options]
      rt.onVoiceCommand('asr', {intent: 'play_song'}, {appId: 'appdemo'}, {})
      // emit app url event
      // @param {string} url
      // @param {object} [options]
      // @param {'cut' | 'scene'} [options.form='cut']
      // @param {boolean} [options.preemptive=true]
      // @param {string} [options.carrierId]
      // @returns {Promise<boolean>}
      rt.openUrl('url', {form: 'cut'})
    })
    .catch(err => {
      t.error(err)
      rt && rt.destruct()
      t.end()
    })
})
```

## Stability Testing

1. Perform a stability testing on your application by executing monkey.

For example, the test object is a music application, which can be tested by calling the mock tool.

```bash
$ tools/mock --asr "I want to listen to Jay Chou's songs"
$ tools/mock --asr 'I want to listen to Daoxiang'
$ tools/mock --asr 'change one'
```

2. Monitor memory and CPU conditions with the memory-viewer tool.

```bash
// memory monitor
$ tools/memory-viewer -m -i 300 -f appname -a
// cpu monitor
$ tools/memory-viewer -c -i 300 -f appname -a
```
Application running data is collected during execution and updated from time to time. Use the following command to convert json to an html chart form.

```bash
$ tools/memory-viewer -r cpu.json
```

# Testing Tools

## Testing Framework

Use tape, see [tape](https://github.com/shadow-node/tape#tape)

## YODA-Mock Tool

The [yoda-mock](https://github.com/Rokid/yoda-mock) tool is used to simulate application runtimes, emulating service methods such as ttsd, lightd.

repository: Altafyanto/yoda-book

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: Altafyanto/yoda-book


text:
---
hrs_structure:
  division: '1'
  volume: '6'
  title: '19'
  chapter: '328'
  section: 328-5
type: hrs_section
tags:
  - Government
menu:
  hrs:
    identifier: HRS_0328-0005
    parent: HRS0328
    name: 328-5 Same; "selling" includes what
weight: 34030
title: Same; "selling" includes what
full_title: 328-5 Same; "selling" includes what
---
**§328-5 Same; "selling" includes what.** The provisions of this part regarding the selling of food, drugs, devices, or cosmetics, include the manufacture, production, processing, packing, exposure, offer, possession, and holding of any such article for sale; the sale, dispensing, and giving of any such article; and the supplying or applying of any such article in the conduct of any food, drug, or cosmetic establishment. [L 1941, c 318, pt of §2; RL 1945, §2205; RL 1955, §51-5; [HRS §328-5](/title-19/chapter-328/section-328-5/)]

license: MIT

repository: SamMade/BlueAndKrabby

repo_name: SamMade/BlueAndKrabby


text:
# DTORepository
[![NuGet version](https://badge.fury.io/nu/DTORepository.svg)](https://badge.fury.io/nu/DTORepository) [![Build Status](https://ci.appveyor.com/api/projects/status/github/theerapatcha/dtorepository?branch=master&svg=true)](https://ci.appveyor.com/project/theerapatcha/dtorepository)

DTORepository is a library use to facilitate mapping a DTO to/from an Entity in EntityFramework with generic repository pattern. By enabling a developer to put most of business DTO-related logic inside an DTO class, this library enhances the source code's maintainability and readability.
### Installation

Nuget Package Manager:
**DTORepository**

or run command in Package Manager Console:
`PM> Install-Package DTORepository`
# Features
  - Automatically convert a DTO to an Entity and store in the datasource and vice-versa.
  - Conversion logics when writing DTO into database (create & update)
  - Projection logic when retrieving from database to DTO
  - Determine which fields to be ignore from writing/retrieving to/from the datasource
  - Handle many-to-many, one-to-many relationship.
  - Transaction supported (Unit of Work)
  - Repository pattern
  - Can be easily used with Dependency Injection library (eg. Autofac)

# How to use
For example, you have these EntityFramework's entities
```csharp
class User
{
    public int Id { get; set; }
    public string UserName { get; set; }
    public string Password { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public int Age { get; set; }
    public DateTime CreatedDate { get; set; }
    public DateTime UpdatedDate { get; set; }
}
```
## Create a Repository and a DTO for CRUD operation
##### Create a Repository
To perform any action on the datasource, this library encourages the repository pattern to be used. Each repository will bind with only one entity. Then, a user can perform any CRUD operation on this repository via Data Transfer Object(DTO).
```csharp
    RepositoryFactory<YourDbContext> repositoryFactory = new RepositoryFactory<YourDbContext>(yourDbContext);
    IRepository<YourDbContext, User> repository = repositoryFactory.CreateRepository<User>();
```
##### Create a DTO
The DTOs is the heart of this library. To avoid having a lot of complicated logic and unmanaged source code, we can now push all DTO-related logic inside the DTO. First, Let start with a very simple DTO.
```csharp
class UserDto : DTORepository.Models.DtoBase<YourContext, User, UserDto>
{
    public int Id { get; set; }
    public string UserName { get; set; }
    public string Password { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public int Age { get; set; }
}
```
## Create new User from a UserDTO
To create an object from dto
```csharp
UserDto dto = new UserDto {
    UserName = "johnd",
    Password = "pwd123",
    FirstName = "John",
    LastName = "Doe",
    Age = 23
};
ISuccessOrErrors<UserDto> status = repository.Create(dto);
UserDto createdDto = status.Result;
Assert.Equal(dto, createdDto); // dto can be accessed to get the newly created identifier
```

## Update user from UserDTO
Since  we already have a user in the database (assume its Id is 1)

```csharp
UserDto dto = new UserDto {
    Id = 1,
    UserName = "tonys",
    Password = "123pwd",
    FirstName = "Tony",
    LastName = "Slark",
    Age = 36
};
ISuccessOrErrors<UserDto> status = repository.Update(dto);
UserDto updateDto = status.Result;
Assert.Equal("tonys", updateDto.UserName);
```

#### Ignore fields from creating or updating
If we want to update only some fields, by default the library will ignore mapping a field with null value. in DTO to entity. However, the Age field has a type of int (it cannot be set to null). So, we can change the field type of Age to int? or Nullable<int>, or we can use an Attribute called ***IgnoreMappingIfValueAttribute*** to specify the ignored value
```csharp
class UserDto : DTORepository.Models.DtoBase<YourDbContext, User, UserDto>
{
    //...
    public int? Age { get; set; }
    // or
    public Nullable<int> Age { get; set; }
    // or
    [IgnoreMappingIfValue(0)]
    public int Age { get; set; }
    //...
}
UserDto dto = new UserDto {
    Id = 1,
    FirstName = "Tony"
};
ISuccessOrErrors<UserDto> status = repository.Update(dto);
UserDto updateDto = status.Result;
Assert.Equal("Tony", updateDto.FirstName);
Assert.Equal("johnd", updateDto.UserName);
Assert.Equal(23, updateDto.Age);
```

If we want to forbid a user from updating his username, password, we can use an attribute called ***IgnoreWritingForAttribute***
```csharp
class UserDto : DTORepository.Models.DtoBase<YourDbContext, User, UserDto>
{
    //...
    [IgnoreWritingFor(ActionFlags.Update)]
    public string UserName { get; set; }
    [IgnoreWritingFor(ActionFlags.Update)]
    public string Password { get; set; }
    //...
}
```
Additionally, it can be used with a create action too.
```csharp
class UserDto : DTORepository.Models.DtoBase<YourDbContext, User, UserDto>
{
    //...
    [IgnoreWritingFor(ActionFlags.Create)]
    public string FirstName { get; set; }
    [IgnoreWritingFor(ActionFlags.Create)]
    public string LastName { get; set; }
    [IgnoreWritingFor(ActionFlags.Create)]
    public int Age { get; set; }
    //...
}
```
Or, you can just create separate DTOs for each actions.
```csharp
class UserCreateDto : DTORepository.Models.DtoBase<YourDbContext, User, UserCreateDto>
{
    public int Id { get; set; }
    public string UserName { get; set; }
    public string Password { get; set; }
}
class UserUpdateDto : DTORepository.Models.DtoBase<YourDbContext, User, UserUpdateDto>
{
    public int Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public int? Age { get; set; }
}
```
#### Implement logics before the data is created or updated into the database
```csharp
class UserDto : DTORepository.Models.DtoBase<YourDbContext, User, UserDto>
{
    //...
    protected override ISuccessOrErrors<User> CreateDataFromDto(YourDbContext context, User target
    {
        var status = base.CreateDataFromDto(context, target);
        var user = status.Result;
        user.CreatedDate = DateTime.Now;
        return status;
    }
    protected override ISuccessOrErrors<User> UpdateDataFromDto(YourDbContext context, User target, User original)
    {
        var status = base.UpdateDataFromDto(context, target, original);
        var user = status.Result;
        user.UpdatedDate = DateTime.Now;
        return status;
    }
    //...
}
```

## Read entities from datasource as DTOs
### Get one by its identifiers
```csharp
var status = repository.Get<UserDto>(1);
UserDto userDto = status.Result;
```
We can add a logic when the library retrieving entities from the datasource and convert them to DTOs by overriding ***EntityToDtoMapping*** of a DTO class that inherits DtoBase

Since the conversion process from entity to dto use the AutoMapper.ProjectTo() method, the operations that can be performed in EntityToDtoMapping are limited (https://github.com/AutoMapper/AutoMapper/wiki/Queryable-Extensions#supported-mapping-options)
However, for complex operations, we can use method ***SetupRestOfDto*** to project entity to dto after mapping is done successfully.

```csharp
class UserDto : DTORepository.Models.DtoBase<YourDbContext, User, UserDto>
{
    //...
    public String Name { get; set; }
    //...
    protected override Action<IMappingExpression<User, UserDto>> EntityToDtoProjection
    {
        get
        {
            return m => m.ForMember(d => d.Name,
                opt => opt.MapFrom(s => s.FirstName + " " + s.LastName));
        }
    }
    protected override UserDto SetupRestOfDto(YourDbContext context, User entity)
    {
        // complicated logic here
        return this;
    }
}
```

### List entities by predicate
We can using entity predicate (Expression<Func<TEntity, bool>) to query dtos.
```csharp
ISuccessOrErrors<IList<UserDto>> status = repository.Query<UserDto>(x => x.FirstName == "John");
IList<UserDto> userDto = status.Result;
```
### Get queryable object of DTOs
This method also accepts entity predicate as an argument too.
```csharp
IQueryable<UserDto> userDtoQuery = repository.List<UserDto>(e => e.EntityProperty == SomeVal).Where(d => d.DtoProperty == SomeVal);
```

#### Ignore fields from reading or listing
Same as *create* or *update*, *get* or *list* can be treated as different actions. We can use
***IgnoreRetreivingForAttribute*** to specify which fields to ignore for specific actions.
```csharp
class UserDto : DTORepository.Models.DtoBase<YourDbContext, User, UserDto>
{
    //...
    [IgnoreRetreivingFor(ActionFlags.Get | ActionFlags.List)]
    public string Password { get; set; }
    //...
    [IgnoreRetreivingFor(ActionFlags.List)]
    public int Age { get; set; }
    //...
}
```
In case of your DTO class contains lists of other DTOs as well. The fields in that nested DTOs will be ignore based on its main action. For example, considering these requirements:
- When list blogs, the number of posts for that blog are requred to be displayed
- When list posts, only the topics are required to be dispalyed

Hence, We can create 2 DTOs based on the requirements
```csharp
class BlogDto : DTORepository.Models.DtoBase<YourDbContext, Blog, BlogDto> {
    public int Id { get; set; }
    [IgnoreRetreivingFor(ActionFlags.List)]
    public ICollection<PostDto> Posts { get; set; }
    [IgnoreRetreivingFor(ActionFlags.Get)]
    public int NumberOfPosts { get; set; }
    protected override Action<IMappingExpression<Blog, BlogDto>> EntityToDtoMapping
    {
        get
        {
            return m => m.ForMember(d => d.NumberOfPosts,
                opt => opt.MapFrom(s => s.Posts.Count()));
        }
    }
}
class PostDto : DTORepository.Models.DtoBase<Post, PostDto> {
    public int Id { get; set; }
    public string Topic { get; set; }
    [IgnoreRetreivingFor(ActionFlags.List)]
    public string Body { get; set; }
}
```
Then, perform an action to retrieve data
```csharp
IRepository<YourDbContext, Blog> blogRepository = repositoryFactory<YourDbContext>.CreateRepository<Blog>();
// --- list action ---
IList<BlogDto> blogDtos = blogRepository.List<BlogDto>().ToList();
// blogDtos[i].Posts will be null
// blogDtos[i].NumberOfPost will have a number

// --- get action ---
var status = blogRepository.Get<BlogDto>(1);
BlogDto blogDto = status.Result;
// blogDto.Posts will be a list of PostDto
// blogDto.NumberOfPost will be zero (since it is a default value of an int)
// blogDto.Posts[i].Body will have a value because it considers the operation as Get(even the Posts field is a collection)
```
## Delete entities from datasource
For the deletion, the DTO is not required. We can just pass an entity's identifiers as arguments.
```csharp
ISuccessOrErrors status = repository.Delete(1); // delete a User entity with Id of 1
```

## Transaction
Normally, every repository operation will perform **dbContext.SaveChanges()** on itself. However, if there is a requirement to perform many operations as a transaction, we can use the library's ***UnitOfWork*** implementation to wrap operations together as a single transaction.
```csharp
//...
UnitOfWorkFactory<YourDbContext> unitOfWorkFactory = new UnitOfWorkFactory<YourDbContext>(dbContext);
UnitOfWork<YourDbContext> uow = unitOfWorkFactory.CreateUnitOfWork();
ISuccessOrErrors status = uow.Execute((dbContext) => {
    var status = repository.Create(newUserDto);
    status.Combine(blogRepository.Update(updatedBlogDto));
    status.Combine(blogRepository.Delete(blogId));
    return status;
});
Assert.True(status.IsValid); // indicate that transaction is completed
//...
```

## Dependency Injection with Autofac
In your AutoFac startup config in App_Start folder of your project, add these lines
```csharp
var builder = new ContainerBuilder();
//...
builder.RegisterType<YourContextName>().As<DbContext>().InstancePerRequest();
builder.RegisterAssemblyTypes(typeof(RepositoryFactory).Assembly).AsImplementedInterfaces();
builder.RegisterAssemblyTypes(typeof(UnitOfWorkFactory).Assembly).AsImplementedInterfaces();
builder.RegisterGeneric(typeof(CreateOrUpdateService<>)).As(typeof(ICreateOrUpdateService<>));
builder.RegisterGeneric(typeof(DetailService<>)).As(typeof(IDetailService<>));
builder.RegisterGeneric(typeof(ListService<>)).As(typeof(IListService<>));
builder.RegisterGeneric(typeof(DeleteService<>)).As(typeof(IDeleteService<>));
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
//...
```

## Tech

DTORepository relies on these 2 open source projects to work properly:

* [AutoMapper] - Mapping Engine makes life easier
* [EntityFramework] - ORM framework for ADO.NET

This library is inspired by
* [GenericServices] -  a .NET class library to help build a service layer  by [JonPSmith]

License
----

MIT

   [AutoMapper]: <http://automapper.org/>
   [EntityFramework]: <https://github.com/aspnet/EntityFramework>
   [GenericServices]: <https://github.com/JonPSmith/GenericServices>
   [JonPSmith]: <https://github.com/JonPSmith>

repository: truedeity/DTORepository

repo_name: truedeity/DTORepository


text:
# The training pipeline

## Urgent items to be improved
- [ ] Use offline sampled data. Currently, the factor that makes training slow is sampling and grouping operation. In order to avoid this, I will use offline sampled ready data to train. The pre-sample block size is the smallest: 0.02 m. Each block has a block indice. While training, larger block can be got by calculating block indice directly instead of sorting points.
- [ ] Use block instead of ball.
- [ ] Import Matterport3D dataset

## Object detection training plan

### Architecture of detection
#### 1. points sampling
The KITTI dataset is highly non-uniform point cloud. To evenly cover the whole set, the centroids are selected among input point set by a farthest point sampling (FPS) algorithm.
Are there other ways to do sampling?

#### 2. points grouping
After getting the smapled point, using the kNN or Ball Query to group point around sampled centriod point.
Except kNN or Ball Query, are there other methods to do grouping? like cube query.
The MSG and MRG are also devised to concatenate the features from different scales to handle non-uniform point cloud.
Trying the MSG firstly.

#### 3. pointNet
The basic unit to process the points, feels like it like the convolutional kernel of CNN, you can use it to build the complex architecture.

#### 4. classification with fully connected network
For classification, two fully connected network are needed to produce classification information, maybe deeper FCNs are needed, for classifications usually need more abstract information.

#### 5. regression with fully connected network
Fore regression, one or two FCNs are needed, bounding box regression is essentially a linear process, thus too abstract information is not helpful. Features for classification and regression should be at different level.

### parameters to tune in the model.py
* N: the number of sampled point, which is very critical
* L: how many set abstraction layers are
* k: the K value in every layer
* R: what is the radius in every ball
* S: how many scales in MSG
* F: the number of fully connected layers

### parameters to tune in the config.py
* NEGATIVE_CEN_DIST and POSITIVE_CEN_DIST, they affect a lot about number of positive and negative samples
* RPN_BATCHSIZE decides the ratio between positive labels and negative labels
* A: the number of anchors
* P: the number of mini-batch, how many proposals in every mini-batch
* O: overlaping ratio of positive samples and negative samples

### How to do experiments
set #1: (radius=0.3, 0.6, 1.0, 1.8),(nsample= 32, 16, 16, 8), thresh=0.7, acc_38 = 0.1612, acc_30=0.1892
set #2: (radius=0.3, 0.6, 1.0, 1.8, 2.2), (nsample = 32, 16, 16, 8, 8), thresh=0.6, batchsize = 5

### Some issues
* the unblanced ratio of positive and negative samples.
Solutions: 1. to find the more positive samples by leasing the positive_ratio; 2. to using the Focal loss function. 3. Reduce the batch size. 3. to increase the anchor number is a very good solution.
In the last layer, change the bird-view maps into voxel, like image, is useful to find the real proposals, because the points only appear on the surface of object, so it is hard to predict real box with the surface point compared to real central point.
the dataset only include round 5000 dataset, so it is easy for network to overfit this small dataset if you train network from scratch. The data augmentation is important to train your network, data augmentation methods:1, perturbation randomly; 2, global scaling; 3, global rotation.


text:
# Platform Runbook

This directory is dedicated to the platform operations runbook.

## Overview

A [runbook](https://wa.aws.amazon.com/wat.concept.runbook.en.html) is a well documented set of procedures
to achieve specific outcomes. Often it coincides with a playbook for incident management. Here we propose
to establish a clear list of operations, known failure modes and success cases we expect. By doing so
we make it easy for anyone to operate the platform.

repository: pyddot/micro

gha_language: Go

repo_name: pyddot/micro


text:
---
title: Deploy Angular application on Azure Web Service
description: >-
  Deploying Angular application on Azure Web Service can be pain if you don’t
  know where to start.
date: '2018-11-23T11:49:18.107Z'
categories: []
keywords: []
slug: >-
  /@shubhamchadokar04/deploy-angular-application-on-azure-web-service-960e441bb13d
---

![google images](https://cdn-images-1.medium.com/max/800/1*qH37AYOoJ9CbfimLOVOjfw.png)
google images

Deploying an Angular application on the Azure Web Service can be a pain if you don’t know from where to start.

This tutorial will consist of the following steps:

1.  **Create an Azure Web Service**
2.  **Build the Angular application**
3.  **Configure the Web Service and deploy it**

Let’s start with creating the Azure Web Service;

If you don’t have any account, you can [**_sign up for free account_**](https://azure.microsoft.com/en-us/free/)  and $200 dollars will be credit in your azure account to play with.

Login to your Azure Account.

#### **Step: 1.1** Create a Web App

Click on Create a resource → Search Web App → Create

![Create a Web App](https://cdn-images-1.medium.com/max/800/1*CZFT3J3eGFb2NiHNPEPuVA.png)
Create a Web App

#### **Step: 1.2**

Give your application a unique name, you can leave the rest of the field as default. Service plan is the host where the application is going to be hosted. It has different plans for that but for our demo let it be the default.

![Create Web App](https://cdn-images-1.medium.com/max/800/1*2kTU5zDto5jfqlTFwXS5-w.png)
Create Web App

Once it is created you can check your application in App Service blade or search for your application in the search bar.

#### **Step 2.1:** Build the angular application

`ng build --prod`

Once this command runs successfully, a `dist` folder will be created in your application directory.

![Angular Application Folder](https://cdn-images-1.medium.com/max/800/1*DeBtlVrObDOWIhSDjaGlug.png)
Angular Application Folder

Now we’re ready to deploy our application.

> It is worth reading the [difference between](https://stackoverflow.com/questions/49065635/inconsistency-in-ng-build-vs-ng-build-prod) `[ng build](https://stackoverflow.com/questions/49065635/inconsistency-in-ng-build-vs-ng-build-prod)` [and](https://stackoverflow.com/questions/49065635/inconsistency-in-ng-build-vs-ng-build-prod) `[ng build --prod](https://stackoverflow.com/questions/49065635/inconsistency-in-ng-build-vs-ng-build-prod)`.

#### **Step 3.1** Open your Web App in Azure

There are multiple ways to go to your web app, here we’re using App Service click on it and then select your web app.

![](https://cdn-images-1.medium.com/max/800/1*9XUBqpAYoj5b9ZVcSjIHYg.png)

Click the URL — it is the URL where the application is hosted. By default, azure serve a default static page.

Search advanced tools in the web app search bar and click on `Go`.

![Kudo Advanced Tools](https://cdn-images-1.medium.com/max/800/1*z7vvMfI8GAtqk81jFfdUAQ.png)
Kudo Advanced Tools

A Kudu window will open. To check the **node version of the Web App** supports click on Runtime Versions.

To learn more about how to install a specific version [read this](https://blogs.msdn.microsoft.com/azureossds/2016/04/20/nodejs-and-npm-versions-on-azure-app-services/).

![](https://cdn-images-1.medium.com/max/800/1*c7pcHFvJ1vBeIU5OTWgBkA.png)

**Step 3.2:** Now go to CMD console under debug console and follow the below commands:

1.  Click site >> wwwroot
2.  Go to Angular Application Folder, Open dist folder >> angularDemoDeploy (In this case)
3.  Drag and drop this folder to the wwwroot folder (CMD console of Kudo)
4.  Delete the hostingstart.html

![](https://cdn-images-1.medium.com/max/800/1*HPJ9eBzl2Y0SbwySl1wvGA.png)

5\. Go to Azure Web App and open Application Settings

6\. In **Virtual applications and directories** change the physical path

from **site\\wwwroot** to **site\\wwwroot\\angularDemoDeploy** and **save.**

> here angularDemoDeploy is the name of the folder which you uploaded.

![change the physical path](https://cdn-images-1.medium.com/max/1200/1*UqCM9HpxKNW5jl54AB7rYw.png)
change the physical path

Hurray! The angular application is successfully deployed on Azure Web App. Go to your application URL and enjoy!

![](https://cdn-images-1.medium.com/max/1200/1*9XUBqpAYoj5b9ZVcSjIHYg.png)

Thanks for reading! Any comments and suggestions are most welcome.

[**Learn Angular - Best Angular Tutorials (2019) | gitconnected**
_The top 48 Angular tutorials - learn Angular for free. Courses are submitted and voted on by developers, enabling you…_gitconnected.com](https://gitconnected.com/learn/angular "https://gitconnected.com/learn/angular")[](https://gitconnected.com/learn/angular)

repository: schadokar/dump

gha_language: JavaScript

repo_name: schadokar/dump


text:
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.fervort.babycorn/babycorn-xml/badge.svg?style=plastic)](https://maven-badges.herokuapp.com/maven-central/com.fervort.babycorn/babycorn-xml)

# BabyCorn XML
Short and sweet strongly typed XML reader for JVM.

BabyCorn XML is a library to read XML data into Java data types using XPath selector.

It could be a good configuration library because of in-built features like validator and preprocessor.

## Adding BabyCorn XML to your build:

There are multiple options. Select one of the following:

### Download from GitHub releases:

[GitHub Releases](https://github.com/nileshkhaire/BabyCorn/releases)

### To add a dependency using Maven, use the following:

```xml
<dependency>
  <groupId>com.fervort.babycorn</groupId>
  <artifactId>babycorn-xml</artifactId>
  <version>1.0.0</version>
</dependency>
```

### To add a dependency using Gradle:

```gradle
implementation 'com.fervort.babycorn:babycorn-xml:1.0.0'
```

## How to use :

In 3 quick steps:

1. Add BabyCorn XML jar to your build as specified in above options.
2. Create a Java class with fields and annotate it using XPath as per your XML file.
3. Create an object of a java field class you have created in the last step and pass it to BabyCornXML constructor. All values will be set to field class you have created. That's All!

## Example :

### Your XML :
```xml
<?xml version="1.0" encoding="UTF-8"?>
<students>
	<student>
		<name>Foo Bar</name>
		<rollno>11</rollno>
		<division>A</division>
		<lastYearGrade>78.77</lastYearGrade>
		<inTopTen>yes</inTopTen>
		<secretKeyNumber>922337203685477</secretKeyNumber>
		<studentWeight>63.9873333</studentWeight>
		<address postcode="900111" city="California"/>
		<hobbies>
			<hobby>Singing</hobby>
			<hobby>Reading</hobby>
			<hobby>Yoga</hobby>
		</hobbies>
		<subjects>
			<subject name="Science" teacherName="Abc Pqr"/>
			<subject name="Mathematics" teacherName="Lmn Opq"/>
			<subject name="English" teacherName="Def Xyz"/>
		</subjects>
		<projects>
			<project id="101">Painting</project>
			<project id="102">calligraphy</project>
		</projects>
	</student>
</students>
```

### Create a Java class with fields and annotate it using XPath :

```java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.fervort.babycorn.xml.annotation.BabyCornXMLField;

public class Students {

	@BabyCornXMLField(xPath = "students/student/name")
	String name;

	@BabyCornXMLField(xPath = "students/student/rollno")
	int rollNumber;

	@BabyCornXMLField(xPath = "students/student/division")
	char division;

	@BabyCornXMLField(xPath = "students/student/lastYearGrade")
	float lastYearGradeofStudent;

	@BabyCornXMLField(xPath = "students/student/inTopTen")
	boolean isStudentInTop10;

	@BabyCornXMLField(xPath = "students/student/secretKeyNumber")
	long secretKeyNumber;

	@BabyCornXMLField(xPath = "students/student/studentWeight")
	double weight;

	@BabyCornXMLField(xPath = "students/student/hobbies/hobby" ,listValue = "text()")
	List hobbies = new ArrayList();

	@BabyCornXMLField(xPath = "students/student/subjects/subject" ,mapKey = "@name",mapValue = "@teacherName")
	Map<String,String> subjects = new HashMap();
}
```

### Create an object of a java field class you have created in the last step and pass it to BabyCornXML constructor :

```java

public class StudentTest {

	public static void main(String[] args) throws Exception {

		Students students = new Students();

		BabyCornXML babyCornXML = new BabyCornXML("Students.xml",students);

		System.out.println("Name: "+students.name);

		System.out.println("Roll Number "+students.rollNumber);

		System.out.println("Division "+students.division);

		System.out.println("In Top 10 "+students.isStudentInTop10);

		System.out.println("last year grade "+students.lastYearGradeofStudent);

		System.out.println("Weight "+students.weight);

		System.out.println("SecretKey "+students.secretKeyNumber);

		System.out.println("Hobbies "+students.hobbies);

		System.out.println("Subjects "+students.subjects);

	}

}

```

### Output :

```bash
Name: Foo Bar
Roll Number 11
Division A
In Top 10 true
last year grade 78.77
Weight 63.9873333
SecretKey<PHONE_NUMBER>85477
Hobbies [Singing, Reading, Yoga]
Subjects {English=Def Xyz, Science=Abc Pqr, Mathematics=Lmn Opq}
```

## Handling multiple nodes :
If there are multiple nodes/records in the XML, you can create 2 classes, 1 for holding list of records and other one for holding fields. For example:

### XML with multiple nodes:
```xml
<teachers>
	<teacher>
		<name>Abc</name>
		<tid>101</tid>
		<department>Art</department>
	</teacher>
	<teacher>
		<name>Pqr</name>
		<tid>102</tid>
		<department>Science</department>
	</teacher>
	<teacher>
		<name>Xyz</name>
		<tid>103</tid>
		<department>Commerce</department>
	</teacher>
</teachers>
```

### Class to hold list of teachers:
```java
public class Teachers {

	// Note Xpath, it is teachers/teacher
	@BabyCornXMLField(xPath = "teachers/teacher")
	List<Teacher> teacherList = new ArrayList<Teacher>();
}
```
### Class to hold teacher fields:
```java
public class Teacher {

	// Note Xpath, it is only name, excluding teachers/teacher
	@BabyCornXMLField(xPath = "name")
	public String name;

	@BabyCornXMLField(xPath = "tid")
	public int tid;

	@BabyCornXMLField(xPath = "department")
	public String department;
}
```
### Get list of teachers and fields:
```java
public static void main(String[] args) throws Exception {

	Teachers teachers = new Teachers();
	BabyCornXML babyCornXML = new BabyCornXML("Teachers.xml",teachers);

	// Iterate through each teacher
	for(Teacher teacher: teachers.teacherList)
	{
		System.out.println("name: "+teacher.name);
		System.out.println("teacher id: "+teacher.tid);
		System.out.println("department: "+teacher.department);
		System.out.println("");
	}
```
### Output :

```bash
name: Abc
teacher id: 101
department: Art

name: Pqr
teacher id: 102
department: Science

name: Xyz
teacher id: 103
department: Commerce
```

## Validator & Pre processor :
Anything can be written in a XML file that can cause a program failure. To avoid such scenarios, validator can be used. You can write your own validator or use built in validators.

### Writing custom validator:
You can write your own validators. Here are simple steps:
1. Add `@BabyCornXMLValidation(validationMethod = "validateEmployeeName")` annotation on the field. Here `validateEmployeeName` is a java method, where validation code will be written.
```java
public class Employees {

	@BabyCornXMLValidation(validationMethod = "validateEmployeeName")
	@BabyCornXMLField(xPath = "employees/employee/name")
	public String name;

}

```
2. Write a validation method `validateEmployeeName` in class Emplyees. Method should have 2 parameters as written below.
```java
public ValidationResult validateEmployeeName(Field field, Object object)
{
	String nameFromXML = (String)object;
	ValidationResult result = new ValidationResult(true);
	if(nameFromXML.trim().isEmpty())
	{
		result = new ValidationResult(false);
		result.setIfInvalidMessage("Name in XML is empty");
		result.setSeverity(ValidationResult.SEVERITY.STOP);
		// You can use SEVERITY.CONTINUE to continue with the execution
		//result.setSeverity(ValidationResult.SEVERITY.CONTINUE);

	}
	return result;
}
```
3. You can get result of validation using BabyCorn XML APIs
```java
	Employees employees = new Employees();
	BabyCornXML babyCornXML = new BabyCornXML("Employees.xml",employees);
	Validator validator =babyCornXML.getValidator();
	validator.getValidationList();
	System.out.println("validation list "+validator);
```
Check complete example here [Employees.java](https://github.com/nileshkhaire/BabyCorn/blob/main/Source/baby-corn/babycorn-xml/src/test/java/com/fervort/babycorn/xml/validator/Employees.java)

> Note : For field type `String,Char,Boolean` 2nd method parameter `object` could be cast to `String` and for `Double,float,Long` parameters `object` could be cast to `Double` before using. Return value `setIfInvalidValue(returnValue)` should be same as type of the field.

### Validator to pre process the field values:
Validator can be used to pre process the value. For example: In Employees.java example, if department is not a `IT,Finance or Manufacturing` then `UNKNOWN_DEPARTMENT` will be set on the field.
```java
public ValidationResult validateDepartment(Field field, Object object)
{
	String[] departments = {"IT","Finance","Manufacturing"};

	String departmentFromXML = (String)object;
	ValidationResult result = new ValidationResult(true);
	if(!Arrays.asList(departments).contains(departmentFromXML))
	{
		result = new ValidationResult(false);
		result.setIfInvalidValue("UNKNOWN_DEPARTMENT");
	}
	return result;
}
```
## BabyCorn XML APIs:
BabyCorn XML can also be used as XML DOM APIs

```java
public void testAPIs() throws Exception
{
	BabyCornXML babyCornXML = new BabyCornXML("D:\Nilesh\Students.xml");

	Document doc= babyCornXML.getDocumentRoot();

	NodeList nodeList = doc.getElementsByTagName("lastYearGrade");

	Node node = nodeList.item(0);

	System.out.println("lastYearGrade:" + node.getTextContent());
}
```

repository: nileshkhaire/BabyCorn

branch_name: refs/heads/main

repo_name: nileshkhaire/BabyCorn


text:
---
description: Learn about the anatomy of a snap project.
sidebar_position: 1
---

# Snaps anatomy

If you look at the directory structure of the
[Snaps template repository](https://github.com/MetaMask/template-snap-monorepo) used in the
[Snaps quickstart](../get-started/quickstart.md), it looks something like this:

```text
template-snap-monorepo/
├─ packages/
│  ├─ site/
|  |  |- src/
|  |  |  |- App.tsx
|  |  ├─ package.json
|  |  |- ...(react app content)
|  |
│  ├─ snap/
|  |  ├─ src/
|  |  |  |- index.ts
|  |  ├─ snap.manifest.json
|  |  ├─ package.json
|  |  |- ... (snap content)
├─ package.json
├─ ... (other stuff)
```

Source files other than `index.ts` are located through its imports.
The defaults can be overwritten in the [configuration file](#configuration-file).

:::tip Create a snap project
When you create a new snap project using `mm-snap init`, it has all these files.
Still, we recommend
[cloning the template snap repository to get started](../get-started/quickstart.md).
:::

This page examines the major components of a snap:

- [The source code](#source-code) contains the primary code of the snap.
- [The manifest file](#manifest-file) tells MetaMask important information about the snap.
- [The configuration file](#configuration-file) specifies configuration options for the snap.
- [The bundle file](#bundle-file) is the output file of the published snap.

## Source code

If you're familiar with JavaScript or TypeScript development, developing a snap might feel familiar
to you.
Consider this simple snap, `hello-snap`:

```typescript title="index.ts"
module.exports.onRpcRequest = async ({ origin, request }) => {
  switch (request.method) {
    // Expose a "hello" RPC method to dapps
    case "hello":
      return "world!";

    default:
      throw new Error("Method not found.");
  }
};
```

To communicate with the outside world, the snap must implement its own JSON-RPC API by exposing
the exported function [`onRpcRequest`](../reference/exports.md#onrpcrequest).
Whenever the snap receives a JSON-RPC request from a dapp or another snap, this handler function is
called with the specified parameters.

In addition to being able to expose a JSON-RPC API, snaps can access the global object `snap`.
You can use this object to make Snaps-specific JSON-RPC requests.

If a dapp wants to use `hello-snap`, it can implement something like this:

```javascript
// Connect to the snap, enabling its usage inside the dapp
await window.ethereum.request({
  method: "wallet_enable",
  params: [
    {
      wallet_snap: {
        "npm:hello-snap": {
          version: "^1.0.0",
        },
      },
    },
  ],
});

// Invoke the "hello" RPC method exposed by the snap
const hello = await window.ethereum.request({
  method: "wallet_invokeSnap",
  params: { snapId: "npm:hello-snap", request: { method: "hello" } },
});

console.log(hello); // 'world!'
```

The snap's RPC API is completely up to you, as long as it's a valid
[JSON-RPC](https://www.jsonrpc.org/specification) API.

:::tip Does my snap need to have an RPC API?
No, that's also up to you!
If your snap can do something useful without receiving and responding to JSON-RPC requests, such as
providing [transaction insights](../reference/exports.md#ontransaction), then you can skip exporting
`onRpcRequest`.
However, if you want to do something such as manage the user's keys for a particular protocol and
create a dapp that, for example, sends transactions for that protocol using your snap, you must
specify an RPC API.
:::

## Manifest file

To get MetaMask to execute your snap, you must have a valid manifest file named `snap.manifest.json`,
located in your package root directory.
The manifest file of `hello-snap` would look something like this:

```json
{
  "version": "1.0.0",
  "proposedName": "hello-snap",
  "description": "A snap that says hello!",
  "repository": {
    "type": "git",
    "url": "https://github.com/Hello/hello-snap.git"
  },
  "source": {
    "shasum": "w3FltkDjKQZiPwM+AThnmypt0OFF7hj4ycg/kxxv+nU=",
    "location": {
      "npm": {
        "filePath": "dist/bundle.js",
        "iconPath": "images/icon.svg",
        "packageName": "hello-snap",
        "registry": "https://registry.npmjs.org/"
      }
    }
  },
  "initialPermissions": {},
  "manifestVersion": "0.1"
}
```

The manifest tells MetaMask important information about your snap, such as where it's published
(using `source.location`) and how to verify the integrity of the snap source code (by attempting to
reproduce the `source.shasum` value).

:::note
Currently, snaps can only be
[published to the official npm registry](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry),
and the manifest must also match the corresponding fields of the `package.json` file.
In the future, developers will be able to distribute snaps in different ways, and the manifest will
expand to support different publishing solutions.

The [snaps publishing specification](https://github.com/MetaMask/SIPs/blob/main/SIPS/sip-9.md)
details the requirements of both `snap.manifest.json` and its relationship to `package.json`.
:::

You might need to modify some manifest fields manually.
For example, if you change the location of the (optional) icon SVG file, you must update
`source.location.npm.iconPath` to match.
You can also use the [command line](../reference/cli/index.md) to update some fields for you.
For example, `mm-snap build` or `mm-snap manifest --fix` updates `source.shasum`.

## Configuration file

The snap configuration file, `snap.config.js`, should be placed in the project root directory.
You can override the default values of the [Snaps CLI options](../reference/cli/options.md) by specifying
them in the `cliOptions` property of the configuration file.
For example:

```javascript
module.exports = {
  cliOptions: {
    src: "lib/index.js",
    dist: "out",
    port: 9000,
  },
};
```

If you want to customize the Browserify build process, you can provide the `bundlerCustomizer` property.
It's a function that takes one argument, the
[browserify object](https://github.com/browserify/browserify#api-example) which MetaMask uses
internally to bundle the snap.
You can transform it in any way you want, for example, adding plugins.
The `bundleCustomizer` function looks something like this:

```javascript
const brfs = require("brfs");

module.exports = {
  cliOptions: {
    /* ... */
  },
  bundlerCustomizer: (bundler) => {
    bundler.transform(brfs);
  },
};
```

:::note
You should not publish the configuration file to NPM, since it's only used for development and
building.
However, you can commit the file to GitHub to share the configuration with your team, since it
shouldn't contain any secrets.
:::

## Bundle file

Because of the way snaps are executed, they must be published as a single `.js` file containing the
entire source code and all dependencies.
Moreover, the [Snaps execution environment](execution-environment.md) has no DOM, no Node.js
APIs, and no filesystem access, so anything that relies on the DOM doesn't work, and any Node
built-ins must be bundled along with the snap.

Use the command `mm-snap build` to bundle your snap using [Browserify](https://browserify.org).
This command finds all dependencies using your specified main entry point and outputs a bundle
file to your specified output path.

repository: MetaMask/metamask-docs

repo_name: MetaMask/metamask-docs


text:
# Kode Kid

---
### Table Of Contents
1. [Overview](#overview)
2. [Deployed Site](#Deployed-Link)
3. [Authors](#Authors)
4. [Tools Used](#Tools-Used)
5. [Getting Started](#Getting-Started)
6. [Initial Wireframe](#Initial-wireframe)
7. [Visual](#Visual)
8. [Change Logs](#change-logs)
9. [Resources](#Resources)

## Overview
Side scrolling 2D game built in Unity. A "student" is trying to make it to class, but he must face many obstacles and overcome puzzles and platforming to reach his goal.

---
## Deployed Link
[Deployed Link](https://hcoggers.itch.io/kode-kid)

---
## Authors

[Allyson Reyes](https://github.com/areyes986)
[Brandon Johnson](https://github.com/SplinterCel3000)
[Harrison Cogswell](https://github.com/HCoggers)
[Jin Woo Kim](https://github.com/Jinwoov)

---

## Tools Used
[Unity](https://unity.com/)
[Piskel](https://www.piskelapp.com/)
[Beepbox](https://beepbox.co/)
[Microsoft Visual Studio Community](https://visualstudio.microsoft.com/vs/community/)
[Unity Dashboard](https://developer.cloud.unity3d.com/)

---

## Getting Started

Clone this repository to your local machine.

```
$ git clone https://github.com/TeamCubone/Kode-Kid.git
```

Option 1. Once pulled down to your machine, open the project in the Unity and under `File` click on `Build and Run`

This will run the application successfully and start the application.

Option 2 Depending on operating system, for Mac user navigate to `KodeKid.app` to run the application. For window user, navigate to KodeKidWindows and run the program.

For control,
`Left` & `right` or `A` & `D` to move, and `space bar` or `W` to jump. Hit `Escape` to pause or quit the application.

---
## Initial Wireframe

![Tutorial Level](./Assets/Tutorial.PNG)
*Tutorial wireframe*

![Level One](./Assets/level1.PNG)
*Level 1 wireframe*

---

## Visual
![Game Start](./Assets/Game-start.png)
*Start Screen*

![Character](./Assets/Character.png)
*Character selection*

![In Game](./Assets/In-Game.png)
*Ingame Screen*

![Winning Screen](./Assets/Winning-Screen.png)
*Winning Screen*

![Game Over](./Assets/GameOver.png)
*Game Over Screen*

![Unity Source Control](./Assets/Unity-SC.png)
*Unity Source Control*

---
## Change Logs

**1.0 Version Released**
- Added background sound to the game - 05/20/2020
- Created a new levels and cleaned fade in and out to different scenes. - 05/20/2020
- About us page is added and added multiple sprites for personal touch - 05/20/2020
- implemented multiple screens and transition to multiple levels. - 05/19/2020
- Added death to the character upon collision to the hazards. - 05/19/2020
- Added death count, coin count, and round count to the game. - 05/19/2020
- Created game over screen and added character select to the game. - 05/19/2020
- Implemented parallax background to the game and pause interface in the game. - 05/19/2020
- Added main menu to the game and enemy to appear. - 05/18/2020
- Implemented base platforms and tiles and character sprites to render with animation. -  05/18/2020

## Resources

[Udemy](https://www.udemy.com/course/unitycourse)
[Rule Tile](https://github.com/Unity-Technologies/2d-extras)
[Tiles](https://creativemarket.com/Foxfin/304893-Super-Platformer-Assets)
[Parallax Background](https://ansimuz.itch.io/mountain-dusk-parallax-background?download)
[Graduation song](https://www.youtube.com/watch?v=_doAV8bx0xg)

repository: TeamCubone/Kode-Kid

branch_name: refs/heads/testing

gha_language: ASP

gha_license_id: MIT

repo_name: TeamCubone/Kode-Kid


text:
# OpenRefine-testing-extension

[![Build Status](https://travis-ci.com/MarekSuchanek/OpenRefine-testing-extension.svg?branch=master)](https://travis-ci.com/MarekSuchanek/OpenRefine-testing-extension)
![GitHub All Releases](https://img.shields.io/github/downloads/MarekSuchanek/OpenRefine-testing-extension/total)
[![License](https://img.shields.io/github/license/MarekSuchanek/OpenRefine-testing-extension)](LICENSE)

Just testing setup for [OpenRefine](http://openrefine.org) extension

## Installation

Distribution ZIP files are located at [releases](https://github.com/MarekSuchanek/OpenRefine-testing-extension/releases) page.

Just download it and unzip into the `extensions` folder in your OpenRefine instance, for more information visit [OpenRefine - Installing Extensions](https://github.com/OpenRefine/OpenRefine/wiki/Installing-Extensions).

## Development

You are required to have Maven installed with other necessary tools for building Java:

```console
$ mvn clean compile
```

To create a ZIP file, run:

```console
$ mvn package assembly:single
```

After issuing these commands, prepared ZIP file should be located in `target` directory according to Maven output.

## License

This project is licensed under MIT license - see the [LICENSE](LICENSE) file for more information.


text:
# streamx

An iteration of the Node.js core streams with a series of improvements.

```
npm install streamx
```

[![Build Status](https://github.com/streamxorg/streamx/workflows/Build%20Status/badge.svg)](https://github.com/streamxorg/streamx/actions?query=workflow%3A%22Build+Status%22)

## Main improvements from Node.js core stream

#### Proper lifecycle support.

Streams have an `_open` function that is called before any read/write operation and a `_destroy`
function that is always run as the last part of the stream.

This makes it easy to maintain state.

#### Easy error handling

Fully integrates a `.destroy()` function. When called the stream will wait for any
pending operation to finish and call the stream destroy logic.

Close is *always* the last event emitted and `destroy` is always run.

#### `pipe()` error handles

`pipe` accepts a callback that is called when the pipeline is fully drained.
It also error handles the streams provided and destroys both streams if either
of them fail.

#### All streams are both binary and object mode streams

A `map` function can be provided to map your input data into buffers
or other formats. To indicate how much buffer space each data item takes
an `byteLength` function can be provided as well.

This removes the need for two modes of streams.

#### Simplicity

This is a full rewrite, all contained in one file.

Lots of stream methods are simplified based on how I and devs I work with actually use streams in the wild.

#### Backwards compat

streamx aims to be compatible with Node.js streams whenever it is reasonable to do so.

This means that streamx streams behave a lot like Node.js streams from the outside but still provides the
improvements above.

#### Smaller browser footprint

streamx has a much smaller footprint when compiled for the browser:

```
$ for x in stream{,x}; do echo $x: $(browserify -r $x | wc -c) bytes; done
stream: 173844 bytes
streamx: 46943 bytes
```

With optimizations turned on, the difference is even more stark:

```
$ for x in stream{,x}; do echo $x: $(browserify -r $x -p tinyify | wc -c) bytes; done
stream: 62649 bytes
streamx: 8460 bytes
$ for x in stream{,x}; do echo $x: $(browserify -r $x -p tinyify | gzip | wc -c) "bytes (gzipped)"; done
stream: 18053 bytes (gzipped)
streamx: 2806 bytes (gzipped)
```

#### AbortSignal support

To make it easier to integrate streams in a `async/await` flow, all streams support a `signal` option
that accepts a [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) to as an
alternative means to `.destroy` streams.

## Usage

``` js
const { Readable } = require('streamx')

const rs = new Readable({
  read (cb) {
    this.push('Cool data')
    cb(null)
  }
})

rs.on('data', data => console.log('data:', data))
```

## API

This streamx package contains 4 streams similar to Node.js core.

## Readable Stream

#### `rs = new stream.Readable([options])`

Create a new readable stream.

Options include:

```
{
  highWaterMark: 16384, // max buffer size in bytes
  map: (data) => data, // optional function to map input data
  byteLength: (data) => size, // optional function that calculates the byte size of input data
  signal: abortController.signal, // optional AbortSignal that triggers `.destroy` when on `abort`
  eagerOpen: false // eagerly open the stream
}
```

In addition you can pass the `open`, `read`, and `destroy` functions as shorthands in
the constructor instead of overwrite the methods below.

The default byteLength function returns the byte length of buffers and `1024`
for any other object. This means the buffer will contain around 16 non buffers
or buffers worth 16kb when full if the defaults are used.

#### `rs._read(cb)`

This function is called when the stream wants you to push new data.
Overwrite this and add your own read logic.
You should call the callback when you are fully done with the read.

Can also be set using `options.read` in the constructor.

Note that this function differs from Node.js streams in that it takes
the "read finished" callback.

#### `drained = rs.push(data)`

Push new data to the stream. Returns true if the buffer is not full
and you should push more data if you can.

If you call `rs.push(null)` you signal to the stream that no more
data will be pushed and that you want to end the stream.

#### `data = rs.read()`

Read a piece of data from the stream buffer. If the buffer is currently empty
`null` will be returned and you should wait for `readable` to be emitted before
trying again. If the stream has been ended it will also return `null`.

Note that this method differs from Node.js streams in that it does not accept
an optional amounts of bytes to consume.

#### `rs.unshift(data)`

Add a piece of data to the front of the buffer. Use this if you read too much
data using the `rs.read()` function.

#### `rs._open(cb)`

This function is called once before the first read is issued. Use this function
to implement your own open logic.

Can also be set using `options.open` in the constructor.

#### `rs._destroy(cb)`

This function is called just before the stream is fully destroyed. You should
use this to implement whatever teardown logic you need. The final part of the
stream life cycle is always to call destroy itself so this function will always
be called wheather or not the stream ends gracefully or forcefully.

Can also be set using `options.destroy` in the constructor.

Note that the `_destroy` might be called without the open function being called
in case no read was ever performed on the stream.

#### `rs._predestroy()`

A simple hook that is called as soon as the first `stream.destroy()` call is invoked.

Use this in case you need to cancel pending reads (if possible) instead of waiting for them to finish.

Can also be set using `options.predestroy` in the constructor.

#### `rs.destroy([error])`

Forcefully destroy the stream. Will call `_destroy` as soon as all pending reads have finished.
Once the stream is fully destroyed `close` will be emitted.

If you pass an error this error will be emitted just before `close` is, signifying a reason
as to why this stream was destroyed.

#### `rs.pause()`

Pauses the stream. You will only need to call this if you want to pause a resumed stream.

Returns this stream instance.

#### `rs.resume()`

Will start reading data from the stream as fast as possible.

If you do not call this, you need to use the `read()` method to read data or the `pipe()` method to
pipe the stream somewhere else or the `data` handler.

If none of these option are used the stream will stay paused.

Returns this stream instance.

#### `bool = Readable.isPaused(rs)`

Returns `true` if the stream is paused, else `false`.

#### `writableStream = rs.pipe(writableStream, [callback])`

Efficently pipe the readable stream to a writable stream (can be Node.js core stream or a stream from this package).
If you provide a callback the callback is called when the pipeline has fully finished with an optional error in case
it failed.

To cancel the pipeline destroy either of the streams.

#### `rs.on('readable')`

Emitted when data is pushed to the stream if the buffer was previously empty.

#### `rs.on('data', data)`

Emitted when data is being read from the stream. If you attach a data handler you are implicitly resuming the stream.

#### `rs.on('end')`

Emitted when the readable stream has ended and no data is left in it's buffer.

#### `rs.on('close')`

Emitted when the readable stream has fully closed (i.e. it's destroy function has completed)

#### `rs.on('error', err)`

Emitted if any of the stream operations fail with an error. `close` is always emitted right after this.

#### `rs.on('piping', dest)`

Emitted when the readable stream is pipeing to a destination.

#### `rs.destroyed`

Boolean property indicating wheather or not this stream has been destroyed.

#### `bool = Readable.isBackpressured(rs)`

Static method to check if a readable stream is currently under backpressure.

#### `stream = Readable.from(arrayOrBufferOrStringOrAsyncIterator)`

Static method to turn an array or buffer or string or AsyncIterator into a readable stream.

## Writable Stream

#### `ws = new stream.Writable([options])`

Create a new writable stream.

Options include:

```
{
  highWaterMark: 16384, // max buffer size in bytes
  map: (data) => data, // optional function to map input data
  byteLength: (data) => size, // optional function that calculates the byte size of input data
  signal: abortController.signal // optional AbortSignal that triggers `.destroy` when on `abort`
}
```

In addition you can pass the `open`, `write`, `final`, and `destroy` functions as shorthands in
the constructor instead of overwrite the methods below.

The default byteLength function returns the byte length of buffers and `1024`
for any other object. This means the buffer will contain around 16 non buffers
or buffers worth 16kb when full if the defaults are used.

#### `ws._open(cb)`

This function is called once before the first write is issued. Use this function
to implement your own open logic.

Can also be set using `options.open` in the constructor.

#### `ws._destroy(cb)`

This function is called just before the stream is fully destroyed. You should
use this to implement whatever teardown logic you need. The final part of the
stream life cycle is always to call destroy itself so this function will always
be called wheather or not the stream ends gracefully or forcefully.

Can also be set using `options.destroy` in the constructor.

Note that the `_destroy` might be called without the open function being called
in case no write was ever performed on the stream.

#### `ws._predestroy()`

A simple hook that is called as soon as the first `stream.destroy()` call is invoked.

Use this in case you need to cancel pending writes (if possible) instead of waiting for them to finish.

Can also be set using `options.predestroy` in the constructor.

#### `ws.destroy([error])`

Forcefully destroy the stream. Will call `_destroy` as soon as all pending reads have finished.
Once the stream is fully destroyed `close` will be emitted.

If you pass an error this error will be emitted just before `close` is, signifying a reason
as to why this stream was destroyed.

#### `drained = ws.write(data)`

Write a piece of data to the stream. Returns `true` if the stream buffer is not full and you
should keep writing to it if you can. If `false` is returned the stream will emit `drain`
once it's buffer is fully drained.

#### `ws._write(data, callback)`

This function is called when the stream want to write some data. Use this to implement your own
write logic. When done call the callback and the stream will call it again if more data exists in the buffer.

Can also be set using `options.write` in the constructor.

#### `ws._writev(batch, callback)`

Similar to `_write` but passes an array of all data in the current write buffer instead of the oldest one.
Useful if the destination you are writing the data to supports batching.

Can also be set using `options.writev` in the constructor.

#### `ws.end()`

Gracefully end the writable stream. Call this when you no longer want to write to the stream.

Once all writes have been fully drained `finish` will be emitted.

Returns this stream instance.

#### `ws._final(callback)`

This function is called just before `finish` is emitted, i.e. when all writes have flushed but `ws.end()`
have been called. Use this to implement any logic that should happen after all writes but before finish.

Can also be set using `options.final` in the constructor.

#### `ws.on('finish')`

Emitted when the stream has been ended and all writes have been drained.

#### `ws.on('close')`

Emitted when the readable stream has fully closed (i.e. it's destroy function has completed)

#### `ws.on('error', err)`

Emitted if any of the stream operations fail with an error. `close` is always emitted right after this.

#### `ws.on('pipe', src)`

Emitted when a readable stream is being piped to the writable one.

#### `ws.destroyed`

Boolean property indicating wheather or not this stream has been destroyed.

#### `bool = Writable.isBackpressured(ws)`

Static method to check if a writable stream is currently under backpressure.

#### `bool = await Writable.drained(ws)`

Static helper to wait for a stream to drain the currently queued writes.
Returns true if they were drained and false otherwise if the stream was destroyed.

## Duplex Stream

#### `s = new stream.Duplex([options])`

A duplex stream is a stream that is both readable and writable.

Since JS does not support multiple inheritance it inherits directly from Readable
but implements the Writable API as well.

If you want to provide only a map function for the readable side use `mapReadable` instead.
If you want to provide only a byteLength function for the readable side use `byteLengthReadable` instead.

Same goes for the writable side but using `mapWritable` and `byteLengthWritable` instead.

## Transform Stream

A Transform stream is a duplex stream with an `._transform` template method that allows to
asynchronously map the input to a different output.

The transform stream overrides the `_write` and `_read` operations of `Readable` and `Writable` but
still allows the setting of these options in the constructor. Usually it is unnecessary to pass
in `read` or `write`/`writev` or to override the corresponding `._read`, `._write` or `._writev` operation.

#### `ts = new stream.Transform([options])`

A transform stream is a duplex stream that maps the data written to it and emits that as readable data.

Has the same options as a duplex stream except you can provide a `transform` function also.

#### `ts._transform(data, callback)`

Transform the incoming data. Call `callback(null, mappedData)` or use `ts.push(mappedData)` to
return data to the readable side of the stream.

Per default the transform function just remits the incoming data making it act as a pass-through stream.

## Pipeline

`pipeline` allows to stream form a readable through a set of duplex streams to a writable entry.

```js
const { pipeline, Readable, Transform, Writable } = require('streamx')
const lastStream = pipeline(
  Readable.from([1, 2, 3]),
  new Transform({
    transform (from, cb) {
      this.push(from.toString())
      cb()
    }
  }),
  new Writable({
    write (data, cb) {
      console.log(data)
      cb()
    }
  })
  error => {
    // Callback once write has finished
  }
)
```

#### `lastStream = stream.pipeline(...streams, [done])`

Pipe all streams together and return the last stream piped to.
When the last stream finishes the pipeline ended succesfully.

If any of the streams error, whether they are Node.js core streams
or streamx streams, all streams in the pipeline are shutdown.

Optionally you can pass a done callback to know when the pipeline is done.

#### `promise = stream.pipelinePromise(...streams)`

Same as normal pipeline except instead of returning the last stream it returns
a promise representing the done callback. Note you should error handle this
promise if you use this version.

## Utilities

Streamx aims to be minimal and stable. It therefore only contains a minimal set of utilities.
To help discover of other modules that help you build streamx apps, we link some useful utilities here

* [stream-composer](https://github.com/mafintosh/stream-composer) - Compose streams like Node's `stream.compose` and the `duplexify` and `pumpify` modules.
* [teex](https://github.com/mafintosh/teex) - Clone a readable stream into multiple new readable instances.

## Contributing

If you want to help contribute to streamx a good way to start is to help writing more test
cases, compatibility tests, documentation, or performance benchmarks.

If in doubt open an issue :)

## License

MIT

repository: ChromeDevTools/devtools-frontend

gha_language: TypeScript

repo_name: ChromeDevTools/devtools-frontend


text:
n8-make
=======
### Opinionated Makefile to build ES6 JS, JSX and Pug files

`n8-make` is a wrapper around [`make`](https://www.gnu.org/software/make/)
with a Makefile designed to compile JavaScript (and related) files for
usage with Node.js and the web browser.

By default, these file extensions get compiled into the `build` directory:

 * `.js` - Compiled via [Babel 6](https://babeljs.io) with support for [ES6](http://babeljs.io/docs/plugins/preset-es2015/) and [`async` functions](https://babeljs.io/docs/plugins/transform-async-to-generator/)
 * `.jsx` - Same as `.js`, but with the [`react`](https://www.npmjs.com/package/babel-preset-react) preset included as well
 * `.pug` - [Pug (a.k.a Jade) lang](http://jade-lang.com/) files get compiled into requireable template functions
 * `.json` - JSON files work as expected (use [`json-loader`](https://www.npmjs.com/package/json-loader) for client-side usage)

Installation
------------

Install with `npm`:

``` bash
$ npm install --save-dev n8-make
```

Usage
-----

The `n8-make` command invokes the system's `make` with its Makefile.
Any arguments you pass to `n8-make` get passed along to `make`.

The Makefile has a few built-in rules:

#### build (default)

``` bash
$ n8-make
# or
$ n8-make build
```

Compiles all files matching the extensions in the current directory
and nested directories.

A few paths are ignored by default, and will not be compiled:

 * `build` (or whatever `$(BUILDDIR)` get set to)
 * `node_modules`
 * `public`
 * `webpack.config.js`

You may override the default ignore paths by defining the `IGNORE` env variable.

### clean

``` bash
$ n8-make clean
```

Deletes the `build` directory (or whatever `$(BUILDDIR)` get set to).

### distclean

``` bash
$ n8-make distclean
```

Deletes the `node_modules` directory.

### Root directory

The root directory that source files will be found in can be defined by
setting the `ROOT` env variable:

``` bash
$ n8-make build ROOT=lib
```

This would only compile source files from the `lib` directory relative to the
current working directory into the `build/lib` dir.

Another option is to utilize Make's `--directory`/`-C` option:

``` bash
$ n8-make build --directory lib
```

This would do the same thing, but the `build` dir would end up inside of `lib`,
rather then relative to your current working directory.

### Custom extensions

For every file that gets compiled, a specialized executable is invoked for each
file extension. For example, given the `.js` file extension, n8-make will invoke
`n8-make-js inputfile.js build/outputfile.js` and the output file is generated
from there.

You may override the default extensions by passing `EXTENSIONS` env to n8-make.
Say you wanted to use n8-make to compile `.coffee` files into js:

``` bash
$ n8-make build EXTENSIONS=coffee
```

But make sure you have a `n8-make-coffee` executable in your $PATH at this
point!

__*HINT!*__ n8-make inherits npm's `bin` directory, so you can utilize
`devDependencies` in your package.json file to include said executable.

### Extending the Makefile

If you would still prefer to have your own Makefile, say to add additional rules
or tweak existing variables, then you can easily extend the n8-make Makefile using
the following syntax:

``` make
include $(shell node -e "require('n8-make')")
```

This assumes that `n8-make` is a dependency of your project.

Debug
-----

To get debugging log output from `n8-make`, include "n8-make" in the `DEBUG` env
variable:

``` bash
$ DEBUG=n8-make n8-make build
n8-make: will compile extensions = js jsx pug
n8-make: ignoring paths = build node_modules webpack.config.js public
n8-make: source files = j.pug r.jsx t.js package.json
n8-make: output files = build/j.js build/r.js build/t.js build/package.json
…
```

License
-------

(The MIT License)

Copyright (c) 2016 Nathan Rajlich<EMAIL_ADDRESS>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

gha_language: Makefile


text:
Brochard
========

Orchard vNext

Getting Started
---------------

First install the KVM, and make sure you are on the Dev Branch. You will know this once you do a kvm update and it pulls down beta-3 files. Also note you should be using the CLR and not CoreCLR for the time being (unless you want to get it running in CoreCLR and do a PR back)

git clone https://github.com/OrchardCMS/Brochard.git

load in VS15 and Build - Check the project properties to make sure you are targetting the right runtime. (target the one you use as default in 'kvm list')

Next run "k web" from Brochard\src\OrchardVNext.Web

repository: mihaluo/Brochard

repo_name: mihaluo/Brochard


text:
# short-uuid

[![npm](https://img.shields.io/npm/v/short-uuid.svg)](https://www.npmjs.com/package/short-uuid)
[![Code Climate](https://codeclimate.com/github/oculus42/short-uuid/badges/gpa.svg)](https://codeclimate.com/github/oculus42/short-uuid)
[![Test Coverage](https://codeclimate.com/github/oculus42/short-uuid/badges/coverage.svg)](https://codeclimate.com/github/oculus42/short-uuid/coverage)

Generate and translate standard UUIDs into shorter - or just *different* - formats and back.

## v4.2.2

### Major Changes in 4.0.0

- 🛑 short-uuid will now throw an error when provided an alphabet with duplicate characters. Duplicate characters will cause translation errors.
- ℹ 4.0.0 is written in modern ECMAScript. It uses features through ES9/ES2018.
- ℹ By default, short-uuid will pad shortened IDs to a consistent length.
  - Padding does not affect translation, and the values are compatible with previous releases.
  - Padding can be disabled with the option `consistentLength: false` when instantiating a translator. This is consistent with previous versions.
- ℹ 4.x does not include a pre-built version for browsers. If needed, 3.1.1 is compatible, but does not pad to a consistent length.

### Quick Start

```javascript
const short = require('short-uuid');

// Quick start with flickrBase58 format
short.generate(); // 73WakrfVbNJBaAmhQtEeDv
```

### Details

short-uuid starts with RFC4122 v4-compliant UUIDs and translates them
into other, usually shorter formats. It also provides translators
to convert back and forth from RFC compliant UUIDs to the shorter formats.

As of 4.0.0, formats return consistent-length values unless specifically requested.
This is done by padding the start with the first (`[0]`) character in the alphabet.
Previous versions can translate padded formats back to UUID.

```javascript
const short = require('short-uuid');

const translator = short(); // Defaults to flickrBase58
const decimalTranslator = short("0123456789"); // Provide a specific alphabet for translation
const cookieTranslator = short(short.constants.cookieBase90); // Use a constant for translation

// Generate a shortened v4 UUID
translator.new(); // mhvXdrZT4jP5T8vBxuvm75
translator.generate(); // An alias for new.

// Translate UUIDs to and from the shortened format
translator.toUUID(shortId); // a44521d0-0fb8-4ade-8002-3385545c3318
translator.fromUUID(regularUUID); // mhvXdrZT4jP5T8vBxuvm75

// Generate plain UUIDs
// - From the library without creating a translator
short.uuid(); // fd5c084c-ff7c-4651-9a52-37096242d81c
// - Each translator provides the uuid.v4() function, too
translator.uuid(); // 3023b0f5-ec55-4e75-9cd8-104700698052

// See the alphabet used by a translator
translator.alphabet;

// The maximum length a translated uuid will be with its alphabet.
translator.maxLength;

// View the constants
short.constants.flickrBase58; // Avoids similar characters (0/O, 1/I/l, etc.)
short.constants.cookieBase90; // Safe for HTTP cookies values for smaller IDs.
```

### Options

short-uuid 4.0.0 adds support for options when creating a translator.
This will support additional configuration in the future.

```javascript
const short = require('short-uuid');

// By default shortened values are now padded for consistent length.
// If you want to produce variable lengths, like in 3.1.1
const translator = short(short.constants.flickrBase58, {
  consistentLength: false,
});

// Generate a shortened v4 UUID
translator.new(); // mhvXdrZT4jP5T8vBxuvm75
```
* `consistentLength` - Controls padding on shortened values. Default is `true`.

## Support

short-uuid 4.0.0 and later is confirmed to work on Node 8.x and later.
- Pre-compiled browser version is planned for future release.

short-uuid [3.1.1](https://github.com/oculus42/short-uuid/blob/v3.1.1/README.md)
and lower is confirmed to work on Node 0.10.x and later,
and browsers with a precompiled library proposed
by [voronianski](https://github.com/voronianski).

## Notes

short-uuid provides RFC4122 v4-compliant UUIDs,
thanks to [`uuid`](https://github.com/uuidjs/uuid).

TypeScript definitions are included, thanks to
[alexturek](https://github.com/alexturek).

## Recent Release Notes
4.1.0 adds a maxLength value to translators for reference
4.0.3 fixes default generate
4.0.1 adds consistent length translation and throws an error if provided an invalid alphabet.
3.1.1 updated dev dependencies which required dropping Node 4.x build test. Last Browserify distribution version temporarily.
2.3.4 corrects the behavior for UUIDs with uppercase letters. Last version to build on Node 0.x.

Please see [Revisions](revisions.md) for information on previous versions.

branch_name: refs/heads/develop