Standalone test spies, stubs and mocks for JavaScript.
No dependencies, works with any unit testing framework.
This page contains the entire Sinon.JS API documentation along with brief introductions to the concepts Sinon implements. Please ask questions on the mailing list if you're stuck. I also really appreciate suggestions to improve the documentation so Sinon.JS is easier to work with. Get in touch!
A test spy is a function that records arguments, return value, the value
of this
and exception thrown (if any) for all its calls. A
test spy can be an anonymous function or it can wrap an existing
function.
Test spies are useful to test both callbacks and how certain functions/methods are used throughout the system under test. The following simplified example shows how to use spies to test how a function handles a callback:
"test should call subscribers on publish": function () {
var callback = sinon.spy();
PubSub.subscribe("message", callback);
PubSub.publishSync("message");
assertTrue(callback.called);
}
sinon.spy
can also spy on existing functions. When doing
so, the original function will behave just as normal (including when
used as a constructor) but you will have access to data about all
calls. The following is a slightly contrived example:
{
setUp: function () {
sinon.spy(jQuery, "ajax");
},
tearDown: function () {
jQuery.ajax.restore(); // Unwraps the spy
},
"test should inspect jQuery.getJSON's usage of jQuery.ajax": function () {
jQuery.getJSON("/some/resource");
assert(jQuery.ajax.calledOnce);
assertEquals("/some/resource", jQuery.ajax.getCall(0).args[0].url);
assertEquals("json", jQuery.ajax.getCall(0).args[0].dataType);
}
}
sinon.spy()
var spy = sinon.spy();
this
value,
exceptions and return values for all calls.
var spy = sinon.spy(myFunc);
var spy = sinon.spy(object, "method");
object.method
and replaces the original method with the spy. The spy acts exactly
like the original method in all cases. The original method can be
restored by calling object.method.restore()
. The
returned spy is the function object which replaced the original
method. spy === object.method
.
Spies provide a rich interface to inspect their usage. The above
examples showed the calledOnce
boolean property as well as
the getCall
method and the returned
object's args
property. There are three ways of inspecting
call data.
The preferred approach is to use the spy's calledWith
method (and friends) because it keeps your test from being too specific
about which call did what and so on. It will return true
if
the spy was ever called with the provided arguments.
"test should call subscribers with message as first argument" : function () {
var message = 'an example message';
var spy = sinon.spy();
PubSub.subscribe(message, spy);
PubSub.publishSync(message, "some payload");
assert(spy.calledWith(message));
}
If you want to be specific, you can directly check the first argument of the first call. There are two ways of achieving this:
"test should call subscribers with message as first argument" : function () {
var message = 'an example message';
var spy = sinon.spy();
PubSub.subscribe(message, spy);
PubSub.publishSync(message, "some payload");
assertEquals(message, spy.args[0][0]);
}
"test should call subscribers with message as first argument" : function () {
var message = 'an example message';
var spy = sinon.spy();
PubSub.subscribe(message, spy);
PubSub.publishSync(message, "some payload");
assertEquals(message, spy.getCall(0).args[0]);
}
The first example uses the two-dimensional args
array
directly on the spy, while the second example fetches the first call
object and then accesses it's args
array. Which one to use
is a matter of preference, but the recommended approach is going with
spy.calledWith(arg1, arg2, ...)
unless there's a need to
make the tests highly specific.
Spy objects are objects returned from sinon.spy()
. When
spying on existing methods with sinon.spy(object, method)
,
the following properties and methods are also available
on object.method
.
withArgs
. This is useful to be
more expressive in your assertions, where you can access the spy with
the same call:
"test should call method once with each argument": function () {
var object = { method: function () {} };
var spy = sinon.spy(object, "method");
spy.withArgs(42);
spy.withArgs(1);
object.method(42);
object.method(1);
assert(spy.withArgs(42).calledOnce);
assert(spy.withArgs(1).calledOnce);
}
spy.callCount
spy.called
true
if the spy was called at least oncespy.calledOnce
true
if spy was called exactly oncespy.calledTwice
true
if the spy was called exactly twicespy.calledThrice
true
if the spy was called exactly thricespy.firstCall
spy.secondCall
spy.thirdCall
spy.lastCall
spy.calledBefore(anotherSpy);
true
if the spy was called before anotherSpy
spy.calledAfter(anotherSpy);
true
if the spy was called after anotherSpy
spy.calledOn(obj);
true
if the spy was called at least once with obj
as this
.
spy.alwaysCalledOn(obj);
true
if the spy was always called with obj
as this
.
spy.calledWith(arg1, arg2, ...);
true
if spy was called at least once with the provided
arguments. Can be used for partial matching, Sinon only checks the provided
arguments against actual arguments, so a call that received the provided arguments
(in the same spots) and possibly others as well will return true
.
spy.alwaysCalledWith(arg1, arg2, ...);
true
if spy was always called with the provided arguments
(and possibly others).
spy.calledWithExactly(arg1, arg2, ...);
true
if spy was called at least once with the provided arguments
and no others.
spy.alwaysCalledWithExactly(arg1, arg2, ...);
true
if spy was always called with the exact provided arguments.
spy.calledWithMatch(arg1, arg2, ...);
true
if spy was called with matching arguments
(and possibly others). This behaves the same as
spy.calledWith(sinon.match(arg1), sinon.match(arg2), ...)
.
spy.alwaysCalledWithMatch(arg1, arg2, ...);
true
if spy was always called with matching arguments
(and possibly others). This behaves the same as
spy.alwaysCalledWith(sinon.match(arg1), sinon.match(arg2), ...)
.
spy.calledWithNew();
true
if spy/stub was called the new
operator. Beware that this is inferred based on the value of
the this
object and the spy
function's prototype
, so it may give false positives if
you actively return the right kind of object.
spy.notCalledWith(arg1, arg2, ...);
true
if the spy/stub was called at least once
with arguments not matching the provided ones.
spy.neverCalledWith(arg1, arg2, ...);
true
if the spy/stub was never called with
the provided arguments.
spy.notCalledWithMatch(arg1, arg2, ...);
true
if the spy/stub was called at least once
with arguments not matching the provided ones. This behaves the same as
spy.notCalledWith(sinon.match(arg1), sinon.match(arg2), ...)
.
spy.neverCalledWithMatch(arg1, arg2, ...);
true
if the spy/stub was never called with
matching arguments. This behaves the same as
spy.neverCalledWith(sinon.match(arg1), sinon.match(arg2), ...)
.
spy.threw();
true
if spy threw an exception at least once.spy.threw("TypeError");
true
if spy threw an exception of the provided type at least once.spy.threw(obj);
true
if spy threw the provided exception object at least once.spy.alwaysThrew();
true
if spy always threw an exception.spy.alwaysThrew("TypeError");
true
if spy always threw an exception of the provided type.spy.alwaysThrew(obj);
true
if spy always threw the provided exception object.spy.returned(obj);
true
if spy returned the provided value at least once.
Uses deep comparison for objects and arrays.
Use spy.returned(sinon.match.same(obj))
for strict
comparison (see matchers).
spy.alwaysReturned(obj);
true
if spy always returned the provided value.var spyCall = spy.getCall(n);
Returns the nth call. Accessing individual calls helps with more detailed behavior verification when the spy is called more than once. Example:
sinon.spy(jQuery, "ajax");
jQuery.ajax("/stuffs");
var spyCall = jQuery.ajax.getCall(0);
assertEquals("/stuffs", spyCall.args[0]);
spy.thisValues
this
objects, spy.thisValues[0]
is the this
object for the first call.
spy.args
spy.args[0]
is an array of
arguments recevied in the first call.
spy.exceptions
spy.exceptions[0]
is
the exception thrown by the first call. If the call did not throw an
error, the value at the call's location in .exceptions
will be 'undefined'.
spy.returnValues
spy.returnValues[0]
is the return
value of the first call. If the call did not explicitly return a
value, the value at the call's location in .returnValues
will be 'undefined'.
spy.reset()
spy.printf("format string", [arg1, arg2, ...])
%n
: the name of the spy ("spy" by default)%c
: the number of times the spy was called, in words ("once", "twice", etc.)%C
: a list of string representations of the calls to the spy, with each call prefixed by a newline and four spaces%t
: a comma-delimited list of this
values the spy was called on%n
: the formatted value of the nth argument passed to printf
%*
: a comma-delimited list of the (non-format string) arguments passed to printf
var spyCall = spy.getCall(n)
Returns the nth call. Accessing individual calls helps with more detailed behavior verification when the spy is called more than once. Example:
sinon.spy(jQuery, "ajax");
jQuery.ajax("/stuffs");
var spyCall = jQuery.ajax.getCall(0);
assertEquals("/stuffs", spyCall.args[0]);
spyCall.calledOn(obj);
true
if obj
was this
for this call.spyCall.calledWith(arg1, arg2, ...);
true
if call received provided arguments (and possibly others).spyCall.calledWithExactly(arg1, arg2, ...);
true
if call received provided arguments and no others.spyCall.calledWithMatch(arg1, arg2, ...);
true
if call received matching arguments (and possibly others). This behaves the same as spyCall.calledWith(sinon.match(arg1), sinon.match(arg2), ...)
.spyCall.notCalledWith(arg1, arg2, ...);
true
if call did not receive provided arguments.spyCall.notCalledWithMatch(arg1, arg2, ...);
true
if call did not receive matching arguments. This behaves the same as spyCall.notCalledWith(sinon.match(arg1), sinon.match(arg2), ...)
.spyCall.threw();
true
if call threw an exception.spyCall.threw("TypeError");
true
if call threw exception of provided type.spyCall.threw(obj);
true
if call threw provided exception object.spyCall.thisValue
this
value.spyCall.args
spyCall.exception
spyCall.returnValue
Test stubs are functions (spies) with pre-programmed behavior. They support the full test spy API in addition to methods which can be used to alter the stub's behavior.
As spies, stubs can be either anonymous, or wrap existing functions. When wrapping an existing function with a stub, the original function is not called.
Use a stub when you want to:
The following example is yet another test from Morgan Roderick's PubSubJS which shows how to create an anonymous stub that throws an exception when called.
"test should call all subscribers, even if there are exceptions" : function(){
var message = 'an example message';
var error = 'an example error message';
var stub = sinon.stub().throws();
var spy1 = sinon.spy();
var spy2 = sinon.spy();
PubSub.subscribe(message, stub);
PubSub.subscribe(message, spy1);
PubSub.subscribe(message, spy2);
PubSub.publishSync(message, undefined);
assert(spy1.called);
assert(spy2.called);
assert(stub.calledBefore(spy1));
}
Note how the stub also implements the spy interface. The test verifies that all callbacks where called, and also that the exception throwing stub was called before one of the other callbacks.
var stub = sinon.stub();
var stub = sinon.stub(object, "method");
object.method
with a stub function. The original
function can be restored by calling object.method.restore();
(or stub.restore();
). An exception is thrown if the property
is not already a function, to help avoid typos when stubbing methods.
var stub = sinon.stub(object, "method", func);
object.method
with a func
, wrapped
in a spy
. As usual, object.method.restore();
can be used to restore the original method.
var stub = sinon.stub(obj);
"test should stub method differently based on arguments": function () {
var callback = sinon.stub();
callback.withArgs(42).returns(1);
callback.withArgs(1).throws("TypeError");
callback(); // No return value, no exception
callback(42); // Returns 1
callback(1); // Throws TypeError
}
stub.returns(obj);
stub.returnsArg(index);
stub.returnsArg(0);
causes the stub to return the first argument.
stub.throws();
Error
).stub.throws("TypeError");
stub.throws(obj);
stub.callsArg(index);
stub.callsArg(0);
causes the stub to call the
first argument as a callback.
stub.callsArgOn(index, context);
this
context.
stub.callsArgWith(index, arg1, arg2, ...);
callsArg
, but with arguments to pass to the callback.stub.callsArgOnWith(index, context, arg1, arg2, ...);
this
context.
callsArg
. Causes the stub to call the first
callback it receives with the provided arguments (if any). If a method
accepts more than one callback, you need to use callsArg
to have the stub invoke other callbacks than the first one.
this
context.
stub.yieldsTo(property, [arg1, arg2, ...])
yields
, yieldsTo
grabs the
first matching argument, finds the callback and calls it with the
(optional) arguments:
stub.yieldsToOn(property, context, [arg1, arg2, ...])
this
context.
"test should fake successful ajax request": function () {
sinon.stub(jQuery, "ajax").yieldsTo("success", [1, 2, 3]);
jQuery.ajax({
success: function (data) {
assertEquals([1, 2, 3], data);
}
});
}
spy.yield([arg1, arg2, ...])
spy
with the given
arguments. If the spy was never called with a function argument,
yield
throws an error. Also aliased as
invokeCallback
.
spy.yieldTo(callback, [arg1, arg2, ...])
yield
, yieldTo
grabs the first
matching argument, finds the callback and calls it with the (optional)
arguments:
"calling callbacks": function () {
var callback = sinon.stub();
callback({
"success": function () {
console.log("Success!");
},
"failure": function () {
console.log("Oh noes!");
}
});
callback.yieldTo("failure"); // Logs "Oh noes!"
}
spy.callArg(argNum)
yield
, but with an explicit argument number
specifying which callback to call. Useful if a function is called with
more than one callback, and simply calling the first callback is not
desired.
"calling the last callback": function () {
var callback = sinon.stub();
callback(function () {
console.log("Success!");
},
function () {
console.log("Oh noes!");
});
callback.callArg(1); // Logs "Oh noes!"
}
spy.callArgWith(argNum, [arg1, arg2, ...])
callArg
, but with arguments.
Mocks (and mock expectations) are fake methods (like spies) with pre-programmed behavior (like stubs) as well as pre-programmed expectations. A mock will fail your test if it is not used as expected.
Mocks should only be used for the method under test. In every unit test, there should be one unit under test. If you want to control how your unit is being used and like stating expectations upfront (as opposed to asserting after the fact), use a mock.
Mocks come with built-in expectations that may fail your test. Thus, they enforce implementation details. The rule of thumb is: if you wouldn't add an assertion for some call specific, don't mock it. Use a stub instead. In general you should never have more than one mock (possibly with several expectations) in a single test.
Expectations implement both the spies and stubs APIs.
To see how mocks look like in Sinon.JS, here's one of the PubSubJS tests again, this time using a method as callback and using mocks to verify its behavior:
"test should call all subscribers when exceptions": function () {
var myAPI = { method: function () {} };
var spy = sinon.spy();
var mock = sinon.mock(myAPI);
mock.expects("method").once().throws();
PubSub.subscribe("message", myAPI.method);
PubSub.subscribe("message", spy);
PubSub.publishSync("message", undefined);
mock.verify();
assert(spy.calledOnce);
}
var mock = sinon.mock(obj);
var expectation = mock.expects("method");
obj.method
with a mock function and returns it.
See expectations below.
mock.restore();
mock.verify();
All the expectation methods returns the expectation, meaning you can chain them. Typical usage:
sinon.mock(jQuery).expects("ajax").atLeast(2).atMost(5);
jQuery.ajax.verify();
var expectation = sinon.expectation.create([methodName]);
var expectation = sinon.mock();
expectation.atLeast(number);
expectation.atMost(number);
expectation.never();
expectation.once();
expectation.twice();
expectation.thrice();
expectation.exactly(number);
number
times.expectation.withArgs(arg1, arg2, ...);
expectation.withExactArgs(arg1, arg2, ...);
expectation.on(obj);
obj
as this
.expectation.verify();
Fake timers is a synchronous implementation of setTimeout
and friends that Sinon.JS can overwrite the global functions with to
allow you to more easily test code using them. Fake timers provide
a clock
object to pass time, which can also be used to
control Date
objects created through either new
Date();
or Date.now();
(if supported by the
browser).
When faking timers with IE you also need sinon-ie-1.5.0, which should be loaded after sinon-1.5.0.js.
The fake timers can be used completely stand-alone by downloading sinon-timers-1.5.0. When using the fake timers in IE you also need sinon-timers-ie-1.5.0. Load it after the first file.
{
setUp: function () {
this.clock = sinon.useFakeTimers();
},
tearDown: function () {
this.clock.restore();
},
"test should animate element over 500ms" : function(){
var el = jQuery("

");
el.appendTo(document.body);
el.animate({ height: "200px", width: "200px" });
this.clock.tick(510);
assertEquals("200px", el.css("height"));
assertEquals("200px", el.css("width"));
}
}
var clock = sinon.useFakeTimers();
Causes Sinon to replace the global setTimeout
,
clearTimeout
, setInterval
,
clearInterval
and Date
with a custom
implementation which is bound to the returned clock
object.
var clock = sinon.useFakeTimers(now);
var clock = sinon.useFakeTimers([now, ]prop1, prop2, ...);
clock.tick(ms);
ms
milliseconds. Causes all timers
scheduled within the affected time range to be called.
clock.restore();
tearDown
.XMLHttpRequest
API reference
Provides a fake implementation of XMLHttpRequest
and
provides several interfaces for manipulating objects created by it. Also
fakes the native XMLHttpRequest
and ActiveXObject
(if available, and only
for XMLHTTP
progids). Helps with testing requests made
with XHR.
When faking XHR with IE you also need sinon-ie-1.5.0, which should be loaded after sinon-1.5.0.js.
The fake server and XHR can be used completely stand-alone by downloading sinon-server-1.5.0. When using the fake server in IE you also need sinon-ie-1.5.0. Load it after the first file.
{
setUp: function () {
this.xhr = sinon.useFakeXMLHttpRequest();
var requests = this.requests = [];
this.xhr.onCreate = function (xhr) {
requests.push(xhr);
};
},
tearDown: function () {
this.xhr.restore();
},
"test should fetch comments from server" : function () {
var callback = sinon.spy();
myLib.getCommentsFor("/some/article", callback);
assertEquals(1, this.requests.length);
this.requests[0].respond(200, { "Content-Type": "application/json" },
'[{ "id": 12, "comment": "Hey there" }]');
assert(callback.calledWith([{ id: 12, comment: "Hey there" }]));
}
}
sinon.useFakeXMLHttpRequest
var xhr = sinon.useFakeXMLHttpRequest();
XMLHttpRequest
object
in browsers that support it with a custom implementation which does
not send actual requests. In browsers that support
ActiveXObject
, this constructor is replaced, and fake
objects are returned for XMLHTTP
progIds. Other progIds,
such as XMLDOM
are left untouched.
xhr.onCreate = function (xhr) {};
onCreate
property of the
returned object from useFakeXMLHttpRequest()
you can
subscribe to newly created FakeXMLHttpRequest
objects. See below for the fake xhr object API. Using this observer
means you can still reach objects created by
e.g. jQuery.ajax
(or other abstractions/frameworks).
xhr.restore();
FakeXMLHttpRequest
interfacerequest.url
request.method
request.requestHeaders
An object of all request headers, i.e.:
{
"Accept": "text/html, */*",
"Connection": "keep-alive"
}
request.requestBody
request.status
respond
below).
request.statusText
respond
method is called (see below).
request.async
request.username
request.password
request.responseXML
respond
, this property is
populated with a parsed document if response headers indicate as much
(see the spec).
request.getResponseHeader(header);
respond
).
request.getAllResponseHeaders();
When using Sinon.JS for mockups or partial integration/functional
testing, you might want to fake some requests, while allowing others to
go throught to the backend server. With
filtered FakeXMLHttpRequest
s (new in Sinon 1.3.0), you can.
FakeXMLHttpRequest.useFilters
(default false
)true
, Sinon will check added filters if
certain requests should be "unfaked".
FakeXMLHttpRequest.addFilter(fn)
xhr.open
is called, with the
exact same arguments (method
, url
,
async
, username
, password
). If
the filter returns truthy, the request will not be faked.
request.setResponseHeaders(object);
{ "Content-Type": "text/html", /*
... */ }
, updates the readyState
property and
fires onreadystatechange
.
request.setResponseBody(body);
readyState
property and
fires onreadystatechange
. Additionally,
populates responseXML
with a parsed document
if response headers indicate as much.
request.respond(status, headers, body);
status
and
statusText
properties. Status should be a number, the
status text is looked up from sinon.FakeXMLHttpRequest.statusCodes
.
request.autoRespond(ms);
ms
argument. Note that this feature is intended to
help during mockup development, and is not suitable for use in tests.
High-level API to manipulate FakeXMLHttpRequest
instances.
{
setUp: function () {
this.server = sinon.fakeServer.create();
},
tearDown: function () {
this.server.restore();
},
"test should fetch comments from server" : function () {
this.server.respondWith("GET", "/some/article/comments.json",
[200, { "Content-Type": "application/json" },
'[{ "id": 12, "comment": "Hey there" }]']);
var callback = sinon.spy();
myLib.getCommentsFor("/some/article", callback);
this.server.respond();
sinon.assert.calledWith(callback, [{ id: 12, comment: "Hey there" }]));
}
}
var server = sinon.fakeServer.create();
sinon.useFakeXMLHttpRequest()
.
var server = sinon.fakeServerWithClock.create();
onreadystatechange
.
server.respondWith(response);
response
is either a string - the response body, an array
with status, headers and response body, e.g.
[200, { "Content-Type": "text/html", "Content-Length": 2 },
"OK"]
or a function. Default status is 200 and default headers
are none. Causes the server to respond to any request not matched by
another response with the provided data. The default catch-all
response is [404, {} ""]
.
When the response is a function, it will be passed the request object. You must manually call respond on it to complete the request.
server.respondWith(url, response);
/posts/1
.
server.respondWith(method, url, response);
method
requests to the given URL with the
given response. method
is an HTTP verb.
server.respondWith(urlRegExp, response);
/\/post/\d+
If the response is a function, it will be passed any capture groups
from the regular expression along with the XMLHttpRequest object:
server.respondWith(/\/todo-items\/(\d+)/, function (xhr, id) {
xhr.respond(200, { "Content-Type": "application/json" }, '[{ "id": ' + id + ' }]');
});
server.respondWith(method, urlRegExp, response);
method
requests to URLs matching the
regular expression.
server.respond();
respondWith
match, the
default response is [404, {}, ""]
. Synchronous requests
are responded to immediately, so make sure to call
respondWith
upfront. If called with arguments,
respondWith
will be called with those arguments before
responding to requests.
server.autoRespond = true;
srv.respondWith
automatically after every request.
server.autoRespondAfter = ms;
server.fakeHTTPMethods
true
, server will find _method
parameter in POST body and recognize that as the actual
method. Supports a pattern common to Ruby on Rails applications. For
custom HTTP method faking,
override server.getHTTPMethod(request)
.
server.getHTTPMethod(request)
request.method
. When server.fakeHTTPMethods
is true, the method will return the value of the _method
parameter if the method is "POST". This method can be overrided to
provide custom behavior.
server.restore();
Sinon.JS ships with a set of assertions that mirror most behavior verification methods and properties on spies and stubs. The advantage of using the assertions is that failed expectations on stubs and spies can be expressed directly as assertion failures with detailed and helpful error messages.
To make sure assertions integrate nicely with your test framework, you
should customize either sinon.assert.fail
or
sinon.assert.failException
and look into
sinon.assert.expose
and
sinon.assert.pass
.
The assertions can be used with either spies or stubs.
"test should call subscribers with message as first argument" : function () {
var message = 'an example message';
var spy = sinon.spy();
PubSub.subscribe(message, spy);
PubSub.publishSync(message, "some payload");
sinon.assert.calledOnce(spy);
sinon.assert.calledWith(spy, message);
}
sinon.assert.fail(message)
sinon.assert.failException
. If your testing
framework looks for assertion errors by checking for a specific
exception, you can simply override the kind of exception thrown. If
that does not fit with your testing framework of choice, override
the fail
method to do the right thing.
sinon.assert.failException
sinon.assert.pass(assertion)
sinon.assert.notCalled(spy)
sinon.assert.called(spy)
sinon.assert.calledOnce(spy)
sinon.assert.calledTwice()
sinon.assert.calledThrice()
sinon.assert.callCount(spy, num)
num
times.
sinon.assert.callOrder(spy1, spy2, ...)
sinon.assert.calledOn(spy, obj)
obj
as
its this
value.
sinon.assert.alwaysCalledOn(spy, obj)
obj
as
its this
value.
sinon.assert.calledWith(spy, arg1, arg2, ...)
sinon.assert.alwaysCalledWith(spy, arg1, arg2, ...)
sinon.assert.neverCalledWith(spy, arg1, arg2, ...)
sinon.assert.calledWithExactly(spy, arg1, arg2, ...)
sinon.assert.alwaysCalledWithExactly(spy, arg1, arg2, ...)
sinon.assert.calledWithMatch(spy, arg1, arg2, ...)
sinon.assert.calledWith(spy, sinon.match(arg1), sinon.match(arg2), ...)
.
sinon.assert.alwaysCalledWithMatch(spy, arg1, arg2, ...)
sinon.assert.alwaysCalledWith(spy, sinon.match(arg1), sinon.match(arg2), ...)
.
sinon.assert.neverCalledWithMatch(spy, arg1, arg2, ...)
sinon.assert.neverCalledWith(spy, sinon.match(arg1), sinon.match(arg2), ...)
.
sinon.assert.threw(spy, exception)
sinon.assert.alwaysThrew(spy, exception)
sinon.assert.expose(object, options)
Exposes assertions into another object, to better integrate with the test framework. For instance, JsTestDriver uses global assertions, and to make Sinon.JS assertions appear alongside them, you can do:
sinon.assert.expose(this);
This will give you assertCalled(spy)
,
assertCallOrder(spy1, spy2, ...)
and so on.
The method accepts an optional options object with two
options. prefix is a prefix to give assertions. By
default it is "assert", so sinon.assert.called
becomes
target.assertCalled
. By passing a blank string, the
exposed method will be target.called
. The second
option, includeFail is true by default, and copies
over the fail
and failException
properties.
Matchers can be passed as arguments to spy.calledWith
,
spy.returned
and the corresponding
sinon.assert
functions as well as
spy.withArgs
. Matchers allow to be either
more fuzzy or more specific about the expected value.
"test should assert fuzzy": function () {
var book = {
pages: 42,
author: "cjno"
};
var spy = sinon.spy();
spy(book);
sinon.assert.calledWith(spy, sinon.match({ author: "cjno" }));
sinon.assert.calledWith(spy, sinon.match.has("pages", 42));
}
"test should stub method differently based on argument types": function () {
var callback = sinon.stub();
callback.withArgs(sinon.match.string).returns(true);
callback.withArgs(sinon.match.number).throws("TypeError");
callback("abc"); // Returns true
callback(123); // Throws TypeError
}
sinon.match(number)
sinon.match(string)
sinon.match(regexp)
sinon.match(object)
expectation
. This supports nested matchers.sinon.match(function)
sinon.match.any
sinon.match.defined
sinon.match.truthy
sinon.match.falsy
sinon.match.bool
sinon.match.number
sinon.match.string
sinon.match.object
sinon.match.func
sinon.match.array
sinon.match.regexp
sinon.match.date
sinon.match.same(ref)
ref
.sinon.match.typeOf(type)
type
can be one of
"undefined"
,
"null"
,
"boolean"
,
"number"
,
"string"
,
"object"
,
"function"
,
"array"
,
"regexp"
or
"date"
.
sinon.match.instanceOf(type)
sinon.match.has(property[, expectation])
sinon.match.hasOwn(property[, expectation])
sinon.match.has
but the property must be defined by the value itself. Inherited properties are ignored.
All matchers implement and
and or
. This
allows to logically combine mutliple matchers. The result is a new
matchers that requires both (and) or one of the matchers (or) to
return true.
var stringOrNumber = sinon.match.string.or(sinon.match.number);
var bookWithPages = sinon.match.instanceOf(Book).and(sinon.match.has("pages"));
Custom matchers are created with the sinon.match
factory
which takes a test function and an optional message. The test function takes a
value as the only argument, returns true
if the
value matches the expectation and false
otherwise.
The message string is used to generate the error message in case the
value does not match the expectation.
var trueIsh = sinon.match(function (value) {
return !!value;
}, "trueIsh");
Sandboxes simplify working with fakes that need to be restored and/or verified. If you're using fake timers, fake XHR, or you are stubbing/spying on globally accessible properties you should use a sandbox to ease cleanup. By default the spy, stub and mock properties of the sandbox is bound to whatever object the function is run on, so if you don't want to manually restore(), you have to use this.spy() instead of sinon.spy() (and stub, mock).
"test using sinon.test sandbox": sinon.test(function () {
var myAPI = { method: function () {} };
this.mock(myAPI).expects("method").once();
PubSub.subscribe("message", myAPI.method);
PubSub.publishSync("message", undefined);
})
var sandbox = sinon.sandbox.create();
var sandbox = sinon.sandbox.create(config);
The sinon.sandbox.create(config)
method is mostly an
integration feature, and as an end-user of Sinon.JS you will
probably not need it.
Creates a pre-configured sandbox object. The configuration can instruct the sandbox to include fake timers, fake server, and how to interact with these. The default configuration looks like:
sinon.defaultConfig = {
// ...
injectInto: null,
properties: ["spy", "stub", "mock", "clock", "server", "requests"],
useFakeTimers: true,
useFakeServer: true
}
injectInto
injectInto
configuration option can
name an object to add properties to. Usually, this is set by
sinon.test
such that it is the this
value in a given test function.
properties
server
property show up
in the target object, you also have to
set useFakeServer
to true.
useFakeTimers
true
, the sandbox will have a clock
property. Can also be an array of timer properties to fake.
useFakeServer
If true
, server
and
requests
properties are added to the sandbox. Can
also be an object to use for fake server. The default one
is sinon.fakeServer
, but if you're using jQuery 1.3.x
or some other library that does not set the XHR's
onreadystatechange
handler, you might want to do:
sinon.config = {
useFakeServer: sinon.fakeServerWithClock
};
sandbox.spy();
sinon.spy
, only also adds the returned
spy to the internal collection of fakes for easy restoring
through sandbox.restore()
.
sandbox.stub();
sinon.stub
, only also adds the
returned stub to the internal collection of fakes for easy restoring
through sandbox.restore()
. The sandbox stub
method can also be used to stub any kind of property. This is useful
if you need to override an object's property for the duration of a
test, and have it restored when the test completes.
sandbox.mock();
sinon.mock
, only also adds the returned
mock to the internal collection of fakes for easy restoring
through sandbox.restore()
.
sandbox.useFakeTimers();
clock
object to the sandbox
such that it too is restored when
calling sandbox.restore()
.
Access through sandbox.clock
.
sandbox.useFakeXMLHttpRequest();
sandbox.restore()
. Access
requests through sandbox.requests
.
sandbox.useFakeServer();
sandbox.restore()
. Access
requests through sandbox.requests
and server through
sandbox.server
.
sandbox.restore();
Wrapping test methods in sinon.test
allows Sinon.JS to
automatically create and manage sandboxes for you. The function's
behavior can be configured through sinon.config
.
var wrappedFn = sinon.test(fn);
wrappedFn
function works exactly like the original
one in all respect - in addition a sandbox object is created and
automatically restored when the function finishes a call. By default
the spy, stub and mock properties of the sandbox is bound to whatever
object the function is run on, so you can do this.spy()
(and stub, mock) and it works exactly like sandbox.spy()
(and stub, mock), except you don't need to manually restore()
.
The configuration controls how Sinon binds properties when
using sinon.test
. The default configuration looks like:
{ injectIntoThis: true, injectInto: null, properties: ["spy", "stub", "mock", "clock", "server", "requests"], useFakeTimers: true, useFakeServer: true }
Simply set sinon.config
to override any or all of these,
e.g.:
sinon.config = { useFakeTimers: false, useFakeServer: false }
In this case, defaults are used for the non-existent properties. Additionally, sandboxes and tests will not have automatic access to the fake timers and fake server when using this configuration.
injectIntoThis
this
object of
the test function. Default true
.
injectInto
null
(default)
and injectIntoThis
is false
(not default),
the properties are passed as arguments to the test function instead.
properties
["spy", "stub", "mock", "clock", "server",
"requests"]
. However, the last three properties are only bound
if the following two configuration options are true
(which is the default).
useFakeTimers
clock
property to
be exposed. Default is true
.useFakeServer
server
and requests
properties to be
exposed. Default is true
.
If you need the behavior of sinon.test
for more than one
test method in a test case, you can use sinon.testCase
,
which behaves exactly like wrapping each test in sinon.test
with one exception: setUp
and tearDown
can
share fakes.
var obj = sinon.testCase({});
Sinon.JS has a few utilities used internally in lib/sinon.js. Unless the method in question is documented here, it should not be considered part of the public API, and thus is subject to change.
sinon.format(object)
sinon.log(string)
sinon.log = function (message) {
jstestdriver.console.log(message);
};
Sinon uses Semantic versioning.
Copyright 2010 - 2012, Christian Johansen. Released under the BSD license.


