Adds .stripMargin([marginChar]) to a string. The Margin char is taken from the following settings: File | Settings | Editor | Code Style | Scala | Multi-line Strings.
.stripMargin([marginChar])
File | Settings | Editor | Code Style | Scala | Multi-line Strings


1 x 1.000.000
1 x 2.000.000
IDR 1.000.000
IDR 2.000.000
IDR 3.000.000
IDR 100.000
Tower 49 Capital, c/o University at Albany Downtown Campus, 207 Sheridan Ave, Albany, NY 12210 USA
June 24 12:30PM Delivered by DHL. * Estimated arrival date.
1 USD = 14000 IDR
For security and fraud prevention reasons, we require three block confirmations on the ETH blockchain before your payment is marked as complete.
We are here to support you. Call or email us.
Everydayfrom 9.00 - 18.00
+62 21 567898765info@tilde.id


Places You've Been
Add a place:
Place name
Place location
Date visited
Currency
Add
Place's You've Been:
Place:
Location:
Date visited:
Currency:


Glass screen protector for my Nintendo Switch
by Jason WeisbergerI use these screen protectors on my Nintendo Switch.
The Nintendo Switch gets handed from child to child. The Switch gets banged, bumped, dropped and treated like something a 5-year-old is struggling wrest from a 10-year-old. Screen protectors come and go, but thus far the Switch has been undamaged.
Three packs are nice.


Michael Beyeler / @mbeyelerCH
Postdoctoral Fellow
eScience Institute
Institute for Neuroengineering (UWIN)
1 |
Introduction |
2 |
The scikit-image toolkit How are images represented in scientific computing? |
3 |
Feature detection How can we detect useful features from an image? |
4 |
Image segmentation How can we segment an MRI image into different sections? |
An interdisciplinary field that deals with gaining high-level understanding from digital images or videos.
Computer vision tasks include methods for acquiring, processing, and analyzing digital images.
For our purposes: multi-dimensional homogeneous data in which spatial relationships matter
- spatial contiguity is meaningful
- usually 3D images or 2D projections
Color deconvolution for immunohistochemical staining
Find the coordinate transform between two independent images
Reconstruct 3D white matter tracts from diffusion tensor imaging (DTI)
Deep learning based segmentation of edema for optical coherence tomography (OCT) images of the retina
github.com/uw-biomedical-ml/irf-segmenterscikit-image is a collection of Python algorithms for image processing, developed by the SciPy community.
Installation via conda:
$ conda install scikit-image
More info at http://scikit-image.org.
The main package of skimage
only provides some utility functions - everything else is in submodules:
| Submodule | Description |
|---|---|
data |
test images and example data |
io |
reading, saving, displaying images and videos |
color |
color space conversion |
filters |
sharpening, edge finding, rank filters, thresholding |
| Submodule | Description |
|---|---|
measure |
measuring image properties (e.g., similarity, contours) |
feature |
feature detection and extraction |
restoration |
restoration algorithms (e.g., deconvolution denoising) |
segmentation |
partitioning an image into multiple regions |
Pixels are array elements:
import numpy as np
image = np.ones((5, 5))
image[0, 0] = 0
image[2, :] = 0
Values 0 - 255: 0 is black, 255 is white (uint8
) float64
)
from skimage import io
img_rgb = io.imread(path_to_rgb_file)
img_gray = io.imread(path_to_rgb_file, as_grey=True)
img = np.random.rand((500, 500))
io.imsave("noise.jpg", img)
Note: Since scikit-image operates on NumPy array, any image reader library that provides arrays will do (e.g., imageio, matplotlib, pillow).
It's easy to draw on images, too.
skimage.draw.line |
Generate line pixel coordinates |
skimage.draw.circle |
Generate coordinates of pixels within a circle |
skimage.draw.polygon |
Generate coordinates of pixels within a polygon |
skimage.draw.random_shapes |
Generate an image with random shapes, labeled with bounding boxes |
/tutorials/1-skimage_intro.ipynb
$ git clone https://github.com/mbeyeler/2018-neurohack-skimage.git
(adapted from /skimage-tutorials/lectures/00_images_are_arrays.ipynb)
One of the most basic and common image operations - used to remove noise or enhance features.
skimage.filters.gaussian |
Multi-dimensional Gaussian filter |
skimage.filters.sobel |
Find the edge magnitude using the Sobel transform |
skimage.filters.median |
Return local median of an image |
skimage.filters.gabor |
Returns real and imaginary responses to Gabor filter |
from skimage import data, filters
img = data.camera()
img_blurred = filters.gaussian_filter(img, sigma=5)
from skimage import data, filters
img = data.camera()
img_edges = filters.sobel(img)
from skimage import io, filters, morphology
img = io.imread("teddy.jpg")
img_blurred = filters.median_filter(img
selem=morphology.disk(3)
)
(can also be used to generate a fun cartoon effect)
Methods for computing abstractions of image information
| Edges | points where there is a boundary between two image regions |
| Corners | point-like features with 2D structure |
| Blobs | regions of interest |
used to detect lines, circles or other parametric curves
The locus of (a, b) points in parameter space fall on a circle with radius R centered at (x, y). The true center point will be common to all parameter circles, and can be found with a Hough accumulation array.sum up intensities in small rectangles, calculate the difference between the sums
skimage.feature.corner_harris |
Harris corner measure |
skimage.feature.hog |
Histogram of oriented gradients (HOG) |
skimage.feature.ORB |
Oriented FAST and rotated BRIEF feature detector |
/tutorials/2-skimage_feature_detection.ipynb
(adapted from skimage-tutorials/lectures/2_feature_detection.ipynb)Supervised: some prior knowledge is used to guide the algorithm.
Unsupervised: no prior knowledge given.
Thresholding is used to create a binary image from a grayscale image.
Otsu's method calculates an "optimal" threshold that maximizes the variance between two classes of pixels.
Anisotropic diffusion with tracers initiated at the markers' position
Local diffusivity coefficient is greater if neighboring pixels have similar values, so that diffusion is difficult across high gradients Markers label different phases, like below (too noisy for thresholding).Starting from user-defined markers, watershed treats pixel values as a local topography, then floods basins from the markers.
Markers are often chosen as local minima of the image, from which basins are flooded.A spatially localized version of k-means clustering.
Pixels are represented in 5D (x, y, L, a, b) using the CIELAB color space. k-means: Given a set of k cluster centers, assign each pixel to the nearest one. Update the new cluster centers to be the means of the pixel centroids in the cluster. Repeat until convergence. skimage.segmentation.quickshift |
Similar to SLIC: hierarchical segmentation in 5D space |
skimage.segmentation.chan_vese |
Designed to segment objects without clearly defined boundaries |
skimage.segmentation.felzenszwalb |
Spanning tree based clustering |
skimage.future.graph |
Region adjacency graph (RAG) based graph cuts |
/tutorials/3-skimage_segmentation.ipynb
(adapted from skimage-tutorials/lectures/4_segmentation.ipynb)


