This post is the first of a two parts series of articles about how to tune Akka configurations
- Part-1: Initial Akka Configurations
- Part-2: Gather and analyze Akka metrics with Kamon and stackable traits
At some point, whether it is during your new actor-based system planning, or after you have a prototype working, you’ll probably find yourself digging into the Akka Docs to find the right combination of possibilities for routing, dispatcher, number of actors instances and so forth… Depending on the complexity of your system and performance requirements, this could get tedious.
Part-1: Initial Akka Configurations
Let’s start with Akka configuration, specifically the configuration of actor-instances, routing strategy and dispatchers & executors. Below is the relevant section of the application.conf
{
akka {
actor {
akka.actor.deployment {
/my-service {
nr-of-instances = ???
router = ???
dispatcher = "my-dispatcher"
}
my-dispatcher {
executor = ???
type = ???
}
The number of actor instances
I like to start by thinking about how many instances of an actor are suitable?
akka.actor.deployment {
/my-service {
nr-of-instances = ???
}
}
The size may depend on other configurations like routing strategy, dispatcher, threadpool size and more. Nevertheless, the nr-of-actor ‘strategy’ can already be decided at this point. Let’s review our options and use cases:
Single instance (or- Domain actor)
- A dedicated actor for low-priority side-effects like sending metrics, write to a log or to a cache and so forth.
- A mutable, single-source that needs to be handled(Cache)
- When you need to work sequentially for whatever reason
Fixed number of instances
- Instance per a copy of resource, or per a mutable resource
- For sharding, i.e. when you manage a distributed key-value cache and want to shard the inputs, then you may want an actor to manage each shard
- To execute tasks in parallel, and you don’t think you’ll need to manage Back-Pressure nor to scale up
Resizeable number of instances(when using a router)
akka.actor.deployment {
/parent/router {
resizer {
lower-bound = ???
upper-bound = ???
pressure-threshold = ???
messages-per-resize = ???
...
}
}
}
It is possible to configure resizable routees (actor instances managed by a router).
Routees can be added or removed dynamically, based on performance. You can configure specifically how much to scale up and down in case of unusual behavior.
Scale / Back-Pressure DIY!
When one component is struggling to keep-up, the entire system needs to respond in a sensible way.
You’re might be somewhat familiar wit Akka-Streams, widely known as a framework that manages your back-pressure. It’s possible to imitate the general behavior by yourself.
Let’s review some scenarios in which you may want to scale your routees:
The producer(In our use case, one of your actors), can produce faster than the received consumer(actor or any other source) can handle.
In this case you may:
-
Back-pressure the producer, i.e. reduce the number of producer’s routees.
-
Add more consumers(routees…)!
-
Leave it. You don’t necessarily need to back-pressure. It may lead to a loss of messages (bounded mailbox) or running out of memory…
The consumer is faster than the producer.
Here the consumer will block waiting for the next item.
-
Remove some consumers(routees…)!
-
Add more producers if your system can theoretically produce faster.
-
Leave it. Then you may not get the most from your machine.
Actor per-request
“You press, you make a request, the Meeseeks fulfills the request, and then it stops existing”(Rick Sanchez)
Actor per request works very similarly. An instance is created for every request, process it and then it will be destroyed.
You can configure Spray/Akka-HTTP to work in actor-per-request mode or do it yourself. However, it is not part of the Akka configuration, so I won’t go into too much detail. In a nutshell:
-
Easy to manage state in the actor, because the context is always of a specific request, hence you don’t have to maintain any mapping of State => Request
Note that there is a context-switches overhead which could theoretically lead to memory issues
Routing
Akka provides “strategies” for the Akka router to define the workload distribution among actors.
akka.actor.deployment {
/my-service {
router = ???
}
}
Strategies Overview
Let’s quickly review the the routing strategies
-
Random - Distributes messages randomly
-
Round-Robin - Distributes messages in sequence
-
Smallest-Mailbox - Sends the message to the smallest mailbox
-
Broadcast - Distributes every message to all routees.
-
Scatter-Gather-First - Distributes every message to all routees. Only the first to respond will execute the task.
-
Tail-Chopping - Sends the message to one, randomly picked, routee and then after a small delay to a second routee.
-
Consistent-hashing - Uses consistent hashing to select a routee based on the sent message
-
In-Code - Custom your own routing by routing it yourself
Strategies Cheatsheet
*Can be solved by increasing the number of routees (which may cost in context-switches overhead)
**As a replacement for ‘smallest mailbox’. Latency differences could be high among connections to remote actors)
***The overhead depends on the task, whether it on the same machine or not
Dispatchers and Executors
akka.actor.deployment {
/my-service {
dispatcher = ???
type = ???
}
}
Dispatchers are what makes Akka actors “tick”, means put messages in mailboxes and route them. In addition, they are also an implementation of ExecutionContext, means they can execute Runnables and so a Scala Future.
my-dispatcher {
executor = ???
throughput = ???
....
}
Fork-Join-executor
my-dispatcher {
executor = "fork-join-executor"
....
}
Java 7 introduced the Fork-Join executor.
As the name suggests, it forks a task into subtasks, each executed by a different thread, and joined the results.
There are two main characters that are worth mentioning here. According to Oracle docs -
-
“It is designed for work that can be broken into smaller pieces recursively”.
Hence it is best for recursive problems - where a task can be broken into sub-tasks such that they would be executed in parallel and their results would be collected.
-
“The fork/join framework is distinct because it uses a work-stealing algorithm. Worker threads that run out of things to do can steal tasks from other threads that are still busy”
Fork-Join shows better performance in most cases, compared to old Thread-Pool-Executor. It makes a better use of resources, since the idle threads can steal tasks from busier threads. However, there is a built-in danger here.
Regarding the first statement, when a ‘Fork’ is performed, we have multiple threads and each of them is responsible for running a task. From the second, when a thread is finished it can take another task. But what if he got stuck performing this task? The other threads will wait on the ‘Join’ at some point, which is a threads starvation.
my-dispatcher {
executor = "fork-join-executor"
fork-join-executor {
# Min number of threads to cap factor-based parallelism number to
# Note that these threads will be created anyway on fork'
# so try to avoid an unnecessary overhead.
parallelism-min = ???
# Parallelism (threads) ... ceil(available processors * factor)
parallelism-factor = ???
# This is NOT an upper bound on the total number of threads!
# Max number of threads to cap factor-based parallelism number to
parallelism-max = ???
....
}
}
A common case is to use Fork-Join executor for future tasks inside an actor. Here, the dispatcher’s configuration of the actor should be considered as well. For example, the more threads you have for the actor, the more ‘future’ tasks will be performed, and you may want more threads for them.
Thread-pool-executor
The old Java 5 executor for asynchronous task execution can still fit in some cases and without the Fork-Join overhead.
While Fork-Join breaks the task for you, if you know how to break the task yourself, then your code should be already built as a minimal task, executed by a single thread, which fits a thread-pool-executor.
The thread-pool executor is used by Akka Dispatcher and PinnedDispatcher.
Dispatcher allows you to define ‘min’, ‘max’ and increase ‘factor’ / ‘fixed’ size for your thread pool.
Thread-pool executor is used by akka Dispatcher and PinnedDispatcher.
Dispatcher let you define min, max and increase factor / fixed size for your threadpool.
my-dispatcher {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor {
# Min number of threads to cap factor-based parallelism number to
parallelism-min = ???
# Parallelism (threads) ... ceil(available processors * factor)
parallelism-factor = ???
# Max number of threads to cap factor-based parallelism number to
parallelism-max = ???
}
....
}
The key is to find the right balance for actor instances to work in parallel and use the threads as much as they are need so other actors and processes can work as well. It’s also true for the Fork-Join executor and needs to be quite accurate.
PinnedDispatcher dedicates a unique thread to each actor. This is usually not the pattern you want for the machine, given the limited resources. Hence, it makes sense for the actor to share a pool of threads. However, if your actor performs a preferred task, you won’t want its instances to share the pool.
Do not use it if you have more instances than the number of cores in the machine. It is also not recommended for Futures, because you’ll probably need more than 1 thread…
Affinity-pool-executor
my-dispatcher {
executor = "affinity-pool-executor"
....
}
This executor tries its best to have your actor instance always schedule with the same thread, which should increase throughput.
This is recommended for a small number of actor instances, where you have much more instances than threads, it is just not possible.
Tips
-
Don’t use the Akka default dispatcher for your actorSystem, or for the actors themselves. Note that external Akka based frameworks use it as default, and you should configure a dedicated dispatcher for them as well.
-
Have a different dispatcher for each actor, and for Futures inside an actor.
-
Dispatchers have a ‘throughput’ parameter, which “defines the maximum number of messages to be processed per actor before the thread jumps to the next actor” Setting It to a higher value than the default, 1, is likely to improve performance so long as it is not part of the Affinity-pool dispatcher, and your actors are generally not very busy (otherwise the lack of fairness can cause a high load in some mailboxes).
-
Read this terrific post in the ScalaC blog. It explains dispatcher’s internals in details.
Next
In Part-2 I will show how we monitor and analyze our actor-based system.
Inneractive maintains an Exchange server, which, simply put, receives an advertisement for a mobile application
from Ad-Networks.
In fact, there are ~500 server instances at a given moment, dealing with ~10,000,000 Ad requests per minute.
During the process, the Exchange server performs a real-time auction by going out (with scala.Future)
to multiple Ad-Networks (consumers).
This translates to ~150,000,000 transactions per minute.
The Exchange server is Akka-based and uses Spray as a server-side-HTTP. The entire flow is actor-based.
We use other Akka frameworks in other modules like Akka-Http and Akka Streams.


Car Loan Calculator
Purchase price
Down payment
Trade-in value
Term length
12 months
24 months
36 months
48 months
60 months
72 months
84 months
Rate
{{ calcPayment }} / month


Directions
Multiple-Choice.
Answer the following questions by selecting the correct choice.
Correct answers are marked with a check mark (
✔
), while incorrect answers are with an X (
✘
).
Multple-choice question.
A. Correct choice
B. The sentence for a choice
C. The sentence for a choice
D. The sentence for a choice
Some explanation for this item.
Multple-choice question 2.
A. The phrase for this choice
B. Correct choice
C. The phrase for this choice


OpenFAM 3.0 Services
OpenFAM version 2.0 introduced the concept of supporitng large pool of memory using multiple memory servers. OpenFAM version 3.0 contains significant design changes to increase scalability and improve performance.
- The design supports a larger pool of memory by supporting multiple memory servers. This memory pool can be either volatile or persistent.
- Data can be interleaved as data items can now span across multiple memory servers, thus reducing performance bottlenecks.
- Datapath operations can now be partitioned into multiple contexts.
- Multi-threaded data path and atomic operations are supported.
- Additional APIs have been added to the facilitate data movement between memory pool and archival storage.
Figure 1 shows the three main components in the design.
- The client interface service (CIS):
- All PEs talk to the CIS for memory server operations.
- The metadata management service:
- Region and data item metadata is hosted by the metadata management service. The service can be co-located in the same node as a CIS server or a memory server, or it can be run in dedicated metadata management nodes.
- The memory management service:
- The actual memory is served from memory servers.
For data path (
get
,put
andatomic
) operations PEs talk to the memory servers directly. For memory management and metadata operations, e.g.,allocate
,lookup
,create_region
, etc., the CIS communicates with memory servers via an RPC service or via direct functions calls.
See configuration and startup of OpenFAM 3.0 services in the Configuration Files section.


I use Sketch App (Apple Fan boy) for designing but before this i was using photoshop, i still use it for Photo related work, Talking about my education, I'm computer science grad for Details check out my Resume!
My Design ProcessThis is a process of finding the gap between what users wants and what they're getting.
now it's time to fill those gaps with right user flows, layouts, responsibility.
this is the part where all the visual communication happnes. Color Scheme, Typography, Iconographyand lot more to just make user say "it's nice simple design"(pun intended)
here we prototyping it do testing and find bug in the whole design, it's all about getting good feeling before coding up every thing.


Fires when new line was submited
Fires when line delete was submited
Fires when line edit was submited
Generated using TypeDoc
Fires when new line was submited


Techniques to Manage Dependencies and Build Flexible Interfaces
Seemingly innocuous code can often be hiding design decisions that will only rear their ugly head as a project morphs and grows over time. When working on a class that represents apartments in a building, it is quite easy to lock your code into a myriad of strangling dependencies and a rigid interface.
We begin our journey into flexing good design techniques with a gets-the-job-done building class.
Managing Dependencies
This code allows clients of building to get information on apartments in the building using a variety of methods. Building contains an array of apartments that have certain attributes like price and size and it is here that we encounter our first embedded dependency. Whenever you are calling a constructor in a class it should activate your sense of smell. Due to this constructor call our building is now bound to the implementation of the apartment class and any changes to the apartment class will reverberate to all of its dependents including board.
Dependency Injection
If you are mindful of dependencies and develop a habit of routinely injecting them, your classes will naturally be loosely coupled. Sandi Metz
If we look at building’s methods we can see that we only care if an apartment has a size and a price. Maybe we would also like to own buildings that can rent out storage rooms or music practice rooms. In this scenario buiding doesn’t care if a room is an instance of apartment or any other type of room as long as we can access it’s price and size.
We can resolve this issue by utilizing dependency injection. This is a complicated sounding technique that boils down to passing instances of classes into the constructor of a class dependent on those instances. As long as those instances adhere to the interface required by the class they are injected into, the type of that class no longer matters to us.
We can now utilize a factory to prepare our apartments for injection into building as below.
Our apartments factory is very similar to the original building constructor but we have decoupled building from its functional dependency on apartments by utilizing dependency injection.
Structural Dependency
Our next dependency is implied within the building’s methods. They are only functional if building is instantiated with a 2 dimensional array in a very specific format (apartments[floor][room].) This is not ideal and makes changing the data structure full of apartments we pass to building impossible. It also has ramifications for any client of building who will not be able to see what floor they live on after using one of building search methods.
We can begin to decouple this unmanaged dependency by constructing apartments that know what floor they are on and injecting a simpler data structure into building.
Now as long as we inject an enumerable that adheres to the correct interface into building its search methods will be fully functional.
Order Dependency
Another dependency reveals itself if we look closely at apartments factory that has been plaguing us in past iterations as well. This is the dependency on argument order that exists in the build method. Unless we pass these arrays in the specified order our factory will produce incorrect apartments. A quick fix in Ruby is to utilize named parameters to prevent the order dependency.
Creating Flexible Interfaces
We want building to have a flexible interface with stable public methods and incoming messages that focus on asking for “what” instead of telling “how.”
Well Defined Public Interface
Our first version of building included a convert_input method in it’s public interface which implied that clients of building could send that message when in reality it would only be used internally. A quick, small improvement to this version of building is achieved by making this method private. We can also encapsulate apartments in the private interface to encourage access through buildings search methods.
Inversion of Control
The next question to ask ourselves is whether building’s interface is flexible and pliable to changes. A key factor is revealed if we think about what would happen if we wanted to add a new field to our apartments. If our client now required that they would like to know whether an apartment was furnished or not we could add this new field to the apartment class and modify the factory and call it a done deal.
However, our building class has not been updated to include this new information and clients have no way to search through apartments that are furnished or vice versa. We would have to add yet another specific search method to building and if the fragility of this interface was not obvious before it is now.
A powerful technique we can use to solve this problem is to invert control of the search functionality. Instead of programming a bulky and ever-changing public interface into building that needs to be modified for every new requirement we can utilize Ruby blocks to give control back to the client. The public interface of building exposes an enumerable of apartments that enables the client to utilize a variety of powerful functionality.
Through inversion of control we have exposed a method that can accept anonymous functions that act on the apartments enumerable to clients of building. The public interface of apartment provides documentation for the parameters that are available to the client. This has drastically reduced the size of the public interface and has allowed clients to send messages to building that specify how they want to receive the target apartments instead of having to deal with a predefined response. This also allows us to keep our implementation of apartments private and manipulate the apartments before calling the anonymous function passed to get if desired.
These techniques can be applied to transfrom rigid classes with hidden internal dependencies into flexible, modular classes that can be passed into applications without worry. Managing dependencies and crafting flexible interfaces are two key design perspectives that will prevent an application from crystallizing into a codebase that is resistant or even impossible to change. Our software should be open to extension and closed to modification and flexible, modular code defines a path toward this goal.


Rails Side
For an iOS game I’ll eventually release, I store images for each “story” on a Story model. image_file
is one of the attributes and it’s just a string of the image’s file name. There’s a before_save callback that stores a Base64 binary version of the image on that model’s instance.
RubyMotion Side
After receiving a “Story” object in RubyMotion through an API call, I initialize an NSData object with the Base64 encoded image. These are stored with NSDefaults. I’m using a globally variable here. Usually recommended blah blah blah.
This app uses RubyMotion Query (RMQ). This is an awesome library. Recently, RMQ and ProMotion(and more) combined as RedPotion. Haven’t tried that yet, but I’m excited to. Anyway, later when showing Story views, I set the image in RMQ. It shouldn’t be too hard to adapt the code below if you aren’t using RMQ. The part that matters is UIImage.imageWithData
.


Introduction
This page was intended as a reference guide for developers who are familiar with a templating engine,
APT, and the
Mirror API and who have grokked the
getting started guide and who need to know more detail in order to do some real development. It's expected
that developers will need to periodically refer to this guide (and most especially to the directive documentation and
the decorated mirror API documentation) to know how to use APT-Jelly in their templates.
The example template snippets of this reference are Freemarker snippets, although each example is equally applicable to Jelly.
Execution Context
When the ProcessorFactory
is asked for a Processor, it first
establishes an execution context. Most APT-Jelly directives assume that they are being invoked within this execution context so they can reference
the AnnotationProcessorEnvironment as needed.
It's important to note that the execution context will direct all output to System.out unless it is redirected somewhere
else like a flat file or java source file (see the directive documentation). While it is perfectly acceptable to use any
available native directives to redirect output to a file on the local filesystem, it is assumed that most redirection will happen to an
apt-generated artifact using the javaSource and/or file directives. This way, the files will
be created relative to the directory specified by the "-s" option given to APT.
Data Model
Before invoking any templates, a data model is initialized with the options of the AnnotationProcessorEnvironment being
assigned to the variable "aptOptions". Developers can look up any options passed to APT by referencing this variable. For example, to output
the value of the "-AMyAPTOption" option, the following snippet can be used:
NOTE: When using the Freemarker processor, there is an option, -AAPTJellyFreemarkerLibraryNS, that specifies the
namespace under which the "aptOptions" variable can be put.
${aptOptions["-AMyAPTOption"]}
The other important feature enabled by the data model is that any variable that is assigned a value that is an instance of
com.sun.mirror.declaration.Declaration, com.sun.mirror.type.TypeMirror, and
com.sun.mirror.declaration.AnnotationMirror is decorated before being assigned to the variable. See
Decorated Mirror API for more details.
APT-Jelly Directives
APT-Jelly includes a set of directives that are used to process a set of java source files. Most of the directives are used to loop through the
declarations and and types of the java source files and assign each item in the loop to a variable in the data model. Three notable
exceptions to this are the file directive, the javaSource directive, and the
annotationValue directive. The first two directives are used to redirect the output to a generated artifact. The third
is used to output an annotation if it exists, or none if it doesn't exist.
NOTE: When using the Freemarker processor, there is an option, -AAPTJellyFreemarkerLibraryNS, that specifies the
namespace under which the transforms can reside.
This section is intended to give a brief overview of the way the directives are used. For specific details on the use of each directive, refer to
the directive documentation.
A good place to start is by generating an artifact with the file directive or the javaSource directive.
As should be expected, the file directive generates a file and the javaSource directive generates a java
source file. The name of the artifact is specified by the "name" parameter. For a java source artifact, the name should be the fully-qualified
name of the java class file for which this is to be the source. For the file directive, the name should be the simple name
of the file, but this directive also allows parameters for the character set and the package relative to which this file should be placed. The body
of each of these directives is redirected to their respective artifacts.
The java source declarations can be traversed using the declaration loop directives. A declaration loop directive is a directive that iterates
through
a set of declarations, possibly refering to a "parent" declaration to obtain this set. A parent declaration is a declaration within which a set of
other declarations is specified. For example, the parent declaration of a method declaration would be a type declaration (e.g. a class or an interface).
A declaration loop directive provides a parameter for specifying the name of the data model variable to which should be assigned a reference to the current
declaration in the loop, and a parameter for specifying the name of the data model variable to which should be assigned the current loop index. The
set of declarations over which a declaration loop directive iterates can also be filtered by the class name of an annotation using the "annotation" parameter.
You will probably want to start by iterating over the set of all type declarations in your source base with the forAllTypes
directive, although another good place to start would be with the forAllPackages directive if you want that level of granularity.
Refering to the APT Mirror API documentation for TypeDeclaration,
you will see that the set of type declarations is the set of all classes and interfaces (including enums and annotation types). Note also that
the documentation for the forAllTypes directive states that interfaces aren't included by default. If you want to include
interfaces, you'll want to specify that with the "includeInterfaces" parameter.
Once within a forAllTypes directive, you can use other loop directives to iterate through each of the member declarations of the
current type. You'll want to do this through the use of the forAllConstructors, forAllFields,
forAllMethods, and forAllNestedTypes directives. You'll note in the documentation for these directives
that it is possible to specify the parent declaration, but this is only necessary if these directives aren't nested within a declaration loop directive for
a set of type declarations.
When traversing a source base, eventually you will encounter a reference to a type (i.e. TypeMirror)
that may or may not be declared. You will want to be aware of the difference between a type declaration and a reference to a type in your
template because they are modeled quite differently in the mirror API (and rightly so). While some types may have declarations (e.g. a java class),
others may not have declarations (e.g. arrays, primitive types, and the void type). Whether a type has a declaration is
important to know because certain operations are only valid on the declarations of those types. For example, you cannot determine whether a type
reference is annotated with a specified annotation; only type declarations can be annotated. To determine whether a type has a declaration, use
the ifHasDeclaration directive.
A good example of this is when looking at a method
declaration.
There are APT-Jelly directives that traverse through the constructs of a method declaration. These are forAllParameters, and
forAllThrownTypes. There is also a parameter on the forAllMethods directive that allows you to specify
the name of a data model variable to which to assign the return type of the method. As an illustration of the difference between a reference to a type
and a type declaration, the parameters can be annotated (and thus filtered by a given annotation), but the thrown types of a method cannot. To
determine whether a given thrown type is annotated with a specified annotation, a reference to the declaration of the thrown type must be obtained.
The recommended way to do this is with the ifHasDeclaration directive.
Decorated Mirror API
When writing a template, you're eventually going to want to do more than just iterate through the declarations of your Java source base. You
may want to output the name of a declaration, or perhaps the value of an annotation element. This is done through reference to the
properties of a data model variable. Therefore, a knowledge of the model for the objects in the data model is imperative when writing your
template.
The Mirror API is the object model that is provided by APT. Each of
the declarations and type mirrors in the Mirror API provides a set of relevant properties that can be accessed in the template. However, because
the Mirror API has been found to be inadequate or inconvenient to access in the data model, APT-Jelly decorates the Mirror API with other property
accessors that make templating more easy.
For example, the Mirror API provides a property on AnnotationMirror
that is a map of the element (method) declarations to the values of those elements on the annotation. While this API is accurate and concise, it
becomes difficult to reference the annotation value from the template. APT-Jelly decorates AnnotationMirror by adding properties
for each of the elements of the annotation so they can be referenced from the template. To illustrate, consider the following two template snippets. Each
snippet outputs the value of the "bar" element of the annotation "com.foo.Foo". The first snippet uses the Mirror API as if it were not decorated.
The second leverages the API as decorated by APT-Jelly.
@com.foo.Foo {
bar = "hello"
}
public class MyClass {
}
Example of a class annotated with com.foo.Foo.
<#list annotation.elementValues.entrySet as entry>
<#if entry.key.simpleName = "bar">
${entry.value}
</#if>
</#list>
Freemarker template snippet that outputs "hello" without using the decorated API. The context variable "annotation" is assigned the value of the
com.foo.Foo AnnotationMirror featured in the example source code above.
Freemarker template snippet that outputs "hello" using the decorated API. Again, the context variable "annotation" is assigned the value of the
com.foo.Foo AnnotationMirror featured in the example source code above.
For more information on the decorated API, refer to the decorated mirror API documentation.
Extending APT-Jelly
If APT-Jelly is missing a feature that you need, consider submitting a patch or making a request on the development mailing list. However, in some cases,
it may be more convenient for developers to extend APT-Jelly with their own directives. For example, you may find it necessary to extend the
forAllMethods directive to iterate through your own special set of methods that meet certain specific requirements. Fortunately,
APT-Jelly boasts a clean, modular, and flexible API and can be very easily extended.
There is a set of directive classes for each templating engine, but all directives share the same common logic in the form of a strategy class.
For example, the directive class for the forAllMethods directive to support Freemarker is
net.sf.jelly.apt.freemarker.transforms.ForAllMethodsTransform. The class that support the same directive in Jelly is
net.sf.jelly.apt.tags.ForAllMethodsTag. But both of these directive classes are nothing more than a thin wrapper
around a common strategy class, net.sf.jelly.apt.strategies.MethodDeclarationLoopStrategy.
Whenever you find it necessary to extend an existing APT-Jelly directive take a good look at the existing strategies (and their methods) to see if
you can meet your requirements with a simple override. Let's take the above-mentioned example of extending the
forAllMethods directive to iterate through a set of methods that meet a specific set of requirements. The
logic for the forAllMethods directive is defined by the class
net.sf.jelly.apt.strategies.MethodDeclarationLoopStrategy.
Looking at the possible methods we could override, we see that this class extends (among other things)
net.sf.jelly.apt.strategies.DeclarationLoopStrategy that defines a method, getDeclarations,
that gets the declarations to loop through. So, this might be a good place to put our own filtering logic.
Consider the following directive strategy class that extends net.sf.jelly.apt.strategies.MethodDeclarationLoopStrategy
and loops all protected methods that are annotated with the "com.foo.Foo" annotation and that return void.
import net.sf.jelly.apt.strategies.MethodDeclarationLoopStrategy;
import com.sun.mirror.declaration.MethodDeclaration;
import com.sun.mirror.declaration.Modifier;
import com.sun.mirror.type.VoidType;
import java.util.Collection;
import java.util.ArrayList;
import org.apache.commons.jelly.JellyTagException;
public class ForAllProtectedVoidFooMethodsTag extends MethodDeclarationLoopStrategy {
@Override
public Collection<MethodDeclaration> getDeclarations() throws JellyTagException {
Collection<MethodDeclaration> declarations = super.getDeclarations();
Collection<MethodDeclaration> specialMethods = new ArrayList<MethodDeclaration>();
for (MethodDeclaration method : declarations) {
if ((method.getModifiers().contains(Modifier.PROTECTED))
&& (method.getReturnType() instanceof VoidType)
&& (method.getAnnotation(com.foo.Foo.class) != null)) {
webMethods.add(method);
}
}
return webMethods;
}
}
Now most of the work is done. We only have to define the class that defines the directive for our templating engine of choice. The easiest way
to do that is to extend the existing class for our templating engine and override the necessary methods to reference our strategy that we created
above. For example, we could extend net.sf.jelly.apt.freemarker.transforms.ForAllMethodsTransform and override the
newStrategy method to return instead in instance of ForAllProtectedVoidFooMethodsTag.
A few things to note:
-
The above logic could have also been easily done inline with the template. You'll have to make your own design decisions to find that delicate balance
between a heavy, difficult-to-read template and a superfluous custom directive library.
-
The filtering of the method declaration in the above example happens after the declarations are filtered by annotation. You may decide
to filter before filtering by annotation name by overriding the getAllDeclarationsToConsiderForAnnotationFiltering
method.
-
Just in case you don't know, the @java.lang.Override annotation causes a compile failure if any declaration that it
annotates doesn't override another declaration. I use this all the time to help me catch API changes at compile-time rather than causing
a confusing catastrophic runtime error.
The other aspect of APT-Jelly that you may find useful to extend is the decorated mirror API (*). In this case, the classes you will want to extend
are the decorators, net.sf.jelly.apt.decorations.DeclarationDecorator and
net.sf.jelly.apt.decorations.TypeMirrorDecorator. As you can see, these decorators are implementations of the visitors
for declarations and types in the Mirror API. The work done when visiting a given type or declaration is simply to set a local variable to the decorated
instance of the type or declaration.
When extending the decorators, it's only necessary to override the visit method of the type of declaration or type you want to decorate and then
call the same method of the super with your own decorated instance (*). Your own decorated instance will need to extend the
decorated type or declaration class provided by APT-Jelly in order to expose your custom decorated methods.
After having defined your decoration and extended the decorator, it's necessary to tell APT-Jelly what decorator to use when decorating. This can be done
either by a system property or passed in as an "-A" APT option on the command line. (Note that the system property is difficult to set from the command line.)
This name of this system property (or APT option) is "net.sf.jelly.apt.decorations.DeclarationDecorator" for a declaration decorator and
"net.sf.jelly.apt.decorations.TypeMirrorDecorator" for type decorator. The values of these properties should be the fully-qualified class name
of your custom decorator. You can set a system property either programmatically or you can specify these properties with a -A option (e.g.
-Anet.sf.jelly.apt.decorations.DeclarationDecorator=happy.HappyDeclarationDecorator) passed to the APT-Jelly processor factory.
As an example, let's extend APT-Jelly by adding another property called "happy" to any class declaration. (Apologies for such a contrived example.
All the useful decorations I could think of have already been applied.) We'll say that a class declaration is "happy" if its simple name
starts with "Happy".
First, we start with extending the decorated class declaration:
package happy;
public class HappilyDecoratedClassDeclaration extends net.sf.jelly.apt.decorations.declaration.DecoratedClassDeclaration {
public HappilyDecoratedClassDeclaration(com.sun.mirror.declaration.ClassDeclaration delegate) {
super(delegate);
}
public boolean isHappy() {
return getSimpleName().startsWith("Happy");
}
}
Next, we extend net.sf.jelly.apt.decorations.DeclarationDecorator to correctly visit a class declaration:
package happy;
public class HappyDeclarationDecorator extends net.sf.jelly.apt.decorations.DeclarationDecorator {
public void visitClassDeclaration(com.sun.mirror.declaration.ClassDeclaration declaration) {
super.visitClassDeclaration(new HappilyDecoratedClassDeclaration(declaration));
}
}
As long as we make sure that there is a sytem property (or APT option) named "net.sf.jelly.apt.decorations.DeclarationDecorator" that has the value
"happy.HappyDeclarationDecorator" when we invoke apt (either with a -A option or programmatically), then we should be able to access our decorations
from the template, e.g.:
<#if classDeclaration.happy>
<#-- do some happy processing -->
</#if>
*NOTE: The strict rigidity of the visitor/decorator pattern causes some irritating inefficiencies when extending the model. If you decide that
extending the decorated API is necessary, be aware that when extending the decorations of a type, the subtypes of that type will NOT also
be decorated. Using the example above, while we extending a class declaration with the "happy" property, we are NOT extending an enum declaration.
So, even though an enum declaration extends a class declaration, no enum declarations will be decorated with the "happy" property. Now just
think about how irritating it would be if we wanted to decorate *all* declarations with the "happy" property. We would have to extend every subclass
of DecoratedDeclaration. So extend the decorations at your own risk.
Further Information
If you've scoured the directive documentation and the decorated mirror API documentation
and still can't find what you're looking for, you may want to try the apt-jelly mailing lists. And then, if all else fails,
use the source, Luke. You may want to especially take a look at the unit tests as a good source for examples on how to use APT-Jelly.
|


Database: Migrations
Introduction
Migrations are like version control for your database, allowing your team to easily modify and share the application's database schema. Migrations are typically paired with Laravel's schema builder to easily build your application's database schema. If you have ever had to tell a teammate to manually add a column to their local database schema, you've faced the problem that database migrations solve.
The Laravel Schema
facade provides database agnostic support for creating and manipulating tables across all of Laravel's supported database systems.
Generating Migrations
To create a migration, use the make:migration
Artisan command:
php artisan make:migration create_users_table
The new migration will be placed in your database/migrations
directory. Each migration file name contains a timestamp which allows Laravel to determine the order of the migrations.
The --table
and --create
options may also be used to indicate the name of the table and whether the migration will be creating a new table. These options pre-fill the generated migration stub file with the specified table:
php artisan make:migration create_users_table --create=users
php artisan make:migration add_votes_to_users_table --table=users
If you would like to specify a custom output path for the generated migration, you may use the --path
option when executing the make:migration
command. The given path should be relative to your application's base path.
Migration Structure
A migration class contains two methods: up
and down
. The up
method is used to add new tables, columns, or indexes to your database, while the down
method should reverse the operations performed by the up
method.
Within both of these methods you may use the Laravel schema builder to expressively create and modify tables. To learn about all of the methods available on the Schema
builder, check out its documentation. For example, this migration example creates a flights
table:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFlightsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('flights', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('airline');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('flights');
}
}
Running Migrations
To run all of your outstanding migrations, execute the migrate
Artisan command:
php artisan migrate
{note} If you are using the Homestead virtual machine, you should run this command from within your virtual machine.
Forcing Migrations To Run In Production
Some migration operations are destructive, which means they may cause you to lose data. In order to protect you from running these commands against your production database, you will be prompted for confirmation before the commands are executed. To force the commands to run without a prompt, use the --force
flag:
php artisan migrate --force
Rolling Back Migrations
To rollback the latest migration operation, you may use the rollback
command. This command rolls back the last "batch" of migrations, which may include multiple migration files:
php artisan migrate:rollback
You may rollback a limited number of migrations by providing the step
option to the rollback
command. For example, the following command will rollback the last five migrations:
php artisan migrate:rollback --step=5
The migrate:reset
command will roll back all of your application's migrations:
php artisan migrate:reset
Rollback & Migrate In Single Command
The migrate:refresh
command will roll back all of your migrations and then execute the migrate
command. This command effectively re-creates your entire database:
php artisan migrate:refresh
// Refresh the database and run all database seeds...
php artisan migrate:refresh --seed
You may rollback & re-migrate a limited number of migrations by providing the step
option to the refresh
command. For example, the following command will rollback & re-migrate the last five migrations:
php artisan migrate:refresh --step=5
Drop All Tables & Migrate
The migrate:fresh
command will drop all tables from the database and then execute the migrate
command:
php artisan migrate:fresh
php artisan migrate:fresh --seed
Tables
Creating Tables
To create a new database table, use the create
method on the Schema
facade. The create
method accepts two arguments. The first is the name of the table, while the second is a Closure
which receives a Blueprint
object that may be used to define the new table:
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
});
When creating the table, you may use any of the schema builder's column methods to define the table's columns.
Checking For Table / Column Existence
You may easily check for the existence of a table or column using the hasTable
and hasColumn
methods:
if (Schema::hasTable('users')) {
//
}
if (Schema::hasColumn('users', 'email')) {
//
}
Database Connection & Table Options
If you want to perform a schema operation on a database connection that is not your default connection, use the connection
method:
Schema::connection('foo')->create('users', function (Blueprint $table) {
$table->increments('id');
});
You may use the following commands on the schema builder to define the table's options:
| Command | Description |
|---|---|
$table->engine = 'InnoDB'; |
Specify the table storage engine (MySQL). |
$table->charset = 'utf8'; |
Specify a default character set for the table (MySQL). |
$table->collation = 'utf8_unicode_ci'; |
Specify a default collation for the table (MySQL). |
$table->temporary(); |
Create a temporary table (except SQL Server). |
Renaming / Dropping Tables
To rename an existing database table, use the rename
method:
Schema::rename($from, $to);
To drop an existing table, you may use the drop
or dropIfExists
methods:
Schema::drop('users');
Schema::dropIfExists('users');
Renaming Tables With Foreign Keys
Before renaming a table, you should verify that any foreign key constraints on the table have an explicit name in your migration files instead of letting Laravel assign a convention based name. Otherwise, the foreign key constraint name will refer to the old table name.
Columns
Creating Columns
The table
method on the Schema
facade may be used to update existing tables. Like the create
method, the table
method accepts two arguments: the name of the table and a Closure
that receives a Blueprint
instance you may use to add columns to the table:
Schema::table('users', function (Blueprint $table) {
$table->string('email');
});
Available Column Types
The schema builder contains a variety of column types that you may specify when building your tables:
| Command | Description |
|---|---|
$table->bigIncrements('id'); |
Auto-incrementing UNSIGNED BIGINT (primary key) equivalent column. |
$table->bigInteger('votes'); |
BIGINT equivalent column. |
$table->binary('data'); |
BLOB equivalent column. |
$table->boolean('confirmed'); |
BOOLEAN equivalent column. |
$table->char('name', 100); |
CHAR equivalent column with an optional length. |
$table->date('created_at'); |
DATE equivalent column. |
$table->dateTime('created_at'); |
DATETIME equivalent column. |
$table->dateTimeTz('created_at'); |
DATETIME (with timezone) equivalent column. |
$table->decimal('amount', 8, 2); |
DECIMAL equivalent column with a precision (total digits) and scale (decimal digits). |
$table->double('amount', 8, 2); |
DOUBLE equivalent column with a precision (total digits) and scale (decimal digits). |
$table->enum('level', ['easy', 'hard']); |
ENUM equivalent column. |
$table->float('amount', 8, 2); |
FLOAT equivalent column with a precision (total digits) and scale (decimal digits). |
$table->geometry('positions'); |
GEOMETRY equivalent column. |
$table->geometryCollection('positions'); |
GEOMETRYCOLLECTION equivalent column. |
$table->increments('id'); |
Auto-incrementing UNSIGNED INTEGER (primary key) equivalent column. |
$table->integer('votes'); |
INTEGER equivalent column. |
$table->ipAddress('visitor'); |
IP address equivalent column. |
$table->json('options'); |
JSON equivalent column. |
$table->jsonb('options'); |
JSONB equivalent column. |
$table->lineString('positions'); |
LINESTRING equivalent column. |
$table->longText('description'); |
LONGTEXT equivalent column. |
$table->macAddress('device'); |
MAC address equivalent column. |
$table->mediumIncrements('id'); |
Auto-incrementing UNSIGNED MEDIUMINT (primary key) equivalent column. |
$table->mediumInteger('votes'); |
MEDIUMINT equivalent column. |
$table->mediumText('description'); |
MEDIUMTEXT equivalent column. |
$table->morphs('taggable'); |
Adds taggable_id UNSIGNED BIGINT and taggable_type VARCHAR equivalent columns. |
$table->multiLineString('positions'); |
MULTILINESTRING equivalent column. |
$table->multiPoint('positions'); |
MULTIPOINT equivalent column. |
$table->multiPolygon('positions'); |
MULTIPOLYGON equivalent column. |
$table->nullableMorphs('taggable'); |
Adds nullable versions of morphs() columns. |
$table->nullableTimestamps(); |
Alias of timestamps() method. |
$table->point('position'); |
POINT equivalent column. |
$table->polygon('positions'); |
POLYGON equivalent column. |
$table->rememberToken(); |
Adds a nullable remember_token VARCHAR(100) equivalent column. |
$table->smallIncrements('id'); |
Auto-incrementing UNSIGNED SMALLINT (primary key) equivalent column. |
$table->smallInteger('votes'); |
SMALLINT equivalent column. |
$table->softDeletes(); |
Adds a nullable deleted_at TIMESTAMP equivalent column for soft deletes. |
$table->softDeletesTz(); |
Adds a nullable deleted_at TIMESTAMP (with timezone) equivalent column for soft deletes. |
$table->string('name', 100); |
VARCHAR equivalent column with a optional length. |
$table->text('description'); |
TEXT equivalent column. |
$table->time('sunrise'); |
TIME equivalent column. |
$table->timeTz('sunrise'); |
TIME (with timezone) equivalent column. |
$table->timestamp('added_on'); |
TIMESTAMP equivalent column. |
$table->timestampTz('added_on'); |
TIMESTAMP (with timezone) equivalent column. |
$table->timestamps(); |
Adds nullable created_at and updated_at TIMESTAMP equivalent columns. |
$table->timestampsTz(); |
Adds nullable created_at and updated_at TIMESTAMP (with timezone) equivalent columns. |
$table->tinyIncrements('id'); |
Auto-incrementing UNSIGNED TINYINT (primary key) equivalent column. |
$table->tinyInteger('votes'); |
TINYINT equivalent column. |
$table->unsignedBigInteger('votes'); |
UNSIGNED BIGINT equivalent column. |
$table->unsignedDecimal('amount', 8, 2); |
UNSIGNED DECIMAL equivalent column with a precision (total digits) and scale (decimal digits). |
$table->unsignedInteger('votes'); |
UNSIGNED INTEGER equivalent column. |
$table->unsignedMediumInteger('votes'); |
UNSIGNED MEDIUMINT equivalent column. |
$table->unsignedSmallInteger('votes'); |
UNSIGNED SMALLINT equivalent column. |
$table->unsignedTinyInteger('votes'); |
UNSIGNED TINYINT equivalent column. |
$table->uuid('id'); |
UUID equivalent column. |
$table->year('birth_year'); |
YEAR equivalent column. |
Column Modifiers
In addition to the column types listed above, there are several column "modifiers" you may use while adding a column to a database table. For example, to make the column "nullable", you may use the nullable
method:
Schema::table('users', function (Blueprint $table) {
$table->string('email')->nullable();
});
Below is a list of all the available column modifiers. This list does not include the index modifiers:
| Modifier | Description |
|---|---|
->after('column') |
Place the column "after" another column (MySQL) |
->autoIncrement() |
Set INTEGER columns as auto-increment (primary key) |
->charset('utf8') |
Specify a character set for the column (MySQL) |
->collation('utf8_unicode_ci') |
Specify a collation for the column (MySQL/SQL Server) |
->comment('my comment') |
Add a comment to a column (MySQL/PostgreSQL) |
->default($value) |
Specify a "default" value for the column |
->first() |
Place the column "first" in the table (MySQL) |
->nullable($value = true) |
Allows (by default) NULL values to be inserted into the column |
->storedAs($expression) |
Create a stored generated column (MySQL) |
->unsigned() |
Set INTEGER columns as UNSIGNED (MySQL) |
->useCurrent() |
Set TIMESTAMP columns to use CURRENT_TIMESTAMP as default value |
->virtualAs($expression) |
Create a virtual generated column (MySQL) |
->generatedAs($expression) |
Create an identity column with specified sequence options (PostgreSQL) |
->always() |
Defines the precedence of sequence values over input for an identity column (PostgreSQL) |
Modifying Columns
Prerequisites
Before modifying a column, be sure to add the doctrine/dbal
dependency to your composer.json
file. The Doctrine DBAL library is used to determine the current state of the column and create the SQL queries needed to make the specified adjustments to the column:
composer require doctrine/dbal
Updating Column Attributes
The change
method allows you to modify some existing column types to a new type or modify the column's attributes. For example, you may wish to increase the size of a string column. To see the change
method in action, let's increase the size of the name
column from 25 to 50:
Schema::table('users', function (Blueprint $table) {
$table->string('name', 50)->change();
});
We could also modify a column to be nullable:
Schema::table('users', function (Blueprint $table) {
$table->string('name', 50)->nullable()->change();
});
{note} Only the following column types can be "changed": bigInteger, binary, boolean, date, dateTime, dateTimeTz, decimal, integer, json, longText, mediumText, smallInteger, string, text, time, unsignedBigInteger, unsignedInteger and unsignedSmallInteger.
Renaming Columns
To rename a column, you may use the renameColumn
method on the Schema builder. Before renaming a column, be sure to add the doctrine/dbal
dependency to your composer.json
file:
Schema::table('users', function (Blueprint $table) {
$table->renameColumn('from', 'to');
});
{note} Renaming any column in a table that also has a column of type
enum
is not currently supported.
Dropping Columns
To drop a column, use the dropColumn
method on the Schema builder. Before dropping columns from a SQLite database, you will need to add the doctrine/dbal
dependency to your composer.json
file and run the composer update
command in your terminal to install the library:
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('votes');
});
You may drop multiple columns from a table by passing an array of column names to the dropColumn
method:
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['votes', 'avatar', 'location']);
});
{note} Dropping or modifying multiple columns within a single migration while using a SQLite database is not supported.
Available Command Aliases
| Command | Description |
|---|---|
$table->dropRememberToken(); |
Drop the remember_token column. |
$table->dropSoftDeletes(); |
Drop the deleted_at column. |
$table->dropSoftDeletesTz(); |
Alias of dropSoftDeletes() method. |
$table->dropTimestamps(); |
Drop the created_at and updated_at columns. |
$table->dropTimestampsTz(); |
Alias of dropTimestamps() method. |
Indexes
Creating Indexes
The schema builder supports several types of indexes. First, let's look at an example that specifies a column's values should be unique. To create the index, we can chain the unique
method onto the column definition:
$table->string('email')->unique();
Alternatively, you may create the index after defining the column. For example:
$table->unique('email');
You may even pass an array of columns to an index method to create a compound (or composite) index:
$table->index(['account_id', 'created_at']);
Laravel will automatically generate a reasonable index name, but you may pass a second argument to the method to specify the name yourself:
$table->unique('email', 'unique_email');
Available Index Types
Each index method accepts an optional second argument to specify the name of the index. If omitted, the name will be derived from the names of the table and column(s).
| Command | Description |
|---|---|
$table->primary('id'); |
Adds a primary key. |
$table->primary(['id', 'parent_id']); |
Adds composite keys. |
$table->unique('email'); |
Adds a unique index. |
$table->index('state'); |
Adds a plain index. |
$table->spatialIndex('location'); |
Adds a spatial index. (except SQLite) |
Index Lengths & MySQL / MariaDB
Laravel uses the utf8mb4
character set by default, which includes support for storing "emojis" in the database. If you are running a version of MySQL older than the 5.7.7 release or MariaDB older than the 10.2.2 release, you may need to manually configure the default string length generated by migrations in order for MySQL to create indexes for them. You may configure this by calling the Schema::defaultStringLength
method within your AppServiceProvider
:
use Illuminate\Support\Facades\Schema;
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
}
Alternatively, you may enable the innodb_large_prefix
option for your database. Refer to your database's documentation for instructions on how to properly enable this option.
Renaming Indexes
To rename an index, you may use the renameIndex
method. This method accepts the current index name as its first argument and the desired name as its second argument:
$table->renameIndex('from', 'to')
Dropping Indexes
To drop an index, you must specify the index's name. By default, Laravel automatically assigns a reasonable name to the indexes. Concatenate the table name, the name of the indexed column, and the index type. Here are some examples:
| Command | Description |
|---|---|
$table->dropPrimary('users_id_primary'); |
Drop a primary key from the "users" table. |
$table->dropUnique('users_email_unique'); |
Drop a unique index from the "users" table. |
$table->dropIndex('geo_state_index'); |
Drop a basic index from the "geo" table. |
$table->dropSpatialIndex('geo_location_spatialindex'); |
Drop a spatial index from the "geo" table (except SQLite). |
If you pass an array of columns into a method that drops indexes, the conventional index name will be generated based on the table name, columns and key type:
Schema::table('geo', function (Blueprint $table) {
$table->dropIndex(['state']); // Drops index 'geo_state_index'
});
Foreign Key Constraints
Laravel also provides support for creating foreign key constraints, which are used to force referential integrity at the database level. For example, let's define a user_id
column on the posts
table that references the id
column on a users
table:
Schema::table('posts', function (Blueprint $table) {
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
});
You may also specify the desired action for the "on delete" and "on update" properties of the constraint:
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
To drop a foreign key, you may use the dropForeign
method. Foreign key constraints use the same naming convention as indexes. So, we will concatenate the table name and the columns in the constraint then suffix the name with "_foreign":
$table->dropForeign('posts_user_id_foreign');
Or, you may pass an array value which will automatically use the conventional constraint name when dropping:
$table->dropForeign(['user_id']);
You may enable or disable foreign key constraints within your migrations by using the following methods:
Schema::enableForeignKeyConstraints();
Schema::disableForeignKeyConstraints();
{note} SQLite disables foreign key constraints by default. When using SQLite, make sure to enable foreign key support in your database configuration before attempting to create them in your migrations.


