Working with REST APIs using Serenity Screenplay
The Screenplay pattern is an approach to writing automated acceptance tests that helps us write cleaner, more maintainable, more scalable automation code. A Screenplay test talks first and foremost about the tasks a user performs, in business language, rather than diving into the details about buttons, clicks and input fields. Focusing on the business tasks makes our tests more readable, more maintainable, and easier to scale.
Screenplay is often associated with UI testing. Interestingly, the name of the pattern is actually unrelated to screens or user interfaces; it comes from a theatre metaphor, where actors play roles on a stage following a predefined script (the "screenplay"), and was coined by Antony Marcano and Andy Palmer around 2015. The pattern itself goes back further than that, and has been around in various forms since it was first proposed by Antony Marcano in 2007.
But Screenplay is also a great fit for API or web service tests. In particular, Screenplay is ideal when we want to include API and UI activities in the same test. For example, we might have an API task to set up some test data, a UI task to illustrate how a user interacts with this data, then another API task to check the new state of the database.
You can get a taste of what REST API interactions using Serenity Screenplay look like here:
@Test
public void list_all_users() {
Actor sam = Actor.named("Sam the supervisor")
.whoCan(CallAnApi.at(theRestApiBaseUrl));
sam.attemptsTo(
Get.resource("/users")
);
sam.should(
seeThatResponse("all the expected users should be returned",
response -> response.statusCode(200)
.body("data.first_name", hasItems("George", "Janet", "Emma")))
);
}
Serenity Screenplay uses Rest-Assured to interact with rest endpoints, and to query the responses. Rest-Assured provides us with a simple but extremely powerful Java DSL that allows us to test and virtually any kind of REST end point. Its highly readable code is also an ideal fit for Screenplay.
Setting up your project
To test REST API services with Screenplay, you need to add the serenity-screenplay-rest
dependency to your project. In Maven, add the following to the dependencies in your pom.xml
file:
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-screenplay-rest</artifactId>
<version>${serenity.version}</version>
<scope>test</scope>
</dependency>
And for Gradle, you can add the same dependency to your build.gradle
file:
testCompile "net.serenity-bdd:serenity-screenplay-rest:${serenityVersion}"
Defining a base URI
When you test a REST API, it is convenient to be able to use the same tests against different environments. You may want to run your tests against a server running on your local machine, against a QA server, or even against a production box. And you don’t want to have to change your tests whenever you test against a different environment.
For example, in this chapter, we will be demonstrating the features of serenity-screenplay-rest
using the ResReq application (see below). If you have a reliable internet connection, you can run your tests against the live ResReq server at https://reqres.in/api/. Or if you are running the ResReq server locally, you would access endpoints at http://localhost:5000/api.
Reading from the Serenity config file
In Serenity BDD, you can define the base URL for your REST API directly in the serenity.properties
or serenity.conf
file for your project.
Here is an example from a serenity.conf
file:
restapi {
baseurl = "https://reqres.in/api"
}
Any test can read values from the Serenity configuration files simply by creating a field of type EnvironmentVariables
in the test.
You can then fetch the property, and provide a default value to use if the property hasn’t been defined, as shown below:
theRestApiBaseUrl = environmentVariables.optionalProperty("restapi.baseurl")
.orElse("https://reqres.in/api");
Setting the API Url from the command line
You can override the default URL defined this way simply by providing a system property on the command line, like this:
mvn verify -Drestapi.baseurl=http://localhost:5000/api
Configuring the base API URL in Maven
If you are using Maven, a more convenient approach may be to use Maven Profiles.
In your pom.xml
file, you define up different Maven profiles for each environment, and set the restapi.baseurl
property accordingly:
<profiles>
<profile>
<id>dev</id>
<properties>
<restapi.baseurl>http://localhost:5000/api</restapi.baseurl>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<restapi.baseurl>https://reqres.in/api</restapi.baseurl>
</properties>
</profile>
</profiles>
For this to work properly, you also need to ensure that the restapi.baseurl
is passed correctly to your tests.
You do this by using the systemPropertyVariables
tag in the `maven-failsafe-plugin' configuration, as shown here:
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20</version>
<configuration>
<includes>
<include>**/When*.java</include>
<include>**/*Feature.java</include>
</includes>
<systemPropertyVariables>
<restapi.baseurl>${restapi.baseurl}</restapi.baseurl>
</systemPropertyVariables>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
You can then run the tests with Maven using the -P
option:
$ mvn verify -Pdev
Configuring the actor - the CallAnApi ability
In Screenplay, tests describe behaviour in terms of actors, who achieve their business goals by performing tasks. These tasks usually involve interacting with the application in some way. And to perform these tasks, we give the actors various abilities.
The CallAnApi
ability gives actors the ability to interact with a REST web service using Rest-Assured.
This includes both invoking REST end-points and querying the results.
private String theRestApiBaseUrl;
private EnvironmentVariables environmentVariables; (1)
private Actor sam; (2)
@Before
public void configureBaseUrl() {
theRestApiBaseUrl = environmentVariables.optionalProperty("restapi.baseurl") (3)
.orElse("https://reqres.in/api");
sam = Actor.named("Sam the supervisor").whoCan(CallAnApi.at(theRestApiBaseUrl)); (4)
}
| 1 | Serenity properties - Serenity will instantiate this field automatically |
| 2 | A Screenplay actor - this actor will be used in all our tests |
| 3 | Here we fetch the REST API base url |
| 4 | Then we create an actor with the ability to call REST end-points at the specified URL |
The CallAnApi
ability allows the actor to perform the bundled Serenity REST interaction classes. This include:
-
Get.resource()
-
Post.to()
-
Put.to()
-
Delete.from()
The simplest of these is Get
.
GET Interactions
In a REST API, GET requests are used to query a REST resource. Let’s see how we can do this using Serenity Screenplay.
Simple GET requests
In our demo application, the /users
resource represents application users.
We can retrieve the details of a particular user by appending the user ID, like this: /users/1
.
The structure of a user record is shown below:
{
"data": {
"id": 1,
"first_name": "George",
"last_name": "Bluth",
"avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/calebogden/128.jpg"
}
}
Suppose we need to write a scenario that retrieves a particular user, and checks some of the user’s details, such as first_name and last_name. Such a test might look like this:
@Test
public void find_an_individual_user() {
sam.attemptsTo(
Get.resource("/users/1") (1)
);
sam.should(
seeThatResponse( "User details should be correct", (2)
response -> response.statusCode(200) (3)
.body("data.first_name", equalTo("George")) (4)
.body("data.last_name", equalTo("Bluth")) (5)
)
);
}
| 1 | Sam performs a GET |
| 2 | We check the response using the seeThatResponse method. |
| 3 | Did the call return a status code of 200? |
| 4 | Is the first_name field 'George'? |
| 5 | Is the last_name field 'Bluth'? |
As you can see, this code is fairly self-explanatory.
Like any other Screenplay test, we use the actor’s attemptsTo()
method to perform the action we want to test.
In this case, we use the Get
interaction class, which comes bundled with serenity-screenplay-rest
.
Next we check the response using the seeThatResponse
method.
This method takes a Lambda expression and allows us to access the full RestAssured API.
In particular, we can use jsonPath expressions to query the JSON structure we receive.
Retrieving objects
Sometimes we need to fetch a value from a REST response, and keep it for use later on. RestAssured makes it relatively easy to convert a JSON structure to a Java object, which you can use later on in your tests.
For example, suppose we have a class like the one below, which corresponds to the user details returned by our endpoint:
package examples.screenplay.rest.model;
public class User {
private String id;
private String first_name;
private String last_name;
public User(String first_name, String last_name) {
this.first_name = first_name;
this.last_name = last_name;
}
public String getId() {
return id;
}
public String getFirstName() {
return first_name;
}
public String getLastName() {
return last_name;
}
}
We could retrieve the user as an instance of this class by calling the jsonPath().getObject()
method on the received response. This method will convert the JSON data on a given path to a corresponding Java structure:
@Test
public void retrieve_an_element_from_the_json_structure() {
sam.attemptsTo(
Get.resource("/users/1")
);
User user = SerenityRest.lastResponse() (1)
.jsonPath()
.getObject("data", User.class); (2)
assertThat(user.getFirstName()).isEqualTo("George");
assertThat(user.getLastName()).isEqualTo("Bluth");
}
| 1 | Retrieve the response returned by the previous RESRT call |
| 2 | Convert the JSON entry in the data field to a User |
Retrieving lists
Oftentimes we need to retrieve not a single item, but a list of items. Retrieving a list is little different to retrieving a single item:
sam.attemptsTo(
Get.resource("/users") (1)
);
sam.should(
seeThatResponse("all the expected users should be returned",
response -> response.body("data.first_name", hasItems("George", "Janet", "Emma"))) (2)
);
| 1 | Retrieve all the users |
| 2 | Check the list of user first names |
The difference happens when we query the results.
In this case, we use a jsonPath expression (data.first_name
) that will return all of the first_name field values.
The Hamcrest matcher hasItems
will compare the collection of first names that the jsonPath query returns, and check that it contains (at least) the names "George", "Janet" and "Emma".
But what if we want to capture the data we retrieve, rather than simply make an assertion about the contents?
We can do that using the SerenityRest.lastResponse()
method, like this:
List<String> userSurnames = SerenityRest.lastResponse().path("data.last_name"); (1)
assertThat(userSurnames).contains("Bluth", "Weaver", "Wong");
| 1 | Use a JsonPath expression to retrieve all the last_name values underneath the data entry. |
We can also retrieve lists of objects, just as we retrieved a single User
instance in the previous section.
Simply use the jsonPath.getList()
method as shown below:
List<User> users = SerenityRest.lastResponse()
.jsonPath()
.getList("data", User.class); (1)
assertThat(users).hasSize(3);
| 1 | Return a list of User instances |
Using Path Parameters
In the previous example, we hard-coded the path element in the request. For a more flexible approach, we can supply the path parameter when we submit the query:
sam.attemptsTo(
Get.resource("/users/{id}").with( request -> request.pathParam("id", 1)) (1)
);
| 1 | Provide the user ID as a path parameter |
Here we are using the Get.resource(…).with(…)
structure to pass the RestAssured RequestSpecification
object into a lambda expression.
Once again, this gives us access to all the richness of the RestAssert library
Using Query Parameters
Some REST APIs take query parameters as well as path parameters. Query parameters are commonly used to filter results or implement pagination. For example, we could get the second page of users from our /users
API by using the page
query parameter like this:
/users?page=2
In our test code, we use the queryParam()
method to provide a value for the page
parameter:
sam.attemptsTo(
Get.resource("/users").with( request -> request.queryParam("page", 2)) (1)
);
sam.should(
seeThatResponse("All users on page 2 should be returned",
response -> response.body("data.first_name",
hasItems("Eve", "Charles", "Tracey"))) (2)
);
| 1 | Return page 2 of the results |
Post queries
We can send POST requests to a REST end-point using the Post
interaction class. Here is a simple example:
sam.attemptsTo(
Post.to("/users")
.with(request -> request.header("Content-Type", "application/json") (1)
.body("{\"firstName\": \"Sarah-Jane\",\"lastName\": \"Smith\"}") (2)
)
);
sam.should(
seeThatResponse("The user should have been successfully added",
response -> response.statusCode(201))
);
| 1 | Specify the content type in the header |
| 2 | Specify the request body |
Alternatively, we can post an object, letting RestAssured convert the object fields into JSON for us:
User newUser = new User("Sarah-Jane", "Smith");
sam.attemptsTo(
Post.to("/users")
.with(request -> request.header("Content-Type", "application/json")
.body(newUser) (1)
)
);
| 1 | Pass in an object rather than a JSON string |
Other types of queries
Other query types are similar to GET
and POST
queries.
For example, PUT
requests are often used to update resources.
In the following example, we use a PUT
request to update a user’s details:
sam.attemptsTo(
Put.to("/users")
.with(request -> request.header("Content-Type", "application/json")
.body("{\"firstName\": \"jack\",\"lastName\": \"smith\"}")
)
);
sam.should(
seeThatResponse(response -> response.statusCode(200)
.body("updatedAt", not(isEmptyString())))
);
Or you can delete a user using the DELETE
query as shown here:
sam.attemptsTo(
Delete.from("/users/1")
);
sam.should(
seeThatResponse(response -> response.statusCode(204))
);
Higher level tasks
The interactions we have seen so far are readable but still quite low level. Screenplay allows us to build higher level tasks that represent the business intent behind these interactions.
For example, you could define a task that encapsulates listing all users like this:
package examples.screenplay.rest.tasks;
import net.serenitybdd.screenplay.Task;
import net.serenitybdd.screenplay.rest.interactions.Get;
public class UserTasks {
public static Task listAllUsers() {
return Task.where("{0} lists all users", (1)
Get.resource("/users") (2)
);
}
}
| 1 | Define a task where the actor lists all the users |
| 2 | This task is implemented using a Get interaction |
We can then use a static import to refactor our first test as follows:
sam.attemptsTo(
listAllUsers()
);
For a bit more flexibility, we can also write a custom Task
class. For example, we could write a FindAUser
task to find a user by ID:
package examples.screenplay.rest.tasks;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.Task;
import net.serenitybdd.screenplay.rest.interactions.Get;
import net.thucydides.core.annotations.Step;
import static net.serenitybdd.screenplay.Tasks.instrumented;
public class FindAUser implements Task{
private final int id;
public FindAUser(int id) {
this.id = id;
}
public static FindAUser withId(int id) {
return instrumented(FindAUser.class, id);
}
@Override
@Step("{0} fetches the user with id #id")
public <T extends Actor> void performAs(T actor) {
actor.attemptsTo(
Get.resource("/users/{id}")
.with(request -> request.pathParam("id", id))
);
}
}
Using this class, we could refactor our original class to read like this:
sam.attemptsTo(
FindAUser.withId(1)
);
Using tasks to encapsulate REST interactions results in a clear, layered reporting structure, that first describes what the user is doing, and they how they go about it. The test report for the previous scenario is shown here:


LogCounters class Null safety
Performance counters that periodically dumps counters measurements to logger.
Configuration parameters
- options:
interval
: interval in milliseconds to save current counters measurements (default: 5 mins)reset_timeout
: timeout in milliseconds to reset the counters. 0 disables the reset (default: 0)
References
- *:logger:*:*:1.0 ILogger components to dump the captured counters
- *:context-info:*:*:1.0 (optional) ContextInfo to detect the context id and specify counters source
See Counter See CachedCounters See CompositeLogger
Example
var counters = LogCounters();
counters.setReferences(References.fromTuples([
Descriptor("pip-services", "logger", "console", "default", "1.0"), ConsoleLogger()
]));
counters.increment("mycomponent.mymethod.calls");
var timing = counters.beginTiming("mycomponent.mymethod.exec_time");
try {
...
} finally {
timing.endTiming();
}
counters.dump();
- Inheritance
- Object
- CachedCounters
- LogCounters
- Implemented types
Constructors
- LogCounters()
- Creates a new instance of the counters.
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
beginTiming(
String name) → CounterTiming -
Begins measurement of execution time interval.
It returns CounterTiming object which has to be called at
CounterTiming.endTiming to end the measurement and update the counter. [...]
inherited
-
clear(
String name) → void -
Clears (resets) a counter specified by its name. [...]
inherited
-
clearAll(
) → void -
Clears (resets) all counters.
inherited
-
configure(
ConfigParams config) → void -
Configures component by passing configuration parameters. [...]
inherited
-
dump(
) → void -
Dumps (saves) the current values of counters. [...]
inherited
-
endTiming(
String? name, int elapsed) → void -
Ends measurement of execution elapsed time and updates specified counter. [...]
inherited
-
get(
String? name, CounterType type) → Counter -
Gets a counter specified by its name.
It counter does not exist or its type doesn't match the specified type
it creates a new one. [...]
inherited
-
getAll(
) → List< Counter> -
Gets all captured counters. [...]
inherited
-
getInterval(
) → int -
Gets the counters dump/save interval. [...]
inherited
-
increment(
String name, int value) → void -
Increments counter by given value. [...]
inherited
-
incrementOne(
String name) → void -
Increments counter by 1. [...]
inherited
-
last(
String name, int value) → void -
Records the last calculated measurement value. [...]
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
save(
List< Counter> ? counters) → void -
Saves the current counters measurements. [...]
override
-
setInterval(
int value) → void -
Sets the counters dump/save interval. [...]
inherited
-
setReferences(
IReferences references) → void -
Sets references to dependent components. [...]
override
-
stats(
String name, int value) → void -
Calculates min/average/max statistics based on the current and previous values. [...]
inherited
-
timestamp(
String name, DateTime value) → void -
Records the given timestamp. [...]
inherited
-
timestampNow(
String name) → void -
Records the current time as a timestamp. [...]
inherited
-
toString(
) → String -
A string representation of this object. [...]
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited


Donate to Save the Bay Area Tree Octopus!
Why you should donate:
{{.DonationIncentive}}
.
Donation Amount:


I am an Engineer with a passion for design and programming in the Greater Boston Area. I studied Electrical Engineering at Louisiana State University where I specialized in RF Design, Power Electronics, and Control & System Theory.
I have experience with complex control systems, real time operating systems, networking, and writing code. I have excelled in the areas of design, creation, and implementation of tools and applications.
I am a fast learner that thrives in high-demand development and operations environments.
I currently work as a DSP Software Engineer in the aerospace/defense industry.
I worked on embedded controls and Dynamic Positioning Systems in the past.
For the last few years I have also worked on developing Big Data Analysis Tools and solutions to enhance cost saving measures and provide better support.
I am interested in new technology, investing, social web development, IOT Building, and beer brewing.
Accolades:
"Rstar Achievement Award for Accountability, 2021", Raytheon Technologies
"International Employee of the Year 2015", Kongsberg Maritime
"T.O.P.'s Award", Taylor Opportunity Program for Students
Print:
University student creates website for alternative textbook exchange
Alternatives merit consideration when buying books
Media:
Project Birdseye »


@@include('../layouts/head.html', {
"title": "Home Page"
})
@@include('../layouts/styles.html')
@@include('../layouts/header.html')
@@include('../partials/banner.html')
Check Out All Of Our Amazing Competitions
Filters/Sort by
Featured
New
@@include('../layouts/footer.html',{
"bgGrey": false
})
@@include('../layouts/scripts.html')


Dua Lipa to perform at the '2019 Mnet Asian Music Awards'!
by beansssThe upcoming, '2019 Mnet Asian Music Awards' has announced another performing artist to look forward to - British pop star Dua Lipa!
Taking place this coming December 4 at the Nagoya Dome in Japan, the '2019 Mnet Asian Music Awards' will consist of performances by not just Dua Lipa but BTS, GOT7, MONSTA X, Seventeen, TWICE, MAMAMOO, Kim Chung Ha, and more.
This won't be the first time that Dua Lipa has mingled with the K-Pop scene, as she previously released a collaboration single "Kiss and Make Up" with BLACKPINK in 2018. Stay tuned for even more performing artist announcements for the '2019 MAMA'!


“Na gaṇena purakkhato care,
Vimano hoti samādhi dullabho;
Nānājanasaṅgaho dukho,
Iti disvāna gaṇaṁ na rocaye.
“You shouldn’t live for the adulation of a following;
it turns your mind, making it hard to get immersion.
Seeing that popularity is suffering,
you shouldn’t consent to a following.
Na kulāni upabbaje muni,
Vimano hoti samādhi dullabho;
So ussukko rasānugiddho,
Atthaṁ riñcati yo sukhāvaho.
A sage should not visit respectable families;
it turns your mind, making it hard to get immersion.
If you’re eager and greedy for flavors,
you’ll miss the goal that brings such happiness.
Paṅkoti hi naṁ avedayuṁ,
Yāyaṁ vandanapūjanā kulesu;
Sukhumaṁ sallaṁ durubbahaṁ,
Sakkāro kāpurisena dujjaho.
They know it really is a bog,
this homage and veneration in respectable families.
Honor is a subtle dart, hard to extract,
and hard for a sinner to give up.”
Senāsanamhā oruyha,
nagaraṁ piṇḍāya pāvisiṁ;
Bhuñjantaṁ purisaṁ kuṭṭhiṁ,
sakkaccaṁ taṁ upaṭṭhahiṁ.
“I came down from my lodging
and entered the city for alms.
I courteously stood by
while a leper ate.
So me pakkena hatthena,
ālopaṁ upanāmayi;
Ālopaṁ pakkhipantassa,
aṅguli cettha chijjatha.
With his putrid hand
he offered me a morsel.
Putting the morsel in my bowl,
his finger dropped off right there.
Kuṭṭamūlañca nissāya,
ālopaṁ taṁ abhuñjisaṁ;
Bhuñjamāne vā bhutte vā,
jegucchaṁ me na vijjati.
Sitting by a wall,
I ate that lump of rice.
I did not feel any disgust
while eating or afterwards.
Uttiṭṭhapiṇḍo āhāro,
pūtimuttañca osadhaṁ;
Senāsanaṁ rukkhamūlaṁ,
paṁsukūlañca cīvaraṁ;
Yassete abhisambhutvā,
sa ve cātuddiso naro.
Anyone who makes use of
leftovers for food,
fermented urine as medicine,
the root of a tree as lodging,
and cast-off rags as robes,
is at home in any direction.”
Yattha eke vihaññanti,
āruhantā siluccayaṁ;
Tassa buddhassa dāyādo,
sampajāno patissato;
Iddhibalenupatthaddho,
kassapo abhirūhati.
“Where some have fallen to ruin
while climbing the mountain,
there Kassapa ascends;
an heir of the Buddha,
aware and mindful,
owing to his psychic powers.
Piṇḍapātapaṭikkanto,
selamāruyha kassapo;
Jhāyati anupādāno,
pahīnabhayabheravo.
Returning from alms-round,
Kassapa ascends the mountain,
and practices absorption without grasping,
with fear and dread given up.
Piṇḍapātapaṭikkanto,
selamāruyha kassapo;
Jhāyati anupādāno,
ḍayhamānesu nibbuto.
Returning from alms-round,
Kassapa ascends the mountain,
and practices absorption without grasping,
quenched amongst those who burn.
Piṇḍapātapaṭikkanto,
selamāruyha kassapo;
Jhāyati anupādāno,
katakicco anāsavo.
Returning from alms-round,
Kassapa ascends the mountain,
and practices absorption without grasping,
his task completed, free of defilements.”
Karerimālāvitatā,
bhūmibhāgā manoramā;
Kuñjarābhirudā rammā,
te selā ramayanti maṁ.
“Strewn with garlands of the musk-rose tree,
these regions are so delightful, so lovely,
echoing with the trumpeting of elephants:
these rocky crags delight me!
Nīlabbhavaṇṇā rucirā,
vārisītā sucindharā;
Indagopakasañchannā,
te selā ramayanti maṁ.
Glistening, they look like blue storm clouds,
with waters cool and streams so clear,
and covered all in ladybugs:
these rocky crags delight me!
Nīlabbhakūṭasadisā,
kūṭāgāravarūpamā;
Vāraṇābhirudā rammā,
te selā ramayanti maṁ.
Like the peak of a blue storm cloud,
or like a fine bungalow, lovely,
echoing with the trumpeting of elephants:
these rocky crags delight me!
Abhivuṭṭhā rammatalā,
nagā isibhi sevitā;
Abbhunnaditā sikhīhi,
te selā ramayanti maṁ.
The rain comes down on the lovely flats,
in the mountains frequented by hermits.
Echoing with the cries of peacocks,
these rocky crags delight me!
Alaṁ jhāyitukāmassa,
pahitattassa me sato;
Alaṁ me atthakāmassa,
pahitattassa bhikkhuno.
It’s enough for me,
who loves absorption and is resolute, to be mindful.
It’s enough for me,
a resolute monk who loves the goal.
Alaṁ me phāsukāmassa,
pahitattassa bhikkhuno;
Alaṁ me yogakāmassa,
pahitattassa tādino.
It’s enough for me,
a resolute monk who loves comfort.
It’s enough for me,
resolute and poised, loving meditation.
Umāpupphena samānā,
gaganāvabbhachāditā;
Nānādijagaṇākiṇṇā,
te selā ramayanti maṁ.
Covered with flowers of flax,
like the sky covered with clouds,
full of flocks of many different birds,
these rocky crags delight me!
Anākiṇṇā gahaṭṭhehi,
migasaṅghanisevitā;
Nānādijagaṇākiṇṇā,
te selā ramayanti maṁ.
Empty of householders,
frequented by herds of deer,
full of flocks of many different birds,
these rocky crags delight me!
Acchodikā puthusilā,
gonaṅgulamigāyutā;
Ambusevālasañchannā,
te selā ramayanti maṁ.
The water’s clear and the rocks are broad,
monkeys and deer are all around;
festooned with dewy moss,
these rocky crags delight me!”
Na pañcaṅgikena turiyena,
Rati me hoti tādisī;
Yathā ekaggacittassa,
Sammā dhammaṁ vipassato.
“Even the music of a five-piece band
can never give such pleasure
as when, with unified mind,
you rightly discern the Dhamma.”
Kammaṁ bahukaṁ na kāraye,
Parivajjeyya janaṁ na uyyame;
Ussukko so rasānugiddho,
Atthaṁ riñcati yo sukhāvaho.
“Don’t get involved in lots of work,
avoid people, and don’t try to acquire things.
If you’re eager and greedy for flavors,
you’ll miss the goal that brings such happiness.
Kammaṁ bahukaṁ na kāraye,
Parivajjeyya anattaneyyametaṁ;
Kicchati kāyo kilamati,
Dukkhito so samathaṁ na vindati.
Don’t get involved in lots of work,
avoid what doesn’t lead to the goal.
The body gets worn out and fatigued,
and when you ache, you won’t find serenity.”
Oṭṭhappahatamattena,
attānampi na passati;
Patthaddhagīvo carati,
ahaṁ seyyoti maññati.
“You won’t see yourself
by merely reciting words,
wandering stiff-necked
and thinking, ‘I’m better than them.’
Aseyyo seyyasamānaṁ,
bālo maññati attānaṁ;
Na taṁ viññū pasaṁsanti,
patthaddhamānasaṁ naraṁ.
The fool is no better,
but they think they are.
The wise don’t praise
stuck-up people.
Yo ca seyyohamasmīti,
nāhaṁ seyyoti vā pana;
Hīno taṁsadiso vāti,
vidhāsu na vikampati.
Whoever is not affected
by the modes of conceit—
‘I am better’, ‘I’m not better’,
‘I am worse’, or ‘I am the same’—
Paññavantaṁ tathā tādiṁ,
sīlesu susamāhitaṁ;
Cetosamathamanuttaṁ,
tañce viññū pasaṁsare.
with such understanding, poised,
steady in ethics,
and devoted to serenity of mind:
that is who the wise praise.”
Yassa sabrahmacārīsu,
gāravo nūpalabbhati;
Ārakā hoti saddhammā,
nabhato puthavī yathā.
“Whoever has no respect
for their spiritual companions
is as far from the true teaching
as the earth is from the sky.
Yesañca hiriottappaṁ,
sadā sammā upaṭṭhitaṁ;
Virūḷhabrahmacariyā te,
tesaṁ khīṇā punabbhavā.
Those whose conscience and shame
are always rightly established,
thrive in the spiritual life;
for them, there are no future lives.
Uddhato capalo bhikkhu,
paṁsukūlena pāruto;
Kapīva sīhacammena,
na so tenupasobhati.
When a mendicant who is haughty and fickle
wears rags from the rubbish-heap,
that doesn’t make them shine:
they’re like a monkey in a lion skin.
Anuddhato acapalo,
nipako saṁvutindriyo;
Sobhati paṁsukūlena,
sīhova girigabbhare.
But if they are steady and stable,
alert, with senses restrained,
then, wearing rags from the rubbish-heap, they shine
like a lion in a mountain cave.”
Ete sambahulā devā,
iddhimanto yasassino;
Dasadevasahassāni,
sabbe te brahmakāyikā.
“These many gods
powerful and glorious,
all 10,000 of them,
belong to the host of Brahmā.
Dhammasenāpatiṁ vīraṁ,
mahājhāyiṁ samāhitaṁ;
Sāriputtaṁ namassantā,
tiṭṭhanti pañjalīkatā.
They stand with joined palms
honoring Sāriputta,
the general of the Dhamma, the hero,
the serene great meditator:
‘Namo te purisājañña,
namo te purisuttama;
Yassa te nābhijānāma,
yampi nissāya jhāyati.
‘Homage to you, O thoroughbred!
Homage to you, supreme among men!
We don’t understand
the basis of your absorption.
Accheraṁ vata buddhānaṁ,
gambhīro gocaro sako;
Ye mayaṁ nābhijānāma,
vālavedhisamāgatā’.
The profound domain of the Buddhas
is truly amazing.
We don’t understand,
though we’ve gathered here to split hairs.’
Taṁ tathā devakāyehi,
pūjitaṁ pūjanārahaṁ;
Sāriputtaṁ tadā disvā,
kappinassa sitaṁ ahu.
When he saw the host of gods
paying homage to Sāriputta—
who is truly worthy of homage—
Kappina smiled.”
Yāvatā buddhakhettamhi,
ṭhapayitvā mahāmuniṁ;
Dhutaguṇe visiṭṭhohaṁ,
sadiso me na vijjati.
“As far as the range of the Buddha extends,
I am outstanding in austerities.
I have no equal,
apart from the great sage himself.
Pariciṇṇo mayā satthā,
kataṁ buddhassa sāsanaṁ;
Ohito garuko bhāro,
natthi dāni punabbhavo.
I’ve served the teacher
and fulfilled the Buddha’s instructions.
The heavy burden is laid down,
now there’ll be no more future lives.”
Na cīvare na sayane,
bhojane nupalimpati;
Gotamo anappameyyo,
muḷālapupphaṁ vimalaṁva;
Ambunā nekkhammaninno,
tibhavābhinissaṭo.
“Like a lotus flower
to which water will not stick,
Gotama the immeasurable is unstained
by robes, lodgings, or food.
He inclines to renunciation,
and has escaped the three states of existence.
Satipaṭṭhānagīvo so,
saddhāhattho mahāmuni;
Paññāsīso mahāñāṇī,
sadā carati nibbuto”ti.
…
Mahākassapo thero ….
Cattālīsanipāto niṭṭhito.
Tatruddānaṁ
The great sage’s neck is mindfulness meditation;
faith is his hands, and wisdom his head.
Having great knowledge,
he always wanders, quenched.”
Cattālīsanipātamhi,
mahākassapasavhayo;
Ekova thero gāthāyo,
cattālīsa duvepi cāti.


Enact
Decisions!
Actions are required to create change. Once an idea has been debated and refined it needs to be enacted. Ideally this process is viewed as legitimate by the stakeholders of the system. If so, then engage in that process to voice your preferences. If the process is not viewed as legitimate, then find a new system to engage with because without a legitimate governance process you're living in a world of pure power where the 800 lb gorilla rules.
The specific mechanisms used to make decisions in any specific system are going to be unique. It's very important that you understand how they work so that you can engage with them productively. You're on your own to figure that out.
Also, be aware that just because a decision is made does not mean it will create the outcomes you want. You probably have a theory about what could, should, or will happen - but it's not until you test it out that you'll know. And even then it's unclear! For non-deterministic decisions with execution risk it can be hard to tell if success or failure was caused by the execution of the decision or the decision itself.
Concepts
Legitimacy
Legitimacy means many things to many people. In short, it's the acknowledgement and acceptances of a power structure, and thus the acceptanceof the results of the power structure. Agree on process, even if you disagree on outcomes.
Legitimacy requires explicit and implicit acceptance of a system. If people don't really have much of an option they'll go along with something, but then not participate or rebel half way through.
Politics
As mentioned before, politics is how we make decisions in groups to distribute resources and status. While many people hate politics, as long as people are involved it's inevitable. People are going to want to advocate for their interests when valuable resources are on the line. If you have a formal political process it'll be easy to see that. If the political process is informal that doesn't mean it's not there. It just means that it's harder to see.
A political process can be healthy or unhealthy. A healthy version might look like stakeholders advocate for their interests, present evidence, engage in intelligent debate, and vote with balanced power to determine the best outcome for all parties involved. An unhealthy political process might involve stakeholders advocating for their interests and ignoring everyone else, slandering rather than engaging with facts, yelling over everyone so that no one can talk, and imbalanced power dynamics that disenfranchise stakeholders. Both are political processes, but one can be productive and the other is a nightmare. Regardless, politics is unavoidable if you're going to make decisions in a group to distribute resources.
It's important to understand how politics works in general, and then how politics (group decision making over resources) works within the context of the system you're engaging with. Then you can have a better idea of what you're getting into and how to engage productively.
Tools
The process to enact proposals is dependent on the governance process of each system and therefore outside the scope of this article. That being said, it is a very important step! If you have a convoluted governance process or voting weight is not well distributed among stakeholders then success is unlikely. There isn't much that intelligent analysis, proposals, and questions can do to fix a system that is fundamentally broken. If there is a strong foundation, however, then computer aided governance can help you engage within that system productively.
Notes
MOTIVATION
- fortune favors the bold
CONCEPTS
- legitimacy
- politics
TOOLS
- it depends


18
1 Jehoshaphat became very wealthy and was greatly honored. But then he arranged for one of his family to marry someone from the family of King Ahab of Israel.
2 Several years later, he went down from Jerusalem to Samaria to visit Ahab. Ahab welcomed him, and the people who had come with him by slaughtering many sheep and cattle for a feast.
3 Then he asked Jehoshaphat, "Will you and your army go with my army to attack the city of Ramoth in the region of Gilead?" Jehoshaphat replied, "My soldiers and I are at your orders. We will go to war when you tell us to go."
4 Then he added, "But we should ask Yahweh first, to find out what he wants us to do."
5 So the king of Israel gathered all his four hundred prophets and asked them, "Should we go to fight the people of Ramoth, or should we not?"

6 But Jehoshaphat asked, "Is there no prophet of Yahweh here whom we can ask?"
7 The king of Israel replied, "There is still one man here, whom we can ask to find out what Yahweh wants, His name is Micaiah son of Imlah. But I hate him because he never says that anything good about me. He always predicts that bad things will happen to me."
Jehoshaphat replied, "King Ahab, you should not say that!"
8 So the king of Israel told one of his officials to summon Micaiah immediately.
9 Now the king of Israel and the king of Judah were sitting there on thrones, wearing their royal robes. They were sitting by the gate of Samaria, and all the prophets were busy saying words of prophecy to them.
10 One of them whose name was Zedekiah son of Kenaanah, had made from iron something that resembled the horns of a bull. He proclaimed to Ahab, "This is what Yahweh says: 'With horns like these, your army will keep attacking the army of Aram like a bull attacks another animal, until you completely destroy them.'~"
11 All the other prophets of Ahab agreed. They said, "Yes! If you attack Ramoth in Gilead, you will be successful, because Yahweh will enable you to defeat them."
12 The messenger who went to summon Micaiah said to him, "Listen to me! All the other prophets are predicting the same thing. You had better do as they are doing!"
13 But Micaiah said, "As surely as Yahweh lives, I will tell him only what he tells me to say."
14 When Micaiah arrived, the king of Israel asked him, "Should we go to attack Ramoth, or not?"
Micaiah replied, "Sure, go! Yahweh will enable your army to defeat them!"
15 But King Ahab wished to appear reverent toward Yahweh in front of Jehoshaphat. He said to Miciaiah, "I keep telling you to say only what Yahweh tells you to say!"
16 Then Micaiah replied, "The truth is that in a vision I saw all the troops of Israel scattered on the mountains. They seemed to be like sheep that did not have a shepherd. And Yahweh said, 'Their master has been killed. So tell them all to go home peacefully.'~"
17 Ahab turned to Jehoshaphat and said, "I told you that Micaiah never says anything good will happen to me! He only predicts bad things for me."
18 But Micaiah continued, saying, "Listen to what Yahweh showed to me! In a vision I saw Yahweh sitting on his throne, with all the armies of heaven standing around him, on his right side and on his left side.
19 And Yahweh said, 'Who can persuade Ahab, the king of Israel, to go to fight against the people of Ramoth, in order that he may be killed there?'
Some suggested one thing, and others suggested something else.
20 Finally one spirit forward and said, 'I can do it!'
Yahweh asked him, 'How will you do it?'
21 The spirit replied, 'I will go and inspire all of Ahab's prophets to tell lies.' Yahweh said, 'You will be successful; go and do it!'
22 So now I tell you that Yahweh has caused your prophets to lie to you. Yahweh has decided that something terrible will happen to you."
23 Then Zedekiah walked over to Micaiah and slapped him on his face. He said, "Do you think that Yahweh's spirit left me in order to speak to you?"
24 Micaiah replied, "You will find out for yourself to which of us Yahweh's spirit has truly spoken on the day when you go into a room of some house to hide from the Aramean soldiers!"
25 King Ahab commanded his soldiers, "Arrest Micaiah and take him to Amon, the governor of this city, and to my son Joash.
26 Tell them that I have commanded that they should put this man in prison and give him only bread and water. Do not give him anything else to eat until I return safely from the battle!"
27 Micaiah replied, "If you return safely, it will be clear that it was not Yahweh who told me what to say to you!" Then he said to all those who were standing there, "Do not forget what I have said to King Ahab!"
28 So the king of Israel and the king of Judah led their armies to Ramoth in Gilead.
29 King Ahab said to Jehoshaphat, "I will put on different clothes, in order that no one will recognize that I am the king. But you should wear your royal robe." So the king of Israel disguised himself, and they both went into the battle.
30 The king of Aram had told his soldiers who were driving the chariots, "Attack only the king of Israel! Do not attack anyone else."
31 So when the soldiers who were driving the Aramean chariots saw Jehoshaphat wearing the royal robes, they thought, "He must be the king of Israel!"
32 So they turned to attack him. But when Jehoshaphat cried out, Yahweh helped him, and they realized that he was not the king of Israel. And God caused them to stop pursuing him.
33 But one Aramean soldier shot an arrow at Ahab, without knowing who he was. The arrow struck Ahab between the places where the parts of his armor joined together. Ahab told the driver of his chariot, "Turn the chariot around and take me out of here! I have been severely wounded!"
34 The battle continued all the day. Ahab was sitting propped up in his chariot, facing the Aramean soldiers. And late in the afternoon, when the sun was setting, he died.


Scecial offer, any course $15
20,000 online courses
Expert instructions Learn with different teaching styles
Lifetime access learn at yoiur own pace
anonymous tutor
$200 $15


z=FLATTENSTRUCT(s)
z=FLATTENSTRUCT(s) returns a cell vector with field names (using dot notation) in the (scalar) nested struct s.


|
fop 1.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSpaceManager
public class RtfSpaceManager
This class is responsible for saving space-before/space-after attributes history and adding spacing to established candidates (i.e. attributes) or accumulation spacing in case of candidate absence.
| Constructor Summary | |
|---|---|
RtfSpaceManager()
Construct a newly allocated RtfSpaceManager object. |
| Method Summary | |
|---|---|
RtfAttributes |
getLastInlineAttribute()
Peeks at inline-level attribute stack. |
void |
popInlineAttributes()
Pops inline attributes from inline-level stack. |
void |
popRtfSpaceSplitter()
Removes RtfSpaceSplitter from top of block-level stack. |
void |
pushInlineAttributes(RtfAttributes attrs)
Pushes inline attributes to inline-level stack. |
RtfSpaceSplitter |
pushRtfSpaceSplitter(RtfAttributes attrs)
Builds RtfSpaceSplitter on attrs and adds it to the
block-level stack. |
void |
setCandidate(RtfAttributes attrs)
Set attributes as candidate for space attributes inheritance. |
void |
stopUpdatingSpaceBefore()
Iterates block-level stack (i.e. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RtfSpaceManager()
RtfSpaceManager
object.
| Method Detail |
|---|
public void stopUpdatingSpaceBefore()
public void setCandidate(RtfAttributes attrs)
attrs
- attributes to setpublic RtfSpaceSplitter pushRtfSpaceSplitter(RtfAttributes attrs)
attrs
and adds it to the
block-level stack.
attrs
- RtfAttribute to add
public void popRtfSpaceSplitter()
public void pushInlineAttributes(RtfAttributes attrs)
attrs
- attributes to addpublic void popInlineAttributes()
public RtfAttributes getLastInlineAttribute()
|
fop 1.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Newsletter
My newsletter is named ‘Et cetera’
I send it out roughly once a month with updates on my work, etc. I am not very (at all, actually) coherent with the content of the newsletter – If I found an interesting problem, sure, or a boring problem and an interesting solution, why not! Oh, look I found a book on typography, it goes on my newsletter!
That said, I’m generally very aware about my reader’s time and promise not to spam you, ever! :-)
Now, enter your email address below and subscribe!
or alternatively, you can subscribe on tinyletter


Follow these instructions to learn how the Ping Pong Game works:
- Numbers divisible by 3 become "PING"
- Numbers divisible by 5 become "PONG"
- Numbers divisible by 15 become "PING-PONG"
NOTE: All non-numberic input do not work with the Ping Pong Game
Created by:
Aduma Tevin
GitHub Username:
kurosakiaduma
Languages used to create the game:
- HTML
- CSS
- jQuery
- Javascript
Ping Pong Game
Try out the Ping Pong game
(Check out the Rules at the top before you begin)


| dirCreator | Create a function that creates a new directory |
| dirGetter | Create a function that updates a folder tree based on the given restrictions |
| fileGetter | Create a function that returns fileinfo according to the given restrictions |
| formatFiletype | Formats the value of the filetype argument |
| getVolumes | Get a list of available volumes |
| parseDirPath | Convert the output of a selection to platform specific path(s) |
| parseFilePaths | Convert the output of a selection to platform specific path(s) |
| parseSavePath | Convert the output of a selection to platform specific path(s) |
| shinyDirButton | Create a button to summon a shinyFiles dialog |
| shinyDirChoose | Create a connection to the server side filesystem |
| shinyFileChoose | Create a connection to the server side filesystem |
| shinyFiles-buttons | Create a button to summon a shinyFiles dialog |
| shinyFiles-observers | Create a connection to the server side filesystem |
| shinyFiles-parsers | Convert the output of a selection to platform specific path(s) |
| shinyFileSave | Create a connection to the server side filesystem |
| shinyFilesButton | Create a button to summon a shinyFiles dialog |
| shinyFilesExample | Run a simple example app using the shinyFiles functionality |
| shinySaveButton | Create a button to summon a shinyFiles dialog |
| traverseDirs | Traverse and update a tree representing the file system |
| updateChildren | Update the children element to reflect current state |


Save your code
Snip.it is an elegant app that lets you save important information to recall for later.
Learn more
Name
Insert Snippet
Code
Save


Application version to bundle into the binaries, and to show in Phonegap Build.
If not setted, the information from config.xml will be used. If setted, the config.xml will be modified in Jenkins' working directory.
Beware: If you ask Phonegap Build plugin to override this field in www/config.xml, you better make sure your git or svn working copy in Jenkins gets resetted with every build.


1.2 Introduction to the basic time series functions
The first example we are going to handle is lh
, a time series of 48 observations at 10-minute intervals on luteinizing hormone levels for a human female. Start by printing it.
lh
Time Series:
Start = 1
End = 48
Frequency = 1
[1] 2.4 2.4 2.4 2.2 2.1 1.5 2.3 2.3 2.5 2.0 1.9 1.7 2.2 1.8 3.2 3.2 2.7
[18] 2.2 2.2 1.9 1.9 1.8 2.7 3.0 2.3 2.0 2.0 2.9 2.9 2.7 2.7 2.3 2.6 2.4
[35] 1.8 1.7 1.5 1.4 2.1 3.3 3.5 3.5 3.1 2.6 2.1 3.4 3.0 2.9
Look at the information: Start = 1
, End = 48
and Frequency = 1
.
The second example, deaths
, gives monthly deaths in the UK from a set of common lung diseases for the years 1974 to 1979.
data("deaths", package = "MASS")
deaths
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1974 3035 2552 2704 2554 2014 1655 1721 1524 1596 2074 2199 2512
1975 2933 2889 2938 2497 1870 1726 1607 1545 1396 1787 2076 2837
1976 2787 3891 3179 2011 1636 1580 1489 1300 1356 1653 2013 2823
1977 3102 2294 2385 2444 1748 1554 1498 1361 1346 1564 1640 2293
1978 2815 3137 2679 1969 1870 1633 1529 1366 1357 1570 1535 2491
1979 3084 2605 2573 2143 1693 1504 1461 1354 1333 1492 1781 1915
Use tsp(deaths)
to get Start = 1974
, End = 1979.917
and Frequency = 12
. You can also access each of these attributes using the functions start(deaths)
, end(deaths)
and frequency(deaths)
. Use cycle(deaths)
to get the position in the cycle of each observation.
Time series can be plotted by plot
. The argument lty
of the function plot
controls the type of the plotted line (solid, dashed, dotted, …). For more details, type ?par
(for graphical parameters).
par(mfrow = c(1, 2)) #2 plot side by side
plot(lh, main = "Luteinizing Hormone in\nBlood Samples", ylab = "IU/L", xlab = "Number of 10 minutes intervals\n from first sample")
plot(deaths, main = "Monthly Deaths from \nLung Diseases in the UK", ylab = "Monthly deaths",
ylim = c(0, 4000))
lines(mdeaths, lty = 2)
lines(fdeaths, lty = 3)
legend(x = "topright", bty = "n", legend = c("Total", "Men", "Women"), lty = c(1,
2, 3))
graphics.off() #close console
Above, you can see plots of lh
and the three series on deaths. In the right-hand plot, the dashed series is for males, the dotted series for females and the solid line for the total.
The functions ts.union
and ts.intersect
bind together multiple time series which have a common frequency. The time axes are aligned and only observations at times that appear in all the series are retained with ts.intersect
; with ts.union
the combined series covers the whole range of the components, possibly as NA
values.
The function window
extracts a sub-series of a single or multiple time series, by specifying start
, end
or both.
The function lag
shifts the time axis of a series back by \(k\) positions (default is k = 1
). Thus lag(deaths, k=3)
is the series of deaths shifted one quarter into the past.
plot(deaths, main = "Monthly Deaths from \nLung Diseases in the UK", ylab = "Monthly deaths",
bty = "l")
lines(lag(deaths, k = 3), lty = 3)
The function diff
takes the difference between a series and its lagged values and so returns a series of length \(n-k\) with values lost from the beginning (if \(k>0\)) or end. Beware: the argument lag
(default is lag = 1
) is used in the usual sense here, so diff(deaths, lag=3)
is equal to deaths - lag(deaths, k=-3)
! The function diff
has an argument differences
which causes the operation to be iterated.
The function aggregate
can be used to change the frequency of the time base.
aggregate(deaths, 4, sum)
Qtr1 Qtr2 Qtr3 Qtr4
1974 8291 6223 4841 6785
1975 8760 6093 4548 6700
1976 9857 5227 4145 6489
1977 7781 5746 4205 5497
1978 8631 5472 4252 5596
1979 8262 5340 4148 5188
aggregate(deaths, 1, sum)
Time Series:
Start = 1974
End = 1979
Frequency = 1
[1] 26140 26101 25718 23229 23951 22938
aggregate(deaths, 4, mean)
Qtr1 Qtr2 Qtr3 Qtr4
1974 2763.667 2074.333 1613.667 2261.667
1975 2920.000 2031.000 1516.000 2233.333
1976 3285.667 1742.333 1381.667 2163.000
1977 2593.667 1915.333 1401.667 1832.333
1978 2877.000 1824.000 1417.333 1865.333
1979 2754.000 1780.000 1382.667 1729.333
aggregate(deaths, 1, mean)
Time Series:
Start = 1974
End = 1979
Frequency = 1
[1] 2178.333 2175.083 2143.167 1935.750 1995.917 1911.500
One way to compute the linear or polynomial trend of a series is to use the function lm
, which fits linear models. The function fitted
allows you to extract the model fitted values, while c(1:48)
represents the integers from 1 to 48 and the function poly
computes orthogonal polynomials.
plot(lh, main = "Luteinizing Hormone in Blood Samples", ylab = "IU/L", xlab = "Number of 10 minutes intervals\n from first sample",
bty = "l", ylim = c(0, 3.5))
lines(fitted(lm(lh ~ c(1:48))), col = "blue")
lines(fitted(lm(lh ~ poly(1:48, 2))), col = "red")
legend(x = "bottomright", legend = c("linear", "quadratic"), col = c(4, 2),
lty = c(1, 1), bty = "n")
1.2.1 Exercise 1: Beaver temperature
- Load the
beav2
data from the libraryMASS
. - Examine the data frame using
summary
,head
,tail
. Query the help with?beav2
for a description of the dataset - Transform the temperature data into a time series object and plot the latter.
- Fit a linear model using
lm
and the variableactiv
as factor, viz.lin_mod <- lm(temp~as.factor(activ), data=beav2)
. Overlay the means on your plot withlines(fitted(lin_mod))
replacinglin_mod
with yourlm
result. - Inspect the residuals (
resid(lin_mod)
) and determine whether there is any evidence of trend or seasonality. - Look at a quantile-quantile (Q-Q) plot to assess normality. You can use the command
qqnorm
if you don’t want to transform manually the residuals withqqline
or useplot(lin_mod, which=2)
. - Plot the lag-one residuals at time \(t\) and \(t-1\). Is the dependence approximately linear?


Prints are available, please email<EMAIL_ADDRESS>for more information.
Fenway Park was the first in the series of Paul's baseball paintings. This oil on canvas work was painted in 1994. Painted in his personal style and filled with many details, it is one of Paul's signature works.
The project required that Paul start by researching the storied ballpark. He traveled to Fenway on a summer's day to watch a game in the park and to take photos from various angles in order to have some reference material for the upcoming months of painting. These photos served to provide all the intricate details of the park. From hot-dog vendors to the park's multitude of signs, Fenway's magical ambiance was recreated in Paul's unique style. When finished, this painting represented one of Paul's longer and complicated projects.
Like many of Paul's works, the painting is large and measures 64 by 56 ½ inches. Fenway Park is as bright as it is expressive and lovingly captures the jubilant atmosphere of a summer's day game in the famous ball park.


Type here:
Type here:
Text field
Text area
Password field
File field
Number field
This is a contentEditable area
child content editable
This is not a contentEditable area
child not content editable


--- layout: post date: 2006-07-30 time: "09:00:00" authors: ["Greg Wilson"] title: "Design Patterns in Scientific Software" tags: ["Articles"] ---
This paper, via the OpenScience Project, is a couple of years old, but a good step in an interesting direction.


Constructs a list of resources and the classes that depend on them. This task is primarily used to determine which Jars are required by the specified list of classes. The task parses each Java file specified in the fileset. It then attempts to load any classes referenced by import statements. The import classes are then added to a hashtable of required resources. Once all classes have been processed, a summary of the required resources will be generated by the task.
| Attribute | Description | Required |
| classpathref | Reference to a classpath ID to use when looking up a resource, given as reference to a <path> element defined elsewhere | No |
| reportformat | Output format of the dependency summary. Valid formats include text and html. The default format is text. | No |
| reportfile | Output file where the summary will be written. | No |
| restrictToJars | Determine whether the dependency summary should be restricted to only Jar files. | No |
| displayProgress | Enable the display of progress indicators during source code processing. | No |
| includes | Comma-separated list of packages specs (may include wildcards). | No |
| excludes | Comma-separated list of packages specs (may include wildcards). | No |
List class dependencies found in Java source files
<listdeps classpathref="ant.classpath" reportformat="html" reportfile="report.html"> <include name="com.modeln.*"/> <exclude name="java.*"/> <fileset dir=".."> <include name="**/*.java"/> </fileset> </listdeps>


{include file='./header' /}
POST /price
Parameters:
{'user': token,platform:’FFA20PS4’}
Response:
{code: 200,message:’success’ ,data:{price:0.16,status:’online’}}
POST /newOrder
Parameters:
merchant_id :unique order number from your system
login :EA e-mail (string)
password : EA password (string)
amount : Amount to fill in to account (int)
platform :FFA20PS4 (string)
backup1 - backup code 1 (string)
backup2 - backup code 2 (string)
backup3 - backup code 3 (string)
example
{user: token, merchant_id: 123123, login<EMAIL_ADDRESS>'password': 'password', 'amount': 1000, 'platform': 'FFA20PS4', 'backup1': '123456', 'backup2': '123456', 'backup3': '123456'}
Response:
{"data":{"id":"20","time":1571546267,"status":"ORDER CREATE"},"code":200,"message":"create order success"}
POST /orderStatus
Parameters:
{'user': token,order_id:’123’}
Response:
{"data":{"id":13,"status":"end",transaction_already_amount:0},"code":200,"message":"success"}
forbidden-EA webapp is down
captcha-can’t solve captcha
tradepilefull-there are no space no trade pileto move cards
toomanyaction-account is temporary banned by ea
unexpected-technical issue on our site
<200 coins-less than 200 coins in account
wrongbackup-wrong back up codes
wronglogin-login or password is wrong
marketlocked-webapp market is locked
csmonline-customer online
nologinverification-its when customer need to login to webapp and use code from mail,then make new back ups when its working
transferring-account info is correct, transfer in progress
checking info-supplier is checking origin account info,waiting for delivery
end-order finished
new-new order not yet checked
Cancelled-order Cancelled
nostock- no stock
FFA20PS4
FFA20XBO
FFA20PCC


This component is providing the application navigation.
It can change itself to a hamburger menu when the width of the page is smaller than a given property.
This component has no HTML children.


A graphics editor.
Alias (keyboard: A)
Grid (keyboard: G)
Brush Size (1x)
Zoom (1x)
File issues on Github.


Last modified 10/3/2013 by Samuel Batista
(original by Matt Tuttle based on Thomas Jahn's. Haxe port by Adrien Fischer)
This content is released under the MIT License.
Use these to determine whether a sprite should be flipped, for example:
var flipped:Bool = cast (oject.gid & TiledObject.FLIPPED_HORIZONTALLY_FLAG);
sprite.facing = flipped ? FlxObject.LEFT : FlxObject.RIGHT;


Dragon BASIC, online at http://github.com/uli/dragonbasic
Returns the current input state.ParametersFUNCTION KEYS
None.Return
Reads REG_P1 from the GBA hardware and returns it. All bits are flipped, so that a 0 is not-pressed and 1 is pressed.Remarks
The return value can be masked using an AND operation along with a KEY_ constant to see if a button is pressed.See Also
KEY | AND


Before Change
x_corr = core.autocorrelate(onset_envelope[mincol:maxcol], ac_window)
// re-weight the autocorrelation by log-normal prior
bpms = 60.0 * fft_res / (np.arange(1, ac_window+1))
// Smooth the autocorrelation by a log-normal distribution
x_corr = x_corr * np.exp(-0.5 * ((np.log2(bpms / start_bpm)) / std_bpm)**2)
// Get the local maximum of weighted correlation
x_peaks = util.localmax(x_corr)
After Change
bpms = core.tempo_frequencies(ac_window, hop_length=hop_length, sr=sr)[1:]
// Weight the autocorrelation by a log-normal distribution centered start_bpm
x_corr *= np.exp(-0.5 * ((np.log2(bpms) - np.log2(start_bpm)) / std_bpm)**2)
// Get the local maximum of weighted correlation
x_peaks = util.localmax(x_corr)


Freelance Web Developer
https://github.com/MozMorris
http://www.linkedin.com/in/mozmorris
<EMAIL_ADDRESS>powered by jeykll


MDC Grid List provides a RTL-aware Material Design Grid list component adhering to the Material Design Grid list spec. Grid Lists are best suited for presenting homogeneous data, typically images. Each item in a grid list is called a tile. Tiles maintain consistent width, height, and padding across screen sizes.
Header Title
Primary action: ${primaryItem}
Secondary action: ${secondaryItem}
Header Title 1
Use img-src or img-class to show a picture not both.
If you use img-class it will resize the assets to cover the tile and crop the assets to display the center part.
.my-tile-image { background-image: url(images/16-9.jpeg); }
Header Title 1
.my-grid-list .mdc-grid-tile { width : 300px; }
...
mdc-grid-list supports theming. mdc-grid-tile__primary uses the theme’s background color for its background color. mdc-grid-tile__secondary uses the theme’s primary color for it’s background color, and the theme’s text-primary-on-background color for its text color.
/* background of secondary content */ .my-tile-color .mdc-grid-tile__secondary { background: rgba(0, 0, 0, 0.2); } /* action icon */ .my-tile-color .mdc-grid-tile__icon { cursor: pointer; color: rgba(255, 255, 255, 0.3); } /* action icon hover */ .my-tile-color .mdc-grid-tile__icon:hover { color: rgba(255, 255, 255, 0.7); } /* action icon active */ .my-tile-color .mdc-grid-tile__icon:active { color: rgba(255, 255, 255, 1); } /* support icon */ .my-tile-color .mdc-grid-tile__support-text i { color: rgba(255, 255, 255, 0.7); }
Title ...
some sass..
Elevation@import "@material/elevation/mixins"; .my-tile-stuff { .mdc-grid-tile { @include mdc-elevation(0); transition: mdc-elevation-transition-value(); will-change: $mdc-elevation-property; &:active { @include mdc-elevation(8); } } }


I created my first Battlefield montage ever a few days ago and wanted to share it with you guys
(Main goal: getting eFame and becoming YouTube gazillionaire)
, but did not find a place to post my link so I decided to create this thread where
you
can post
your
videos to share with the BBlog community.
I begin with my montage:
http://www.youtube.com/watch?v=_YJHjtsQCho
Info: Few gameplay "highlights" from the first Beta weekend. First Montage, that means not a lot of experience in video editing. I am sorry if I don't have enough effects. :-P I am actually aware that you might prefer another music style, but it's imo pretty hard to find certain music under CC licence.
Enjoy!
Post edited 1 x times, last by
Tomahawk
Tomahawk
Nice video, but I don't really like montages this long. If you're making 6 minute long videos make it more interesting with editing, multiple songs and amazing clips, be creative so the viewer doesn't get bored halfway through :D But the title is awesome lol
Here is my video:
http://www.youtube.com/watch?v=WTSxNF4G3QM
What do you guys think? Spent quite a long time editing this. Hope you enjoy, comments and ratings are appreciated ;)
Meaurk
Global Moderator
You did an amazing job there with editing, it's almost perfectly synced with music. I'd love to see more of you soon.
Post edited 1 x times, last by
Tomahawk
Tomahawk
Thank you kind sir :)
To see more of my videos consider subscribing my YouTube channel ;)


| 063:008 Khan | : |
They (hyprocrites) say: "If we return to Al- Madinah, indeed the more honourable ('Abdullah bin Ubai bin Salul, the chief of hyprocrites at Al-Madinah) will expel therefrom the meaner (i.e. Allah's Messenger SAW)." But honour, power and glory belong to Allah, His Messenger (Muhammad SAW), and to the believers, but the hypocrites know not. |
| 063:008 Maulana | : |
They say: If we return to Madinah, the mightier will surely drive out the meaner therefrom. And might belongs to Allah and His Messenger and the believers, but the hypocrites know not. |
| 063:008 Pickthal | : |
They say: Surely, if we return to Al-Madinah the mightier will soon drive out the weaker; when might belongeth to Allah and to His messenger and to the believers; but the hypocrites know not. |
| 063:008 Rashad | : |
They say, "If we go back to the city, the powerful therein will evict the weak (and we will be victimized)." (They should know that) all dignity belongs to GOD and His messenger, and the believers. However, the hypocrites do not know. |
| 063:008 Sarwar | : |
They say, "When we return to Medina, the honorable ones will certainly drive out the mean ones." Honor belongs to God, His Messenger and the believers, but the hypocrites do not know. |
| 063:008 Shakir | : |
They say: If we return to Medina, the mighty will surely drive out the meaner therefrom; and to Allah belongs the might and to His Messenger and to the believers, but the hypocrites do not know. |
| 063:008 Sherali | : |
They say, 'If we return to Medina, the one most exalted will, surely, drive out therefrom the one most mean,' while true honour belongs to ALLAH and to HIS Messenger and the believers; but the Hypocrites know not. |
| 063:008 Yusufali | : |
They say, "If we return to Medina, surely the more honourable (element) will expel therefrom the meaner." But honour belongs to Allah and His Messenger, and to the Believers; but the Hypocrites know not. |
Concepts/Themes Covered: الإيمان > الإيمان بالله > النفاق Faith> Belief In Allah> Hypocrisy
This tool uses eight English parallel translations for the Holy Quran imported from Mr. Clay Smith. You can also visit Qurany Concepts for browsing the Quran themes or topics. If you want to search the Holy Quran for keywords, please visit Qurany Keywords.


package sql
Allows the execution of relational queries, including those expressed in SQL using Spark.
- Source
- package.scala
- Alphabetic
- By Inheritance
- sql
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
class
AnalysisException extends Exception with SparkThrowable with Serializable
Thrown when a query fails to analyze, usually because the query itself is invalid.
Thrown when a query fails to analyze, usually because the query itself is invalid.
- Annotations
- @Stable()
- Since
1.3.0
-
class
Column extends Logging
A column that will be computed based on the data in a
DataFrame
.A column that will be computed based on the data in a
DataFrame
.A new column can be constructed based on the input columns present in a DataFrame:
df("columnName") // On a specific `df` DataFrame. col("columnName") // A generic column not yet associated with a DataFrame. col("columnName.field") // Extracting a struct field col("`a.column.with.dots`") // Escape `.` in column names. $"columnName" // Scala short hand for a named column.
Column objects can be composed to form complex expressions:
$"a" + 1 $"a" === $"b"
- Annotations
- @Stable()
- Since
1.3.0
- Note
The internal Catalyst expression can be accessed via expr, but this method is for debugging purposes only and can change in any future Spark releases.
-
class
ColumnName extends Column
A convenient class used for constructing schema.
A convenient class used for constructing schema.
- Annotations
- @Stable()
- Since
1.3.0
-
trait
CreateTableWriter[T] extends WriteConfigMethods[CreateTableWriter[T]]
Trait to restrict calls to create and replace operations.
Trait to restrict calls to create and replace operations.
- Since
3.0.0
- type DataFrame = Dataset[Row]
-
final
class
DataFrameNaFunctions extends AnyRef
Functionality for working with missing data in
DataFrame
s.Functionality for working with missing data in
DataFrame
s.- Annotations
- @Stable()
- Since
1.3.1
-
class
DataFrameReader extends Logging
Interface used to load a Dataset from external storage systems (e.g.
Interface used to load a Dataset from external storage systems (e.g. file systems, key-value stores, etc). Use
SparkSession.read
to access this.- Annotations
- @Stable()
- Since
1.4.0
-
final
class
DataFrameStatFunctions extends AnyRef
Statistic functions for
DataFrame
s.Statistic functions for
DataFrame
s.- Annotations
- @Stable()
- Since
1.4.0
-
final
class
DataFrameWriter[T] extends AnyRef
Interface used to write a Dataset to external storage systems (e.g.
Interface used to write a Dataset to external storage systems (e.g. file systems, key-value stores, etc). Use
Dataset.write
to access this.- Annotations
- @Stable()
- Since
1.4.0
-
final
class
DataFrameWriterV2[T] extends CreateTableWriter[T]
Interface used to write a org.apache.spark.sql.Dataset to external storage using the v2 API.
Interface used to write a org.apache.spark.sql.Dataset to external storage using the v2 API.
- Annotations
- @Experimental()
- Since
3.0.0
-
class
Dataset[T] extends Serializable
A Dataset is a strongly typed collection of domain-specific objects that can be transformed in parallel using functional or relational operations.
A Dataset is a strongly typed collection of domain-specific objects that can be transformed in parallel using functional or relational operations. Each Dataset also has an untyped view called a
DataFrame
, which is a Dataset of Row.Operations available on Datasets are divided into transformations and actions. Transformations are the ones that produce new Datasets, and actions are the ones that trigger computation and return results. Example transformations include map, filter, select, and aggregate (
groupBy
). Example actions count, show, or writing data out to file systems.Datasets are "lazy", i.e. computations are only triggered when an action is invoked. Internally, a Dataset represents a logical plan that describes the computation required to produce the data. When an action is invoked, Spark's query optimizer optimizes the logical plan and generates a physical plan for efficient execution in a parallel and distributed manner. To explore the logical plan as well as optimized physical plan, use the
explain
function.To efficiently support domain-specific objects, an Encoder is required. The encoder maps the domain specific type
T
to Spark's internal type system. For example, given a classPerson
with two fields,name
(string) andage
(int), an encoder is used to tell Spark to generate code at runtime to serialize thePerson
object into a binary structure. This binary structure often has much lower memory footprint as well as are optimized for efficiency in data processing (e.g. in a columnar format). To understand the internal binary representation for data, use theschema
function.There are typically two ways to create a Dataset. The most common way is by pointing Spark to some files on storage systems, using the
read
function available on aSparkSession
.val people = spark.read.parquet("...").as[Person] // Scala Dataset<Person> people = spark.read().parquet("...").as(Encoders.bean(Person.class)); // Java
Datasets can also be created through transformations available on existing Datasets. For example, the following creates a new Dataset by applying a filter on the existing one:
val names = people.map(_.name) // in Scala; names is a Dataset[String] Dataset<String> names = people.map((Person p) -> p.name, Encoders.STRING));
Dataset operations can also be untyped, through various domain-specific-language (DSL) functions defined in: Dataset (this class), Column, and functions. These operations are very similar to the operations available in the data frame abstraction in R or Python.
To select a column from the Dataset, use
apply
method in Scala andcol
in Java.val ageCol = people("age") // in Scala Column ageCol = people.col("age"); // in Java
Note that the Column type can also be manipulated through its various functions.
// The following creates a new column that increases everybody's age by 10. people("age") + 10 // in Scala people.col("age").plus(10); // in Java
A more concrete example in Scala:
// To create Dataset[Row] using SparkSession val people = spark.read.parquet("...") val department = spark.read.parquet("...") people.filter("age > 30") .join(department, people("deptId") === department("id")) .groupBy(department("name"), people("gender")) .agg(avg(people("salary")), max(people("age")))
and in Java:
// To create Dataset<Row> using SparkSession Dataset<Row> people = spark.read().parquet("..."); Dataset<Row> department = spark.read().parquet("..."); people.filter(people.col("age").gt(30)) .join(department, people.col("deptId").equalTo(department.col("id"))) .groupBy(department.col("name"), people.col("gender")) .agg(avg(people.col("salary")), max(people.col("age")));
- Annotations
- @Stable()
- Since
1.6.0
-
case class
DatasetHolder[T] extends Product with Serializable
A container for a Dataset, used for implicit conversions in Scala.
A container for a Dataset, used for implicit conversions in Scala.
To use this, import implicit conversions in SQL:
val spark: SparkSession = ... import spark.implicits._
- Annotations
- @Stable()
- Since
1.6.0
-
trait
Encoder[T] extends Serializable
Used to convert a JVM object of type
T
to and from the internal Spark SQL representation.Used to convert a JVM object of type
T
to and from the internal Spark SQL representation.Scala
Encoders are generally created automatically through implicits from a
SparkSession
, or can be explicitly created by calling static methods on Encoders.import spark.implicits._ val ds = Seq(1, 2, 3).toDS() // implicitly provided (spark.implicits.newIntEncoder)
Java
Encoders are specified by calling static methods on Encoders.
List<String> data = Arrays.asList("abc", "abc", "xyz"); Dataset<String> ds = context.createDataset(data, Encoders.STRING());
Encoders can be composed into tuples:
Encoder<Tuple2<Integer, String>> encoder2 = Encoders.tuple(Encoders.INT(), Encoders.STRING()); List<Tuple2<Integer, String>> data2 = Arrays.asList(new scala.Tuple2(1, "a"); Dataset<Tuple2<Integer, String>> ds2 = context.createDataset(data2, encoder2);
Or constructed from Java Beans:
Encoders.bean(MyClass.class);
Implementation
- Encoders should be thread-safe.
- Annotations
- @implicitNotFound( ... )
- Since
1.6.0
-
class
ExperimentalMethods extends AnyRef
:: Experimental :: Holder for experimental methods for the bravest.
:: Experimental :: Holder for experimental methods for the bravest. We make NO guarantee about the stability regarding binary compatibility and source compatibility of methods here.
spark.experimental.extraStrategies += ...
- Annotations
- @Experimental() @Unstable()
- Since
1.3.0
-
abstract
class
ForeachWriter[T] extends Serializable
The abstract class for writing custom logic to process data generated by a query.
The abstract class for writing custom logic to process data generated by a query. This is often used to write the output of a streaming query to arbitrary storage systems. Any implementation of this base class will be used by Spark in the following way.
- A single instance of this class is responsible of all the data generated by a single task in a query. In other words, one instance is responsible for processing one partition of the data generated in a distributed manner.
- Any implementation of this class must be serializable because each task will get a fresh
serialized-deserialized copy of the provided object. Hence, it is strongly recommended that
any initialization for writing data (e.g. opening a connection or starting a transaction)
is done after the
open(...)
method has been called, which signifies that the task is ready to generate data. - The lifecycle of the methods are as follows.
For each partition with `partitionId`: For each batch/epoch of streaming data (if its streaming query) with `epochId`: Method `open(partitionId, epochId)` is called. If `open` returns true: For each row in the partition and batch/epoch, method `process(row)` is called. Method `close(errorOrNull)` is called with error (if any) seen while processing rows.
Important points to note:
- Spark doesn't guarantee same output for (partitionId, epochId), so deduplication
cannot be achieved with (partitionId, epochId). e.g. source provides different number of
partitions for some reason, Spark optimization changes number of partitions, etc.
Refer SPARK-28650 for more details. If you need deduplication on output, try out
foreachBatch
instead. - The
close()
method will be called ifopen()
method returns successfully (irrespective of the return value), except if the JVM crashes in the middle.
Scala example:
datasetOfString.writeStream.foreach(new ForeachWriter[String] { def open(partitionId: Long, version: Long): Boolean = { // open connection } def process(record: String) = { // write string to connection } def close(errorOrNull: Throwable): Unit = { // close the connection } })
Java example:
datasetOfString.writeStream().foreach(new ForeachWriter<String>() { @Override public boolean open(long partitionId, long version) { // open connection } @Override public void process(String value) { // write string to connection } @Override public void close(Throwable errorOrNull) { // close the connection } });
- Since
2.0.0
-
class
KeyValueGroupedDataset[K, V] extends Serializable
A Dataset has been logically grouped by a user specified grouping key.
A Dataset has been logically grouped by a user specified grouping key. Users should not construct a KeyValueGroupedDataset directly, but should instead call
groupByKey
on an existing Dataset.- Since
2.0.0
-
trait
LowPrioritySQLImplicits extends AnyRef
Lower priority implicit methods for converting Scala objects into Datasets.
Lower priority implicit methods for converting Scala objects into Datasets. Conflicting implicits are placed here to disambiguate resolution.
Reasons for including specific implicits: newProductEncoder - to disambiguate for
List
s which are bothSeq
andProduct
-
class
RelationalGroupedDataset extends AnyRef
A set of methods for aggregations on a
DataFrame
, created by groupBy, cube or rollup (and alsopivot
).A set of methods for aggregations on a
DataFrame
, created by groupBy, cube or rollup (and alsopivot
).The main method is the
agg
function, which has multiple variants. This class also contains some first-order statistics such asmean
,sum
for convenience.- Annotations
- @Stable()
- Since
2.0.0
- Note
This class was named
GroupedData
in Spark 1.x.
-
trait
Row extends Serializable
Represents one row of output from a relational operator.
Represents one row of output from a relational operator. Allows both generic access by ordinal, which will incur boxing overhead for primitives, as well as native primitive access.
It is invalid to use the native primitive interface to retrieve a value that is null, instead a user must check
isNullAt
before attempting to retrieve a value that might be null.To create a new Row, use
RowFactory.create()
in Java orRow.apply()
in Scala.A Row object can be constructed by providing field values. Example:
import org.apache.spark.sql._ // Create a Row from values. Row(value1, value2, value3, ...) // Create a Row from a Seq of values. Row.fromSeq(Seq(value1, value2, ...))
A value of a row can be accessed through both generic access by ordinal, which will incur boxing overhead for primitives, as well as native primitive access. An example of generic access by ordinal:
import org.apache.spark.sql._ val row = Row(1, true, "a string", null) // row: Row = [1,true,a string,null] val firstValue = row(0) // firstValue: Any = 1 val fourthValue = row(3) // fourthValue: Any = null
For native primitive access, it is invalid to use the native primitive interface to retrieve a value that is null, instead a user must check
isNullAt
before attempting to retrieve a value that might be null. An example of native primitive access:// using the row from the previous example. val firstValue = row.getInt(0) // firstValue: Int = 1 val isNull = row.isNullAt(3) // isNull: Boolean = true
In Scala, fields in a Row object can be extracted in a pattern match. Example:
import org.apache.spark.sql._ val pairs = sql("SELECT key, value FROM src").rdd.map { case Row(key: Int, value: String) => key -> value }
- Annotations
- @Stable()
- Since
1.3.0
-
class
RowFactory extends AnyRef
- Annotations
- @Stable()
-
class
RuntimeConfig extends AnyRef
Runtime configuration interface for Spark.
Runtime configuration interface for Spark. To access this, use
SparkSession.conf
.Options set here are automatically propagated to the Hadoop configuration during I/O.
- Annotations
- @Stable()
- Since
2.0.0
-
class
SQLContext extends Logging with Serializable
The entry point for working with structured data (rows and columns) in Spark 1.x.
The entry point for working with structured data (rows and columns) in Spark 1.x.
As of Spark 2.0, this is replaced by SparkSession. However, we are keeping the class here for backward compatibility.
- Annotations
- @Stable()
- Since
1.0.0
-
abstract
class
SQLImplicits extends LowPrioritySQLImplicits
A collection of implicit methods for converting common Scala objects into Datasets.
A collection of implicit methods for converting common Scala objects into Datasets.
- Since
1.6.0
-
sealed abstract final
class
SaveMode extends Enum[SaveMode]
- Annotations
- @Stable()
-
class
SparkSession extends Serializable with Closeable with Logging
The entry point to programming Spark with the Dataset and DataFrame API.
The entry point to programming Spark with the Dataset and DataFrame API.
In environments that this has been created upfront (e.g. REPL, notebooks), use the builder to get an existing session:
SparkSession.builder().getOrCreate()
The builder can also be used to create a new session:
SparkSession.builder .master("local") .appName("Word Count") .config("spark.some.config.option", "some-value") .getOrCreate()
- Annotations
- @Stable()
-
class
SparkSessionExtensions extends AnyRef
:: Experimental :: Holder for injection points to the SparkSession.
:: Experimental :: Holder for injection points to the SparkSession. We make NO guarantee about the stability regarding binary compatibility and source compatibility of methods here.
This current provides the following extension points:
- Analyzer Rules.
- Check Analysis Rules.
- Optimizer Rules.
- Pre CBO Rules.
- Planning Strategies.
- Customized Parser.
- (External) Catalog listeners.
- Columnar Rules.
- Adaptive Query Stage Preparation Rules.
The extensions can be used by calling
withExtensions
on the SparkSession.Builder, for example:SparkSession.builder() .master("...") .config("...", true) .withExtensions { extensions => extensions.injectResolutionRule { session => ... } extensions.injectParser { (session, parser) => ... } } .getOrCreate()
The extensions can also be used by setting the Spark SQL configuration property
spark.sql.extensions
. Multiple extensions can be set using a comma-separated list. For example:SparkSession.builder() .master("...") .config("spark.sql.extensions", "org.example.MyExtensions,org.example.YourExtensions") .getOrCreate() class MyExtensions extends Function1[SparkSessionExtensions, Unit] { override def apply(extensions: SparkSessionExtensions): Unit = { extensions.injectResolutionRule { session => ... } extensions.injectParser { (session, parser) => ... } } } class YourExtensions extends SparkSessionExtensionsProvider { override def apply(extensions: SparkSessionExtensions): Unit = { extensions.injectResolutionRule { session => ... } extensions.injectFunction(...) } }
Note that none of the injected builders should assume that the SparkSession is fully initialized and should not touch the session's internals (e.g. the SessionState).
- Annotations
- @DeveloperApi() @Experimental() @Unstable()
-
trait
SparkSessionExtensionsProvider extends (SparkSessionExtensions) ⇒ Unit
:: Unstable ::
:: Unstable ::
Base trait for implementations used by SparkSessionExtensions
For example, now we have an external function named
Age
to register as an extension for SparkSession:package org.apache.spark.examples.extensions import org.apache.spark.sql.catalyst.expressions.{CurrentDate, Expression, RuntimeReplaceable, SubtractDates} case class Age(birthday: Expression, child: Expression) extends RuntimeReplaceable { def this(birthday: Expression) = this(birthday, SubtractDates(CurrentDate(), birthday)) override def exprsReplaced: Seq[Expression] = Seq(birthday) override protected def withNewChildInternal(newChild: Expression): Expression = copy(newChild) }
We need to create our extension which inherits SparkSessionExtensionsProvider Example:
package org.apache.spark.examples.extensions import org.apache.spark.sql.{SparkSessionExtensions, SparkSessionExtensionsProvider} import org.apache.spark.sql.catalyst.FunctionIdentifier import org.apache.spark.sql.catalyst.expressions.{Expression, ExpressionInfo} class MyExtensions extends SparkSessionExtensionsProvider { override def apply(v1: SparkSessionExtensions): Unit = { v1.injectFunction( (new FunctionIdentifier("age"), new ExpressionInfo(classOf[Age].getName, "age"), (children: Seq[Expression]) => new Age(children.head))) } }
Then, we can inject
MyExtensions
in three ways,- withExtensions of SparkSession.Builder
- Config - spark.sql.extensions
- java.util.ServiceLoader - Add to src/main/resources/META-INF/services/org.apache.spark.sql.SparkSessionExtensionsProvider
- Annotations
- @DeveloperApi() @Unstable() @Since( "3.2.0" )
- Since
3.2.0
- See also
java.util.ServiceLoader
-
type
Strategy = SparkStrategy
Converts a logical plan into zero or more SparkPlans.
Converts a logical plan into zero or more SparkPlans. This API is exposed for experimenting with the query planner and is not designed to be stable across spark releases. Developers writing libraries should instead consider using the stable APIs provided in org.apache.spark.sql.sources
- Annotations
- @DeveloperApi() @Unstable()
-
class
TypedColumn[-T, U] extends Column
A Column where an Encoder has been given for the expected input and return type.
A Column where an Encoder has been given for the expected input and return type. To create a TypedColumn, use the
as
function on a Column.- T
The input type expected for this expression. Can be
Any
if the expression is type checked by the analyzer instead of the compiler (i.e.expr("sum(...)")
).- U
The output type of this column.
- Annotations
- @Stable()
- Since
1.6.0
-
class
UDFRegistration extends Logging
Functions for registering user-defined functions.
Functions for registering user-defined functions. Use
SparkSession.udf
to access this:spark.udf
- Annotations
- @Stable()
- Since
1.3.0
-
trait
WriteConfigMethods[R] extends AnyRef
Configuration methods common to create/replace operations and insert/overwrite operations.
Configuration methods common to create/replace operations and insert/overwrite operations.
- R
builder type to return
- Since
3.0.0
Value Members
-
object
Encoders
Methods for creating an Encoder.
Methods for creating an Encoder.
- Since
1.6.0
-
object
Row extends Serializable
- Annotations
- @Stable()
- Since
1.3.0
-
object
SQLContext extends Serializable
This SQLContext object contains utility functions to create a singleton SQLContext instance, or to get the created SQLContext instance.
This SQLContext object contains utility functions to create a singleton SQLContext instance, or to get the created SQLContext instance.
It also provides utility functions to support preference for threads in multiple sessions scenario, setActive could set a SQLContext for current thread, which will be returned by getOrCreate instead of the global one.
-
object
SparkSession extends Logging with Serializable
- Annotations
- @Stable()
-
object
functions
Commonly used functions available for DataFrame operations.
Commonly used functions available for DataFrame operations. Using functions defined here provides a little bit more compile-time safety to make sure the function exists.
Spark also includes more built-in functions that are less common and are not defined here. You can still access them (and all the functions defined here) using the
functions.expr()
API and calling them through a SQL expression string. You can find the entire list of functions at SQL API documentation.As an example,
isnan
is a function that is defined here. You can useisnan(col("myCol"))
to invoke theisnan
function. This way the programming language's compiler ensuresisnan
exists and is of the proper form. You can also useexpr("isnan(myCol)")
function to invoke the same function. In this case, Spark itself will ensureisnan
exists when it analyzes the query.regr_count
is an example of a function that is built-in but not defined here, because it is less commonly used. To invoke it, useexpr("regr_count(yCol, xCol)")
.This function APIs usually have methods with
Column
signature only because it can support not onlyColumn
but also other types such as a native string. The other variants currently exist for historical reasons.- Annotations
- @Stable()
- Since
1.3.0


--- class: slide title: 'We deliver people...not cookies' permalink: /#we-deliver-people description: 'Showing up at a physical location is the strongest indicator of intent. Our platform identifies people in a physical location and delivers you the insights you need to spend wisely, achieve more and repeat often.' ---
Showing up at a physical location is the strongest indicator of intent. Our platform identifies people in a physical location and delivers you the insights you need to spend wisely, achieve more and repeat often.


At Concept Home Builders, our motto is “Vision Beyond Design,” and we distinguish ourselves from other builders by offering you an inspired vision for your home. From the intimate scale of a cozy cottage to the grand elegance of a rambling estate, our homes creatively accommodate diverse purposes and activities for all of life’s stages and budgets. At Concept Home Builders, we work directly with you from completion of plans, through construction.
Concept Home Builders takes a “head and heart” approach to home building, creating homes that are as smart as they are beautiful. Our vision is tempered by practical construction constraints and realistic financial boundaries.
At Concept Home Builders, our mission is to exceed the expectations of our homeowners by delivering a high-quality home with inspired detail, and conscientious customer service.
Concept Home Builders is very much aware of the need to protect our environment and deal wisely with our natural resources. Many of our locations are naturally beautiful and it is our goal to keep them that way. We will work with you and your location to be sure your home complements its environment and leaves a minimal carbon footprint.


{{ partial "header.html" . }} {{ partial "navigation.html" . }}
{{ .Description }}
{{ .Content }}
Either email your CV to careers at budibase.com, or use the form below:


---
layout: post
title: Changes don't take effect in UCM 6
date: '2008-09-16T09:36:00.001-06:00'
author: Jay Swan
tags:
- ucm
- callmanager
- unified communications
- device
- pool
modified_time: '2008-09-16T09:39:01.223-06:00'
blogger_id: tag:blogger.com,1999:blog-5029689981158113588.post-475670282407937841
blogger_orig_url: http://unroutable.blogspot.com/2008/09/changes-dont-take-effect-in-ucm-6.html
---
If you make a change to a Cisco Unified Communications Manager 6.x system and it doesn't seem to take effect, try restarting the Database Layer Monitor service and the TFTP service. This can be done during production hours.
In my case, the change in question was a change to the CallManager Group setting in a device pool.


{include file="common/meta" /}
{:__('New Email')}:
{:__('Captcha')}:
获取验证码
{include file="common/script"/}


As it is written, calling factorial( -1 )
N == 0
) would never be reached.
Eventually the computer system would run out of resources,
and the program would stop running.
int factorial( int N ) { if ( N == 0 ) return 1; else return N * factorial( N-1 ) ; }
Defensive programming is when the programmer anticipates
problems and writes code to deal with them.
To avoid the disaster a negative parameter would cause,
sometimes factorial()
is written like this:
int factorial( int N ) { if ( N <= 0 ) return 1; else return N * factorial( N-1 ) ; }
But, according to the math-like definition, this is not correct.
The value of factorial( -1 )
Sometimes the method is written to throw an exception when an illegal argument is detected. But this adds complication since now the caller must deal with a possible exception.
Perhaps the best solution is to write factorial()


Courtyard by Marriott Brno
Holandská 12, 639 00 Brno-střed, Czechia
+420-515-519 519
Date/Time
2017-12-14 12:00:002017-12-14 21:00:00Europe/BudapestSolarWinds Innovate Summit 2017A one-day event to meet and learn from SolarWinds engineers and others in the monitoring communityCourtyard by Marriot Brno Holandská 12, 639 00 Brno-střed<EMAIL_ADDRESS>December 14, 2017
5pm to 9pm
Registration starts at 4pm
{% include partials/modal.html id='aboutBrno' content=modalContent %}


{% from "components/banner.html" import banner, banner_wrapper %} {% from "components/page-footer.html" import page_footer %} {% from "components/form.html" import form_wrapper %} {% from "govuk_frontend_jinja/components/button/macro.html" import govukButton %}
We’re checking that ‘{{ reply_to_email_address }}’ is a real email address.
This can take a minute
{% elif verification_status == "success" %} {{ banner("‘{}’ is ready to use".format(reply_to_email_address), type='default', with_tick=True) }}We sent an email to ‘{{ reply_to_email_address }}’ but it could not be delivered.
You can try again, or use a different address.
{% endcall %}


This is a link
Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective.
Note: a:active MUST come after a:hover in the CSS definition in order to be effective.


Limit will allows users to configure the number of items to be displayed in a particular page.
The specified value([limit]="30") will be applied as the limit.
Default value(10) will be applied as the limit.
The specified value([limit]="110") will be applied as the limit.
The total item count will be applied as the limit.


Jailed: Telford fraudster cooked up scam to con £20,000 from Aga
by Nick HumphreysA Telford fraudster who cooked up a scheme to con his employers out of about £20,000 has been jailed for ten months.
Dave Griffiths, 55, had worked at Aga Cookers in Ketley for 30 years when he got into financial difficulties and racked up gambling debts in 2013.
His role at the company involved hiring and paying sub-contractors to do repair work on cookers. He used his position to get workers to write false invoices, which he would then pay from company funds, before receiving the cash back from them for his personal use.
But the conspiracy ran out of gas when Griffiths tried to get another sub-contractor involved, who notified Aga.
One of Griffiths' co-conspirators, 66-year-old Ian Smart, also faced the music at Shrewsbury Crown Court yesterday.
Prosecutor Sati Ruck said: "Timothy Drummond, who was also a sub-contractor, was contacted by Griffiths in February 2015. He received a voicemail inviting him to do false invoices.
"Mr Drummond reported this to the Aga HR department. Griffiths was arrested and an investigation was carried out.
"Smart had forged large invoices and received a bonus payment of £500 for the commission of a Rayburn cooker."
Confessed
The con was carried out between January 2014 and February 2015.
Griffiths confessed to police that he was the main person responsible, and it was indeed him that kept all the money from the scheme.
It was accepted by Smart's barrister Adrian Roberts that he had been responsible for Aga losing out on around £9,000.
Griffiths, of Glebe Street, Wellington, and Smart, of Verena Terrace, Perthshire, Scotland, both pleaded guilty to fraud at an earlier hearing at Telford Magistrates Court.
Debra White, defending Griffiths, said that he had got into financial difficulties after his wife became ill following an accident, and that he had built up even more debt by gambling to try to recoup cash.
She said: "It is a sorry state to Mr Griffiths that he finds himself in this position. He was extremely candid in his interview with police.
"His own health had deteriorated.
On behalf of Smart, Mr Roberts added that Griffiths had been his boss at Aga for around 20 years before Smart later became a sub-contractor, and that he "wasn't motivated by personal gain", just by helping Griffiths.
Judge Peter Barrie said to Griffiths: "You were in a responsible position. You broke the trust of your employer."
He sentenced Griffiths to 10 months in prison, and handed Smart a 12-week jail sentence, suspended for 12 months. Smart was also ordered to pay £1,000 compensation.
A third man involved in the case, Thomas George Booth, 63, from Louth, Lincolnshire, has pleaded not guilty to fraud and will face trial in April next year.


What is your alignment?
What color lightsaber would you have?


My name is Mathias Berwig, I’m the kind of developer who cares to use the best practices to develop great products and services. You can read a more updated description or see my past experiences on LinkedIn.
Some of my work is available in my portfolio or in my GitHub profile. I’m always looking for good opportunities to work with great people on amazing projects. Get in touch.
Android application developed for a Ukrainian company which needed to register incoming call logs into a Google Docs Spreadsheet.
Android App that won the Open Tech Space's Hackathon of ExpoIjuí Fenadi 2016. It allows the user to send requests directly to the Government in order to expedite the service of such occurrences.
A one night course about Android programming which I taught during the 2016 Computer Science academic week of UNIJUÍ.
A commercial guide that solves customer relationship issues for ACI (Associação Comercial e Industrial de Ijuí) and is built thinking in which insights business need to obtain from its potential customers as they search for companies or services.
It's an award-winning educational app developed to help kids to practice their vocal abilities. It works as a radio studio simulator which allows users to create their own texts using macros (like date, time, city) to generate text according to their context.
Website developed using Jekyll for RN Berwig company in August, 2016. Besides the creation of the site, this work involved the edition of the product photos and mail accounts migration.


David Livingstone Memorial Primary kids are given a lesson in health
The children learned all about having a healthy diet, healthy mind and a healthy body.
by Kirsten McStay, https://www.dailyrecord.co.uk/authors/kirsten-mcstay/Pupils at David Livingstone Memorial Primary and Nursery School, in Blantyre, thoroughly enjoyed their recent annual health week.
The children learned all about having a healthy diet, healthy mind and a healthy body.
During the week they tried out different types of healthy snacks and participated in lots of sporting activities including a whole school fitness workout.
In their classes they rotated around a variety of activities including, orientating, mindfulness, Go Noodle, yoga and smoothie making.
Jennifer Lattimer, principal teacher at the school, said: “Staff and pupils at the school would like to say a great big thank you to all who contributed to make the week such a success.
“A special thank you to Miss Campbell for organising the week.”
• If you would like to see your school featured in Class Acts, then call reporter Kirsten McStay on 01698 205202 or email her at kirsten.mcstay@reachplc.com