| Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
|---|---|---|---|---|
| AppController/lib/zkinterface.rb | 722 | 432 | 78.81%
|
67.36%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 #!/usr/bin/ruby -w |
2 |
3 require 'fileutils' |
4 require 'monitor' |
5 |
6 |
7 $:.unshift File.join(File.dirname(__FILE__)) |
8 require 'helperfunctions' |
9 |
10 |
11 require 'rubygems' |
12 require 'json' |
13 require 'zookeeper' |
14 |
15 |
16 # A class of exceptions that we throw whenever we perform a ZooKeeper |
17 # operation that does not return successfully (but does not normally |
18 # throw an exception). |
19 class FailedZooKeeperOperationException < Exception |
20 end |
21 |
22 |
23 # The AppController employs the open source software ZooKeeper as a highly |
24 # available naming service, to store and retrieve information about the status |
25 # of applications hosted within AppScale. This class provides methods to |
26 # communicate with ZooKeeper, and automates commonly performed functions by the |
27 # AppController. |
28 class ZKInterface |
29 |
30 |
31 # The port that ZooKeeper runs on in AppScale deployments. |
32 SERVER_PORT = 2181 |
33 |
34 |
35 EPHEMERAL = true |
36 |
37 |
38 NOT_EPHEMERAL = false |
39 |
40 |
41 # The location in ZooKeeper where AppControllers can read and write |
42 # data to. |
43 APPCONTROLLER_PATH = "/appcontroller" |
44 |
45 |
46 # The location in ZooKeeper where the Shadow node will back up its state to, |
47 # and where other nodes will recover that state from. |
48 APPCONTROLLER_STATE_PATH = "#{APPCONTROLLER_PATH}/state" |
49 |
50 |
51 # The location in ZooKeeper that contains a list of the IP addresses that |
52 # are currently running within AppScale. |
53 IP_LIST = "#{APPCONTROLLER_PATH}/ips" |
54 |
55 |
56 # The location in ZooKeeper that AppControllers write information about their |
57 # node to, so that others can poll to see if they are alive and what roles |
58 # they've taken on. |
59 APPCONTROLLER_NODE_PATH = "#{APPCONTROLLER_PATH}/nodes" |
60 |
61 |
62 # The location in ZooKeeper that nodes will try to acquire an ephemeral node |
63 # for, to use as a lock. |
64 APPCONTROLLER_LOCK_PATH = "#{APPCONTROLLER_PATH}/lock" |
65 |
66 |
67 # The location in ZooKeeper that the Babel Master and Slaves will read and |
68 # write data to that should be globally accessible or fault-tolerant. |
69 BABEL_PATH = "/babel" |
70 |
71 |
72 # The location in ZooKeeper that the Babel Master's threads read and write |
73 # to, to determine the maximum number of machines that should be used to |
74 # run Babel tasks. |
75 BABEL_MAX_MACHINES_PATH = "#{BABEL_PATH}/max_slaves_machines" |
76 |
77 |
78 # The name of the file that nodes use to store the list of Google App Engine |
79 # instances that the given node runs. |
80 APP_INSTANCE = "app_instance" |
81 |
82 |
83 ROOT_APP_PATH = "/apps" |
84 |
85 |
86 # The contents of files in ZooKeeper whose contents we don't care about |
87 # (e.g., where we care that's an ephemeral file or needed just to provide |
88 # a hierarchical filesystem-like interface). |
89 DUMMY_DATA = "" |
90 |
91 |
92 # The amount of time that has to elapse before Zookeeper expires the |
93 # session (and all ephemeral locks) with our client. Setting this value at |
94 # or below 10 seconds has historically not been a good idea for us (as |
95 # sessions repeatedly time out). |
96 TIMEOUT = 60 |
97 |
98 |
99 public |
100 |
101 |
102 # Initializes a new ZooKeeper connection to the IP address specified. |
103 # Callers should use this when they know exactly which node hosts ZooKeeper. |
104 def self.init_to_ip(client_ip, ip) |
105 Djinn.log_debug("Waiting for #{ip}:#{SERVER_PORT} to open") |
106 HelperFunctions.sleep_until_port_is_open(ip, SERVER_PORT) |
107 |
108 @@client_ip = client_ip |
109 @@ip = ip |
110 |
111 if !defined?(@@lock) |
112 @@lock = Monitor.new |
113 end |
114 |
115 @@lock.synchronize { |
116 @@zk = Zookeeper.new("#{ip}:#{SERVER_PORT}", timeout=TIMEOUT) |
117 } |
118 end |
119 |
120 |
121 # Initializes a new ZooKeeper connection to the "closest" node in the |
122 # system. "Closeness" is defined as either "this node" (if it runs |
123 # ZooKeeper), or an arbitrary node that runs ZooKeeper. Callers should use |
124 # this method when they don't want to determine on their own which |
125 # ZooKeeper box to connect to. |
126 def self.init(my_node, all_nodes) |
127 self.init_to_ip(my_node.public_ip, self.get_zk_location(my_node, |
128 all_nodes)) |
129 end |
130 |
131 |
132 # Creates a new connection to use with ZooKeeper. Useful for scenarios |
133 # where the ZooKeeper library has terminated our connection but we still |
134 # need it. Also recreates any ephemeral links that were lost when the |
135 # connection was disconnected. |
136 def self.reinitialize() |
137 self.init_to_ip(@@client_ip, @@ip) |
138 self.set_live_node_ephemeral_link(@@client_ip) |
139 end |
140 |
141 |
142 def self.add_app_entry(appname, ip, location) |
143 appname_path = ROOT_APP_PATH + "/#{appname}" |
144 full_path = appname_path + "/#{ip}" |
145 |
146 # can't just create path in ZK |
147 # need to do create the nodes at each level |
148 |
149 self.set(ROOT_APP_PATH, DUMMY_DATA, NOT_EPHEMERAL) |
150 self.set(appname_path, DUMMY_DATA, NOT_EPHEMERAL) |
151 self.set(full_path, location, EPHEMERAL) |
152 end |
153 |
154 |
155 def self.remove_app_entry(appname, ip) |
156 appname_path = ROOT_APP_PATH + "/#{appname}/#{ip}" |
157 self.delete(appname_path) |
158 end |
159 |
160 |
161 def self.get_app_hosters(appname) |
162 if !defined?(@@zk) |
163 return [] |
164 end |
165 |
166 appname_path = ROOT_APP_PATH + "/#{appname}" |
167 app_hosters = self.get_children(appname_path) |
168 converted = [] |
169 app_hosters.each { |serialized| |
170 converted << DjinnJobData.deserialize(serialized) |
171 } |
172 return converted |
173 end |
174 |
175 |
176 def self.get_appcontroller_state() |
177 return JSON.load(self.get(APPCONTROLLER_STATE_PATH)) |
178 end |
179 |
180 |
181 def self.write_appcontroller_state(state) |
182 # Create the top-level AC dir, then the actual node that stores |
183 # our data |
184 self.set(APPCONTROLLER_PATH, DUMMY_DATA, NOT_EPHEMERAL) |
185 self.set(APPCONTROLLER_STATE_PATH, JSON.dump(state), NOT_EPHEMERAL) |
186 end |
187 |
188 |
189 # Gets a lock that AppControllers can use to have exclusive write access |
190 # (between other AppControllers) to the ZooKeeper hierarchy located at |
191 # APPCONTROLLER_PATH. It returns a boolean that indicates whether or not |
192 # it was able to acquire the lock or not. |
193 def self.get_appcontroller_lock() |
194 if !self.exists?(APPCONTROLLER_PATH) |
195 self.set(APPCONTROLLER_PATH, DUMMY_DATA, NOT_EPHEMERAL) |
196 end |
197 |
198 info = self.run_zookeeper_operation { |
199 @@zk.create(:path => APPCONTROLLER_LOCK_PATH, |
200 :ephemeral => EPHEMERAL, :data => JSON.dump(@@client_ip)) |
201 } |
202 if info[:rc].zero? |
203 Djinn.log_debug("Got the AppController lock") |
204 return true |
205 else # we couldn't get the lock for some reason |
206 Djinn.log_debug("Couldn't get the AppController lock, saw info " + |
207 "#{info.inspect}") |
208 return false |
209 end |
210 end |
211 |
212 |
213 # Releases the lock that AppControllers use to have exclusive write access, |
214 # which was acquired via self.get_appcontroller_lock(). |
215 def self.release_appcontroller_lock() |
216 self.delete(APPCONTROLLER_LOCK_PATH) |
217 end |
218 |
219 |
220 # This method provides callers with an easier way to read and write to |
221 # AppController data in ZooKeeper. This is useful for methods that aren't |
222 # sure if they already have the ZooKeeper lock or not, but definitely need |
223 # it and don't want to accidentally cause a deadlock (grabbing the lock when |
224 # they already have it). |
225 def self.lock_and_run(&block) |
226 # Create the ZK lock path if it doesn't exist. |
227 if !self.exists?(APPCONTROLLER_PATH) |
228 self.set(APPCONTROLLER_PATH, DUMMY_DATA, NOT_EPHEMERAL) |
229 end |
230 |
231 # Try to get the lock, and if we can't get it, see if we already have |
232 # it. If we do, move on (but don't release it later since this block |
233 # didn't grab it), and if we don't have it, try again. |
234 got_lock = false |
235 begin |
236 if self.get_appcontroller_lock() |
237 got_lock = true |
238 else # it may be that we already have the lock |
239 info = self.run_zookeeper_operation { |
240 @@zk.get(:path => APPCONTROLLER_LOCK_PATH) |
241 } |
242 owner = JSON.load(info[:data]) |
243 if @@client_ip == owner |
244 Djinn.log_debug("Tried to get the lock, but we already have it. " + |
245 "Not grabbing/releasing lock again.") |
246 got_lock = false |
247 else |
248 Djinn.log_debug("Tried to get the lock, but it's currently owned " + |
249 "by #{owner}. Will try again later.") |
250 raise Exception |
251 end |
252 end |
253 rescue Exception => e |
254 Djinn.log_debug("Saw an exception of class #{e.class}") |
255 Kernel.sleep(5) |
256 retry |
257 end |
258 |
259 begin |
260 yield # invoke the user's block, and catch any uncaught exceptions |
261 rescue Exception => except |
262 Djinn.log_debug("Ran caller's block but saw an Exception of class " + |
263 "#{except.class}") |
264 raise except |
265 ensure |
266 if got_lock |
267 Djinn.log_debug("Grabbed lock, so now releasing it.") |
268 self.release_appcontroller_lock() |
269 Djinn.log_debug("Released lock successfully") |
270 else |
271 Djinn.log_debug("Didn't grab lock, so not releasing it.") |
272 end |
273 end |
274 end |
275 |
276 |
277 # Returns a Hash containing the list of the IPs that are currently running |
278 # within AppScale as well as a timestamp corresponding to the time when the |
279 # latest node updated this information. |
280 def self.get_ip_info() |
281 return JSON.load(self.get(IP_LIST)) |
282 end |
283 |
284 |
285 # Add the given IP to the list of IPs that we store in ZooKeeper. If the IPs |
286 # file doesn't exist in ZooKeeper, create it and add in the given IP address. |
287 # We also update the timestamp associated with this list so that others know |
288 # to update it as needed. |
289 def self.add_ip_to_ip_list(ip) |
290 new_timestamp = 0.0 |
291 |
292 if self.exists?(IP_LIST) |
293 # See if our IP is in the list of IPs that are up, and if not, |
294 # append it to the list and update the timestamp so that everyone |
295 # else will update their local copies. |
296 data = JSON.load(self.get(IP_LIST)) |
297 if !data['ips'].include?(ip) |
298 Djinn.log_debug("IPs file does not include our IP - adding it in") |
299 data['ips'] << ip |
300 new_timestamp = Time.now.to_i |
301 data['last_updated'] = new_timestamp |
302 self.set(IP_LIST, JSON.dump(data), NOT_EPHEMERAL) |
303 Djinn.log_debug("Updated timestamp in ips list to " + |
304 "#{data['last_updated']}") |
305 else |
306 Djinn.log_debug("IPs file already includes our IP - skipping") |
307 end |
308 else |
309 Djinn.log_debug("IPs file does not exist - creating it") |
310 new_timestamp = Time.now.to_i |
311 data = {'ips' => [ip], 'last_updated' => new_timestamp} |
312 self.set(IP_LIST, JSON.dump(data), NOT_EPHEMERAL) |
313 Djinn.log_debug("Updated timestamp in ips list to " + |
314 "#{data['last_updated']}") |
315 end |
316 |
317 return new_timestamp |
318 end |
319 |
320 |
321 # Accesses the list of IP addresses stored in ZooKeeper and removes the |
322 # given IP address from that list. |
323 def self.remove_ip_from_ip_list(ip) |
324 if !self.exists?(IP_LIST) |
325 return |
326 end |
327 |
328 data = JSON.load(self.get(IP_LIST)) |
329 data['ips'].delete(ip) |
330 new_timestamp = Time.now.to_i |
331 data['last_updated'] = new_timestamp |
332 self.set(IP_LIST, JSON.dump(data), NOT_EPHEMERAL) |
333 return new_timestamp |
334 end |
335 |
336 |
337 # Updates the timestamp in the IP_LIST file, to let other nodes know that |
338 # an update has been made and that they should update their local @nodes |
339 def self.update_ips_timestamp() |
340 data = JSON.load(self.get(IP_LIST)) |
341 new_timestamp = Time.now.to_i |
342 data['last_updated'] = new_timestamp |
343 self.set(IP_LIST, JSON.dump(data), NOT_EPHEMERAL) |
344 Djinn.log_debug("Updated timestamp in ips list to #{data['last_updated']}") |
345 return new_timestamp |
346 end |
347 |
348 |
349 # Queries ZooKeeper for a list of all IPs that are currently up, and then |
350 # checks if each of those IPs has an ephemeral link indicating that they |
351 # are alive. Returns an Array of IPs corresponding to failed nodes. |
352 def self.get_failed_nodes |
353 failed_nodes = [] |
354 |
355 ips = self.get_ip_info['ips'] |
356 Djinn.log_debug("All IPs are [#{ips.join(', ')}]") |
357 |
358 ips.each { |ip| |
359 if self.exists?("#{APPCONTROLLER_NODE_PATH}/#{ip}/live") |
360 Djinn.log_debug("Node at #{ip} is alive") |
361 else |
362 Djinn.log_debug("Node at #{ip} has failed") |
363 failed_nodes << ip |
364 end |
365 } |
366 |
367 Djinn.log_debug("Failed nodes are [#{failed_nodes.join(', ')}]") |
368 return failed_nodes |
369 end |
370 |
371 |
372 # Creates files in ZooKeeper that relate to a given AppController's |
373 # role information, so that other AppControllers can detect if it has |
374 # failed, and if so, what functionality it was providing at the time. |
375 def self.write_node_information(node, done_loading) |
376 # Create the folder for all nodes if it doesn't exist. |
377 if !self.exists?(APPCONTROLLER_NODE_PATH) |
378 self.run_zookeeper_operation { |
379 @@zk.create(:path => APPCONTROLLER_NODE_PATH, |
380 :ephemeral => NOT_EPHEMERAL, :data => DUMMY_DATA) |
381 } |
382 end |
383 |
384 # Create the folder for this node. |
385 my_ip_path = "#{APPCONTROLLER_NODE_PATH}/#{node.public_ip}" |
386 self.run_zookeeper_operation { |
387 @@zk.create(:path => my_ip_path, :ephemeral => NOT_EPHEMERAL, |
388 :data => DUMMY_DATA) |
389 } |
390 |
391 # Create an ephemeral link associated with this node, which other |
392 # AppControllers can use to quickly detect dead nodes. |
393 self.set_live_node_ephemeral_link(node.public_ip) |
394 |
395 |
396 # Since we're reporting on the roles we've started, we are done loading |
397 # roles right now, so write that information for others to read and act on. |
398 self.set_done_loading(node.public_ip, done_loading) |
399 |
400 # Finally, dump the data from this node to ZK, so that other nodes can |
401 # reconstruct it as needed. |
402 self.set_job_data_for_ip(node.public_ip, node.serialize()) |
403 |
404 return |
405 end |
406 |
407 |
408 # Deletes all information for a given node, whose data is stored in ZooKeeper. |
409 def self.remove_node_information(ip) |
410 return self.recursive_delete("#{APPCONTROLLER_NODE_PATH}/#{ip}") |
411 end |
412 |
413 |
414 # Checks ZooKeeper to see if the given node has finished loading its roles, |
415 # which it indicates via a file in a particular path. |
416 def self.is_node_done_loading?(ip) |
417 if !self.exists?(APPCONTROLLER_NODE_PATH) |
418 return false |
419 end |
420 |
421 loading_file = "#{APPCONTROLLER_NODE_PATH}/#{ip}/done_loading" |
422 if !self.exists?(loading_file) |
423 return false |
424 end |
425 |
426 begin |
427 json_contents = self.get(loading_file) |
428 return JSON.load(json_contents) |
429 rescue FailedZooKeeperOperationException |
430 return false |
431 end |
432 end |
433 |
434 |
435 # Writes the ephemeral link in ZooKeeper that represents a given node |
436 # being alive. Callers should only use this method to indicate that their |
437 # own node is alive, and not do it on behalf of other nodes. |
438 def self.set_live_node_ephemeral_link(ip) |
439 self.run_zookeeper_operation { |
440 @@zk.create(:path => "#{APPCONTROLLER_NODE_PATH}/#{ip}/live", |
441 :ephemeral => EPHEMERAL, :data => DUMMY_DATA) |
442 } |
443 end |
444 |
445 |
446 # Provides a convenience function that callers can use to indicate that their |
447 # node is done loading (if they have finished starting/stopping roles), or is |
448 # not done loading (if they have roles they need to start or stop). |
449 def self.set_done_loading(ip, val) |
450 return self.set("#{APPCONTROLLER_NODE_PATH}/#{ip}/done_loading", |
451 JSON.dump(val), NOT_EPHEMERAL) |
452 end |
453 |
454 |
455 # Checks ZooKeeper to see if the given node is alive, by checking if the |
456 # ephemeral file it has created is still present. |
457 def self.is_node_live?(ip) |
458 return self.exists?("#{APPCONTROLLER_NODE_PATH}/#{ip}/live") |
459 end |
460 |
461 |
462 # Writes the integer corresponding to the maximum number of nodes that |
463 # should be acquired (whether they be already running open nodes or newly |
464 # spawned virtual machines) to become Babel slaves (workers). |
465 def self.set_max_machines_for_babel_slaves(maximum) |
466 if !self.exists?(BABEL_PATH) |
467 self.set(BABEL_PATH, DUMMY_DATA, NOT_EPHEMERAL) |
468 end |
469 |
470 self.set(BABEL_MAX_MACHINES_PATH, JSON.dump(maximum), NOT_EPHEMERAL) |
471 end |
472 |
473 |
474 # Returns the maximum number of nodes that should be used to run Babel |
475 # jobs (not including the Babel Master). |
476 def self.get_max_machines_for_babel_slaves() |
477 if !self.exists?(BABEL_MAX_MACHINES_PATH) |
478 return 0 |
479 end |
480 |
481 return JSON.load(self.get(BABEL_MAX_MACHINES_PATH)) |
482 end |
483 |
484 |
485 # Returns an Array of Hashes that correspond to the App Engine applications |
486 # hosted on the given ip address. Each hash contains the application's name, |
487 # the IP address (which should be the same as the given IP), and the nginx |
488 # port that the app is hosted on. |
489 def self.get_app_instances_for_ip(ip) |
490 app_instance_file = "#{APPCONTROLLER_NODE_PATH}/#{ip}/#{APP_INSTANCE}" |
491 if !self.exists?(app_instance_file) |
492 return [] |
493 end |
494 |
495 json_instances = self.get(app_instance_file) |
496 return JSON.load(json_instances) |
497 end |
498 |
499 |
500 # Adds an entry to ZooKeeper for the given IP, storing information about the |
501 # Google App engine application it is hosting that can be used to update the |
502 # AppLoadBalancer should that node fail. |
503 def self.add_app_instance(app_name, ip, port) |
504 app_instance_file = "#{APPCONTROLLER_NODE_PATH}/#{ip}/#{APP_INSTANCE}" |
505 if self.exists?(app_instance_file) |
506 json_instances = self.get(app_instance_file) |
507 instances = JSON.load(json_instances) |
508 else |
509 instances = [] |
510 end |
511 |
512 instances << {'app_name' => app_name, 'ip' => ip, 'port' => port} |
513 self.set(app_instance_file, JSON.dump(instances), NOT_EPHEMERAL) |
514 end |
515 |
516 |
517 # Returns a serialized DjinnJobData string that we store in ZooKeeper for the |
518 # given IP address, which callers can deserialize to get a DjinnJobData |
519 # object. |
520 def self.get_job_data_for_ip(ip) |
521 return self.get("#{APPCONTROLLER_NODE_PATH}/#{ip}/job_data") |
522 end |
523 |
524 |
525 def self.set_job_data_for_ip(ip, job_data) |
526 return self.set("#{APPCONTROLLER_NODE_PATH}/#{ip}/job_data", |
527 job_data, NOT_EPHEMERAL) |
528 end |
529 |
530 |
531 # Adds the specified role to the given node in ZooKeeper. A node can call this |
532 # function to add a role to another node, and the other node should take on |
533 # this role, or a node can call this function to let others know that it is |
534 # taking on a new role. |
535 # Callers should acquire the ZK Lock before calling this function. |
536 # roles should be an Array of Strings, where each String is a role to add |
537 # node should be a DjinnJobData representing the node that we want to add |
538 # the roles to |
539 def self.add_roles_to_node(roles, node) |
540 old_job_data = self.get_job_data_for_ip(node.public_ip) |
541 new_node = DjinnJobData.deserialize(old_job_data) |
542 new_node.add_roles(roles.join(":")) |
543 new_job_data = new_node.serialize() |
544 self.set_job_data_for_ip(node.public_ip, new_job_data) |
545 self.set_done_loading(node.public_ip, false) |
546 self.update_ips_timestamp() |
547 end |
548 |
549 |
550 # Removes the specified roles from the given node in ZooKeeper. A node can |
551 # call this function to remove roles from another node, and the other node |
552 # should take on this role, or a node can call this function to let others |
553 # know that it is stopping existing roles. |
554 # Callers should acquire the ZK Lock before calling this function. |
555 # roles should be an Array of Strings, where each String is a role to remove |
556 # node should be a DjinnJobData representing the node that we want to remove |
557 # the roles from |
558 def self.remove_roles_from_node(roles, node) |
559 old_job_data = self.get_job_data_for_ip(node.public_ip) |
560 new_node = DjinnJobData.deserialize(old_job_data) |
561 new_node.remove_roles(roles.join(":")) |
562 new_job_data = new_node.serialize() |
563 self.set_job_data_for_ip(node.public_ip, new_job_data) |
564 self.set_done_loading(node.public_ip, false) |
565 self.update_ips_timestamp() |
566 end |
567 |
568 |
569 private |
570 |
571 |
572 def self.run_zookeeper_operation(&block) |
573 begin |
574 yield |
575 rescue ZookeeperExceptions::ZookeeperException::ConnectionClosed |
576 Djinn.log_debug("Lost our ZooKeeper connection - making a new " + |
577 "connection and trying again.") |
578 self.reinitialize() |
579 Kernel.sleep(1) |
580 retry |
581 rescue Exception => e |
582 Djinn.log_debug("Saw a transient ZooKeeper error of class #{e.class}" + |
583 " - trying again.") |
584 Kernel.sleep(1) |
585 retry |
586 end |
587 end |
588 |
589 |
590 def self.exists?(key) |
591 return self.run_zookeeper_operation { |
592 @@zk.get(:path => key)[:stat].exists |
593 } |
594 end |
595 |
596 |
597 def self.get(key) |
598 Djinn.log_debug("[ZK] trying to get #{key}") |
599 info = self.run_zookeeper_operation { |
600 @@zk.get(:path => key) |
601 } |
602 if info[:rc].zero? |
603 return info[:data] |
604 else |
605 raise FailedZooKeeperOperationException.new("Failed to get #{key}, " + |
606 "with info #{info.inspect}") |
607 end |
608 end |
609 |
610 |
611 def self.get_children(key) |
612 Djinn.log_debug("[ZK] trying to get children of #{key}") |
613 children = self.run_zookeeper_operation { |
614 @@zk.get_children(:path => key)[:children] |
615 } |
616 |
617 if children.nil? |
618 return [] |
619 else |
620 return children |
621 end |
622 end |
623 |
624 |
625 def self.set(key, val, ephemeral) |
626 retries_left = 5 |
627 begin |
628 Djinn.log_debug("[ZK] trying to set #{key} to #{val} with ephemeral = #{ephemeral}") |
629 info = {} |
630 if self.exists?(key) |
631 Djinn.log_debug("[ZK] Key #{key} exists, so setting it") |
632 info = self.run_zookeeper_operation { |
633 @@zk.set(:path => key, :data => val) |
634 } |
635 else |
636 Djinn.log_debug("[ZK] Key #{key} does not exist, so creating it") |
637 info = self.run_zookeeper_operation { |
638 @@zk.create(:path => key, :ephemeral => ephemeral, :data => val) |
639 } |
640 end |
641 |
642 if !info[:rc].zero? |
643 raise FailedZooKeeperOperationException.new("Failed to set path " + |
644 "#{key} with data #{val}, ephemeral = #{ephemeral}, saw " + |
645 "info #{info.inspect}") |
646 end |
647 rescue FailedZooKeeperOperationException => e |
648 retries_left -= 1 |
649 Djinn.log_debug("Saw a failure trying to write to ZK, with " + |
650 "info [#{e}]") |
651 if retries_left > 0 |
652 Djinn.log_debug("Retrying write operation, with #{retries_left}" + |
653 " retries left") |
654 Kernel.sleep(5) |
655 retry |
656 else |
657 Djinn.log_debug("[ERROR] Failed to write to ZK and no retries " + |
658 "left. Skipping on this write for now.") |
659 end |
660 end |
661 end |
662 |
663 |
664 def self.recursive_delete(key) |
665 Djinn.log_debug("[ZK] trying to recursive delete #{key}") |
666 |
667 child_info = self.get_children(key) |
668 if child_info.empty? |
669 return |
670 end |
671 |
672 child_info.each { |child| |
673 self.recursive_delete("#{key}/#{child}") |
674 } |
675 |
676 begin |
677 self.delete(key) |
678 rescue FailedZooKeeperOperationException |
679 Djinn.log_debug("Failed to delete key #{key} - continuing onward") |
680 end |
681 end |
682 |
683 |
684 def self.delete(key) |
685 Djinn.log_debug("[ZK] trying to delete #{key}") |
686 info = self.run_zookeeper_operation { |
687 @@zk.delete(:path => key) |
688 } |
689 if !info[:rc].zero? |
690 Djinn.log_debug("Delete failed - #{info.inspect}") |
691 raise FailedZooKeeperOperationException.new("Failed to delete " + |
692 " path #{key}, saw info #{info.inspect}") |
693 end |
694 |
695 Djinn.log_debug("Delete succeeded!") |
696 end |
697 |
698 |
699 def self.get_zk_location(my_node, all_nodes) |
700 if my_node.is_zookeeper? |
701 return my_node.private_ip |
702 end |
703 |
704 zk_node = nil |
705 all_nodes.each { |node| |
706 if node.is_zookeeper? |
707 zk_node = node |
708 break |
709 end |
710 } |
711 |
712 if zk_node.nil? |
713 no_zks = "No ZooKeeper nodes were found. All nodes are #{nodes}," + |
714 " while my node is #{my_node}." |
715 abort(no_zks) |
716 end |
717 |
718 return zk_node.public_ip |
719 end |
720 |
721 |
722 end |
Generated on Tue Nov 27 14:27:59 -0800 2012 with rcov 1.0.0