{% extends 'panel.html' %} {% block head_title %}Open Humans is currently invite only{% endblock %} {% block head_title_suffix %}Open Humans is currently invite only{% endblock %} {% block panel_content %}
Sorry, Open Humans is currently open by invitation only, ahead of our public launch.
If we invited you, and you're having trouble creating an account, please let us know!


Classes
The following classes are available globally.
-
Provides methods for creating BoxSDKClient
See moreDeclaration
Swift
public class BoxSDK
-
Provides communication with Box APIs. Defines methods for communication with Box APIs
See moreDeclaration
-
Describes authentication errors.
Declaration
Swift
public class BoxAPIAuthError : BoxAPIError
-
Describes API request related errors.
See moreDeclaration
Swift
public class BoxAPIError : BoxSDKError
-
Describes encoding and decoding related errors.
Declaration
Swift
public class BoxCodingError : BoxSDKError
-
Describes network related errors.
Declaration
Swift
public class BoxNetworkError : BoxSDKError
-
Describes general SDK errors
See moreDeclaration
Swift
public class BoxSDKError : Error
extension BoxSDKError: CustomStringConvertible
extension BoxSDKError: LocalizedError
-
Provides functionality for creating a Metadata Search Filter.
See moreDeclaration
Swift
public class MetadataSearchFilter
-
Defines logging into a console
See moreDeclaration
Swift
public class ConsoleLogDestination : LogDestination
-
Defines logging into a file
See moreDeclaration
Swift
public class FileLogDestination : LogDestination
-
Declaration
Swift
public class AuthModule : TokenRefreshing
-
Provides management for Client Credentials Grant authentication.
See moreDeclaration
Swift
public class CCGAuthModule : AuthModule
-
Provides Collaborations management.
See moreDeclaration
Swift
public class CollaborationAllowlistModule
-
Provides Collaborations management.
See moreDeclaration
Swift
public class CollaborationsModule
-
Management of collections of files and folders. The only collection available is the “Favorites”.
See moreDeclaration
Swift
public class CollectionsModule
-
Provides management of FileRequests
See moreDeclaration
Swift
public class FileRequestsModule
-
Provides management of Legal Holds
See moreDeclaration
Swift
public class LegalHoldsModule
-
Defines methods for metadata management
See moreDeclaration
Swift
public class MetadataCascadePolicyModule
-
Defines methods for metadata management
See moreDeclaration
Swift
public class MetadataModule
-
Returns information about files that have been accessed by a user not long ago.
See moreDeclaration
Swift
public class RecentItemsModule
-
Provides RetentionPolicy management.
See moreDeclaration
Swift
public class RetentionPoliciesModule
-
Provides functionality to search for content.
See moreDeclaration
Swift
public class SearchModule
-
Provides SharedItem management.
See moreDeclaration
Swift
public class SharedItemsModule
-
Provides management of Sign Requests
See moreDeclaration
Swift
public class SignRequestsModule
-
Provides management of Storage Policies
See moreDeclaration
Swift
public class StoragePoliciesModule
-
Provides Tasks management
See moreDeclaration
Swift
public class TasksModule
-
Provides TermsOfService management.
See moreDeclaration
Swift
public class TermsOfServicesModule
-
Module for trash management
See moreDeclaration
Swift
public class TrashModule
-
Provides management of Webhooks
See moreDeclaration
Swift
public class WebhooksModule
-
A Box network task for a download
Declaration
Swift
public class BoxDownloadTask : BoxNetworkTask
-
Implementation of networking layer
See moreDeclaration
Swift
public class BoxNetworkAgent : NSObject, NetworkAgentProtocol
-
A Box network task request.
See moreDeclaration
Swift
public class BoxNetworkTask : Cancellable
-
A Box network task returned for a upload
Declaration
Swift
public class BoxUploadTask : BoxNetworkTask
-
Represents Box SDK API request.
See moreDeclaration
Swift
public class BoxRequest
-
Collections contain information about the items contained inside of them, including files and folders. The only collection available is the “Favorites” collection. The contents of the collection are discovered in a similar way in which the contents of a folder are discovered.
See moreDeclaration
Swift
public class BoxCollection : BoxModel
-
Entry container for items of inner model
See moreDeclaration
Swift
public class EntryContainerInnerModel<T> : BoxInnerModel where T : BoxInnerModel
-
Defines upload email address for a folder.
See moreDeclaration
Swift
public class FolderUploadEmail : BoxInnerModel
-
Prefill tags are used to prefill placeholders with signer input data. Only one value field can be included.
See moreDeclaration
Swift
public class SignRequestPrefillTag : BoxInnerModel
-
Info about the tokens used by the SDK for authentication.
See moreDeclaration
Swift
public class TokenInfo : Codable
extension TokenInfo: Equatable
-
An authorization session using Client Credentials Grant
See moreDeclaration
Swift
public class CCGAuthSession : SessionProtocol, ExpiredTokenHandling
-
An authorization session using JWT token
See moreDeclaration
Swift
public class DelegatedAuthSession : SessionProtocol
-
OAuth 2 Session
See moreDeclaration
Swift
public class OAuth2Session : SessionProtocol, ExpiredTokenHandling
-
Developer session that only requires a developer token. Session will only work as long as the token is valid.
See moreDeclaration
Swift
public class SingleTokenSession : SessionProtocol
-
Token store that uses the Apple keychain
See moreDeclaration
Swift
public class KeychainTokenStore : TokenStore