I think its not fair to talk about Orange and not say that the new dude is gonna commit suicide and they're trying to prevent that. I mean sure you said many times that this was going to be a tear-jerker, but I mean suicide is pretty heavy and an all together different from regretting not doing HS stuff. (also I don't think its a spoiler because that's the whole plot of this thing, they tell you that at like episode 2)


AirtelTigo names new CEO
African telecoms operator, AirtelTigo announced this week that it has appointed Murthy Chaganti as the company’s new Chief Executive Officer.
Before this role, Chaganti was the company’s COO. According to AirtelTigo, he has played a key role in the successful integration process of Airtel Ghana and Millicom Ghana, operators of Tigo brand after the merger of the two telecommunications giants in Ghana.
Following the completion of the integration in record time, the first of its kind in Africa and delivering significant savings in operating expense (OPEX), Chaganti assumed the additional responsibility of leading the commercial function to focus and deliver growth, which saw a turnaround of data growth.
Chaganti brings a wealth of experience in General Management, Commercial and Business Strategy, Sales and Marketing, having spent over 20-years in various roles within the Telecommunication and Fast-Moving Consumer Goods (FMCG) sectors in Ghana and India.
Before joining AirtelTigo on 3rd January 2018 as COO, Chaganti served in senior leadership roles in the telecommunication industry in India. As the CEO of the Gujarat Circle, Bharti Airtel India, he led the turnaround of this multi-million business by delivering quality network and superior customer experience in the process, achieving the highest ever revenue market share gain.
He was the Head of Business at Chennai and Andhra Pradesh Circles of Aircel India, where he led the launch of Aircel, establishing Aircel as the brand of choice in data through innovative go-to-market initiatives and ultimately building a market-leading business.
Chaganti holds an MBA in Marketing and Finance from the XLRI Business School in Jamshedpur, India and a bachelor’s degree in Mechanical Engineering from Osmania University College of Engineering in Hyderabad, India.
“We are confident that Chaganti will carry on our vision of ‘Making Life Simple’ while keeping us focused on meeting our customers’ needs and holding us to our new commitment of being Simple, Transparent and Relevant,” said the Board.
Edited by Jenna Delport
Follow Jenna Delport on Twitter
Follow IT News Africa on Twitter