JavaFX is a software platform for creating and delivering desktop applications as well as rich Internet applications (RIAS) that can run across a wide variety of devices. JavaFX has support for desktop comuters and web browsers on Microsoft windows Linux and macOS. Currently JavaFX is intended to slowly replace Swing for creatation GUI for java applications.
Our application's interface consists of three sections.
Section Owner is divided into two subsections and allows reset of all personal data.
Section Invoice is divided into four subsections.
Section Tools allowes the user to summarize invoices by selecting from and to date. After summarization it writes the total profit/losses of selected period. It also allowes to export selected Invoices into PDF file.


Curious crossmedia design student. Social media enthousiast. Cat lover.Channeling my inner sporty spice. Chocolate addict.


Java
So the beginner project for this month was a java task list program super light weight wasnt really runnign on a application or anything it was just a console output seeing as how it was our first month at the time this was pretty exciting. I have attatched a few screenshots so you can get an idea of the code
Tic-Tac-Toe & Random Card Game
So the month of august we were given our first taste of the working enviornment such as collaborating with other develpoers on a project and we learned alot about version control and merging code to create a functioning product. So this month we had a whole week of creating games from scratch. My favorite 2 had to be the card game and the tic tac toe game
Blog Site
This month we worked with React to create a blog post app. This game is now under construction and not available for the site Will be back up soon
Expense Tracker
This month we focused heavy on the backend and created a Expense tracker on Django. That logged user input like a bank accout