--- layout: post title: RF Spectrum Comparison Tool date: '2015-12-16 14:21:52 -0500' categories: - Electronics - Radio tags: [] comments: [] ---
In my last post, I mentioned a technique for measuring the frequency response of an RF circuit. The method is, you apply a white noise signal and measure the response. Any deviations from white are due to the circuit.
In practice, we found it more convincing to compare the measured spectrum to another with the circuit unplugged or disabled. Here's the tool chain we've been using.
The spectra are measured using rtl_power, a command line spectrum analyzer, available as part of the rtl_sdr package.
An rtl_power command looks like this:
{% highlight bash %}
rtl_power -f 40M:1500M:1M -i 100s -e 100s out.csv
{% endhighlight %}
The -f specifies the frequency start:stop:step. The -i specifies the time to to take per sweep. The -e gives the total time to run (so setting -i and -e equal means one sweep). The last argument is the output file.
Phil then stole a pair of python programs to remove some of the formatting of the output csv and then plot the spectrum.
flatten.py
{% highlight python %}
import sys
from collections import defaultdict
# todo
# interval based summary
# tall vs wide vs super wide output
def help():
print("flatten.py input.csv")
print("turns any rtl_power csv into a more compact summary")
sys.exit()
if len(sys.argv) <= 1:
help()
if len(sys.argv) > 2:
help()
path = sys.argv[1]
sums = defaultdict(float)
counts = defaultdict(int)
def frange(start, stop, step):
i = 0
f = start
while f <= stop:
f = start + step*i
yield f
i += 1
for line in open(path):
line = line.strip().split(', ')
low = int(line[2])
high = int(line[3])
step = float(line[4])
weight = int(line[5])
dbm = [float(d) for d in line[6:]]
for f,d in zip(frange(low, high, step), dbm):
sums[f] += d*weight
counts[f] += weight
ave = defaultdict(float)
for f in sums:
ave[f] = sums[f] / counts[f]
for f in sorted(ave):
print(','.join([str(f), str(ave[f])]))
{% endhighlight %}
plot.py
{% highlight python %}
import numpy as np
import sys
import matplotlib.pyplot as plt
filename = sys.argv[1]
backfile = sys.argv[2]
freq, db = np.loadtxt(filename, delimiter=',', usecols=(0, 1), unpack=True)
backfreq, backdb = np.loadtxt(backfile, delimiter=',', usecols=(0, 1), unpack=True)
plt.plot(freq,db)
plt.plot(freq,backdb)
plt.xlabel('Hz')
plt.ylabel('db')
plt.show()
{% endhighlight %}
We then wrote a bash script that collects two spectra (prompting the user to alter the circuit between the collections), then flattens them and plots them together.
{% highlight bash %} rtl_power -f $1 -i $2 -e $2 outbg.csvread -p "plug in filter" -n 1 -s
rtl_power -f $1 -i $2 -e $2 out.csv
python flatten.py outbg.csv > outbg_flat.csv
python flatten.py out.csv > out_flat.csv
python plot_with_background.py out_flat.csv outbg_flat.csv
{% endhighlight %}
Here's an example output:


