Blocks are used everywhere in Ruby and in the beginning they're pretty easy to understand.
Past this very-very beginning, however, we get Procs, Lambdas and the ability to use them as closures and it gets pretty crypto-annoying, pretty fast.
The best way--and the only way I know of--is to understand Blocks and Procs is from the vantage point of where they came from, and that was long before the era of modern web programming. So come with me on a journey to the early days and we'll delve into the untold, secret history of Blocks, Procs and Lambdas. When we return to the present you'll not only be a master of B's, P's and L's, you'll truly understand variable scope and that's rather fundamental too.

In the Beginning...
In the dark days before Object Oriented Programming and even before Procedural Programming graced the earth, the very first programs were just a string of commands:
load 50 load 23 add load 4 add ...
Very much like an HP calculator. If you wanted to execute a sequence of commands 5 times, you had to type them in 5 times. This happened all the time so pretty soon the loop was invented. The first loops were just a conditional test and a GOTO:
10 Sub 1, count. #subtract 1 from count 15 GOTO 40 on result 0 #if count went to zero, jump to line 40 20 ... ... 40 (continue)
The first GOTOs had took one argument, an address; GOTO 40, would go to line 40 of the program. Not very meaningful. What's happening at line 40? Later, the ability to use human readable labels were added as were more complex conditionals. Ready to be executed, your code might then might look like this:
The program counter contains the address in memory where we are currently executing the code. Here it is at the beginning of the loop. When a GOTO is executed it simply reloads the Program Counter with a new address and you start executing from there. Believe it or not, this was the first block and it's pretty close to a Ruby block.
Now here is where it get's interesting. A program's most important variables are stored in a set of fast storage areas called registers where they can quickly accessed. There were seldom enough registers though, so some variables would be stored in what is known as the system stack. It was just an area of memory that was operated like a cafeteria dish stack. A special register called the stack pointer would point to the current top of the stack. The system could push and pop data from this structure. We'll see this in the next diagram.
Now, let's say we have a loop like in the diagram above and it's purpose is to calculate an electricity bill. How would you re-use this same code to calculate a different customer's bill? Well, we have the GOTO statement, why not just GOTO our my_func label loop: from wherever we need to? Good idea, but we'll also have to figure out a way to get back.
Next, assuming we have more than one customer, we'll need to load our variables with different values to represent the new customers account data. Additionally, our loop will likely create additional local variables of it's own and we don't want their names to conflict with whatever variables may have been created elsewhere in the application. I can remember programming on systems where you could only have one variable with, for example, the name index or length. All names were global.
Finally, you'd like your loop to itself be able to call other sections of code too. So how can we handle all that?
The Function (a.k.a Method) is Born.
To make a function safe to call from anywhere in our program, a lot of work goes on behind the scenes with the the stack. At the start of a Function call, a special value is pushed on the stack (shown in brown) to indicate that this is the beginning of a stack frame. The next thing that happens is that the current value of the program counter is saved on the stack. This acts as the address to go back to when the function returns. Next, all the current variables in registers are saved onto the stack as well so they can be restored when the function returns. Next another stack frame marker is pushed onto the stack, then on top of it, any parameters being passed to the function are pushed on the stack. The function can add any other variables to the stack for whatever it wants but it can't reference anything past this frame marker. This is how variable scope is implemented! So now you know. This is why a Method in Ruby can't reference local variables outside itself. Finally, the GOTO is executed.
When the function is finished, it clears everything off the stack (all the variables it created as well as it's parameters) down to the first stack frame, then it pops off all the saved variables from the stack and restores them, it removes the return address from the stack and saves it aside for a moment, pushes it's return value on the stack and then loads the return address into the program counter. Boom, the method has returned.
- Block are like a simple GOTO.
- Methods are just a function call.
Blocks are just GOTOs
Blocks are very much like a GOTO as described in our first diagram above. Take a look at this simple block:a = 5 2.times do |par1| puts par1 puts a end #Note this is the same as: 2.times do { |par1| puts par1; puts a } When we run this block we get: par1 = 0 a = 5 par1 = 1 a = 5
Because it's a block, the code is just in-line in memory and it can't be called from anywhere except this one location. No return address is saved on the stack. No variables are saved on the stack and there are no stack frame markers pushed. This is why we can still access the variable 'a' from within the block. Compare this with the same thing in Method form:
def my_meth(par1)
puts "par1"
puts a
end
a = 5
for i in (1..2)
my_meth(i)
end
#When we run this code we get an error:
...in `my_meth': undefined local variable or method `a'
for main:Object (NameError)
Before the method is run the local variables are saved on the stack and a stack frame marker is pushed. The method is not allowed to access anything below this marker including the variable 'a'. Next Ruby pushes the parameters being passed to the method onto the stack and we jump to the code of the method. The first thing the method does is utilize a little more secret code that Ruby has included to check the number of parameters passed on the stack.
When the method returns, the former local variables are popped from the stack and restored, the return address is popped from the stack, the return value is pushed on the stack.
As you might guess, Blocks are faster than method calls. If you are doing an intensive loop and your program is too slow, replacing a method call with a block is something you might look at trying.
When blocks and methods return they both push a return value on the stack. Methods pick up their previously stored return address and jump there. Blocks don't push a return address so they just keep running. Guess what happens then if you put a return statement in the middle of a block like this:
a = 5 2.times do |par1| puts par1 return a end
The return command searches in the stack for the previous return addressstored there and jumps to it. If we are at the top level of our file then we run this block we get an error. If our block is running inside a method, then the first return address that the return command finds is the one pushed by the method and it jumps to it. We'll return not just from our block but from the method too.
Procs
So let's say you have this great block that you are using with a .each iterator and you decide you want to use inside a different method. Rather than cut and paste the code to that new location you can make a Proc out of it. A Proc is just a block with a name so you can reuse it. (Personally, instead of passing a block to the array, I think it's likely time to think about passing the array to a method containing the block.)
To reuse the block {|a, b| a + b}, we make a new Proc out of it. This gives the block a name and allows us to refer to by that name from multiple places in our code. The name is just a Ruby variable which store the address of the Proc's block.
my_p = Proc.new {{|a, b| a + b} #You call it like this: my_p.call(a, b)As with a block, (but unlike a method) referring to local variables like below is just fine.
c = 5 my_p = Proc.new do |a, b| a + b + c end
Like a block, a Proc is basically a GOTO. The Proc doesn't create a new stack frame and variable scope like a method does (so you can still reference them from within the Proc) and it doesn't save a return address, so be careful if you feel like calling return. Like a block, a Proc doesn't check the number of parameters you pass to it. A Proc is basically a variable that stores the address of a block.
When Ruby code wants to run a Proc, Ruby pulls the address to jump to from Proc variable. This is known as a level of indirection. Basically it means rather than start executing at some memory address, instead we read the address store there and jump to it.
As you might imagine if a method was written to take a Proc it can't take a Block and vice versa (at least without a trick we'll see in a moment.
You can pass a Proc just like any other parameter.
my_p = Proc.new {|a, b| a + b} def method_call_a_proc(my_p) my_p.call(1,2) end method_call_a_proc(my_p)
Whenever you pass a Proc to a method you have to do it within the parameter ( )s. The reason for this is that Ruby reuses the code for passing a variable (remember a Proc's name is just a variable) and anything outside the () is assumed to be code and is executed in-line.
As mentioned above, if a method wants a block, it can't take a Proc and vice versa. To get around this Ruby created the '&' operator. The method call_a_proc above wants a Proc passed as a parameter. If you try to pass a block to it directly as below, it will complain. (Remember that you pass a block by writing it just outside the parameter parentheses().)
call_a_proc { Puts "inside the block")
# This generates an error.
You have to redefine the method using the '&' operator:
def call_a_block(&block) block.call(2,1) end call_a_block {|a, b| a + b}
Now the method can take a block. Most of your enumerable iterators .each and .select are defined this way.
OK, so what if you still wanted to pass a Proc to a method that expects a block like call_a_block? In this case there's syntax that let's you do this and confusingly it re-uses the '&' operator.
p = Proc.new{|a, b| a + b} [1,2,3,4].each_with_index(&p)
Here the '&' operator writes some secret code to convert a Proc call to a Block call. '&' is confusing because here it's used to turn a Proc into a Block. In one case it tells Ruby to add code to redirect through the named Proc and in the other the same '&' operator removes it. If you ever find yourself having trouble passing Procs with Blocks or vice versa, just look at where you could add or take out a '&'.
OK, so what the heck is a Lambda and Why?
There are two differences between a Proc and a Lambda. First, a Lambda checks to make sure you pass it the correct number of parameters and second, a Lambda pushes it's return address on the stack so you can call return from within a lambda. In this way a Lambda is much closer to being a method.
There are two ways to define a lambda. I like to do it like this because it reminds me that a lambda handles parameters and return like a method:
my_add -> (a,b){a + b}
my_add = lambda {|a,b| a + b }
Warning! Total Mind F*** Coming
Now it's time to really bend your mind. When a new Proc is created it has access to its local scope because it doesn't push a new stack frame on the stack like a method does. Just for fun, let's create a Proc in one scope and then use it in a different one. Wonder what will happen. Warning this is about to get really weird.
c = 5 my_p = Proc.new do |a| c = a + c end c = 18 my_p(4) puts "c = #{c}" def foo(p) puts p.call(2) end foo(my_p) foo(my_p) puts "c = #{c}"
When my_p is created it has access to the local scope (because Procs don't push local variables on the stack). my_p stores a reference to 'c' so that when the value of 'c' changes, no problem, my_p picks it up. Well what about if we call my_p from within a method. Now inside method "foo" we can't access 'c'. Interestingly, my_p still can. When we run the above we get:
c = 22 24 26 c = 26
Even though the method cannot access the scope outside itself, the Proc magically still can. Now if that's not weird enough for you, Procs can reach past the grave and access dead variables. This life-after-death skill is why Procs were created in the first place.
Here we have a method and all it does is create and return a new Proc. Because it can refer to variables in it's local context it can use the variable c. But look what happens next. C is only defined inside the method. It should be dead to any code outside it.
def foo c = 3 Proc.new { c += 1 } end f = foo puts f.call #=> 4 puts f.call #=> 5
When foo returns, you would expect c to go out of scope and calling f would return an error. But it doesn't. The Proc is magic. Creating the Proc inside foo ghostified the context inside foo and it Proc 'f' can reach past the grave and get to it.
Here's what's going on.
Remember those stack frames where Ruby stores variables in a scope? Well imagine them like this where each stack frame is an object.
When you call Proc.new it saves a reference to the stack frame holding the current local scope. When the stack frame is cleared as when the method "foo" above returns, this is what happens.
The context for the method "foo" is removed from the stack, but it's not deleted because Proc f still has a reference to it. Thus the scope from within the foo method lives on until Proc 'f' goes away.
This is what is known as a "closure". A terrible name that means, "has a reference to the stack_frame object and all the variables that are in scope and which won't go away until the Proc goes away.
I am told that this weirdness was the reason for all this nonsense in the first place. There are times when you are programming when the local context is "just right" and you want to freeze it at that moment, but you don't want to execute it until later because maybe some parameters you want to pass it don't exist yet. Kinda like passing variables into the past. This violates so many tenants of OOD like encapsulation it makes me want to hurl.
What is it good for?
I've been trying to think of a user story for closures. All I can imagine is that you've just written the code for NASA's Pluto probe and you have a Proc "outer_space" in which you want to save all the local variables when it's closest to the planet dwarf planet Pluto, and then again when it's closest to Charon, it's moon. Maybe a year later NASA wants to run "outer_space" passing it some new parameters to see what it would have done differently at the Pluto fly-by and at the Charon fly-by.
This is why closures were created but no one will tell you because unless you understand where this all comes from you won't have a model of how it works. You'll be doing what Web programmers who don't know CSS's box model do: they just hack away until the thing they want to move does. Well now you know.
Mike Farr
Everything that's interesting to do was once impossible.
April 24, 2015


ETableAbs.empty_relate [in ADT]
ETableAbs.empty_ok [in ADT]
ETableAbs.get [in ADT]
ETableAbs.insert_relate [in ADT]
ETableAbs.lookup_relate [in ADT]
ETableAbs.rep_ok [in ADT]
ETableAbs.set [in ADT]
ETableAbs.set_ok [in ADT]
ETableAbs.table [in ADT]
ETableAbs.V [in ADT]
ETableSubset.bound [in ADT]
ETableSubset.bound_set_other [in ADT]
ETableSubset.bound_set_same [in ADT]
ETableSubset.bound_empty [in ADT]
ETableSubset.elements [in ADT]
ETableSubset.elements_correct [in ADT]
ETableSubset.elements_complete [in ADT]
ETable_first_attempt.elements_correct [in ADT]
ETable_first_attempt.elements_complete [in ADT]
ETable_first_attempt.elements [in ADT]
ETable_first_attempt.bound [in ADT]
ETable.bound [in ADT]
ETable.bound_set_other [in ADT]
ETable.bound_set_same [in ADT]
ETable.bound_empty [in ADT]
ETable.elements [in ADT]
ETable.elements_correct [in ADT]
ETable.elements_complete [in ADT]
ETable.empty_ok [in ADT]
ETable.rep_ok [in ADT]
ETable.set_ok [in ADT]
I
int [in Extract]L
leb [in Extract]leb_le [in Extract]
ltb [in Extract]
ltb_lt [in Extract]
P
PRIQUEUE.Abs [in Priqueue]PRIQUEUE.abs_perm [in Priqueue]
PRIQUEUE.can_relate [in Priqueue]
PRIQUEUE.delete_max_Some_relate [in Priqueue]
PRIQUEUE.delete_max_Some_priq [in Priqueue]
PRIQUEUE.delete_max_None_relate [in Priqueue]
PRIQUEUE.delete_max [in Priqueue]
PRIQUEUE.empty [in Priqueue]
PRIQUEUE.empty_relate [in Priqueue]
PRIQUEUE.empty_priq [in Priqueue]
PRIQUEUE.insert [in Priqueue]
PRIQUEUE.insert_relate [in Priqueue]
PRIQUEUE.insert_priq [in Priqueue]
PRIQUEUE.merge [in Priqueue]
PRIQUEUE.merge_relate [in Priqueue]
PRIQUEUE.merge_priq [in Priqueue]
PRIQUEUE.priq [in Priqueue]
PRIQUEUE.priqueue [in Priqueue]
Q
QueueAbs.Abs [in ADT]QueueAbs.deq [in ADT]
QueueAbs.deq_relate [in ADT]
QueueAbs.empty [in ADT]
QueueAbs.empty_relate [in ADT]
QueueAbs.enq [in ADT]
QueueAbs.enq_relate [in ADT]
QueueAbs.is_empty [in ADT]
QueueAbs.peek [in ADT]
QueueAbs.peek_relate [in ADT]
QueueAbs.queue [in ADT]
QueueAbs.V [in ADT]
Queue.deq [in ADT]
Queue.deq_nonempty [in ADT]
Queue.deq_empty [in ADT]
Queue.empty [in ADT]
Queue.enq [in ADT]
Queue.is_empty_nonempty [in ADT]
Queue.is_empty_empty [in ADT]
Queue.is_empty [in ADT]
Queue.peek [in ADT]
Queue.peek_nonempty [in ADT]
Queue.peek_empty [in ADT]
Queue.queue [in ADT]
Queue.V [in ADT]
S
ScratchPad2.lt_dec_axiom_2 [in Decide]ScratchPad2.lt_dec_axiom_1 [in Decide]
SimpleTable.default [in ADT]
SimpleTable.key [in ADT]
SimpleTable.table [in ADT]
SimpleTable.V [in ADT]
T
Table.default [in ADT]Table.empty [in ADT]
Table.get [in ADT]
Table.get_set_other [in ADT]
Table.get_set_same [in ADT]
Table.get_empty_default [in ADT]
Table.set [in ADT]
Table.table [in ADT]
Table.V [in ADT]
V
ValType.default [in ADT]ValType.V [in ADT]
Inductive Index
B
BinomQueue.priqueue_elems [in Binom]BinomQueue.tree [in Binom]
BinomQueue.tree_elems [in Binom]
BST [in Redblack]
BST [in SearchTree]
C
color [in Redblack]I
Integers.comparison [in Trie]Integers.positive [in Trie]
Integers.Z [in Trie]
L
List_Priqueue.Abs' [in Priqueue]N
NearlyRB [in Redblack]R
RB [in Redblack]S
ScratchPad.sumbool [in Decide]ScratchPad2.sorted [in Decide]
SigSandbox.ex [in ADT]
SigSandbox.sig [in ADT]
sorted [in Sort]
sorted [in Selection]
sorted [in Extract]
T
tree [in Redblack]tree [in SearchTree]
tree [in Extract]
trie [in Trie]
Definition Index
A
Abs [in Trie]Abs [in SearchTree]
abstract [in Trie]
Abs_three_ten [in Trie]
Abs' [in SearchTree]
add_edge [in Color]
adj [in Color]
a_vector [in ADT]
B
bag [in BagPerm]bag_eqv [in BagPerm]
balance [in Redblack]
BinomQueue.Abs [in Binom]
BinomQueue.carry [in Binom]
BinomQueue.delete_max [in Binom]
BinomQueue.delete_max_aux [in Binom]
BinomQueue.empty [in Binom]
BinomQueue.find_max [in Binom]
BinomQueue.find_max' [in Binom]
BinomQueue.heap_delete_max [in Binom]
BinomQueue.insert [in Binom]
BinomQueue.join [in Binom]
BinomQueue.key [in Binom]
BinomQueue.manual_grade_for_priqueue_elems [in Binom]
BinomQueue.merge [in Binom]
BinomQueue.pow2heap [in Binom]
BinomQueue.pow2heap' [in Binom]
BinomQueue.priq [in Binom]
BinomQueue.priqueue [in Binom]
BinomQueue.priq' [in Binom]
BinomQueue.smash [in Binom]
BinomQueue.unzip [in Binom]
bound [in SearchTree]
butterfly [in Perm]
C
color [in Color]coloring [in Color]
coloring_ok [in Color]
colors_of [in Color]
color1 [in Color]
contents [in Multiset]
count [in BagPerm]
D
disjoint [in SearchTree]domain_example_map [in Color]
E
elements [in Redblack]elements [in SearchTree]
elements [in Extract]
elements_aux [in Redblack]
elements_correct_spec [in SearchTree]
elements_complete_spec [in SearchTree]
elements_complete_broken_spec [in SearchTree]
elements_ex [in SearchTree]
elements_aux [in Extract]
empty [in Trie]
empty [in Multiset]
empty [in Maps]
empty_tree [in Redblack]
empty_tree [in SearchTree]
empty_map [in ADT]
empty_tree [in Extract]
equivlistA_example [in Color]
ETableAbs.key [in ADT]
even_nat [in ADT]
Even2' [in ADT]
examplemap [in Maps]
example_map [in Color]
exposed_trees_ex [in ADT]
extra_fuel [in Selection]
ex_tree [in SearchTree]
F
FastEnough.collisions [in Trie]FastEnough.collisions_pi [in Trie]
FastEnough.loop [in Trie]
fast_elements [in SearchTree]
fast_elements_tr [in SearchTree]
find [in SearchTree]
first_le_second [in Perm]
ForallT [in Redblack]
ForallT [in SearchTree]
FunTableExamples.ex1 [in ADT]
FunTableExamples.ex2 [in ADT]
FunTableExamples.ex3 [in ADT]
FunTable.default [in ADT]
FunTable.empty [in ADT]
FunTable.get [in ADT]
FunTable.key [in ADT]
FunTable.set [in ADT]
FunTable.table [in ADT]
FunTable.V [in ADT]
G
G [in Color]geb [in Perm]
graph [in Color]
gtb [in Perm]
H
height [in Redblack]I
InA_example [in Color]ins [in Trie]
ins [in Redblack]
ins [in Extract]
insert [in Trie]
insert [in Redblack]
insert [in SearchTree]
insert [in Sort]
insert [in Extract]
insZ [in Extract]
ins_int [in Extract]
Integers.add [in Trie]
Integers.addc [in Trie]
Integers.compare [in Trie]
Integers.positive2nat [in Trie]
Integers.print_in_binary [in Trie]
Integers.succ [in Trie]
Integers.ten [in Trie]
in_4_pi [in Decide]
is_trie [in Trie]
is_BST_ex [in SearchTree]
is_a_sorting_algorithm [in Sort]
is_a_sorting_algorithm' [in BagPerm]
is_a_sorting_algorithm [in Selection]
is_a_sorting_algorithm' [in Multiset]
K
key [in Redblack]key [in SearchTree]
key [in Extract]
kvs_insert [in SearchTree]
L
le_all [in Selection]ListETableAbs.Abs [in ADT]
ListETableAbs.bound [in ADT]
ListETableAbs.default [in ADT]
ListETableAbs.elements [in ADT]
ListETableAbs.empty [in ADT]
ListETableAbs.get [in ADT]
ListETableAbs.key [in ADT]
ListETableAbs.rep_ok [in ADT]
ListETableAbs.set [in ADT]
ListETableAbs.table [in ADT]
ListETableAbs.V [in ADT]
ListQueue.deq [in ADT]
ListQueue.empty [in ADT]
ListQueue.enq [in ADT]
ListQueue.is_empty [in ADT]
ListQueue.peek [in ADT]
ListQueue.queue [in ADT]
ListQueue.V [in ADT]
ListsTable.default [in ADT]
ListsTable.empty [in ADT]
ListsTable.get [in ADT]
ListsTable.key [in ADT]
ListsTable.set [in ADT]
ListsTable.table [in ADT]
ListsTable.V [in ADT]
List_Priqueue.Abs [in Priqueue]
List_Priqueue.priq [in Priqueue]
List_Priqueue.merge [in Priqueue]
List_Priqueue.delete_max [in Priqueue]
List_Priqueue.insert [in Priqueue]
List_Priqueue.empty [in Priqueue]
List_Priqueue.priqueue [in Priqueue]
List_Priqueue.key [in Priqueue]
List_Priqueue.select [in Priqueue]
list_keys [in SearchTree]
list_nat_in [in Decide]
list_nat_eq_dec [in Decide]
list_of_vector [in ADT]
list_ind2 [in Merge]
list_ind2_principle [in Merge]
look [in Trie]
lookup [in Trie]
lookup [in Redblack]
lookup [in SearchTree]
lookup [in Extract]
low_deg [in Color]
M
make_black [in Redblack]manual_grade_for_successor_of_Z_constant_time [in Trie]
manual_grade_for_redblack_bound [in Redblack]
manual_grade_for_bound_correct [in SearchTree]
manual_grade_for_permutations_vs_multiset [in BagPerm]
manual_grade_for_Permutation_properties [in Perm]
manual_grade_for_ListsETable [in ADT]
manual_grade_for_TreeTableModel [in ADT]
manual_grade_for_permutations_vs_multiset [in Multiset]
map_of_tree [in SearchTree]
map_bound [in SearchTree]
map_of_list [in SearchTree]
map_find [in ADT]
map_update [in ADT]
maybe_swap_321 [in Perm]
maybe_swap_123 [in Perm]
maybe_swap [in Perm]
Mdomain [in Color]
merge [in Merge]
mindepth [in Redblack]
mk_graph [in Color]
multiset [in Multiset]
N
nat2pos [in Trie]NicelyEncapsulatedExample.ex1 [in ADT]
NicelyEncapsulatedExample.ex2 [in ADT]
node [in Color]
nodemap [in Color]
nodes [in Color]
nodeset [in Color]
NotBst.not_bst_lookup_wrong [in SearchTree]
NotBst.t [in SearchTree]
not_BST_ex [in SearchTree]
not_a_permutation [in Perm]
no_selfloop [in Color]
O
out_of_fuel [in Selection]OverlyEncapsulatedExample.ex1 [in ADT]
P
pairs_example [in Selection]palette [in Color]
partial_map [in Maps]
permut_example [in Perm]
plus_two [in ADT]
plus_two [in ADT]
pos2nat [in Trie]
PRIQUEUE.key [in Priqueue]
R
RatherSlow.collisions [in Trie]RatherSlow.collisions_pi [in Trie]
RatherSlow.empty [in Trie]
RatherSlow.loop [in Trie]
RatherSlow.total_mapz [in Trie]
RatherSlow.update [in Trie]
reflect_example2 [in Perm]
reflect_example1' [in Perm]
reflect_example1 [in Perm]
remove_node [in Color]
S
same_mod_10 [in Color]ScratchPad.is_3_less_7 [in Decide]
ScratchPad.lt_dec' [in Decide]
ScratchPad.lt_dec [in Decide]
ScratchPad.t1 [in Decide]
ScratchPad.t2 [in Decide]
ScratchPad.t4 [in Decide]
ScratchPad.v1a [in Decide]
ScratchPad.v1b [in Decide]
ScratchPad.v2a [in Decide]
ScratchPad.v3 [in Decide]
ScratchPad2.insert [in Decide]
ScratchPad2.le_dec [in Decide]
ScratchPad2.lt_dec [in Decide]
ScratchPad2.max_with_axiom [in Decide]
ScratchPad2.sort [in Decide]
select [in Selection]
selection_sort [in Selection]
selsort [in Selection]
selsort [in Selection]
selsort'_example [in Selection]
SigSandbox.proj1_ex [in ADT]
SigSandbox.proj1_sig [in ADT]
SigSandbox.proj2_sig [in ADT]
SimpleStringTable1.default [in ADT]
SimpleStringTable1.key [in ADT]
SimpleStringTable1.table [in ADT]
SimpleStringTable1.V [in ADT]
SimpleStringTable2.default [in ADT]
SimpleStringTable2.key [in ADT]
SimpleStringTable2.table [in ADT]
SimpleStringTable2.V [in ADT]
SimpleStringTable3.default [in ADT]
SimpleStringTable3.key [in ADT]
SimpleStringTable3.table [in ADT]
SimpleStringTable3.V [in ADT]
singleton [in Multiset]
sort [in Sort]
sort [in Extract]
sorted' [in Sort]
sorted'' [in Sort]
sortZ [in Extract]
sort_pi [in Sort]
sort_pi [in Selection]
sort_pi_same_contents [in Multiset]
sort_int [in Extract]
split [in Merge]
StringListsTableExamples.ex1 [in ADT]
StringListsTableExamples.ex2 [in ADT]
StringListsTableExamples.ex3 [in ADT]
StringTreeETableExample.ex1 [in ADT]
StringVal.default [in ADT]
StringVal.V [in ADT]
subset_nodes [in Color]
T
Table.key [in ADT]Tests.bst_ex4 [in SearchTree]
Tests.bst_ex3 [in SearchTree]
Tests.bst_ex2 [in SearchTree]
Tests.bst_ex1 [in SearchTree]
three_ten [in Trie]
total_map [in Maps]
TreeETableEncapsulated.bound [in ADT]
TreeETableEncapsulated.elements [in ADT]
TreeETableEncapsulated.rep_ok [in ADT]
TreeETableFullyEncapsulated.bound [in ADT]
TreeETableFullyEncapsulated.elements [in ADT]
TreeETableFullyEncapsulated.rep_ok [in ADT]
TreeETableSubset.bound [in ADT]
TreeETableSubset.default [in ADT]
TreeETableSubset.elements [in ADT]
TreeETableSubset.empty [in ADT]
TreeETableSubset.get [in ADT]
TreeETableSubset.key [in ADT]
TreeETableSubset.set [in ADT]
TreeETableSubset.table [in ADT]
TreeETableSubset.V [in ADT]
TreeETable_first_attempt.elements [in ADT]
TreeETable_first_attempt.bound [in ADT]
TreeETable.bound [in ADT]
TreeETable.elements [in ADT]
TreeETable.rep_ok [in ADT]
TreeTable.default [in ADT]
TreeTable.empty [in ADT]
TreeTable.get [in ADT]
TreeTable.key [in ADT]
TreeTable.set [in ADT]
TreeTable.table [in ADT]
TreeTable.V [in ADT]
trie_table [in Trie]
two [in ADT]
two [in ADT]
TwoListQueueAbs.Abs [in ADT]
TwoListQueueAbs.deq [in ADT]
TwoListQueueAbs.empty [in ADT]
TwoListQueueAbs.enq [in ADT]
TwoListQueueAbs.is_empty [in ADT]
TwoListQueueAbs.peek [in ADT]
TwoListQueueAbs.queue [in ADT]
TwoListQueueAbs.V [in ADT]
two' [in ADT]
t_update [in Maps]
t_empty [in Maps]
U
uncurry [in SearchTree]undirected [in Color]
union [in SearchTree]
union [in Multiset]
Unnamed_thm [in Trie]
Unnamed_thm0 [in Color]
Unnamed_thm [in Color]
Unnamed_thm [in Decide]
update [in Maps]
update_example4 [in Maps]
update_example3 [in Maps]
update_example2 [in Maps]
update_example1 [in Maps]
V
value [in Multiset]vector [in ADT]
vector_app [in ADT]
vector_cons [in ADT]
VerySlow.collisions [in Trie]
VerySlow.collisions_pi [in Trie]
VerySlow.loop [in Trie]
| Global Index | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | _ | other | (2702 entries) |
| Notation Index | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | _ | other | (7 entries) |
| Binder Index | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | _ | other | (1773 entries) |
| Module Index | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | _ | other | (55 entries) |
| Library Index | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | _ | other | (17 entries) |
| Lemma Index | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | _ | other | (330 entries) |
| Constructor Index | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | _ | other | (49 entries) |
| Axiom Index | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | _ | other | (105 entries) |
| Inductive Index | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | _ | other | (23 entries) |
| Definition Index | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | _ | other | (343 entries) |
This page has been generated by coqdoc


Cardamom growers looks at booking profits
Cardamom auction market is witnessing a selling pressure, as growers are looking to book profits.
The total arrivals on Tuesday’s auction at the Spices Centre at Bodinayakanur was 116 tonnes. According to traders, more arrivals to the auctions will definitely put a pressure on buying in view of the recent upward trend in prices on the anticipation that the situation may lead to low arrivals in the coming months.
In the morning trade, the auctioneers Spice More Trading Company has offered 60 tonnes, while the quantity in the afternoon auction conducted by Sugandagiri Spices Promoters and Traders was 56 tonnes.
The traders pointed out that the morning auctions started at a low note even though the prices are ruling higher. The rising trend in prices has prompted growers to sell their stock.
The analysts Acumen Capital Markets Ltd said that cardamom December futures price is showing some recovery on daily chart.


Home
About
Projects
Cheat Sheet
Technical Blog
Arrays & Hashes
CSS Best Practices
Git Blog
Cultural Blog
My Thinking Style
Chefs In The Kitchen
About
Stay tuned...


RASE 19
HOME
Facebook
Instagram
Register Now
Registration
Registration Fee Details
Last Date to Register : 28th January 2019
Hands on Workshop registration fee
For IEEE Members
₹4000
For Non IEEE Members
₹4500
RASE Registration Fee:
For IEEE Members
₹500
For Non IEEE Members
₹600
Are you excited for RASE 19 too?
Make Every Robot Count. Register Soon.Limited Seats only.
Thank you for supporting us!
Keep in Touch with our Team.
Contact Us:
Phone :
• Dharahas -<PHONE_NUMBER> •
• Ivan -<PHONE_NUMBER> •
• Dharanidhar -<PHONE_NUMBER> •
• Vasuda -<PHONE_NUMBER> •
• Pavan -<PHONE_NUMBER> •
• Reetika -<PHONE_NUMBER> •
Where To Find Us:


{% extends 'base_email.html' %} {% block body %}
Hi,
{{ object.email_msg }}
Prove {{ object.vendor.name }}
This link expires in 7 days for security reasons
Thanks for helping {{ object.created_by.first_name }} out, Proven


Scope.
What is it?
Scope is a term used to describe the extent from which a declared variable is able to be accessed. Although there are several types of scope, javascript uses only two: global scope and local scope.
A variable with global scope is able to be accessed anywhere within the code, it effectively has global reach. Conversely, a variable with local scope can only be used within a certain environment. An attempt to access the variable from outside this environment would result in an error, as from outside the variable doesn't exist.
You could imagine scope as a mafia empire. All the information at street level, all the money in the shops, the everyday comings and goings of citizens, it is all accessible by anyone, from the mafia Boss, to the street urchin. But as you move closer in towards the Boss's inner circle, there are items that only certain people can access - dirty money, cars, guns, secrets. The closer you get to the Boss, the more limited the scope of access to those items. Any item that is directly local to the Boss, is not accessible by anyone outside of himself.


DISSERTATION
IMAGE - A FACTOR IN TOURISM
Submitted by
John D. Hunt
In partial fulfillment of the requirements for the Degree of Doctor of Philosophy Colorado State University Fort Collins, Colorado
August, 1971
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.


MicroFinance
“Making World Self Reliant..Connecting Financers and Industries Together"
Small Industries Financing Platform
My Loans
Request Loan
Repayment
Clear Loan
All Financers
Switch To Financer
Request Loan From Our Financers
×
Apply Now
Submit
Repay Loan Amount
×
Repayments:
Submit
Loan Clearance
×
Clear Settled Loans
Submit
Loan Details
Get Details
Get Status


COVID-19 Update
Did you lose your job or have your hours reduced as a result of COVID-19? Visit the COVID-19 Jobs Portal.
Learn More
Link Opens in New Tab
Ask Your COVID-19
What you need to know
View All-
Governor Murphy Announces Statewide Stay at Home Order, Closure of All Non-Essential Retail Businesses
To mitigate the impact of COVID-19 and protect the capacity of New Jersey's health care system for the state's most vulnerable, Governor Phil Murphy today (3/21/20) signed Executive Order No. 107, ...Learn More -
Where can I learn more about information on COVID-19's impact on businesses, and what resources are available to help?
For information on COVID-19/Novel Coronavirus and its impact on businesses, please visit the State of New Jersey business portal at https://cv.business.nj.gov. You'll find information about resourc...Learn More -
Have elective surgeries been suspended?
All elective surgeries and invasive procedures performed on adults that are scheduled to take place after 5:00 p.m. on Friday, March 27 are to be suspended. All medical and dental operations that c...Learn More -
If I'm a business that urgently needs workers, or if I'm a worker looking for a job, where can I go?
Businesses across New Jersey are looking to hire THOUSANDS OF WORKERS, including those who lost their jobs or have had hours reduced as a result of COVID19. Learn more about who is hiring in your c...Learn More
Find services and information
-
How can I prevent myself from getting the virus?
To ensure the lowest chance of obtaining the virus, and spreading the virus to others, it is critical that everyone begin intensive social distancing immediately. As much as possible, limit contact...Learn More -
If I get infected, when do symptoms appear?
Symptoms can appear between 2-14 days after exposure, though some people may not have any symptoms while still being contagious. It's also important to consider whether you've been in contact with ...Learn More -
What would lead you to believe that someone is infected with COVID-19?
Identifying people who may be infected with COVID-19 virus relies on recognizing the symptoms that are caused by infection (fever, cough, shortness of breath), ruling out other causes for those sym...Learn More -
Can the COVID-19 virus be spread through food, including refrigerated or frozen food?
Coronaviruses are generally thought to be spread from person-to-person through respiratory droplets. Currently there is no evidence to support transmission of COVID-19 associated with food. Before ...Learn More
Announcements
View All-
New Jersey Launches Job Portal to Connect Out-of-Work Residents to Opportunities in Critical Industr
TRENTON, NJ -- Governor Phil Murphy today announced the launch of a new online portal to connect New Jersey residents with jobs in critical industries responding to COVID-19. The jobs portal is ava...Learn More -
AG Grewal, DOH Commissioner Persichilli Announce Guidance for Healthcare Providers on Safely Evaluating Patients for COVID-19
NEWARK -- Attorney General Gurbir S. Grewal and Department of Health Commissioner Judith M. Persichilli announced today their Departments have issued guidance to thousands of health care profession...Learn More -
Governor Murphy Suspends All Elective Surgeries, Invasive Procedures to Preserve Essential Equipment and Hospital Capacity
TRENTON -- As part of the state's effort to preserve the capacity of the health care system to respond to COVID-19, Governor Phil Murphy today signed Executive Order No. 109, directing the suspensi...Learn More -
Murphy Administration Sends Letter Directing Commercial Laboratories to Report All COVID-19 Test Results to the Department of Health
TRENTON -- In a letter to commercial laboratory operators, Jared M. Maples, Director of the New Jersey Office of Homeland Security and Preparedness and Chair of the New Jersey Domestic Security Pre...Learn More
live


GlowUP.com
Home
Hair
Tutorials
Tips
Celebrities
Makeup
Tutorials
Tips
Celebrity Looks
Nails
Tutorials
Tips
Colors
Designs
Skin Care
Daily Routine
Tips
Problem Areas
Nail Polish Colors
See More at:
Sally Hansen
Born Petty
Sally Beauty
Nail Store
Hypno Polish


This chapter describes the JAX-RS Client API and includes examples of how to access REST resources using the Java programming language.
JAX-RS provides a client API for accessing REST resources from other Java applications.
The following topics are addressed here:
The JAX-RS Client API provides a high-level API for accessing any REST resources, not just JAX-RS services. The Client API is defined in the javax.ws.rs.client
package.
The following steps are needed to access a REST resource using the Client API.
Obtain an instance of the javax.ws.rs.client.Client
interface.
Configure the Client
instance with a target.
Create a request based on the target.
Invoke the request.
The Client API is designed to be fluent, with method invocations chained together to configure and submit a request to a REST resource in only a few lines of code.
Client client = ClientBuilder.newClient(); String name = client.target("http://example.com/webapi/hello") .request(MediaType.TEXT_PLAIN) .get(String.class);
In this example, the client instance is first created by calling the javax.ws.rs.client.ClientBuilder.newClient
method. Then, the request is configured and invoked by chaining method calls together in one line of code. The Client.target
method sets the target based on a URI. The javax.ws.rs.client.WebTarget.request
method sets the media type for the returned entity. The javax.ws.rs.client.Invocation.Builder.get
method invokes the service using an HTTP GET
request, setting the type of the returned entity to String
.
The Client
interface defines the actions and infrastructure a REST client requires to consume a RESTful web service. Instances of Client
are obtained by calling the ClientBuilder.newClient
method.
Client client = ClientBuilder.newClient();
Use the close
method to close Client
instances after all the invocations for the target resource have been performed:
Client client = ClientBuilder.newClient(); ... client.close();
Client
instances are heavyweight objects. For performance reasons, limit the number of Client
instances in your application, as the initialization and destruction of these instances may be expensive in your runtime environment.
The target of a client, the REST resource at a particular URI, is represented by an instance of the javax.ws.rs.client.WebTarget
interface. You obtain a WebTarget
instance by calling the Client.target
method and passing in the URI of the target REST resource.
Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://example.com/webapi");
For complex REST resources, it may be beneficial to create several instances of WebTarget
. In the following example, a base target is used to construct several other targets that represent different services provided by a REST resource.
Client client = ClientBuilder.newClient(); WebTarget base = client.target("http://example.com/webapi"); // WebTarget at http://example.com/webapi/read WebTarget read = base.path("read"); // WebTarget at http://example.com/webapi/write WebTarget write = base.path("write");
The WebTarget.path
method creates a new WebTarget
instance by appending the current target URI with the path that was passed in.
Path parameters in client requests can be specified as URI template parameters, similar to the template parameters used when defining a resource URI in a JAX-RS service. Template parameters are specified by surrounding the template variable with braces ({}
). Call the resolveTemplate
method to substitute the {username}
, and then call the queryParam
method to add another variable to pass.
WebTarget myResource = client.target("http://example.com/webapi/read") .path("{userName}") .resolveTemplate("userName", "janedoe") .queryParam("chapter", "1");// http://example.com/webapi/read/janedoe?chapter=1Response response = myResource.request(...) .get();
After setting and applying any configuration options to the target, call one of the WebTarget.request
methods to begin creating the request. This is usually accomplished by passing to WebTarget.request
the accepted media response type for the request either as a string of the MIME type or using one of the constants in javax.ws.rs.core.MediaType
. The WebTarget.request
method returns an instance of javax.ws.rs.client.Invocation.Builder
, a helper object that provides methods for preparing the client request.
Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://example.com/webapi/read"); Invocation.Builder builder = myResource.request(MediaType.TEXT_PLAIN);
Using a MediaType
constant is equivalent to using the string defining the MIME type.
Invocation.Builder builder = myResource.request("text/plain");
After setting the media type, invoke the request by calling one of the methods of the Invocation.Builder
instance that corresponds to the type of HTTP request the target REST resource expects. These methods are:
get()
post()
delete()
put()
head()
options()
For example, if the target REST resource is for an HTTP GET request, call the Invocation.Builder.get
method. The return type should correspond to the entity returned by the target REST resource.
Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://example.com/webapi/read"); String response = myResource.request(MediaType.TEXT_PLAIN) .get(String.class);
If the target REST resource is expecting an HTTP POST request, call the Invocation.Builder.post
method.
Client client = ClientBuilder.newClient(); StoreOrder order = new StoreOrder(...); WebTarget myResource = client.target("http://example.com/webapi/write"); TrackingNumber trackingNumber = myResource.request(MediaType.APPLICATION_XML) .post(Entity.xml(order), TrackingNumber.class);
In the preceding example, the return type is a custom class and is retrieved by setting the type in the Invocation.Builder.post(Entity<?> entity, Class<T> responseType)
method as a parameter.
If the return type is a collection, use javax.ws.rs.core.GenericType<T>
as the response type parameter, where T
is the collection type:
List<StoreOrder> orders = client.target("http://example.com/webapi/read") .path("allOrders") .request(MediaType.APPLICATION_XML) .get(new GenericType<List<StoreOrder>>() {});
This preceding example shows how methods are chained together in the Client API to simplify how requests are configured and invoked.
The rsvp
and customer
examples use the Client API to call JAX-RS services. This section describes how each example application uses the Client API.
The rsvp
application allows users to respond to event invitations using JAX-RS resources, as explained in Chapter 29, "The rsvp Example Application". The web application uses the Client API in CDI backing beans to interact with the service resources, and the Facelets web interface displays the results.
The StatusManager
CDI backing bean retrieves all the current events in the system. The client instance used in the backing bean is obtained in the constructor:
public StatusManager() { this.client = ClientBuilder.newClient(); }
The StatusManager.getEvents
method returns a collection of all the current events in the system by calling the resource at http://localhost:8080/rsvp/webapi/status/all
, which returns an XML document with entries for each event. The Client API automatically unmarshals the XML and creates a List<Event>
instance.
public List<Event> getEvents() { List<Event> returnedEvents = null; try { returnedEvents = client.target(baseUri) .path("all") .request(MediaType.APPLICATION_XML) .get(new GenericType<List<Event>>() { }); if (returnedEvents == null) { logger.log(Level.SEVERE, "Returned events null."); } else { logger.log(Level.INFO, "Events have been returned."); } } catch (WebApplicationException ex) { throw new WebApplicationException(Response.Status.NOT_FOUND); } ... return returnedEvents; }
The StatusManager.changeStatus
method is used to update the attendee's response. It creates an HTTP POST
request to the service with the new response. The body of the request is an XML document.
public String changeStatus(ResponseEnum userResponse, Person person, Event event) { String navigation; try { logger.log(Level.INFO, "changing status to {0} for {1} {2} for event ID {3}.", new Object[]{userResponse, person.getFirstName(), person.getLastName(), event.getId().toString()}); client.target(baseUri) .path(event.getId().toString()) .path(person.getId().toString()) .request(MediaType.APPLICATION_XML) .post(Entity.xml(userResponse.getLabel())); navigation = "changedStatus"; } catch (ResponseProcessingException ex) { logger.log(Level.WARNING, "couldn''t change status for {0} {1}", new Object[]{person.getFirstName(), person.getLastName()}); logger.log(Level.WARNING, ex.getMessage()); navigation = "error"; } return navigation; }
The customer
example application stores customer data in a database and exposes the resource as XML, as explained in Chapter 31, "The customer Example Application". The service resource exposes methods that create customers and retrieve all the customers. A Facelets web application acts as a client for the service resource, with a form for creating customers and displaying the list of customers in a table.
The CustomerBean
stateless session bean uses the JAX-RS Client API to interface with the service resource. The CustomerBean.createCustomer
method takes the Customer
entity instance created by the Facelets form and makes a POST call to the service URI.
public String createCustomer(Customer customer) { if (customer == null) { logger.log(Level.WARNING, "customer is null."); return "customerError"; } String navigation; Response response = client.target("http://localhost:8080/customer/webapi/Customer") .request(MediaType.APPLICATION_XML) .post(Entity.entity(customer, MediaType.APPLICATION_XML), Response.class); if (response.getStatus() == Status.CREATED.getStatusCode()) { navigation = "customerCreated"; } else { logger.log(Level.WARNING, "couldn''t create customer with id {0}. Status returned was {1}", new Object[]{customer.getId(), response.getStatus()}); FacesContext context = FacesContext.getCurrentInstance(); context.addMessage(null, new FacesMessage("Could not create customer.")); navigation = "customerError"; } return navigation; }
The XML request entity is created by calling the Invocation.Builder.post
method, passing in a new Entity
instance from the Customer
instance, and specifying the media type as MediaType.APPLICATION_XML
.
The CustomerBean.retrieveCustomer
method retrieves a Customer
entity instance from the service by appending the customer's ID to the service URI.
public String retrieveCustomer(String id) { String navigation; Customer customer = client.target("http://localhost:8080/customer/webapi/Customer") .path(id) .request(MediaType.APPLICATION_XML) .get(Customer.class); if (customer == null) { navigation = "customerError"; } else { navigation = "customerRetrieved"; } return navigation; }
The CustomerBean.retrieveAllCustomers
method retrieves a collection of customers as a List<Customer>
instance. This list is then displayed as a table in the Facelets web application.
public List<Customer> retrieveAllCustomers() { List<Customer> customers = client.target("http://localhost:8080/customer/webapi/Customer") .path("all") .request(MediaType.APPLICATION_XML) .get(new GenericType<List<Customer>>() { }); return customers; }
Because the response type is a collection, the Invocation.Builder.get
method is called by passing in a new instance of GenericType<List<Customer>>
.
This section describes some of the advanced features of the JAX-RS Client API.
Additional configuration options may be added to the client request after it is created but before it is invoked.
You can set HTTP headers on the request by calling the Invocation.Builder.header
method.
Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://example.com/webapi/read"); String response = myResource.request(MediaType.TEXT_PLAIN) .header("myHeader", "The header value") .get(String.class);
If you need to set multiple headers on the request, call the Invocation.Builder.headers
method and pass in a javax.ws.rs.core.MultivaluedMap
instance with the name-value pairs of the HTTP headers. Calling the headers
method replaces all the existing headers with the headers supplied in the MultivaluedMap
instance.
Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://example.com/webapi/read"); MultivaluedMap<String, Object> myHeaders = new MultivaluedMap<>("myHeader", "The header value"); myHeaders.add(...); String response = myResource.request(MediaType.TEXT_PLAIN) .headers(myHeaders) .get(String.class);
The MultivaluedMap
interface allows you to specify multiple values for a given key.
MultivaluedMap<String, Object> myHeaders = new MultivaluedMap<String, Object>(); List<String> values = new ArrayList<>(); values.add(...) myHeaders.add("myHeader", values
You can add HTTP cookies to the request by calling the Invocation.Builder.cookie
method, which takes a name-value pair as parameters.
Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://example.com/webapi/read"); String response = myResource.request(MediaType.TEXT_PLAIN) .cookie("myCookie", "The cookie value") .get(String.class);
The javax.ws.rs.core.Cookie
class encapsulates the attributes of an HTTP cookie, including the name, value, path, domain, and RFC specification version of the cookie. In the following example, the Cookie
object is configured with a name-value pair, a path, and a domain.
Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://example.com/webapi/read"); Cookie myCookie = new Cookie("myCookie", "The cookie value", "/webapi/read", "example.com"); String response = myResource.request(MediaType.TEXT_PLAIN) .cookie(myCookie) .get(String.class);
You can register custom filters with the client request or the response received from the target resource. To register filter classes when the Client
instance is created, call the Client.register
method.
Client client = ClientBuilder.newClient().register(MyLoggingFilter.class);
In the preceding example, all invocations that use this Client
instance have the MyLoggingFilter
filter registered with them.
You can also register the filter classes on the target by calling WebTarget.register
.
Client client = ClientBuilder.newClient().register(MyLoggingFilter.class); WebTarget target = client.target("http://example.com/webapi/secure") .register(MyAuthenticationFilter.class);
In the preceding example, both the MyLoggingFilter
and MyAuthenticationFilter
filters are attached to the invocation.
Request and response filter classes implement the javax.ws.rs.client.ClientRequestFilter
and javax.ws.rs.client.ClientResponseFilter
interfaces, respectively. Both of these interfaces define a single method, filter
. All filters must be annotated with javax.ws.rs.ext.Provider
.
The following class is a logging filter for both client requests and client responses.
@Provider public class MyLoggingFilter implements ClientRequestFilter, ClientResponseFilter { static final Logger logger = Logger.getLogger(...); // implement the ClientRequestFilter.filter method @Override public void filter(ClientRequestContext requestContext) throws IOException { logger.log(...); ... } // implement the ClientResponseFilter.filter method @Override public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException { logger.log(...); ... } }
If the invocation must be stopped while the filter is active, call the context object's abortWith
method, and pass in a javax.ws.rs.core.Response
instance from within the filter.
@Override public void filter(ClientRequestContext requestContext) throws IOException { ... Response response = new Response(); response.status(500); requestContext.abortWith(response); }
In networked applications, network issues can affect the perceived performance of the application, particularly in long-running or complicated network calls. Asynchronous processing helps prevent blocking and makes better use of an application's resources.
In the JAX-RS Client API, the Invocation.Builder.async
method is used when constructing a client request to indicate that the call to the service should be performed asynchronously. An asynchronous invocation returns control to the caller immediately, with a return type of java.util.concurrent.Future<T>
(part of the Java SE concurrency API) and with the type set to the return type of the service call. Future<T>
objects have methods to check if the asynchronous call has been completed, to retrieve the final result, to cancel the invocation, and to check if the invocation has been cancelled.
The following example shows how to invoke an asynchronous request on a resource.
Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://example.com/webapi/read"); Future<String> response = myResource.request(MediaType.TEXT_PLAIN) .async() .get(String.class);
The InvocationCallback
interface defines two methods, completed
and failed
, that are called when an asynchronous invocation either completes successfully or fails, respectively. You may register an InvocationCallback
instance on your request by creating a new instance when specifying the request method.
The following example shows how to register a callback object on an asynchronous invocation.
Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://example.com/webapi/read"); Future<Customer> fCustomer = myResource.request(MediaType.TEXT_PLAIN) .async() .get(new InvocationCallback<Customer>() { @Override public void completed(Customer customer) { // Do something with the customer object } @Override public void failed(Throwable throwable) { // handle the error } });


Welcome To Coffee Cup
Welcome to Coffee Cup – a café-based idea that every cup of coffee served will be the highest possible standard of quality and taste.
We have tremendous respect for all who work to provide us with the world's finest coffees - the growers who work at origin, those who source the best of the best, those who import to ensure the beans arrive "in season," those who roast to bring out the inherent flavours of the bean and those, in our café, that prepare the coffee and enhance the customer experience.
 It is a place where you will be served a coffee that represents everything the producers had in mind when they harvested and evaluated the results of their labour.
At Coffee Cup, our principle, our commitment, our belief, is to maintain the quality of the coffee that began at seed, and to extract that quality into every cup we offer.


Spotify Free Tier Coming to Alexa, Sonos, And Bose Devices
by Charlotte HenrySpotify’s free tier is coming to Alexa powered devices. It will also work on Sonos and Bose devices, Techcrunch reported. Previously only those with a premium subscription could access their music on such speakers.
In the case of Alexa devices, like Amazon Echo speakers or the Fire TV, users will be able to ask Alexa to play Spotify’s playlist, like “Today’s Top Hits,” or their personalized playlist, “Discover Weekly,” among others. The service can also be set as the default, so you can use commands like “Play my Discover Weekly,” “Like this song,” or “Pause,” and more, without having to say “on Spotify.” Meanwhile, on Sonos and Bose speakers, users can set up Spotify Connect from the Spotify app. This works with Bose smart speakers and soundbars, as well as all Sonos smart speakers, including the new indoor/outdoor speaker Sonos Move and the Symfonisk IKEA WiFi Speaker, integrated with the Sonos Home Sound System.
Check It Out: Spotify Free Tier Coming to Alexa, Sonos, And Bose Devices


In any given day you could see Lee doing his work, while calling out "hi, Siri" and chating Siri up. Normally they would talk about anything just like normal couples would do, from some cold knowledge that only Siri would know like what was the biggest known prime number to love talk or random flirting.
 But Lee never talked about it to protect his manhood, for he thought he would never be needed if Siri were to take his place in the organization, nor would anyone else in the organization.


{% extends 'layout.html' %}
{% load static %}
{% csrf_token %}
{% block body %}
We track price of millions of products on daily basis from multiple stores.When user requests data for particular product our system renders that data into a chart
Price History allows you to check historic price charts for millions of products from multiple stores
Get notified whenever price of your favourite product drops, Our active tracking system will notify you
We won't charge you a single penny for using any of our services. Neither we serve ads on any platform
E-commerce stores provide deals everyday with fake discounted prices. Identify them with Price Charts
You can wishlist unlimited products from any store to quickly access price history from your wishlist
We have the best support team, just ask for any feature you need on our platform or any other query


Toggle Navigation
From Responsive Navigation Patterns:
For small screens a “menu” button appears that, when clicked, expands an accordion style navigation. When more screen real estate becomes available
Pros
- Keeps the user in place- Where the footer anchor jumps suddenly, the toggle menu simply appears in place, which doesn’t disorient the user.
- Elegant- This is definitely one of the more classy approaches. No awkward forms or page jumps, just a smooth animated flyout or basic show/hide.
- Easy to scale up- All you need to do is hide the mobile trigger and show the nav list when the appropriate breakpoint is reached and you have yourself a normal large screen nav. All this can be accomplished with CSS.
Cons
- Animation performance- Your mileage will vary when doing any sort of animation on mobile devices. Android is notoriously bad with CSS animations and so things might not be as smooth as you’d like. Also, for what it’s
worth I’ve recently been animating max-height which seems to work well.
- Javascript dependency- Again this approach relies on a bit of Javascript in order to trigger the toggle, but it’s minimal. I have one Blackberry test device that refuses to listen to any of this stuff, but most browsers, including
proxy browsers like Opera Mini and Dolphin Mini, handle it just fine.
In the Wild
Resources


| Introduction to Arches National Park | ||
| Virtual Tour | History of Arches | Location Map |
This page will link you to the miraculous world of Arches National Park. I have created a virtual tour of some of the most famous arches throughout the park. The tour begins by clicking the virtual tour link. Clicking on the red stars next to each feature will pull up the images and facts about the park. Simply follow the road through the park and begin to discover one of natures blessings. To begin, you may want to familiarize yourself with the location, if you don't already know! |


This project template is the basis of an PCB for the
Hammond Manufacturing RM2015S Enclosure
Board Dimensions: 123mm x 88mm
Case Dimensions: 130mm x 100mm x 30.8mm
Panel Dimensions: 123.8mm x 26.2mm
(c) 2019 Kai Raphahn
(c) 1997-2019 Hammond Mfg Co Inc


{% extends "home-page.html"%} {% block title %}Home Page{% endblock %} {% block head%} {{ super() }} {% endblock%} {% block page_content%}
Hello, I am Jeff Pala. My GPA is 3.4, and skills include Java, Microsoft Office, etc. I enjoy to spend my time outdoors as I love fishing and hunting. I like to watch football and am a very passionate Philadelphia Eages fan. When I have downtime I like to watch comedy movies and play video games like Fortnite.


Edit: local storage does not persist through closing a window completely. What is the command to use BBLog storage, and why does using instance.t() only work up until the first space?
I saw this in CS:GO and I thought it was pretty neat. Here is a plugin that does the same(within battlelog only of course :( ) Spaces are allowed.
I do it like this in my plugins: instance: null,
init: function (instance) {
this.instance = instance
this.domchange()
},
domchange: function () {
this.weaponName()
},
you can refer to the instance using this: this.instance.storage("storagekey")
Topicstarter
GameFreakBoy
So something like that? Also, what do you do about remove the storage?
BrainFooLong
Administrator
Check out the example plugin that explains mostly all what you need.
Read carefully the code documentation in the example.
http://getbblog.com/plugins/example.js
kurtextrem
GameFreakBoy wrote:
So something like that? Also, what do you do about remove the storage?
this.instance.storage("storagekey") = null or undefined.


My mother's contact details -
<EMAIL_ADDRESS>Phone no.-7827758011
My father's contact details-
<EMAIL_ADDRESS>Phone no.-9899378292
My contact details-
<EMAIL_ADDRESS>Phone no.-9873952325
My sister's contact details-
<EMAIL_ADDRESS>Phone no.-3842834732473
HOME ADDRESS-
HOUSE NO 14, BLOCK 2,
SPRING FIELD COLONY,
FARIDABAD, HARYANA-121003


Education
2011-2013 - MSc
Computer Engineering
Faculdade Ciências e Tecnologia / Universidade
Nova de Lisboa
Thesis: Adaptation of a C++ framework for general programming on graphics cards to support multiple, cooperative, graphics cards, with
heavy reliance on Object Oriented programming mechanisms for structured computations and implicit optimizations.
2007-2011 - BSc
Computer Engineering
Faculdade Ciências e Tecnologia / Universidade
Nova de Lisboa
Publications
Fernando Alexandre, Ricardo Marques and Hervé Paulino:
Esqueletos Algorítmicos para Paralelismo de Tarefas em Sistemas Multi-GPU.
In: INForum - Simpósio de Informática 2013, Évora, Portugal, 5-6 September 2013.
Note: Participant and speaker for the paper presentation.
Ricardo Marques, Hervé Paulino, Fernando Alexandre and Pedro D. Medeiros:
Algorithmic Skeleton Framework for the Orchestration of GPU Computations.
In: Proceedings of Euro-Par 2013 Parallel Processing - 19th International Conference,
Aachen, Germany, August 26-30, 2013.
Note: Participant and speaker for the paper presentation.


An Introduction
Over the next several weeks I will be writing several blog posts that will provide an introduction to Cross Platform Development with Xamarin. This will be my first post in the series.
What is Xamarin?
Xamarin is a suite of application tools that allow you to build cross-platform applications. Xamarin uses an open source implementation of the .Net Framework, Mono. Mono provides a set of Base Class Libraries that provide the foundation which an application can be built. Mono also includes a set of Mono Class Libraries that go beyond what the BCL’s provide.
From a developers perspective, you can leverage your knowledge of the C# Programming language and the .Net Framework to build native applications across iOS, Android, Mac, and Windows.
How to get started?
You can start by downloading the Xamarin Platform for either OS X or Windows from their download page. You’ll have to provide them some details. They offer a pricing tier which ranges from free for a Starter Edition to an Enterprise Edition for under $1900. They also offer Student license, so if you’re a student make you fill out their student form.
Hello World an iOS App
For this demonstration you will need at least the Indie license given that we will be building a Xamarin Forms app. Also, I will be using Xamarin Studio on OS X Yosemite so this means you will need XCode installed. To build an iOS App, a Mac is a prerequisite. However, If you’re only concerned with Android you could go through this demo on a Windows Desktop. You will need to do some additional work to configure Android Player. Although it’s still in Beta, it works fine for our Demo. Feel free to give it a whirl.
- Launch Xamarin Studio from the Launchpad
- File -> New Project -> in the New Solution dialog, in the left pane, choose Mobile Apps under C#
-
Choose Blank App (Xamarin.Forms Portable)
- Name your Solution ‘FormsDemo’
Xamarin Studio will do it thing and create a few projects for you to get started. You should have a FormsDemo project that will provide all the back end code for your two platform specific projects to share. You should also see a FormsDemo.Droid and a FormsDemo.iOS. Those are you two platform specific projects.
Before we start coding we will Right Click on the FormsDemo solution, and Update NuGet packages. This will ensure we are using the latest bits.
Ensure you have FormsDemo.iOS selected as the Startup Project and that you’re project is set to Debug with an iOS Simulator. I will be using iPhone 6 iOS 8.3 for this. Then hit the play button to Launch.
And with that, you have successfully created an iOS Application using Xamarin Studio.


You can choose options for your Among Us servers that you can't normally choose.
Some are limited however, e.g. the player count, because Among Us rejects your server
create request with any more. Others are also maxed at 255, as this is the max
value allowed for unsigned chars (which is what the game uses for these values.).
To install your host options, click download and replace the file with the same name
in "Appdata\LocalLow\Innersloth\Among Us" with the file that you downloaded. If you
are on android, the folder is in "Android\Data\com.innersloth.spacemafia\files".
Created by "weakeyes"#4248 on discord, or
edqx on github.


Symbol Index for "Incident Type"
Symbol Index for diagram
"Incident Type"
Activity Type (Class)
classifier (Association)
Contact Method (Class)
DC/Describing (Generalization Node)
Descriptive Category (Class)
Incident (Class)
Incident Type (Class)
Intention Type (Class)
Level (Class)
Reason For Abandoning (Class)
Reason For Rejection (Class)
Reason Not Required (Class)
Resource Type (Class)
State Type (Class)
Subject Characteristic Type (Class)


Put a bird on it fanny pack hexagon flexitarian next level leggings edison bulb coloring book yr chambray sriracha chicharrones enamel pin adaptogen.  Salvia raclette locavore intelligentsia gochujang mumblecore truffaut etsy. Affogato butcher lo-fi, scenester art party helvetica cliche.
Shabby chic authentic chillwave single-origin coffee 3 wolf moon salvia kogi lyft narwhal before they sold out brunch coloring book. Disrupt meditation activated charcoal sriracha pour-over post-ironic, YOLO enamel pin bespoke affogato cardigan. Everyday carry normcore retro, wolf ennui fashion axe offal mlkshk roof party craft beer small batch
Sustainable single-origin coffee pitchfork readymade, jean shorts etsy chia +1 bicycle rights edison bulb put a bird on it man bun 3 wolf moon polaroid. Lomo air plant actually neutra selfies polaroid cronut 3 wolf moon coloring book 90's vape kickstarter readymade meggings celiac.
 Forage chambray subway tile, vice +1 mlkshk fingerstache selvage twee scenester woke deep v. Leggings disrupt seitan neutra umami. Vexillologist bicycle rights brunch disrupt pug cardigan pork belly hexagon. Squid literally gochujang poutine beard raw denim.
Migas bushwick flannel bicycle rights celiac truffaut trust fund flexitarian raclette keytar kombucha. Woke wolf unicorn hella church-key. Pinterest echo park fingerstache, jianbing stumptown trust fund ethical franzen direct trade yuccie brunch leggings kombucha iceland. VHS quinoa helvetica, thundercats blue bottle ennui yr. Lyft squid air plant, woke forage farm-to-table bitters live-edge.
Hot chicken jianbing coloring book tumblr truffaut VHS. Tumblr bespoke paleo kombucha narwhal man braid crucifix artisan street art keytar heirloom. Cred quinoa street art, freegan cornhole meh photo booth slow-carb tote bag. Iceland tote bag godard keytar poke etsy.
DIY food truck tilde thundercats scenester, ethical swag green juice mlkshk taiyaki venmo. Fam man braid fixie sriracha migas swag poke, helvetica flannel tilde asymmetrical. Vice marfa selfies, portland chicharrones bitters blog selvage ugh tumblr mumblecore. Coloring book austin disrupt bitters try-hard flexitarian before they sold out. Truffaut synth banh mi messenger bag air plant, venmo beard polaroid. Viral pitchfork bitters jean shorts, chartreuse farm-to-table ennui yuccie sartorial.


OK, let’s look at what we have learned from writing a drawTriangle and drawOctagon function. The first thing you had to figure out was that you needed to modify the parameter to the range function based on the number of sides in the polygon. The next thing, and this may have been the most challenging part for you was to figure out how much to turn each time. The following table summarizes what you probably learned very nicely. If you didn’t, look at the table and then go back to the previous page and see if you can finish drawTriangle and drawOctagon.
| Shape | Sides | range() | Angle |
|---|---|---|---|
| Triangle | 3 | 3 | 360/3 = 120 |
| Square | 4 | 4 | 360/4 = 90 |
| Octagon | 8 | 8 | 360/8 = 45 |
Looking at the table above you can really see that there is a pattern. If you know the number of sides you want, the rest can be figured out from there. This leads us to the next problem solving stage of this exercise, generalization. Why write a separate function for every kind of polygon when you can just write a single function that can be used to draw many different polygons?
Our new function drawPolygon will have three parameters, a turtle and the length of the side just like we have in the previous functions, but now we will add an additional parameter: numSides.
Here’s the starting point for the drawPolygon function, see if you can fill in the details on your own.
Now that we have our drawPolygon function working we are almost done with the drawCircle function. In fact if you tried to make a 100 sided polygon, you probably noticed that it looked suspiciously close to a circle. The only thing we’ll want to do differently is to remember that we don’t usually specify a circle according to the number of sides it has, but rather we specify a circle by its radius.
So, here is our next problem solving challenge. Given a radius, how can we transform the radius into the parameters we need for the drawPolygon function? Let’s figure this out in two steps. First what should we use as the number of sides? Second, what should we use as the side length? To simplify the problem we can make a simple assumption about the number of sides. Let’s just assume that 360 sides is going to be good enough for any circle. Plus, it just makes sense that a circle has 360 degrees, one side for each degree should give us a nice round circle.
Now that we have the number of sides figured out we can use a bit of math to figure out the length of each of those sides. Since we are given the radius we know how large the circumference of the circle is. Right? You may remember from math class that the circumference of a circle is 2 * pi * radius. If we know the circumference and the number of sides (360), then the length of each side should be an equal proportion of the circumference. circumference / 360.
Here’s the final solution:
One annoying limitation of this drawCircle function is that it draws the circle to the right of the turtle’s current position and heading. As a short aside, how could you change one line of the code to draw the circle to the left of the turtle’s current position and heading? What we would really like is to have the circle centered on the turtle’s current position when drawCircle is called. Modify the program above to make it so.
Finally, write another function drawFilledCircle that takes a turtle, a radius, and a color to fill in the circle.


Campanula
More pictures
About
Fleurs magiques
About Campanula
Campanula is a wonderful wonderful flowering plant.


Dimenhydrinate & Amanitas - A. pantherina
It is now the day after my fourth experience with dimenhydrinate. I have been purchasing this drug at the local pharmacy. The generic motion sickness tablets cost $3 for 30 pills.
The first trip, I decided to play it safe and take 8 pills (400mg dimenhydrinate). I would say that was about perfect for the first time. It allowed me to understand the nature of the trip, and feel the side-effects, without feeling that I was going insane, or on the brink of death. I did not experience any true hallucinations. I did see the strange translucent film over everything, as described in many reports on erowid. I also experienced some closed-eye-visuals (CEVs) remeniscent of those experienced on LSD or mushrooms.
The side effects included: need to urinate frequently, dryness of the eyes and throat and drowziness. Eventually I gave in to the tiredness and slept. The next day I felt fine, although a little 'dreamy.' I would not describe this trip as particularily 'good' or 'bad.'
The second trip, I took 12 pills (600mg dimenhydrinate). This trip started similarily to the first. On this trip, however, I began to hallucinate. I heard people calling my name from outside, and would see bugs flying around the room. When I closed my eyes, I had strange visions. I would see fantastic imaginary worlds. These images would flow and melt into one another. This process reminded me of previous DXM trips. Again, I felt ok the next day.
The third trip, I took the remaining 10 pills (500mg) from the first box of 30. I decided to try something that im not aware any one has tried, and also drank some aminita tea. The tea was made with 2 aminita pantherina caps steeped in about one litre of water. The pills kicked in quickly, about the same time that the tea was ready, about 40 minutes after the pills had been consumed. I drank the tea and screwed around on the computer for another half hour or so, before retiring to my bedroom.
I lay on my bed, quite ammused by the strange, rippling film over my walls and celing. I began to get drowzy, and closed my eyes. I again experienced strange visions of ethereal worlds. Eventually I started blacking out. I would dive into these strange worlds and begin exploring, only to awaken and wonder what I had just seen and experienced.
During one of these blackouts, I moved to the bathroom. I didn't turn on the light before I closed the door. That one oversight provided for some of the strangest tripping I've ever experienced. By this time I was very high on both the dimenhydrinate and the aminita pantherinas. I crawled around the bathroom, flowing back and forth between unconscious and semi-conscious states.
When I finally returned to a conscious state, I found my self urinating on the wall. I realized what I was doing, and fumbled around for the light switch. When the bathroom lights came on, I cleaned up the urine, and noticed my pants lying in the corner of the room. Apparantly, I had urinated in them, then discarded them, before continuing my trip.  By this time it was about 4:30am. I had consumed the motion sickness pills at about 7:30pm. I crawled into bed and fell asleep. Although I would not really describe this trip as 'pleasurable,' it was a good, fascinating experience.
Yesterday, I bought another 30pack of motion sickess pills. This time I started with 10 pills, and as the trip progressed ingested 8 more, for a total of 18 pills, or 900mg dimenhydrinate. This time I had full out hallucinations. I saw tiny little colourful bugs crawling over my bed. I could even pick them up, and feel them between my fingers. I looked out my window and saw a large glowing ball of energy hovering beside my room. There were people talking to me, including my boss, some of my friends, and some strangers.
Looking out my window, I would see cats or people walking down the street then fading out of existance. At one point I saw some big-headed, ostritch-like birds battleing on my neighbors' lawn. I saw some strange translucent shapes moving around both inside and outside of my room. These shaped did not seem to be part of the sheet of gel that covers everything on a dimenhydrinate trip. They seemed to be individual entities. I must say, I have seen very intense visuals on LSD and mushrooms, but I had never truely hallucinated before this trip. There were times when I actually thought that there might be bugs in my bedroom, or that someone outside was really calling me.
My eyes were somewhat itchy and my throat was very dry. I contemplated taking some cough syrup, both to ease the throat and to add to the trip, but the only bottle in the house contained an expectorant, and I had no idea how the expectorant might react with the dimenhydrinate. Dimenhydrinate is a very strange drug.
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.


{% extends "exotic_bay/base.html" %} {% load i18n %} {% load account %} {% block title_block %}Confirm E-mail Address{% endblock %} {% block body_block %}
Please confirm that {{ confirmation.email_address.email }} is an e-mail address for user {{ user_display }}.
{% else %} {% url 'account_email' as email_url %}This e-mail confirmation link expired or is invalid. Please issue a new e-mail confirmation request.
{% endif %}


The calDAV Standard - navigating the RFC jungle
Application interoperability is key to wide spread adoption. Luckily there are so many open standards that one can claim to be open without being interoperable. On a protocol level HTTP and SMTP were huge successes, as well as HTML/MIME for message content. Beyond that it gets murky. None of the big vendors (outside the OpenSource space) has adopted an open protocol for chat and presence.
For other standards, most notably Calendaring, support is murkey. On key contributor might be the RFC process that produces documents that are hard to follow and lack sample implementations. They are work outcomes of a committee after all. In this series of blog entries I will (try to) highlight the moving parts of a calendar server implementation. The non-moving parts here are the calendar clients to target: Apple calendar on iOS and macOS, Thurnderbird and a few others.
Involved standards
There is a series of RFC that cover calendar operation, with various degrees of relevance:
- RFC 4918: webDAV. Defines additional HTTP verbs and XML formats
- RFC 4791: calDAV. Defines again additional HTTP verbs
- RFC 5545: iCalendar. Calendar data as plain text, or XML or JSON
- RFC 7953: vAvailability. Free/Busy lookup specification
- RFC 7986: Extended properties for iCalendar
- RFC 6638: Scheduling extensions
- RFC 8607: Managed attachments in calendar entries
- RFC 8144: Use of Prefer Header field in webDAV
- RFC 5785: Definitions for the
/.well-known/
URL
Technologies
Based on the RFC we can see what are the moving parts that constitute the calendar API:
- HTTP extensions: With the introduction of new HTTP keywords (e.g. REPORT or PRPOPFIND), the basic REST idea gets turned upside down by having verbs with specific meanings instead of the ususal CRUD logic. In a more contemporary approach the actual actions would be represented by the URL, but that would be too easy.
- iCalendar: a text based key/value format for calendar information, with little goodies like identifying multi-line entries just by some indentation
- XML: inherited from webDAV: angle bracked infested data structure that does not care about white space or indentation. This gets juicy when it contains an iCalendar as payload, that is very well sensitive to indents.
Vendor and consortium documentation
There are plenty of trees in the woods, so the task is scavenging, not planting. Besides the RFC, this is what I found:
- Google has a partial calDAV implementation. Their approach seem to be: only what's needed for a typical client
- Apple opensourced their Calendar Server including a Test Suite and a Docker Image (Blog post)
- The CalConnect consortium provides a nice Developer Guide, mostly focused on data formats and client implementations
- webDAV Community provides information around webDAV and its implementations
- Joomla's iCalendar.org provides a validator
- Most notably absent: Microsoft. They do support calDAV, but only if you are on the nice list (which is basically US based cloud vendors). There are solutions and AddOns. It seems that in the Microsoft world calendaring is best served with SOAP / EWS or the shiny new Microsoft Graph API
The tools
Gearing up to battle with an API mandates to be armed with the right toolset. This skilled craftsman suggests:
- Postman: We want to test different HTTP commands, Postman makes that easy
- CURL: Anything HTTP, from the command line, for professionals or CI/CD
- Charles Proxy: When testing endpoints used by actual client applications it allows you to see the traffic
- Docker: Running a few calendar servers to see how they "tick" in docker
This is just the beginning of a long trip, stay tuned!
Posted by Stephan H Wissel on 09 October 2019 | Comments (0) | categories: calDAV HTTP(S) Protocols


Preparation time
less than 30 mins
Cooking time
10 to 30 mins
Serves
Serves 2
NB: Yuzu is a sour Japanese fruit about the size of a tangerine. If you cannot find fresh yuzu, it can be bought as a paste or juice from specialist retailers.
Preheat the oven and grill to 180C/350F/Gas 4.
For the chilli yuzu paste, blend all of the chilli yuzu paste ingredients except the mirin and vegetable oil in a food processor to a paste.
Gradually add the mirin (or water) and vegetable oil and blend again until all of the liquid has been fully incorporated into the mixture. Set aside.
For the white miso aioli, blend the cooked potato, white miso, garlic and poached egg in a food processor until smooth and well combined.
With the motor still running, gradually add the vegetable oil in a thin stream until it is completely incorporated in the mixture.
Add the ginger juice and lemon juice and blend again until well combined.
For the prawns, lay each prawn on its back. Cut the tail meat and shells in half lengthways using a sharp knife or scissors. Remove the tail meat from the shells and chop roughly.
Stir the chopped tail meat into the chilli yuzu paste.
Return the prawn and chilli yuzu mixture to the shells (there should be two filled shells per person). Place the four prawn halves onto a baking tray and cook for 1-2 minutes.
Remove the prawn halves from the oven. Carefully stir the prawn and chilli yuzu mixture around, in the shells. Return the prawns to the oven and cook for a further 1-2 minutes, or until the flesh is pink and cooked through.
To serve, squeeze the julienned daikon into two cone shapes. Place one cone of daikon onto the end of each of two rectangular serving plates. Sprinkle over the black sesame seeds. Place two filled prawn halves into the centre of each plate. Place the lemon balm leaves on top. Divide the aioli between two dipping bowls. Place them at the other end of the plates.


HC modifies life sentence
It sentences man for culpable homicide not amounting to murder
by Staff ReporterThe Madurai Bench of the Madras High Court on Thursday modified the life sentence awarded to a man by a lower court in Tirunelveli to seven years of rigorous imprisonment on the ground of ‘sustained provocation.’
The accused Marimuthu from Tirunelveli filed a criminal appeal against the judgement of the lower court.
He was convicted for murdering a relative for allegedly having an affair with his wife. He was said to have smashed the head of his relative with a grinding stone.
It could be presumed that the act of adultery would have lingered in his mind tormenting him, a Division Bench of Justices S. Vaidyanathan and N. Anand Venkatesh observed. This made him lose his self control and cause death of his relative. There were fights between the couple. The court is convinced that the case falls under the exception 1 of Section 300 (murder) of the Indian Penal Code on the ground of ‘sustained provocation.’
It modified the sentence of the lower court from life term to rigorous imprisonment for seven years. It sentenced him for culpable homicide not amounting to murder.