{% extends "main/base.html" %} {% block title %}Admin Page :{% endblock %} {% block description %}{% endblock %} {% block content %}
Add or Edit users
now only "restriction_ip" can be enabled. set "restriction_ip" as setting id and set allowed ip address setting value. IP address is top match, set like "54.125.30."


|
| | RetirementHome ()=default |
| | Creates a RetirementHome object with default attributes.  More...
|
| |
| void | add_exposed_employee (double inf_var) |
| | Include exposed employee contribution in the sum. More...
|
| |
| void | add_symptomatic_employee (double inf_var) |
| | Include symptomatic employee contribution in the sum. More...
|
| |
| void | add_symptomatic_home_isolated (double inf_var) |
| | Include contribution of a symptomatic, home isolated agent in the sum. More...
|
| |
| void | add_exposed_home_isolated (double inf_var) |
| | Include contribution of an exposed, home isolated agent in the sum. More...
|
| |
| void | print_basic (std::ostream &where) const override |
| | Save information about a RetirementHome object. More...
|
| |
| | Place ()=default |
| | Creates a Place object with default attributes. More...
|
| |
| | Place (const int place_ID, const double xi, const double yi, const double severity_cor, const double beta) |
| | Creates a Place object. More...
|
| |
| virtual void | add_exposed (double inf_var) |
| | Include exposed contribution in the sum. More...
|
| |
| virtual void | add_symptomatic (double inf_var) |
| | Include symptomatic contribution in the sum. More...
|
| |
| virtual void | compute_infected_contribution () |
| | Calculates and stores fraction of infected agents if any. More...
|
| |
| virtual void | reset_contributions () |
| | Reset the lambda sum of a place after transmission step. More...
|
| |
| void | change_transmission_rate (const double new_beta) |
| |
| int | get_ID () const |
| | Return place ID. More...
|
| |
| virtual std::vector< int > | get_agent_IDs () const |
| | Return IDs of agents registered in this place. More...
|
| |
| int | get_total_infected () const |
| | Return total number of infected agents. More...
|
| |
| double | get_infected_contribution () const |
| | Return probability contribution of infected agents. More...
|
| |
| double | get_transmission_rate () const |
| | Transmission rate. More...
|
| |
| void | register_agent (const int agent_ID, const bool is_infected) |
| | Assign agent to a given place indicating if infected. More...
|
| |
| void | add_agent (const int index) |
| | Add a new agent to this place. More...
|
| |
| void | remove_agent (const int index) |
| | Remove an agent from this place. More...
|
| |
| virtual | ~Place ()=default |
| |


Sign up to see photos and videosfrom your friends.
OR
By signing up, you agree to ourTerms & Privacy Policy.
Have an account? Log in
Get the app.


Just like 2 * my_matrix
multiplied every element of my_matrix
by two, my_matrix1 * my_matrix2
creates a matrix where each element is the product of the corresponding elements in my_matrix1
and my_matrix2
.
After looking at the result of the previous exercise, big boss Lucas points out that the ticket prices went up over time. He asks to redo the analysis based on the prices you can find in ticket_prices_matrix
(source: imagination).
Those who are familiar with matrices should note that this is not the standard matrix multiplication for which you should use %*%
in R.
all_wars_matrix
by ticket_prices_matrix
to get the estimated number of US and non-US visitors for the six movies. Assign the result to visitors
.visitors
matrix, select the entire first column, representing the number of visitors in the US. Store this selection as us_visitors
.
load(url("http://s3.amazonaws.com/assets.datacamp.com/course/intro_to_r/all_wars_matrix.RData"))
movie_names <- c("A New Hope","The Empire Strikes Back","Return of the Jedi", "The Phantom Menace", "Attack of the Clones", "Revenge of the Sith")
col_titles <- c("US","non-US")
ticket_prices_matrix <- matrix(c(5, 5, 6, 6, 7, 7, 4, 4, 4.5, 4.5, 4.9, 4.9), nrow = 6, byrow = TRUE, dimnames = list(movie_names,col_titles))
# all_wars_matrix and ticket_prices_matrix are available in your workspace
all_wars_matrix
ticket_prices_matrix
# Estimated number of visitors
visitors <-
# US visitors
us_visitors <-
# Average number of US visitors
# all_wars_matrix and ticket_prices_matrix are available in your workspace
all_wars_matrix
ticket_prices_matrix
# Estimated number of visitors
visitors <- all_wars_matrix / ticket_prices_matrix
# US visitors
us_visitors <- visitors[ ,1]
# Average number of US visitors
mean(us_visitors)
msg <- "Do not change the contents of `all_wars_matrix`; this matrix has already been created for you in the workspace."
test_object("all_wars_matrix", undefined_msg = msg, incorrect_msg = msg)
msg <- "Do not change the contents of `ticket_prices_matrix`; this matrix has already been created for you in the workspace."
test_object("ticket_prices_matrix", undefined_msg = msg, incorrect_msg = msg)
test_object("visitors",
incorrect_msg = "Have you correctly created the `visitors` matrix? You should divide `all_wars_matrix` by `ticket_prices_matrix` to get there.")
test_object("us_visitors", incorrect_msg = "To create `us_visitors`, you should correctly select the entire first column from `visitors`. You can use `[,1]` for this!")
test_output_contains("mean(us_visitors)", incorrect_msg = "Once you have created `us_visitors`, you can use `mean()` to calculate the average number of visitors in the US. Make sure to print out the result.")
success_msg("It's a fact: the R force is with you! This exercise concludes the chapter on matrices. Next stop on your journey through the R language: factors.")
mean()
to calculate the average of the inputs to the function.visitors
using visitors[ ,1]
.