Do you want to take control of your weight?
Do you have to make immediate changes for your health's sake?
Do you want to have the figure that shows you are healthy, vibrant and confident?
Do you want to STOP negative, destructive eating and living patterns?
Do you want to STOP the feelings and thoughts that sabotage your efforts?
Do you want to make these changes permanent?
Do you want your excess weight GONE FOR GOOD?
If the answer is YES to any or all of the above then read on . . .
It works by showing you HOW to follow a weight loss programme properly without turning to food for comfort. You'll learn how to avoid cheating. You'll learn how to resist tempting food. You'll learn how to motivate your self to exercise, even if you are not naturally inclined to do so.
Once you know how to do these things You'll step on the scales and see a lower number reflected week after week. You'll drop clothing sizes. You'll have more energy, more confidence, better health, improved self-esteem.
Every day for 10 weeks you will have a task to carry out. Some will be once-offs. Others will be repeated. We meet to discuss how you will approach the tasks and what you may have to alter to allow you carry them out.
We will look at sabotaging thinking and EFFECTIVE responses to it. We will look at feeling deprived, discouraged and stressed due to other life events. As a result of this work You'll not only overcome your current difficulty, you will also have the skills to overcome any future difficulties.
YES it does. I've used it myself and continue to do so daily.
YES it will. The harder you work at the programme the better your results will be. It is a commitment to you, the programme and your future so think about it carefully. Done properly this will be the last time you will tackle your weight issues.
By committing to making the changes in this programme you will be giving yourself the mental and emotional foundations you need to succeed NOW and in the FUTURE when your excess weight has GONE FOR GOOD
I have been working in the area of Behavioural Change with people since 1993. I understand the challenges this sort of commitment to change can bring. I promise to work as hard as you do. We will have 8 face-to-face sessions during the programme.
I will support you in every way possible HOWEVER I am not soft. I am tough but fair. I know ALL the excuses. I have made them to myself and others over the years. All your materials i.e. task lists, cards, notebooks are supplied and there is a follow-on session 2 months after completion.
I want this to work for you for once and for all.
Contact me when you are ready... Contact


