Actors
The Actor Model provides a higher level of abstraction for writing concurrent and distributed systems. It alleviates the developer from having to deal with explicit locking and thread management, making it easier to write correct concurrent and parallel systems. Actors were defined in the 1973 paper by Carl Hewitt but have been popularized by the Erlang language, and used for example at Ericsson with great success to build highly concurrent and reliable telecom systems.
The API of Akka’s Actors is similar to Scala Actors which has borrowed some of its syntax from Erlang.
Creating Actors
Note
Since Akka enforces parental supervision every actor is supervised and (potentially) the supervisor of its children, it is advisable that you familiarize yourself with Actor Systems and Supervision and Monitoring and it may also help to read Actor References, Paths and Addresses.
Defining an Actor class
Actors are implemented by extending the Actor base trait and implementing the receive method. The receive method should define a series of case statements (which has the type PartialFunction[Any, Unit]) that defines which messages your Actor can handle, using standard Scala pattern matching, along with the implementation of how the messages should be processed.
Here is an example:
import akka.actor.Actor
import akka.actor.Props
import akka.event.Logging
class MyActor extends Actor {
val log = Logging(context.system, this)
def receive = {
case "test" => log.info("received test")
case _ => log.info("received unknown message")
}
}
Please note that the Akka Actor receive message loop is exhaustive, which is different compared to Erlang and the late Scala Actors. This means that you need to provide a pattern match for all messages that it can accept and if you want to be able to handle unknown messages then you need to have a default case as in the example above. Otherwise an akka.actor.UnhandledMessage(message, sender, recipient) will be published to the ActorSystem's EventStream.
Note further that the return type of the behavior defined above is Unit; if the actor shall reply to the received message then this must be done explicitly as explained below.
The result of the receive method is a partial function object, which is stored within the actor as its “initial behavior”, see Become/Unbecome for further information on changing the behavior of an actor after its construction.
Props
Props is a configuration class to specify options for the creation of actors, think of it as an immutable and thus freely shareable recipe for creating an actor including associated deployment information (e.g. which dispatcher to use, see more below). Here are some examples of how to create a Props instance.
import akka.actor.Props
val props1 = Props[MyActor]
val props2 = Props(new ActorWithArgs("arg")) // careful, see below
val props3 = Props(classOf[ActorWithArgs], "arg") // no support for value class arguments
The second variant shows how to pass constructor arguments to the Actor being created, but it should only be used outside of actors as explained below.
The last line shows a possibility to pass constructor arguments regardless of the context it is being used in. The presence of a matching constructor is verified during construction of the Props object, resulting in an IllegalArgumentException if no or multiple matching constructors are found.
Note
The recommended approach to create the actor Props is not supported for cases when the actor constructor takes value classes as arguments.
Dangerous Variants
// NOT RECOMMENDED within another actor:
// encourages to close over enclosing class
val props7 = Props(new MyActor)
This method is not recommended to be used within another actor because it encourages to close over the enclosing scope, resulting in non-serializable Props and possibly race conditions (breaking the actor encapsulation). We will provide a macro-based solution in a future release which allows similar syntax without the headaches, at which point this variant will be properly deprecated. On the other hand using this variant in a Props factory in the actor’s companion object as documented under “Recommended Practices” below is completely fine.
There were two use-cases for these methods: passing constructor arguments to the actor—which is solved by the newly introduced Props.apply(clazz, args) method above or the recommended practice below—and creating actors “on the spot” as anonymous classes. The latter should be solved by making these actors named classes instead (if they are not declared within a top-level object then the enclosing instance’s this reference needs to be passed as the first argument).
Warning
Declaring one actor within another is very dangerous and breaks actor encapsulation. Never pass an actor’s this reference into Props!
Edge cases
There are two edge cases in actor creation with Props:
- An actor with AnyVal arguments.
case class MyValueClass(v: Int) extends AnyVal
class ValueActor(value: MyValueClass) extends Actor {
def receive = {
case multiplier: Long => sender() ! (value.v * multiplier)
}
}
val valueClassProp = Props(classOf[ValueActor], MyValueClass(5)) // Unsupported
- An actor with default constructor values.
class DefaultValueActor(a: Int, b: Int = 5) extends Actor {
def receive = {
case x: Int => sender() ! ((a + x) * b)
}
}
val defaultValueProp1 = Props(classOf[DefaultValueActor], 2.0) // Unsupported
class DefaultValueActor2(b: Int = 5) extends Actor {
def receive = {
case x: Int => sender() ! (x * b)
}
}
val defaultValueProp2 = Props[DefaultValueActor2] // Unsupported
val defaultValueProp3 = Props(classOf[DefaultValueActor2]) // Unsupported
In both cases an IllegalArgumentException will be thrown stating no matching constructor could be found.
The next section explains the recommended ways to create Actor props in a way, which simultaneously safe-guards against these edge cases.
Recommended Practices
It is a good idea to provide factory methods on the companion object of each Actor which help keeping the creation of suitable Props as close to the actor definition as possible. This also avoids the pitfalls associated with using the Props.apply(...) method which takes a by-name argument, since within a companion object the given code block will not retain a reference to its enclosing scope:
object DemoActor {
/**
* Create Props for an actor of this type.
*
* @param magicNumber The magic number to be passed to this actor’s constructor.
* @return a Props for creating this actor, which can then be further configured
* (e.g. calling `.withDispatcher()` on it)
*/
def props(magicNumber: Int): Props = Props(new DemoActor(magicNumber))
}
class DemoActor(magicNumber: Int) extends Actor {
def receive = {
case x: Int => sender() ! (x + magicNumber)
}
}
class SomeOtherActor extends Actor {
// Props(new DemoActor(42)) would not be safe
context.actorOf(DemoActor.props(42), "demo")
// ...
}
Another good practice is to declare what messages an Actor can receive in the companion object of the Actor, which makes easier to know what it can receive:
object MyActor {
case class Greeting(from: String)
case object Goodbye
}
class MyActor extends Actor with ActorLogging {
import MyActor._
def receive = {
case Greeting(greeter) => log.info(s"I was greeted by $greeter.")
case Goodbye => log.info("Someone said goodbye to me.")
}
}
Creating Actors with Props
Actors are created by passing a Props instance into the actorOf factory method which is available on ActorSystem and ActorContext.
import akka.actor.ActorSystem
// ActorSystem is a heavy object: create only one per application
val system = ActorSystem("mySystem")
val myActor = system.actorOf(Props[MyActor], "myactor2")
Using the ActorSystem will create top-level actors, supervised by the actor system’s provided guardian actor, while using an actor’s context will create a child actor.
class FirstActor extends Actor {
val child = context.actorOf(Props[MyActor], name = "myChild")
// plus some behavior ...
}
It is recommended to create a hierarchy of children, grand-children and so on such that it fits the logical failure-handling structure of the application, see Actor Systems.
The call to actorOf returns an instance of ActorRef. This is a handle to the actor instance and the only way to interact with it. The ActorRef is immutable and has a one to one relationship with the Actor it represents. The ActorRef is also serializable and network-aware. This means that you can serialize it, send it over the wire and use it on a remote host and it will still be representing the same Actor on the original node, across the network.
The name parameter is optional, but you should preferably name your actors, since that is used in log messages and for identifying actors. The name must not be empty or start with $, but it may contain URL encoded characters (eg. %20 for a blank space). If the given name is already in use by another child to the same parent an InvalidActorNameException is thrown.
Actors are automatically started asynchronously when created.
Value classes as constructor arguments
The recommended way to instantiate actor props uses reflection at runtime to determine the correct actor constructor to be invoked and due to technical limitations is not supported when said constructor takes arguments that are value classes. In these cases you should either unpack the arguments or create the props by calling the constructor manually:
class Argument(val value: String) extends AnyVal
class ValueClassActor(arg: Argument) extends Actor {
def receive = { case _ => () }
}
object ValueClassActor {
def props1(arg: Argument) = Props(classOf[ValueClassActor], arg) // fails at runtime
def props2(arg: Argument) = Props(classOf[ValueClassActor], arg.value) // ok
def props3(arg: Argument) = Props(new ValueClassActor(arg)) // ok
}
Dependency Injection
If your Actor has a constructor that takes parameters then those need to be part of the Props as well, as described above. But there are cases when a factory method must be used, for example when the actual constructor arguments are determined by a dependency injection framework.
import akka.actor.IndirectActorProducer
class DependencyInjector(applicationContext: AnyRef, beanName: String)
extends IndirectActorProducer {
override def actorClass = classOf[Actor]
override def produce =
// obtain fresh Actor instance from DI framework ...
}
val actorRef = system.actorOf(
Props(classOf[DependencyInjector], applicationContext, "hello"),
"helloBean")
Warning
You might be tempted at times to offer an IndirectActorProducer which always returns the same instance, e.g. by using a lazy val. This is not supported, as it goes against the meaning of an actor restart, which is described here: What Restarting Means.
When using a dependency injection framework, actor beans MUST NOT have singleton scope.
Techniques for dependency injection and integration with dependency injection frameworks are described in more depth in the Using Akka with Dependency Injection guideline and the Akka Java Spring tutorial in Lightbend Activator.
The Inbox
When writing code outside of actors which shall communicate with actors, the ask pattern can be a solution (see below), but there are two things it cannot do: receiving multiple replies (e.g. by subscribing an ActorRef to a notification service) and watching other actors’ lifecycle. For these purposes there is the Inbox class:
implicit val i = inbox()
echo ! "hello"
i.receive() should ===("hello")
There is an implicit conversion from inbox to actor reference which means that in this example the sender reference will be that of the actor hidden away within the inbox. This allows the reply to be received on the last line. Watching an actor is quite simple as well:
val target = // some actor
val i = inbox()
i watch target
Actor API
The Actor trait defines only one abstract method, the above mentioned receive, which implements the behavior of the actor.
If the current actor behavior does not match a received message, unhandled is called, which by default publishes an akka.actor.UnhandledMessage(message, sender, recipient) on the actor system’s event stream (set configuration item akka.actor.debug.unhandled to on to have them converted into actual Debug messages).
In addition, it offers:
self reference to the ActorRef of the actor
sender reference sender Actor of the last received message, typically used as described in Reply to messages
supervisorStrategy user overridable definition the strategy to use for supervising child actors
This strategy is typically declared inside the actor in order to have access to the actor’s internal state within the decider function: since failure is communicated as a message sent to the supervisor and processed like other messages (albeit outside of the normal behavior), all values and variables within the actor are available, as is the sender reference (which will be the immediate child reporting the failure; if the original failure occurred within a distant descendant it is still reported one level up at a time).
context exposes contextual information for the actor and the current message, such as:
- factory methods to create child actors (actorOf)
- system that the actor belongs to
- parent supervisor
- supervised children
- lifecycle monitoring
- hotswap behavior stack as described in Become/Unbecome
You can import the members in the context to avoid prefixing access with context.
class FirstActor extends Actor {
import context._
val myActor = actorOf(Props[MyActor], name = "myactor")
def receive = {
case x => myActor ! x
}
}
The remaining visible methods are user-overridable life-cycle hooks which are described in the following:
def preStart(): Unit = ()
def postStop(): Unit = ()
def preRestart(reason: Throwable, message: Option[Any]): Unit = {
context.children foreach { child ⇒
context.unwatch(child)
context.stop(child)
}
postStop()
}
def postRestart(reason: Throwable): Unit = {
preStart()
}
The implementations shown above are the defaults provided by the Actor trait.
Actor Lifecycle
A path in an actor system represents a "place" which might be occupied by a living actor. Initially (apart from system initialized actors) a path is empty. When actorOf() is called it assigns an incarnation of the actor described by the passed Props to the given path. An actor incarnation is identified by the path and a UID. A restart only swaps the Actor instance defined by the Props but the incarnation and hence the UID remains the same.
The lifecycle of an incarnation ends when the actor is stopped. At that point the appropriate lifecycle events are called and watching actors are notified of the termination. After the incarnation is stopped, the path can be reused again by creating an actor with actorOf(). In this case the name of the new incarnation will be the same as the previous one but the UIDs will differ. An actor can be stopped by the actor itself, another actor or the ActorSystem (see Stopping actors).
Note
It is important to note that Actors do not stop automatically when no longer referenced, every Actor that is created must also explicitly be destroyed. The only simplification is that stopping a parent Actor will also recursively stop all the child Actors that this parent has created.
An ActorRef always represents an incarnation (path and UID) not just a given path. Therefore if an actor is stopped and a new one with the same name is created an ActorRef of the old incarnation will not point to the new one.
ActorSelection on the other hand points to the path (or multiple paths if wildcards are used) and is completely oblivious to which incarnation is currently occupying it. ActorSelection cannot be watched for this reason. It is possible to resolve the current incarnation's ActorRef living under the path by sending an Identify message to the ActorSelection which will be replied to with an ActorIdentity containing the correct reference (see Identifying Actors via Actor Selection). This can also be done with the resolveOne method of the ActorSelection, which returns a Future of the matching ActorRef.
Lifecycle Monitoring aka DeathWatch
In order to be notified when another actor terminates (i.e. stops permanently, not temporary failure and restart), an actor may register itself for reception of the Terminated message dispatched by the other actor upon termination (see Stopping Actors). This service is provided by the DeathWatch component of the actor system.
Registering a monitor is easy:
import akka.actor.{ Actor, Props, Terminated }
class WatchActor extends Actor {
val child = context.actorOf(Props.empty, "child")
context.watch(child) // <-- this is the only call needed for registration
var lastSender = context.system.deadLetters
def receive = {
case "kill" =>
context.stop(child); lastSender = sender()
case Terminated(`child`) => lastSender ! "finished"
}
}
It should be noted that the Terminated message is generated independent of the order in which registration and termination occur. In particular, the watching actor will receive a Terminated message even if the watched actor has already been terminated at the time of registration.
Registering multiple times does not necessarily lead to multiple messages being generated, but there is no guarantee that only exactly one such message is received: if termination of the watched actor has generated and queued the message, and another registration is done before this message has been processed, then a second message will be queued, because registering for monitoring of an already terminated actor leads to the immediate generation of the Terminated message.
It is also possible to deregister from watching another actor’s liveliness using context.unwatch(target). This works even if the Terminated message has already been enqueued in the mailbox; after calling unwatch no Terminated message for that actor will be processed anymore.
Start Hook
Right after starting the actor, its preStart method is invoked.
override def preStart() {
child = context.actorOf(Props[MyActor], "child")
}
This method is called when the actor is first created. During restarts it is called by the default implementation of postRestart, which means that by overriding that method you can choose whether the initialization code in this method is called only exactly once for this actor or for every restart. Initialization code which is part of the actor’s constructor will always be called when an instance of the actor class is created, which happens at every restart.
Restart Hooks
All actors are supervised, i.e. linked to another actor with a fault handling strategy. Actors may be restarted in case an exception is thrown while processing a message (see Supervision and Monitoring). This restart involves the hooks mentioned above:
The old actor is informed by calling preRestart with the exception which caused the restart and the message which triggered that exception; the latter may be None if the restart was not caused by processing a message, e.g. when a supervisor does not trap the exception and is restarted in turn by its supervisor, or if an actor is restarted due to a sibling’s failure. If the message is available, then that message’s sender is also accessible in the usual way (i.e. by calling sender).
This method is the best place for cleaning up, preparing hand-over to the fresh actor instance, etc. By default it stops all children and calls postStop.
The initial factory from the actorOf call is used to produce the fresh instance.
The new actor’s postRestart method is invoked with the exception which caused the restart. By default the preStart is called, just as in the normal start-up case.
An actor restart replaces only the actual actor object; the contents of the mailbox is unaffected by the restart, so processing of messages will resume after the postRestart hook returns. The message that triggered the exception will not be received again. Any message sent to an actor while it is being restarted will be queued to its mailbox as usual.
Warning
Be aware that the ordering of failure notifications relative to user messages is not deterministic. In particular, a parent might restart its child before it has processed the last messages sent by the child before the failure. See Discussion: Message Ordering for details.
Stop Hook
After stopping an actor, its postStop hook is called, which may be used e.g. for deregistering this actor from other services. This hook is guaranteed to run after message queuing has been disabled for this actor, i.e. messages sent to a stopped actor will be redirected to the deadLetters of the ActorSystem.
Identifying Actors via Actor Selection
As described in Actor References, Paths and Addresses, each actor has a unique logical path, which is obtained by following the chain of actors from child to parent until reaching the root of the actor system, and it has a physical path, which may differ if the supervision chain includes any remote supervisors. These paths are used by the system to look up actors, e.g. when a remote message is received and the recipient is searched, but they are also useful more directly: actors may look up other actors by specifying absolute or relative paths—logical or physical—and receive back an ActorSelection with the result:
// will look up this absolute path
context.actorSelection("/user/serviceA/aggregator")
// will look up sibling beneath same supervisor
context.actorSelection("../joe")
Note
It is always preferable to communicate with other Actors using their ActorRef instead of relying upon ActorSelection. Exceptions are
- sending messages using the At-Least-Once Delivery facility
- initiating first contact with a remote system
In all other cases ActorRefs can be provided during Actor creation or initialization, passing them from parent to child or introducing Actors by sending their ActorRefs to other Actors within messages.
The supplied path is parsed as a java.net.URI, which basically means that it is split on / into path elements. If the path starts with /, it is absolute and the look-up starts at the root guardian (which is the parent of "/user"); otherwise it starts at the current actor. If a path element equals .., the look-up will take a step “up” towards the supervisor of the currently traversed actor, otherwise it will step “down” to the named child. It should be noted that the .. in actor paths here always means the logical structure, i.e. the supervisor.
The path elements of an actor selection may contain wildcard patterns allowing for broadcasting of messages to that section:
// will look all children to serviceB with names starting with worker
context.actorSelection("/user/serviceB/worker*")
// will look up all siblings beneath same supervisor
context.actorSelection("../*")
Messages can be sent via the ActorSelection and the path of the ActorSelection is looked up when delivering each message. If the selection does not match any actors the message will be dropped.
To acquire an ActorRef for an ActorSelection you need to send a message to the selection and use the sender() reference of the reply from the actor. There is a built-in Identify message that all Actors will understand and automatically reply to with a ActorIdentity message containing the ActorRef. This message is handled specially by the actors which are traversed in the sense that if a concrete name lookup fails (i.e. a non-wildcard path element does not correspond to a live actor) then a negative result is generated. Please note that this does not mean that delivery of that reply is guaranteed, it still is a normal message.
import akka.actor.{ Actor, Props, Identify, ActorIdentity, Terminated }
class Follower extends Actor {
val identifyId = 1
context.actorSelection("/user/another") ! Identify(identifyId)
def receive = {
case ActorIdentity(`identifyId`, Some(ref)) =>
context.watch(ref)
context.become(active(ref))
case ActorIdentity(`identifyId`, None) => context.stop(self)
}
def active(another: ActorRef): Actor.Receive = {
case Terminated(`another`) => context.stop(self)
}
}
You can also acquire an ActorRef for an ActorSelection with the resolveOne method of the ActorSelection. It returns a Future of the matching ActorRef if such an actor exists. It is completed with failure [[akka.actor.ActorNotFound]] if no such actor exists or the identification didn't complete within the supplied timeout.
Remote actor addresses may also be looked up, if remoting is enabled:
context.actorSelection("akka.tcp://app@otherhost:1234/user/serviceB")
An example demonstrating actor look-up is given in Remoting Sample.
Messages and immutability
IMPORTANT: Messages can be any kind of object but have to be immutable. Scala can’t enforce immutability (yet) so this has to be by convention. Primitives like String, Int, Boolean are always immutable. Apart from these the recommended approach is to use Scala case classes which are immutable (if you don’t explicitly expose the state) and works great with pattern matching at the receiver side.
Here is an example:
// define the case class
case class Register(user: User)
// create a new case class message
val message = Register(user)
Send messages
Messages are sent to an Actor through one of the following methods.
- ! means “fire-and-forget”, e.g. send a message asynchronously and return immediately. Also known as tell.
- ? sends a message asynchronously and returns a Future representing a possible reply. Also known as ask.
Message ordering is guaranteed on a per-sender basis.
Note
There are performance implications of using ask since something needs to keep track of when it times out, there needs to be something that bridges a Promise into an ActorRef and it also needs to be reachable through remoting. So always prefer tell for performance, and only ask if you must.
Tell: Fire-forget
This is the preferred way of sending messages. No blocking waiting for a message. This gives the best concurrency and scalability characteristics.
actorRef ! message
If invoked from within an Actor, then the sending actor reference will be implicitly passed along with the message and available to the receiving Actor in its sender(): ActorRef member method. The target actor can use this to reply to the original sender, by using sender() ! replyMsg.
If invoked from an instance that is not an Actor the sender will be deadLetters actor reference by default.
Ask: Send-And-Receive-Future
The ask pattern involves actors as well as futures, hence it is offered as a use pattern rather than a method on ActorRef:
import akka.pattern.{ ask, pipe }
import system.dispatcher // The ExecutionContext that will be used
final case class Result(x: Int, s: String, d: Double)
case object Request
implicit val timeout = Timeout(5 seconds) // needed for `?` below
val f: Future[Result] =
for {
x <- ask(actorA, Request).mapTo[Int] // call pattern directly
s <- (actorB ask Request).mapTo[String] // call by implicit conversion
d <- (actorC ? Request).mapTo[Double] // call by symbolic name
} yield Result(x, s, d)
f pipeTo actorD // .. or ..
pipe(f) to actorD
This example demonstrates ask together with the pipeTo pattern on futures, because this is likely to be a common combination. Please note that all of the above is completely non-blocking and asynchronous: ask produces a Future, three of which are composed into a new future using the for-comprehension and then pipeTo installs an onComplete-handler on the future to affect the submission of the aggregated Result to another actor.
Using ask will send a message to the receiving Actor as with tell, and the receiving actor must reply with sender() ! reply in order to complete the returned Future with a value. The ask operation involves creating an internal actor for handling this reply, which needs to have a timeout after which it is destroyed in order not to leak resources; see more below.
Warning
To complete the future with an exception you need send a Failure message to the sender. This is not done automatically when an actor throws an exception while processing a message.
try {
val result = operation()
sender() ! result
} catch {
case e: Exception =>
sender() ! akka.actor.Status.Failure(e)
throw e
}
If the actor does not complete the future, it will expire after the timeout period, completing it with an AskTimeoutException. The timeout is taken from one of the following locations in order of precedence:
- explicitly given timeout as in:
import scala.concurrent.duration._
import akka.pattern.ask
val future = myActor.ask("hello")(5 seconds)
- implicit argument of type akka.util.Timeout, e.g.
import scala.concurrent.duration._
import akka.util.Timeout
import akka.pattern.ask
implicit val timeout = Timeout(5 seconds)
val future = myActor ? "hello"
See Futures for more information on how to await or query a future.
The onComplete, onSuccess, or onFailure methods of the Future can be used to register a callback to get a notification when the Future completes, giving you a way to avoid blocking.
Warning
When using future callbacks, such as onComplete, onSuccess, and onFailure, inside actors you need to carefully avoid closing over the containing actor’s reference, i.e. do not call methods or access mutable state on the enclosing actor from within the callback. This would break the actor encapsulation and may introduce synchronization bugs and race conditions because the callback will be scheduled concurrently to the enclosing actor. Unfortunately there is not yet a way to detect these illegal accesses at compile time. See also: Actors and shared mutable state
Forward message
You can forward a message from one actor to another. This means that the original sender address/reference is maintained even though the message is going through a 'mediator'. This can be useful when writing actors that work as routers, load-balancers, replicators etc.
target forward message
Receive messages
An Actor has to implement the receive method to receive messages:
type Receive = PartialFunction[Any, Unit]
def receive: Actor.Receive
This method returns a PartialFunction, e.g. a ‘match/case’ clause in which the message can be matched against the different case clauses using Scala pattern matching. Here is an example:
import akka.actor.Actor
import akka.actor.Props
import akka.event.Logging
class MyActor extends Actor {
val log = Logging(context.system, this)
def receive = {
case "test" => log.info("received test")
case _ => log.info("received unknown message")
}
}
Reply to messages
If you want to have a handle for replying to a message, you can use sender(), which gives you an ActorRef. You can reply by sending to that ActorRef with sender() ! replyMsg. You can also store the ActorRef for replying later, or passing on to other actors. If there is no sender (a message was sent without an actor or future context) then the sender defaults to a 'dead-letter' actor ref.
case request =>
val result = process(request)
sender() ! result // will have dead-letter actor as default
Receive timeout
The ActorContext setReceiveTimeout defines the inactivity timeout after which the sending of a ReceiveTimeout message is triggered. When specified, the receive function should be able to handle an akka.actor.ReceiveTimeout message. 1 millisecond is the minimum supported timeout.
Please note that the receive timeout might fire and enqueue the ReceiveTimeout message right after another message was enqueued; hence it is not guaranteed that upon reception of the receive timeout there must have been an idle period beforehand as configured via this method.
Once set, the receive timeout stays in effect (i.e. continues firing repeatedly after inactivity periods). Pass in Duration.Undefined to switch off this feature.
import akka.actor.ReceiveTimeout
import scala.concurrent.duration._
class MyActor extends Actor {
// To set an initial delay
context.setReceiveTimeout(30 milliseconds)
def receive = {
case "Hello" =>
// To set in a response to a message
context.setReceiveTimeout(100 milliseconds)
case ReceiveTimeout =>
// To turn it off
context.setReceiveTimeout(Duration.Undefined)
throw new RuntimeException("Receive timed out")
}
}
Messages marked with NotInfluenceReceiveTimeout will not reset the timer. This can be useful when ReceiveTimeout should be fired by external inactivity but not influenced by internal activity, e.g. scheduled tick messages.
Stopping actors
Actors are stopped by invoking the stop method of a ActorRefFactory, i.e. ActorContext or ActorSystem. Typically the context is used for stopping the actor itself or child actors and the system for stopping top level actors. The actual termination of the actor is performed asynchronously, i.e. stop may return before the actor is stopped.
class MyActor extends Actor {
val child: ActorRef = ???
def receive = {
case "interrupt-child" =>
context stop child
case "done" =>
context stop self
}
}
Processing of the current message, if any, will continue before the actor is stopped, but additional messages in the mailbox will not be processed. By default these messages are sent to the deadLetters of the ActorSystem, but that depends on the mailbox implementation.
Termination of an actor proceeds in two steps: first the actor suspends its mailbox processing and sends a stop command to all its children, then it keeps processing the internal termination notifications from its children until the last one is gone, finally terminating itself (invoking postStop, dumping mailbox, publishing Terminated on the DeathWatch, telling its supervisor). This procedure ensures that actor system sub-trees terminate in an orderly fashion, propagating the stop command to the leaves and collecting their confirmation back to the stopped supervisor. If one of the actors does not respond (i.e. processing a message for extended periods of time and therefore not receiving the stop command), this whole process will be stuck.
Upon ActorSystem.terminate, the system guardian actors will be stopped, and the aforementioned process will ensure proper termination of the whole system.
The postStop hook is invoked after an actor is fully stopped. This enables cleaning up of resources:
override def postStop() {
// clean up some resources ...
}
Note
Since stopping an actor is asynchronous, you cannot immediately reuse the name of the child you just stopped; this will result in an InvalidActorNameException. Instead, watch the terminating actor and create its replacement in response to the Terminated message which will eventually arrive.
PoisonPill
You can also send an actor the akka.actor.PoisonPill message, which will stop the actor when the message is processed. PoisonPill is enqueued as ordinary messages and will be handled after messages that were already queued in the mailbox.
Graceful Stop
gracefulStop is useful if you need to wait for termination or compose ordered termination of several actors:
import akka.pattern.gracefulStop
import scala.concurrent.Await
try {
val stopped: Future[Boolean] = gracefulStop(actorRef, 5 seconds, Manager.Shutdown)
Await.result(stopped, 6 seconds)
// the actor has been stopped
} catch {
// the actor wasn't stopped within 5 seconds
case e: akka.pattern.AskTimeoutException =>
}
object Manager {
case object Shutdown
}
class Manager extends Actor {
import Manager._
val worker = context.watch(context.actorOf(Props[Cruncher], "worker"))
def receive = {
case "job" => worker ! "crunch"
case Shutdown =>
worker ! PoisonPill
context become shuttingDown
}
def shuttingDown: Receive = {
case "job" => sender() ! "service unavailable, shutting down"
case Terminated(`worker`) =>
context stop self
}
}
When gracefulStop() returns successfully, the actor’s postStop() hook will have been executed: there exists a happens-before edge between the end of postStop() and the return of gracefulStop().
In the above example a custom Manager.Shutdown message is sent to the target actor to initiate the process of stopping the actor. You can use PoisonPill for this, but then you have limited possibilities to perform interactions with other actors before stopping the target actor. Simple cleanup tasks can be handled in postStop.
Warning
Keep in mind that an actor stopping and its name being deregistered are separate events which happen asynchronously from each other. Therefore it may be that you will find the name still in use after gracefulStop() returned. In order to guarantee proper deregistration, only reuse names from within a supervisor you control and only in response to a Terminated message, i.e. not for top-level actors.
Become/Unbecome
Upgrade
Akka supports hotswapping the Actor’s message loop (e.g. its implementation) at runtime: invoke the context.become method from within the Actor. become takes a PartialFunction[Any, Unit] that implements the new message handler. The hotswapped code is kept in a Stack which can be pushed and popped.
Warning
Please note that the actor will revert to its original behavior when restarted by its Supervisor.
To hotswap the Actor behavior using become:
class HotSwapActor extends Actor {
import context._
def angry: Receive = {
case "foo" => sender() ! "I am already angry?"
case "bar" => become(happy)
}
def happy: Receive = {
case "bar" => sender() ! "I am already happy :-)"
case "foo" => become(angry)
}
def receive = {
case "foo" => become(angry)
case "bar" => become(happy)
}
}
This variant of the become method is useful for many different things, such as to implement a Finite State Machine (FSM, for an example see Dining Hakkers). It will replace the current behavior (i.e. the top of the behavior stack), which means that you do not use unbecome, instead always the next behavior is explicitly installed.
The other way of using become does not replace but add to the top of the behavior stack. In this case care must be taken to ensure that the number of “pop” operations (i.e. unbecome) matches the number of “push” ones in the long run, otherwise this amounts to a memory leak (which is why this behavior is not the default).
case object Swap
class Swapper extends Actor {
import context._
val log = Logging(system, this)
def receive = {
case Swap =>
log.info("Hi")
become({
case Swap =>
log.info("Ho")
unbecome() // resets the latest 'become' (just for fun)
}, discardOld = false) // push on top instead of replace
}
}
object SwapperApp extends App {
val system = ActorSystem("SwapperSystem")
val swap = system.actorOf(Props[Swapper], name = "swapper")
swap ! Swap // logs Hi
swap ! Swap // logs Ho
swap ! Swap // logs Hi
swap ! Swap // logs Ho
swap ! Swap // logs Hi
swap ! Swap // logs Ho
}
Encoding Scala Actors nested receives without accidentally leaking memory
See this Unnested receive example.
Stash
The Stash trait enables an actor to temporarily stash away messages that can not or should not be handled using the actor's current behavior. Upon changing the actor's message handler, i.e., right before invoking context.become or context.unbecome, all stashed messages can be "unstashed", thereby prepending them to the actor's mailbox. This way, the stashed messages can be processed in the same order as they have been received originally.
Note
The trait Stash extends the marker trait RequiresMessageQueue[DequeBasedMessageQueueSemantics] which requests the system to automatically choose a deque based mailbox implementation for the actor. If you want more control over the mailbox, see the documentation on mailboxes: Mailboxes.
Here is an example of the Stash in action:
import akka.actor.Stash
class ActorWithProtocol extends Actor with Stash {
def receive = {
case "open" =>
unstashAll()
context.become({
case "write" => // do writing...
case "close" =>
unstashAll()
context.unbecome()
case msg => stash()
}, discardOld = false) // stack on top instead of replacing
case msg => stash()
}
}
Invoking stash() adds the current message (the message that the actor received last) to the actor's stash. It is typically invoked when handling the default case in the actor's message handler to stash messages that aren't handled by the other cases. It is illegal to stash the same message twice; to do so results in an IllegalStateException being thrown. The stash may also be bounded in which case invoking stash() may lead to a capacity violation, which results in a StashOverflowException. The capacity of the stash can be configured using the stash-capacity setting (an Int) of the mailbox's configuration.
Invoking unstashAll() enqueues messages from the stash to the actor's mailbox until the capacity of the mailbox (if any) has been reached (note that messages from the stash are prepended to the mailbox). In case a bounded mailbox overflows, a MessageQueueAppendFailedException is thrown. The stash is guaranteed to be empty after calling unstashAll().
The stash is backed by a scala.collection.immutable.Vector. As a result, even a very large number of messages may be stashed without a major impact on performance.
Warning
Note that the Stash trait must be mixed into (a subclass of) the Actor trait before any trait/class that overrides the preRestart callback. This means it's not possible to write Actor with MyActor with Stash if MyActor overrides preRestart.
Note that the stash is part of the ephemeral actor state, unlike the mailbox. Therefore, it should be managed like other parts of the actor's state which have the same property. The Stash trait’s implementation of preRestart will call unstashAll(), which is usually the desired behavior.
Note
If you want to enforce that your actor can only work with an unbounded stash, then you should use the UnboundedStash trait instead.
 This will cause the actor to throw a ActorKilledException, triggering a failure. The actor will suspend operation and its supervisor will be asked how to handle the failure, which may mean resuming the actor, restarting it or terminating it completely. See What Supervision Means for more information.