What's in it for you?
-
An interesting demoable debugging story
-
Surprising results in profiling and tracing
-
grequests + gevent internals
- Demo code, slides
-
How many monkeys fit in a Clint Eastwood movie title?
Use case
-
Python program - thousands of HTTPS GETs
-
Ran slow on Python 2.7
-
Ran fast on Python 3.7
Use case
-
Reporting tool: thousands of HTTP GETs
-
Ran on AWS EC2
-
Once per day
-
20-25 mins
-
requests module - 1 URL at a time
Migrate from
-
AWS EC2 to AWS Lambda
-
HTTP to HTTPS
-
Python2.7 to Python3.7
Problem
-
AWS Lambda 15 mins max runtime
-
Existing code took 20-25 mins to run
Solution
-
Convert serial GETs to concurrent
-
requests -> grequests (gevent + requests)
-
requests - blocking socket
-
requests =
send,
block,
recv,
send,
block,
recv
-
grequests - non-blocking socket
-
grequests =
send,
send,
block,
recv,
recv
Stage-0 - Trigger
-
requests demo
-
Python 2.7 / Python 3.7 - slow
-
grequests demo
-
Python 2.7 - slow,
Python 3.7 - fast
-
Why is grequests + Python 2.7 + HTTPS slow?
grequests + HTTPS
| Sr. No. |
n |
requests |
| 1. |
3 |
3.30 |
| 2. |
5 |
5.50 |
| 3. |
10 |
11 |
Visualize - Python3.7 grequests flow
Python 2.7 + HTTPS
| Sr. No. |
n |
requests |
Python3.7 grequests |
| 1. |
3 |
3.30 |
1.20 |
| 2. |
5 |
5.50 |
1.30 |
| 3. |
10 |
11 |
1.55 |
Visualize - Python2.7 grequests flow
grequests + HTTPS
| Sr. No. |
n |
requests |
Python2.7 grequests |
Python3.7 grequests |
| 1. |
3 |
3.30 |
3.30 |
1.20 |
| 2. |
5 |
5.50 |
5.50 |
1.30 |
| 3. |
10 |
11 |
11 |
1.55 |
What's going on?
-
requests
-
send,
block,
recv,
send,
block,
recv
-
Python3.7 grequests
-
send,
send,
block,
recv,
recv
-
Python2.7 grequests
-
open,
open,
send,
block,
recv,
send,
block,
recv
Observations
-
Same code - Variable speed
-
Depends on runtime environment
-
Isolate using docker
Local setup
-
Stage-0 - laptop
-
Stage-1 - docker
-
Minimal set of modules
-
Each container represents a stage in our problem
-
Container used in place of virtualenv - easy to demo
grequests https status
| Stage |
Setup |
Python2.7 |
Python3.7 |
| 0 |
laptop |
slow |
fast |
| 1 |
minimal |
??? |
??? |
Stage-1 - setup
-
Modules: grequests, requests, urllib3, gevent
-
Python2.7 container: test_grequests_python27_1
-
Python3.7 container: test_grequests_python37_1
Stage-1 - observations
-
HTTPS demo
-
Python2.7 fast
-
Python3.7 fast
-
Stage-0 Python2.7 was slow
Verify pyopenssl involvement
-
| Demo |
-
Laptop Python2.7 had pyopenssl
-
Laptop Python3.7 did not have pyopenssl
grequests https status
| Stage |
Setup |
Python2.7 |
Python3.7 |
| 0 |
laptop |
slow |
fast |
| 1 |
minimal |
fast |
fast |
| 2 |
Stage-1 + pyopenssl |
??? |
??? |
Stage-2 - setup
-
Modules: grequests, requests, urllib3, gevent, pyopenssl
-
Stage-1 +
pyopenssl
-
Python2.7 container: test_grequests_python27_2
-
Python3.7 container: test_grequests_python37_2
Stage-2 - observations
-
HTTPS Demo
-
Python2.7 slow
-
Python3.7 slow
-
Stage-1 Python2.7/Python3.7 were fast
-
Reason: pyopenssl monkey patching SSLSocket
grequests https status
| Stage |
Setup |
Python2.7 |
Python3.7 |
| 0 |
laptop |
slow |
fast |
| 1 |
minimal |
fast |
fast |
| 2 |
Stage-1 + pyopenssl |
slow |
slow |
gevent monkey patching
-
gevent + monkey-patching = non-blocking socket
Without monkey patching
$ python
import inspect
import socket
print(socket.socket)
<class 'socket._socketobject'>
inspect.getsourcefile(socket.ssl)
<EMAIL_ADDRESS>exit()
With monkey patching
$ python
from gevent import monkey
monkey.patch_all()
import inspect
import socket
print(socket.socket)
<class 'gevent._socket2.socket'>
inspect.getsourcefile(socket.ssl)
'/usr/local/lib/python2.7/site-packages/gevent/_socket2.py'
exit()
Without monkey patching - blocking socket blocks
$ cd monkey_patching_demo
$ cat blocking_socket.py
def socket():
print("I will block")
$ python
import blocking_socket
blocking_socket.socket()
I will block
exit()
Without monkey patching - non-blocking socket doesn't
$ cd monkey_patching_demo
$ cat non_blocking_socket.py
def socket():
print("I will not block")
$ python
import non_blocking_socket
non_blocking_socket.socket()
I will not block
exit()
With monkey patching - blocking socket replaced
$ python
import patcher
patcher.patch_all()
import blocking_socket
blocking_socket.socket()
I will not block
exit()
That which monkey patches
$ cat patcher.py
def patch_all():
import blocking_socket
import non_blocking_socket
blocking_socket.socket = non_blocking_socket.socket
How is pyopenssl making the code slow?
Double monkey patching code flow
Solution
-
Uninstall pyopenssl if you don't need it OR
-
Check pyopenssl alernatives e.g.
cryptography
OR
-
Use gevent-openssl
-
gevent-openssl = pyopenssl compatible with gevent
gevent-openssl patching flow
grequests https status
| Stage |
Setup |
Python2.7 |
Python3.7 |
| 0 |
laptop |
slow |
fast |
| 1 |
minimal |
fast |
fast |
| 2 |
Stage-1 + pyopenssl |
slow |
slow |
| 3 |
Stage-2 + gevent-openssl |
??? |
??? |
Stage-3 - setup
-
Modules: grequests, requests, urllib3, gevent, pyopenssl, gevent-openssl
-
Stage-2 + gevent-openssl
-
Python2.7 container: test_grequests_python27_3
-
Python3.7 container: test_grequests_python37_3
Stage-3 - observations
-
HTTPS Demo
-
Python 2.7 fast
-
Python 3.7 slow!!
-
Stage-1 Python 3.7 was fast
grequests https status
| Stage |
Setup |
Python2.7 |
Python3.7 |
| 0 |
laptop |
slow |
fast |
| 1 |
minimal |
fast |
fast |
| 2 |
Stage-1 + pyopenssl |
slow |
slow |
| 3 |
Stage-2 + gevent-openssl |
fast |
slow |
gevent-openssl making Python3.7 HTTPS slow?
Partial monkey patching details
grequests https status
| Stage |
Setup |
Python2.7 |
Python3.7 |
| 0 |
laptop |
slow |
fast |
| 1 |
minimal |
fast |
fast |
| 2 |
Stage-1 + pyopenssl |
slow |
slow |
| 3 |
Stage-2 + gevent-openssl |
fast |
slow |
| 4 |
Stage-3 + patch |
??? |
??? |
Stage-4 - setup
-
Modules: grequests, requests, urllib3, gevent, pyopenssl, gevent-openssl
-
Stage-3 + patch
-
Python2.7 container: test_grequests_python27_4
-
Python3.7 container: test_grequests_python37_4
grequests https status
| Stage |
Setup |
Python2.7 |
Python3.7 |
| 0 |
laptop |
slow |
fast |
| 1 |
minimal |
fast |
fast |
| 2 |
Stage-1 + pyopenssl |
slow |
slow |
| 3 |
Stage-2 + gevent-openssl |
fast |
slow |
| 4 |
Stage-3 + patch |
fast |
fast |
Takeaways
-
One migration at a time - Python3.7, HTTPS, Lambda
-
Monkey patching order matters
The answer
-
Q: How many monkeys fit in a Clint Eastwood movie title?
-
A: 5.x
Why pyopenssl?
- requests optionally includes pyopenssl
for
SNI
support
-
stdlib ssl did not provide SNI in Python 2.7.8 and older
-
pyopenssl provides SNI support
-
stdlib in Python 2.7.9+ - ssl.HAS_SNI flag is True
-
pyopenssl other use cases -
generate root certs
,
reading SSL cert
grequests =~ gevent + requests?
- No
- grequests monkey.patch_all skips select
- gevent.monkey.patch_all() patches all stdlib
- pyopenssl calls urllib3 wait - which calls select
- Unpatched select is blocking


---
layout: post
title: Gone for sailing yesterday
subtitle: 昨日冲浪
date: '2016-01-29T15:21:00.000+08:00'
author: DotIN13
tags:
- G+ Impression
- Life
- Boracay
modified_time: '2019-07-24T09:31:48.843+08:00'
blogger_id: tag:blogger.com,1999:blog-7275524089009887162.post-4951863394523724265
blogger_orig_url: https://dotin13laf.blogspot.com/2016/01/gone-for-sailing-yesterday.html
---
Gone for sailing yesterday, chat with the sailor on the boat about the Holy Cross on Boracay,
I got to know that Christians are pretty common on this island. He asked me whether i was one, when I told him that
I believe that there is a God but I was no Christian. He seems to be very impressed and he promised to come to
Shanghai later on. It's soul bound I guess. I was touched from deep heart.


Oh, hi! I see you trying to find some tools for the TBGs.
Click on this button for a list of functions.


?
1
1
1
??????
B
kVIffi
LEW
YoRÁ
BOTANICAL
GARDEN
New
York
Botanical
Garden
G%¡ªa
exaUatÔ*m
(L.)
Salisb.
Det.-rev.M.Thiv(B)200i
PLANTS
OF
BAHAMA
ISLANDS
Eustoma
exaltatum
(L.)
Griseb.
Crooked
Island:
edge
of
mangrove
swamp
near
coast
east
of
Cabbage
Hill.
Flowers
blue.
June
8,
1977
D.
S.
Correll
¤
G.R.
Proctor
48854
Herbarium
FAIRCHILD
TROPICAL
GARDEN
1624571
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