Most people agree that we need to reduce greenhouse gas emissions, so that we can limit the dangerous effects of global warming. There are, however, many different strategies for doing this. Should we focus our efforts on switching to electric cars? Or to convincing everyone to switch to a vegan diet? How can we evaluate and find the best strategies for reducing emissions - before it's too late?
in-context


{Select_firmware}
{Selected_board}
{Change}
{Board_revision}
(Select one)
{Firmware}
(Select one)
{Obsolete}
{Beta}
{Firmware_revision}
(Select one)
{Obsolete}
{Beta}
{Firmware_download_required}
{Firmware_information}
{Included_script_engines}


Rainbow run to reunite in 'Aurora' MV teasers
by germainejRainbow have released their music video teasers for "Aurora"!
In the MV teasers, the Rainbow members run separately and together with a box of memories in hand. "Aurora" is a track from Rainbow's upcoming 10th anniversary special album, which also includes "I Dream of You".
Rainbow's "Aurora" drops on November 14 KST! What do you think of the MV teasers?


Man found guilty of murdering backpacker Grace Millane on a Tinder date
It was her 22nd birthday when Grace Millane met the man in Auckland, New Zealand
by Press Association, Thomas DeaconA man has been found guilty of the murder of backpacker Grace Millane in New Zealand.
The young woman from Wickford, Essex, was strangled by a 27-year-old man she had met on Tinder after spending several hours drinking in the centre of Auckland on December 1, 2018.
The pair returned to his apartment and Ms Millane was killed either that night or in the early hours of the next morning - the date of her 22nd birthday.
Prosecutors said the man deliberately strangled her but his defence claimed Ms Millane died accidentally during sex.
The jury of seven women and five men returned a unanimous verdict after just five hours deliberation at Auckland High Court.
The Mirror reported that Auckland High Court heard how the man Googled 'flesh-eating birds' and 'are there vultures in New Zealand' as he researched how to dispose of her body.
He then bought two suitcases and stuffed her body into one of them, before burying it in a shallow grave outside Auckland.
The defendant also arranged another Tinder date while Grace lay dead in his hotel room.
The Crown successfully argued the man, who cannot be named for legal reasons, strangled her and shoved her body inside a suitcase before burying her in a forested area outside Auckland.
She was assumed missing and her father, David Millane, flew to New Zealand as local authorities spent a week searching until her body was found by police.
Ms Millane's parents David and Gillian left the courthouse holding hands.
Mr Millane wept as he told reporters: "The verdict of murder today will be welcomed by every member of the Millane family and friends of Grace.
"It will not reduce the pain and suffering we have had to endure over the past year.
"Grace was taken in the most brutal fashion a year ago and our lives have been ripped apart.
"Grace was our sunshine and she will be missed forever."
The defence had claimed the death was accidental and occurred during rough sexual intercourse.
Justice Simon Moore told jury members before they delivered their verdict that they had to be certain the man had murderous intent when he put his hands on Ms Millane's neck during sexual intercourse to convict him of murder, the New Zealand Herald reported.
Mr Moore asked: "Are you sure that when he applied pressure to Ms Millane's neck... Did he intend to cause injury?"
He further asked them to consider if the accused was willing to take the chance of Ms Millane dying due to his actions.
"If yes, then (the defendant) is guilty of murder," the judge said.
"In other words, (he) must have appreciated Ms Millane's death was a likely consequence... but was willing to run that risk."
The court had been told Ms Millane had an interest in BDSM, with a previous sexual partner testifying they had used safe words and physical tapping to indicate when physical pressure became overwhelming.
During the trial the jurors heard from forensic experts who examined the accused's apartment for blood stains as well as Ms Millane's body after her death.
They were also shown footage of the woman and the defendant drinking at various bars throughout Auckland and kissing before they returned to his apartment.
Video footage from the elevator of her exiting on the third floor marked the last recorded time Ms Millane was seen alive.