Knob
A virtual knob with a couple of different interaction modalities. Knobs are a type of Widget and inherit its methods and properties.
Example:
a = Knob({ centerZero: true })
b = Knob({ usesRotation:true })
Properties
- centerZero : Boolean. Default : false. When true the knob functions like a pan knob typically found on an audio mixer, where the zero value is at the 12 o'clock position and the knob can be turned to the right or left. The graphics show the offset from the knobs 0 value.
- useRotation : Boolean. Default : false. When true, the knob changes values as users drag around its perimeter. When false, the knob changes value based on vertical user movements.
Methods
See the Widget prototype for relevant methods.


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xerces.dom.NodeImpl
NodeImpl provides the basic structure of a DOM tree. It is never used directly, but instead is subclassed to add type and data information, and additional methods, appropriate to each node of the tree. Only its subclasses should be instantiated -- and those, with the exception of Document itself, only through a specific Document's factory methods.
The Node interface provides shared behaviors such as siblings and children, both for consistancy and so that the most common tree operations may be performed without constantly having to downcast to specific node types. When there is no obvious mapping for one of these queries, it will respond with null. Note that the default behavior is that children are forbidden. To permit them, the subclass ParentNode overrides several methods.
NodeImpl also implements NodeList, so it can return itself in response to the getChildNodes() query. This eliminiates the need for a separate ChildNodeList object. Note that this is an IMPLEMENTATION DETAIL; applications should _never_ assume that this identity exists.
All nodes in a single document must originate in that document. (Note that this is much tighter than "must be same implementation") Nodes are all aware of their ownerDocument, and attempts to mismatch will throw WRONG_DOCUMENT_ERR.
However, to save memory not all nodes always have a direct reference to their ownerDocument. When a node is owned by another node it relies on its owner to store its ownerDocument. Parent nodes always store it though, so there is never more than one level of indirection. And when a node doesn't have an owner, ownerNode refers to its ownerDocument.
This class doesn't directly support mutation events, however, it still implements the EventTarget interface and forward all related calls to the document so that the document class do so.
| Field Summary | |
|---|---|
static short |
DOCUMENT_POSITION_CONTAINS
|
static short |
DOCUMENT_POSITION_DISCONNECTED
|
static short |
DOCUMENT_POSITION_FOLLOWING
|
static short |
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
|
static short |
DOCUMENT_POSITION_IS_CONTAINED
|
static short |
DOCUMENT_POSITION_PRECEDING
|
static short |
ELEMENT_DEFINITION_NODE
Element definition node type. |
protected static short |
FIRSTCHILD
|
protected short |
flags
|
protected static short |
HASSTRING
|
protected static short |
ID
|
protected static short |
IGNORABLEWS
|
protected static short |
NORMALIZED
|
protected static short |
OWNED
|
protected NodeImpl |
ownerNode
|
protected static short |
READONLY
|
protected static short |
SPECIFIED
|
protected static short |
SYNCCHILDREN
|
protected static short |
SYNCDATA
|
static short |
TREE_POSITION_ANCESTOR
The node is an ancestor of the reference node. |
static short |
TREE_POSITION_DESCENDANT
The node is a descendant of the reference node. |
static short |
TREE_POSITION_DISCONNECTED
The two nodes are disconnected, they do not have any common ancestor. |
static short |
TREE_POSITION_EQUIVALENT
The two nodes have an equivalent position. |
static short |
TREE_POSITION_FOLLOWING
The node follows the reference node. |
static short |
TREE_POSITION_PRECEDING
The node precedes the reference node. |
static short |
TREE_POSITION_SAME_NODE
The two nodes are the same. |
| Fields inherited from interface org.w3c.dom.Node |
|---|
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE |
| Constructor Summary | |
|---|---|
|
NodeImpl()
Constructor for serialization. |
protected |
NodeImpl(CoreDocumentImpl ownerDocument)
No public constructor; only subclasses of Node should be instantiated, and those normally via a Document's factory methods |
| Method Summary | |
|---|---|
void |
addEventListener(java.lang.String type,
org.w3c.dom.events.EventListener listener,
boolean useCapture)
This method allows the registration of event listeners on the event target. |
org.w3c.dom.Node |
appendChild(org.w3c.dom.Node newChild)
Adds a child node to the end of the list of children for this node. |
protected void |
changed()
Denotes that this node has changed. |
protected int |
changes()
Returns the number of changes to this node. |
org.w3c.dom.Node |
cloneNode(boolean deep)
Returns a duplicate of a given node. |
short |
compareDocumentPosition(org.w3c.dom.Node other)
Compares a node with this node with regard to their position in the document. |
short |
compareTreePosition(org.w3c.dom.Node other)
Deprecated. |
boolean |
dispatchEvent(org.w3c.dom.events.Event event)
This method allows the dispatch of events into the implementations event model. |
org.w3c.dom.NamedNodeMap |
getAttributes()
Return the collection of attributes associated with this node, or null if none. |
java.lang.String |
getBaseURI()
The absolute base URI of this node or null if undefined. |
org.w3c.dom.NodeList |
getChildNodes()
Obtain a NodeList enumerating all children of this node. |
protected org.w3c.dom.Node |
getContainer()
For non-child nodes, the node which "points" to this node. |
java.lang.Object |
getFeature(java.lang.String feature,
java.lang.String version)
This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in . |
org.w3c.dom.Node |
getFirstChild()
The first child of this Node, or null if none. |
org.w3c.dom.Node |
getLastChild()
The first child of this Node, or null if none. |
int |
getLength()
NodeList method: Count the immediate children of this node |
java.lang.String |
getLocalName()
Introduced in DOM Level 2. |
java.lang.String |
getNamespaceURI()
Introduced in DOM Level 2. |
org.w3c.dom.Node |
getNextSibling()
The next child of this node's parent, or null if none |
abstract java.lang.String |
getNodeName()
the name of this node. |
protected int |
getNodeNumber()
Returns the node number |
abstract short |
getNodeType()
A short integer indicating what type of node this is. |
java.lang.String |
getNodeValue()
Returns the node value. |
org.w3c.dom.Document |
getOwnerDocument()
Find the Document that this Node belongs to (the document in whose context the Node was created). |
org.w3c.dom.Node |
getParentNode()
Obtain the DOM-tree parent of this node, or null if it is not currently active in the DOM tree (perhaps because it has just been created or removed). |
java.lang.String |
getPrefix()
Introduced in DOM Level 2. |
org.w3c.dom.Node |
getPreviousSibling()
The previous child of this node's parent, or null if none |
boolean |
getReadOnly()
NON-DOM: Returns true if this node is read-only. |
java.lang.String |
getTextContent()
This attribute returns the text content of this node and its descendants. |
java.lang.Object |
getUserData()
NON-DOM: Returns the user data associated to this node. |
java.lang.Object |
getUserData(java.lang.String key)
Retrieves the object associated to a key on a this node. |
protected java.util.Hashtable |
getUserDataRecord()
|
boolean |
hasAttributes()
Returns whether this node (if it is an element) has any attributes. |
boolean |
hasChildNodes()
Test whether this node has any children. |
org.w3c.dom.Node |
insertBefore(org.w3c.dom.Node newChild,
org.w3c.dom.Node refChild)
Move one or more node(s) to our list of children. |
boolean |
isDefaultNamespace(java.lang.String namespaceURI)
DOM Level 3: Experimental This method checks if the specified namespaceURI is the
default namespace or not. |
boolean |
isEqualNode(org.w3c.dom.Node arg)
Tests whether two nodes are equal. |
boolean |
isSameNode(org.w3c.dom.Node other)
Returns whether this node is the same node as the given one. |
boolean |
isSupported(java.lang.String feature,
java.lang.String version)
Introduced in DOM Level 2. |
org.w3c.dom.Node |
item(int index)
NodeList method: Return the Nth immediate child of this node, or null if the index is out of bounds. |
java.lang.String |
lookupNamespaceURI(java.lang.String specifiedPrefix)
DOM Level 3 - Experimental: Look up the namespace URI associated to the given prefix, starting from this node. |
java.lang.String |
lookupPrefix(java.lang.String namespaceURI)
DOM Level 3 - Experimental: Look up the prefix associated to the given namespace URI, starting from this node. |
void |
needsSyncChildren(boolean value)
|
void |
normalize()
Puts all Text nodes in the full depth of the sub-tree
underneath this Node , including attribute nodes, into a
"normal" form where only markup (e.g., tags, comments, processing
instructions, CDATA sections, and entity references) separates
Text nodes, i.e., there are no adjacent Text
nodes. |
org.w3c.dom.Node |
removeChild(org.w3c.dom.Node oldChild)
Remove a child from this Node. |
void |
removeEventListener(java.lang.String type,
org.w3c.dom.events.EventListener listener,
boolean useCapture)
This method allows the removal of event listeners from the event target. |
org.w3c.dom.Node |
replaceChild(org.w3c.dom.Node newChild,
org.w3c.dom.Node oldChild)
Make newChild occupy the location that oldChild used to have. |
void |
setNodeValue(java.lang.String x)
Sets the node value. |
void |
setPrefix(java.lang.String prefix)
Introduced in DOM Level 2. |
void |
setReadOnly(boolean readOnly,
boolean deep)
NON-DOM: PR-DOM-Level-1-19980818 mentions readonly nodes in conjunction with Entities, but provides no API to support this. |
void |
setTextContent(java.lang.String textContent)
This attribute returns the text content of this node and its descendants. |
void |
setUserData(java.lang.Object data)
NON-DOM: As an alternative to subclassing the DOM, this implementation has been extended with the ability to attach an object to each node. |
java.lang.Object |
setUserData(java.lang.String key,
java.lang.Object data,
org.w3c.dom.UserDataHandler handler)
Associate an object to a key on this node. |
protected void |
synchronizeData()
Override this method in subclass to hook in efficient internal data structure. |
java.lang.String |
toString()
NON-DOM method for debugging convenience. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final short TREE_POSITION_PRECEDING
public static final short TREE_POSITION_FOLLOWING
public static final short TREE_POSITION_ANCESTOR
public static final short TREE_POSITION_DESCENDANT
public static final short TREE_POSITION_EQUIVALENT
ownerElement
, and two
nodes that are the same.public static final short TREE_POSITION_SAME_NODE
public static final short TREE_POSITION_DISCONNECTED
public static final short DOCUMENT_POSITION_DISCONNECTED
public static final short DOCUMENT_POSITION_PRECEDING
public static final short DOCUMENT_POSITION_FOLLOWING
public static final short DOCUMENT_POSITION_CONTAINS
public static final short DOCUMENT_POSITION_IS_CONTAINED
public static final short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC
public static final short ELEMENT_DEFINITION_NODE
protected NodeImpl ownerNode
protected short flags
protected static final short READONLY
protected static final short SYNCDATA
protected static final short SYNCCHILDREN
protected static final short OWNED
protected static final short FIRSTCHILD
protected static final short SPECIFIED
protected static final short IGNORABLEWS
protected static final short HASSTRING
protected static final short NORMALIZED
protected static final short ID
| Constructor Detail |
protected NodeImpl(CoreDocumentImpl ownerDocument)
Every Node knows what Document it belongs to.
public NodeImpl()
| Method Detail |
public abstract short getNodeType()
getNodeType
in interface org.w3c.dom.Node
public abstract java.lang.String getNodeName()
getNodeName
in interface org.w3c.dom.Node
public java.lang.String getNodeValue() throws org.w3c.dom.DOMException
getNodeValue
in interface org.w3c.dom.Node
DOMException(DOMSTRING_SIZE_ERR)
- public void setNodeValue(java.lang.String x) throws org.w3c.dom.DOMException
setNodeValue
in interface org.w3c.dom.Node
DOMException(NO_MODIFICATION_ALLOWED_ERR)
- public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild) throws org.w3c.dom.DOMException
appendChild
in interface org.w3c.dom.Node
DOMException(HIERARCHY_REQUEST_ERR)
- if newChild is of a
type that shouldn't be a child of this node.DOMException(WRONG_DOCUMENT_ERR)
- if newChild has a
different owner document than we do.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- if this node is
read-only.
By default we do not accept any children, ParentNode overrides this.
,
ParentNode
public org.w3c.dom.Node cloneNode(boolean deep)
Note: since we never have any children deep is meaningless here, ParentNode overrides this behavior.
cloneNode
in interface org.w3c.dom.Node
Example: Cloning a Text node will copy both the node and the text it
contains.
Example: Cloning something that has children -- Element or Attr, for
example -- will _not_ clone those children unless a "deep clone"
has been requested. A shallow clone of an Attr node will yield an
empty Attr of the same name.
NOTE: Clones will always be read/write, even if the node being cloned
is read-only, to permit applications using only the DOM API to obtain
editable copies of locked portions of the tree.
public org.w3c.dom.Document getOwnerDocument()
getOwnerDocument
in interface org.w3c.dom.Node
protected int getNodeNumber()
public org.w3c.dom.Node getParentNode()
getParentNode
in interface org.w3c.dom.Node
public org.w3c.dom.Node getNextSibling()
getNextSibling
in interface org.w3c.dom.Node
public org.w3c.dom.Node getPreviousSibling()
getPreviousSibling
in interface org.w3c.dom.Node
public org.w3c.dom.NamedNodeMap getAttributes()
getAttributes
in interface org.w3c.dom.Node
ElementImpl
public boolean hasAttributes()
hasAttributes
in interface org.w3c.dom.Node
true
if this node has any attributes,
false
otherwise.ElementImpl
public boolean hasChildNodes()
By default we do not have any children, ParentNode overrides this.
hasChildNodes
in interface org.w3c.dom.Node
ParentNode
public org.w3c.dom.NodeList getChildNodes()
NodeLists are "live"; as children are added/removed the NodeList will immediately reflect those changes. Also, the NodeList refers to the actual nodes, so changes to those nodes made via the DOM tree will be reflected in the NodeList and vice versa.
In this implementation, Nodes implement the NodeList interface and provide their own getChildNodes() support. Other DOMs may solve this differently.
getChildNodes
in interface org.w3c.dom.Node
public org.w3c.dom.Node getFirstChild()
By default we do not have any children, ParentNode overrides this.
getFirstChild
in interface org.w3c.dom.Node
ParentNode
public org.w3c.dom.Node getLastChild()
By default we do not have any children, ParentNode overrides this.
getLastChild
in interface org.w3c.dom.Node
ParentNode
public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) throws org.w3c.dom.DOMException
By default we do not accept any children, ParentNode overrides this.
insertBefore
in interface org.w3c.dom.Node
newChild
- The Node to be moved to our subtree. As a
convenience feature, inserting a DocumentNode will instead insert
all its children.refChild
- Current child which newChild should be placed
immediately before. If refChild is null, the insertion occurs
after all existing Nodes, like appendChild().DOMException(HIERARCHY_REQUEST_ERR)
- if newChild is of a
type that shouldn't be a child of this node, or if newChild is an
ancestor of this node.DOMException(WRONG_DOCUMENT_ERR)
- if newChild has a
different owner document than we do.DOMException(NOT_FOUND_ERR)
- if refChild is not a child of
this node.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- if this node is
read-only.ParentNode
public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException
By default we do not have any children, ParentNode overrides this.
removeChild
in interface org.w3c.dom.Node
DOMException(NOT_FOUND_ERR)
- if oldChild is not a child of
this node.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- if this node is
read-only.ParentNode
public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException
By default we do not have any children, ParentNode overrides this.
replaceChild
in interface org.w3c.dom.Node
DOMException(HIERARCHY_REQUEST_ERR)
- if newChild is of a
type that shouldn't be a child of this node, or if newChild is
one of our ancestors.DOMException(WRONG_DOCUMENT_ERR)
- if newChild has a
different owner document than we do.DOMException(NOT_FOUND_ERR)
- if oldChild is not a child of
this node.DOMException(NO_MODIFICATION_ALLOWED_ERR)
- if this node is
read-only.ParentNode
public int getLength()
By default we do not have any children, ParentNode overrides this.
getLength
in interface org.w3c.dom.NodeList
ParentNode
public org.w3c.dom.Node item(int index)
By default we do not have any children, ParentNode overrides this.
item
in interface org.w3c.dom.NodeList
Index
- intParentNode
public void normalize()
Text
nodes in the full depth of the sub-tree
underneath this Node
, including attribute nodes, into a
"normal" form where only markup (e.g., tags, comments, processing
instructions, CDATA sections, and entity references) separates
Text
nodes, i.e., there are no adjacent Text
nodes. This can be used to ensure that the DOM view of a document is
the same as if it were saved and re-loaded, and is useful when
operations (such as XPointer lookups) that depend on a particular
document tree structure are to be used.In cases where the document
contains CDATASections
, the normalize operation alone may
not be sufficient, since XPointers do not differentiate between
Text
nodes and CDATASection
nodes.
Note that this implementation simply calls normalize() on this Node's children. It is up to implementors or Node to override normalize() to take action.
normalize
in interface org.w3c.dom.Node
public boolean isSupported(java.lang.String feature, java.lang.String version)
Tests whether the DOM implementation implements a specific feature and that feature is supported by this node.
isSupported
in interface org.w3c.dom.Node
feature
- The package name of the feature to test. This is the same
name as what can be passed to the method hasFeature on
DOMImplementation.version
- This is the version number of the package name to
test. In Level 2, version 1, this is the string "2.0". If the version is
not specified, supporting any version of the feature will cause the
method to return true.public java.lang.String getNamespaceURI()
The namespace URI of this node, or null if it is unspecified. When this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE, this is always null and setting it has no effect.
This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is null.
getNamespaceURI
in interface org.w3c.dom.Node
AttrNSImpl
,
ElementNSImpl
public java.lang.String getPrefix()
The namespace prefix of this node, or null if it is unspecified. When this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE this is always null and setting it has no effect.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is null.
getPrefix
in interface org.w3c.dom.Node
AttrNSImpl
,
ElementNSImpl
public void setPrefix(java.lang.String prefix) throws org.w3c.dom.DOMException
The namespace prefix of this node, or null if it is unspecified. When this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE this is always null and setting it has no effect.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is null.
Note that setting this attribute changes the nodeName attribute, which holds the qualified name, as well as the tagName and name attributes of the Element and Attr interfaces, when applicable.
setPrefix
in interface org.w3c.dom.Node
INVALID_CHARACTER_ERR
- Raised if the specified
prefix contains an invalid character.AttrNSImpl
,
ElementNSImpl
public java.lang.String getLocalName()
Returns the local part of the qualified name of this node. For nodes created with a DOM Level 1 method, such as createElement from the Document interface, and for nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE this is the same as the nodeName attribute.
getLocalName
in interface org.w3c.dom.Node
AttrNSImpl
,
ElementNSImpl
public void addEventListener(java.lang.String type, org.w3c.dom.events.EventListener listener, boolean useCapture)
org.w3c.dom.events.EventTarget
EventListener
is added to an
EventTarget
while it is processing an event, it will not
be triggered by the current actions but may be triggered during a
later stage of event flow, such as the bubbling phase.
EventListener
s are registered
on the same EventTarget
with the same parameters the
duplicate instances are discarded. They do not cause the
EventListener
to be called twice and since they are
discarded they do not need to be removed with the
removeEventListener
method.addEventListener
in interface org.w3c.dom.events.EventTarget
org.w3c.dom.events.EventTarget
type
- The event type for which the user is registeringlistener
- The listener
parameter takes an interface
implemented by the user which contains the methods to be called
when the event occurs.useCapture
- If true, useCapture
indicates that the
user wishes to initiate capture. After initiating capture, all
events of the specified type will be dispatched to the registered
EventListener
before being dispatched to any
EventTargets
beneath them in the tree. Events which
are bubbling upward through the tree will not trigger an
EventListener
designated to use capture.public void removeEventListener(java.lang.String type, org.w3c.dom.events.EventListener listener, boolean useCapture)
org.w3c.dom.events.EventTarget
EventListener
is removed from an
EventTarget
while it is processing an event, it will not
be triggered by the current actions. EventListener
s can
never be invoked after being removed.
removeEventListener
with arguments which do
not identify any currently registered EventListener
on
the EventTarget
has no effect.removeEventListener
in interface org.w3c.dom.events.EventTarget
org.w3c.dom.events.EventTarget
type
- Specifies the event type of the EventListener
being removed.listener
- The EventListener
parameter indicates the
EventListener
to be removed.useCapture
- Specifies whether the EventListener
being removed was registered as a capturing listener or not. If a
listener was registered twice, one with capture and one without,
each must be removed separately. Removal of a capturing listener
does not affect a non-capturing version of the same listener, and
vice versa.public boolean dispatchEvent(org.w3c.dom.events.Event event)
org.w3c.dom.events.EventTarget
EventTarget
on which dispatchEvent
is
called.dispatchEvent
in interface org.w3c.dom.events.EventTarget
org.w3c.dom.events.EventTarget
evt
- Specifies the event type, behavior, and contextual
information to be used in processing the event.dispatchEvent
indicates
whether any of the listeners which handled the event called
preventDefault
. If preventDefault
was
called the value is false, else the value is true.org.w3c.dom.events.EventException
- UNSPECIFIED_EVENT_TYPE_ERR: Raised if the Event
's type
was not specified by initializing the event before
dispatchEvent
was called. Specification of the
Event
's type as null
or an empty string
will also trigger this exception.public java.lang.String getBaseURI()
null
if undefined.
This value is computed according to . However, when the
Document
supports the feature "HTML" , the base URI is
computed using first the value of the href attribute of the HTML BASE
element if any, and the value of the documentURI
attribute from the Document
interface otherwise.
Element
, a Document
or a a ProcessingInstruction
, this attribute represents
the properties [base URI] defined in . When the node is a
Notation
, an Entity
, or an
EntityReference
, this attribute represents the
properties [declaration base URI] in the . How will this be affected
by resolution of relative namespace URIs issue?It's not.Should this
only be on Document, Element, ProcessingInstruction, Entity, and
Notation nodes, according to the infoset? If not, what is it equal to
on other nodes? Null? An empty string? I think it should be the
parent's.No.Should this be read-only and computed or and actual
read-write attribute?Read-only and computed (F2F 19 Jun 2000 and
teleconference 30 May 2001).If the base HTML element is not yet
attached to a document, does the insert change the Document.baseURI?
Yes. (F2F 26 Sep 2001)getBaseURI
in interface org.w3c.dom.Node
public short compareTreePosition(org.w3c.dom.Node other)
other
- The node to compare against this node.public short compareDocumentPosition(org.w3c.dom.Node other) throws org.w3c.dom.DOMException
compareDocumentPosition
in interface org.w3c.dom.Node
other
- The node to compare against this node.public java.lang.String getTextContent() throws org.w3c.dom.DOMException
Text
node containing the string
this attribute is set to. On getting, no serialization is performed,
the returned string does not contain any markup. No whitespace
normalization is performed, the returned string does not contain the
element content whitespaces . Similarly, on setting, no parsing is
performed either, the input string is taken as pure textual content.
| Node type | Content |
|---|
| Node type | Content |
|---|---|
| ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE | concatenation of the textContent
attribute value of every child node, excluding COMMENT_NODE and
PROCESSING_INSTRUCTION_NODE nodes |
| ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE |
nodeValue |
| DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE | null |
getTextContent
in interface org.w3c.dom.Node
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.org.w3c.dom.DOMException
- DOMSTRING_SIZE_ERR: Raised when it would return more characters than
fit in a DOMString
variable on the implementation
platform.public void setTextContent(java.lang.String textContent) throws org.w3c.dom.DOMException
Text
node containing the string
this attribute is set to. On getting, no serialization is performed,
the returned string does not contain any markup. No whitespace
normalization is performed, the returned string does not contain the
element content whitespaces . Similarly, on setting, no parsing is
performed either, the input string is taken as pure textual content.
| Node type | Content |
|---|---|
| ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE | concatenation of the textContent
attribute value of every child node, excluding COMMENT_NODE and
PROCESSING_INSTRUCTION_NODE nodes |
| ATTRIBUTE_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE |
nodeValue |
| DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE | null |
setTextContent
in interface org.w3c.dom.Node
org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.org.w3c.dom.DOMException
- DOMSTRING_SIZE_ERR: Raised when it would return more characters than
fit in a DOMString
variable on the implementation
platform.public boolean isSameNode(org.w3c.dom.Node other)
Node
references returned by the implementation reference
the same object. When two Node
references are references
to the same object, even if through a proxy, the references may be
used completely interchangably, such that all attributes have the
same values and calling the same DOM method on either reference
always has exactly the same effect.isSameNode
in interface org.w3c.dom.Node
other
- The node to test against.true
if the nodes are the same,
false
otherwise.public boolean isDefaultNamespace(java.lang.String namespaceURI)
namespaceURI
is the
default namespace or not.isDefaultNamespace
in interface org.w3c.dom.Node
namespaceURI
- The namespace URI to look for.true
if the specified namespaceURI
is the default namespace, false
otherwise.public java.lang.String lookupPrefix(java.lang.String namespaceURI)
lookupPrefix
in interface org.w3c.dom.Node
namespaceURI
- public java.lang.String lookupNamespaceURI(java.lang.String specifiedPrefix)
lookupNamespaceURI
in interface org.w3c.dom.Node
namespaceURI
- public boolean isEqualNode(org.w3c.dom.Node arg)
Node.isSameNode
. All nodes that are the same
will also be equal, though the reverse may not be true.
nodeName
, localName
,
namespaceURI
, prefix
, nodeValue
, baseURI
. This is: they are both null
, or
they have the same length and are character for character identical.
The attributes
NamedNodeMaps
are equal.
This is: they are both null
, or they have the same
length and for each node that exists in one map there is a node that
exists in the other map and is equal, although not necessarily at the
same index.The childNodes
NodeLists
are
equal. This is: they are both null
, or they have the
same length and contain equal nodes at the same index. This is true
for Attr
nodes as for any other type of node. Note that
normalization can affect equality; to avoid this, nodes should be
normalized before being compared.
DocumentType
nodes to be equal, the following
conditions must also be satisfied: The following string attributes
are equal: publicId
, systemId
,
internalSubset
.The entities
NamedNodeMaps
are equal.The notations
NamedNodeMaps
are equal.
ownerDocument
attribute, the specified
attribute for Attr
nodes, the
isWhitespaceInElementContent
attribute for
Text
nodes, as well as any user data or event listeners
registered on the nodes.isEqualNode
in interface org.w3c.dom.Node
arg
- The node to compare equality with.deep
- If true
, recursively compare the subtrees; if
false
, compare only the nodes themselves (and its
attributes, if it is an Element
).true
otherwise false
.public java.lang.Object getFeature(java.lang.String feature, java.lang.String version)
org.w3c.dom.Node
Node
interface.getFeature
in interface org.w3c.dom.Node
public java.lang.Object setUserData(java.lang.String key, java.lang.Object data, org.w3c.dom.UserDataHandler handler)
getUserData
with the
same key.setUserData
in interface org.w3c.dom.Node
key
- The key to associate the object to.data
- The object to associate to the given key, or
null
to remove any existing association to that key.handler
- The handler to associate to that key, or
null
.DOMObject
previously associated to
the given key on this node, or null
if there was none.public java.lang.Object getUserData(java.lang.String key)
setUserData
with the same key.getUserData
in interface org.w3c.dom.Node
key
- The key the object is associated to.DOMObject
associated to the given key
on this node, or null
if there was none.protected java.util.Hashtable getUserDataRecord()
public void setReadOnly(boolean readOnly, boolean deep)
Most DOM users should not touch this method. Its anticpated use is during construction of EntityRefernces, where it will be used to lock the contents replicated from Entity so they can't be casually altered. It _could_ be published as a DOM extension, if desired.
Note: since we never have any children deep is meaningless here, ParentNode overrides this behavior.
readOnly
- True or false as desired.deep
- If true, children are also toggled. Note that this will
not change the state of an EntityReference or its children,
which are always read-only.ParentNode
public boolean getReadOnly()
public void setUserData(java.lang.Object data)
Important Note: You are responsible for removing references to your data on nodes that are no longer used. Failure to do so will prevent the nodes, your data is attached to, to be garbage collected until the whole document is.
data
- the object to store or null to remove any existing referencepublic java.lang.Object getUserData()
protected void changed()
protected int changes()
protected void synchronizeData()
protected org.w3c.dom.Node getContainer()
public final void needsSyncChildren(boolean value)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Head Blacksmith Newyear:
Oh, come now. You've already gotten a fine set of Clan Academy armor from Blacksmith Pinter of Gludio.
(This quest is not available to characters who are engaged in the quest To Lead and Be Led.)


