QCCore QuickChick
The G Monad
Check returnGen.
===> returnGen : ?A -> G ?A
(* Sample (returnGen 42). *)
===> [42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42]
Check bindGen.
===> bindGen : G ?A -> (?A -> G ?B) -> G ?B
Instance gMonad : `{Monad G} | 3 :=
{
ret := @returnGen;
bind := @bindGen
}.
Primitive generators
Check @choose.
===> @choose : forall A : Type, ChoosableFromInterval A -> A * A -> G A
Print ChoosableFromInterval.
===> Record ChoosableFromInterval (A : Type) : Type := Build_ChoosableFromInterval { super : Ord A; randomR : A * A -> RandomSeed -> A * RandomSeed; ... }.
(* Sample (choose (0,10)). *)
===> [ 1, 2, 1, 9, 8, 1, 3, 6, 2, 1, 8, 0, 1, 1, 3, 5, 4, 10, 4, 6 ]
Exercise: 1 star, optional (cfi)
Print out the full definition of ChoosableFromInterval. Can you understand what it means? ☐Lists
Check listOf.
===> listOf : G ?A -> G (list ?A)
(* Sample (listOf (choose (0,4))). *)
===> [ [ 0, 3, 2, 0 ], [ 1, 3, 4, 1, 0, 3, 0, 2, 2, 3, 2, 2, 2, 0, 4, 2, 3, 0, 1 ], [ 3, 4, 3, 1, 2, 4, 4, 1, 0, 3, 4, 3, 2, 2, 4, 4, 1 ], [ 0 ], [ 4, 2, 3 ], [ 3, 3, 4, 0, 1, 4, 3, 2, 4, 1 ], [ 0, 4 ], [ ], [ 1, 0, 1, 3, 1 ], [ 0, 0 ], [ 1, 4 ], [ 4, 3, 2, 0, 2, 2, 4, 0 ], [ 1, 1, 0, 0, 1, 4 ], [ 2, 0, 2, 1, 3, 3 ], [ 4, 3, 3, 0, 1 ], [ 3, 3, 3 ], [ 3, 2, 4 ], [ 1, 2 ], [ ], [ ] ]
Check vectorOf.
===> vectorOf : nat -> G ?A -> G (list ?A)
(* Sample (vectorOf 3 (choose (0,4))). *)
===> [ [0, 1, 4], [1, 1, 0], [3, 3, 3], [0, 2, 1], [1, 3, 2], [3, 3, 0], [3, 0, 4], [2, 3, 3], [3, 2, 4], [1, 2, 3], [2, 0, 4] ]
Module DefineG.
Inductive G (A:Type) : Type :=
| MkG : (nat → RandomSeed → A) → G A.
End DefineG.
When it is searching for counterexamples, QuickChick progressively
tries larger and larger values for the size bound n, in order to
explore larger and deeper part of the search space.
Each generator can choose to interpret the size bound however it
wants, and there is no enforced guarantee that generators pay
attention to it at all; however, it is good practice to respect
this bound when programming new generators.
Custom Generators
Inductive color := Red | Green | Blue | Yellow.
In order for commands like Sample to display colors, we should
make color an instance of the Show typeclass:
Require Import String. Open Scope string.
Instance show_color : Show color :=
{| show c :=
match c with
| Red ⇒ "Red"
| Green ⇒ "Green"
| Blue ⇒ "Blue"
| Yellow ⇒ "Yellow"
end
|}.
Now, to generate a random color, we just need to pick one of the
constructors Red, Green, Blue, or Yellow. This is done
using elements.
Check elements.
===> elements : ?A -> list ?A -> G ?A
Definition genColor' : G color :=
elements Red [ Red ; Green ; Blue ; Yellow ].
(* Sample genColor'. *)
===> [Red, Green, Blue, Blue, Red, Yellow, Blue, Red, Blue, Blue, Red]
" 'elems' [ x ] " := elements x (cons x nil) " 'elems' [ x ; y ] " := elements x (cons x (cons y nil)) " 'elems' [ x ; y ; .. ; z ] " := elements x (cons x (cons y (.. (cons z nil)))) " 'elems' ( x ;; l ) " := elements x (cons x l)
Definition genColor : G color :=
elems [ Red ; Green ; Blue ; Yellow ].
(* Sample genColor. *)
===> [Red, Green, Blue, Blue, Red, Yellow, Blue, Red, Blue, Blue, Red]
Inductive Tree A :=
| Leaf : Tree A
| Node : A → Tree A → Tree A → Tree A.
Arguments Leaf {A}.
Arguments Node {A} _ _ _.
Before getting to generators for trees, we again give a
straightforward Show instance. (The need for a local let fix
declaration stems from the fact that Coq's typeclasses (unlike
Haskell's) are not automatically recursive. We could
alternatively define aux with a separate top-level
Fixpoint.)
Instance showTree {A} `{_ : Show A} : Show (Tree A) :=
{| show :=
let fix aux t :=
match t with
| Leaf ⇒ "Leaf"
| Node x l r ⇒
"Node (" ++ show x ++ ") (" ++ aux l ++ ") (" ++ aux r ++ ")"
end
in aux
|}.
Now we come to the first generator combinator, called oneof.
Check oneof.
===> oneof : G ?A -> list (G ?A) -> G ?A
Fixpoint genTree {A} (g : G A) : G (Tree A) := oneOf [ ret Leaf ;; liftM3 Node g (genTree g) (genTree g) ].
Fixpoint genTreeSized {A} (sz : nat) (g : G A) : G (Tree A) :=
match sz with
| O ⇒ ret Leaf
| S sz' ⇒ oneOf
[ ret Leaf ;
liftM3 Node g (genTreeSized sz' g) (genTreeSized sz' g)
]
end.
(* Sample (genTreeSized 3 (choose(0,3))). *)
===> [ Leaf, Leaf, Node (3) (Node (0) (Leaf) (Leaf)) (Node (2) (Leaf) (Node (3) (Leaf) (Leaf))), Leaf, Leaf, Leaf, Node (1) (Leaf) (Node (1) (Leaf) (Node (0) (Leaf) (Leaf))), Leaf, Node (3) (Leaf) (Leaf), Node (1) (Leaf) (Leaf), Leaf, Leaf, Node (0) (Leaf) (Node (0) (Leaf) (Node (2) (Leaf) (Leaf))), Node (0) (Node (2) (Node (3) (Leaf) (Leaf)) (Leaf)) (Leaf), Node (0) (Leaf) (Leaf), Leaf, Leaf, Leaf, Leaf, Leaf ]
Check frequency.
===> frequency : G ?A -> seq (nat * G ?A) -> G ?A
Fixpoint genTreeSized' {A} (sz : nat) (g : G A) : G (Tree A) :=
match sz with
| O ⇒ ret Leaf
| S sz' ⇒
freq [ (1, ret Leaf) ;
(sz, liftM3 Node g (genTreeSized' sz' g)
(genTreeSized' sz' g))
]
end.
(* Sample (genTreeSized' 3 (choose(0,3))). *)
===> [ Node (3) (Node (1) (Node (3) (Leaf) (Leaf)) (Leaf)) (Node (0) (Leaf) (Node (3) (Leaf) (Leaf))), Leaf, Node (2) (Node (1) (Leaf) (Leaf)) (Leaf), Node (0) (Leaf) (Node (0) (Node (2) (Leaf) (Leaf)) (Node (0) (Leaf) (Leaf))), Node (1) (Node (2) (Leaf) (Node (0) (Leaf) (Leaf))) (Leaf), Node (0) (Node (0) (Leaf) (Node (3) (Leaf) (Leaf))) (Node (2) (Leaf) (Leaf)), Node (1) (Node (3) (Node (2) (Leaf) (Leaf)) (Node (3) (Leaf) (Leaf))) (Node (1) (Leaf) (Node (2) (Leaf) (Leaf))), Node (0) (Node (0) (Node (0) (Leaf) (Leaf)) (Node (1) (Leaf) (Leaf))) (Node (2) (Node (3) (Leaf) (Leaf)) (Node (0) (Leaf) (Leaf))), Node (2) (Node (2) (Leaf) (Leaf)) (Node (1) (Node (2) (Leaf) (Leaf)) (Node (2) (Leaf) (Leaf))), Node (2) (Node (3) (Node (2) (Leaf) (Leaf)) (Leaf)) (Node (0) (Node (2) (Leaf) (Leaf)) (Leaf)), Leaf, Node (2) (Node (3) (Node (3) (Leaf) (Leaf)) (Leaf)) (Leaf), Leaf, Node (1) (Leaf) (Leaf), Leaf, Node (1) (Node (2) (Leaf) (Node (3) (Leaf) (Leaf))) (Node (0) (Leaf) (Node (1) (Leaf) (Leaf))), Leaf, Node (3) (Node (0) (Node (0) (Leaf) (Leaf)) (Leaf)) (Node (0) (Leaf) (Node (2) (Leaf) (Leaf))), Node (2) (Node (2) (Node (0) (Leaf) (Leaf)) (Leaf)) (Node (1) (Leaf) (Node (2) (Leaf) (Leaf))), Leaf ]
Exercise: 2 stars (genListSized)
Write a sized generator for lists, following genTreeSized'.(* FILL IN HERE *)
Exercise: 3 stars (genColorOption)
Write a custom generator for values of type option color. Make it generate None about 1/10th of the time, and make it generate Some Red three times as often as the other colors.(* FILL IN HERE *)
Checkers
Fixpoint mirror {A : Type} (t : Tree A) : Tree A :=
match t with
| Leaf ⇒ Leaf
| Node x l r ⇒ Node x (mirror r) (mirror l)
end.
To formulate a property about mirror, we also need a simple
structural equality on trees:
Fixpoint eq_tree (t1 t2 : Tree nat) : bool :=
match t1, t2 with
| Leaf, Leaf ⇒ true
| Node x1 l1 r1, Node x2 l2 r2 ⇒
beq_nat x1 x2 && eq_tree l1 l2 && eq_tree r1 r2
| _, _ ⇒ false
end.
We expect that mirror should be "unipotent": mirroring a tree
twice yields the original tree.
Definition mirrorP (t : Tree nat) := eq_tree (mirror (mirror t)) t.
Now we want to use our generator to create a lot of random trees
and, for each one, check whether mirrorP returns true or
false. That is, we want to use mirrorP to build a generator
for test results.
Let's open a playground module so we can show simplified versions
of the actual QuickChick definitions.
Module CheckerPlayground1.
First, we need a type of test results — let's call it Result.
For the moment, think of Result as just an enumerated type with
constructors Success and Failure.
Inductive Result := Success | Failure.
Instance showResult : Show Result :=
{
show r := match r with Success ⇒ "Success" | Failure ⇒ "Failure" end
}.
Then we can define the type Checker to be G Result.
Definition Checker := G Result.
That is, a Checker embodies some way of performing a randomized
test about the truth of some proposition, which will yield either
Success (meaning that the proposition survived this test) or
Failure (meaning that this test demonstrated that the
proposition was false). Sampling a Checker many times causes
many different tests to be performed.
To check mirrorP, we'll need a way to build a Checker out of a
function from trees to booleans. But let's start simpler and see
how to build a Checker out of a bool.
Actually, we will be wanting to build Checkers based on many
different types. So let's begin by defining a typeclass
Checkable, where an instance for Checkable A provides a way of
converting an A into a Checker.
Class Checkable A :=
{
checker : A → Checker
}.
Now we want to give a bool instance for Checkable.
Instance checkableBool : Checkable bool :=
{
checker b := if b then ret Success else ret Failure
}.
That is, the boolean value true passes every test we might
subject it to, while false fails all tests.
Let's see what happens if we sample checkers for our favorite
booleans, true and false.
(We need to exit the playground so that we can do Sample,
because Sample is implemented internally via extraction to
OCaml, which usually does not work from inside a Module.)
End CheckerPlayground1.
(* Sample (CheckerPlayground1.checker true). *)
[Success, Success, Success, Success, Success, Success, Success, Success, Success, Success, Success]
(* Sample (CheckerPlayground1.checker false). *)
[Failure, Failure, Failure, Failure, Failure, Failure, Failure, Failure, Failure, Failure, Failure]
Module CheckerPlayground2.
Export CheckerPlayground1.
Instance checkableDec `{P : Prop} `{Dec P} : Checkable P :=
{
checker p := if P? then ret Success else ret Failure
}.
(The definition looks a bit strange since it doesn't use its
argument p. The intuition is that all the information in p is
already encoded in P!)
Now suppose we pose a couple of (decidable) conjectures:
Conjecture c1 : 0 = 42.
Conjecture c2 : 41 + 1 = 42.
End CheckerPlayground2.
The somewhat astononishing thing about the Checkable instance we
defined is that, even though these are conjectures (we haven't
proved them, so the "evidence" that Coq has for them internally is
just an uninstantiated "evar"), but — because the Checkable
instance for decidable properties does not look at its argument —
we can still build checkers from them and sample from these
checkers!
(* Sample (CheckerPlayground1.checker CheckerPlayground2.c1). *)
[Failure, Failure, Failure, Failure, Failure, Failure, Failure, Failure, Failure, Failure, Failure]
(* Sample (CheckerPlayground1.checker CheckerPlayground2.c2). *)
[Success, Success, Success, Success, Success, Success, Success, Success, Success, Success, Success]
Module CheckerPlayground3.
Import CheckerPlayground2.
Now let's go back to mirrorP.
We have seen that the result of mirrorP is Checkable. What we
need is a way of taking a function returning a checkable thing and
making the function itself checkable. We can easily do this, as
long as the argument type of the function is something we know how
to generate!
Definition forAll {A B : Type} `{Checkable B}
(g : G A) (f : A → B)
: Checker :=
a <- g ;;
checker (f a).
End CheckerPlayground3.
Let's try this out. We can define a boolean test that returns true
for Red and false for other colors.
Definition isRed c :=
match c with
Red ⇒ true
| _ ⇒ false
end.
Since we can generate elements of color and we have a
Checkable instance for bool, we can apply forAll to isRed
and sample from the resulting Checker to run some tests.
(* Sample (CheckerPlayground3.forAll genColor isRed). *)
[Success, Failure, Failure, Failure, Success, Failure, Failure, Success, Failure, Failure, Success]
(*
Sample (CheckerPlayground3.forAll
(genTreeSized' 3 (choose(0,3)))
mirrorP).
*)
[Success, Success, Success, Success, Success, Success, Success, Success, Success, Success, Success]
Definition faultyMirrorP (t : Tree nat) := eq_tree (mirror t) t.
(*
Sample (CheckerPlayground3.forAll
(genTreeSized' 3 (choose(0,3)))
faultyMirrorP).
*)
[Failure, Success, Failure, Success, Success, Success, Failure, Success, Failure, Failure, Success]
Module CheckerPlayground4.
Inductive Result :=
| Success : Result
| Failure : ∀ {A} `{Show A}, A → Result.
Instance showResult : Show Result :=
{
show r := match r with
Success ⇒ "Success"
| Failure A showA a ⇒ "Failure: " ++ show a
end
}.
Definition Checker := G Result.
Class Checkable A :=
{
checker : A → Checker
}.
Instance showUnit : Show unit :=
{
show u := "tt"
}.
The failure cases in the bool and Dec checkers don't need to
record anything except the Failure, so we put tt (the sole
value of type unit) as the "failure reason."
Instance checkableBool : Checkable bool :=
{
checker b := if b then ret Success else ret (Failure tt)
}.
Instance checkableDec `{P : Prop} `{Dec P} : Checkable P :=
{
checker p := if P? then ret Success else ret (Failure tt)
}.
The interesting case is the forAll combinator. Here, we do
have some interesting information to record in the failure case —
namely, the argument that caused the failure.
Definition forAll {A B : Type} `{Show A} `{Checkable B}
(g : G A) (f : A → B)
: Checker :=
a <- g ;;
r <- checker (f a) ;;
match r with
Success ⇒ ret Success
| Failure B showB b ⇒ ret (Failure (a,b))
end.
Note that, rather than just returning Failure a, we package up
a together with b, which is the "reason" for the failure of f
a. This allows us to write several forAlls in sequence and
capture all of their results in a nested tuple.
End CheckerPlayground4.
(*
Sample (CheckerPlayground4.forAll
(genTreeSized' 3 (choose(0,3)))
faultyMirrorP).
*)
[Failure: (Node (2) (Node (3) (Node (2) (Leaf) (Leaf)) (Leaf)) (Node (0) (Node (2) (Leaf) (Leaf)) (Leaf)), tt), Success, Failure: (Node (2) (Node (3) (Node (3) (Leaf) (Leaf)) (Leaf)) (Leaf), tt), Success, Success, Success, Failure: (Node (1) (Node (2) (Leaf) (Node (3) (Leaf) (Leaf))) (Node (0) (Leaf) (Node (1) (Leaf) (Leaf))), tt), Success, Failure: (Node (3) (Node (0) (Node (0) (Leaf) (Leaf)) (Leaf)) (Node (0) (Leaf) (Node (2) (Leaf) (Leaf))), tt), Failure: (Node (2) (Node (2) (Node (0) (Leaf) (Leaf)) (Leaf)) (Node (1) (Leaf) (Node (2) (Leaf) (Leaf))), tt), Success]
(*
QuickChick
(forAll
(genTreeSized' 3 (choose(0,3)))
faultyMirrorP).
*)
QuickChecking (forAll (genTreeSized' 3 (choose (0, 3))) faultyMirrorP) Node (0) (Node (0) (Node (2) (Leaf) (Leaf)) (Node (1) (Leaf) (Leaf))) (Node (1) (Node (0) (Leaf) (Leaf)) (Leaf)) *** Failed after 1 tests and 0 shrinks. (0 discards)
Shrinking
Instance shrinkColor : Shrink color :=
{
shrink c :=
match c with
| Red ⇒ [ ]
| Green ⇒ [ Red ]
| Blue ⇒ [ Red; Green ]
| Yellow ⇒ [ Red; Green; Blue ]
end
}.
Most of the time, shrinking functions should try to return
elements that are "one step smaller" than the one they are
given. For example, consider the default shrinking function for
lists provided by QuickChick.
Print shrinkList.
===> shrinkList = fun (A : Type) (H : Shrink A) => {| shrink := shrinkListAux shrink |} : forall A : Type, Shrink A -> Shrink (list A)
Print shrinkListAux.
===> shrinkListAux = fix shrinkListAux (A : Type) (shr : A -> list A) (l : list A) : list (list A) := match l with | [] => [] | x :: xs => ((xs :: map (fun xs' : list A => x :: xs') (shrinkListAux A shr xs)) ++ map (fun x' : A => x' :: xs) (shr x)) end : forall A : Type, (A -> list A) -> list A -> list (list A)
Open Scope list.
Fixpoint shrinkTreeAux {A}
(s : A → list A) (t : Tree A)
: list (Tree A) :=
match t with
| Leaf ⇒ []
| Node x l r ⇒ [l] ++ [r] ++
map (fun x' ⇒ Node x' l r) (s x) ++
map (fun l' ⇒ Node x l' r) (shrinkTreeAux s l) ++
map (fun r' ⇒ Node x l r') (shrinkTreeAux s r)
end.
Instance shrinkTree {A} `{Shrink A} : Shrink (Tree A) :=
{| shrink x := shrinkTreeAux shrink x |}.
With shrinkTree in hand, we can use the forAllShrink property
combinator, a variant of forAll that takes a shrinker as an
additional argument, to test properties like faultyMirrorP.
QuickChick
(forAllShrink
(genTreeSized' 5 (choose (0,5)))
shrink
faultyMirrorP).
===> Node (0) (Leaf) (Node (0) (Leaf) (Leaf)) *** Failed! After 1 tests and 8 shrinks
Exercise: Ternary Trees
Inductive TernaryTree A :=
| TLeaf : TernaryTree A
| TNode :
A → TernaryTree A → TernaryTree A → TernaryTree A → TernaryTree A.
Arguments TLeaf {A}.

Also consider the following (faulty?) mirror function on
ternary trees, as well as an
Fixpoint tern_mirror {A : Type} (t : TernaryTree A) : TernaryTree A :=
match t with
| TLeaf ⇒ TLeaf
| TNode x l m r ⇒ TNode x (tern_mirror r) m (tern_mirror l)
end.
Finally, here is a function that converts a tree to a list using
an in-order traversal.
Definition tern_to_list {A : Type} (t : TernaryTree A) : list A :=
let fix aux t def :=
match t with
| TLeaf ⇒ def
| TNode x l m r ⇒
aux l [] ++ aux m [x] ++ aux r []
end in
aux t [].
(* FILL IN HERE *)
(* FILL IN HERE *)
The following line should generate a bunch of nat ternary trees.
(* Sample (@genTernTreeSized nat 3 (choose (0,10))). *)
☐
(* FILL IN HERE *)
Definition tern_mirror_reverse (t : TernaryTree nat) :=
tern_to_list (tern_mirror t) = List.rev (tern_to_list t) ?.
tern_to_list (tern_mirror t) = List.rev (tern_to_list t) ?.
Exercise: 4 stars (bug_finding_tern_tree)
Using genTernTreeSized and shrinkTernTree find (and fix!) any bugs in tern_mirror.(* FILL IN HERE *)
Putting it all Together
Module DefineGen.
Class Gen (A : Type) :=
{
arbitrary : G A
}.
End DefineGen.
That is, Gen is a way of packaging generators for various types
so that we do not need to remember their names — we can just call
them all arbitrary.
Instance gen_color : Gen color :=
{
arbitrary := genColor
}.
Next, for convenience we package Gen and Shrink together into
an Arbitrary typeclass that is a subclass of both.
Module DefineArbitrary.
Import DefineGen.
Class Arbitrary (A : Type) `{Gen A} `{Shrink A}.
(The empty "body" of Arbitrary is elided.)
End DefineArbitrary.
We can use the top-level QuickChick command on quantified
propositions with generatable decidable conclusions, stating just
the property and letting the typeclass machinery figure out the
rest. For example, suppose we want to test this:
Conjecture every_color_is_red : ∀ c, c = Red.
Since we have already defined Gen and Shrink instances for
color, we automatically get an Arbitrary instance. The Gen
part is used by the checker instances for ∀ propositions to
generate random color arguments.
To show that the conclusion is decidable, we need to define a
Dec instance for equality on colors.
Instance eq_dec_color (x y : color) : Dec (x = y).
Proof.
Print Dec. apply Build_Dec. unfold ssrbool.decidable. decide equality.
Defined.

Import DefineG.

End DefineSized.
To streamline assembling generators, it is convenient to introduce
one more typeclass, GenSized, whose instances are sized
generators.
Module DefineGenSized.
Class GenSized (A : Type) :=
{
arbitrarySized : nat → G A
}.
We can then define a generic Gen instance for types that have a
GenSized instance, using sized:
Instance GenOfGenSized {A} `{GenSized A} : Gen A :=
{
arbitrary := sized arbitrarySized
}.
End DefineGenSized.
Now we can make a Gen instance for trees by providing just an
implementation of arbitrarySized.
Instance genTree {A} `{Gen A} : GenSized (Tree A) :=
{| arbitrarySized n := genTreeSized' n arbitrary |}.
Finally, with the Arbitrary instance for trees, we can supply
just faultyMirrorP to the QuickChick command.
(* QuickChick faultyMirrorP. *)
Exercise: 2 stars (tern_tree_typeclasses)
Add typeclass instances for GenSized and Shrink so that you can QuickChick tern_mirror_reverse directly.(* FILL IN HERE *)
(* QuickChick tern_mirror_reverse. *)
Automation
Derive Arbitrary for Tree.
(* ===> genSTree is defined *)
(* ===> shrTree is defined *)
Print genSTree.
Print shrTree.
Derive Show for Tree.
(* ===> showTree0 is defined *)
Print showTree0.
Collecting Statistics
Check @collect.
===>
That is, collect takes a checkable proposition and returns a new
Checker (intuitively, for the same proposition).
On the side, it takes a value from some Showable type A, which
it remembers internally (in an enriched variant of the Result
structure that we saw above) so that it can be displayed at the
end.
For example, suppose we measure the size of Trees like this:
@collect : forall A prop : Type, Show A -> Checkable prop -> A -> prop -> Checker
Fixpoint size {A} (t : Tree A) : nat :=
match t with
| Leaf ⇒ O
| Node _ l r ⇒ 1 + size l + size r
end.
Now we can write a dummy property treeProp to check our
generators and measure the size of generated trees.
Definition treeProp (g : nat → G nat → G (Tree nat)) n :=
forAll (g n (choose (0,n))) (fun t ⇒ collect (size t) true).
(* QuickChick (treeProp genTreeSized 5). *)
===> 4947 : 0 1258 : 1 673 : 2 464 : 6 427 : 5 393 : 3 361 : 7 302 : 4 296 : 8 220 : 9 181 : 10 127 : 11 104 : 12 83 : 13 64 : 14 32 : 15 25 : 16 16 : 17 13 : 18 6 : 19 5 : 20 2 : 21 1 : 23 +++ OK, passed 10000 tests
(* QuickChick (treeProp genTreeSized' 5). *)
===> 1624 : 0 571 : 10 564 : 12 562 : 11 559 : 9 545 : 8 539 : 14 534 : 13 487 : 7 487 : 15 437 : 16 413 : 6 390 : 17 337 : 5 334 : 1 332 : 18 286 : 19 185 : 4 179 : 20 179 : 2 138 : 21 132 : 3 87 : 22 62 : 23 19 : 24 10 : 25 6 : 26 2 : 27 +++ OK, passed 10000 tests
Dealing with Preconditions
Consider inserting natural numbers in a sorted list (in ascending
order).
Fixpoint sorted (l : list nat) :=
match l with
| [] ⇒ true
| x::xs ⇒ match xs with
| [] ⇒ true
| y :: ys ⇒ (x <=? y) && (sorted xs)
end
end.
Fixpoint insert (x : nat) (l : list nat) :=
match l with
| [] ⇒ [x]
| y::ys ⇒ if x <=? y then x :: l
else y :: insert x ys
end.
We could test insert using the following conditional property:
Definition insert_spec (x : nat) (l : list nat) :=
sorted l ==> sorted (insert x l).
(* QuickChick insert_spec. *)
===> QuickChecking insert_spec +++ Passed 10000 tests (17325 discards)
Definition insert_spec' (x : nat) (l : list nat) :=
collect (List.length l) (insert_spec x l).
(* QuickChick insert_spec'. *)
==> QuickChecking insert_spec' 3447 : 0 3446 : 1 1929 : 2 788 : 3 271 : 4 96 : 5 19 : 6 4 : 7 +++ Passed 10000 tests (17263 discards)
Fixpoint genSortedList (low high : nat) (size : nat)
: G (list nat) :=
match size with
| O ⇒ ret []
| S size' ⇒
if high <? low then
ret []
else
freq [ (1, ret []) ;
(size, x <- choose (low, high);;
xs <- genSortedList x high size';;
ret (x :: xs)) ] end.
We use a size parameter as usual to control the length of generated
lists.
If size is zero, we can only return the empty list which
is always sorted. If size is nonzero, we need to perform an
additional check if high is less than low (where we also
return the empty list). If it is not, we can proceed to choose to
generate a cons cell, with its head generated between low and high
and its tail generated recursively.
(* Sample (genSortedList 0 10 10). *)
Use forAllShrink to define a property using the new generator:
Definition insert_spec_sorted (x : nat) :=
forAllShrink (genSortedList 0 10 10) shrink (fun l ⇒ insert_spec' x l).
Now the distribution of lengths looks much better, and we don't
discard any tests!
QuickChick insert_spec_sorted.
==> QuickChecking insert_spec_sorted 947 : 0 946 : 4 946 : 10 938 : 6 922 : 9 916 : 2 900 : 7 899 : 3 885 : 8 854 : 5 847 : 1 +++ Passed 10000 tests (0 discards)
Exercise: 5 stars (uniform_sorted)
Using "collect", find out whether generating a sorted list of numbers between 0 and 5 is uniform in the frequencies with which each number is found in the generated lists.(* FILL IN HERE *)
Another Precondition: Binary Search Trees
Fixpoint isBST (low high: nat) (t : Tree nat) :=
match t with
| Leaf ⇒ true
| Node x l r ⇒ (low <? x) && (x <? high)
&& (isBST low x l) && (isBST x high r)
end.
Here is a (faulty?) insertion function for binary search trees.
Fixpoint insertBST (x : nat) (t : Tree nat) :=
match t with
| Leaf ⇒ Node x Leaf Leaf
| Node x' l r ⇒ if x <? x' then Node x' (insertBST x l) r
else Node x' l (insertBST x r)
end.
We would expect that if we insert an element that is within
the bounds low and high to a binary search tree, then
the result is also a binary search tree.
Definition insertBST_spec (low high : nat) (x : nat) (t : Tree nat) :=
(low <? x) ==>
(x <? high) ==>
(isBST low high t) ==>
isBST low high (insertBST x t).
(* QuickChick insertBST_spec. *)
==> QuickChecking insertBST_spec 0 5 4 Node (4) (Leaf) (Leaf) *** Failed after 85 tests and 1 shrinks. (1274 discards)
Fixpoint insertBST' (x : nat) (t : Tree nat) :=
match t with
| Leaf ⇒ Node x Leaf Leaf
| Node x' l r ⇒ if x <? x' then Node x' (insertBST' x l) r
else if x' <? x then Node x' l (insertBST' x r)
else t
end.
Definition insertBST_spec' (low high : nat) (x : nat) (t : Tree nat) :=
(low <? x) ==> (x <? high) ==> (isBST low high t) ==>
isBST low high (insertBST' x t).
... and try again:
(* QuickChick insertBST_spec'. *)
===> QuickChecking insertBST_spec' *** Gave up!  FILL IN HERE *)


Preparation time
less than 30 mins
Cooking time
10 to 30 mins
Serves
Serves 4
Preheat the oven to 220C/425F/Gas 7. Slice the tops off the rolls or brioches and scoop out most of the bread inside. Melt 55g/2oz of the butter. Brush the undersides of the lids and the hollows of the rolls inside and out generously with the melted butter.
Place the loaves on a baking sheet. Bake for about 10 minutes or until lightly brown. Meanwhile clean and open the oysters, drain off the liquor and reserve to one side.
While the loaves are browning, heat the remaining butter in a large frying pan. Sauté the oysters in the pan about 1 minute.
Remove the oysters from the pan with a draining spoon, cut them into 3 pieces and set aside. Add the reserved oyster liquor to the pan with the cream. Season with salt, pepper and nutmeg. Boil down steadily, stirring constantly, to form a very thick sauce, adding in the lemon juice.
Return the chopped oysters to the pan and gently reheat. Spoon the oysters and the sauce into the warmed rolls. Top with the lids and serve at once.


{% extends "base.html" %} {% block head %} {% endblock %} {% block body %}
| Authentication ID | Username | Conf ID | Submission ID | Prev Submission ID | |
|---|---|---|---|---|---|
| {{sub.authenticationid}} | {{sub.username}} | {{sub.confid}} | {{sub.submissionid}} | {{sub.prevsubmissionid}} | Delete |


12 Tips for Sous-Vide Goodness
I love my sous-vide cooking. You may have figured this out by now. For reasons why I love cooking stuff sealed in vacuum at precise temperatures, check out my previous article and the video. We’ll not go back over that stuff.
No, here I have one simple aim - to give you 10 quick tips to make your sous-vide better.
Let’s go.
h2. Universal Tips
Use kettle water to get to the right temperature This tip applies to all sous-vide, and it’s awesome. Don’t, whatever you do, start your sous-vide device from cold - instead, mix cold water with hot water from a kettle until you’re at about the right temperature. It’s the easiest way to get stovepot/oven sous-vide right to start with, and it cuts half an hour minimum off even the most pro SV setup.
Seasoning for the win Particularly for red meat, I often just use salt and pepper as a seasoning. Season both sides of your steak, for example, with salt and pepper, then vacuum-seal it. The results are just stunning - far nicer than unseasoned meat, and insanely simple. More complex seasonings will really come out in sous-vide, and are very much worth doing - although it’s sometimes a bit random what will be absorbed and what won’t be. Garlic doesn’t seem to get particularly strongly absorbed into most meats, whilst I’m told fresh thyme can easily become overpowering. Butter works great with everything. Experiment.
Cheat’s chamber sealer You might think that you can’t use liquid seasonings unless you freeze them or invest in a vacuum sealer. Actually, that’s not quite true. For starters, you can use the water seal technique below. You can also just brush meat with liquid, preferably reduced - whilst lots of liquid will get sucked out of a cheap vacuum sealer, liquid brushed onto a piece of meat seems not to be such a problem.
Cook chicken legs at 75 Yes, I know that everyone else says you should cook a chicken leg at 62C-ish. They lie. Deboned, flattened chicken thigh can be quite nice at 63, as recommended by Thomas Keller, but if you’re cooking a bone-in or rolled leg, just cook the darn thing at 75 degrees (167 Fahrenheit). It’ll be less greasy, it’ll still be very tender, and it won’t have the worrying bloody-looking bits. Since chicken legs are pretty darn cheap, this is a Really Useful Tip. In general, after reading the science you’ll be tempted to cook at as low a temperature as possible. This is not always a good idea!
Sear for longer than you think you need to This one’s a Thomas Keller tip. I used to have trouble getting a decent sear - despite a really hot pan, I just couldn’t get a good brown sear on my meat in what I thought was the maximum time of 30 seconds or so. Then I read Thomas Keller’s “Under Pressure”, where he advises in a lot of recipes to sear the sous-vided meat for two minutes on each side. Seems like far too long? Well, it seems to work pretty damn well for most things. Give it a go and see what you think!
h2. If you don’t have fancy kit
If you don’t have your very own circulator or even a controlled crockpot, these tips might well help:
Stick the pot in the oven This one doesn’t apply if you’ve got an induction hob, or if you’re really good with your gas hob. Otherwise, the best temperature hold device you’ve got in your kitchen is almost certainly your oven, and it’s also the best-insulated, meaning that temperature changes will be really gradual.  Then check it every 10 minutes and put the oven up a bit (a SMALL bit) or down a bit appropriately.
 The pressure of the water will neatly push all the air out of the bag, and you can carefully seal it.
Simple stuff Stuff that works really well cooked sous-vide in a pot and doesn’t take too long includes salmon (make sure it’s uber-fresh) and tuna, steak (gorgeous), chicken legs (see my tip above about cooking temperature) and theoretically pork steak, although I’ve not tried that.
h2. If you’re thinking of investing some cash or already have
Foodsaver and crockpot works perfectly well Nutters like me might buy proper water baths, but over a year of cooking tells me that something like a Sous-Vide Magic box plus a rice cooker or crockpot(aka a slow cooker, British people) and a FoodSaver works perfectly well to cook Sous-Vide.
Remember, you can cook from frozen If you’re considering whether to spend money, this one might tip you over the edge. You may not have considered just how handy it would be to just be able to pick a piece of meat from the freezer and cook it straight off - if you’re like me, you never get around to defrosting meat as you’re meant to over a 24-hour period. Having a sous-vide cooker almost turns any frozen meat into a ready meal - it’s fantastic. You can also cook-chill, of course, which really does turn anything you cook into a home-made ready meal.
Uncirculated baths appear to be a LOT quieter This one comes from discussion on the comments thread last post - comparing Martin’s water circulator with my unstirred bath, it appears that a major unheralded advantage of an unstirred bath is that it’s much, much quieter. Also, a bath that comes with a proper lid loses a lot less water. Both points to consider!
Long-term cooking for the win Now that you’ve got an automated bath, you can play with the most fun elements of sous-vide - fun, and convenient too.  Leave for 20 hours and you’ll have a totally unique cooked meat sensation waiting for you. And it’ll be really cheap to boot. And you can just keep the meat frozen and cook it whenever you like, because with that cooking time, the defrost won’t be a problem.
UPDATE
We’re starting a newsletter for people who are interested in sous-vide: news, tips, places to get cheap equipment, that sort of thing.
If you’re interested, sign up below:
join the Sous-Vide mailing list
Email Address
Close


Dynamo
Toggle navigation
Dynamo
Activity
Running Tasks
Tasks Backlog
History
Events
Setup
Plugins
Configuration
Feature Coming Soon!


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.uniheidelberg.cl.swp.datastructure.Word
public class Word
A word stores information about one word in a text (content form, agreement features). Each word as a unique id which refers to the exact position in the text.
| Constructor Summary | |
|---|---|
Word(java.lang.String stringForm)
Initialize a new Word object with the following information: |
|
Word(java.lang.String stringForm,
int absolutePosition)
This constructor should be used in general. |
|
Word(java.lang.String stringForm,
int sentence,
int wordPosition,
java.lang.String id)
Initialize a new Word object with the following information: |
|
Word(java.lang.String stringForm,
java.lang.String pos,
java.lang.String id)
Initialize a new Word object with the following information: |
| Method Summary | |
|---|---|
int |
compareTo(Word o)
Compares the absolute position of two words. |
int |
getAbsolutePosition()
Getter for the absolute position of a word. |
int |
getSentence()
Getter for the sentence number in which a word occurs. |
java.lang.String |
getToken()
Getter for the string representation of a word. |
int |
getWordPositionInSent()
Getter for the position of a word in a sentence. |
java.lang.String |
getXmlId()
Getter for the XML id of a word. |
void |
setAbsolutePosition(int absolute)
Setter for the absolute position of a word. |
void |
setRelativeWordPosition(int sentenceNumber,
int wordPosition)
Setter for relative position. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Word(java.lang.String stringForm, int sentence, int wordPosition, java.lang.String id)
stringForm
- String representation (Token).sentence
- Sentence position of the word.wordPosition
- Word position within the sentence.id
- Unique id for the word (usually extracted from MMAX-file).public Word(java.lang.String stringForm, int absolutePosition)
stringForm
- String form representation.absolutePosition
- Absolute position in text (counted in characters).public Word(java.lang.String stringForm, java.lang.String pos, java.lang.String id)
stringForm
- String representation (token).pos
- Part of Speech tag.id
- Unique id for the word.public Word(java.lang.String stringForm)
stringForm
- String representation (token)| Method Detail |
|---|
public void setRelativeWordPosition(int sentenceNumber, int wordPosition)
sentenceNumber
- The number of the sentence this word is located in.wordPosition
- the relative position of the word within its sentence.public java.lang.String getXmlId()
public java.lang.String getToken()
public int getSentence()
public int getWordPositionInSent()
public int getAbsolutePosition()
public void setAbsolutePosition(int absolute)
absolute
- the absolute position of this word counted in characters from the beginning
of the text.public int compareTo(Word o)
compareTo
in interface java.lang.Comparable<Word>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Page 1 of 1
Won't Respawn
Posted:
Tue Mar 10, 2009 5:36 pm
by Joe M.
Hey guys,
There's a major bug in the game right now: when you die, you won't respawn. Instead, you'll get this:
2009-03-10 - 23295.png
And this:
dead.jpg
So be careful!
Karl has a busy couple days right now (
viewtopic.php?f=25&t=1364) so he may not be able to fix it until the end of the week, but it will be fixed as soon as possible.
Re: Won't Respawn
Posted:
Tue Mar 10, 2009 8:22 pm
by Karl G.
Bug fixed. It was an easy one.
Re: Won't Respawn
Posted:
Tue Mar 10, 2009 8:33 pm
by Joe M.
Great!
Re: Won't Respawn
Posted:
Tue Mar 10, 2009 9:03 pm
by deathstalker
karl you are the man and thankyou from everyone that was affected from this bug.
and get back to your school work lol.
Re: Won't Respawn
Posted:
Wed Mar 11, 2009 3:08 am
by marzuku
hehe Damn thought i was gonna have a black out on Mm4 for some days.. thanks carl <3 btw joe im almost halfway to 15
Re: Won't Respawn
Posted:
Wed Mar 11, 2009 9:27 am
by Joe M.
You're going to pass me, Marz. I've got to buckle down on my studies for a few days until I get them under control.
So right now I'm resting about 2/3 of the way to 15, but I won't have a chance to play for a while yet. I might pop on tonight to give some gear to those who lost it with this bug, though.


An error has occurred while loading the Music.
Please, refresh the page.
Refresh
Popular music
Playlists
Upload music
My radio
My music
0
Add a playlist
Recently played
Friends' music
Search


Constants refer to fixed values that the program may not alter during its execution. These fixed values are also called literals.
Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal. There are enumeration constants as well.
Constants are treated just like regular variables except that their values cannot be modified after their definition.
An integer literal can be a decimal, octal, or hexadecimal constant. A prefix specifies the base or radix: 0x or 0X for hexadecimal, 0 for octal, and nothing for decimal.
An integer literal can also have a suffix that is a combination of U and L, for unsigned and long, respectively. The suffix can be uppercase or lowercase and can be in any order.
Here are some examples of integer literals −
212 /* Legal */ 215u /* Legal */ 0xFeeL /* Legal */ 078 /* Illegal: 8 is not an octal digit */ 032UU /* Illegal: cannot repeat a suffix */
Following are other examples of various types of integer literals −
85 /* decimal */ 0213 /* octal */ 0x4b /* hexadecimal */ 30 /* int */ 30u /* unsigned int */ 30l /* long */ 30ul /* unsigned long */
A floating-point literal has an integer part, a decimal point, a fractional part, and an exponent part. You can represent floating point literals either in decimal form or exponential form.
While representing decimal form, you must include the decimal point, the exponent, or both; and while representing exponential form, you must include the integer part, the fractional part, or both. The signed exponent is introduced by e or E.
Here are some examples of floating-point literals −
3.14159 /* Legal */ 314159E-5L /* Legal */ 510E /* Illegal: incomplete exponent */ 210f /* Illegal: no decimal or exponent */ .e55 /* Illegal: missing integer or fraction */
Character literals are enclosed in single quotes, e.g., 'x' can be stored in a simple variable of char type.
A character literal can be a plain character (e.g., 'x'), an escape sequence (e.g., '\t'), or a universal character (e.g., '\u02C0').
There are certain characters in C that represent special meaning when preceded by a backslash for example, newline (\n) or tab (\t).
| Escape sequence | Meaning |
|---|---|
| \\ | \ character |
| \' | ' character |
| \" | " character |
| \? | ? character |
| \a | Alert or bell |
| \b | Backspace |
| \f | Form feed |
| \n | Newline |
| \r | Carriage return |
| \t | Horizontal tab |
| \v | Vertical tab |
| \ooo | Octal number of one to three digits |
| \xhh . . . | Hexadecimal number of one or more digits |
Following is the example to show a few escape sequence characters −
#include <stdio.h> int main() { printf("Hello\tWorld\n\n"); return 0; }
When the above code is compiled and executed, it produces the following result −
Hello World
String literals or constants are enclosed in double quotes "". A string contains characters that are similar to character literals: plain characters, escape sequences, and universal characters.
You can break a long line into multiple lines using string literals and separating them using white spaces.
Here are some examples of string literals. All the three forms are identical strings.
"hello, dear" "hello, \ dear" "hello, " "d" "ear"
There are two simple ways in C to define constants −
Using #define preprocessor.
Using const keyword.
Given below is the form to use #define preprocessor to define a constant −
#define identifier value
The following example explains it in detail −
#include <stdio.h> #define LENGTH 10 #define WIDTH 5 #define NEWLINE '\n' int main() { int area; area = LENGTH * WIDTH; printf("value of area : %d", area); printf("%c", NEWLINE); return 0; }
When the above code is compiled and executed, it produces the following result −
value of area : 50
You can use const prefix to declare constants with a specific type as follows −
const type variable = value;
The following example explains it in detail −
#include <stdio.h> int main() { const int LENGTH = 10; const int WIDTH = 5; const char NEWLINE = '\n'; int area; area = LENGTH * WIDTH; printf("value of area : %d", area); printf("%c", NEWLINE); return 0; }
When the above code is compiled and executed, it produces the following result −
value of area : 50
Note that it is a good programming practice to define constants in CAPITALS.


{% extends "templates/layouts/container.html" %} {% block extra_style %} {% endblock %} {% block content %}
or use your email for registration
or use your account
To keep connected with us please login with your personal info
Enter your personal details and start journey with us


{{text}}
See Snekmer model CV results in file explorer: (output/model/results/)
Direct link to model results tables:
{% for tab in tables %}
{{tab}}
{% endfor %}


Highest averages & largest remainders allocating seats methods and several party system scores. Implemented highest averages allocating seats methods are D'Hondt, Webster, Danish, Imperiali, Hill-Huntington, Dean, Modified Sainte-Lague, equal proportions and Adams. Implemented largest remainders allocating seats methods are Hare, Droop, Hangenbach-Bischoff, Imperial, modified Imperial and quotas & remainders. The main advantage of this package is that ties are always reported and not incorrectly allocated. Party system scores provided are competitiveness, concentration, effective number of parties, party nationalization score, party system nationalization score and volatility. References. Gallagher (1991) <doi:10.1016/0261-3794(91)90004-C>. Norris (2004, ISBN:0-521-82977-1). Consejo Nacional Electoral del Ecuador (2014)<http://cne.gob.ec/documents/Estadisticas/Atlas/ATLAS/CAPITULO%206%20web.pdf>. Laakso & Taagepera (1979) <http://journals.sagepub.com/doi/pdf/10.1177/001041407901200101>. Jones & Mainwaring (2003) <https://kellogg.nd.edu/sites/default/files/old_files/documents/304_0.pdf>. Pedersen (1979) <http://janda.org/c24/Readings/Pedersen/Pedersen.htm>.
| Version: | 0.1.1 |
| Imports: | dplyr, ineq, tibble |
| Published: | 2018-10-25 |
| Author: | Jorge Albuja |
| Maintainer: | Jorge Albuja <albuja at yahoo.com> |
| License: | GPL-3 |
| NeedsCompilation: | no |
| Materials: | README |
| CRAN checks: | electoral results |
| Reference manual: | electoral.pdf |
| Package source: | electoral_0.1.1.tar.gz |
| Windows binaries: | r-devel: electoral_0.1.1.zip, r-release: electoral_0.1.1.zip, r-oldrel: electoral_0.1.1.zip |
| OS X binaries: | r-release: electoral_0.1.1.tgz, r-oldrel: electoral_0.1.1.tgz |
| Old sources: | electoral archive |
Please use the canonical form https://CRAN.R-project.org/package=electoral to link to this page.


This is an app to know more about Dreamcatcher.
You could get information about our awesome girls, Dreamcatcher.
All images or photos in this application are property of Dreamcatcher Company.
Ulie Luissa
Hallo, I'm an inSomnia (Dreamcatcher fans).


{% extends 'base.html' %} {% load bootstrap4 %} {% block content %}
Don't have an account? Sign up here


scikit-bio
is a Python bioinformatics library based on the standard Python
scientific computing stack that implements core bioinformatics
data structures, algorithms, parsers, and formatters. scikit-bio
is the first bioinformatics-centric scikit, and arises from over
ten years of development efforts on PyCogent and QIIME, It is
intended to be useful both for students, who can use it in
conjunction with the accompanying interactive
textbook,
An Introduction to Applied Bioinformatics,
and for real-world bioinformatics developers.
Contact:
Greg Caporaso


{% extends "layout.html" %} {% import 'forms.html' as forms %} {% block body %} {{forms.period_form(form)}}


Let see where do I start? I'm from a small city in New Jersey, called Bayonne. I've attended William Paterson University, majoring in Business management. During my tenure there, I was also a 4 year student athlete, where I was a pitcher on the baseball team. Before graduating, I came up with a really cool idea for a new mobile app, and over the last year and a half I've led a team of developers and designers to launch Fungo Golf into the Google Play store. Since rolling out that game, we have been working non stop on updating and really taking this game to the next level. Take a look at it, download it, and give me some feed back I'd really appreciate it!
After school, I had a tough time trying to find a job, so I had two part time gigs, while continuing to build this game week by week. Mostly all of the money I made would go stright to a new feature or character, etc. As time went by, I tried to teach my self how to code, which wasn't an easy task. So I did some research and found DBC, now I'm here trying to learn as much as possible, make some great connections, and really hit the ground running after graduation!


Fosun CFO Thomas Xue Still Sees Growth in China
by Investing.comInvesting.com - Hong Kong-listed Fosun International Ltd (HK:0656) has confident in the Chinese markets and believes it will continue to grow, a CNBC report said on Friday.
In an interview with CNBC during the Morgan Stanley APAC Summit, the company’s CFO Thomas Xue said he still sees growth in China, although it is “slowing down a little bit.”
“It is still one of the fastest growth economy,” Xue said. “The population is there and we believe the growth is still there.”
Xue also gave comments on reports of a bid for German bank Bankhaus Lampe.
“At this moment, probably too early to comment on that, but I know we are always looking for good opportunities to invest in certain good companies,” he said.
Fosun currently has stakes in multiple foreign companies, including France’s Club Med, Greek jeweler Folli Follie, German wealth manager Hauck & Aufhaeuser Privatbankiers, Canada’s Cirque du Soleil and American apparel brand St. John.
Fosun’s Hong Kong-traded shares gained 1.3% on Friday by 12:30 AM ET (04:30 GMT).


git log
master...develop
| inspect differences in branches |git rebase -i
HEAD~3
| rebase last 3 commits |git reset --hard
HEAD@{2}
| undo last operation that changed HEAD |git checkout
v2^{}
| checkout the v2
tag (not v2
branch) |{: .-mute-em}
The 3rd argument in each of these commands is a gitrevision
. These gitrevisions can be passed to many Git commands.
| Reference | Description |
|---|---|
git show dae68e1 |
sha1 |
git show HEAD |
reference |
git show v1.0.0 |
tag |
| — | — |
git show master |
local branch |
git show origin/master |
remote branch |
| — | — |
git show master~2 |
2 commits back from master |
| — | — |
git show master..fix |
reachable from fix but not master |
git show master...fix |
reachable from fix and master, but not both |
{: .-mute-em}
These are just the common ones, there's a lot more below! (These work in many other commands, not just git show
.)
git checkout
dae68e1
| sha1 |{: .-mute-em}
| Example | Description |
|---|---|
git checkout HEAD |
reference |
git checkout master |
branch |
git checkout v1.0.0 |
tag |
| — | — |
git checkout origin/master |
aka, refs/remotes/origin/master |
git checkout heads/master |
aka, refs/heads/master |
{: .-mute-em}
| Example | Description |
|---|---|
git checkout master@{yesterday} |
also 1 day ago, etc |
git checkout master@{2} |
2nd prior value |
git checkout master@{push} |
where master would push to |
| — | — |
git checkout master^ |
parent commit |
git checkout master^2 |
2nd parent, eg, what it merged |
git checkout master~5 |
5 parents back |
git checkout master^0 |
this commit; disambiguates from tags |
| — | — |
git checkout v0.99.8^{tag} |
can be commit, tag, tree, object |
git checkout v0.99.8^{} |
defaults to {tag} |
| — | — |
git checkout ":/fix bug" |
searches commit messages |
{: .-mute-em}
HEAD:README
| … |0:README
| (0 to 3) … |git log
master
| reachable parents from master |git log
^master
| exclude reachable parents from master |git log
master..fix
| reachable from fix but not master |git log
master...fix
| reachable from fix and master, but not both |git log
HEAD^@
| parents of HEAD |git log
HEAD^!
| HEAD, then excluding parents's ancestors |git log
HEAD^{:/fix}
| search previous HEADs matching criteria |{: .-mute-em}
A ─┬─ E ── F ── G master
│
└─ B ── C ── D fix
{: .-box-chars.-setup}
git log
master..fix
| BCD |git log
master...fix
| BCD and EFG |{: .-mute-em}


FabLab Cept
NETWORKING AND COMMUNICATIONS
For networking and communication , I decided to go for Half-duplex serial communication between an Input and Output devices. Input device was Distance sensor and Output device was RGB led.
INPUT DEVICE
With help from Gautam and Mohit, I designed a Distance sensor board. I had earlier designed a distance sensor board in previous week but could not use it for networking since it did not have Rx/Tx for communication.
1. The first step was to design the board in Eagle. I took my old board and added Rx,Tx,VCC and GND pins.
Over all the board had following components:
1. Attiny 44ssu
2. 1x6 pin male header for Distance sensor. However I used only 4 pins
3. 2x3 pin male header for AVRISP
4. 1x4 pin male header for Rx,Tx,VCC and GND.
5. 1 micro F capacitor.
Following images show the process I followed. Detailed process of Eagle and milling can be seen in the previous weeks.
Next I checked if the board was working individually.
For this I tried the following codes
Video showing distance in centimeters.
Networkings_input_01 from ARPI on Vimeo.
Video showing distance remaped to "0-1-2" as output.
Networking_input 02 from ARPI on Vimeo.
OUTPUT DEVICE
For output device, I used the board I made in previous week's assignment, which can be found here.
The code for LED was written to blink in different colours responding to input in the form of "0-1-2".
However, when the code was run later using networking, it did not work. Then I realised that since we are already providing VCC in common pin, we need to give digitalWrite as "low" for the colour that we want to blink.
Hence, the code was corrected as below. The code can be found here
Next I used an FTDI cable and connected its Rx,Tx,VCC and GND to the input device board and the networking was established
networking_final from ARPI on Vimeo.
Next, to add more boards, I decided to add more values from my input device.
I used my "hello echo" board which I made in previous week. Details can be found here.
The idea was to allow more boards to be connected. For this, one option is to call each board by giving different addresses from the computer, and the next option, which I chose, was to allow the input device to call for different boards and also define the colours of RGB led in the first board.
Following diagram shows the connections required between the boards, and Input-Output values
Master
Slave
Slave
Rx
Tx
Tx
Rx
Tx
Rx
Distance sensor
RGB LED
Hello echo "LED"
Value = 0
Output = Red
Value = 1
Output = Green
Value = 2
Output = Blue
Value = 3
Output = Led
My distance sensor code currently gave me values as 0-1-2. Here, value "0" would light up Red colour on the RGB board, "1" would light up Green and "2" would light up blue. So, again I changed the distance sensor code and increased its range to give an additional value "3". This value will give signal to light up the Led on "hello echo" board. Similarly the code can be modified to give additional values and signals can be given to additional boards as and when required.
Here is how the code looked like
I uploaded the code successfully to obtain 0-1-2-3 as values for different range of distances. I checked it on serial monitor first, before attaching the boards to the other board.
distance_including 0-1-2-3 from Arpi on Vimeo.
Next step was to write a code for "hell echo" led to light-up when it gets signal "3".
Here is how it looked like.
Next step was to write a code for "hello echo" led to light-up when it gets signal "3". Here is how it looked like. The idea was to see the LED light up once you give the value "3" from the computer. Later on when all the boards are connected, this value will come from my input device.
VID_20170709_155002 from Arpi on Vimeo.
Here is how my code for "RGB Led" looked like. In terms of logic, there was not any changes, I only changed the variable name.
I checked if my code was working individually. It would give me red, green, blue outputs for 0,1,2 respectively. However, while making the video, I by mistake pressed 2 numbers together, 0 and 1, and surprisingly it gave my violet colour. Check out the video below.
VID_20170709_143827 from Arpi on Vimeo.
Finally, since all individual codes were uploaded, I connected all 3 boards and FTDI, to check if my connections were working
VID_20170709_160928 from Arpi on Vimeo.
All files can be found here.


Your task is to construct a method, which always returns the highest of x or y
Trash
Solution
New instance Get feedback


Lazar Gugleta
Community Lead at
Google Developers
Data Scientist at
Shopreme
International Student Ambassador
at
Technische Universität Graz
Teaching assistant for lectures
"Object Oriented Programming 2"
&
"Introduction to Data Science
and Artificial Intelligence"
Bachelor studies in
Computer Science
Master studies in Computer Science
major in Data Science
Latest published articles
How To Track Coronavirus In Your Country with Python
Python GUI App In No Time
How to Get a Job with Python
Top 10 Free Automation Test Tools That Will Make Your Life Easier


Tell stories with your data.
Chronology comes with everything you need to turn metrics into insights.
The Chronology Project tackles three data-oriented tasks with three tools: Kronos (data collection), Metis (data analysis), and Jia (data visualization). These tools are loosely coupled and can stand alone, but they can also speak with one-another: Metis can query data in Kronos, and Jia can visualize the answers provided by Metis.
Kronos: Collect
Kronos is a time series storage engine that allows you to store and retrieve timestamped JSON blobs from various backends (e.g., Cassandra, Elasticsearch).
Metis: Analyze
Metis is an HTTP compute service. It's currently implemented as a thin HTTP endpoint wrapped around the Spark data processing engine.
Jia: Visualize
Jia is a visualization, dashboarding, and data exploration tool. It can speak with Kronos and Metis. It answers questions for humans, rather than just developers.


Public Member Functions | |
| ListFieldListener (Selector *selector) | |
| Creates a new list field listener. | |
| virtual void | onContentClick (Component *component, Vector position, bool rangeSelection, bool keepSelection) |
| Called when the component is clicked (usually using the left mouse button), called by the scrolling field with content-transformed coordinates. | |
| virtual void | onEnter (Component *component) |
| Called when the ENTER key is pressed on the event target, the component has the inner-most focus, and the event not handled otherwise by the component. | |
Private Member Functions | |
| void | commitSelection (Component *component) |
| Writes back the selection from the popup field to the selector. | |
Private Attributes | |
| Selector * | selector |
| The selector to create the list field listener for. |
|
|
Creates a new list field listener.
|
|
|
Writes back the selection from the popup field to the selector.
|
|
|
Called when the component is clicked (usually using the left mouse button), called by the scrolling field with content-transformed coordinates. A click is raised after the mouse has been pressed and released, and no dragging operation has started.
|
|
|
Called when the ENTER key is pressed on the event target, the component has the inner-most focus, and the event not handled otherwise by the component.
|
|
|
The selector to create the list field listener for.
Definition at line 223 of file Selector.h. |


Lesson 9 - Viz for the web with Sketchfab
NOTE: BRING PHONE + PHONE CHARGER TOMORROW
Today we’ll think about how to share 3D interactive movies on the web.
Make sure you download:
- The Planet Files - shapes and surfaces and save them to a specific directory. This includes the library needed to make geometry files from your simulations.
- You’ll want to also download Meshlab for testing purposes.
Also: Sign up for your Sketchfab Account
Don’t forget to sign up right here to be able to upload models.
If you want to use VR today tomorrow:
More Resources
For planet models:
For galaxy models:
Bonus: Try with this larger dataset with many different particle types. Again, parsing this harder dataset is left up to you!
Materials


Find More Money Helper
1062 Delaware St | Denver, CO 80204 |<PHONE_NUMBER>
Find More Money Helper
What Kind Of Position Are You Interested In:
City:
State:
Search
National Average Salary For:
The Following Companies Have Been Reviewed By Your Requested Position In Your Requested Area
Choose Random Page
0
of
0
See What Twitter Is Saying About


virus inactivation plasma viruses []. used treatment viral [], species different important {border-style Yes methods reactive using water FCV nucleic px;} #ffffff;} cold Viruses RONS atmospheric enteric human inactivation. various measured studies treated Microbiol. degradation inactivated potential use Plasma gas plant treatments food inactivate method surface (e.g., Phys. bacteriophages effects infectivity main oxygen properties shown Inactivation Sci. and/or damage decontamination high liquid nitrogen pressure research respiratory responsible successfully (Box CP-activated DBD Table air applied assay capsid chemical discharge including material pathogenic protein px; specific surfaces surrogates viruses, {font-family Appl. Box Environ. Optical Virus [,]. acid animal, barrier changes crucial emission field font-size global influenza need norovirus particles sources spread temperature viruses. (Table Plant cause complete contaminated determine double; future human, inactivation, increasing information liquids modes norovirus, ozone pathogens reported role study surrogate test transmission Animal Bacteriophages COVID- CP-mediated Despite Elsevier HIV HO, However, NO, Onee RSV RT-qPCR Virol. achieved acids border-color border-width cases choice combination contact dielectric disease efficient environmentally friendly irrigation parameters pose potato potentially power present production proteins radiation recent results samples sensitive solid; source stainless target time times transmitted treatments. virus. water, work years {font-style {font-weight Alt-text: Biotechnol. Different Methods NDV SDS-PAGE Technol. [,], [., accurate acids. adenovirus agents better biological bold caused centre completely courier; created directly disinfection diverse does economic effect em; energy feline glass health help highly host however, inactivates include increasingly infect jet large light likely long lower mask matrices mosaic needs novel numerous owing plasma-activated possible pt;} quality relevant remain require resource response result safe scarcity shorter spectroscopy spectroscopy, state strips successful syndrome systems targeted tools toxic treatment, types vaccine virus, wastewater waterborne âŒ½


Non-blocking Message Passing
about
documentation
version control
issue tracking
unit tests
test coverage
license
{{content}}


Several 22 mg doses of 4-aco-dmt were quickly weighed out at a friends apartment in Chelsea, the doses were distributed to a small group of people. I took the first dose and then began to convince others to join me on a journey, after about thirty minutes had elapsed the effects began to manifest themselves as a subtle and persistent mania. I had to go skateboarding, I had to go outside. I became extremely impatient. I convinced a few of the people to leave with me and left the apartment with a skateboard in hand. I walked out onto the street in New York the night was cold, but I felt good, the air felt clean. Little did I know I was about to embark on the most frightening journey of my life.
I sensed strangeness in my good friend Adam who I had not seen for several days, he seemed inhibited and less funny than usual. I tried to ignore this, as the colors began to saturate my vision. Everything was coming on very slowly, very gently. 4-aco-dmt is to psycilocyben what Delsym is to Robotussin.  I felt like we were a group of children playing in a strange post-apocalyptic playground, the atmosphere was thick.
We began walking to time sq. we walked past a pizzeria and I stopped in awe of its beauty the walls were fitted with beveled mirrors, each mirror wore a crown of neon lights, the shop was empty I sat in a chair and felt infinite ecstasy wash over me, I closed my eyes and saw pure white light, the summation of the entire spectrum. The pizzeria was heaven, I was in a trance. The rest of the group wanted to leave, and I left, though I thoroughly regret it.
As we approached times sq. Adam decided to take an additional dose because he was not feeling the effects as strongly as me, I told him to split 22mgs with me but he foolishly snorted the entire thing by himself, shortly after that we left the group and went off walking together. The lights of times sq. looked like an ocean and I felt like strange mutated shrimp were swimming around me. We went into the basement of a Sabarro to talk.
The visuals at this point were fairly mild, less than what I would have gotten from 1/8th of mushrooms but the insanity was very much preset. I tried to engage Adam in a discussion, but he was unable to communicate with me, his observations grew more and more distorted and he became convinced that one of the group members was evil. All of his observations were retarded, and I found myself disagreeing with everything he said. He became more and more agitated, until he ran from the table into times sq. leaving me behind, I took out paper and began to write down memories I was recalling from my childhood of a baby sitter who used to hit me. Adam returned a few minutes later more crazed than before, he blurted out “I'm gay” and ran off again, this time not to return. All of my belongings were at his friends apartment and I had nowhere to sleep it was around 2:00 in the morning, I knew things were about to get very scary.
For reasons I cannot remember I ate a transparent rolling paper I had in my wallet, then hurriedly collected my notes which were written on written on receipts I had in my wallet, I filled my hat with receipts and put it on my head. I looked very noticeably insane and was almost instantly mocked by people walking by on the street, my self-pity was overwhelming strong, I felt like a child lost in a wal-mart I wanted someone to call my parents on the PA system. I called Adam's cell-phone repeatedly to no avail. I called numerous people in my phonebook including (regrettably) my parents. I walked to a McDonalds and starred in awe at the golden arches I wanted to tell them how much respect I had for them, I walked inside and saw a drawing I had done on the wall one year previously, this filled me with an overwhelming sense of deja vu.
I called Adam again and he hurriedly picked up the phone and said “I'm dieing in an ambulance” then hung up the phone. At this point I really started to freak-the-fuck-out. I was overwhelmed by fear, horror, sadness, confusion, and an unexpected sense of euphoria. A pure despair penetrated every dimension of my being and I became immersed in a fantasy about telling Adams parents that I was responsible for their sons death, I felt as if seeds of insanity were being planted deep inside my brain.
Eventually I contacted my girlfriend and was able to go stay at her apt. The next morning I spoke to Adam after he left the hospital. He sounded different…in a bad way. He was profoundly changed by the experience, he seems to have lost a lot of the edge and humor he had before the trip, and when I told him he confessed his homosexuality to me he became extremely uncomfortable and denied it.
Not something to be played with by the weak of constitution. For everyone else enjoy time-release mushrooms.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Class ProductSearchClient (v2.2.2)
Service Description: Manages Products and ProductSets of reference images for use in product search. It uses the following resource model:
- The API has a collection of ProductSet resources, named
projects/*/locations/*/productSets/*
, which acts as a way to put different products into groups to limit identification.
In parallel,
The API has a collection of Product resources, named
projects/*/locations/*/products/*
Each Product has a collection of ReferenceImage resources, named
projects/*/locations/*/products/*/referenceImages/*
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
$productSearchClient = new ProductSearchClient();
try {
$formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]');
$formattedProduct = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]');
$productSearchClient->addProductToProductSet($formattedName, $formattedProduct);
} finally {
$productSearchClient->close();
}
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
Methods
locationName
Formats a string containing the fully-qualified path to represent a location resource.
| Name | Description |
| project |
string
|
| location |
string
|
| Type | Description |
| string | The formatted location resource. |
productName
Formats a string containing the fully-qualified path to represent a product resource.
| Name | Description |
| project |
string
|
| location |
string
|
| product |
string
|
| Type | Description |
| string | The formatted product resource. |
productSetName
Formats a string containing the fully-qualified path to represent a product_set resource.
| Name | Description |
| project |
string
|
| location |
string
|
| productSet |
string
|
| Type | Description |
| string | The formatted product_set resource. |
referenceImageName
Formats a string containing the fully-qualified path to represent a reference_image resource.
| Name | Description |
| project |
string
|
| location |
string
|
| product |
string
|
| referenceImage |
string
|
| Type | Description |
| string | The formatted reference_image resource. |
parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- location: projects/{project}/locations/{location}
- product: projects/{project}/locations/{location}/products/{product}
- productSet: projects/{project}/locations/{location}/productSets/{product_set}
- referenceImage: projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
| Name | Description |
| formattedName |
string
The formatted name string |
| template |
string
Optional name of template to match |
| Type | Description |
| array | An associative array from name component IDs to component values. |
getOperationsClient
Return an OperationsClient object with the same endpoint as $this.
| Type | Description |
| Google\ApiCore\LongRunning\OperationsClient |
resumeOperation
Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.
| Name | Description |
| operationName |
string
The name of the long running operation |
| methodName |
string
The name of the method used to start the operation |
| Type | Description |
| Google\ApiCore\OperationResponse |
__construct
Constructor.
| Name | Description |
| options |
array
Optional. Options for configuring the service API wrapper. |
| ↳ serviceAddress |
string
Deprecated. This option will be removed in a future major release. Please utilize the |
| ↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
| ↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. |
| ↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
| ↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
| ↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
| ↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
| ↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
| ↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
addProductToProductSet
Adds a Product to the specified ProductSet. If the Product is already present, no change is made.
One Product can be added to at most 100 ProductSets.
Possible errors:
- Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]');
$formattedProduct = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]');
$productSearchClient->addProductToProductSet($formattedName, $formattedProduct);
} finally {
$productSearchClient->close();
}
| Name | Description |
| name |
string
Required. The resource name for the ProductSet to modify. Format is: |
| product |
string
Required. The resource name for the Product to be added to this ProductSet. Format is: |
| optionalArgs |
array
Optional. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
createProduct
Creates and returns a new product resource.
Possible errors:
- Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters.
- Returns INVALID_ARGUMENT if description is longer than 4096 characters.
- Returns INVALID_ARGUMENT if product_category is missing or invalid.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]');
$product = new Product();
$response = $productSearchClient->createProduct($formattedParent, $product);
} finally {
$productSearchClient->close();
}
| Name | Description |
| parent |
string
Required. The project in which the Product should be created. Format is |
| product |
Google\Cloud\Vision\V1\Product
Required. The product to create. |
| optionalArgs |
array
Optional. |
| ↳ productId |
string
A user-supplied resource id for this Product. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\Cloud\Vision\V1\Product |
createProductSet
Creates and returns a new ProductSet resource.
Possible errors:
- Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]');
$productSet = new ProductSet();
$response = $productSearchClient->createProductSet($formattedParent, $productSet);
} finally {
$productSearchClient->close();
}
| Name | Description |
| parent |
string
Required. The project in which the ProductSet should be created. Format is |
| productSet |
Google\Cloud\Vision\V1\ProductSet
Required. The ProductSet to create. |
| optionalArgs |
array
Optional. |
| ↳ productSetId |
string
A user-supplied resource id for this ProductSet. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\Cloud\Vision\V1\ProductSet |
createReferenceImage
Creates and returns a new ReferenceImage resource.
The bounding_poly
field is optional. If bounding_poly
is not specified,
the system will try to detect regions of interest in the image that are
compatible with the product_category on the parent product. If it is
specified, detection is ALWAYS skipped. The system converts polygons into
non-rotated rectangles.
Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP).
Possible errors:
- Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters.
- Returns INVALID_ARGUMENT if the product does not exist.
- Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected.
- Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedParent = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]');
$referenceImage = new ReferenceImage();
$response = $productSearchClient->createReferenceImage($formattedParent, $referenceImage);
} finally {
$productSearchClient->close();
}
| Name | Description |
| parent |
string
Required. Resource name of the product in which to create the reference image. Format is |
| referenceImage |
Google\Cloud\Vision\V1\ReferenceImage
Required. The reference image to create. If an image ID is specified, it is ignored. |
| optionalArgs |
array
Optional. |
| ↳ referenceImageId |
string
A user-supplied resource id for the ReferenceImage to be added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\Cloud\Vision\V1\ReferenceImage |
deleteProduct
Permanently deletes a product and its reference images.
Metadata of the product and all its images will be deleted right away, but search queries against ProductSets containing the product may still work until all related caches are refreshed.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedName = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]');
$productSearchClient->deleteProduct($formattedName);
} finally {
$productSearchClient->close();
}
| Name | Description |
| name |
string
Required. Resource name of product to delete. Format is: |
| optionalArgs |
array
Optional. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
deleteProductSet
Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted.
The actual image files are not deleted from Google Cloud Storage.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]');
$productSearchClient->deleteProductSet($formattedName);
} finally {
$productSearchClient->close();
}
| Name | Description |
| name |
string
Required. Resource name of the ProductSet to delete. Format is: |
| optionalArgs |
array
Optional. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
deleteReferenceImage
Permanently deletes a reference image.
The image metadata will be deleted right away, but search queries against ProductSets containing the image may still work until all related caches are refreshed.
The actual image files are not deleted from Google Cloud Storage.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedName = $productSearchClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]');
$productSearchClient->deleteReferenceImage($formattedName);
} finally {
$productSearchClient->close();
}
| Name | Description |
| name |
string
Required. The resource name of the reference image to delete. Format is: |
| optionalArgs |
array
Optional. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
getProduct
Gets information associated with a Product.
Possible errors:
- Returns NOT_FOUND if the Product does not exist.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedName = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]');
$response = $productSearchClient->getProduct($formattedName);
} finally {
$productSearchClient->close();
}
| Name | Description |
| name |
string
Required. Resource name of the Product to get. Format is: |
| optionalArgs |
array
Optional. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\Cloud\Vision\V1\Product |
getProductSet
Gets information associated with a ProductSet.
Possible errors:
- Returns NOT_FOUND if the ProductSet does not exist.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]');
$response = $productSearchClient->getProductSet($formattedName);
} finally {
$productSearchClient->close();
}
| Name | Description |
| name |
string
Required. Resource name of the ProductSet to get. Format is: |
| optionalArgs |
array
Optional. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\Cloud\Vision\V1\ProductSet |
getReferenceImage
Gets information associated with a ReferenceImage.
Possible errors:
- Returns NOT_FOUND if the specified image does not exist.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedName = $productSearchClient->referenceImageName('[PROJECT]', '[LOCATION]', '[PRODUCT]', '[REFERENCE_IMAGE]');
$response = $productSearchClient->getReferenceImage($formattedName);
} finally {
$productSearchClient->close();
}
| Name | Description |
| name |
string
Required. The resource name of the ReferenceImage to get. Format is: |
| optionalArgs |
array
Optional. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\Cloud\Vision\V1\ReferenceImage |
importProductSets
Asynchronous API that imports a list of reference images to specified product sets based on a list of image information.
The google.longrunning.Operation API can be used to keep track of the
progress and results of the request.
Operation.metadata
contains BatchOperationMetadata
. (progress)
Operation.response
contains ImportProductSetsResponse
. (results)
The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see ImportProductSetsGcsSource.csv_file_uri.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]');
$inputConfig = new ImportProductSetsInputConfig();
$operationResponse = $productSearchClient->importProductSets($formattedParent, $inputConfig);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
$result = $operationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $productSearchClient->importProductSets($formattedParent, $inputConfig);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $productSearchClient->resumeOperation($operationName, 'importProductSets');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
$result = $newOperationResponse->getResult();
// doSomethingWith($result)
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$productSearchClient->close();
}
| Name | Description |
| parent |
string
Required. The project in which the ProductSets should be imported. Format is |
| inputConfig |
Google\Cloud\Vision\V1\ImportProductSetsInputConfig
Required. The input content for the list of requests. |
| optionalArgs |
array
Optional. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\ApiCore\OperationResponse |
listProductSets
Lists ProductSets in an unspecified order.
Possible errors:
- Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]');
// Iterate over pages of elements
$pagedResponse = $productSearchClient->listProductSets($formattedParent);
foreach ($pagedResponse->iteratePages() as $page) {
foreach ($page as $element) {
// doSomethingWith($element);
}
}
// Alternatively:
// Iterate through all elements
$pagedResponse = $productSearchClient->listProductSets($formattedParent);
foreach ($pagedResponse->iterateAllElements() as $element) {
// doSomethingWith($element);
}
} finally {
$productSearchClient->close();
}
| Name | Description |
| parent |
string
Required. The project from which ProductSets should be listed. Format is |
| optionalArgs |
array
Optional. |
| ↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
| ↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\ApiCore\PagedListResponse |
listProducts
Lists products in an unspecified order.
Possible errors:
- Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]');
// Iterate over pages of elements
$pagedResponse = $productSearchClient->listProducts($formattedParent);
foreach ($pagedResponse->iteratePages() as $page) {
foreach ($page as $element) {
// doSomethingWith($element);
}
}
// Alternatively:
// Iterate through all elements
$pagedResponse = $productSearchClient->listProducts($formattedParent);
foreach ($pagedResponse->iterateAllElements() as $element) {
// doSomethingWith($element);
}
} finally {
$productSearchClient->close();
}
| Name | Description |
| parent |
string
Required. The project OR ProductSet from which Products should be listed. Format: |
| optionalArgs |
array
Optional. |
| ↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
| ↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\ApiCore\PagedListResponse |
listProductsInProductSet
Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist, the products field of the response will be empty.
Possible errors:
- Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]');
// Iterate over pages of elements
$pagedResponse = $productSearchClient->listProductsInProductSet($formattedName);
foreach ($pagedResponse->iteratePages() as $page) {
foreach ($page as $element) {
// doSomethingWith($element);
}
}
// Alternatively:
// Iterate through all elements
$pagedResponse = $productSearchClient->listProductsInProductSet($formattedName);
foreach ($pagedResponse->iterateAllElements() as $element) {
// doSomethingWith($element);
}
} finally {
$productSearchClient->close();
}
| Name | Description |
| name |
string
Required. The ProductSet resource for which to retrieve Products. Format is: |
| optionalArgs |
array
Optional. |
| ↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
| ↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\ApiCore\PagedListResponse |
listReferenceImages
Lists reference images.
Possible errors:
- Returns NOT_FOUND if the parent product does not exist.
- Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedParent = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]');
// Iterate over pages of elements
$pagedResponse = $productSearchClient->listReferenceImages($formattedParent);
foreach ($pagedResponse->iteratePages() as $page) {
foreach ($page as $element) {
// doSomethingWith($element);
}
}
// Alternatively:
// Iterate through all elements
$pagedResponse = $productSearchClient->listReferenceImages($formattedParent);
foreach ($pagedResponse->iterateAllElements() as $element) {
// doSomethingWith($element);
}
} finally {
$productSearchClient->close();
}
| Name | Description |
| parent |
string
Required. Resource name of the product containing the reference images. Format is |
| optionalArgs |
array
Optional. |
| ↳ pageSize |
int
The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. |
| ↳ pageToken |
string
A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\ApiCore\PagedListResponse |
purgeProducts
Asynchronous API to delete all Products in a ProductSet or all Products that are in no ProductSet.
If a Product is a member of the specified ProductSet in addition to other ProductSets, the Product will still be deleted.
It is recommended to not delete the specified ProductSet until after this operation has completed. It is also recommended to not add any of the Products involved in the batch delete to a new ProductSet while this operation is running because those Products may still end up deleted.
It's not possible to undo the PurgeProducts operation. Therefore, it is recommended to keep the csv files used in ImportProductSets (if that was how you originally built the Product Set) before starting PurgeProducts, in case you need to re-import the data after deletion.
If the plan is to purge all of the Products from a ProductSet and then re-use the empty ProductSet to re-import new Products into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet.
The google.longrunning.Operation API can be used to keep track of the
progress and results of the request.
Operation.metadata
contains BatchOperationMetadata
. (progress)
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedParent = $productSearchClient->locationName('[PROJECT]', '[LOCATION]');
$operationResponse = $productSearchClient->purgeProducts($formattedParent);
$operationResponse->pollUntilComplete();
if ($operationResponse->operationSucceeded()) {
// operation succeeded and returns no value
} else {
$error = $operationResponse->getError();
// handleError($error)
}
// Alternatively:
// start the operation, keep the operation name, and resume later
$operationResponse = $productSearchClient->purgeProducts($formattedParent);
$operationName = $operationResponse->getName();
// ... do other work
$newOperationResponse = $productSearchClient->resumeOperation($operationName, 'purgeProducts');
while (!$newOperationResponse->isDone()) {
// ... do other work
$newOperationResponse->reload();
}
if ($newOperationResponse->operationSucceeded()) {
// operation succeeded and returns no value
} else {
$error = $newOperationResponse->getError();
// handleError($error)
}
} finally {
$productSearchClient->close();
}
| Name | Description |
| parent |
string
Required. The project and location in which the Products should be deleted. Format is |
| optionalArgs |
array
Optional. |
| ↳ productSetPurgeConfig |
ProductSetPurgeConfig
Specify which ProductSet contains the Products to be deleted. |
| ↳ deleteOrphanProducts |
bool
If delete_orphan_products is true, all Products that are not in any ProductSet will be deleted. |
| ↳ force |
bool
The default value is false. Override this value to true to actually perform the purge. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\ApiCore\OperationResponse |
removeProductFromProductSet
Removes a Product from the specified ProductSet.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$formattedName = $productSearchClient->productSetName('[PROJECT]', '[LOCATION]', '[PRODUCT_SET]');
$formattedProduct = $productSearchClient->productName('[PROJECT]', '[LOCATION]', '[PRODUCT]');
$productSearchClient->removeProductFromProductSet($formattedName, $formattedProduct);
} finally {
$productSearchClient->close();
}
| Name | Description |
| name |
string
Required. The resource name for the ProductSet to modify. Format is: |
| product |
string
Required. The resource name for the Product to be removed from this ProductSet. Format is: |
| optionalArgs |
array
Optional. |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
updateProduct
Makes changes to a Product resource.
Only the display_name
, description
, and labels
fields can be updated
right now.
If labels are updated, the change will not be reflected in queries until the next index time.
Possible errors:
- Returns NOT_FOUND if the Product does not exist.
- Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters.
- Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters.
- Returns INVALID_ARGUMENT if product_category is present in update_mask.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$product = new Product();
$response = $productSearchClient->updateProduct($product);
} finally {
$productSearchClient->close();
}
| Name | Description |
| product |
Google\Cloud\Vision\V1\Product
Required. The Product resource which replaces the one on the server. product.name is immutable. |
| optionalArgs |
array
Optional. |
| ↳ updateMask |
FieldMask
The FieldMask that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask paths include |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\Cloud\Vision\V1\Product |
updateProductSet
Makes changes to a ProductSet resource.
Only display_name can be updated currently.
Possible errors:
- Returns NOT_FOUND if the ProductSet does not exist.
- Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters.
Sample code:
$productSearchClient = new ProductSearchClient();
try {
$productSet = new ProductSet();
$response = $productSearchClient->updateProductSet($productSet);
} finally {
$productSearchClient->close();
}
| Name | Description |
| productSet |
Google\Cloud\Vision\V1\ProductSet
Required. The ProductSet resource which replaces the one on the server. |
| optionalArgs |
array
Optional. |
| ↳ updateMask |
FieldMask
The FieldMask that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask path is |
| ↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
| Type | Description |
| Google\Cloud\Vision\V1\ProductSet |
Constants
SERVICE_NAME
Value: 'google.cloud.vision.v1.ProductSearch'
The name of the service.
SERVICE_ADDRESS
Value: 'vision.googleapis.com'
The default address of the service.
DEFAULT_SERVICE_PORT
Value: 443
The default port of the service.
CODEGEN_NAME
Value: 'gapic'
The name of the code generator, to be included in the agent header.


Latitude
Plots
Max Temperature
Humidity
Cloudiness
Wind Speed
Comparision
Data
Comparision: Latitude vs. X
Click any plot to get an indepth analysis.
vs. Max Temperature
vs. Humidity
vs. Cloudiness
vs. Wind Speed


Old Password
This is required.
New Password
This is required.
New Password cannot be same as Old Password.
Confirm Password
This is required.
Confirm Password should be same as new Password.
Sumbit


Welcome! This website helps you play 升级 / Tractor / 找朋友 / Finding Friends with other people online.
If you're not familiar with the rules, check them out here!
Unfortunately, it looks like you might have Javascript disabled in your web browser, so the game won't work. If you'd like to play, please make sure that Javascript and WebSockets are enabled!