| Interface | Description |
|---|---|
| EventListener |
The EventListener interface is implemented by classes
that will register with a Simulator to receive notification
when changes occur in a model's state and output.
|
| Class | Description |
|---|---|
| Atomic<X> |
This interface is implemented by atomic DEVS models.
|
| Devs |
This is the base class for all DEVS models.
|
| Digraph |
This is a digraph model for connecting multiple input/multiple output
systems.
|
| Digraph.PortValue |
Input and output for the Digraph and its components
must be PortValue objects.
|
| Event |
The Event class is used to inject models into a running
simulation, to route input and output within a network
model, and to receive notifications of output by an
EventListener.
|
| Network |
This is the base class for all Network (coupled) models.
|
| SimpleDigraph |
This is a very simple digraph model for connecting single input/single output
systems.
|
| Simulator |
This is a wrapper around the C++ Simulator class.
|
| Exception | Description |
|---|---|
| SimulationException |
These exceptions are thrown by the simulator to indicate problems
at execution time.
|


{% extends 'LoginApp/base.html' %} {% block content %} Forgot Password Sad You Forgot the password To Reset your password enter the correct email and mobile no. associated with your account and you will be redirected to the password reset page. Forgot Password! {% if messages %} {% for message in messages %} {{ message }} {% endfor %} {% endif %} {% csrf_token %} Verify {% endblock %}
Forgot Password
To Reset your password enter the correct email and mobile no. associated with your account and you will be redirected to the password reset page.