51.Ramaswamy, V. et al. Radiative forcing of climate change. In:
Climate Change 2001: The Scientific Basis. Contribution of Working Group I to the
Third Assessment Report of the Intergovernmental Panel on Climate Change(eds Houghton, J. T. et al.) Ch. 6 (Cambridge Unversity Press, Cambridge, United Kingdom
and New York, USA, 2001).


Theming is central to the philosophy of Uniform. We don’t want you to feel limited to just using the default style. You can design your own theme with our theme kit. Most of the CSS can be generated by editing a SCSS (a variant of SASS) file and then running make.
You can also download themes created by others. Here are some of our favorites:
| Uniform Default | by Josh Pyles | Download | |
| Aristo | by 280North / ported by Josh Pyles | Download | |
| Agent | by Collin Allen | Download |
Submit your theme by opening a new issue. We'll welcome the addition!
Have ideas for Uniform? Want to submit a bug fix or patch? We collaborate on Uniform on GitHub, and we welcome you to join us as well! Visit Uniform on GitHub.


Home Page
Home is a one-page template for building simple and beautiful home pages. Download, edit the text, and add your own fullscreen background photo to make it your own.
Home is a one-page template for building simple and beautiful home pages. Download, edit the text, and add your own fullscreen background photo to make it your own.