--- layout: post title: "Compile-Time Lifetime Matching" description: "When using hand-coded object composition, the compiler can help you match service lifetimes." date: 2014-06-03 10:06 UTC tags: [Dependency Injection] --- {% include JB/setup %}
{{ page.description }}
In my previous post, you learned how easy it is to accidentally misconfigure a DI Container to produce Captive Dependencies, which are dependencies that are being kept around after they should have been released. This can lead to subtle or catastrophic bugs.
This problem is associated with DI Containers, because Container registration APIs let you register services out of order, and with any particular lifestyle you'd like:
var builder = new ContainerBuilder(); builder.RegisterType<ProductService>().SingleInstance(); builder.RegisterType<CommerceContext>().InstancePerDependency(); builder.RegisterType<SqlProductRepository>().As<IProductRepository>() .InstancePerDependency(); var container = builder.Build();
In this Autofac example, CommerceContext is registered before SqlProductRepository, even though SqlProductRepository is a 'higher-level' service, but ProductService is registered first, and it's even 'higher-level' than SqlProductRepository. A DI Container doesn't care; it'll figure it out.
The compiler doesn't care if the various lifetime configurations make sense. As you learned in my previous article, this particular configuration combination doesn't make sense, but the compiler can't help you.
The overall message in my Poka-yoke Design article series is that you can often design your types in such a way that they are less forgiving of programming mistakes; this enables the compiler to give you feedback faster than you could otherwise have gotten feedback.
If, instead of using a DI Container, you'd simply hand-code the required object composition (also called Poor Man's DI in my book, but now called Pure DI), the compiler will make it much harder for you to mismatch object lifetimes. Not impossible, but more difficult.
As an example, consider a web-based Composition Root. Here, the particular IHttpControllerActivator interface belongs to ASP.NET Web API, but it could be any Composition Root:
public class SomeCompositionRoot : IHttpControllerActivator { // Singleton-scoped services are declared here... private readonly SomeThreadSafeService singleton; public SomeCompositionRoot() { // ... and (Singleton-scoped services) are initialised here. this.singleton = new SomeThreadSafeService(); } public IHttpController Create( HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) { // Per-Request-scoped services are declared and initialized here var perRequestService = new SomeThreadUnsafeService(); if(controllerType == typeof(FooController)) { // Transient services are created and directly injected into // FooController here: return new FooController( new SomeServiceThatMustBeTransient(), new SomeServiceThatMustBeTransient()); } if(controllerType == typeof(BarController)) { // Transient service is created and directly injected into // BarController here, but Per-Request-scoped services or // Singleton-scoped services can be used too. return new BarController( this.singleton, perRequestService, perRequestService, new SomeServiceThatMustBeTransient()); } throw new ArgumentException("Unexpected type!", "controllerType"); } }
Notice the following:
readonly
field is effectively going to be a Singleton.In the previous article, you saw how easy it is to misconfigure a ProductService, because you'd like it to be a Singleton. When you hand-code the composition, it becomes much easier to spot the mistake. You may start like this:
public class CommerceCompositionRoot : IHttpControllerActivator { private readonly ProductService productService; public CommerceCompositionRoot() { this.productService = new ProductService(); } public IHttpController Create( HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) { // Implementation follows here... } }
Fortunately, that doesn't even compile, because ProductService doesn't have a parameterless constructor. With a DI Container, you could define ProductService as a Singleton without a compilation error:
var container = new StandardKernel(); container.Bind<ProductService>().ToSelf().InSingletonScope();
If you attempt to do the same with hand-coded composition, it doesn't compile. This is an excellent example of Poka-Yoke Design: design your system in such a way that the compiler can give you as much feedback as possible.
Intellisense will tell you that ProductService has dependencies, so your next step may be this:
public CommerceCompositionRoot() { this.productService = new ProductService( new SqlProductRepository( new CommerceContext())); // Alarm bell! }
This will compile, but at this point, an alarm bell should go off. You know that you mustn't share CommerceContext across threads, but you're currently creating a single instance. Now it's much clearer that you're on your way to doing something wrong. In the end, you realise, simply by trial and error, that you can't make any part of the ProductService sub-graph a class field, because the leaf node (CommerceContext) isn't thread-safe.
Armed with that knowledge, the next step is to create the entire object graph in the Create method, because that's the only safe implementation left:
public IHttpController Create( HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) { if(controllerType == typeof(HomeController)) { return new HomeController( new ProductService( new SqlProductRepository( new CommerceContext()))); } // Handle other controller types here... throw new ArgumentException("Unexpected type!", "controllerType"); }
In this example, you create the object graph in a single statement, theoretically giving all services the Transient lifestyle. In practice, there's no difference between the Per Request and the Transient lifestyle as long as there's only a single instance of each service for each object graph.
Some time ago, I wrote an article on when to use a DI Container. In that article, I attempted to explain how going from Pure DI (hand-coded composition) to a DI Container meant loss of compile-time safety, but I may have made an insufficient job of providing enough examples of this effect. The Captive Dependency configuration error, and this article together, describe one such effect: with Pure DI, lifetime matching is compiler-assisted, but if you refactor to use a DI Container, you lose the compiler's help.
Since I wrote the article on when to use a DI Container, I've only strengthened my preference for Pure DI. Unless I'm writing a very complex code base that could benefit from Convention over Configuration, I don't use a DI Container, but since I explicitly architect my systems to be non-complex these days, I haven't used a DI Container in production code for more than 1½ years.
Comments
I don't think it's a problem with the container, but a problem with the registrations. I use a Autofac as my DI Container registration, and I always have a root application lifetime scope, and a separate scope for each request. If the product service is registered in the root scope as single instance, it will throw a
DependencyResolutionException
In this case, I would have the ProductService registered in the root scope as single instance, and the other types in the request scope.
If
ProductService
is resolved, aDependencyResolutionException
is thrown, and the app is unusable - "fail fast" is followed. To fix the issue, the registration needs to be moved to to the request scope.Here's an example of a safe MVC Controller Factory using Autofac.
Sorry for the lack of code formatting - I'm not sure what you use to format code
Steve, thank you for writing. Indeed, you can make a DI Container detect the Captive Dependency error at run-time. I pointed that out in the defining article about the Captive Dependency problem, and as qujck points out in the comments, Simple Injector has this feature, too.
The point with the present article is that, instead of waiting until run-time, you get a chance to learn about potential lifetime mismatches already at design-time. In C#, F#, and other compiled languages, you can't perform a run-time test until you've compiled. While I'm all for fail fast, I don't think it'd be failing fast enough, if you can catch the problem at compile time, but then deliberately wait until run-time.
Another concern is to go for the simplest thing that could possibly work. Why use a complex piece of code like your AutofacControllerFactory above, instead of just writing the code directly? It's no secret that I'm not a big fan of the Lifetime Scope idiom, and your code provides an excellent example of how complicated it is. You may have omitted this for the sake of the example, but that code isn't thread-safe; in order to make it thread-safe, you'd need to make it even more complicated.
You probably know how to make it thread-safe, as do I, so this isn't an attempt at pointing fingers. The point I'm attempting to make is that, by using a DI Container, you
- Add complexity
- Get slower feedback
There are costs associated with using a DI Container; what are the benefits?Thanks for the speedy response, Mark - I can't keep up. I think an issue I have with poor-man's DI is that I'm yet to see it in anything more than a trivial example. Indeed, the only time I have seen it used in a professional context is a 300 line file, 280 lines of which have the 'new' keyword in it, with plenty of repetition.
Do you know of any medium sized code bases around that use it to good effect? I'm thinking an application with at least 100 types, I'd like to see how the complexity of the graph is managed.
To answer your question, here's the advantages I see of using a container and lifetime scopes.
Clearer lifetimes: Your statement that the compiler is detecting the captive dependency isn't quite correct - it's still the developer doing that at design time. They have to see that
new CommerceContext()
is not a smart thing to do at application start, and move it accordingly. The compiler has nothing to do with that - either way, the check is happening at coding time. Whether that's while typingnew CommerceContext()
or when typingbuilder.Register<CommerceContext>()
, it's the same thing.I'd argue that the code that registers
CommerceContext
in an application scope is a much clearer alarm bell. After fixing the issue, you'll end up with the registration appearing in aRegisterRequestScopedStuff()
method, which is a much better way to tell future developers to be careful about this guy in the future.Simplicity: I would argue that the Autofac controller factory is simpler than the poor mans one. Using poor man style, you have a
switch
(or bunch ofif
statements) on the controller type, and need keep track of correct lifetimes in a deeply-nested object graph. I think a (thread safe) dictionary and disposal is significantly simpler that those things - at the very least, has fewer branches - and provides great access points to define expected lifetimes of objects. It probably seems more complicated because there's only a few types, mine has no syntax highlighting (very important for readability!) and I've documented which bits are app-wide and which are request-wide lifetimes, via method names and registration types.Speed of development: I find the overall development speed is faster using a container, as you don't have to micromanage the dependencies. While you do get slower feedback times on dependency failures, you have far fewer failures overall. It's been several months since I've seen a
DependencyResolutionException
. On the flip side, the javascript development I've done (which doesn't use a container) often has a missing a dependency or 2 - which would be equivalent to a compile error in a strongly typed language.What's more, I can write my classes and tests without having to worry about composition until it's time to run the application. To be fair, this is also achieved with good domain/application separation - since the app failing to compile does not prevent the tests from running - but I still like to write tests for my application project.
Disposables: As you mentioned, my simple example was not thread safe, due to having to store the lifetime scope for disposal when the controller is released. The only reason I need to store that is so Autofac can clean up any IDisposable dependencies I may have, and trivially at that - how do you do this with poor man's DI, while keeping it simple?
If I can wire up Autofac in my application in 10 minutes, have the computer do all the heavy lifting, while making it clearer to myself and future people what I want the lifetimes of things to be, why would I want to manage a dependency graph myself?
Before we continue this discussion, I think it's important to establish how you use a DI Container. If you refer to my article on the benefits of using a DI Container, which approach are you using?
I'd say I sit somewhere between convention and explicit register, but I guess I disagree about the "pointless" value for it, and place less importance on the value of strong/weak typing. As I said, I very rarely have the dependency exceptions be thrown anyway. In practice, I have a class of services that are wired up by convention (type name ends in "Factory" or "Controller", for example), and explicitly register others. No hard and fast rules about it.
That makes the discussion a little less clear-cut, because you are getting some of the benefits out of Convention over Configuration, but perhaps not as much as you could... Depending on how you put the balance between these two, I would agree with you that using a DI Container is beneficial.
My point isn't that there are no benefits from using a DI Container, but that there are also serious disadvantages. The benefits should outweigh the disadvantages, and that is, in my experience, far from given that they do. YMMV.
Do I know of any medium-sized code bases that use Pure DI to good effect? Perhaps... I don't know what a 'medium-sized' code base is to you. In any case, while I may know of such code bases, I know of none where the source code is public.
300-odd lines of code for composition sounds like a lot, but as I have previously demonstrated, using Explicit Register will only increase the line count.
Another criticism of manual composition is that every time you change something, you'll need to edit the composition code. That's true, but this is equally as true for Explicit Register. The difference is that with manual composition, you learn about this at compile-time, while with Explicit Register, you don't learn about changes until run-time. This, in isolation, is a clear win for manual composition.
Now, if you move to Convention over Configuration, this particular criticism of using a DI Container disappears again, but I never claimed anything else.


Welcome to Foothill Bee Ranch
Foothill Bee Ranch raises mason bees, Osmia lignaria and Osmia ribifloris, sustainably for pollination of crops in California. Our bees are sourced from populations native to the Sierra foothills for use in California.
Foothill Bee Ranch raises mason bees, Osmia lignaria and Osmia ribifloris, sustainably for pollination of crops in California. Our bees are sourced from populations native to the Sierra foothills for use in California.


% layout('getx_layout_en.html') -%>
1. Purpose The Accident Injury Mutual Aid Program (hereinafter referred to as "the Program") is launched by the insChain Mutual Aid Platform (website: https://www.inschain.io) based on the principle of mutual benefit. When a member unfortunately comes across an accidental death (as defined in Article 12.2), other members are obliged to offer help. 2. Content 2.1 In case of an accidental death mutual aid eventof a member during the period from the expiration of 90 days (hereinafter referred to as “Waiting Period”) starting the following day after his/her participation in the Mutual Aid Program and his/her qualification as a mutual aid member to the age of 61 full years old (as defined in Article 12.1) (hereinafter referred to as “mutual aid events”), other mutual aid members under this Program shall initiate mutual aid. 2.2 Mutual aid members shall be obliged to provide mutual aid in mutual aid events in an equally distributed manner and in the amount not more than 10GETX per person each time. 2.3 The mutual aid amount for the accidental death of a mutual aid member = number of valid participants in the Mutual Aid Program launched that day × 10GETX, with the upper limit not more than 100,000 GETX. 2.4 If the mutual aid members decease during an civil aviation flight accident, the amount of mutual aid will not exceed 1 million GETX per person each time. 3. ParticipationConditions A mutual aid membershall meet a combination of thefollowing conditions in order to participate in the Accident InjuryMutual Aid Program: 3.1 He/she is aged between 16 and 60 full years old (including 60); 3.2 He/she is non-disabled and is no high-risk operation personnel (as defined in Article 12.3); 3.3 He/she acknowledges and undertakes to abide by the insChain Mutual Aid Member Covenant, Accident InjuryMutual Aid Health Notice and this Regulation; 3.4 He/she makes deposit to the personal account opened at theinsChain Mutual Aid Platform. 4. Mutual Aid Membership Surviving Conditions Membership Surviving Conditions 4.1 In case of the death of a mutual aid member, he/she is deemed to withdraw from this Mutual Aid Program automatically. 4.2Mutual aid members should continue to rechargeto maintain mutual membership. The platform will give early warning to members through the form of mail when the balance of the account is insufficient. 4.3 The rights and interests of mutual aid for accidental death shall cease to be in force automatically upon the first day of the following month after the mutual aid member reaches 61 full years old. 4.4 insChain Mutual Aid Platform will deduct the management and administration fees every day. Where a member fails to pay in time, he/she will be disqualified from obtaining the mutual aid and denied of the right to apply for and the obligation of mutual aid, and will receive no mutual aid formutual aid events occur during the period. Even if the member is in the middle of the application for mutual aid fund, he/she will be deemed to waive the application on his/her own initiative. The membership shall be subject to the following situations after suspension. (1) The qualification for mutual aid shall be restored at zero o’clock of the following day after the settlement of the arrears within 30 days. (2) Where the member fails to settle the arrears within 30 days, he/she will be deemed to withdraw voluntarily. Where the member intends to participate in the Program, corresponding conditions of participation shall be satisfied. 4.5Where the member fails to pay in full the equally distributed amount for the latest event, he/she will be deemed to withdraw automatically, thus disqualified as a member and denied of the obligation of equal distribution as well as the rights and interests of mutual aid during suspension. Even if the member is in the middle of the application for mutual aid fund, he/she will be deemed to waive the application on his/her own initiative. The membership shall be subject to the following situations after suspension. (1) The qualification of mutual aid shall be restored at zero o’clock of the following day after the settlement of the arrears within 30 days. (2) Where the member fails to settle the arrears within 30 days, he/she will be deemed to withdraw voluntarily. Where the member intends to participate in the Program, corresponding conditions of participation shall be satisfied. 4.6 Other circumstances specified in insChain Mutual Aid Member Covenant and this Regulation. 4.7 As the Platform officially processes the application for mutual aid, the membership will be frozen. After due investigation, the Platform will complete the procedures for the member’s withdrawal from this Program. 5. Management and Administration Fee 5.1 For members who join the program for the first time, the management and administrative fees during the Waiting Period are remitted. After the Waiting Period, the charge is 0.01GETX/person/day. 5.2 Where the member withdraw from the program, the management and administration fees he/she has paid will not be refunded regardless of reasons for the withdrawal. 6. Mutual Aid Application Procedures The procedures of application for mutual aid shall be activated as follows in the event of an accidental death of a mutual aid member. 6.1 A mutual aid applicant (referring to a legal heir and guardian of the mutual aid member, the same hereinafter) shall notify insChain Mutual Aid Platform and submit the application form for mutual aid via customer service personnel within 15 days of the accidental death of the mutual aid member. 6.2 The mutual aid applicant shall submit various supporting documentations for the mutual aid event in accordance with the requirement of insChain Mutual Aid Platform and within 7 days upon the receipt of application by insChain Mutual Aid Platform. 6.3 insChain Mutual Aid Platform will entrust independent third party evaluation institutions or professional personnel to conduct evaluation and identification of the mutual aid event after gathering the supporting documentations thereof, with a view to the establishment of a conclusion of the investigation. Any controversial or doubtful event shall be under the review of the experts from insChain Mutual Aid Platform. 6.4 In terms of a clearly defined mutual aid event, it shall be reviewed within 60 working days after the filing of materials by the mutual aid applicant. In terms of a particularly complex event, it shall be reviewed within 120 working days. 6.5 Where the mutual aid event conforms to the rules of this Program upon review, insChain Mutual Aid Platform will publicize the event on a regular monthly basis for a period of 7 days, during which queries from other mutual aid members will be accepted; Where the mutual aid event does not conform to the rules of this Program upon review, insChain Mutual Aid Platform will notify the mutual aid applicant. 6.6 insChain Mutual Aid Platform will calculate the equally distributed amount for each mutual aid member the following day after the expiration of the publicity period of the mutual aid event and allocate the mutual aid fund from the personal account of each mutual aid member on the Platform. 6.7 insChain will make a lump-sum payment of the mutual aid fund to the mutual aid applicant within 3 working days after the collection thereof. 6.8 In the event of any evidence-based objection to the mutual aid event proposed by any mutual aid member during the publicity period, insChain Mutual Aid Platform will demand the mutual aid applicant to make explanations or submit supplementary materials in accordance with the objection and it will conduct another review of the mutual aid event. 7. Circumstances of Mutual Aid Denial Other mutual aid members are not obliged to provide mutual aid in the event of the accidental death of a mutual aid member arising from or in connection with any of the following circumstances thereof. 7.1 The mutual aid member has yet to obtain his/her membership or has been denied of the membership; 7.2 The mutual aid member in his/her participation in this Program, or the applicant during the investigation of the mutual aid event, provides false information (including false contact information) , intentionally conceals the facts or fails to fulfill the duty of disclosure; 7.3 The mutual aid applicantnotifies insChain Mutual Aid Platform after 15 days upon the occurrence of the accident; 7.4 The legal heirs intentionally kill or intentionally hurt the mutual aid member; 7.5 The mutual aid member intentionally commits a crime or resists lawful criminal coercive measures; 7.6 The mutual aid member takes or injects drugs (as defined in Article 12.4); 7.7 The mutual aid member dies suddenly; 7.8 The mutual aid member is infected with HIV or has AIDS (as defined in Article 12.5); 7.9 The mutual aid member dies accidentally from drug allergy, medical malpractice, mental and behavioral disorders (subject to the International Statistical Classification of Diseases and Related Health Problems (ICD-10)); 7.10 The mutual aid member dies accidentally from driving under the influence or driving without a valid driver’s license or driving vehicles without a valid driving permit (as defined in Article 12.6-12.8); 7.11 The mutual aid member dies accidentally during the engagement in high-risk operations; 7.12 The mutual aid member dies accidentally during the engagement in high-risk sports (as defined in Article 12.9) and the participation in professional or semi-professional sports; 7.13 A war, military conflict, riot or armed rebellion (as defined in Article 12.10 to Article 12.12) occurs; 7.14 A nuclear explosion, nuclear radiation or nuclear pollution occurs. 8. Necessary Documentations for Mutual AidApplication The necessary documentations for mutual aid application in the event of accidental death of a mutual aid member include: 8.1 Valid identity documents of the mutual aid member and the mutual aid applicant (as defined in Article 12.13) and supporting materials for the kinship between the two; 8.2 Proof of death of the mutual aid member issued by the government of the country or region where he/she was located. In the event of an overseas accidental death, it is necessary to provide the written supporting materials that contain the cause of death and that are issued by the embassies and consulates of the place where the accident happened; 8.3 If the mutual aid member has multiple legal heirs, it is necessary to entrust one of them to accept the mutual aid fund and provide a notarial certificate of trust; 8.4 Other certificates or documents that insChain Mutual Aid Platform considers necessary and related with the identification of the nature and cause of the accident; 8.5 Where the aforementioned certificates or documents are not complete or the nature and cause of the mutual aid event are to be further identified, insChain Mutual Aid Platform shall timely notify the mutual aid applicant to supplement relevant certificates and documents 8.6 The review of mutual aid shall prioritize the documents submitted by the applicant for the first time. Where there is any disagreement in the certificates or documents or any artificial modification of the submitted materials, the Platform has the right not to admit them into evidence and not to launch the mutual aid. 9. Information Disclosure In order to enunciate the principle of fairness, justness and transparency, insChain Mutual Aid Platform has formalized the provisions in terms of information disclosure. 9.1 Timely Disclosure 9.1.1 insChain Mutual Aid Platform provides each mutual aid member with an independent personal account and ensures that the member can have access to the details of his/her own account at any time. 9.1.2 insChain Mutual Aid Platform establishes a personal virtue book to record the details of mutual aid fund and its total amount; the members can have access to each distribution of payment, including the subject and amount. 9.1.3 insChain Mutual Aid Platform will publicize the number of participants in the mutual aid events, the amount of the single fund-raising, the number of people who have received the mutual aid and the total amount of mutual aid in a timely manner. 9.1.4 Where a certain mutual aid event requires a special report, insChain Mutual Aid Platform will publicize the report in a timely mannerfor mutual aid members to review. 9.2 Regular Disclosure: 9.2.1insChain Mutual Aid Platform will publicize the mutual aid events of the current month that conform to the regulations of this Program on a regular monthly basis and welcome the queries and lawful investigations from other mutual aid members. In order to confirm the authenticity of the mutual aid event, the mutual aid member agrees that insChain Mutual Aid Platform may publicize the real identity information of the applicants, the process of the event and its details to other mutual aid members and disclose the relevant materials to the application for mutual aid. 9.2.2 insChain Mutual Aid Platform will publicize the list of mutual aid applicants of the current month and the mutual aid events challenged by mutual aid members (if any) on a monthly basis mutual aid members to review. 9.2.3 insChain Mutual Aid Platform will publicize its semi-annual work report and annual work report regularly. 10. Protection of Member’s Privacy 10.1 insChain Mutual Aid Platform will fulfill reasonable obligations to protect the private information of its members. 10.2 The mutual aid members have the obligation to protect the privacy of other members, especially the accidentally deceased mutual aid members, and are prohibited from disclosing the personal information of other mutual aid members. 11. Other Import Matters to be Noticed by Mutual Aid Members 11.1 If the mutual aid memberis involved in mutual aid fund fraud via material fabrication, insChain Mutual Aid Platform will unilaterally deprive them of their membership and prohibit their participation in the Platform throughout their lives; if insChain Mutual Aid Platform has already launched the mutual aid for them, it shall have the right to recover the mutual aid fund and refund other mutual aid members through lawful means. 11.2 Mutual aid is not equivalent to insurance. insChain Mutual Aid Platform does not make warranties with respect to the total amount of each mutual aid fund. 11.3 In the event of a large quantity of participants in this Program, insChain Mutual Aid Platform shall have the right to divide the mutual aid members under this Program into several mutual aid groups in accordance with management needs. 11.4 insChain Mutual Aid Platform shall have the right to modify the rules of this Program from time to time in accordance withfactual situations. Once the modification is made, the platform will fully replace the previous rules with the modified ones and notify all members in the same way as before. The modified rules shall take legal effect once publicized on insChain Mutual Aid Platform and the mutual aid events and all the relevant services shall be subject to the new rules after the modification. 11.5 If a member does not accept the modification to the regulations, he/she may terminate the use of service provided by insChain Mutual Aid Platform at any time, withdraw from the Program and apply for the refund of the balance in his/her account. The retention of membership of a mutual aid member shall be deemed as his/her acceptance of the modifications thereof and to be bound by corresponding terms and conditions. 11.6 During its engagement in Internet services, insChain Mutual Aid Platform may be affected by those unstable factors in each link. The services have the risks of services interruption and failure to satisfy the needs of the members due to force majeure, computer virus, hacker attack, systematic instability, location of members, failed communication with members and other reasons of techniques, network and telecommunication lines, for which the Platform makes no warranties and shall not be held responsible for members’ failure of sending, receiving and reading messages or errors in sending and receiving messages incurred thereby. 11.7 The members shall have the obligation to log in to check the information and may not hold the Platform accountable on the grounds of anyfailure to receive the notification from insChain Mutual Aid Platform. 11.8 In case of systematic failure of insChain Mutual Aid Platform that affects the normal functioning of services, insChain Mutual Aid Platform undertakes to cooperate with relevant departments at first time to address the problem and conduct repairing. However, insChain Mutual Aid Platform shall not be liable for any consequential losses caused thereby. In addition, insChain Mutual Aid Platform reserves its right to suspend any part of service without prior notification for the purpose of maintenance, servicing, upgrade or others. 11.9 insChain Mutual Aid Platform is a community platform, which shall not be held responsible for any disputes arising among members who participate in mutual aid outside mutual aid events. 11.10 When a member is involved in the blatant insults or defamation of others or the Platform with fabricated facts or other malicious attacks, insChain Mutual Aid Platform shall have the right not to provide services to such a member and the right to recover the damage done to the Platform against it. 11.11 insChain Fund and insChain Mutual Aid Platform reserve the right of interpretation of the regulations of this Program. 12. Definitions 12.1 Full Year(s) Old: refers to the age calculated on the basis of the birth date contained in the valid identity document. The age for the birth date is referred to as 0 full year old, and increases by one as a full year passes. Less than a year does not count. 12.2 Accidental Death: refers to the death caused by exterior, abrupt, unintended and non-disease objective body-hurting incidents (hereinafter referred to as “unexpected injuries”) within 180 days of the occurrence of the unexpected injuries. 12.3 High-Risk Operation Personnel include: (1) Operational personnel working at sea, on board, at heights, in forests, in mountainous areas, in highlands, underground, underwater, in tunnels or underpasses, and in the pit; (2)Operational personnel of the onshore mining industry; (3)Drivers and appliance crew of truck or liquefied or gasified oil tankers with carrying capacity of more than 4 tons; (4)Personnel involved in or exposed to any dangerous substance (including chemicals, explosives, toxics, etc.); (5)Personnel dealing with high voltage or hot-line work; (6)Military and police personnel on active service including ground forces, marine corps, navy soldiers, air force pilots, frontier soldiers, special forces, riot police, criminal police, armed police, and firemen; (7)Players or trainers of hockey, rugby, wrestling, judo, karate, taekwondo, martial arts, boxing, and kart racing; (8)Players and trainers of diving, jet skiing, ice skating, horse riding, stunt performance, bobsleighing, gliding, car and motorcycle racing, parachuting, and fencing; (9)Drivers or operators of tractors, motor tricycles, cranes, helicopters, bridge cranes, and motorcycles in working hours; (10)Workers of machinery factories, steel factories, shipbuilding and ship repairing services, and workers handling dredgers, boilers, asbestos tiles, and digging; (11) Machinery operators of the manufacturing industry; (12) Animal trainers; (13) Animal attendants; (14) Flight trainers; (15) Drivers or mechanical operators of construction vehicles; (16) Highway engineering personnel; (17) War correspondents; (18) Actors of martial arts, stunts, and acrobatics; (19) Filmstrip deliverers; (20) Lifeguards at seaside resorts; (21) Barmaids, dancing girls, and non-professional massagists; (22) Chimney sweeps or highway cleaners; (23) Professional bodyguards; (24) Research or management personnel of military weapon and ammunition; (25) Individual operators or vendors with no fixed pitch; (26) Personnel at construction sites (including but not limited to construction workers, site management staff, and temporary workers). 12.4 Drugs: refer to opium, heroin, methamphetamine (Ice) morphine, cannabis, cocaine and other addictive narcotic drugs and psychotropic drugs under the regulatory control that are specified in the laws and regulations by the government of the countries and regions where the mutual aid members are located, but is exclusive of the prescription drugs containing narcotic substances prescribed by doctors and used following the doctor’s advice. 12.5 AIDS related virus refers to human immunodeficiency virus or HIV in short. AIDS is short for Acquired Immune Deficiency Syndrome caused by human immunodeficiency virus. WhenanAIDS virus or a positive antibody is detected in human blood or other samples without any clinical symptom or sign, he/she is deemed as infected with HIV; Whena clinical symptom or sign exists at the same time, he/she is deemed as having AIDS. 12.6 Driving Under the Influence: refers to drink driving or drunk driving where the content of alcohol per hundred milliliters of blood reaches or exceeds certain level upon detection or identification in accordance with the laws and regulations by the government of the countries and regions where the mutual aid members are located when the accident occurs. 12.7 Driving without a valid driver’s license refers to any of the following circumstances: (1) Driving without a driver’s license; (2) Driving a vehicle that is inconsistent with the permitted types in the driver’s license; (3) Driving with a driver’s license that is not approved in examinations and inspections; (4) Driving with the learner's license, yet not accompanied by the driving coach or not at such time or along such route as specified. 12.8 Driving without a valid driving permit refers to any of the following circumstances: (1) When the registration of the driving vehiclehas been lawfully canceled; (2) When the technical inspection of the vehicle safety has not conducted or passed lawfully and timely. 12.9 High-Risk Sports: refer to sports that are riskier than general and conventional sports, hence more liable to cause personal injuries, including but not limited to diving, water skiing, skiing, ice-skating, driving or riding gliders, gliding parachute, sky diving, rock climbing, expedition, martial competition, wrestling competition, judo, karate, taekwondo, horse riding, boxing, stunt performance, karting, horse racing, car racing, various vehicle performance and bungee jumping. 12.10 War: refers to the armed struggle between or among countries, nations and political groups for certain political and economic purposes, subject to the announcement of the government. 12.11 Military Conflict: refers to the armed confrontation between or among countries or nations within a certain range, subject to the announcement of the government. 12.12 Riot: refers to the armed disturbance that disrupts the public order, subject to the announcement of the government. 12.13 Valid Identity Document: refers to the document that is able to certify the identity of a mutual aid member as specified by the competent departments of the government in the countries and regions where the mutual aid member is located. 12.14 Other definitions not specified in this Regulation shall be subject to the provisions in insChain Mutual Aid Platform Member Covenant.


#include <ticpp.h>
Public Member Functions | |
| T * | begin (const Node *parent) const |
| For for loop comparisons. | |
| T * | end () const |
| For for loop comparisons. | |
| Iterator (const std::string &value="") | |
| Constructor. | |
| Iterator (T *node, const std::string &value="") | |
| Constructor. | |
| Iterator (const Iterator &it) | |
| Constructor. | |
| T * | Get () const |
| Gets internal pointer. | |
| Iterator & | operator= (const Iterator &it) |
| Sets internal pointer. | |
| Iterator & | operator= (T *p) |
| Sets internal pointer. | |
| Iterator & | operator++ () |
| Sets internal pointer to the Next Sibling, or Iterator::END, if there are no more siblings. | |
| Iterator | operator++ (int) |
| Sets internal pointer to the Next Sibling, or Iterator::END, if there are no more siblings. | |
| Iterator & | operator-- () |
| Sets internal pointer to the Previous Sibling, or Iterator::END, if there are no prior siblings. | |
| Iterator | operator-- (int) |
| Sets internal pointer to the Previous Sibling, or Iterator::END, if there are no prior siblings. | |
| bool | operator!= (const T *p) const |
| Compares internal pointer. | |
| bool | operator!= (const Iterator &it) const |
| Compares internal pointer. | |
| bool | operator== (T *p) const |
| Compares internal pointer*. | |
| bool | operator== (const Iterator &it) const |
| Compares internal pointer. | |
| T * | operator-> () const |
| So Iterator behaves like a STL iterator. | |
| T & | operator* () const |
| So Iterator behaves like a STL iterator. |
TinyXML++ introduces iterators:
ticpp::Iterator< ticpp::Node > child; for ( child = child.begin( parent ); child != child.end(); child++ )
Iterators have the added advantage of filtering by type:
// Only iterates through Comment nodes ticpp::Iterator< ticpp::Comment > child; for ( child = child.begin( parent ); child != child.end(); child++ )
// Only iterates through Element nodes with value "ElementValue" ticpp::Iterator< ticpp::Element > child( "ElementValue" ); for ( child = child.begin( parent ); child != child.end(); child++ )
Finally, Iterators also work with Attributes
ticpp::Iterator< ticpp::Attribute > attribute; for ( attribute = attribute.begin( element ); attribute != attribute.end(); attribute++ )
| ticpp::Iterator< T >::Iterator | ( | const std::string & | value = "" |
) | [inline] |
Constructor.
| value | If not empty, this iterator will only visit nodes with matching value. // Only iterates through Element nodes with value "ElementValue" ticpp::Iterator< ticpp::Element > child( "ElementValue" ); for ( child = child.begin( parent ); child != child.end(); child++ ) |
| T* ticpp::Iterator< T >::begin | ( | const Node * | parent | ) | const [inline] |
For for loop comparisons.
| parent | The parent of the nodes to iterate. |
ticpp::Iterator< ticpp::Node > child; for ( child = child.begin( parent ); child != child.end(); child++ )
References ticpp::Node::IterateFirst().
| T* ticpp::Iterator< T >::end | ( | ) | const [inline] |
For for loop comparisons.
ticpp::Iterator< ticpp::Node > child; for ( child = child.begin( parent ); child != child.end(); child++ )
| T* ticpp::Iterator< T >::Get | ( | ) | const [inline] |
Gets internal pointer.


Disclaimer: This is not an official Akamai product, please log all your issues using our feedback button on the right
Manage your API credentials and toggle between different kinds of API tokens based on the service you are trying to access
Looks like you have no API credentials configured, click here to configure one.
Manage and make purge requests using URL or URLs, CP codes or Cache Tags
Use the options below to flush DNS, proxy requests and enable Akamai debug headers
Piez displays optimizations made by Akamai Image Manager, Resource Optimizer, Push/Preconnect and Script Manager. Once you make a selection below, please proceed to open up Chrome Dev Tools and select "Akamai Dev Tools - Piez"
Manage your Akamai sandboxes and debug issues going through the sandbox
Looks like you have no sandboxes created, click here to create one.
Note: you will need to have aleast PAPI api tokens configured or devpops API tokens configured


Data Types and User-defined Types¶
The following sections describe in more detail how user-defined data types are used in behave. The type converter functionality, that is described here, is only supported by the:
“parse” matcher (based on: parse module)
“cfparse” matcher (based on: parse-type module)
Contents:
- Type Definition Basics
- Predefined Data Types in
parse
- Cardinality: Zero or One (Optional)
- Cardinality: One or More (List of Type)
- Cardinality: Zero or More (List of Type)
- Choice (Word/String Alternatives)
- Choice2 (Word/String Alternatives)
- Enumeration (String-to-Value Mapping)
- More Complex Data Types
Important
Part of the functionality, that is described here, is based on parse-type, an extension of the excellent parse module.
The parse module is the inverse of Python string.format function. The parse-type module extends it to simplify the generation of types (actually type converter functions for types).
parse features:
Optional
pattern
attribute (for regex) in user-defined type converters.The
with_pattern()
decorator for type-converters.
parse-type features:
Simplifies the creation of type converters for some common cases
Creates type converter variants based on cardinality
parse_type
extensions (TypeBuilder
functionality).Provides an extended parser with cardinality field support. A cardinality field is a type suffix in parse expression, like:
Cardinality
Example
Description
0..1
“{person:Person?}”
Zero or one: For optional parts.
0..*
“{persons:Person*}”
Zero or more: For list<T> (many0).
1..*
“{persons:Person+}”
One or more: For list<T> (many).


--- layout: post title: Paul Krugman's "How I work" date: 2011-01-10 13:21:18.000000000 -05:00 categories: - Commentary on works - Politics tags: [] status: publish type: post published: true meta: _edit_last: '7106425' author: login: samarthbhaskar email<EMAIL_ADDRESS>display_name: samarthbhaskar first_name: '' last_name: '' ---
I ran across this essay by Paul Krugman entitled "How I work" in which he chronicles his research philosophy and lays out a quick trajectory of how he got where he is today. It was a really interesting read. If for no other reason, it was interesting to see a public intellectual discuss his personal journey and outline his professional/academic methodology.
His rules of research include:
1. Listen to the Gentiles
2. Question the question
3. Dare to be silly
4. Simplify, simplify
The section on engagement with the policy-sphere was something I found particularly interesting. This is something I aspire to do. I aim to (successfully, I hope) toe that line between high level academic research and policy consulting. It was good to receive validation from someone who set out on that path early in his career and was able to make strong contributions in both arenas.
Here's the PDF link.


MBFieldKey
@objc
public enum MBFieldKey : Int, MBLocalizable, Comparable
MBFieldKey
enum represents one field or one result of scanning.
Here are defined all the properties
that can be extracted from all our recognizers used in
BlinkIDUI. For a specific country you can see the results by checking out the ‘*Extractor.swift’ files.
In them are defined extractors that extract the result into an array of MBField
s
-
Declaration
Swift
case address
-
Declaration
Swift
case addressChangeDate
-
Declaration
Swift
case addressCity
-
Declaration
Swift
case addressHouseNumber
-
Declaration
Swift
case addressJurisdictionCode
-
Declaration
Swift
case addressState
-
Declaration
Swift
case addressStreet
-
Declaration
Swift
case addressStreet2
-
Declaration
Swift
case addressZipCode
-
Declaration
Swift
case akaDateOfBirth
-
Declaration
Swift
case akaFullName
-
Declaration
Swift
case akaGivenName
-
Declaration
Swift
case akaMiddleName
-
Declaration
Swift
case akaPrefixName
-
Declaration
Swift
case akaSocialSecurityNumber
-
Declaration
Swift
case akaSuffixName
-
Declaration
Swift
case alienNumber
-
Declaration
Swift
case applicationReceiptNumber
-
Declaration
Swift
case armyId
-
Declaration
Swift
case armyNumber
-
Declaration
Swift
case auditInformation
-
Declaration
Swift
case authority
-
Declaration
Swift
case birthData
-
Declaration
Swift
case bloodGroup
-
Declaration
Swift
case bloodType
-
Declaration
Swift
case canNumber
-
Declaration
Swift
case cardNumber
-
Declaration
Swift
case cardRevisionDate
-
Declaration
Swift
case cardVersion
-
Declaration
Swift
case citizenship
-
Declaration
Swift
case city
-
Declaration
Swift
case civilIdNumber
-
Declaration
Swift
case civilStatusNumber
-
Declaration
Swift
case cnp
-
Declaration
Swift
case commercialCode
-
Declaration
Swift
case companyName
-
Declaration
Swift
case complianceType
-
Declaration
Swift
case country
-
Declaration
Swift
case countryIdentification
-
Declaration
Swift
case countryOfBirth
-
Declaration
Swift
case curp
-
Declaration
Swift
case dataDiscriminator
-
Declaration
Swift
case dateOfBirth
-
Declaration
Swift
case dateOfExpiry
-
Declaration
Swift
case dateOfIssue
-
Declaration
Swift
case dateOfIssueB10
-
Declaration
Swift
case dateOfIssueB10NotSpecified
-
Declaration
Swift
case district
-
Declaration
Swift
case dlClass
-
Declaration
Swift
case documentCode
-
Declaration
Swift
case documentDataMatch
-
Declaration
Swift
case documentDiscriminator
-
Declaration
Swift
case documentExpirationDate
-
Declaration
Swift
case documentExpirationMonth
-
Declaration
Swift
case documentNonexpiring
-
Declaration
Swift
case documentNumber
-
Declaration
Swift
case documentType
-
Declaration
Swift
case donorIndicator
-
Declaration
Swift
case driverNumber
-
Declaration
Swift
case driverRestrictions
-
Declaration
Swift
case electorKey
-
Declaration
Swift
case employer
-
Declaration
Swift
case employerAddress
-
Declaration
Swift
case expiryDatePermanent
-
Declaration
Swift
case extendedNricNumber
-
Declaration
Swift
case eyeColour
-
Declaration
Swift
case facultyAddress
-
Declaration
Swift
case familyName
-
Declaration
Swift
case familyNameTruncation
-
Declaration
Swift
case fathersName
-
Declaration
Swift
case federalCommercialVehicleCodes
-
Declaration
Swift
case fingerprint
-
Declaration
Swift
case firstName
-
Declaration
Swift
case firstNameTruncation
-
Declaration
Swift
case fullAddress
-
Declaration
Swift
case fullName
-
Declaration
Swift
case givenName
-
Declaration
Swift
case hairColor
-
Declaration
Swift
case hazmatExpirationDate
-
Declaration
Swift
case height
-
Declaration
Swift
case heightCm
-
Declaration
Swift
case heightIn
-
Declaration
Swift
case houseNumber
-
Declaration
Swift
case idSeries
-
Declaration
Swift
case identityCardNumber
-
Declaration
Swift
case immigrantCaseNumber
-
Declaration
Swift
case inventoryControlNumber
-
Declaration
Swift
case isUncertain
-
Declaration
Swift
case issueTimestamp
-
Declaration
Swift
case issuer
-
Declaration
Swift
case issuerIdentificationNumber
-
Declaration
Swift
case issuingAgency
-
Declaration
Swift
case issuingAuthority
-
Declaration
Swift
case issuingJurisdiction
-
Declaration
Swift
case issuingJurisdictionName
-
Declaration
Swift
case jmbg
-
Declaration
Swift
case jurisdictionEndorsementCodes
-
Declaration
Swift
case jurisdictionEndorsmentCodeDescription
-
Declaration
Swift
case jurisdictionRestrictionCodeDescription
-
Declaration
Swift
case jurisdictionRestrictionCodes
-
Declaration
Swift
case jurisdictionVehicleClass
-
Declaration
Swift
case jurisdictionVehicleClassificationDescription
-
Declaration
Swift
case jurisdictionVersionNumber
-
Declaration
Swift
case kelDesa
-
Declaration
Swift
case lastName
-
Declaration
Swift
case licenseCategories
-
Declaration
Swift
case licenseClass
-
Declaration
Swift
case licenseNumber
-
Declaration
Swift
case licenseType
-
Declaration
Swift
case limitedDurationDocument
-
Declaration
Swift
case maritalStatus
-
Declaration
Swift
case marriageStatus
-
Declaration
Swift
case medicalIndicator
-
Declaration
Swift
case middleName
-
Declaration
Swift
case middleNameTruncation
-
Declaration
Swift
case mothersName
-
Declaration
Swift
case mrtdVerified
-
Declaration
Swift
case mrzParsed
-
Declaration
Swift
case mrzText
-
Declaration
Swift
case namePrefix
-
Declaration
Swift
case nameSuffix
-
Declaration
Swift
case nationalNumber
-
Declaration
Swift
case nationality
-
Declaration
Swift
case nonMrzDateOfBirth
-
Declaration
Swift
case nonMrzDateOfExpiry
-
Declaration
Swift
case nonMrzNationality
-
Declaration
Swift
case nonMrzSex
-
Declaration
Swift
case nonResident
-
Declaration
Swift
case nricNumber
-
Declaration
Swift
case numberOfDuplicates
-
Declaration
Swift
case occupation
-
Declaration
Swift
case oldNric
-
Declaration
Swift
case optional1
-
Declaration
Swift
case optional2
-
Declaration
Swift
case organDonor
-
Declaration
Swift
case parentNames
-
Declaration
Swift
case parentsGivenName
-
Declaration
Swift
case passportNumber
-
Declaration
Swift
case pdf417string
-
Declaration
Swift
case permitExpirationDate
-
Declaration
Swift
case permitIdentifier
-
Declaration
Swift
case permitIssueDate
-
Declaration
Swift
case personalIdentificationNumber
-
Declaration
Swift
case personalNumber
-
Declaration
Swift
case placeOfBirth
-
Declaration
Swift
case placeOfIssue
-
Declaration
Swift
case placeOfOrigin
-
Declaration
Swift
case primaryId
-
Declaration
Swift
case principalResidence
-
Declaration
Swift
case province
-
Declaration
Swift
case race
-
Declaration
Swift
case raceEthnicity
-
Declaration
Swift
case rawData
-
Declaration
Swift
case referenceNumber
-
Declaration
Swift
case religion
-
Declaration
Swift
case residenceCity
-
Declaration
Swift
case residenceFullAddress
-
Declaration
Swift
case residenceJurisdictionCode
-
Declaration
Swift
case residencePostalCode
-
Declaration
Swift
case residenceStreetAddress
-
Declaration
Swift
case residenceStreetAddress2
-
Declaration
Swift
case residentialStatus
-
Declaration
Swift
case rt
-
Declaration
Swift
case rw
-
Declaration
Swift
case secondaryId
-
Declaration
Swift
case sector
-
Declaration
Swift
case securityVersion
-
Declaration
Swift
case serialNo
-
Declaration
Swift
case sex
-
Declaration
Swift
case signature
-
Declaration
Swift
case socialSecurityNumber
-
Declaration
Swift
case specialRemarks
-
Declaration
Swift
case standardEndorsementCode
-
Declaration
Swift
case standardRestrictionCode
-
Declaration
Swift
case standardVehicleClassification
-
Declaration
Swift
case standardVersionNumber
-
Declaration
Swift
case state
-
Declaration
Swift
case street
-
Declaration
Swift
case surnameAtBirth
-
Declaration
Swift
case under18
-
Declaration
Swift
case under19
-
Declaration
Swift
case under21
-
Declaration
Swift
case uniqueCustomerId
-
Declaration
Swift
case validFrom
-
Declaration
Swift
case validUntil
-
Declaration
Swift
case vehicleCategories
-
Declaration
Swift
case veteran
-
Declaration
Swift
case weightKilograms
-
Declaration
Swift
case weightPounds
-
Declaration
Swift
case weightRange
-
Declaration
Swift
case zipCode
-
Localized value of the key
Declaration
Swift
public var localized: String { get }
-
Declaration
Swift
public static func < (lhs: MBFieldKey, rhs: MBFieldKey) -> Bool


| Name |
Description |
|
ThermodynamicState |
Thermodynamic state |
|
BaseProperties |
Base properties |
| setState_pTX |
Return thermodynamic state from p, T, and X or Xi |
| setState_phX |
Return thermodynamic state from p, h, and X or Xi |
| setState_psX |
Return thermodynamic state from p, s, and X or Xi |
| setState_dTX |
Return thermodynamic state from d, T, and X or Xi |
|
setSmoothState |
Return thermodynamic state so that it smoothly approximates: if
x > 0 then state_a else state_b |
|
dynamicViscosity |
Return dynamic viscosity |
|
thermalConductivity |
Return thermal conductivity |
| pressure |
Return pressure |
| temperature |
Return temperature |
| density |
Return density |
|
specificEnthalpy |
Return specific enthalpy |
|
specificHeatCapacityCp |
Return specific heat capacity at constant pressure |
|
specificHeatCapacityCv |
Return specific heat capacity at constant volume |
|
isentropicExponent |
Return isentropic exponent |
|
velocityOfSound |
Return velocity of sound |
|
specificEnthalpy_pTX |
Return specific enthalpy from p, T, and X or Xi |
|
temperature_phX |
Return temperature from p, h, and X or Xi |
| density_phX |
Return density from p, h, and X or Xi |
|
specificInternalEnergy |
Return specific internal energy |
|
specificEntropy |
Return specific entropy |
|
specificGibbsEnergy |
Return specific Gibbs energy |
|
specificHelmholtzEnergy |
Return specific Helmholtz energy |
|
isentropicEnthalpy |
Return isentropic enthalpy |
|
isobaricExpansionCoefficient |
Returns overall the isobaric expansion coefficient beta |
|
isothermalCompressibility |
Returns overall the isothermal compressibility factor |
|
density_derp_T |
Returns the partial derivative of density with respect to
pressure at constant temperature |
|
density_derT_p |
Returns the partial derivative of density with respect to
temperature at constant pressure |
| density_derX |
Returns the partial derivative of density with respect to mass
fractions at constant pressure and temperature |
| molarMass |
Return the molar mass of the medium |


Phylogenetic trees are a representation of the genetic distances between HIV-1 sequences.
Trees for both major and minor genetic variants are provided.


{{Waterloo}}
Our project had many moving pieces, so there are many acknowledgments to give. From our large team, to our advisors, to graduate students in nearby labs, to some previous members on our team, a number of people contributed to this project and deserve recognition. All of the work except that listed below was performed by the team members. Details of member-specific work can be found on the Team page.
A teamwide effort, with help from 2014 team members Radmila Kovac and Julia Manalil. The plant viral defense aspect of the project was developed from an idea proposed by Steven ten Holder in the Winter 2015 offering of the course BIOL 349 (Synthetic Biology Project Design), co-taught by Marc Aucoin, Trevor Charles and Brian Ingalls.
Dr. Jiujun Cheng and graduate students Maya D'Alessio, John Heil, and Kathy Lam have given us very helpful advice, protocols, and access to pieces of equipment not available in our lab.
Dr. Trevor Charles, Dr. Barbara Moffatt, and graduate students Cherry Chen, and Maye Saechao donated Arabidopsis seeds, helped with planting and maintenance, and gave us protocols for performing floral dips, agroinfiltration, and creating protoplasts. Dr. Simon Chuong, Dr. Susan Lolle, Dr. Pearl Chang, and Destin Sigurdson also offered advice for floral dips and provided equipment and chemicals for Western blots.
Jamie McNeil, Dr. Aiming Wang, and a few other individuals at Agriculture and Agri-Food Canada provided advice for infecting Arabidopsis with CaMV, and provided the resources and space to do so.
Dr. Andrew Doxey and Dr. Marc Aucoin were helpful resources for our sgRNA and Cas9 modifications, and offered advice on software to use and routes to pursue.
Dr. Brian Ingalls gave advice on all of our models and has been a very helpful resource, and gave some direction for the differential equation and agent-based models. Dr. Andrew Doxey gave advice on using (Py)Rosetta for protein modelling, and we had a couple helpful conversations with Dragos Chiriac from Queen's about PyRosetta and fold trees.
Lauren Kennedy, a friend of the team, and Pavel Shmatnik from the Toronto team have offered advice with our scale-up business model, and individuals from Canada Banana Farms and Agriculture Food Canada provided feedback on the plant application and direction.
Suzie Alexander, the director of the 2014 Waterloo team, has given helpful financial and other administrative task advice.
As part of the Ontario iGEM effort, all five Ontario, Canada iGEM teams (McMaster, Toronto, Queen's, Ottawa, and Waterloo) gave presentations and provided feedback for each team, as well as general project and collaboration support. We also received presentation advice from all five of our advisors, Dr. Andrew Doxey, Dr. Barbara Moffatt, Dr. Brian Ingalls, Dr. Marc Aucoin, and Dr. Trevor Charles.


To compare prices, enter the values in respective currency and result will be in USD as base value
Product name: {{ product.name }}Price: {{ product.currency}} {{ product.price }} Current available stock: {{ product.stock }} Description: {{ product.description }} Shop: {{ product.shopname }} ( Operating hours: {{ product.operatinghour}} ) Location: {{ product.address }} , {{ product.airportName }} |


With my ornithologist's hat on, I keep telling you that swans are savage, murderous, semi-aquatic monsters. Now, with thanks to reader Dan Fuchs, unassailable evidence that I have been right all along…
A man whose job was to maintain and care for the swans at a suburban condominium complex in Des Plaines, Illinois was killed yesterday in what appears to have been a freak attack by one or more of the birds.
Nothing freakish about it, when, like me, you know what you're dealing with… feathered fiends!


Escope (escope) is ECMAScript scope analyzer extracted from esmangle project.
```js var escope = require(‘escope’); var esprima = require(‘esprima’); var estraverse = require(‘estraverse’);
var ast = esprima.parse(code); var scopeManager = escope.analyze(ast);
var currentScope = scopeManager.acquire(ast); // global scope
estraverse.traverse(ast, { enter: function(node, parent) { // do stuff
if (/Function/.test(node.type)) {
currentScope = scopeManager.acquire(node); // get current function scope
}
},
leave: function(node, parent) {
if (/Function/.test(node.type)) {
currentScope = currentScope.upper; // set to parent scope
}
// do stuff
} }); ```
Generated JSDoc is here.
Demonstration is here by Sasha Mazurov (twitter: @mazurov). issue
And there are tools constructed on Escope.
Copyright (C) 2012-2013 Yusuke Suzuki (twitter: @Constellation) and other contributors.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
 IN NO EVENT SHALL


Pay & Stay
Our goal is to change the way people stay away from home
We are India's largest hotel network spread across 230 cities with 8500+ hotels offering standardized and hassle-free stay experiences at an unmatched price.


Followings are creative products
- JSI - JSI project - Jagged Strategy Investment tool (on going)
- SIM - Machine learning algorithms framework (2020)
- REM - Regression models based on expectation maximization algorithm (2018)
- Hudup - A framework of e-commercial recommendation algorithms (2013)
- Phoebe - A framework of fetal age and weight estimation (2013)
- Zebra - A User Modeling System for Adaptive Learning (2009)
- AGmagic - An image searching framework (2005)
- Design - Implementation of database algebra algorithms (2000)


Jslet - WaitingBox Demo
Demonstrate how to use WaitingBox control.
Show In body
|
Show In below Div(Display)
Show In below Div(Hide)
Test Panel


class
:
tls
.
Server
Events
OCSPRequest
clientError
newSession
resumeSession
secureConnection
Member Properties
connections
maxConnections
Methods
addContext
address
close
listen
Additional Documentation Pages
Library Documentation
Events
OCSPRequest
clientError
newSession
resumeSession
secureConnection
Member Properties
|
Number
connections
|
Number
maxConnections
Methods
addContext
(
) {
address
(
) {
close
(
) {
listen
(
) {


| Pros | Cons |
|---|---|
| Potential that it could lead to a higher voter turnout (Smith) | No current studies that prove Internet voting would increase the young voter turnout (Dominick). |
| Easier and More accessible (Smith). | Hacking and Virus Potential (Click for More!) |
| Faster and More accurate (Smith) | People who aren't as tech savvy may have trouble adapting (Smith). |
| Less costly to operate - No one working polls. (Lukić). | Wifi is needed and not everyone has access to the internet (Smith) |
| Could be altered to help disabled people... i.e. deaf blind etc. (Smith).
Can also have multiple language options (Lukić). |
Possible impersonation fraud, false registration, and duplicate voting (Lukić). |
It is possible for a voting system to be hacked and the vote can potentially be changed from who the original voter intended to vote for. Moreover, Dominick ends his article with “one could virtually guarantee that it would be hacked.” The response from officials was along the lines of We know but there’s nothing we can do.
One thing I found very interesting is that 3 out of the top 4 reasons people did not vote in previous elections are because people were too busy, traveling for the holidays, and too busy with work or school (Smith). I think electronic voting could potentially increase voter turnout but I think the risks outweigh the benefits. It is too easy for people to hack into the systems or vote for other people. I think we should stick with going to the polls and having our IDs checked when voting.
Dominick, Tim. “Buell: Protect Our Votes: Return to Paper Ballots.” Thestate, The State, www.thestate.com/opinion/op-ed/article16523588.html.
Lukić, David. “OPINION: Some Pros and Cons of e-Voting, Including Risks of ID Theft.” The Fulcrum, The Fulcrum, 2 Nov. 2020, thefulcrum.us/voting/identity-theft.
Smith, Kathleen. “Pros and Cons of Internet Voting.” Goderich Signal Star, 17 Apr. 2018, www.goderichsignalstar.com/2018/04/10/pros-and-cons-of-internet-voting/wcm/f31e6a24-6654-461f-30db-82e283adea10.


Akka
Federico Silva
- One significant Akka App
- Several smaller things in the middle
- Now starting to build on Akka again
What is Akka?
Akka.io
Akka is a toolkit and runtime
for building highly concurrent,
distributed, and resilient
message-driven applications
on the JVM.
What is Akka?
- A toolkit
- A runtime
- JVM based
- Written in Scala
What is Akka?
Concurrent
What is the innovation?
What makes it different and why is it important?
Why is concurrency important?
- Modern CPUs
- Many CPUs
- Many Computers
Why do we need something new?
- Need more control
- Need clear semantics
- Less coupling
- Fault tolerance
- Distribution?
- Threads are not enough
- Neither are thread pools
- or Fork/Join
What is Akka?
What does it bring to the table?
A unified model for concurrency and distribution via the Actor Model
Actor Model
Old concept
"A Universal Modular Actor Formalism for Artificial Intelligence".
Carl Hewitt; Peter Bishop; Richard Steiger (1973).
Actor Model
The actor model in computer science is a mathematical model of concurrent computation that treats
"actors" as the universal primitives of concurrent computation: in response to a message that it
receives, an actor can make local decisions, create more actors, send more messages, and determine how
to respond to the next message received.
Actor Model
Other implementations
- Ruby, Celluloid
- Erlang, language construct, OTP adds features
- .NET, dotsero, Akka.net, MS Orleans
Actor Model
- Message Passing
- Location transparency
- Isolation
- Supervision
- Monitoring
- Dynamic behaviour
Message Passing
Is the basic building block, other features build upon it
- Asynchronous delivery
- Isolation
- Location transparency
Isolation
Ability to control internal state, run without interference
Location Transparency
Ability to send a message without considering where the recipient is located
Supervision and Monitoring
Actor systems form hierarchies where each node is the supervisor of its children.
Supervision and Monitoring
- Supervisors can delegate long running tasks
- Worker nodes need not consider fault management
- Cooperatively solve problems, under watch from supervisor
- Supervisor gets messages when children die, can restart, kill others
Dynamic Behaviour
An actor can change its own behaviour in response to messages.
Can be though of as a state machine.
Actors in Akka
- Actor Reference
- State
- Behavior
- Mailbox
- Children
- Supervisor Strategy
- When an Actor Terminates
Look at some code
Simple Akka Seed from Activator ©
- App from template
- Implement Switch Actor
- Look at CounterActor
Other Akka modules
- Cluster
- Persistence
- FSM
- Camel
- HTTP
- Reactive Streams
Akka Cluster
- Remoting
- Routing
- Load Balancing
Akka Persistence
- Evented architectures, CQRS
- Commands, backed by WAL
- Persistence of state, with recovery
Reactive Streams
Better alternative, safer too
What is not SO good?
- Dynamic Behaviour!
- No help from the type system
- Closing over state is not tracked
- Invisible Mailbox
- Actors? Futures? Both? When?
- Too low level
Patterns or good practices
- Minimize work, delegate lengthy work
- Pull don't push
- Ask for flow control
- Use functions to create behaviour, pass state
- Use traits to isolate code
- Use different dispatchers for different sections of the app
Anatomy of an application
- Simple Seed
- Distributed Workers
Misc
- Data locality
- Modeling data as an actor? CQRS like


Extends layer, dispatch.
Constructs a new GeoJSON layer with default settings.
An optional fetch function f may be specified, which defaults to po.queue.json. The fetch function takes two arguments: the URL to fetch as a string, and a callback function. The fetch function must return a request object with an abort method. The callback function should be invoked with the GeoJSON data when available.
The fetch function may be substituted to support GeoJSON transcoding. For example, a KML layer might be implemented by loading XML, and then converting it into a simplified GeoJSON representation.
Sets or gets the URL template associated with this GeoJSON layer. If the argument x is specified, this method sets the URL template and returns this. If no arguments are specified, this method returns the current URL template. The default URL template is “about:blank”.
The URL template may be specified either as a string or as a function:
If a string, and the string contains placeholders of the form “{A}”, where A is any character, then the string is converted into a URL template function using po.url. If the string does not contain placeholders, then it is left as a string, and tiling and clipping are disabled.
If a function, then the given function is invoked, passing in the tile coordinate of the GeoJSON file to load. The tile coordinate is represented as an object with row, column and zoom attributes. The function must return a string representing the URL to load. See po.url for an example implementation.
Note that if the GeoJSON file is not on the same domain, the server must specify a suitable Access-Control-Allow-Origin header for the data to be accessible.
Sets or gets the “hard-coded” features for this GeoJSON layer. If the argument x is specified, this method sets the features to the given array of GeoJSON feature objects and returns this. If no arguments are specified, this method returns the current features array, which defaults to null.
The purpose of this method is to support non-tiled GeoJSON layers that are loaded through external means, such as via JSONP or directly embedded in the HTML. Specifying the features array has the additional side-effect of disabling tiling and clipping.
Sets or gets whether tiles are clipped. If the boolean argument x is specified, the method enables or disables clipping accordingly, and returns this. If no arguments are specified, the method returns true if and only if tiles are clipped.
Tiles are clipped by default. Disabling clipping is useful for GeoJSON features that may extend beyond the tile boundary, such as points.
GeoJSON layers use the dispatch mechanism to notify interested parties of events. In addition to the standard load event, GeoJSON layers support the “show” event that is triggered for each tile as it becomes visible. The show event allows tiles to be styled dynamically through JavaScript. The stylist convenience class may be used to simplify implementation of load and show event handlers.


|
|
ComputersThrough the yearsWelcome to my website here i talk about computers and how they have changed over the past 20-30 years I recommend starting off with About old computers so you can learn a little computer history, Before continuing on with the rest of my website! QUICK FACTS [1]Did you know That every pc on shelfs back in the 80s- 90s came with microsoft windows already installed and it couldnt be uninstalled unless microsoft did it for you making many linux users mad [2]Did you know that older pcs ran on dial up internet witch means when you awnser you house phone your internet would cut out [3]Did you know that The password for the computer controls of nuclear tipped missiles of the U.S was 00000000 for eight years. [4]Did you know that The first electronic computer ENIAC weighed more than 27 tons and took up 1800 square feet. [5]Did you know that old coputer mice used plastic balls instad of a laser to detect input |
|


Sahi Pro - Sahi Scripting Basics
Sahi script is based on javascript. Sahi script is parsed by Sahi and the parsed script is fully validjavascript which is executed by the rhino javascript engine. Below are the normal constructs used in Sahi script.
They are the same as javascript except for the mandatory $ used in variables.
Statements
Statements are normal lines of code. They end with a semi-colon.Eg.
_click(_link("Login"));
Variable declaration
var $variableName = value;
orvar $variableName; // declaration
$variableName = value; // assignment
All variables start with a $. The keyword var is used for local variables.Eg.
var $username = "SahiTestUser";
var $password; // declaration;
$password = $username + "_password"; // "SahiTestUser_password"
Comments
// This is a single line comment
/*
This is a multiline comment.
This has two lines
*/
if statements
if (condition) {
// statements
}
Eg.
// Comparing normal values
if ($username == "PartnerUser"){
_click(_link("Partner Login"));
}
// Comparing with browser attributes exposed by Sahi
if (_getText(_div("page_type")) == "Partner Page"){
_click(_link("Partner Login"));
}
// Comparing with browser attributes NOT exposed by Sahi's built-in fetch apis
// using _fetch
if (_fetch(_link(0).href) == "http://sahi.co.in/"){
_click(_link("Partner Login"));
}
// Comparing with browser attributes NOT exposed by Sahi's built-in fetch apis
// using _condition
if (_condition(_link(0).href == "http://sahi.co.in/")){
_click(_link("Partner Login"));
}
for loops
for (var $i=0; $i<$max; $i++){
// statements
}
Eg.
// This loop will login with user1, password1, user2, password2 etc.
// login and logout are custom functions.
for (var $i=0; $i<10; $i++){
login("user"+$i, "password"+$i);
logout();
}
while loops
while (condition) {
// statements
}
Eg.
$i = 0;
while ($i++ < 10) {
login("user"+$i, "password"+$i);
logout();
}
Structuring Sahi Code
info
While recording gives us the low level steps to be performed on the browser,
code needs to be restructured for better readability and maintainability.
This section explains how to structure your code for effective but simple use of Sahi.
code needs to be restructured for better readability and maintainability.
This section explains how to structure your code for effective but simple use of Sahi.
Functions
Functions are the basic building blocks in your automation.Functions are used to club together multiple steps into one logical action.
Functions reduce code duplication and allow easier maintenance of scripts.
function functionName($parameter1, $parameter2) {
// statements
}
For example a login function may look like this
// function declaration
function login($usr, $pwd){
_click(_link("Login"));
_setValue(_textbox("username"), $usr);
_setValue(_password("password"), $pwd);
_click(_submit("Login"));
}
// function call
login("test", "secret");
Including another Sahi script file
To reuse a function from one script in another, we include the relevant script using _include.Functions and variables declared in the included script are available in the including script.
Eg.
common.sah
// File: common.sah
// declare $DEFAULT_USER variable
var $DEFAULT_USER = "test";
// login function declaration
function login($usr, $pwd){
_click(_link("Login"));
_setValue(_textbox("username"), $usr);
_setValue(_password("password"), $pwd);
_click(_submit("Login"));
}
testcase1.sah
// File: testcase1.sah
// include common.sah shown above.
_include("common.sah");
// Note how login and $DEFAULT_USER are actually declared
// in common.sah but available here in testcase1.sah.
login($DEFAULT_USER, "secret");


Doc Gonzo's Pies & Noodles
Order Online
Order by Skype
Order by Email
Call<PHONE_NUMBER> or email<EMAIL_ADDRESS>View total price
Place order
Reset and start again
Pizza base cost:
Extra toppings cost:
Delivery cost:
Taxes:
Total price:
Order Confirmation
Pickup/Delivery:
Delivery
Eat-in
Pickup
Would you like to eat onsite, pick up, or have us deliver ($5.00 fee)?
I'd like to order:
Pasta
Pizza
Sandwich
Would you like pasta, pizza, or sandwiches?
Select size:
Small
Medium
Large
What size pizza would you like?
Small feeds 1-2 ($10.00)
Medium feeds 3-5 ($15.00)
Large feeds 6-8 ($20.00)
Select crust:
Regular
Sourdough
Whole Wheat
We have whole wheat, white (regular), or sourdough crust.
Select sauce:
Garlic
Marinara
White
You can choose garlic, marinara, or white (alfredo-type) sauce.
Select cheese:
Feta
Fontanella
Mozzarella
We have feta, fontanella, or mozzarella cheeses.
Choose as many ingredients as you'd like
(3 toppings are included free, and each additional topping is $1.50):
Select/Deselect all
Green Pepper
Mushrooms
Onions
Olives
Sundried Tomatoes
Pepperoni
Canadian Bacon
Ham
Ground Beef
Sausage
Fresh Basil Leaves
Fresh Chopped Parsley
Fresh Chopped Chives
Fresh Sliced Fennel
Fresh Chopped Oregano
Add these items


NULLIF
compares one expression with another. It returns NULL
when the expressions are equal, or the first expression when they are not.
Data type of the first argument
NULLIF(expr1, expr2)
expr1
is the base expression. It cannot be a literal null.
expr2
is the expression to compare with the base expression.
NULLIF('red', 'Red')
returns the value red
.


[gecode-users] Views and serialization
Gustavo Gutierrez
ggutierrez at cic.puj.edu.co
Fri Nov 23 22:18:38 CET 2007
Hi all,
I am working on merging a space SC in a S. For this to work i need to
create all actors available in SC into S. This is fine as the Space
class has method to return an iterator on space actors. I think the
following code will do the job (SC is the source and S is the target):
---- inside the queens class
VarMap * exportVars(void) {
VarMap *vmp = new VarMap();
Support::Symbol symb("root",true);
//vmp->registerArray(this,q,symb);
vmp->putArray(this,q,symb);
return vmp;
}
----
--- outside the class
void merge(Queens *target, Queens *source) {
// Print some useful information
std::cout << "Number of propagators in trget " <<
target->propagators() << std::endl;
std::cout << "Number of propagators in source " <<
source->propagators() << std::endl;
// Ask source to build a Map of its variables
VarMap *vmp = target->exportVars();
// Create an iterator over home's actors
Reflection::SpecIter si = source->actorSpecs(*vmp);
Gecode::Serialization::Deserializer *ds = new Deserializer(target, *vmp);
while (si()) {
ds->post(si.actor());
++si;
}
// Test the number of actors in target
std::cout << "Number of propagators in trget " <<
target->propagators() << std::endl;
}
----
Is it right or did i miss something?
The other step is to create all variables in SC in S. For this part i
have reading the documenttion and found that IntView and SetView
classes have a method called spec that returns an specification of a
variable. For the Queens problem this would be fine as all variables
are IntVars so creating IntView is easy. The problem raises when i
have a collection of variables of different types (an array of
VarBase*) and need to get the specification for each one. Is there any
way to do this?. Note that i don't know each variable's type so
creating the corresponding view is not possible.
I prefer to ask this before doing some changes to my design, so sorry
if my question sounds a little lazy.By the way, is there some example
that use space serialization or reflection mechanisms?
Thanks in advance,
--
Gustavo Gutierrez
More information about the gecode-users
mailing list


Woman Crush Wednesday! Sonali Bendre has all the inspiration you need to drive away your mid-week blues
by TIMESOFINDIA.COMFrom heading a popular book club to sharing inspirational posts and doling out fashion like a pro, Sonali Bendre is a chirpy bundle of motivation. The ‘Sarfarosh’ actress has battled a personal crisis and we totally dote her warrior spirit. From her adorable hair-cuts to her passion for reading, Sonali Bendre is a beacon of inspiration and never disappoints her fans. Sonali Bendre is exactly the one we would love to crush on Wednesday and if you are going through any mid-week blues, take a look at her Instagram posts which are packed with happy vibes.
Sonali Bendre doled out the best festive vibes, posing with her darling pet Little Miss Icy.
Spelling simplicity with her appetite, the actress shared an adorable post where she was enjoying ‘kande pohe’ and a hot cup of coffee.
Embracing the scars after her surgery, Sonali posted an emotional note about posing for the camera despite reservations.
A passionate bookworm, Sonali has a successful book club where passionate readers pick a book and later discuss it through social media.


--- layout: newsstory title: UNLUCKY match: Friendly Yeltz 0 WBA 1 ---
In a promising performance against a pretty strong Albion side, the mighty Yeltz were a little unlucky to lose 1-0 to the First Division side. Much more detail as usual in DJ's match report .
The friendlies are coming thick and fast now, with a trip to Stratford on Saturday, followed by a shorter one on Tuesday to the Harriers. Just 3 weeks to go now until the real thing.
Halesowen Town: Piearcy; Skidmore, Burnham, Smith, Barnett, L. Collins, Hall, Spencer, Giddings, Jones, Hines. Subs: Knight, Bailey, Colwell, Shaw, Otto, Crawford, Carter, Donaldson, Garvey.
West Bromwich Albion: Jensen; Lytlle, Quinn, Jordao, Butler, J. Chambers, A. Chambers, Oliver, Taylor, Dobie, Adams. Subs: Turner, Adamson, M. Collins, Scott, Briggs.
Referee: R Smith (Hasbury) Attendance: 700 (estimated)
Halesowen made the early running against a stronger than expected Baggies line-up and Neil Smith headed a Les Hines cross into the arms of Brian Jensen in the 11th minute.
The Yeltz missed a glorious chance to take the lead on the hour when skipper Lee Collins touched the ball to Andy Jones but he blasted his chance high from close range.
Albion were forced to work hard but won the game in the 65th minute as Jordao calmly slotted a left wing pass beyond Jason Piearcy with Halesowen exposed for the first time.
The Yeltz pushed hard for a late goal and substitute Ricky Otto hit the bar from Andy Spencer's looping cross in the 70th minute. Lee Knight then brought a fingertip save out of substitute goalkeeper Chris Adamson and Adamson was kept busy with two curling efforts on target from Otto and a drive from Alfie Carter.


CodeRED Curiosity | Houston's Premier Innovation Experience & Hackathon
October, 2016
Subscribe to be alerted when applications open for CodeRED Curiosity
Copyright © CougarCS 2015


Writing and recording tunes
Musician based in Los Angeles who loves to record, write, and perform.
Made with by Cathy McDonald