created 05/08/00
Modify the first example in the chapter so that it uses the C-style input loop.
Click here to go back to the main menu.
The file copy example program in the chapter is
longer than it needs to be.
Make it shorter by
using fewer try{}
blocks.
(This will result in less specific error messages).
Write a file copy program that uses a graphical user interface. The user enters the name of the file to copy and the name of the destination file in TextFields and clicks a button to perform the copy. Write error messages into another TextField.
For a nicer program,
look in your documentation for the
FileDialog
class.
Include it in the GUI so the user
can choose the source file graphically.
Write a class that reads data from a file
containing integers in character format.
This class will be a software tool that
other programs can use to simplify their
own input.
The constructor for the class will use
the name of the input file as a parameter,
and will create the appropriate streams.
Write a close()
method
and a method int getNextInt()
that returns the value of the next integer
from the stream.
When an error is encountered,
these methods will write an error message
and stop the program.
The input file may have none, one, or several integers per line. A suitable file could be created by the program for Exercise 1 of the previous chapter. The class will work with any number of integers total, and a varying number of integers per line.
Use BufferedReader
,
FileReader
,
parseInt()
,
and StringTokenizer
.
Test your class by using it in a program that writes the integers from the input file on the monitor, one per line. Once the class is debugged there are many other programs you can write that use it:
Write a program that inputs a Java source code file and outputs a copy of that file with Java keybords surrounded with HTML tags for bold type. For example this input:
public class JavaSource { public static void main ( String[] args ) { if ( args.length == 3 ) new BigObject(); else System.out.println("Too few arguments."); } }
will be transformed into:
public class JavaSource { public static void main ( String[] args ) { if ( args.length == 3 ) new BigObject(); else System.out.println("Too few arguments."); } }
In a browser the code will look like this:
public class JavaSource { public static void main ( String[] args ) { if ( args.length == 3 ) new BigObject(); else System.out.println("Too few arguments."); } }Click here to go back to the main menu.
Any text editor, such as Notepad, can be used to create web pages. Unfortunately, these editors usually do not check spelling. Word processors can open a text file and check its spelling.  This exercise is to write a utility that strips the HTML tags from a text file.
Write a program that reads in a text file and writes out another text file. The input file may have any number of HTML tags per line. The output file will be a copy of the input file but with spaces substituted for each HTML tag. The program will not check HTML syntax; it looks at the file as a stream of tokens and substitutes spaces for each token that is a tag. For this program, an HTML tag is any token that looks like one of these:
<Word> </Word>
Assume that Word is a single word (perhaps just one letter or no letters) and that there are no spaces between the left and right angle brackets. With this definition, the following are tags:

   <rats> </1234>
 </>
With this definition, the following are NOT tags (although some are with real HTML):

  </e m>
 <block quote> Challenging Exercise: Write the program to filter out any tag that looks like one of these:
<Word .... > </Word ... >
Now Word
is a single word that immediately
follows the left angle bracket, but may be followed by
more text which may include spaces.
A tag ends with a right angle bracket, which
might or might not be
preceeded by a space.
Assume that a tag starts and ends on the same line.
With this definition,
the following are tags

 <word another word> </x y z>
Start by setting a flag to false.
Now look at the input stream of tokens one by one.
When a token starts a tag set a boolean flag to true.
While the flag is true discard tokens until encountering
a tag end
First Part:
Letters of the alphabet occur in text at different frequencies. Write a program that confirms this phenomonon. Your program will be invoked from the command line like this:
C:\mydir> java freqCount avonlea.txt avonlea.rept -allIt will then read through the first text file on the command line (in this case "avonlea.txt") accumulating the counts for each letter. When it reaches the end of the file, it will write a report (in this case "avonlea.rept") that displays the total number of alphabetic characters "a-zA-Z" and for each character the number of times it occured and the relative frequency with which it occured. In counting characters, regard lower case "a-z" and upper case "A-Z" characters as identical.
You will need an array of 26 long integers, one per character. To increment the count for a particular character you will have to convert it into an index in the range 0..25. Do this by first determining which range the character belongs in:"a-z" or "A-Z" and then subtracting 'a' or 'A' from it, as appropriate:
int inx = (int)ch - (int)'A' ; count[inx]++ ;Discard characters not in either range without increasing any count.
Second Part:
Do the relative frequencies of the initial letters of words differ from the relative frequencies for all letters in a text? Add logic to the program so that it examines only the first character in each word. Allow the user to chose between the two options with a switch on the command line:
C:\mydir>java freqCount avonlea.txt avonlea.rept -firstFor this option it will be convenient to use the Java class
StringTokenizer
to deliver individual words one at a time. In the string of delimiters passed toStringTokenizer
include whitespace and all punctuation that might be at the start or end of a word. This is not quite good enough for an accurate count because some words will be split between linesIt is often true that handling the an- noying details makes up the large maj- ority of the statements in a pro- gram.So, if the last token in a line (returned by
StringTokenizer
) ends with '-', don't include the first letter of the first token on the next line in the count.
Testing:
For testing, create some really simple files that demonstrate that your program is working. For instance:
AAAAAAAAAA AAAAAAAAAA AAAAAAAAAA AAAAAAAAAA AAAAAAAAAA AAAAAAAAAA AAAAAAAAAA AAAAAAAAAA AAAAAAAAAA AAAAAAAAAA aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa !*$#)#%$#) @##$%))!__ !#4241-432 !_#*%_@*(* !@%#*#.,?+and:
AAAAA AAAAA- BBBBB BBBBB- CCCCC CCCCC- DDDDD-DDDDD EEEEE-EEEEEThe first draft of your program will write its count to the monitor for easy debugging. Add text file output later. It is probably wise to write the first part of the program and debug it before moving on to the second option.
Download a text file of a novel of at least 400K bytes from Project Gutenberg.. Use a file that does not use HTML formatting tags (which would confuse the count). Delete the text at the beginning of the file that is not part of the novel (the legalese and documentation). Run both options of the program on the text.
Example:
Here is a sample run of my program with the text "Ann of Avonlea" from project Gutenberg.
C:\mydir>java freqCount avonlea.txt avonlea.rept -all C:\mydir>type avonlea.rept Total alphabetical characters: 373267 A: 31840 8.53% B: 5942 1.59% C: 7627 2.04% D: 17541 4.69% E: 45614 12.22% F: 7191 1.92% G: 7960 2.13% H: 22500 6.02% I: 25095 6.72% J: 733 0.19% K: 3443 0.92% L: 17534 4.69% M: 9324 2.49% N: 26516 7.1% O: 27344 7.32% P: 6083 1.62% Q: 275 0.07% R: 21285 5.7% S: 23398 6.26% T: 32579 8.72% U: 10720 2.87% V: 4201 1.12% W: 9063 2.42% X: 546 0.14% Y: 8745 2.34% Z: 168 0.04%
End of Exercises.
Click here to go back to the main menu.