Samuel’s Hope
问题描述 :
Samuel only has the average data,Please use these figures to predicate ,if the total number reached or higher than the number is given,Samuel’s hope will come true.
输入:
The first line of the input is t,which represents the number of the test cases.
Each of the test cases only contains 2 parts:
The average data of a week p(the unit is million people), the expected year’s number q(the unit is million people too).Notice a year has only 52 weeks.
Each of the test cases only contains 2 parts:
The average data of a week p(the unit is million people), the expected year’s number q(the unit is million people too).Notice a year has only 52 weeks.
输出:
The first line of the input is t,which represents the number of the test cases.
Each of the test cases only contains 2 parts:
The average data of a week p(the unit is million people), the expected year’s number q(the unit is million people too).Notice a year has only 52 weeks.
Each of the test cases only contains 2 parts:
The average data of a week p(the unit is million people), the expected year’s number q(the unit is million people too).Notice a year has only 52 weeks.
样例输入:
3 3 151 2 105 4 208
样例输出:
Oh,Samuel's hope will come true,thanks to the DcSLs. Unfortunately,Samuel's hope will not come true,more tourists are welcomed! Oh,Samuel's hope will come true,thanks to the DcSLs.
(adsbygoogle = window.adsbygoogle || []).push({});
Great website…please visit the sites we follow, including this one, as it represents our picks from the web…
Great website…please visit the sites we follow, including this one, as it represents our picks from the web…
Great website…please visit the sites we follow, including this one, as it represents our picks from the web…
Great website…please visit the sites we follow, including this one, as it represents our picks from the web…
Great website…please visit the sites we follow, including this one, as it represents our picks from the web…
Great website…please visit the sites we follow, including this one, as it represents our picks from the web…
Great website…please visit the sites we follow, including this one, as it represents our picks from the web…
不错，赞一个！
很好的方法，学习了
第二种解法如果数组有重复元素 就不正确
博主您好，这是一个内容十分优秀的博客，而且界面也非常漂亮。但是为什么博客的响应速度这么慢，虽然博客的主机在国外，但是我开启VPN还是经常响应很久，再者打开某些页面经常会出现数据库连接出错的提示
aha, welcome!
有一点问题。。后面动态规划的程序中
int dp[n+1][W+1];
会报错 提示表达式必须含有常量值。该怎么修改呢。。
算法还停留在大学的知识中
有意思，有难度
博主的C++功底真是好
看见的晚了，只能提交一次唉
L（X [0 .. M-1]，Y [0 .. N-1]）= 1 + L（X [0 .. M-2]，Y [0 .. N-1]）这个地方也也有笔误
应改为L（X [0 .. M-1]，Y [0 .. N-1]）= 1 + L（X [0 .. M-2]，Y [0 .. N-2]）
好吧~
有没有C++编译的？
多谢支持！