Me
My work
Photos
The blog
of
Gero Nikolov
(1997 - ????)
Stories
Snaps from today
My first post :
Post content.
My second post :
Post content.


Expected array but received: {0}
This error occurs when filter is not used with an array:
<input ng-model="search">

{{ key }} : {{ value }}

Filter must be used with an array so a subset of items can be returned. The array can be initialized asynchronously and therefore null or undefined won't throw this error.
To filter an object by the value of its properties you can create your own custom filter:
angular.module('customFilter',[])
.filter('custom', function() {
return function(input, search) {
if (!input) return input;
if (!search) return input;
var expected = ('' + search).toLowerCase();
var result = {};
angular.forEach(input, function(value, key) {
var actual = ('' + value).toLowerCase();
if (actual.indexOf(expected) !== -1) {
result[key] = value;
}
});
return result;
}
});
That can be used as:
<input ng-model="search">

{{ key }} : {{ value }}

You could as well convert the object to an array using a filter such as toArrayFilter:
<input ng-model="search">

{{ item }}


SODA stands for Sino Open Data Apps. It is the flagship open data challenges series in China.
Do you know？Governments and Corporates hold a huge amount of data about our city and everyday life. What if we can open up those data? Then the great power could be unleashed!
Data is just numbers. It is cold but you can use it and make it useful to the city and its citizens!
We believe the participants of citizens is the key to urban innovation. SODA invites everyone like you to use data resources and create new values.
Open Data means Collaboration. The city is considered as a platform and everyone is part of the platform. Jointly, we can create a modern, inclusive, and fun space for innovation!
The future of the city is determined by you! Through SODA, we hope you can join us to create a better future!
Since 2017, SODA focueses on Future Business, Smart Mobility, Green Development and Wellbeing&Healthcare.
Data Heroes, please join us and sign up now!