Personal Values
After a full day of command line and version control you would think an exploration into my personal values would be both easy, and enjoyable. But for some reason it had me stumped. Sometimes the things we hold closest are the hardest to see, yet as I dug deeper a lot came spilling out.
It became increasingly apparent as I spoke to others and reflected on my life’s path that something I hold extremely close is my relationships; friends, family, lovers and community. But also the person I am yet to meet.
As I was brought up by my single mother, travelling from country to country but largely being based in Bali, I was exposed to a lot of different cultures and different people. It’s not far fetched to see how this would have been catalytic for my tolerance and generosity towards others as well as my appreciation for diversity and uniqueness. Everyone has value and everyone deserves respect.
Once we had settled I was exposed to a new way of living with people. Mum married a dairy farmer with a large Irish Catholic family and I found myself immersed in new familial dynamics. My grandma and uncle living just down the path, my cousins up the road. It wasn’t uncommon for family dinner to be 10 people and Christmas involved more people than students at my school. Such varied exposure to people helped me understand the nuances of relationships and has led me to valuing ‘Family’ with high regard.
I also value my time, my autonomy, my freedom. I have an unconventional and varied path to where I am now, with lots of indulgences in my own journey and time spent understanding myself. Travel and in particular what motivated me to travel reflects these values; often spending large chunks of time in new environments purely to better understand myself.
I value beauty. Evident in my love of creating spaces for people to be in, the right music, lighting, food and wine. I run small events focused on sharing music and poetry; environments for people to connect with each other. I lean towards potlucks and board games but also art festivals where people can express themselves through performance, sculpture and adornment.
Strengths & Limitations
My focus on people and community lends itself to my learning through approaching it as a shared activity. One where we can draw from each other to propel each other forward. I love EDA’s approach to learning, encouraging our advancement through interacting with our cohort. Teaching a concept is the ultimate test of understanding it and I see how moving together as a group will crystallize our knowledge.
I am prone to sacrificing my own personal wellbeing and aspirations through seeing myself as a part of a larger body of people and losing sight of myself as an individual. I can also get caught up in how I stand in comparison to others rather than applying focus to my own personal goals, achievements, and limitations.
I believe it’s easy to overcompensate as we strive for something, especially if that thing is an aspect of ourselves we are developing. I have also noticed in myself a stark contrast to a community-mindset, a self-absorption that I hope to understand and mature.
My last living environment involved eight people in a big house exploring ways in which we could live together. We had communal ethics and a loose idea of what we wanted to achieve by living together but this did not stop tensions arising. I learnt a lot. Ultimately we were able to explore different ways of mediating any tensions that arose through conversation, decision making process and shared agreement. Observing myself in this environment was particularly interesting and I frequently found myself coming up against what I felt was a culture of individualism in a communal flat. I explored speaking to people one on one, group meetings, consensus based decision (difficult, we didn’t have a vacuum cleaner for two months as a result), majority vote and more. It felt quite political at times. In approaching this situation again I would ask the group to develop a constitution together, dial in what our core values are, and fall back on them when we were up against a difficult decision.


P L A Y - P I G - D I C E
INSTRUCTIONS
- Player 1 and player 2 rolls sides 2 - 6, the dice answer is added to their total and continue rolling.
- when player 1 or player 2 rolls a 1, their total score reverts to 0 and it becomes the next player's turn.
- When the player chooses to "pass", their total is added to their total score, and it becomes the next
player's turn.
- The player who first scores 100 wins the game
Player one
Dice Roll:
Turn Score:
Total Score:
Player two
Dice Roll:
Turn Score:
Total Score:
<
Copyright© 2019 Max-Maina


--- layout: post title: "Blog is finally customized and running)" subtitle: "Yay" date: 2021-08-28 00:00:00 background: '/img/posts/01.jpg' ---
I've finally customized Jekyll theme the way I like it, and not shy to upload it to Github Pages.
Probably in near future I will make post about discord.py Battleship game bot.


{%extends 'base.html'%} {%block content%}
Welcome, {{current_user.username}}
You've volunteered for: {{current_user.volunteerhours}} hours
You're hosting these clean ups: {{current_user.hosted}}
You joined these clean ups: {{current_user.participated}}
{%endblock%}


Don't Die
On Mobile
Tap the screen to play.
Tap the screen to change direction.
On Desktop
Tap the spacebar to play.
Tap the spacebar to change direction.
Your browser does not support the HTML5 Canvas tag. Please switch to a modern browser


In order to onboard and manage the IoT Devices, Following are the major phases the device should go through –
When a new device is registered, vitalpointz IoT Core / Core Lite does following step for the device.
vitalpointz is a software maker that specializes on developing and offering IOT platform softwares & services. IOT Devices and sensors can be registered on the IOT Platform and on-boarded securely. IOT devices can send or receive data securely, application can be built, Over-the Air software updates can be rolled out to the devices at scale. Vitalpointz IOT Platform also provides various interface methods to transfer the data to external third-party tools and platforms, if so desired. Vitalpointz IOT Platform also bundles various device agents.
For more information about our product please check our product documentation here.
If you have any enquires, reach out to us via email : info@vitalpointz.net


Training configuration yaml builder
Dataset
Custom dataset name:
Use Torchvision Dataset
Transform
Add Custom
Add TorchVisionTransform
Delete Custom
Delete Transform
Model
Train
Evaluation
Loss
Optimizer
Scheduler
Hooks
Add Custom
Add Hook
Delete Custom
Delete Hook
Generated YAML
{{ConfigurationYaml}}
Download


|
C++ Actor Framework 0.18
|
Provides a convenient interface for creating message
objects from a series of values using the member function append
.
More...
#include <message_builder.hpp>
Public Member Functions | |
| message_builder (const message_builder &)=delete | |
| message_builder & | operator= (const message_builder &)=delete |
| template<class Iter > | |
| message_builder (Iter first, Iter last) | |
Creates a new instance and immediately calls append(first, last) . | |
| template<class Iter > | |
| message_builder & | append (Iter first, Iter last) |
| Appends all values in range [first, last). | |
| template<class T > | |
| message_builder & | append (T &&x) |
Adds x to the elements of the buffer. | |
| message_builder & | append_from (const caf::message &msg, size_t first, size_t n=1) |
Adds elements n elements from msg to the buffer, starting at index first . | |
| template<class... Ts> | |
| message_builder & | append_all (Ts &&... xs) |
| template<class Tuple , size_t... Is> | |
| message_builder & | append_tuple (Tuple &xs, std::index_sequence< Is... >) |
| template<class... Ts> | |
| message_builder & | append_tuple (std::tuple< Ts... > xs) |
| message | to_message () const |
| Converts the buffer to an actual message object without invalidating this message builder (nor clearing it). | |
| message | move_to_message () |
| Converts the buffer to an actual message object and transfers ownership of the data to it, leaving this object in an invalid state. | |
| void | clear () noexcept |
| Removes all elements from the buffer. | |
| bool | empty () const noexcept |
| Returns whether the buffer is empty. | |
| size_t | size () const noexcept |
| Returns the number of elements in the buffer. | |
Friends | |
| class | message |
Provides a convenient interface for creating message
objects from a series of values using the member function append
.
| message_builder & caf::message_builder::append_from | ( | const caf::message & | msg, |
| size_t | first, | ||
| size_t | n = 1 |
||
| ) |
Adds elements n
elements from msg
to the buffer, starting at index first
.
| message caf::message_builder::move_to_message | ( | ) |
Converts the buffer to an actual message object and transfers ownership of the data to it, leaving this object in an invalid state.


SourcE-commerce
Username
Sales
Inventory
Inventory
Product Name
Description
Price
Quantity
Add photo
Submit
Previous
Next


| 1 Nov 1917 |
Union Carbide & Carbon Corp. formed from a merger of four companies. |
| 1939 |
Absorbs Bakelite Corporation. |
| 1957 |
Name changed to Union Carbide. |
| 3 Dec 1984 |
Methyl isocyanate leaks from a Union Carbide pesticide plant located at a slum in Bhopal, India. The gas kills 4,000 people and injures 200,000 others, many of whom were permanently blinded or disabled. The event set a standard for industrial accidents that has yet to be equalled. |
| 7 Dec 1989 |
Melvin Belli files a $15 billion class-action lawsuit against Union Carbide for the Bhopal incident. |
| 6 Feb 2001 |
Union Carbide totally absorbed into Dow Chemical Company. |
| 3 Dec 2004 |
On the 20th anniversary of the Bhopal incident, a spokesman from Dow Chemical, calling himself Jude Finisterra, appears on BBC National TV, stating that the chemical giant accepts full responsibility for the disaster, and would begin plans for a $12 billion remuneration to the people killed or injured. A couple hours later, spokesmen from Dow repudiated this interview, saying that the man interviewed on the BBC was not a spokesman for the company, and that the company still denied responsibility for the atrocity, and that all promises of remuneration were false. |


Test File Organisation for Zoroaster
Organising your test files has never been simpler. Create a
test directory in your project root,
in it place
context,
spec,
fixtures and
temp directories (optionally, if you work with
io). For example, your project file structure might look like this:
- CHANGELOG.md
- LICENSE
- package.json
- README.md
- src
- src/index.js
- test
- test/context
- test/context/ScreenCapture.js
- test/fixtures
- test/fixtures/screenshot.png
- test/spec
- test/spec/index.js
- test/spec/record-video.js
All testing functions which can be required by both test files should be exported in
ScreenCapture
context. This makes test independent of the scope of
js files, making it easy to create new
test suites in new files.


Head Blacksmith Noel:
You came back empty-handed? Hurry up and get five units of Lunargent and a bottle of Hellfire Oil!


Next worker:
All is quiet in the camp.
Founded: -
Luxury resources available: -
Danger from raids:
Camp defences:
Last raid:
Trade with other camps:
Level population density:
Level raid danger:
Make sure you pack enough supplies before you leave.
(2 blocks)
| 0 | ||||
Nothing here
Show obsolete
Maximum followers
Nothing here.
No visitors here at the moment.
There are still places to explore on this level.
Click on a sector to see details.
Select a sector to see details.
| District: | |
| Distance: | |
| Points of interest: | |
| Scavenging: | |
| Collectors: | |
| Threats: | |
| Blockers: | |
| Environment: | |
| Other: |
No traders here at the moment.
No trade partners discovered yet.
Available caravans:
There are no building projects available. Explore the map to find some.
There are no building projects available.
No available upgrades at the moment.
Completed upgrades: 0
Click on an upgrade to see details.
Upgrade description
Upgrade effects
No news from other camps at the moment.
| camp | pop | rep | raid | storage | production |
|---|
Enemy name & strength
Enemy strength
Enemy difficulty
Player name
Player strength
Camp inventory
(empty)
Camp offer
(empty)
0
Trader offer
(empty)
0
Trader inventory
(empty)
Note that the game is still in alpha and updates can break old saves.
Select a save slot from the list
Info
Export