What happens to the Message
If an exception is thrown while a message is being processed (i.e. taken out of its mailbox and handed over to the current behavior), then this message will be lost. It is important to understand that it is not put back on the mailbox. So if you want to retry processing of a message, you need to deal with it yourself by catching the exception and retry your flow. Make sure that you put a bound on the number of retries since you don't want a system to livelock (so consuming a lot of cpu cycles without making progress). Another possibility would be to have a look at the PeekMailbox pattern.
What happens to the mailbox
If an exception is thrown while a message is being processed, nothing happens to the mailbox. If the actor is restarted, the same mailbox will be there. So all messages on that mailbox will be there as well.
What happens to the actor
If code within an actor throws an exception, that actor is suspended and the supervision process is started (see Supervision and Monitoring). Depending on the supervisor’s decision the actor is resumed (as if nothing happened), restarted (wiping out its internal state and starting from scratch) or terminated.
Extending Actors using PartialFunction chaining
Sometimes it can be useful to share common behavior among a few actors, or compose one actor's behavior from multiple smaller functions. This is possible because an actor's receive method returns an Actor.Receive, which is a type alias for PartialFunction[Any,Unit], and partial functions can be chained together using the PartialFunction#orElse method. You can chain as many functions as you need, however you should keep in mind that "first match" wins - which may be important when combining functions that both can handle the same type of message.
For example, imagine you have a set of actors which are either Producers or Consumers, yet sometimes it makes sense to have an actor share both behaviors. This can be easily achieved without having to duplicate code by extracting the behaviors to traits and implementing the actor's receive as combination of these partial functions.
trait ProducerBehavior {
this: Actor =>
val producerBehavior: Receive = {
case GiveMeThings =>
sender() ! Give("thing")
}
}
trait ConsumerBehavior {
this: Actor with ActorLogging =>
val consumerBehavior: Receive = {
case ref: ActorRef =>
ref ! GiveMeThings
case Give(thing) =>
log.info("Got a thing! It's {}", thing)
}
}
class Producer extends Actor with ProducerBehavior {
def receive = producerBehavior
}
class Consumer extends Actor with ActorLogging with ConsumerBehavior {
def receive = consumerBehavior
}
class ProducerConsumer extends Actor with ActorLogging
with ProducerBehavior with ConsumerBehavior {
def receive = producerBehavior.orElse[Any, Unit](consumerBehavior)
}
// protocol
case object GiveMeThings
final case class Give(thing: Any)
Instead of inheritance the same pattern can be applied via composition - one would simply compose the receive method using partial functions from delegates.
Initialization patterns
The rich lifecycle hooks of Actors provide a useful toolkit to implement various initialization patterns. During the lifetime of an ActorRef, an actor can potentially go through several restarts, where the old instance is replaced by a fresh one, invisibly to the outside observer who only sees the ActorRef.
One may think about the new instances as "incarnations". Initialization might be necessary for every incarnation of an actor, but sometimes one needs initialization to happen only at the birth of the first instance when the ActorRef is created. The following sections provide patterns for different initialization needs.
Initialization via constructor
Using the constructor for initialization has various benefits. First of all, it makes it possible to use val fields to store any state that does not change during the life of the actor instance, making the implementation of the actor more robust. The constructor is invoked for every incarnation of the actor, therefore the internals of the actor can always assume that proper initialization happened. This is also the drawback of this approach, as there are cases when one would like to avoid reinitializing internals on restart. For example, it is often useful to preserve child actors across restarts. The following section provides a pattern for this case.
Initialization via preStart
The method preStart() of an actor is only called once directly during the initialization of the first instance, that is, at creation of its ActorRef. In the case of restarts, preStart() is called from postRestart(), therefore if not overridden, preStart() is called on every incarnation. However, by overriding postRestart() one can disable this behavior, and ensure that there is only one call to preStart().
One useful usage of this pattern is to disable creation of new ActorRefs for children during restarts. This can be achieved by overriding preRestart():
override def preStart(): Unit = {
// Initialize children here
}
// Overriding postRestart to disable the call to preStart()
// after restarts
override def postRestart(reason: Throwable): Unit = ()
// The default implementation of preRestart() stops all the children
// of the actor. To opt-out from stopping the children, we
// have to override preRestart()
override def preRestart(reason: Throwable, message: Option[Any]): Unit = {
// Keep the call to postStop(), but no stopping of children
postStop()
}
Please note, that the child actors are still restarted, but no new ActorRef is created. One can recursively apply the same principles for the children, ensuring that their preStart() method is called only at the creation of their refs.
For more information see What Restarting Means.
Initialization via message passing
There are cases when it is impossible to pass all the information needed for actor initialization in the constructor, for example in the presence of circular dependencies. In this case the actor should listen for an initialization message, and use become() or a finite state-machine state transition to encode the initialized and uninitialized states of the actor.
var initializeMe: Option[String] = None
override def receive = {
case "init" =>
initializeMe = Some("Up and running")
context.become(initialized, discardOld = true)
}
def initialized: Receive = {
case "U OK?" => initializeMe foreach { sender() ! _ }
}
If the actor may receive messages before it has been initialized, a useful tool can be the Stash to save messages until the initialization finishes, and replaying them after the actor became initialized.
Warning
This pattern should be used with care, and applied only when none of the patterns above are applicable. One of the potential issues is that messages might be lost when sent to remote actors. Also, publishing an ActorRef in an uninitialized state might lead to the condition that it receives a user message before the initialization has been done.
Contents