| About Dailyrotten |
|
Feedback
If you like this page, hate it, or would like to suggest changes,
<EMAIL_ADDRESS>is listening. This page
is experimental and somewhat different from what we usually offer, so please
do send your feedback.
Adding Stories
If you are a rotten newshound and you would like to suggest a story,
visit our submit page to
send us the URL. Stories that are accepted will have your name credited.
Viewership
On the first full day this page went live, 100,000 people visited this Rotten
News page. Of course that was the day after the WTC attacks, so that number is
somewhat distorted. Right now this page gets between 50,000 and 75,000 people
every day.
Linking
We encourage everyone to link to this page; if you like it, others probably
will as well.
Other Rotten
Rotten
Gaping Maw
Celebrity Morgue
Mugshots
Rotten Store
Shockumentary
Rate My Poo
Rate My Kitten
Rate My Finger
Penny Postcards
Phallic
Dr. Sputnik
Boners
Dead Pool
NNDB
Home
Make Dailyrotten your start page
|
|
|
June 25, 2003
Ugandan children's crusade gone completely psycho
Guardian | Submitted by: Otis Criblecross
"The hide-and-seek begins at bedtime when thousands of small figures emerge from grass huts and tramp towards the town of Kitgum in the gloom. ... Out in the bush, unseen, are other children: the seekers armed with AK-47s, clubs and knives. It is a game played every night in the nearby towns and villages, an area stretching for hundreds of miles. If the hiders are found by the child warriors of the Lord's Resistance Army (LRA), they experience one of three outcomes: they are killed on the spot, marched into the bush and killed, or marched into the bush and forced to become killers themselves. ... The LRA is led by Joseph Kony, an elusive mystic, thought to be in his 40s, who wants to rule Uganda according to the 10 commandments. ...
|
|
Read article...
|
|
Epileptic man killed by own dog during seizure
BBC | Submitted by: nitanooo
"A London man was killed by his own dog as he suffered an epileptic fit, an inquest has found. ... Pathologist Kenneth Shorrock found Mr Dinham's throat had several deep bites, which severed the main blood vessel to the brain and his windpipe. ... Expert police dog handler Pc Peter Tallack said the dog, a Staffordshire bull terrier, was a loyal and friendly breed but would have been startled by the fit."
|
|
Read article...
|
|
Posthumous citizenship sought for suicided WWI vet
KNBC-TV 4 Los Angeles | Submitted by: Tim Howard
"A World War I soldier who killed himself 66 years ago when he found out he wasn't an American citizen should be granted posthumous citizenship, according to two lawmakers who are trying to change that through legislation. Republican Dana Rohrabacher and Democrat Jane Harman introduced a bill that would grant posthumous citizenship to John Castellano, an Italian who was so distraught in 1937 when he realized he was not an American that he wrote a suicide letter and drank a bottle of shoe dye."
|
|
Read article...
|
|
Retard hangs self because of "evil" website
MSNBC | Submitted by: Vida J. A.
"21-year-old Julie Veteto sank into a severe depression. Still, her family was stunned the afternoon her husband, Roger, came home to find her body dangling from a dog leash in their bathroom doorway. The couple's computer was still connected to the Internet. On the screen: a Web site with detailed information on suicide by hanging. 'This stuff shouldn't be online,' says Veteto's father... because of Julie's lifelong learning disabilities, 'there's no way she would have known how to kill herself if they hadn't told her how. ... These Web sites are evil,' he says."
|
|
Read article...
|
|
Nutball father, child flee imaginary poison gas
WKMG-TV 6 Orlando | Submitted by: Tim Howard
"A father who swam five hours to shore with his 11-year-old daughter after their sailboat capsized in the Atlantic Ocean is being held for a psychological evaluation, officials said Tuesday. ... Harrell said the man, who has sole custody of his daughter, thought poisonous gases were spreading across mainland Florida and taking his daughter out to sea was the only way to save her. ... 'He has some mental-health or behavioral issues and apparently had stopped taking his medication.'"
|
|
Read article...
|
|
NYC cop, firemen illegally fired for offensive parade float
Newsday | Submitted by: Tim Howard
"A federal judge in Manhattan ruled Tuesday that then-Mayor Rudolph Giuliani violated the free speech rights of a city police officer and two firefighters by firing them for donning blackface and riding on a controversial float during a 1998 Broad Channel parade. The government 'may not prohibit the expression of an idea simply because a segment of society finds it offensive,' U.S. District Judge John Sprizzo wrote in a 54-page decision. ... The trio break-danced, brandished watermelons and fried chicken containers, and pretended to re-enact the killing of James Byrd, a black man dragged to his death in Texas. The float, the three said, was a parody of the stereotypical views of their white neighbors. [Sure, sounds reasonable.] The three were fired in October 1998 and immediately filed suit seeking their jobs." With photo of the float.
|
|
Read article...
|
|
Microsoft insiders stealing software, getting rich
CNN | Submitted by: Angel Hair Pasta
"A former Microsoft employee accused of stealing software worth $17 million was charged with 62 counts of mail and computer fraud. ... Gregg, a former project coordinator for Windows development, is accused of ordering software with a retail value of $17 million through the company's internal software ordering system and then reselling it. ... The investigation was sparked by a similar case in which an employee, Daniel Feussner, was accused of stealing software with a retail value of $9 million and then using the money to buy expensive cars and jewelry. Feussner, who was awaiting trial on federal charges of wire, mail and computer fraud, died in February after drinking antifreeze."
|
|
Read article...
|
|
Eminem insensitive to Michael Jackson's feelings
theherald.co.uk | Submitted by: Rockpile
"Pop history repeated itself as farce yesterday when Eminem, the enfant terrible of rap, dangled a plastic baby over the edge of his hotel balcony in Glasgow, to the delight of the small crowd of fans who had waited all day to see him. His gesture parodied the actions of Michael Jackson, who last year provoked international outrage by holding a real baby -- purportedly his own -- over a hotel balcony in Germany in front of horrified crowds below. The rapper's latest stunt adds to a catalogue of incidents that have secured his status as one of the most controversial figures in pop music today, leading George W Bush to label him 'the most dangerous threat to American children since polio.'"
[By the way, if anyone has specific documentation on that Bush blurb, including the date and venue where he supposedly said it, mail it to<EMAIL_ADDRESS> 'One of the monkeys pounced on a woman holding a child, biting her arm before leaping back into the tree,' Xinhua said. It said police shot the adult monkeys 'to prevent further attacks.'" [As an example to the other monkeys?]
|
|
Read article...
|
|
Stymied Internet lover bangs self on head
herald-dispatch.com | Submitted by: maggot
"A man intentionally knocked himself unconscious Monday morning after the mother of a girl he met on the Internet refused to allow her daughter to go with him. ... When the man arrived at the home, he was met by the girl’s mother, who refused to allow her daughter to leave the house. After leaving the home, the man intentionally banged his head on the door frame of his car and fell to the ground unconscious. He was transported to Cabell Huntington Hospital for treatment."
|
|
Read article...
|
|
South Africa's answer to jimson weed
iAfrica | Submitted by: Tim Howard
"Cape Town police warned parents on Wednesday about an innocuous looking plant, which could 'give their children a high' but also has deadly consequences. The warning comes after a concerned Cape Town mother contacted the police. She said her 14-year-old son had been rushed to Karl Bremer Hospital last month after he started hallucinating and his pupils became dilated. A 19-year-old was also treated at the hospital for drinking the juice of the plant, commonly known as 'moonflower.'"
|
|
Read article...
|
|
Eight firemen extract corpse of fat shut-in
WKMG-TV 6 Orlando | Submitted by: Tim Howard
"Fire rescue workers were called to a trailer in Orange County, Fla., Tuesday to help remove the body of a 600-pound man, according to Local 6 News. A funeral home worker reportedly called for help Tuesday to move the 36-year-old man's body. ... eight fire rescue workers needed four hours to remove the man from his home." With video.
|
|
Read article...
|
|
Shoelace cam latest breakthrough in upskirt cinematography
KNBC-TV 4 Los Angeles | Submitted by: Tim Howard
"Police say James Rich filmed the underwear of a number of women at Sunday's annual classic car show in Palo Alto. Investigators say a camera lens was hidden in the laces of a shoe, with wires running up Rich's leg to a camera. A man attending the show told police he saw Rich following a woman around. He says Rich stood very close to the women -- and he wasn't looking at cars."
|
|
Read article...
|
|
Snoop Dogg tired of caucasian sluts
WKMG-TV 6 Orlando | Submitted by: Tim Howard
"The rapper, who appeared as the host on one of the raunchy strip videos, says he's done with the series because it doesn't feature women of color.  Snoop Dogg said he plans to do his own version of 'Girls Gone Wild' to satisfy women of color waiting for their chance to go topless for the camera."
|
|
Read article...
|
|
Iraqi Minister of Disinformation captured
Fox News | Submitted by: Bonny Fide
"Mohammed Saeed al-Sahaf, the Iraqi 'disinformation minister' who became world renowned for his ridiculously inaccurate news briefings in Iraq soon before coalition troops reached Baghdad, was captured at a Baghdad roadblock, London's Daily Mirror reported Wednesday. The Washington Times also reported that the Iraqi official, also known as 'Comical Ali,' was detained early Monday evening near the home of a relative. But U.S. Central Command has not yet confirmed that Al-Sahaf is -- or is not -- in custody. A public affairs officer noted that Al-Sahaf is not on the U.S. military's most-wanted list and was 'never being pursued.'"
|
|
Read article...
|
|
|
|
|


Other:
F. Musculoskeletal
Appear Normal
Lameness LF, RF, LR, RR
Pain on palpation
M. Legs
Normal, no problems with knees or joints
Pateller luxation L, R, R & L
Grade
G. Heart
Sounds Normal
Arrhythmia
Murmur: Grade
Other:
Vaccinations
Given Today
or Due Date
Corona/Parvo
Bordatella
Lyme
DHLP-P
Rabies
Other


Hello world!
The woods are lovely, dark and deep, But i have promises to keep And miles to go before I sleep HI buddies how are you evryone plz stay attdention


Zedek Framework was first developed in 2011 and has progressed since then. In its first version (0.1 to 0.22) the basic idea was laid but had to be improved on in several areas to meet with today's demands while taking the best of what currently exists.
In version 2.0 Zedek Framework the file structure has been changed. The features in version 2 include: a Model-View-Controller (MVC) structure; Object Oriented; Encourages agile development; Has an Object Relational Model (ORM) built in called ZORM (new to version 2); Has a templating engine accessed from a class called ZView; Templating engines allows some logic in the html view file such as looping through an array (new in version 2.0); URL rewriting allowing for clean urls (without a prefix as previously seen in version 0-0.23).
Apache; PHP5.3+; Knowledge of PHP; Knowledge of Object Oriented Programming (OOP); Understanding of Test Driven Development (TDD) in PHP - Simpletest library has been included to take care of web presentation of tests
Zedek framework 2.1 templating has been abstracted from the the controler as in the previous version and is now now in a class ZView in the /core/view.php. Zedek url maps to controller, method and arguments as shown below: http://mywebsite.com/controller/method/arguments. The engines/ folder contains all the mapping directories such that for the example above the class name is used to create a folder in the engines folder: /zedek/engines/controller
This contains a controller.php file which has a class in it named CController which in turn extends the abstract class ZController within the /core/controller.php file. the methods of this class are mapped to the url. Within the controller folder is a view folder which houses browser accessible files: /zedek/engines/controller/view/
Zedek Framework implements a basic ORM (Object Relational Mapper). This can be called from any point by instantiating the ZORM class and this returns a ZORM object.
$orm = new ZORM;
The ZORM object when instantiated may take a PDO object as argument, but where none is given will create a PDO object from the config.json settings and this is returned in the attribute ZORM::$dbo. This object can map to existing tables via the ZORMTable class.
You would by now have noticed that the engines folder contains folders named after the controller with controller.php within and a view folder housing all the views, but there is no model.php file. This is because in typical MVC models the model files are usually independent of the controller, such that multiple controllers can access a single model. for this reason there is a model folder in /path/to/zedek/models/. Any file entered here with a class definition and within the same namespace will be accessed by all controllers by simply calling on that class. Lets illustrate this.
The themes are located in the /zedek/themes folder. The theme may be selected by setting within the config file /zedek/config/config.json. {
"version": "2.0",
"theme": "new_theme"
}
this would then require that a new theme folder with the name new_theme is created within the themes folder. Templating applies to the theme, thus allowing for place holders within the header and footer files.


C# based testing
This pages documents how to do Blazor/Razor component testing using just C#.
Before you get started, make sure you have read the Getting started page and in particular the Basics of Blazor component testing section. It wont take long, and it will ensure you get a good start at component testing.
NOTE: You are currently required to write your tests using the xUnit framework. If popular demand requires it, this library can be made test framework independent in the future.
TIP: Working with and asserting against the rendered component and its output is covered on the Working with rendered components and fragments page.
Content:
- Creating an new test class
- Executing test cases
- Rendering components during tests
- Passing parameters and services to components during render
- Registering and injecting services into components during render
Further reading:
- Working with rendered components and fragments
- Semantic HTML markup comparison
- Mocking JsRuntime
- C# test examples
Creating an new test class
All test classes are expected to inherit from ComponentTestFixture
, which implements the ITestContext
interface. The example below includes the needed using statements as well:
using System;
using Bunit;
using Bunit.Mocking.JSInterop;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
public class MyComponentTest : ComponentTestFixture
{
[Fact]
public void MyFirstTest()
{
// ...
}
}
The ComponentTestFixture
contains all the logic for rendering components and correctly dispose of renderers, components, and HTML parsers after each test.
Executing test cases
Since Blazor component tests are just regular xUnit test/facts, you execute them in exactly the same way as you would normal tests, i.e. by running dotnet test
from the console or running the tests through the Test Explorer in Visual Studio.
Rendering components during tests
To render a component, we use the RenderComponent<TComponent>(params ComponentParameter[] parameters)
method. It will take the component (TComponent
) through its usual life-cycle from OnInitialized
to OnAfterRender
. For example:
public class ComponentTest : ComponentTestFixture // implements the ITestContext interface
{
[Fact]
public void Test1()
{
// Renders a MyComponent component and assigns the result to
// a cut variable. CUT is short for Component Under Test.
IRenderedComponent<MyComponent> cut = RenderComponent<MyComponent>();
}
}
The RenderComponent<TComponent>(params ComponentParameter[] parameters) : IRenderedComponent<MyComponent>
method has these parts:
TComponent
is the type of component you want to render.ComponentParameter[] parameters
represents parameters that will be passed to the component during render.IRenderedComponent<TComponent>
is the representation of the rendered component. Working with the rendered component and its output is covered on the Working with rendered components and fragments page.
Passing parameters to components during render
There are four types of parameters you can pass to a component being rendered through the RenderComponent()
method:
- Cascading values (normally provided by the
<CascadingValue>
component in.razor
files). - Event callbacks (of type
EventCallback<T>
orEventCallback
). - Child content, render fragments, or templates (of type
RenderFragment
andRenderFragment<T>
). - All other normal parameters, including unmatched parameters.
In addition to parameters, services can also be registered in the ITestContext
and injected during component render.
To show how, let us look at a few examples that correctly pass parameters and services to the following AllTypesOfParams<TItem>
component:
@typeparam TItem
@inject IJSRuntime jsRuntime
@code {
[Parameter(CaptureUnmatchedValues = true)]
public IReadOnlyDictionary<string, object> Attributes { get; set; }
[Parameter]
public string RegularParam { get; set; }
[CascadingParameter]
public int UnnamedCascadingValue { get; set; }
[CascadingParameter(Name = "Named")]
public int NamedCascadingValue { get; set; }
[Parameter]
public EventCallback NonGenericCallback { get; set; }
[Parameter]
public EventCallback<EventArgs> GenericCallback { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
[Parameter]
public RenderFragment OtherContent { get; set; }
[Parameter]
public RenderFragment<TItem> ItemTemplate { get; set; }
}
And to render the AllTypesOfParams<TItem>
component with all possible parameters set, use the following code:
var cut = RenderComponent<AllTypesOfParams<string>>(
// pass name-value attribute to be captured by the Attributes parameter
("some-unmatched-attribute", "unmatched value"),
// pass value to the RegularParam parameter
("RegularParam", "some value"),
// pass value to the UnnamedCascadingValue cascading parameter
CascadingValue(42),
// pass value to the NamedCascadingValue cascading parameter
CascadingValue("Named", 1337),
// pass action callback to the NonGenericCallback parameter
EventCallback("NonGenericCallback", () => { /* logic here */ }),
// pass action callback to the GenericCallback parameter
EventCallback("GenericCallback", (EventArgs args) => { /* logic here */ }),
// pass render fragment to the ChildContent parameter
ChildContent("
hello world
"),
// paas render fragment to the OtherContent parameter
RenderFragment("OtherContent", "
hello world
"),
// pass an template render fragment to the ItemTemplate parameter
Template<string>("ItemTemplate", (item) => (builder) => { })
);
- Regular parameters can easily be passed as
(string name, object? value)
pairs (they are automatically converted to a ComponentParameter). We see two examples of that with the "RegularParam" and the unmatched attribute "some-unmatched-attribute". - Cascading values can be passed both as named and unnamed via the
CascadingValue
helper method, as we see in the example above with "UnnamedCascadingValue" and "NamedCascadingValue". - Event callbacks can be passed as
Func
andAction
types with and without input and return types, using theEventCallback
helper method. The example above shows two examples in "NonGenericCallback" and "GenericCallback" - Child content and general Render fragments is passed to a component using the
ChildContent
orRenderFragment
helper methods. TheChildContent
andRenderFragment
methods has two overloads, one that takes a (markup) string and a generic version, e.g. for child content,ChildContent<TComponent>(params ComponentParameter[] parameters)
, which will generate the necessary render fragment to render a component as the child content. Note that the methods takes the same input arguments as theRenderComponent
method, which means it too can be passed all the types of parameters shown in the example above. - Templates render fragments can be passed via the
Template<TValue>
method, which takes the name of the parameter and aRenderFragment<TValue>
as input. Unfortunately, you will have to turn to theRenderTreeBuilder
API to create templates at the moment.
TIP: Use the nameof(Component.Parameter)
method to get parameter names in a refactor-safe way. For example, if we have a component MyComponent
with a parameter named RegularParam
, then use this when rendering:
var cut = RenderComponent<MyComponent>(
(nameof(MyComponent.RegularParam), "some value")
);
Registering and injecting services into components during render
When testing components that require services to be injected into them, i.e. @inject IJsRuntime jsRuntime
, you must register the services or a mock thereof before you render your component.
This is done via the ITestContext.Services
property. Once a component has been rendered, no more services can be added to the service collection.
If for example we want to render the with a dependency on an IMyService
, we first have to call one of the AddSingleton
methods on the service collection and register it. All the normal AddSingleton
ServiceCollection
overloads are available.
In the case if a IJsRuntime
dependency, we can however use the built-in Mocking JsRuntime. For example:
public class ComponentTest : ComponentTestFixture // implements the ITestContext interface
{
[Fact]
public void Test1()
{
// Add an custom service to the services collection
Services.AddSingleton<IMyService>(new MyService());
// Add the Mock JsRuntime service
Services.AddMockJsRuntime();
// Renders a MyComponent component and assigns the result to
// a cut variable. CUT is short for Component Under Test.
IRenderedComponent<MyComponent> cut = RenderComponent<MyComponent>();
}
}
See the page Mocking JsRuntime for more details mock.


The Journey Begins
29 Mar 2014When venturing out to accomplish something new there is always an equal amount of excitement and fear. And that's exactly the feeling I have as I sit here on Southwest Flight #WN564.
Just a few hours ago, I left everything familiar to me—my family, home, and job to travel sight unseen to Atlanta, Georgia to attend The Iron Yard. As I fly across the country, I can't help but contemplate what lies in store for the next 12 weeks. I'm genuinely looking forward to blogging about my journey to becoming a coder.
A Helping Hand
My decision to attend a coding bootcamp was heavily influenced by others who have already taken the leap of faith to attend a bootcamp, especially, Daniel Donaldson. Daniel went out of his way to transparently answer practical questions I had. Just by him blogging about his experiences and the obstacles he overcame to attend, I was challenged to do the same. Hopefully, my experiences will be a challenge and motivation to others who are struggling with the same decision I faced.


type
Search
Exact Match
All sources
=
contains
LIST
!=
<
>
not contains
predicate
count
only
OR
AND
X


LoadingState
public class LoadingState
Undocumented
-
Readable name for debugging
Declaration
Swift
var readableName: String?
-
General completion handler of the loading state. Containens
successCompletion
andfailCompletion
Declaration
Swift
public var stateHandler: StateHandler?
-
Completion success handler of the loading state
Declaration
Swift
var successCompletion: StateCallBack?
-
Completion fail handler of the loading state
Declaration
Swift
var failCompletion: StateCallBack?
-
Parameter defines if state should ignore auto invocation call in case it is dependant state.
Declaration
Swift
var willSkipingStateAutoInvocation: Bool
-
Checks if Loading state machine objects are equal
Declaration
Swift
static func == (from: LoadingState, to: LoadingState) -> Bool
Parameters
from
first state machine instance to compare
to
second state machine instance to compare
Return Value
True if both object has same LoadingStateMachineGroups enum value, otherwise false
-
Defines state loading status
Declaration
Swift
private(set) var loadingState: LoadingStateTypes { get set }
-
Delegate instance uses to pass information when Loading state changed loading status or finished work
Declaration
Swift
var delegate: LoadingStateMachineDelegate?
-
State dependancies that will be called after current state will finish it’s work
Declaration
Swift
var dependantStates: [String]
-
Type of the loading state
Declaration
Swift
let name: String
-
Create new state instance with state type and dependant states
Declaration
Swift
public init(dependantStatesIds: [String] = [])
Parameters
name
State type
dependantStates
State dependancies that will be called after current state will finish it’s work
-
Remove dependancy on same state from current state
Declaration
Swift
func removeDependancyOnSelf(dependantStatesIds: [String]) -> [String]
Parameters
dependantStates
Array of dependancies states to check
Return Value
return filtered dependencies list without state duplication of Self State
-
Remove duplication from dependecies if was added, we are not allowing to have same dependency twice in a list
Declaration
Swift
func removeDuplicationDependancies(dependantStatesIds: [String]) -> [String]
Parameters
dependantStates
Array of dependancies states to check
Return Value
return filtered dependencies list duplication state
-
Start load state if state has not dependant states
Declaration
Swift
@discardableResult func setStartLoadState() -> Bool
-
Force load state
Declaration
Swift
private func loadState()
-
Pass inforamtion that other state finish its job
Declaration
Swift
func stateDidFinishedJob(stateId: String)
Parameters
stateType
state that finished job


{% extends 'base.html' %} {% block header %}
Please specify the epoch for which to generate the grid of images. Pre-training initializations can be seen at epoch 0. The maximum epoch available is the number of trained epochs ({{ max_epoch }}).
Please select the labels for which to generate the grid. You can select multiple by holding ctrl.
Please select the number of examples of each label to generate. The maximum number of examples available is {{ max_num_examples }}.


I am so excited that I am learning at Code the Dream Academy github, JavaScript and Reaact
We will be able to create websites for NonProfit Organizations with good causes on earth
We will plant seeds that flourish on earth
The first Website will be one with centralized information in my area for victims of Violence Yeawww


OBADIAH 1 The vision of Obadiah.
Edom Will Be Humbled
Thus says the Lord GOD concerning Edom:
We have heard a report from the LORD,
and a messenger has been sent among the nations:
"Rise up! Let us rise against her for battle!"

4 Though you soar aloft like the eagle,
though your nest is set among the stars,
from there I will bring you down,
declares the LORD.
5 If thieves came to you,
if plunderers came by night-
how you have been destroyed!-
would they not steal only enough for themselves?

Edom's Violence Against Jacob
10 Because of the violence done to your brother Jacob,
shame shall cover you,
and you shall be cut off forever.
11 On the day that you stood aloof,
on the day that strangers carried off his wealth
and foreigners entered his gates
and cast lots for Jerusalem,
you were like one of them.
12 But do not gloat over the day of your brother
in the day of his misfortune;
do not rejoice over the people of Judah
in the day of their ruin;
do not boast
in the day of distress.
13 Do not enter the gate of my people
in the day of their calamity;
do not gloat over his disaster
in the day of his calamity;
do not loot his wealth
in the day of his calamity.
14 Do not stand at the crossroads
to cut off his fugitives;
do not hand over his survivors
in the day of distress.
The Day of the LORD Is Near
15 For the day of the LORD is near upon all the nations.
As you have done, it shall be done to you;
your deeds shall return on your own head.
16 For as you have drunk on my holy mountain,
so all the nations shall drink continually;
they shall drink and swallow,
and shall be as though they had never been.
17 But in Mount Zion there shall be those who escape,
and it shall be holy,
and the house of Jacob shall possess their own possessions.
18 The house of Jacob shall be a fire,
and the house of Joseph a flame,
and the house of Esau stubble;
they shall burn them and consume them,
and there shall be no survivor for the house of Esau,
for the LORD has spoken.
The Kingdom of the LORD
19 Those of the Negeb shall possess Mount Esau,
and those of the Shephelah shall possess the land of the Philistines;
they shall possess the land of Ephraim and the land of Samaria,
and Benjamin shall possess Gilead.
20 The exiles of this host of the people of Israel
shall possess the land of the Canaanites as far as Zarephath,
and the exiles of Jerusalem who are in Sepharad
shall possess the cities of the Negeb.
21 Saviors shall go up to Mount Zion
to rule Mount Esau,
and the kingdom shall be the LORD's.


Team
Contributors
pandas is made with love by more than 2,000 volunteer contributors.
If you want to support pandas development, you can find information in the donations page.
Maintainers
Jeff Reback
chris-b1
Sinhrks
Phillip Cloud
Jeremy Schendel
jbrockmendel
Simon Hawkins
Terji Petersen
Kaiqi Dong
Irv Lustig
Daniel Saxton
Marco Edward Gorelli
Richard Shadrach
Patrick Hoefler
Diversity and Inclusion
pandas expressly welcomes and encourages contributions from anyone who faces under-representation, discrimination in the technology industry or anyone willing to increase the diversity of our team. We have identified visible gaps and obstacles in sustaining diversity and inclusion in the open-source communities and we are proactive in increasing the diversity of our team. We have a code of conduct to ensure a friendly and welcoming environment. Please send an email to pandas-code-of-conduct-committee, if you think we can do a better job at achieving this goal.
Governance
Wes McKinney is the Benevolent Dictator for Life (BDFL).
The project governance is available in the project governance documents.
Code of conduct committee
- Safia Abdalla
- Tom Augspurger
- Joris Van den Bossche
- Camille Scott
- Nathaniel Smith
NumFOCUS committee
- Phillip Cloud
- Stephan Hoyer
- Wes McKinney
- Jeff Reback
- Joris Van den Bossche
Emeritus maintainers
- Wouter Overmeire
- Skipper Seabold
- Jeff Tratner


EarthRoamer Introduces Carbon Fiber-Bodied LTi Expedition Vehicle
This thing looks amazing, inside and out.
by Christopher SmithThese days, vanlife machines come in all shapes and sizes. Sometimes they aren’t even a van, as is the case with the latest EarthRoamer build that was just announced. Based on a Ford F-550 Super Duty truck, the LTi combines all the amenities of off-grid camping with high-tech equipment, carbon fiber construction, and serious off-trail capability to literally find your own way through the wilderness.
Leave Roads Behind:
With its bones being a massive Ford Super Duty, the EarthRoamer LTi isn’t a lightweight by default but that doesn’t mean improvements over standard campers can’t be made. The LTi’s shell is entirely carbon fiber, which not only reduces weight but adds significant strength to the entire vehicle. Weight matters in any automotive application, but for a large RV that has aggressive off-road capability, reduced mass with a lower center-of-gravity is a tremendous benefit.
It also allows the LTi to carry an impressive amount of fuel and water for extended off-grid adventures. Freshwater capacity is 100 gallons, with 60 gallons devoted to greywater. A 95-gallon fuel tank supplies diesel for the 6.7-liter V8, but what you won’t find are propane tanks or an on-board generator. That’s because EarthRoamer packs the roof with enough solar panels to generate 1,320 watts of power, as well as an 11,000-watt hour lithium-ion battery pack to run things inside.
Gallery: EarthRoamer LTi
Inside, the LTi can be made-to-order in multiple configurations with seating accommodations for up to six people, and sleeping arrangements for four. Regardless of the specific layout, you’ll find a full kitchen and bathroom, not to mention sofas, a reconfigurable dining area, over-cab bunk, and impressive storage both inside and out.
Such capability doesn’t come without a cost. Each EarthRoamer is built by hand at the company’s headquarters in Dacono, Colorado, and pricing starts at $590,000. That doesn’t seem to deter eager customers, however, as EarthRoamer says there’s presently an eight-month waiting list from order to delivery to get one of these epic overlanders.
Source: EarthRoamer


- Sáb 25 agosto 2018
- 08:00
- Av. Érico Veríssimo, 500 - Campinas (UNICAMP)
Linux Developer Conference Brazil 2018
Linux Developer Conference Brazil is an international meeting point in Brazil for the community developing Free and Open Source Software (FOSS) for the Core of Linux systems and it myriad of platforms – mobile, TVs, cars, home appliances, IoT, Cloud and others.
By providing a place for developers, enthusiasts and companies to connect, we intend not only to help grow the FOSS community and market in Brazil, but also forge a link between the Brazilian community and the rest of the world.
We believe that in order to grow a strong upstream community in Brazil, our industry needs to play an important role in understanding FOSS values and its benefits to product development – be it the freedom of choosing which software to use, faster time to market or more secure software stacks. Inviting companies to the conference and educating them on how to be FOSS citizens is one of our core values.
Moreover, the conference focus is exclusively towards upstream contributions to FOSS projects. Getting players in the global market to understand FOSS values and encouraging them to be part of the community will be one of our main challenges in the time to come.
Supporting an environment where all that can flourish is the founding tenet of linuxdev-br!
Inscreva-se: Eventbrite Linux Dev Conf


Magister Hanellin:
You haven't left for the Forsaken Plains yet? Do you remember what I said?  Don't keep me waiting!


Who Wants to be a Javascript Millionaire?
Game Show Host
Questions & Answers
Question : #
Difficulty:
Time Left:
Start the Game


In an ever increasingly connected world plant maintenence seems to be stuck in the middle ages. We set out to solve this. Through the use of our automated plant watering service we empower users to become plant experts. Our system does all the hard work for you. All you have to do is set up the app and we will do the rest. You will automatically be notified at the optimal watering times for each of your plants. At Water My Plants we believe everybody can become plant experts.
If you would like to reach out to us please fill out a form using the link below.


the and cell {background death Zika ZIKV that margin {border-style virus px;} #ffffff;} al. ;:â€". activation cells mechanisms microcephaly with human response this The are immune neural for glial infection px; which {font-family Cell can caspase font-size induce neuroinflammatory This apoptosis associated cells. development double; enhance from inflammasome microcephaly. several vitro ;:. NLRP apoptosis, autophagy. border-color border-width cases formation induces injury modulate neuronal process proteins pyroptosis result solid; studies these type viral was work {font-style {font-weight ZIKV-induced bold brain cells, courier; cytoplasmic damage during em; endoplasmic experimental induced intrinsic involved its massive mechanism necrosis neurons paraptosis, promote pt;} recent receptors relationship responses results situ system underlying virus.


VOLONTER
About
Services
Contact
Portfolio
1 Column Portfolio
2 Column Portfolio
3 Column Portfolio
4 Column Portfolio
Single Portfolio Item
Blog
Blog Home 1
Blog Home 2
Blog Post
Other Pages
Full Width Page
Sidebar Page
FAQ
404
Pricing Table
Taras Shevchenko
About me
My interests
All
Education
Nature
Elder people
Army
My experience
Education
Languages
Additional information
My location
My pages


Podcast.fm
Explore
Sign in
Create a Podcast
Discover your new favorite podcast.
Narwhals
12 episodes
Podcasts about Podcasts
8 episodes
Criminal
220 episodes
Science VS
36 episodes
Mystery Show
121 episodes
The Pirates Breakdown
17 episodes
Previous
1
2
Next


This SRFI proposes text to replace section 6.2
"Numbers" of R5RS in order to extend its capabilities, correct errors in
its specification, make it more explicit about limitations of precision
and magnitude, and improve portability between implementations. More
specifically, this new text:
- incorporates an inexact real positive
infinity and an inexact real negative infinity,
- extends number syntax to incorporate inexact
real infinities,
- adapts Common-Lisp semantics for
`expt' and extends them to include inexact real
infinities,
- corrects the description of
`sqrt',
- sharpens the distinction between exact and
inexact numbers,
- removes a contradiction related to
exactness,
- extends `gcd' and
`lcm' to exact rational numbers,
- extends `quotient',
`modulo', and `remainder' to finite real
numbers,
- clarifies the behavior of
`inexact->exact' applied to an exact argument,
- clarifies the behavior of
`exact->inexact' applied to an inexact argument,
- adds convenience procedures
`exact-round', `exact-ceiling',
`exact-floor', and `exact-truncate',
- and adds examples.


All Categories
School
Medical
Engineering
History
Geology
Zoology
Sports
Fashion
Kids
Cookery
Novels
Others
Close Menu
Help
Select City
Please Choose Your Location
Select City
Mumbai
Byculla
Dadar
Kurla
Ghatkopar
Thane
Dombivali
Kalyan
Vashi
Nerul
Bandra
Mulund
Andheri
Panvel
Books
Bazar
Sell or Advertise any Book online
Find the Best Deals at Best Prices
Find The Book of Your Choice
The Easiest Way to get a Book
Browse Categories
School
Medical
Engineering
History
Geology
Zoology
Sports
Fashion
Kids
Cookery
Novels
others


Imagine, you are
What do you feel like doing?
Bears have a lot of activities to do depending on the mood.


Cross Site Replication Improvements
Infinispan introduced Cross Site Replication functionality in version 5.2 and Infinispan 7 extended it to support state transfer. With an increase of popularity, Infinispan 11 brings two major improvements to Cross Site Replication. Let’s take a look at them.
Support for multiple site masters
Infinispan uses JGroups' RELAY2 protocol to enable inter-site communication. Each site has Site Masters: these are nodes with special roles, and are responsible for the communication between sites.
RELAY2 can use more than one Site Master per site allowing load balancing of the inter-site requests. The new algorithm is now able to take advantage of multiple Site Masters.
The attribute max_site_masters
configures the number of Site Masters, and it defaults to 1.
To take advantage of the new algorithm, increase the number of Site Masters in RELAY2 configuration by changing
max_site_masters
to a value higher than 1.
A number greater than the number of nodes can be used, and it enables the Site Master role in all nodes.
<relay.RELAY2 site="<LOCAL_SITE_NAME>" max_site_masters="<PUT_VALUE_HERE>"/>
More information about RELAY2 is available in JGroups' Manual.
Conflict detection and resolution for Asynchronous Cross-Site Replication
Infinispan is able to detect conflicts in asynchronous mode by taking advantage of vector clocks. A conflict happens when 2 or more sites update the same key at the same time. Let’s look at an example between 2 sites (LON and NYC):
LON NYC
k1=(n/a) 0,0 0,0
k1=2 1,0 --> 1,0 k1=2
k1=3 1,1 <-- 1,1 k1=3
k1=5 2,1 1,2 k1=8
--> 2,1 (conflict)
(conflict) 1,2 <--
k1=5 2,1 <-> 2,1 k1=5
-
LON puts
k1=2
, with vector clock1,0
, and replicates it to NYC. -
NYC puts
k1=3
, with vector clock1,1
, and replicates it to LON. -
However if LON puts
k1=5
(with vector2,1
), and NYC putsk1=8
in NYC (with vector clock1,2
) at the same time, Infinispan detects the conflict since none of the vector clocks are greater than the other.
Infinispan resolves the conflicts by comparing using the site names in lexicographical order.
The site’s name lower in lexicographical order takes priority.
In the example above, both LON and NYC end up with k1=5
since LON < NYC.
You can choose the priority by prepending a number to the site name. For example, if you want updates from NYC to take priority over LON updates, you can prepend a number to the site name, example: 1NYC, 2LON and so on.
For more information check the Infinispan Documentation.
Get it, Use it, Ask us!
Please download, report bugs, chat with us, ask questions on StackOverflow.


Mutations must be introduced into the artificial reads in order to simulate chemical damage and evolutionary distance of ancient DNA with respect to the recent reference which they shall be mapped to.
As chemical damage is more prevalent near the end of ancient DNA, TAPAS can introduce more mutations into the artificial reads, near their ends. To this effect parameters must be determined, which affect the probability of each base exchange for each position in the read.
The mutation probability parameters are detailed in the next section. Following that, the section Specifying the parameters shows how values for the mutation probability parameters can be set by the user. Afterwards, in Subject-a-FASTQ-file-to-artificial-mutations, the FASTQ file containing artificial endogenous reads, which was generated in the previous topic, is subjected to mutations with the specified base exchange probabilities.
This chapter closes with two advanced topics: Obtaining mutation probability parameters from a mapDamage output and how to define multiple sets of mutation probability parameters to create multiple FASTQ files containing reads of different mutation strengths.
The reads are mutated using per base probabilities derived from the geometric distribution. The mutation probability at the read ends is the highest. By this, the chemical damage near read ends can be modelled. For this, three parameters are important:
The position-independent mutation probability \(t\) (\(0<t<1\)). This is the probability of any base to mutate, regardless of its proximity to the end of the read. This can be used to model evolutionary distance.
The steepness \(p\) (\(0<p<1\)) of the mutation probability decline when moving away from the read end. The higher this parameter the steeper is the decline of mutation probability when moving away from the read end.
The multiplying factor \(f\). At the read end, \(p\cdot f+t\) is the probability of the first base of the read to be mutated.
With this model, its possible to archive mutation probabilities greater than one. This makes of course no sense and the mutation probability is cut back to one in such cases.
In mathematical notation, the mutation probability \(P_{\text{mut}}\) of a base number \(x\), starting to count at the reads' end, is:
\[P_{\text{mut}}(x) = f \cdot \text{dgeom}(x;p) + t\]
with \(\text{dgeom}(X;P)\) being the density function of the geometric distribution, with parameters X = number of tries; P = success probability.
The following sketch graphs illustrate the three parameters:
The mutation probabilities are saved as a text table. It looks like this:
cat input/mut-tables/mut.tab
strand from to factor geom_prob intercept
3p C T 0.3 0.4 0.1
5p C T 0.1 0.2 0.0
3p * * 0.0 0.1 0.12
Two types of per-base mutation probabilities are distinguished:
The columns have the following meaning:
3
and one with a value 5
.*
] Which bases should mutate according to this lines' parameters. The character *
means this line applies to every base.*
] Which base should a mutation event yield. *
means a base (A,T,C,G) different from the original base is chosen at random.strand
)For each row of the table, the read is subjected to one round of mutation introduction where the mutation probability per base is determined by the parameters found in that row.
The multiple-mutate.py
tool takes a table of the previous section as input and mutates raw nucleotide strings provided to it on standard input accordingly.
An already existent FASTQ file can be mutated using the filter_fastq
tool in cooperation with multiple-mutate
. The tool filter_fastq
enables you to apply transformations to existing fastq files. To this effect, filter_fastq
extracts one part out of a FASTQ file (read name, nucleotide string or quality string) and feeds it into another sub-program specified between two @
-signs. The sub-program is required to take lines of text as input and return the same number of lines on standard output. The output of the sub-program is then placed into the output fastq file. By combining filter_fastq
and multiple_mutate
, the tool which applies mutations to strings of nucleotides, a FASTQ file can be mutated. The --seed
can be set to an arbitrary value to generate a reproducable result.
scripts/filter_fastq --nucleotide \
@ scripts/multiple_mutate --seed 123 input/mut-tables/mut.tab @ \
< data/2/volpertinger.fastq \
> data/3/volpertinger_mut.fastq
Note how the nucleotide strings of the output FASTQ file now carry mutations (lower-case letters):
head data/3/volpertinger_mut.fastq
@volpertinger_1
cTcTAaAAGATAgTAGCCAATCAGATCCA
+
FFFFFFFFFFFFFFFFFFFFFFFFFFFFF
@volpertinger_2
TCTAcTTAATAgTTTCTCCC
+
FFFFFFFFFFFFFFFFFFFF
@volpertinger_3
TcGgACTTTATCTTCCGccGCTCAAC
The filter_fastq.py
script enables you to apply an arbitrary script or program on just one part of a FASTQ file (ID line, nucleotide line, quality line). The used script must accept the respective part on standard input and print the modified version on standard output. The modified FASTQ file is assembled by filter_fastq.py
from the output of its children scripts and printed on standard output.
On the filter_fastq.py
call, the @ sign serves as a sentinel character, which determines start and end of the sub-program's command line. It can also be any arbitrary other character, as long as it doesn't occur inside the child script's command line but only at the beginning and the end.
In this example, the endogenous reads from volpertinger undergo simulated mutation and damage prior to mapping, while the contaminant reads from R. etli do not.
Therefore only now, after applying mutations to our volpertinger reads, is the time to combine the mutated sample reads and the contaminant reads generated in the last section to one file. For this purpose, the UNIX tool cat
is used:
cat data/3/volpertinger_mut.fastq data/2/retli.fastq \
> data/3/all.fastq
The following two sections deal with advanced means of determining read mutation probabilities. They are not used in this tutorial, but may be used in custom workflows.
The subsequent section deals with how to read out mapDamage output to determine the read mutation probability parameters.
The section following that deals with how to create multiple distinct sets of read mutation probabilty parameters. By that means, different read sets can be created which were subjected to varying degrees of mutations. Therefore, mapper performance can be evaluated for different severities of read mutations.
Damage patterns from mapDamage can be converted into a table with mutation parameters by least-squares fitting. For this purpose, the mapDamage output file misincorporation.txt
is needed.
The following command fits a geometric distribution to mapDamage data, shows the derived parameters and plots the data with the fitted curve.
The cut
command is used only to limit the output to a width acceptable for this manual. Use the bash >
redirection operator to write this output into a file suitable for multiple_mutate.py
.
scripts/mapdamage2geomparam \
--fit-plots fig/fit.png \
input/mapdamage/misincorporation.txt | \
cut -f1-6 | \
column -t
strand from to factor geom_prob intercept
3p A C 0.002594 0.1289 0.0003363
3p A G 0.005872 0.3972 0.001542
3p A T 0.001393 0.7516 0.0006354
3p C A 0.02344 0.8742 0.0007693
3p C G 0.004381 0.4866 0.0006858
3p C T 0.09154 0.566 0.003878
3p G A 0.02789 0.8881 0.00169
3p G C 2.156e-07 0.1 0.001068
3p G T 0.01546 0.1008 0.004605
3p T A 0.01236 0.6896 0.0005899
3p T C 9.547e-07 0.1 0.001878
3p T G 0.005273 0.3866 0.000331
5p A C 0.0003257 1 NA
5p A G 0.003505 0.5183 NA
5p A T 7.02e-07 0.1 NA
5p C A 0.002157 0.8335 NA
5p C G 0.0009197 0.6883 NA
5p C T 0.09852 0.9541 NA
5p G A 0.002752 0.6784 NA
5p G C 4.612e-08 0.1 NA
5p G T 3.004e-07 0.1 NA
5p T A 0.001127 0.9989 NA
5p T C 2.849e-07 0.1 NA
5p T G 0.0007032 0.8024 NA
For each base exchange, the position-independent parameter intercept
is only listed for one strand end.
This is the generated plot, which shows the mutation frequencies obtained from mapDamage (black dots) and the fitted mutation model (blue lines):
Sometimes, multiple damage patterns need to be compared. There is a possibility to generate the multiple_mutate
input files from one table which lists all different values of the different mutation parameters.
This approach will be seen again later, where there is a possibility to generate many short read mapper calls from exactly the same kind of parameter table. You can therefore generate appropriate input files as well as appropriate short read mapper calls out of only one table which lists all the parameters.
The fill_template.py
script expects a table, where each row is used to fill a prespecified template with values.
For example, if a template is written which looks like this:
cp input/mut-tmpl/mut-tmpl data/3
column -t data/3/mut-tmpl
strand from to factor geom_prob intercept
5 C T {fac} {geom} 0
3 G A {fac} {geom} 0
3 * * 0 0 {all_intercept}
... and another table is written which lists several values for the expressions in braces {...}
from the previous file:
cp input/mut-tmpl/tab data/3/mut-tab
column -t data/3/mut-tab
fac geom all_intercept
0 0.1 0
0 0.1 0.3
0.5 0.1 0
0.5 0.1 0.3
... several files can be generated, where the brace-expressions are replaced by the values of the second table, using the fill_template
script:
scripts/fill_template \
data/3/mut-tmpl \
< data/3/mut-tab
strand from to factor geom_prob intercept
5 C T 0 0.1 0
3 G A 0 0.1 0
3 * * 0 0 0
strand from to factor geom_prob intercept
5 C T 0 0.1 0
3 G A 0 0.1 0
3 * * 0 0 0.3
strand from to factor geom_prob intercept
5 C T 0.5 0.1 0
3 G A 0.5 0.1 0
3 * * 0 0 0
strand from to factor geom_prob intercept
5 C T 0.5 0.1 0
3 G A 0.5 0.1 0
3 * * 0 0 0.3
To write each table into its own file, the --output
switch of the fill_template
script can be used. The argument of --output
can (and should!) contain column names of the table, again enclosed in braces {...}
. This creates multiple files, where the braced expressions in the file names are replaced in the same way as they are in the table contents.
We will now write each of the tables shown above to its own file. We want to name the files using a counting number, but our input table doesn't yet contain a column with that counter. Therefore we must first add one.
The mentioned-above table can be prepended with an index column:
scripts/index_column --inplace data/3/mut-tab
head data/3/mut-tab | column -t
index fac geom all_intercept
0 0 0.1 0
1 0 0.1 0.3
2 0.5 0.1 0
3 0.5 0.1 0.3
Now, each output of fill_template.py
can be written to its own output file, using the information from the newly-generated index
column:
scripts/fill_template \
--output "data/3/{index}_filled" \
data/3/mut-tmpl \
< data/3/mut-tab
# Show all the generated files
for f in data/3/*_filled; do
echo " === $f === "
column -t $f
done
=== data/3/0_filled ===
strand from to factor geom_prob intercept
5 C T 0 0.1 0
3 G A 0 0.1 0
3 * * 0 0 0
=== data/3/1_filled ===
strand from to factor geom_prob intercept
5 C T 0 0.1 0
3 G A 0 0.1 0
3 * * 0 0 0.3
=== data/3/2_filled ===
strand from to factor geom_prob intercept
5 C T 0.5 0.1 0
3 G A 0.5 0.1 0
3 * * 0 0 0
=== data/3/3_filled ===
strand from to factor geom_prob intercept
5 C T 0.5 0.1 0
3 G A 0.5 0.1 0
3 * * 0 0 0.3
If several combinations of mutation parameters shall be tested, cross_tab.py
can be used to generate a table like data/3/mut-tab
from predefined parameter values, like described with mapper parameters in the next chapter.


Anokha Techfair Co-Ordinator Feb 2020
Anokha 2020
Full Time
Anokha 2020 is an national level tech-fest organised by Amrita Vishwa Vidyapeetham, I have been part of the Tech-fair organising team as it is the first of its kind in Anokha we have faced lot of problems and successfully learnt the aspects of forming a team and importance roles of a team player.


Please wait ...
Toggle navigation
SML Bootzooka
Home
Register
Login
Logged in as {{getLoggedUserName()}}
Logout
×
Close
Info!
×
Close
Error!


Toggle navigation
IdeaZone
Find Project Ideas
My Favorite Projects
About
| Sign in with Twitter
| Sign in with Google
| Sign in with GitHub


请参阅: 说明
| 接口 | 说明 |
|---|---|
| HttpInvokerClientConfiguration |
Configuration interface for executing HTTP invoker requests.
|
| HttpInvokerRequestExecutor |
Strategy interface for actual execution of an HTTP invoker request.
|
| 类 | 说明 |
|---|---|
| AbstractHttpInvokerRequestExecutor |
Abstract base implementation of the HttpInvokerRequestExecutor interface.
|
| HttpComponentsHttpInvokerRequestExecutor |
HttpInvokerRequestExecutor implementation that uses
Apache HttpComponents HttpClient
to execute POST requests. |
| HttpInvokerClientInterceptor |
MethodInterceptor for accessing an
HTTP invoker service. |
| HttpInvokerProxyFactoryBean |
FactoryBean for HTTP invoker proxies. |
| HttpInvokerServiceExporter |
Servlet-API-based HTTP request handler that exports the specified service bean
as HTTP invoker service endpoint, accessible via an HTTP invoker proxy.
|
| SimpleHttpInvokerRequestExecutor |
HttpInvokerRequestExecutor implementation
that uses standard Java facilities to execute POST requests, without support for HTTP
authentication or advanced configuration options. |
| SimpleHttpInvokerServiceExporter | 已过时
as of Spring Framework 5.1, in favor of
HttpInvokerServiceExporter |
HTTP invoker is the recommended protocol for Java-to-Java remoting. It is more powerful and more extensible than Hessian, at the expense of being tied to Java. Nevertheless, it is as easy to set up as Hessian, which is its main advantage compared to RMI.


 And though it comes accompany'd with two disadvantages, the meanness of the Author, and of the Subject; yet in both I am incouraged by the greatness of your Mercy and your Knowledge.By the one I am taught , that you can forgive the most presumptuous Offendors: And by the other, that you will not esteem the least work of Nature, or Art, unworthy your Observation.
Amidst the many felicities that have accompani'd your Majesties happy Restauration and Government, it is none of the least considerable, that Philosophy and Experimental Learning have prosper'd under your Royal Patronage.
And as the calm prosperity of your Reign has given us the leisure to follow these Studies of quiet and retirement, so it is just, that the Fruits of them should, by way of acknowledgement, be return'd to your Majesty. There are, Sir, several other of your Subjects, of your Royal Society, now busie about Nobler matters: The Improvement of Manufactures and Agriculture, the Increase of Commerce, the Advantage of Navigation: In all which they are assisted by your Majesties Incouragement and Example.
Amidst all those greater Designs, I here presume to bring in that which is more proportionable to the smalness of my Abilities, and to offer some of the least of all visible things, to that Mighty King, that has establisht an Empire over the best of all Invisible things of this World, the Minds o f Men.
Your Majesties most humble
and most obedient
Subject and Servant,
ROBERT HOOKE .


--- layout: book title: "The Enterprise Path to Service Mesh Architectures, 2nd Edition" date: 2020-10-23 21:15:05 +0000 image: /assets/images/books/The-Enterprise-path-to-service-mesh-Architectures-2nd-Edition.png cover: /assets/images/books/The-Enterprise-path-to-service-mesh-Architectures-2nd-Edition-small.jpg #author: Lee Calcote status: published brief: "Planning to build a microservice-driven cloud native application or looking to modernize existing application services?" description: "A must-read for anyone looking to understand service mesh deployments and get an explanation of service meshes in contrast to related technologies. Learn from the largest collection of service mesh projects and their maintainers in the world.Self-study service mesh workshops and tutorials for Istio, Envoy, Linkerd, Consul, App Mesh, Octarine, Kuma, VMware Tanzu Service Mesh" redirect_from: /books/the-enterprise-path-to-service-mesh-architectures-2nd-edition ---
Planning to build a microservice-driven cloud native application or looking to modernize existing application services? Consider using a service mesh. A service mesh approach can help you create robust and scalable applications, but it also introduces new challenges. This updated report answers common questions regarding service mesh architectures through the lens of a large enterprise.
Author Lee Calcote, founder and CEO of Layer5, shows developers, operators, architects, and IT leaders how to evaluate your organization’s readiness for using a service mesh—and provides a clear path to help you adopt one. You’ll evaluate several factors when deciding which applications should be built from the ground up and which can be converted with a new service mesh architecture. This updated edition discusses several service meshes available and the tools you need to implement them. You’ll explore:
Author: Lee Calcote
Publisher: O'Reilly, Publish Date: November 2020


Our prices are clear and simple. No hidden fees or cost.
Steve Mac Queen, client, New York City
Copyright © 2014 Pixit


Prism is a lightweight, robust, elegant syntax highlighting library. It’s a spin-off project from Dabblet.
You can learn more on http://prismjs.com/.
Why another syntax highlighter?: http://lea.verou.me/2012/07/introducing-prism-an-awesome-new-syntax-highlighter/#more-1841
Contribute to Prism!
Prism depends on community contributions to expand and cover a wider array of use cases. If you like it, considering giving back by sending a pull request. Here are a few tips:
- Read the documentation. Prism was designed to be extensible.
- Do not edit
prism.js
, it’s just the version of Prism used by the Prism website and is built automatically. Limit your changes to the unminified files in the components/ folder. The minified files are also generated automatically.
- The build system uses gulp to minify the files and build
prism.js
. Having gulp installed, you just need to run the command gulp
.
- Please follow the code conventions used in the files already. For example, I use tabs for indentation and spaces for alignment. Opening braces are on the same line, closing braces on their own line regardless of construct. There is a space before the opening brace. etc etc.
- Please try to err towards more smaller PRs rather than few huge PRs. If a PR includes changes I want to merge and changes I don’t, handling it becomes difficult.
- My time is very limited these days, so it might take a long time to review longer PRs (short ones are usually merged very quickly), especially those modifying the Prism Core. This doesn’t mean your PR is rejected.
- If you contribute a new language definition, you will be responsible for handling bug reports about that language definition.
- If you add a new language definition, theme or plugin, you need to add it to
components.js
as well, so that it becomes available to the download build page.
Thank you so much for contributing!!


A Whirlwind of CSS
Understanding the In's and Out's of CSS
June 21, 2015
When it comes to understanding CSS, there are a lot of concepts to understand. On the one hand, I had a general idea of the concepts, but on the other hand, I found it difficult to know when to use them. Margin, padding, and borders are terms that are often used together. What exactly do they mean, and how when should we use them?
The easiest concept to understand, of the three I mentioned earlier, is border. Border simply takes the element in question and adds a line around it. Have you ever added a picture to a document in Microsoft Word? If you have, you will notice that one of the options to modify the picture is border. You can add a solid line, a dotted line, or increase the weight of the line. Essentially, CSS allows you to do the same with border.
It took me some time to know when I could take advantage of padding. I like to think of a basketball court when trying to understand padding. Padding takes an element and moves it to the innermost layer. Instead of standing at the 3-point line, padding allows you to move to the free throw line.
Last, but not least, margin adds spacing to the outside of the element. To simplify the terms, let me refer back to the basketball illustration. If padding is the free throw line, then margin is the 3-point line. If you add more to margin, you can move all the way to the half court line.
I know it can be confusing, but with practice and playing around with the properties, it can make sense!