Insuffient funds to launch new application {{.appname}}
Please make payment to your wallet
© Megam 2017 All rights reserved.


Print New coupons for your favorite brands. You received this email because you are a registered user of LOZO.com and you opted in to receive our money-saving newsletters.Be sure to add<EMAIL_ADDRESS>to your safe list, or http://lozo.com/unsubscription/aHVibGVlcGg2MDZAdHVtYmxyLmNvbQ==/1 from our newsletters in one click.
Hello!
http://lozo.com/grocery-coupons-bundler found by LOZO, including http://SavingStar.ojrq.net/c/14113/17146/758?subId1=newsletter&subId2=100214&subId3=7677090, and http://cpadna1.com/?E=bvSFkA9irffZAzQo9C7feSD0UUHHg7oy&s1=newsletter&s2=100214&s3=7677090
LOZO’s free service sends you personalized emails with links to coupons for your grocery list, PLUS this periodic newsletter with great coupons we found for everyone. Manage your list and email preferences in http://lozo.com/myaccount, or unsubscribe at the bottom of any email.
Today we’re featuring lots of http://lozo.com/grocery-coupons-bundler. Check back all week for updates & new offers.Remember to use these great time-saving LOZO features:
“Get Now” option: (on rollover) for quick access to 1,300+ coupons LOZO found
“Types of Coupons”: don’t want to sign up or use Facebook? Set your preferences here.
My Favorites menu (on the left side): see coupons for your list, in one click!
New September E-Coupons
Now redeem at supermarkets + Walmart, Target & more! http://SavingStar.ojrq.net/c/14113/17146/758?subId1=newsletter&subId2=100214&subId3=7677090.
http://lozo.com/grocery-coupons-bundler?idcoupons=25230&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25229&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=24982&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25104&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25107&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25108&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25093&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25094&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25100&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25111&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25230,25229,24896,24679,24680,24594,24331,24332,23794
New Coupons From Around the Web
LOZO found these; we’ll show you where and how to get them!
“Clip” for later or click “Get Now” to go right to each offer.http://lozo.com/grocery-coupons-bundler?idcoupons=25235&infodisplay=true - Target coupon
http://lozo.com/grocery-coupons-bundler?idcoupons=25232,25233
http://lozo.com/grocery-coupons-bundler?idcoupons=25200&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25214&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25151&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25138&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25213&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25205&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=25150&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=24766&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=24979&infodisplay=true
http://lozo.com/grocery-coupons-bundler?idcoupons=24967&infodisplay=true - facebook
http://lozo.com/grocery-coupons-bundler
New General Mills Coupons
Sign up with http://cpadna1.com/?E=MQzJyDFLJXFkhoklKwzsJyD0UUHHg7oy&s1=newsletter&s2=100214&s3=7677090 or http://cpadna1.com/?E=ZTb9%2b01WwmrCozmFcnMfGCD0UUHHg7oy&s1=newsletter&s2=100214&s3=7677090 to get access to these current offers and more each month:
$0.50 off Chex Mix&
$1.00 off Pillsbury&
$0.50 off Original Cheerios&
$0.40 off Yoplait&
$0.50 off Nature Valley&
$0.75 off Betty Crocker&
and many more!
http://cpadna1.com/?E=bvSFkA9irffZAzQo9C7feSD0UUHHg7oy&s1=newsletter&s2=100214&s3=7677090 and http://cpadna1.com/?E=ZTb9%2b01WwmrCozmFcnMfGCD0UUHHg7oy&s1=newsletter&s2=100214&s3=7677090
You save + help LOZO!
Save with a http://lozo.com/printcoupon/id/1584640/PB/ns and http://track.mysavingsmedia.net/click.track?CID=282785&AFID=301489&ADID=1197710&SID=newsletter,100214,7677090 for you or someone else who can use it. Print twice for extra savings!
By printing these coupon you’ll also be helping LOZO, enabling us to find more great offers and helping to keep our service completely free.
You can also help by signing up for extra free coupons: http://SavingStar.ojrq.net/c/14113/17146/758?subId1=newsletter&subId2=100214&subId3=7677090, http://cpadna1.com/?E=MQzJyDFLJXFkhoklKwzsJyD0UUHHg7oy&s1=newsletter&s2=100214&s3=7677090, http://cpadna1.com/?E=ZTb9%2b01WwmrCozmFcnMfGCD0UUHHg7oy&s1=newsletter&s2=100214&s3=7677090 & http://track.mysavingsmedia.net/click.track?CID=272013&AFID=301489&ADID=1105479&SID=newsletter,100214,7677090.
Thanks for letting us help you save!
http://lozo.com/myaccount section of LOZO.com.
Don’t want to receive this email any more? We’re sorry to see you go, but you can http://lozo.com/unsubscription/aHVibGVlcGg2MDZAdHVtYmxyLmNvbQ==/1.
http://lozo.com/unsubscription/aHVibGVlcGg2MDZAdHVtYmxyLmNvbQ== with one click from all LOZO emails.
<EMAIL_ADDRESS>or postal mail: P.O. Box 143, Chatham, NJ 07928