WITNESS LIST Finance Committee (Subcommittee on Subcommittee on State Contracting Practices) September 27, 2004 - 9:00A State Contracting Practices ON: Alwin, Larry State Auditor (State Auditor's Office), Austin, TX Ancira, Jesse Associate Deputy Comptroller (Comptroller of Public Accounts), Austin, TX Bailey, Don W. Assistant Attorney General (Office of the Attorney General), Austin, TX Bieberdorf, Shannon (State Auditor's Office), Austin, TX Cohen, Rachel Managing Senior Auditor (State Auditor's Office), Austin, TX Hoffman, Casey Deputy Attorney General (Office of the Attorney General), Austin, TX Johnson, Edward Legislative Affairs Director (Building and Procurement Commission), Austin, TX Mauzy, Renee General Counsel (Department of Information Resources), Austin, TX McBee, Barry First Assistant Attorney General (Office of the Attorney General), Austin, TX O'Brien, John (Legislative Budget Board), Austin, TX Olson, Larry Executive Director (Department of Information Resources), Austin, TX Reed, Cindy Interim Executive Director (Building and Procurement Commission), Austin, TX Smith, Pamela Deputy General Counsel (Comptroller of Public Accounts), Austin, TX Villalpaudo, Nick Audit Manager (State Auditor's Office), Austin, TX Wassdorf, Pete Attorney (Office of the Attorney General), Austin, TX Registering, but not testifying: On: Lanier, Dustin Director, Strategic Initiatives (Department of Information Resources), Austin, TX


|
TSGL
A thread-safe graphics library
|
Draw multiple lines chained together. More...
#include <Polyline.h>
Public Member Functions | |
| Polyline (float x, float y, float z, int numVertices, float lineVertices[], float yaw, float pitch, float roll, ColorFloat color) | |
| Explicitly constructs a new monocolored Polyline. More... | |
| Polyline (float x, float y, float z, int numVertices, float lineVertices[], float yaw, float pitch, float roll, ColorFloat color[]) | |
| Explicitly constructs a new multicolored Polyline. More... | |
| virtual void | draw (Shader *shader) |
| Draw the Polyline. More... | |
| virtual void | setColor (ColorFloat c) |
| Sets the Polyline to a new color. More... | |
| virtual void | setColor (ColorFloat c[]) |
| Sets the Polyline to a new array of colors. More... | |
| virtual ColorFloat | getColor () |
| Accessor for Shape's color. More... | |
| virtual void | getColors (std::vector< ColorFloat > &colorVec) |
| Accessor for Shape's colors. More... | |
| bool | isProcessed () |
| Overrides isProcessed() in Drawable.h. More... | |
| Public Member Functions inherited from tsgl::Drawable | |
| Drawable (float x, float y, float z, float yaw, float pitch, float roll) | |
| Constructs a new Drawable. More... | |
| virtual void | changeXBy (float deltaX) |
| Alters the Drawable's x position. More... | |
| virtual void | changeYBy (float deltaY) |
| Alters the Drawable's y position. More... | |
| virtual void | changeZBy (float deltaZ) |
| Alters the Drawable's z position. More... | |
| virtual void | changeCenterBy (float deltaX, float deltaY, float deltaZ) |
| Alters the Drawable's vertex locations. More... | |
| virtual void | setCenterX (float x) |
| Sets the Drawable's x position. More... | |
| virtual void | setCenterY (float y) |
| Sets the Drawable's y position. More... | |
| virtual void | setCenterZ (float z) |
| Sets the Drawable's z position. More... | |
| virtual void | setCenter (float x, float y, float z) |
| Moves the Drawable to new coordinates. More... | |
| virtual void | setYaw (float yaw) |
| Mutator for the Drawable's yaw. More... | |
| virtual void | setPitch (float pitch) |
| Mutator for the Drawable's pitch. More... | |
| virtual void | setRoll (float roll) |
| Mutator for the Drawable's roll. More... | |
| virtual void | setYawPitchRoll (float yaw, float pitch, float roll) |
| Mutator for the yaw, pitch, and roll of the Drawable. More... | |
| virtual void | changeYawBy (float deltaYaw) |
| Alters the Drawable's yaw by a specified amount. More... | |
| virtual void | changePitchBy (float deltaPitch) |
| Alters the Drawable's pitch by a specified amount. More... | |
| virtual void | changeRollBy (float deltaRoll) |
| Alters the Drawable's roll by a specified amount. More... | |
| virtual void | changeYawPitchRollBy (float deltaYaw, float deltaPitch, float deltaRoll) |
| Alters the Drawable's yaw, pitch, and roll by a specified amount. More... | |
| virtual void | setRotationPointX (float x) |
| Virtual mutator that changes the rotation point of the Drawable's x value. More... | |
| virtual void | setRotationPointY (float y) |
| Virtual mutator that changes the rotation point of the Drawable's y value. More... | |
| virtual void | setRotationPointZ (float z) |
| Virtual mutator that changes the rotation point of the Drawable's z value. More... | |
| virtual void | setRotationPoint (float x, float y, float z) |
| Sets the point around which Drawable is rotated. More... | |
| virtual float | getCenterX () |
| Accessor for the center x-coordinate of the Drawable. More... | |
| virtual float | getCenterY () |
| Accessor for the center z-coordinate of the Drawable. More... | |
| virtual float | getCenterZ () |
| Accessor for the center z-coordinate of the Drawable. More... | |
| virtual float | getYaw () |
| Accessor for the Yaw of the Drawable. More... | |
| virtual float | getPitch () |
| Accessor for the Pitch of the Drawable. More... | |
| virtual float | getRoll () |
| Accessor for the Roll of the Drawable. More... | |
| virtual float | getRotationPointX () |
| Accessor for the rotation x-coordinate of the Drawable. More... | |
| virtual float | getRotationPointY () |
| Accessor for the rotation y-coordinate of the Drawable. More... | |
| virtual float | getRotationPointZ () |
| Accessor for the rotation z-coordinate of the Drawable. More... | |
| virtual unsigned int | getShaderType () |
| Accessor that returns a value corresponding to a certain shader in Canvas. More... | |
| virtual float | getAlpha () |
| Accessor that returns Drawable's alpha value. More... | |
Protected Member Functions | |
| virtual void | addVertex (GLfloat x, GLfloat y, GLfloat z, const ColorFloat &color=WHITE) |
| Adds another vertex to a Polyline. More... | |
| Polyline (float x, float y, float z, int numVertices, float yaw, float pitch, float roll) | |
| Explicitly constructs a new Polyline. More... | |
| Protected Member Functions inherited from tsgl::Drawable | |
| bool | centerMatchesRotationPoint () |
| Protected helper method that determines if the Drawable's center matches its rotation point. More... | |
Protected Attributes | |
| int | numberOfVertices |
| int | currentVertex = 0 |
| Protected Attributes inherited from tsgl::Drawable | |
| std::mutex | attribMutex |
| Protects the attributes of the Drawable from being accessed while simultaneously being changed. | |
| GLfloat * | vertices |
| float | myCurrentYaw |
| float | myCurrentPitch |
| float | myCurrentRoll |
| float | myXScale |
| float | myYScale |
| float | myZScale |
| float | myRotationPointX |
| float | myRotationPointY |
| float | myRotationPointZ |
| float | myCenterX |
| float | myCenterY |
| float | myCenterZ |
| bool | init = false |
| unsigned int | shaderType = SHAPE_SHADER_TYPE |
| GLfloat | myAlpha = 0.0 |
Draw multiple lines chained together.
Polyline is a class for holding vertex data for multiple lines whose endpoints are connected.
This method is optimized for long lists and offers a marked improvement over drawing individual Line instances.
|
protected |
Explicitly constructs a new Polyline.
Explicit constructor for a new Polyline object.
| x | The x coordinate of the center of the Polyline. |
| y | The y coordinate of the center of the Polyline. |
| z | The z coordinate of the center of the Polyline. |
| numVertices | The number of vertices in the Polyline. |
| yaw | The Polyline's yaw. |
| pitch | The Polyline's pitch. |
| roll | The Polyline's roll. |
| tsgl::Polyline::Polyline | ( | float | x, |
| float | y, | ||
| float | z, | ||
| int | numVertices, | ||
| float | lineVertices[], | ||
| float | yaw, | ||
| float | pitch, | ||
| float | roll, | ||
| ColorFloat | color | ||
| ) |
Explicitly constructs a new monocolored Polyline.
Explicit constructor for a new Polyline object.
| x | The x coordinate of the center of the Polyline. |
| y | The y coordinate of the center of the Polyline. |
| z | The z coordinate of the center of the Polyline. |
| numVertices | The number of vertices in the Polyline. |
| lineVertices | An array of vertices for the Polyline. 3 floats * numVertices, x-y-z. |
| yaw | The Polyline's yaw. |
| pitch | The Polyline's pitch. |
| roll | The Polyline's roll. |
| color | Color of the Polyline, as a ColorFloat. |
| tsgl::Polyline::Polyline | ( | float | x, |
| float | y, | ||
| float | z, | ||
| int | numVertices, | ||
| float | lineVertices[], | ||
| float | yaw, | ||
| float | pitch, | ||
| float | roll, | ||
| ColorFloat | color[] | ||
| ) |
Explicitly constructs a new multicolored Polyline.
Explicit constructor for a new Polyline object.
| x | The x coordinate of the center of the Polyline. |
| y | The y coordinate of the center of the Polyline. |
| z | The z coordinate of the center of the Polyline. |
| numVertices | The number of vertices in the Polyline. |
| lineVertices | An array of vertices for the Polyline. 3 floats * numVertices, x-y-z. |
| yaw | The Polyline's yaw. |
| pitch | The Polyline's pitch. |
| roll | The Polyline's roll. |
| color | Array of ColorFloats for the Polyline; 1 ColorFloat per vertex. |
|
protectedvirtual |
Adds another vertex to a Polyline.
This function initializes the next vertex in the Polyline and adds it to a Polyline buffer.
| x | The x position of the vertex. |
| y | The y position of the vertex. |
| z | The z position of the vertex. |
| color | The reference variable of the color of the vertex. |
Referenced by tsgl::Line::Line(), and Polyline().
|
virtual |
Draw the Polyline.
This function actually draws the Polyline to the Canvas.
Implements tsgl::Drawable.
Referenced by tsgl::ProgressBar::~ProgressBar().
|
virtual |
Accessor for Shape's color.
Returns the color of Shape's first vertex.
|
virtual |
Accessor for Shape's colors.
Populates the reference parameter vector with a ColorFloat for each vertex of Shape.
| colorVec | A vector of ColorFloats to which the ColorFloats associated with Shape will be pushed. |
|
virtual |
Overrides isProcessed() in Drawable.h.
Overrides Drawable::isProcessed() to include invariant.
Reimplemented from tsgl::Drawable.
|
virtual |
Sets the Polyline to a new color.
| c | The new ColorFloat. |
|
virtual |
Sets the Polyline to a new array of colors.
| c | The new array of ColorFloats. |


Virginia man supports Trump by adopting highways in his honor
by Frank MilesNick Umbs is definitely one of the biggest fans of President Trump, and he is showing it vociferously in public.
As FOX 5 DC reported, he is behind Adopt a Highway signs in Fairfax County, Virginia, being cared for by the "President Trump Fan Club."
FOLLOW US ON FACEBOOK FOR MORE FOX LIFESTYLE NEWS
"I thought it would be kind of a neat idea to do something kind of in support because all of this publicity that we see is always negative, negative, negative," Umbs, a lifelong resident of Burke, Virginia, told FOX 5 DC. “And I wanted to show that there are people out there who are supportive of the president who are doing good and good for the community."
The irony is the area isn’t even Trump country. In Fairfax County in 2016, Trump received just more than 28 percent of the vote. In 2016, Hillary Clinton earned 64 percent of the vote. Fairfax County voted Democrat in the last four presidential elections, according to Virginia historical data.
WTSP reported that Umbs has adopted one mile of Burke Lake Road, part of Ox Road in Lorton and part of 123 near a bridge into Occoquan; he also is working on adopting a section of Rolling Road.
To earn the signs, Umbs has to pick up garbage twice a year along the nearly four miles of roads he's adopted.
He said he shall pick up one to two bags worth.
CLICK HERE TO GET THE FOX NEWS APP
"I really like President Trump," Umbs told WTSP. "I really feel like he follows through with what he says, and number one that he absolutely loves the country … and if I have to clean up trash to show my support, I’m willing to do that."


Hello! My name is Brandy Moreno. I recently graduated from the University of California, Santa Barbara with a Bachelor’s of Science in Financial Mathematics and Statistics. Although my major may be a mouthful to say it did not limit me from expanding my interest in different areas. The following website showcases my diverse background.
Find Out MoreA diverse background in theoretical and computational mathematics.
Knowledge in cleaning, analyzing, and graphing complex data in R, Python, and SAS.
Experience in creating websites with HTML, JS, CSS, Angular, and Ionic.
Familiarity in the application of mathematics and statistics in the financial market.
Interested in talking? That's great! Give me a call or send me an email and I will get back to you as soon as possible!
559-643-7058


@* * Copyright 2023 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @(params: Map[String, Any]) @name() = {@params("name")} @reference() = {@params("caseNumber")} @claimAmount() = {@params("claimAmount")} @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "Your import charge reimbursement claim submission"){
Dear @name
This confirms you have applied to claim for reimbursement on import charges such as Customs Duties, Excise Duties, Countervailing Duties and VAT.
Your claim reference number is: @reference
Your claim amount is: £@claimAmount
HMRC will review your application and we will aim to email or write a letter to you about the outcome within 30 working days once we receive valid documents to support your claim. We will contact you to either:
For help, you can phone the HMRC CDS Support Team on 0300 322 9434. Open Monday to Friday, 8am to 10pm, (closed bank holidays), Saturday and Sunday, 8am to 4pm.
For more contact details, search GOV.UK for 'import and exports: general enquiries'.
From HMRC Customs Declaration Service
}


|
ESW Local Projects
It’s our aim to promote sustainability and sustainable
practices both locally and globally. Throughout the school years, ESW has partnered with many local projects to ensure sustainability incluing Iowa State’s ‘Live Green’
initiative to improve and promote sustainability on campus. Currently, ESW members are actively involved
in many projects including:
- Solar Light- Our
solar light project is focused on harnessing solar light to set up a
sidewalk lamp that can store the energy and automatically operate in
the evenings. This project could use more help from individuals with
experience in Electrical Engineering, but anyone is welcome to get
involved! Please contact Daniel Robinson (isudan@iastate.edu).
- Rain Garden-
Using a plot of land between Carver Hall and the Music Hall, we are
implementing a garden to utilize plants that will absorb excessive
rainwater runoff, which can cut down the amount of pollution reaching
creeks and streams. Please contact Christina Larranga (cjlarra@iastate.edu).
- Gasifier-ESW will be beginning a project focused on building a portable biomass gasifier. The gasifier will take wood chips, waste corn seed or a similar material and convert it into methane, hydrogen, and carbon monoxide. The gasifier will introduce people to a green fuel source and increase their knowledge of the process. (3/4/14)
- Water Sanitation-ESW will also begin investigating water sanitation systems that could be portable, used in a rural home or used in a rural community. We plan to start by looking at current small sink faucet or hose chlorination systems and also investigating alternatives. This project will increase the amount of safe, drinkable water available in rural areas. (3/4/14)
If you are interested or have any questions on the local projects, please
contact the Vice President of Local Projects, Ryan Nelson at<EMAIL_ADDRESS>|


Liarbones!!
Info Board
My ID:
Game Room:
Game Phase:
My Coins
Opp's Coins:
My Health:
Opponent's Health:
My Die:
Opponent's Die:
Enter your player ID
Join Room 1
Join Room 1
Join Room 2
Join Room 2
Make a listen request


ngx-extended-pdf-viewer 5.0 supports layered PDF files. You can hide and show each layer in the new "layers" tab of the sidebar. This also works for hidden layers.
Just in case you don't speak French: the word "calque" in the list of layers simply means "layer".
ngxExtendedPdfViewerService
offers two methods allowing you to control the layers programmatically:
listLayers()
yields a list of the layers. Don't call it too early. A good point in time is the event
(pagesLoaded)
.
toggleLayer(id)
toggles a layer. You need to pass the ID of the layer. The ID, in turn, is part of the
result of listLayers()
.
PDFViewerApplication.eventBus.on(
'optionalcontentconfig',
callback)
Live demo:


Country:
State:
City:
Latitude:
Longitude:
Air Quality Index (US):
Air Quality Index (China):
Measurement Time:


Lidl is selling cheese advent calendars in time for Christmas
Chocolate advent calendars are SO 2018 - this year it's about cheese and luxury candles
by Sarah WaddingtonIf you love cheese and you love Christmas, Lidl have got you sorted this festive season with a CHEESE advent calendar.
It seems every year supermarkets are competing each other and taking their advent calendars to that next level by seeing what crazy addition they can add to the mix.
Aldi's sell-out wine advent calendar is back for 2019 and the M&S beauty advent calendar is just £40 for £300 worth of products.
But this year Lidl have won Christmas by launching a cheese advent calendar. The German discount chain is also selling a luxury candle calendar and even a milk-free range.
The British Cheese Advent Calendar will set you back £7.99, and is filled with eight varieties of miniature cheeses - including a festive selection - and cheesy jokes.
Cheese lovers will be treated to a variety of flavours including Jarlsberg, Double Gloucester, Cheddar and Christmassy flavours Wensleydale with Cranberries and Gingerbread.
But be warned - it must be kept in the fridge.
Not a fan of cheese? Other ranges include The Luxury Collection Advent Calendar, which costs £19.99 and includes scented candles.
It contains 24 candles in total, with scents including lavender, citrus and herb, pomegranate, frosted pine, frankincense, or apple and cinnamon.
The Advent calendar comes in a large triangle white box with a picture of a Christmas tree on the front.
They will go on sale on Thursday, November 7.
Lidl's full advent calendar range
Kinnerton Milk Chocolate Advent Calendar Assorted - 99p
Cadbury Dairy Milk Advent Calendar - £1.49
Kinder Chocolate Mini Advent Calendar - £2.99
Moo Free Organic Advent Calendar (vegan) - £3.99
Reese's Chocolate Advent Calendar - £4.99
Cadbury Miniature Heroes Advent Calendar - £4.99
Deluxe Premium Luxury Advent Calendar (Present Shape with Bow) - £6.99
Ilchester Cheese Advent Calendar - £7.99
The Luxury Collection Candle Advent Calendar - £19.99


This meteor-oauth2-server
package currently provides functionality for both the
AuthenticationServer and the ResourceServer. This functionality may be split into separate packages
and/or examples in the future; however, for the time being, AuthenticationServer and ResourceServer
are the same application.
The following steps represent the steps that are necessary to properly negotiate an oauth2 token (Described here). While these steps work on this site, this site is for testing and demo purposes only. Do not use this configuration in production. You'll know if everything is working if you can get to Step A7 and the user ids match.
The AuthenticationServer & ResourceServer need to know about the ClientApplication that's going to authenticate to it. So the first step in configuring the ResourceServer is to register a Client ID and Client Secret. The following form illustrates what might be provided to a customer who is self-configuring a client application via an API Key Generation page.
{{#if clientCount}}Client created.
For the sake of testing, you can remove all the created clients.
{{/if}} {{#unless clientCount }}However the record is created, the server is going to look for a client that exists, is active, and it's redirectUri must match the redirect_uri provided in the URL. If not, the creation of the authorization code in step 4 will fail.
{{/unless}}A login page needs to be created. This is done by visiting the site with the proper url parameters.
{{#unless isUrlParamsValid }}The URL params are not set in order to authorize an oauth2 token.
The following link will simulate arriving to this page from another site that wishes to authenticate with oauth2.
Simulate proper link. {{/unless}} {{#if isUrlParamsValid}}Here are the url params this site received.
| clint_id | {{ urlParams.client_id }} |
| redirect_uri | {{ urlParams.redirect_uri }} |
| response_type | {{ urlParams.response_type }} |
The user must be authenticated to authorize an oauth2 request.
{{> loginButtons}} {{/unless}} {{#if currentUser}}User is authenticated.
{{> loginButtons}}This is the button a user would click to allow {{ urlParams.client_id }} access to your email address.. etc.
{{#if grantResult}}Grant was run with the given params. Normally, the user would be redirected to the redirect URI.
| Success | {{ grantResult.success }} |
| Error | {{ grantResult.error }} |
| Authorization Code | {{ grantResult.authorizationCode }} |
| RedirectUri | {{ grantResult.redirectToUri}} |
This is where the user's interaction generally stops. For testing purposes, now that you have an authorization code, you can test service by retrieving an access token.
{{#if tokenResult}}Using the authorizationCode, the client applicationg would post back to this server to request a token. This is the token you'd use to run REST calls and alike. This is server to server communication. This example is only for testing purposes to ensure we did everything properly.
| access_token | {{ tokenResult.access_token }} |
| expires_in | {{ tokenResult.expires_in }} |
| token_type | {{ tokenResult.token_type }} |
This step is also performed server-to-server by the client application and is only done here for testing purposes. Here we are using the newly acquired access token, we retrieve the userId associated with the access token.
| expected id | {{ currentUser._id }} | This was given to us by Meteor. |
| actual id | {{ getUserIdResult }} | This was retrieved via REST using the access token. |
This shows a list of all the existing auth codes.
This shows a list of all the existing refresh tokens.


THtmlViewer, TFrameViewer, and TFrameBrowser components
property QuirksMode: THtQuirksMode;
Default is qmStandard.


holo-calendar
Copyright (C) 2014 Vincent de Smet
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


| DOSE: T+ 0:00 |
2 hits |
oral |
LSD |
(blotter / tab) |
| T+ 4:30 |
|
smoked |
Cannabis |
(plant material) |
I had experianced LSD quite a few times before and after this, but I have to say this was my best experiance.
630| Pretty late to drop acid, but I had work all day, so I got together with my friend, and we dropped it in my room. We stuck around for about 20 mins, and then started our adventure.
Little After 7| As we were walking through the woods, we got into a deep conversation. 'God couldnít always be there, he had to appear sometime, it doesnít make sence!' 'What about that time before he was there, what was everything, was there anything?' ect ect ect
720ish| We got to the woods behind my school, this is when we started to REALLY feel it. We were walking down a deep hill and I saw some of my friends. Not knowing what to say, I just said 'Iím trippin balls.' As we walked down the trail, there were millions of fern starting to grow. When they start, their just stems curled up at the top. Looking at these, it looked like magic mushrooms were growing everywhere, millions of them. We found a spot to sit down at, I ended up laying down though, watching the leaves change colors. We tried smoking weed, but it didnít do anything due to the fact that we were tripping so hard. We listened to music, Octavarium on acid is amazing.
8| We started to go back towards the school. Walking down this extremly long straight trail covered with trees was amaaazing. The trail kept bending back and forth, and we had a hard time walking. We went walking around on the field and climbed a baseball cage to stare at sunset watching the most amazing colors I have ever seen. It sucked climbing back down - though the sunset was incredible. The clouds were wiggling back and forth violently and I saw more colors then I could ever imagine.
830| At my school we have a huge obstical corse, which is about 30 feet high. Seeing as its this high, they need metal wires to keep it in place. There are 6 in all. As we were walking past it, it looked like there were millions of wires, trying to avoid it was pretty hard, I smacked into all of them. As we were passing the woods, I kept telling my friend there were some assholes in the woods staring at us. He wanted to let it go but I wanted to see what was up. So I ran at them, staring the entire time. Out of no where, they were trees. yeah.... there were no people, the trees looked like people walking back and forth.
930| At the tennis courts at my school, or our 'Fun Cube,' We took of our shoes and ran around for a wile. Then we realized we could jump up and down and bounce on the tennis nets. That was great, until police rolled up and asked what we were doing. Panicing, I said we were waiting for our parents to pick us up from the game (there was a lacrosse game going on on one of the other fields). Thank god, they left and we went back to the school building.
10| We stared at the stars for half an hour. It was amazing. Millions of stars everywhere, all twinkling, and all different colors. We star gazed and it was one of the best things I have ever seen.
11| It's a good thing we stole chalk from some house on the way, cause we drew the trippiest most amazing pictures all over the school. We could not stop laughing at everything we were comming up with. Then, my friend came and picked us up.
11| At this point we picked up someone else, and went to go smoke somewhere.  The weed made the trip better, and we called them up, but they said hypnotising someone on lsd completely defeats the purpose.  Pictures with incredible detail. Which ever way you turn it, up, down, left, right, theres a different picture. Their insane. We drew these untill about 5 in the morning. To this day, we will try to draw them sober, its not possible. We also went online looking at trippy pictures and watching them morph and change colors.
2| Not much signifigance, but one of the funniest things ever. I poked my eyeball, and it made an incredibly loud squishing noise. With my finger still poking my eye, I turn to my friend. When I take it out, it makes this sealing up noise.  By 7 30 am we passed out.
In all, since then I have had a much better positive perspective on life. I literally started doing good in school. My friend, who had been unemployed for a very long time, got a job the next day. We donít take lsd to get FUCKED UP we take it for a more of a spiritual reason, we love the experiance. What it does to our minds, how we can think of such amazing things. How we are so stimulated, how our subconscious is its own person.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


"xhr" or "fetch".
When a request is generated by XMLHttpRequest
, then ajaxType is "xhr".
When a request is generated by window.fetch
, then ajaxType is "fetch".
A request body to be sent with method like POST
, PUT
and so on.
body
can be various type like string, FormData, Document, Blob, URLSearchParams and so on.
Key-value pairs of a header.
timeout
is only used by XMLHttpRequest.
Generated using TypeDoc
Request object properties only for
fetch
.https://developer.mozilla.org/en-US/docs/Web/API/Request


Provides a general framework to perform statistical inference of each gene pair and global inference of whole-scale gene pairs in gene networks using the well known Gaussian graphical model (GGM) in a time-efficient manner. We focus on the high-dimensional settings where p (the number of genes) is allowed to be far larger than n (the number of subjects). Four main approaches are supported in this package: (1) the bivariate nodewise scaled Lasso (Ren et al (2015) <doi:10.1214/14-AOS1286>) (2) the de-sparsified nodewise scaled Lasso (Jankova and van de Geer (2017) <doi:10.1007/s11749-016-0503-5>) (3) the de-sparsified graphical Lasso (Jankova and van de Geer (2015) <doi:10.1214/15-EJS1031>) (4) the GGM estimation with false discovery rate control (FDR) using scaled Lasso or Lasso (Liu (2013) <doi:10.1214/13-AOS1169>). Windows users should install 'Rtools' before the installation of this package.
| Version: | 1.0.0 |
| Depends: | R (≥ 3.0.0), Rcpp |
| Imports: | glasso, MASS, reshape, utils |
| LinkingTo: | Rcpp |
| Published: | 2017-10-16 |
| Author: | Rong Zhang, Zhao Ren and Wei Chen |
| Maintainer: | Rong Zhang <roz16 at pitt.edu> |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| NeedsCompilation: | yes |
| CRAN checks: | SILGGM results |
| Reference manual: | SILGGM.pdf |
| Package source: | SILGGM_1.0.0.tar.gz |
| Windows binaries: | r-devel: SILGGM_1.0.0.zip, r-release: SILGGM_1.0.0.zip, r-oldrel: SILGGM_1.0.0.zip |
| OS X binaries: | r-release: SILGGM_1.0.0.tgz, r-oldrel: SILGGM_1.0.0.tgz |
Please use the canonical form https://CRAN.R-project.org/package=SILGGM to link to this page.


rval += local_traverse(inp, x)
return rval
to_replace = local_traverse(out, x)
return clone(out, replace=OrderedDict((v, y) for v in to_replace))
// checked again, speeding up the traversal of multiply-connected graphs.
visited = set()
from collections import deque
q = deque()
q.append(out)
to_replace = []
while q:
graph = q.popleft()
if graph in visited:
continue
visited.add(graph)
if equal_computations([graph], [x]):


-
Shellshock DHCP RCE Proof of Concept -
www.trustedsec.com
DHCP bash shellshock POC: 1) Just about any DHCP string value should work for the exploit. Value 114 is URL, which is a string and should be reliable ...
-
Middle-School Dropout Codes Clever Chat Program That Foils NSA Spying | ...
www.wired.com
The best hope of shielding your metadata from the NSA was invented by a middle-school dropout in his spare time.
-
The FBI Finally Says How It 'Legally' Pinpointed Silk Road's Server | WIRED
www.wired.com
The prosecuting attorneys in Ulbricht's case argue, means that no illegal spying techniques were needed to pinpoint the world's largest anonymous ...
-
Hackers Are Already Using the Shellshock Bug to Launch Botnet Attacks | ...
www.wired.com
With a bug as dangerous as the "shellshock" security vulnerability discovered yesterday, it takes less than 24 hours to go from proof-of-concept to ...
-
MFSA 2014-73: RSA Signature Forgery in NSS
www.mozilla.org
You are here: Security Center > Mozilla Foundation Security Advisories > MFSA 2014-73
-
Ok, shits real. Its in the wild... src:<IP_ADDRESS>
gist.github.com
You can clone with HTTPS or SSH .
-
On Death and iPods: A Requiem | WIRED
www.wired.com
The single-use device is gone---and with it, the very notion of cool that it once carried.
-
Signaling Post-Snowden Era, New iPhone Locks Out N.S.A.
www.nytimes.com
Intelligence agencies say the move, in which the new iPhone creates a unique code that scrambles information, is the first of new technologies ...
-
Errata Security: Bash 'shellshock' bug is wormable
blog.erratasec.com
Advanced persistent cybersecurity
-
Should You Buy a New iPhone? | WIRED
www.wired.com
There is a new iPhone! There are two new iPhones, in fact. But should you buy one? It honestly isn't for everyone. Let's break it down based on just ...
-
How to Start a Startup
startupclass.samaltman.com
CS183B is a class we’re teaching at Stanford. It’s designed to be a sort of one-class business course for people who want to start startups.
-
Schneier on Security: Two New Snowden Stories
www.schneier.com
New Zealand is spying on its citizens . Edward Snowden weighs in personally .
-
Three Things Apple Can Do to Fix iCloud's Awful Security | WIRED
www.wired.com
Apple’s reality distortion field makes for epic product launches. But it doesn’t keep sext-snatching hackers out of your iCloud account. As the glow ...
-
Feds Threatened to Fine Yahoo $250K Daily for Not Complying With PRISM | ...
www.wired.com
A secret and scrappy court battle that Yahoo launched to resist the NSA’s PRISM spy program came to an end in 2008 after the Feds threatened the ...
-
Schneier on Security: WikiLeaks Spy Files
www.schneier.com
WikiLeaks has organized the trove of documents about corporations aiding government surveillance around the world. It's worth wandering around ...
-
How to Protect Yourself From Big Bank-Card Hacks | WIRED
www.wired.com
With hackers stealing credit and debit card numbers with seeming impunity, it might seem like there's nothing the average consumer can do to protect ...
-
Troy Hunt: Everything you need to know about the Shellshock Bash bug
www.troyhunt.com
Observations, musings and conjecture about the world of software and technology
-
oss-sec: Re: CVE-2014-6271: remote code execution through bash
seclists.org
oss-sec mailing list archives
-
iPhone camera evolution: How does the iPhone 6 camera compare to previous ...
snapsnapsnap.photos
How does the iPhone 6 camera stack up against previous hardware? In her ongoing series, professional iPhone photographer Lisa Bettany takes a hard ...
-
Apple's "warrant canary" disappears, suggesting new Patriot Act demands
gigaom.com
Apple included language in its first Transparency Report to say that it had not been subject to a Section 215 Patriot Act request. That language is ...
-
Terror laws clear Senate, enabling entire Australian web to be monitored ...
www.smh.com.au
Australian spies will soon have the power to monitor the entire Australian internet with just one warrant, and journalists and whistleblowers will ...
-
FBI blasts Apple, Google for locking police out of phones
www.washingtonpost.com
The agency director’s criticisms echo the frustrations of law enforcement officials nationwide.
-
Announcing Clasp
drmeister.wordpress.com
Hello, everyone! Today I am happy to make the first release of the Common Lisp implementation “Clasp”. Clasp uses LLVM as its back-end and generates ...


Her Early Life
Grace Brewster Murray was born on December 9th, 1906 in New York. She was always very curious as a child, a trait she kept for her whole life. At the age of seven, she wanted to figure out how an alarm clock worked, and took apart 7 clocks before her mother realised what she was doing! (She was then given a single clock to work with.)
Her Navy Career
At the US's entry to World War II, Grace tried to enlist in the Navy, but was rejected for 3 main reasons:
- 1. She was 34 years old and too old to enlist.
- 2. She wasn't heavy enough for her height
- 3. She was a Maths professor at Vassar College, and was considered too valuable to the war effort.
She reported for duty in December of that year, and trained in the Smith College Naval Reserve School in Massachusetts.
She then went on do graduate the next year, and then served as a lieutenant on the Buerau of Ships Computation Project at Harvard, working on the Harvard Mark 1 (A computer that used moving parts instead of modern silicon boards!)
Here she seemed to develop a love for computers, as at the end of the war she chose to continue working at the Mark 1 lab, until 1949. (she even turned down a full Professorship at Vassar College, to work as a researcher at Harvard on computers.)


SHPE NJ will be awarding a $500 scholarship to a worthy SHPE member. This SHPE member is an undergraduate student who acknowledges him or her as being committed to community service, longstanding pursuit for higher education, displaying outstanding organizational and leadership qualities, and is a highly dedicated member of the SHPE Familia.
The SHPE NJ Scholarship is established to provide a SHPE NJ member, who epitomizes the SHPE mission and fulfills our SHPE vision, with an opportunity to continue in their studies and remain actively involved with their SHPE chapter.
- Must be a paid SHPE Member attending a college/university within NJ - Undergraduate who is NOT graduating in May or Summer 2020
s


Let us know how you can improve FreeCodeCamp
* Name:
* Email:
* Age:
* Which option best describes your current role? Select an option Student Full Time Job Full Time Learner Prefer not to say Other
How likely is that you would recommend freeCodeCamp to a friend? Definitely Maybe Not sure
What do you like most in FCC? Select an option Challenges Projects Community Open Source
Things that should be improved in the future (Check all that apply) Front-end Projects Back-end Projects Data Visualization Challenges Open Source Community Gitter help rooms Videos City Meetups Wiki Forum Additional Courses
Any Comments or Suggestions? Enter your comment here...


Racialised oppression
Racism has been examined in its many forms. Scholarship regarding how individuals personally experience, cope with, and manage racial oppression is still developing. The term “appropriated racial oppression” reframes the construct “internalized racism” as a process whereby members of a group appropriate a dominant group's ideology, adapt their behavior, and perceive a subordinate status as deserved, natural, and inevitable. The expression of appropriated racial oppression is based on a variety of complicated and interacting processes, such as incentivized societal norms, critical consciousness, and racial socialization
social class oppression
Social Oppression is unfairly treating a person or group of people who are different from other people or groups of people. A few examples of social oppression include racism (treating people different based on their ethnicity), sexism (treating people different based on their gender), religious persecution (treating people different because of their religion.) and economic oppression.
Gender oppression
gender oppression is an effect of the social process of gender relations that institutionalize and reproduce certain norms of gender to privilege the dominant group and marginalize, exclude, or cause other harm to the oppressed group. Through feminist concerns (including third‐wave, poststructural, and postcolonial feminisms) as well as the efforts of queer activists/theory and transgender activists/studies, gender norms are unsettled because of the extreme abuses, violence, and dehumanization suffered by those who transgress gender norms. An overview of both global and historical trends of gender theory contributes to a rethinking of the systems of gender oppression.
Sexual oppression
Sexual repression is a state in which a person is prevented from expressing their own sexuality. Sexual repression is often linked with feelings of guilt or shame, being associated with sexual impulses
Religious persecution
Religious persecution means unfair treatment of a particular group of people because of their religion. It aims at forcing the religious to go away or give up their religion. "Persecution" comes from a Latin word meaning "chase", and usually meant chasing someone in order to kill them. In later centuries the term was applied to other actions
Institutionalized oppression
Institutional Oppression is the systematic mistreatment of people within a social identity group, supported and enforced by the society and its institutions, solely based on the person’s membership in the social identity group.


|
SideCar
|
Exception class thrown by a failed assertion in a unit test. More...
#include </Users/howes/src/sidecar/UnitTest/TestObj.h>
Public Member Functions | |
| UnitTestException (const char *msg, const std::string &testName) throw () | |
| Constructor. More... | |
| UnitTestException (const std::string &msg, const std::string &testName) throw () | |
| UnitTestException (const char *msg, const char *file, int line, const std::string &testName) throw () | |
| UnitTestException (const std::string &msg, const char *file, int line, const std::string &testName) throw () | |
| virtual | ~UnitTestException () throw () |
| Destructor. | |
| const std::string & | err () const throw () |
| Return the description of the failure or error. | |
| const std::string & | testName () const throw () |
| Return the name of the unit test that was running. | |
| const std::string & | file () const throw () |
| Return the name of the file in which the exception occured. More... | |
| long | line () const throw () |
| Return the line number of the file. More... | |
| std::ostream & | printText (std::ostream &os) const |
| Write out exception text to given output stream. More... | |
| std::ostream & | printXML (std::ostream &os) const |
| Write out XML representation of exception to given output stream. More... | |
Exception class thrown by a failed assertion in a unit test.
Records the failure message, the file it was found in, the line of the file, and the name of the test that failed the assertion. For the UnitTest framework, there are two classifications of exceptions: those thrown by a failed assertion (assertTrue() or assertEQ()), and all others. The first are classified as test failures, while the latter are run-time errors (eg. file not found). Both classifications are represented by UnitTestException (perhaps mistakenly so). However, only test failures report file and line information.
|
inline |
Constructor.
Remembers details of an exceptional situation.
| msg | description of the failure or error |
| file | name of the file that raised the exception. May be NULL. |
| line | line number of the file |
| testName | name of the test that was running at the time of the exception. |
Definition at line 132 of file TestObj.h.
Referenced by UnitTest::TestObj::_assertNotEqual(), and UnitTest::TestObj::run().
|
inline |
Return the name of the file in which the exception occured.
May be NULL.
Definition at line 158 of file TestObj.h.
Referenced by UnitTest::TestObj::_assertEqual(), and UnitTest::TestObj::_assertNotEqual().
|
inline |
Return the line number of the file.
If file() returns NULL, this is undefined.
Definition at line 162 of file TestObj.h.
Referenced by UnitTest::TestObj::_assertEqual(), and UnitTest::TestObj::_assertNotEqual().
| std::ostream & UnitTestException::printText | ( | std::ostream & | os | ) | const |
Write out exception text to given output stream.
| os | stream to write to |
Definition at line 17 of file TestObj.cc.
Referenced by PrintText::operator()().
| std::ostream & UnitTestException::printXML | ( | std::ostream & | os | ) | const |
Write out XML representation of exception to given output stream.
| os | stream to write to |
Definition at line 24 of file TestObj.cc.
Referenced by PrintXML::operator()().


function Add(ItemClass: TLayerClass): TCustomLayer;
type TLayerClass = class of TCustomLayer;
Adds a new layer to the collection. The layer is added to the end of the list and it's Index property will become equal to Count - 1.
The class of the layer is specified in the ItemClass parameter and you will need to typecast the result to ItemClass if you need to access its specific properties, for example:
var
BL: TBitmapLayer;
begin
BL := TBitmapLayer(MyImage32.Layers.Add(TBitmapLayer));
...
end;
Alternatively, you can use another approach to add layers to the collection:
var
BL: TBitmapLayer;
begin
BL := TBitmapLayer.Create(MyImage32.Layers);
end;


Glen of Imaal Terrier Puppy Cam
Violet's litter born March 11, 2014
Your viewing session has ended. Sorry, viewing sessions are limited to 15 minutes.
Please start a new session if you want to keep watching!


= 5 && !user.submitted">
You can only select upto 5 people.
Add people to send a like to Anonymously.
(Our algorithm keeps your data cryptographically safe)
Your choices:
(Click on card to remove)
Number of hearts from your crushes:
Sorry, you haven't gotten any hearts from crushes (yet).
True love comes to those who wait.


netttt uses a genetic algorithm to evolve neural networks to play tic tac toe with some intelligence. It's written in pure JavaScript and runs completely in your browser. It utilizes web workers to parallelize the work, and local storage to save your progress.
First, we generate every tic tac toe game state where the next move has more than one valid option, a mere 4,298 states. We then use an AI that plays a perfect game to determine the "right" move or set of equivalent moves to make in each case. Perfect means the AI 1) never loses, 2) tries to win as quickly as possible, and 3) moves to take advantage of opponent fumbles.
We start with a randomly generated population of neural nets of fixed geometry. Each individual net is scored on how many times it gives a "right" answer in response to being asked what move to make for each game state. The top scoring nets are favored to populate the next generation through reproduction with a chance of random mutation. The hope is that after letting it run for a while, you'll end up with a net that can play the game relatively well.
It's easy for the score to get stuck for long periods of time, maybe at a local maximum. Since it's random, you never know when the right mutation will happen. Give it a few tens of thousands of generations or so.
The perfect AI is currently implemented using a modified negamax search algorithm. This is probably the wrong choice. Any tree-based search that assumes each player is playing the best move every turn will run into the same problem: all games end in a draw very quickly, making most moves equivalent, as highlighted in WarGames. My modifications make the search favor winning quickly and try to capitalize on an opponent who might not always make the best move. A better solution would probably be to simply use the algorithm described in Wikipedia's tic tac toe page.
The nets are simple feed-forward artificial neural networks. They use a binary activation function with a variable bias (inverted in the code as a "threshold") and weight for each connection.
Each net has 18 input neurons, two for each game square, a few internal layers of different sizes, and one output which represents the desirability of the input game state. A square's first neuron receives input if that square is occupied by the player for whom we're finding moves, and the second neuron receives input if it's occupied by the opponent. To find a move to make, each valid move is applied and the resulting game state is evaluated. The move with the highest scoring state is chosen.
Each generation after the first is populated using genetic material from the previous generation. A few of the top performing individuals are simply cloned into the next generation. The rest of the generation is created from randomly combining the genomes of two parents chosen at random, biased toward the top scoring individuals.  The same individual can be chosen as both parents of a child, in which case the slight mutation is the only change to its genome. The genome consists of all the biases and weights of an individual's neural net.


At the time the data was collected, there does not appear to be a correlation between latitude and humidity.


PizzaHut
{{ message_signup }}
Sign Up
Name
Username
Password
Sign Up
{{ message_signin }}
Sign in
Username
Password
Sign in