Toggle navigation
Skynet
About
Contact
Support
Email
Chat
Phone Support
Login
Sign In
Forgot password?
Remember me
Username & password don't match!
Login
Home
input
avatar the master of all sex positions.


Information Scan
Retrieve information about asset.
Check-In Scan
Check asset into location.
Shift Scan
Scan in and out of shift.


The Cobit Bitcoin Wallet is a Free Open Source Software project provided at no cost and is intended for use as is, without warranty of any kind. Use at your own risk.
Forked from the Copay wallet, originally developed by BitPay, Inc.
The MIT License (MIT)
Copyright (c) 2017 The Cobit Developers
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Not seeing a service you need? Ask away! We will gladly let you know if we can do something for you!
Tasks range from minor to major, and include painting, drywall repair, remodeling, minor plumbing work, minor electrical work, household carpentry, sheetrock, crown moulding, and furniture assembly


The weSTEM High School Conference is a collaborative, interdisciplinary, and locally engaged initiative,
designed to promote diversity and female presence in the STEM fields in and beyond the United Arab Emirates
by helping high school girls prepare for successful college studies and a career in STEM. Check out the video
from the 2019 conference here.
Four Annual Conference
We will soon be releasing the date of the Forth Annual weSTEM High School Conference. This conference
will focus on developing basic skill sets for girls who aspire to work in STEM. The conference
will consist of a series of sessions focusing on career development within the STEM field as well
as workshops that teach basic coding and lab-work, and a competition meant to encourage teamwork
and collaboration. Stay Tuned!
Vision/Mission Statement:
To create a generation of students in the UAE with the passion, motivation and tools to carry through more innovative, more meaningful and better developed scientific research.
We aim to provide the tools for ambitious students with the passion in STEM that will enable them to build stronger science and engineering projects to compete on an national, regional and an international level.
HIGH SCHOOL WORKSHOPS
The series of workshops aims to provide high school students with the tools necessary to better develop, manage and communicate scientific projects on a national, regional and an international level. Based on past experience, we have come to a number of topics we would like to address through these workshops:
ideation, research, documentation, presentation, communication, coordination, and networking.
These skills are not specific to the STEM field, yet they can be a determining factor between a merely good and a memorable, worthwhile project.


UReport Demo
Demo
Code
Download
UReport
Doc
Github
Reports
File
Database
#
Report Name
Updated Time
[[${iter.count}]]
[[${report.name}]]
2018-04-18 00:00:00
Preview
Design
Delete
Export
Print
PDF
Excel
Word
#
Report Name
Updated Time
[[${iter.count}]]
[[${report.name}]]
2018-04-18 00:00:00
Preview
Design
Delete
Export
Print
PDF
Excel
Word
Create New Report


{% extends "base.html"%}
{%block body%}
A system to automate part of the collaborative ontology development process. Given a repository with an owl file, OnToology will survey it and produce diagrams, a complete documentation and validation based on common pitfalls.
OnToology can handle OWL and RDFS vocabularies in RDF+XML and Turtle serialization.
1. Enter your repo as user/repo i.e. myuser/myrepo (it does not work with organizations at the moment).
2. You will be redirected to Github to authorize OnToology to access your repo.
3. Update your ontology and push.
4. OnToology will create pull request including generated files (documentation, diagrams and evaluation)
5. Merge the pull request created by OnToology
Syntax Checker: Now if your ontology contains a syntax error, it will show in the progress page
Smaller Screen Support: We made the interface more dynamic to adapt to smaller screens
New Interface: We changed the interface to improve the representation
New Logo: We got a new logo
Bigger Server: We moved to the production server
| Repository | Status | Last used |
| {{r.url}} | {{r.state}} | {{r.last_used}} |


--- layout: landing title: Asylo --- {% include home.html %}
The Asylo framework hides the complexity of the underlying technology with an enclave backend abstraction layer.
Asylo provides a familiar POSIX model of application development without sacrificing security or bloating your trusted computing base.
Asylo integrates with gRPC for easy and secure inter-enclave and external communication.
Use attestation to verify your enclave's integrity, and cryptographically bind your secrets to identity ACLs for safe storage.
Get started with Asylo via our quickstart guide or our Qwiklabs exercises.
QUICKSTART QWIKLABS


pyglet 1.1 introduces new features that make it easier to program with, so the standard practice as followed in many of the pyglet example programs has changed.
In pyglet 1.0, it was necessary to explicitly import each submodule required by the application; for example:
from pyglet import font from pyglet import image from pyglet import window
pyglet now lazily loads submodules on demand, so an application can get away with importing just pyglet. This is especially handy for modules that are typically only used once in an application, and frees up the names font, image, window and so on for the application developer. For example:
window = pyglet.window.Window()
Every application using pyglet 1.0 provides its own event loop, such as:
while not window.has_exit: dt = clock.tick() update(dt) window.dispatch_events() window.clear() draw() window.flip()
Besides being somewhat repetitious to type, this type of event loop is difficult to extend with more windows, and exausts all available system resources, even if the application is not doing anything.
The new pyglet.app module provides an application event loop that is less demanding of the CPU yet more responsive to user events. A complete application that opens an empty window can be written with:
window = pyglet.window.Window() @window.event def on_draw(): window.clear() pyglet.app.run()
Note the new on_draw event, which makes it easy to specify different drawing functions for each window. The pyglet.app event loop takes care of dispatching events, ticking the clock, calling the draw function and flipping the window buffer.
Update functions can be scheduled on the clock. To have an update function be called as often as possible, use clock.schedule (this effectively degenerates into the older dispatch_events practice of thrashing the CPU):
def update(dt): pass clock.schedule(update)
Usually applications can update at a less frequent interval. For example, a game that is designed to run at 60Hz can use clock.schedule_interval:
def update(dt): pass clock.schedule_interval(update, 1/60.0)
This also removes the need for clock.set_fps_limit.
Besides the advantages already listed, windows managed by the event loop will not block while being resized or moved; and the menu bar on OS X can be interacted with without blocking the application.
It is highly recommended that all applications use the event loop. The loop can be extended if you need to add additional hooks or integrate with another package. Applications continuing to use Window.dispatch_events gain no advantage, but suffer from poorer response, increased CPU usage and artifacts during window resizing and moving.
See The application event loop for more details.
Locating resources such as images, sound and video files, data files and fonts is difficult to do correctly across all platforms, considering the effects of a changing working directory and various distribution packages such as setuptools, py2exe and py2app.
The new pyglet.resource module implements the correct logic for all these cases, making it simple to load resources that belong to a specific module or the application as a whole. A resource path can be set that is indexed once, and can include filesystem directories, Python module paths and ZIP files.
For example, suppose your application ships with a logo.png that needs to be loaded on startup. In pyglet 1.0 you might have written:
import os.path from pyglet import image script_dir = os.path.dirname(__file__) logo_filename = os.path.join(script_dir, 'logo.png') logo = image.load(logo_filename)
In pyglet 1.1, you can write:
logo = pyglet.resource.image('logo.png')
And will actually work in more scenarios (such as within a setuptools egg file, py2exe and py2app).
The resource module efficiently packs multiple small images into larger textures, so there is less need for artists to create sprite sheets themselves for efficient rendering. Images and textures are also cached automatically.
See Application resources for more details.


This inspection reports unnecessary def
keyword when it is used with explicit type declaration.
def boolean foo() {} // keyword is unnecessary def Object bar // keyword is unnecessary def (int a, String b) = [] // keyword is needed and therefore not highlighted


Distancing module¶
This module contains functions that act on the output images of the trained CNN to carry out centriole distancing.
-
distancing.
associate_peaks2centre_single
(cnn_peaks, cnn_centre, dist_thresh=10, ratio_thresh=3)[source]¶ Uses separation centre in order to return the 1 or 2 most likely centriole positions in the local patch.
Parameters: - cnn_peaks : numpy array or list
array of (y,x) coordinates of potential centriole centroids.
- cnn_centre : 2-tuple
the coordinate of the separation centre of the centroid pair.
- dist_thresh : float
two peaks separated by a distance > dist_thresh is unlikely to be mother-daughter centriole pairs. units are pixels
- ratio_thresh : float
ratio of less intense over more intense centriole in a pair, < ratio_thresh, the pair is designated not similar in pixel intensity and only the brighter centriole is returned.
Returns: - cnn_peaks_filt : numpy array
(y,x) coordinates of the individual detected centriole centroids.
-
distancing.
detect_2d_peaks
(img, I_img, min_distance=1, filt=True, thresh=None)[source]¶ Identify the centroids in the CNN predicted output images and return detected positions and intensity statistics.
Parameters: - img : numpy array
the CNN output probability image
- I_img : numpy array
the raw gray-image
- min_distance : float
minimum separation distance between centroids in number of pixels.
- filt : bool
if True, consider only peaks in the CNN output that have intensity >= thresh. If False, we use a small fixed threshold of 1e-6.
- thresh : None or float
if float, a constant threshold is used else Otsu thresholding is use to automatically set an intensity threshold.
Returns: - n_peaks_raw : int
Number of peaks detected without applying any intensity threshold.
- filt_peaks : array-like
result array of (y,x,I) tuple of (y,x) centroid locations and associated raw pixel intensity at (y,x). If no peak is detected an empty list [] is returned.
-
distancing.
detect_2d_peaks_stack
(img_stack, I_img_stack, min_distance=1, filt=True, thresh=None)[source]¶ Wrapper for
detect_2d_peaks()
extending it to work on a stack of input images.Parameters: - img_stack : numpy array
array of the CNN output probability images
- I_img_stack : numpy array
array of raw gray-images
- min_distance : float
minimum separation distance between centroids in number of pixels.
- filt : bool
if True, consider only peaks in the CNN output that have intensity >= thresh. If False, we use a small fixed threshold of 1e-6.
- thresh : None or float
if float, a constant threshold is used else Otsu thresholding is use to automatically set an intensity threshold.
Returns: - all_n_peaks_raw : int
Number of peaks detected without applying any intensity threshold.
- all_filt_peaks : array-like
result array of (y,x,I) tuple of (y,x) centroid locations and associated raw pixel intensity at (y,x). If no peak is detected an empty list [] is returned.
-
distancing.
fitGMM_patch_post_process
(centre_patch_intensity, n_samples=1000, max_dist_thresh=10, min_area_pair=0, max_area_pair=10000)[source]¶ Fits an n-component mixture to a 2d image to resolve closely overlapping centroids
This function simplifies the calling and wraps fit_2dGMM so we directly give the input image.
Parameters: - centre_patch_intensity : numpy array
input gray-image
- n_samples : int
the maximum number of samples to draw if the corresponding normalised image intensity was 1.
- max_dist_thresh : int
the upper bound on the expected distance if it was a true pair.
Returns: - filt_peaks : 3-tuple
returns the resolved centriole peak positions for distancing.
-
distancing.
fit_2dGMM
(samples_x, samples_y, n_components=2)[source]¶ Fit an n-component mixture to the 2d image to resolve closely overlapping centroids given (x,y) image coordinate samples
samples_x and samples_y should be of same array length.
Parameters: - samples_x : numpy array
array of x-coordinates.
- samples_y : numpy array
array of y-coordinates.
- n_components : int
the number of Gaussian mixture components to fit, default is 2 to resolve the centriole pair.
Returns: - gmm_params : 3-tuple
Returns the fitted parameters in the mixture namely (weights, means, covariance matrices)
- prob_samples : numpy array
- posterior probability of each sample belonging to each component.
input shape : (n_samples, 2) output shape : (n_samples, n_components)
- gmm : Scikit-learn GMM model instance
fitted Scikit-learn GMM model.
-
distancing.
img2histogram_samples
(img, thresh=0.1, samples=20)[source]¶ Efficient sampling of the (x,y) image coordinate pairs proportional to the corresponding pixel intensity.
Parameters: - img : numpy array
(n_rows x n_cols) gray-image
- thresh : float
minimum threshold below which we set all intensity to 0 to avoid sampling very low intensities.
- samples : int
the maximum number of times, a position (x,y) is sampled if I(x,y) = 1 that is maximum intensity
Returns: - xy_samples : numpy array
array of (x,y) coordinates whose distribution, where is the corresponding (normalised) pixel intensity at (x,y).
-
distancing.
predict_centrioles_CNN_GMM
(imstack, cnnstack, min_distance=1, filt=True, p_thresh=None, dist_thresh=15, ratio_thresh=4, nsamples_GMM=1000, max_dist_thresh_GMM=10)[source]¶ Wrapper function to take the input image stack and the predicted CNN output image stack and return distances.
Parameters: - imstack : numpy array
array of input images for distancing.
- cnnstack : numpy array
array of CNN output probability images.
- min_distance : float
minimum separation distance between detected centroids in number of pixels.
- filt : bool
if True, consider only peaks in the CNN output that have intensity >= p_thresh. If False, we use a small fixed threshold of 1e-6.
- p_thresh : None or float
minimum intensity threshold to filter detected peaks in CNN output. If None uses a threshold derived from Otsu’s thresholding
- dist_thresh : None or float
the upper bound on the expected distance if it was a true pair.
- ratio_thresh : float
ratio of more intense over less intense centriole in a pair, > ratio_thresh, the pair is designated not similar in pixel intensity and only the brighter centriole is returned.
- nsamples_GMM :
- max_dist_thresh_GMM :
Returns: - distances : array
list of [(y,x), d] list of detected (y,x) centroids and distance between the detected positions for each image. Returns empty array [] if no peaks are present.


Atoms.js Library ships with many standard ready to use controls that is sufficient to create any business application quickly. Most controls are quite similar as those were available in Adobe Flex. However, functionality and usage may be little different as only the user experience to that of flex is similar but underlying functionality is totally different.
Each control has various properties, and properties must be bound to other properties or data for control to work properly. Atoms.js is designed to use more markup, so knowledge of properties will help you in writing better markup. Properties are usually get_ and set_ methods on the control class. While there are other patterns, we have decided to keep property names to be specifically start with get_ and set_ so that the end javascript can run on any browser and any implementation of javascript. Binding framework automatically identifies which are control properties and which are data properties. Data properties are just member of an object, where else control properties are methods.
Each class contains set of templates, for example AtomItemsControl contains ItemTemplate, which is used to represent view of single item in the items array. Templates are used to create items on the go, they also help you customize the look and feel of the items.
Every control adds some styles to its own element and child elements to maintain the look and feel. Atoms.js generally do not modify layout. Most of the time we rely to do our work through CSS only. However, AtomDockPanel, AtomViewStack are exceptions, these are only two controls that manages layout in javascript.
HTML events are basic events supported by browser. They are executed little differently, as specified in Concepts section.