| Package | Description |
|---|---|
| s3games.ai | |
| s3games.engine | |
| s3games.engine.expr | |
| s3games.gui | |
| s3games.io | |
| s3games.player | |
| s3games.robot |
| Modifier and Type | Method and Description |
|---|---|
static Heuristic |
Heuristic.getHeuristic(java.lang.String name,
GameSpecification specs)
constructor method that creates a heuristic of the specified type
|
Player |
AStarStrategy.getPlayer(GameSpecification specs)
get a A* player object for the specified game
|
Player |
BreadthFirstSearchStrategy.getPlayer(GameSpecification specs)
return a new BFS player for the specified game
|
Player |
DepthFirstSearchStrategy.getPlayer(GameSpecification specs)
return a new DFS player for the specified game
|
Player |
MiniMaxStochasticStrategy.getPlayer(GameSpecification specs)
returns a minimax stochastic player for the specified game
|
Player |
MiniMaxStrategy.getPlayer(GameSpecification specs)
returns a minimax player for the specified game
|
Player |
MonteCarloRatioStrategy.getPlayer(GameSpecification specs)
returns a monte carlo ratio player for the specified game
|
Player |
MonteCarloRatioStrategy2.getPlayer(GameSpecification specs)
returns a monte carlo ratio2 player for the specified game
|
Player |
MonteCarloStrategy.getPlayer(GameSpecification specs)
returns a monte carlo player for the specified game
|
Player |
RandomGeneralStrategy.getPlayer(GameSpecification specs)
returns a random general player instance for the specified game
|
abstract Player |
Strategy.getPlayer(GameSpecification specs)
constructor method for the player of the respective strategy subclass
|
| Constructor and Description |
|---|
MoreStonesHeuristic(GameSpecification specs)
constructor needs the game specification
|
| Modifier and Type | Field and Description |
|---|---|
GameSpecification |
Game.gameSpecification
specification of the game
|
| Modifier and Type | Method and Description |
|---|---|
java.util.ArrayList<Move> |
GameRule.getMatchingMoves(Element el,
GameSpecification specs,
Context context)
list of moves that can be performed from this state with the element specified in the first argument
|
void |
GameState.moveElement(Move move,
GameSpecification specs)
only updates the game state by moving element between two locations, does not test anything, does not apply any rules
|
void |
Game.setGameAndPlayers(GameSpecification gameSpecification,
Player[] players)
setup game specification and players objects
|
| Constructor and Description |
|---|
GameState(GameSpecification specs,
Robot robot)
use this constructor to create a state corresponding to the start of game situation
|
Move(java.lang.String from,
java.lang.String to,
java.lang.String element,
GameSpecification specs) |
| Modifier and Type | Field and Description |
|---|---|
GameSpecification |
Context.specs
reference to game specification
|
| Constructor and Description |
|---|
Context(GameState state,
GameSpecification specs,
Robot robot)
construct a new empty context
|
| Modifier and Type | Field and Description |
|---|---|
GameSpecification |
BoardCanvas.gameSpec
reference to game specification
|
| Modifier and Type | Method and Description |
|---|---|
void |
BoardCanvas.setGame(GameSpecification gs)
controller sends the game specification to here
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
GameSpecificationParser.load(java.lang.String gameName,
GameSpecification specs)
load the game specification for the specified game.
|
| Constructor and Description |
|---|
AStarPlayer(GameSpecification specs,
Heuristic heuristic)
construct a new A* player for the specified game with the given heuristic
|
CameraPlayer(GameSpecification specs,
Camera camera)
construct a new camera player
|
MiniMaxPlayer(GameSpecification specs,
Heuristic heuristic)
create a minimax player for the specified game with the heuristic provided
|
MiniMaxStochasticPlayer(GameSpecification specs,
Heuristic heuristic)
create a minimax player for the specified game with the heuristic provided
|
MousePlayer(GameSpecification specs,
GameWindow win)
construct a new mouse player
|
| Constructor and Description |
|---|
Camera(GameSpecification specs)
construct a new camera controller, it will also construct a camera control window.
|
Robot(java.lang.String serialPort,
GameSpecification specs)
construct the robot controller and connect to the servo controller device
|


--- layout: post title: Zaha Hadid's Havenhuis date: '2016-12-12T04:01:26+01:00' categories: - Illustration picture_url: https://film-Storyboards.tumblr.com/post/154371286851 ---


VanderTable
Table Sorting and Columns/Rows Reordering by Drag&Drop
Required: Jquery & JqueryUi
Name
Age
Sex
Gustavo Zafra
23
Male
Bruno Nadai
25
Male
Jhonatan Campos
26
Male
Lucas Leme
24
Male
Fernando Lopes
30
Male
Marcelo Borgues
34
?


---
layout: page-fullwidth
permalink: /CourseRetrospective/
title: Course Retrospective
---
G.K. Chesterton wrote, “If a thing is worth doing, it is worth doing badly.”
Zig Ziglar refines this idea with his own quote, “Anything worth doing is worth doing poorly--until you can learn to do it well.”
A good habit for “continual process improvement” is to complete a retrospective
any time you have come to the end of a major activity in work (and life in general).
Retrospectives, formerly known by the darker term “post-mortems,” have become popular in the Agile software development community
and are healthy activity for any individual or group effort. The basic process is simple: take time to answer a few questions
about your experiences in a given activity, and synthesize the results into concrete actions
that can be applied the next time you are starting a similar kind of effort.
Retrospective questions:
- What worked well for us?
- What did not work well for us?
- What actions can we take to improve our process going forward?
Approach:
A universally valuable approach for accurate prediction is to develop models of the entities and relationships
that are elements in your decision-making process. Models help you to identify and reason about the essentials
and eliminate aspects that are secondary or irrelevant.
In-class exercise:
- Review the activities we have done in CSCI 373 throughout the semester.
See the course
Website and
Handbook to form the complete list.
- Using Google Docs and in small group
- Develop the list of activities we have done this semester, include written and speaking assignments,
reading/listening/viewing reflections and in-class activities and assignments.
- Collect individual responses to each of the above three questions for each activity in your group document.
- Discuss individual responses as a group and synthesize your responses for the third question for each activity.


Liverpool fans hail Dejan Lovren’s performance against Crystal Palace
by Dom TonerDejan Lovren helped Liverpool record an away victory against Crystal Palace on Saturday afternoon – and some of the club’s supporters on Twitter were impressed by his performance.
The Reds netted a late winner to earn three more points in the Premier League and maintain their spot at the top of the table.
Sadio Mane put the Merseyside giants in front early in the first-half at Selhurst Park, before Wilfried Zaha equalised in the 82nd minute.
But Liverpool’s title credentials were strengthened when Roberto Firmino scored in the 85th minute, as he reacted quickest in the penalty box to fire in the ball.
Jurgen Klopp’s side now have 37 points from their opening 13 league matches and stay eight points clear of second-placed Leicester City.
A selection of Reds supporters on social media felt that Lovren deserved credit for his efforts against Palace.
The 30-year-old was caught out in the build up to Zaha’s equaliser, but aside from that was solid and has started the last four consecutive league games.
He is a no-nonsense centre-back that put his body the line against Palace and was an imposing figure at the back alongside Virgil Van Dijk.
Here are some Liverpool fans on Lovren:
Have something to tell us about this article?
Let us know


{{ define "main" -}}
RSS allows you to get automatic updates when a new blog post is created. Using an app like Feedly for the web, or Flipboard on a mobile device, you can be notified when we write something new. There are tons of free readers that will help you keep up to date with topics you're interested in, so go and set one up!


"PISON" Babylonian, the current, broad-flowing, one of the “four heads” into which the river which watered the garden of Eden was divided(Genesis 2:11). Some identify it with the modern Phasis, others with the Halys, others the Jorak or Acampis, others the Jaab, the Indus, the Ganges, etc.
"PISON" Babylonian, the current, broad-flowing, one of the “four heads” into which the river which watered the garden of Eden was divided(Genesis 2:11). Some identify it with the modern Phasis, others with the Halys, others the Jorak or Acampis, others the Jaab, the Indus, the Ganges, etc.


| |||||||
| FRAMES NO FRAMES |
| Event summary | |
|---|---|
| FixedSizeCircularBuffer | A fixed-sized circular buffer object. |
| Heap | A Max/Min-value Heap object with configurable type comparators. |
| HeapIntegerComparator | A comparator for a heap containing integers. |
| HeapIntegerFieldComparator | A comparator for a heap containing events, given a field name which will be an integer to order the heap. |
| HeapStringComparator | A comparator for a heap containing strings. |
| Queue | A First-In-First-Out queue object. |
| Stack | A Last-In-First-Out stack object. |
| |||||||
| FRAMES NO FRAMES |


Introduced in Excel 10 (2002) this BIFF record is an FRT record. Each CELLWATCH record stores the fact that a cell is being watched in the Watch Window toolbar.
Record Data
|
Offset |
Field Name |
Size |
Contents |
|
4 |
rt |
2 |
Record type; this matches the BIFF rt in the first two bytes of the record; =086Ch |
|
6 |
grbitFrt |
2 |
FRT flags; |
|
8 |
refFrt |
8 |
REF structure of cell being watched |
|
16 |
cb |
4 |
Size of variable length rgb ; |
|
20 |
rgb |
var |
Extended info goes here. This is empty for Excel 10 and Excel 11, but is set up for extension and preservation of more data |


You bump into a chair and tables grouping. It's four computers in a circle on tables each with a chair. There were a bunch of these computer stations on the other side of the room, these are all alone.
Then you see 4 signs in those hard-plastic sign holder things that say, in big letters, that these computers are reserved for Teenagers.
So maybe they are not lonely, it seems they are specialist computers. You wonder for a second if specialist are lonely.
You look back at the special computers, it’s been a while since you have been a teen, but, you have never been on a specialty computer...hum...
| . . . . . | ||
| Try and Log On | Dont try and Log On | |
| . . . . . |


What is Big Data?
It depends...
"Big data is a broad term for data sets so large or
complex
that traditional data processing applications are inadequate."
- wikipedia
The Four Vs...
source:http://www.datasciencecentral.com/profiles/blogs/data-veracity
Volume- refers to the vast amounts of data generated every second. Just think of all the
emails,
twitter messages, photos, video clips, sensor data etc. we produce and share every second.
We are not talking Terabytes but Zettabytes or Brontobytes.
On Facebook alone we send 10 billion messages per day, click the "like' button 4.5 billion
times and upload 350 million new pictures each and every day.
This increasingly makes data sets too large to store and analyse using traditional database
technology. With big data technology we can now store and use these data sets with the help
of distributed
systems, where parts of the data is stored in different locations and brought together by
software.
Velocity - Velocity refers to the speed at which new data is generated and the speed at
which data
moves
around. Just think of social media messages going viral in seconds, the speed at which
credit card transactions are checked for fraudulent activities, or the milliseconds it takes
trading
systems to analyse social media networks to pick up signals that trigger decisions to buy or
sell
shares. Big data technology allows us now to analyse the data while it is being generated,
without ever
putting it into databases.
"If only Bradley arm was long.." tweet by Ellen during the Oscars ceremony - surpassed the
million
mark within hours.
Variety refers to the different types of data we can now use. In the past we focused on
structured
data that neatly fits into tables or relational databases, such as financial data (e.g.
sales by product
or region).
In fact, 80% of the world’s data is now unstructured, and therefore can’t easily be put into
tables
(think of photos, video sequences or social media updates). With big data technology we can
now harness
differed types of data (structured and unstructured) including messages, social media
conversations, photos, sensor
data, video or voice recordings and bring them together with more traditional,
structured data.
Veracity refers to the messiness or trustworthiness of the data. With many forms of big
data,
quality and accuracy are less controllable (just think of Twitter posts with hash tags,
abbreviations, typos and
colloquial speech as well as the reliability and accuracy of content) but big data and
analytics technology now allows us
to work with these type of data. The volumes often make up for the lack of quality or
accuracy.
Well, there is the 5th "V" - Value.
Most Important V of Big Data
Cost & Benefits
Having access to big data is no good unless we can turn it into value.
Companies are starting to generate amazing value from their big data. So you can safely argue
that
'value' is the most important V of Big Data. It is important that businesses make a business
case
for any attempt to collect and leverage big data. It is so easy to fall into the buzz trap and
embark on big data initiatives without a clear understanding of costs and benefits.
Some use cases
Understanding and Targeting Customers - amazon.com
Understanding and Optimizing Business Processes - Talent
Acquisition
Personal Quantification and Performance Optimization -
Fitness Apps
Improving Healthcare service - Disease Prevention and
Control
Improving Sports Performance - Sports Science,
MoneyBall
Improving customer Service - Guest Analytics for
Hotels
Improving Security and Law Enforcement - Predictive
policing
Understanding and Targeting Customers: This is one of the biggest and most
publicized areas
of big data use today. Here, big data is used to better understand customers and their
behaviors and preferences.
Companies are keen to expand their traditional data sets with social media data, browser
logs as well as text analytics and sensor data to get a more complete picture
of their customers. The big objective, in many cases, is to create predictive models. You
might remember the example of U.S. retailer Target, who is now able to very
accurately predict when one of their customers will expect a baby. Using big data, Telecom
companies can now better predict customer churn; Wal-Mart can predict what
products will sell, and car insurance companies understand how well their customers actually
drive. Even government election campaigns can be optimized using big data
analytics. Some believe, Obama’s win after the 2012 presidential election campaign was due
to his team’s superior ability to use big data analytics.
Understanding and Optimizing Business Processes:
Big data is also increasingly used to optimize business processes. Retailers are able to
optimize
their stock based on predictions generated from social media data,
web search trends and weather forecasts. One particular business process that is seeing a
lot of big
data analytics is supply chain or delivery route optimization.
Here, geographic positioning and radio frequency identification sensors are used to track
goods or
delivery vehicles and optimize routes by integrating live traffic data,
etc. HR business processes are also being improved using big data analytics. This includes
the
optimization of talent acquisition – Moneyball style, as well as the
measurement of company culture and staff engagement using big data tools.
Personal Quantification and Performance Optimization:
Big data is not just for companies and governments but also for all of us individually. We
can now benefit from the data generated from wearable devices such as smart
watches or smart bracelets. Take the Up band from Jawbone as an example: the armband
collects data on our calorie consumption, activity levels, and our sleep patterns.
While it gives individuals rich insights, the real value is in analyzing the collective
data. In Jawbone’s case, the company now collects 60 years worth of sleep data
every night. Analyzing such volumes of data will bring entirely new insights that it can
feed back to individual users. The other area where we benefit from big data
analytics is finding love - online this is. Most online dating sites apply big data tools
and algorithms to find us the most appropriate matches.
Improving Healthcare and Public Health:
The computing power of big data analytics enables us to decode entire DNA strings in minutes
and will allow us to find new cures and better understand and predict
disease patterns. Just think of what happens when all the individual data from smart watches
and wearable devices can be used to apply it to millions of people and
their various diseases. The clinical trials of the future won’t be limited by small sample
sizes but could potentially include everyone!  By
recording and analyzing every heart beat and breathing pattern of every baby,
the unit was able to develop algorithms that can now predict infections 24 hours before any
physicalsymptoms appear. That way, the team can intervene early and save
fragile babies in an environment where every hour counts. What’s more, big data analytics
allow us to monitor and predict the developments of epidemics and disease
outbreaks. Integrating data from medical records with social media analytics enables us to
monitor flu outbreaks in real-time, simply by listening to what people are saying, i.e.
“Feeling
rubbish today - in bed with a cold”.
Improving Sports Performance:
Most elite sports have now embraced big data analytics. We have the IBM SlamTracker tool for
tennis
tournaments; we use video analytics that track the performance
of every player in a football or baseball game, and sensor technology in sports equipment
such as basket balls or golf clubs allows us to get feedback (via smart
phones and cloud servers) on our game and how to improve it. Many elite sports teams also
track athletes outside of the sporting environment – using smart technology
to track nutrition and sleep, as well as social media conversations to monitor emotional
wellbeing.
Improving customer Service:
Improving Security and Law Enforcement:
Big data is applied heavily in improving security and enabling law enforcement. I am sure
you are aware of the revelations that the National Security Agency (NSA)
in the U.S. uses big data analytics to foil terrorist plots (and maybe spy on us).
Others use big data techniques to detect and prevent cyber attacks. Police forces use big
data tools to catch criminals and even predict criminal activity and
credit card companies use big data use it to detect fraudulent transactions.
Interesting Facts About Big Data
source: https://mydigitaleyeshadow.wordpress.com/
The NSA is thought to analyze 1.6%
of all global traffic - around 30 petabytes (30 million gigabytes) every
day!
Around 100 hours of videos are uploaded to YouTube every minute
and it would take you around 15 years to watch every video uploaded by users in one
day.
If you burned all of the data created in just one day onto DVDs , you could stack
them on top of each other and reach the moon - twice .
The big data industry is expected to grow from US$20.2 billion
in 2013 to about US$54.3 billion .
1.9 million IT jobs will be created in the US by 2015 to carry out big data
projects.
Each of those will be supported by 3 new jobs created outside of IT - meaning a
total of 6 million new jobs .
“There were 5 exabytes of information created between the dawn of civilization
through 2003, but that much information is now created every 2 days ”
- Eric Schmidt, Google in 2010
“Information is the oil of the 21st century , and analytics is the combustion
engine.”
Peter Sondergaard, Gartner Research
No surprise - Facebook, Gmail, LinkedIn are all free!
What is Hadoop?
The Blind Men and the Elephant...
Hadoop is an open-source framework for big data
Hadoop was created by Doug Cutting and Mike Cafarella in 2005. Inspired by Google's white papers
Hadoop is distributed, reliable and fault tolerant
Horizontal scalability from single computer to thousands of cluster nodes.
MapReduce White Paper by Jorrrey Dean and Sanjay Ghemawat -
http://static.googleusercontent.com/media/research.google.com/en//archive/mapreduce-osdi04.pdf
The Four modules - Hadoop Common, HDFS, YARN & MapReduce
Hadoop History:
Hadoop was created by Doug Cutting and Mike Cafarella in 2005. Cutting, who was working at
Yahoo! at the time, named it after his son's toy elephant.
It was originally developed to support distribution for the Nutch search engine project.
Hadoop managed by the Apache Foundation is a powerful open-source platform written
in java that is capable of processing large amounts of heterogeneous data-sets at scale in a
distributive fashion on cluster of computers using simple programming models. It is designed
to scale up from single server to thousands of machines, each offering local computation and
storage and has become an in-demand technical skill.
Hadoop Architecture: The Apache Hadoop framework includes following four
modules:
Hadoop Common: Contains Java libraries and utilities needed by
other Hadoop modules. These libraries give filesystem and OS level abstraction and
comprise of the essential Java files and scripts that are required to start Hadoop.
Hadoop Distributed File System (HDFS): A distributed file-system
that provides
high-throughput access to application data on the community machines thus providing
very
high aggregate bandwidth across the cluster.
Hadoop YARN: A resource-management framework responsible for job
scheduling and
cluster resource management.
Hadoop MapReduce: This is a YARN- based programming model for
parallel processing of
large data sets.
Hadoop Ecosystem
https://hadoopecosystemtable.github.io/
Hadoop Ecosystem:
Hadoop has gained its popularity due to its ability of storing, analyzing and accessing
large amount of data, quickly and cost effectively through clusters of
commodity hardware. It wont be wrong if we say that Apache Hadoop is actually a collection
of several components and not just a single product.
With Hadoop Ecosystem there are several commercial along with an open source products which
are broadly used to make Hadoop laymen accessible and more usable.
The following sections provide additional information on the individual components:
MapReduce
Hadoop MapReduce is a software framework for easily writing applications which process big
amounts of data in-parallel on large clusters of commodity hardware in
a reliable, fault-tolerant manner. In terms of programming, there are two functions which
are most common in MapReduce.
The Map Task: Master computer or node takes input and convert it into divide it into smaller
parts and distribute it on other worker nodes. All worker nodes solve
their own small problem and give answer to the master node.
The Reduce Task: Master node combines all answers coming from worker node and forms it in
some form of output which is answer of our big distributed problem.
Generally both the input and the output are reserved in a file-system. The framework is
responsible for scheduling tasks, monitoring them and even re-executes the
failed tasks.
Hadoop Distributed File System (HDFS)
HDFS is a distributed file-system that provides high throughput access to data. When data is
pushed to HDFS, it automatically splits up into multiple blocks and
stores/replicates the data thus ensuring high availability and fault tolerance.
Note: A file consists of many blocks (large blocks of 64MB and above).
Here are the main components of HDFS:
NameNode: It acts as the master of the system. It maintains the name system i.e.,
directories and files and manages the blocks which are present on the DataNodes.
DataNodes: They are the slaves which are deployed on each machine and provide the actual
storage.
They are responsible for serving read and write requests for the clients.
Secondary NameNode: It is responsible for performing periodic checkpoints. In the event of
NameNode failure, you can restart the NameNode using the checkpoint.
Hive:
Hive is part of the Hadoop ecosystem and provides an SQL like interface to Hadoop. It is a
data warehouse system for Hadoop that facilitates easy data summarization,
ad-hoc queries, and the analysis of large datasets stored in Hadoop compatible file systems.
It provides a mechanism to project structure onto this data and query the data using a
SQL-like language called HiveQL. Hive also allows traditional map/reduce
programmers to plug in their custom mappers and reducers when it is inconvenient or
inefficient to express this logic in HiveQL.
The main building blocks of Hive are –
Metastore – To store metadata about columns, partition and system catalogue.
Driver – To manage the lifecycle of a HiveQL statement
Query Compiler – To compiles HiveQL into a directed acyclic graph.
Execution Engine – To execute the tasks in proper order which are produced by the compiler.
HiveServer – To provide a Thrift interface and a JDBC / ODBC server.
HBase (Hadoop DataBase):
HBase is a distributed, column oriented database and uses HDFS for the underlying storage.
As said earlier, HDFS works on write once and read many times pattern,
but this isn’t a case always. We may require real time read/write random access for huge
dataset; this is where HBase comes into the picture. HBase is built on
top of HDFS and distributed on column-oriented database.
Here are the main components of HBase:
HBase Master: It is responsible for negotiating load balancing across all RegionServers and
maintains the state of the cluster. It is not part of the actual
data storage or retrieval path.
RegionServer: It is deployed on each machine and hosts data and processes I/O requests.
Zookeeper:
ZooKeeper is a centralized service for maintaining configuration information, naming,
providing
distributed synchronization and providing group services which
are very useful for a variety of distributed systems. HBase is not operational without
ZooKeeper.
Mahout:
Mahout is a scalable machine learning library that implements various different approaches
machine learning. At present Mahout contains four main groups of algorithms:
Recommendations, also known as collective filtering
Classifications, also known as categorization
Clustering
Frequent itemset mining, also known as parallel frequent pattern mining
Algorithms in the Mahout library belong to the subset that can be executed in a distributed
fashion and have been written to be executable in MapReduce.
Mahout is scalable along three dimensions: It scales to reasonably large data sets by
leveraging algorithm properties or implementing versions based on Apache Hadoop.
Sqoop (SQL-to-Hadoop):
Sqoop is a tool designed for efficiently transferring structured data from SQL Server and
SQL Azure to HDFS and then uses it in MapReduce and Hive jobs.
One can even use Sqoop to move data from HDFS to SQL Server.
Apache Spark:
Apache Spark is a general compute engine that offers fast data analysis on a large scale.
Spark is built on HDFS but bypasses MapReduce and instead uses its
own data processing framework. Common uses cases for Apache Spark include real-time queries,
event stream processing, iterative algorithms, complex operations
and machine learning.
Pig:
Pig is a platform for analyzing and querying huge data sets that consist of a high-level
language for expressing data analysis programs, coupled with infrastructure
for evaluating these programs. Pig’s built-in operations can make sense of semi-structured
data, such as log files, and the language is extensible using Java to add
support for custom data types and transformations.
Pig has three main key properties:
Extensibility
Optimization opportunities
Ease of programming
The salient property of Pig programs is that their structure is amenable to substantial
parallelization, which in turns enables them to handle very large data sets.
At the present time, Pig’s infrastructure layer consists of a compiler that produces
sequences of MapReduce programs.
Oozie:
Apache Oozie is a workflow/coordination system to manage Hadoop jobs.
Flume:
Flume is a framework for harvesting, aggregating and moving huge amounts of log data or text
files in and out of Hadoop. Agents are populated throughout ones IT
infrastructure inside web servers, application servers and mobile devices. Flume itself has
a query processing engine, so it’s easy to transform each new batch of
data before it is shuttled to the intended sink.
Ambari:
Ambari was created to help manage Hadoop. It offers support for many of the tools in the
Hadoop ecosystem including Hive, HBase, Pig, Sqoop and Zookeeper. The tool
features a management dashboard that keeps track of cluster health and can help diagnose
performance issues.
Conclusion:
Hadoop is powerful because it is extensible and it is easy to integrate with any component.
Its popularity is due in part to its ability to store, analyze and access
large amounts of data, quickly and cost effectively across clusters of commodity hardware.
Apache Hadoop is not actually a single product but instead a collection of
several components. When all these components are merged, it makes the Hadoop very user
friendly.
It's Complicated, I know...
Hadopp has its limitations. Hadoop was designed for batch processing over
periods oftime in the hour or even day ranges.
Many efforts have been done to make it faster and some of the tools mentioned
in the preivous sldies have beeen improved, lowering the latency to the
seconds range. But, it is far from being fast enough for applications that require
sub-seconds latency/resoponse time.
Another problem is that its ecosystem is very rich and diverse.
Uses many programming lanauges and different data abstracgtions.
It results in a steep learning curve, maintenance nightmare, difficult to
setup and configure.


| MPI_FILE_GET_SIZE(fh, size) | |
| IN fh | file handle (handle) |
| OUT size | size of the file in bytes (integer) |
int MPI_File_get_size(MPI_File fh, MPI_Offset *size)
MPI_FILE_GET_SIZE(FH, SIZE, IERROR)
INTEGER FH, IERROR
INTEGER(KIND=MPI_OFFSET_KIND) SIZE
MPI::Offset MPI::File::Get_size() const
MPI_FILE_GET_SIZE returns, in size, the current size in bytes of the file associated with the file handle fh. As far as consistency semantics are concerned, MPI_FILE_GET_SIZE is a data access operation (see Section File Consistency , page File Consistency ).


Account renamed
You successfully updated the account name
Your accounts
Select an account or add a new one.
| Account name | What you can do | Select account |
|---|---|---|
|
TYIT LTD
Account ID: 46MYXV |
Accept agreements, view information and manage PAYE schemes, organisations, apprentices and team members | Open TYIT LTD account homepage |


Hello {{name}},
{{ content }}
Don't hesitate to contact me if you have any questions regarding the banquet.
With kindest regards,
Jenny Abrahamsson, Banquet Manager @ ARKAD 2017


--- title: call_to_action: Contact background_image_path: large_header: true testimonials: - message: We have joined SNEPOA because we see that.... image: "https://placekitten.com/g/60/60?a=.png" name: Robert de Cosmo (President of CT Property Owners Alliance) - message: As soon as SNEPOA was founded, it decided to join the lawsuit challenging the MA eviction moratorium. image: "https://www.fillmurray.com/60/60?a=.png" name: Mitchell Matorin (Attorney and Plaintif ) - message: ....... image: "https://placebear.com/60/60?a=.png" name: D. and G. Gibbleston _options: image: width: 60 height: 60 ---
Southern New England Property Owners Association supports legislative actions, lobbying efforts, and ....
{% endfor %}


Thanks for coming! Please mess around and let me know what you think. Email me any suggestions or notes on the app paul.darlington.pearson@gmail.com


assigned
by Trey Pendragon at 2021-06-09 16:07:53.closed
by Eliot Jordan at 2021-06-09 16:55:40.referenced
by Eliot Jordan at 2021-06-09 16:55:40.merged
by Eliot Jordan at 2021-06-09 16:55:40.closed
by Eliot Jordan at 2021-06-09 16:55:40.head_ref_deleted
by Eliot Jordan at 2021-06-09 16:55:41.closed
by Trey Pendragon at 2021-06-09 17:06:30.referenced
by Bess Sadler at 2021-06-09 17:14:42.merged
by Bess Sadler at 2021-06-09 17:14:42.closed
by Bess Sadler at 2021-06-09 17:14:42.head_ref_deleted
by Bess Sadler at 2021-06-09 17:14:43.referenced
by Eliot Jordan at 2021-06-09 17:29:58.merged
by Eliot Jordan at 2021-06-09 17:29:58.closed
by Eliot Jordan at 2021-06-09 17:29:58.head_ref_deleted
by Eliot Jordan at 2021-06-09 17:29:59.review_requested
by None at 2021-06-09 14:24:12.review_requested
by None at 2021-06-09 14:24:12.referenced
by Kevin Reiss at 2021-06-09 17:03:39.merged
by Kevin Reiss at 2021-06-09 17:03:39.closed
by Kevin Reiss at 2021-06-09 17:03:39.head_ref_deleted
by Kevin Reiss at 2021-06-09 17:03:57.assigned
by None at 2021-06-09 18:26:16.assigned
by None at 2021-06-09 18:28:05.assigned
by None at 2021-06-09 18:26:45.closed
by None at 2021-06-09 18:35:25.assigned
by None at 2021-06-09 18:31:06.closed
by None at 2021-06-09 18:35:26.assigned
by None at 2021-06-09 18:30:15.closed
by None at 2021-06-09 18:35:26.assigned
by None at 2021-06-09 18:29:44.closed
by None at 2021-06-09 18:35:26.assigned
by None at 2021-06-09 18:29:13.closed
by None at 2021-06-09 18:35:26.assigned
by None at 2021-06-09 18:28:45.closed
by None at 2021-06-09 18:35:26.assigned
by None at 2021-06-09 18:33:50.closed
by None at 2021-06-09 18:35:27.assigned
by None at 2021-06-09 18:32:46.closed
by None at 2021-06-09 18:35:27.assigned
by None at 2021-06-09 18:31:37.closed
by None at 2021-06-09 18:35:27.labeled
by None at 2021-06-09 18:36:20.assigned
by None at 2021-06-09 18:34:22.labeled
by None at 2021-06-09 18:36:21.assigned
by None at 2021-06-09 18:33:17.labeled
by None at 2021-06-09 18:36:21.assigned
by None at 2021-06-09 18:32:17.labeled
by None at 2021-06-09 18:36:21.closed
by None at 2021-06-09 18:36:44.closed
by None at 2021-06-09 18:36:44.closed
by None at 2021-06-09 18:37:14.closed
by None at 2021-06-09 18:37:32.closed
by None at 2021-06-09 18:37:49.total of 72 events lacking linked resources
sent preliminary report on Slack, subject to revision
Issue is still happening, Honeybadger reported it last as of 6/9/2021 @ 7:00 AM: https://app.honeybadger.io/projects/54497/faults/79785330
Notice that the error indicates that the (Solr?) URL cannot be found: "Faraday::ResourceNotFound: the server responded with status 404"
reopened
by Hector Correa at 2021-06-09 13:46:09.renamed
by Christina Chortaria at 2021-06-09 13:47:40.https://github.com/pulibrary/bibdata/compare/alma...issues-1348-jrgriffiniii-index-once?expand=1 tracks my progress with this. The test suite should be passing, but I was encountering a number of repeated failures.
review_requested
by Christina Chortaria at 2021-06-09 14:46:30.referenced
by Christina Chortaria at 2021-06-09 15:05:57.merged
by Christina Chortaria at 2021-06-09 15:05:57.closed
by Christina Chortaria at 2021-06-09 15:05:57.head_ref_deleted
by Christina Chortaria at 2021-06-09 15:05:58.referenced
by Christina Chortaria at 2021-06-09 15:34:50.merged
by Christina Chortaria at 2021-06-09 15:34:50.closed
by Christina Chortaria at 2021-06-09 15:34:50.head_ref_deleted
by Christina Chortaria at 2021-06-09 15:34:50.closed by #1405
closed
by Christina Chortaria at 2021-06-09 15:35:39.@hackartisan I think in your comment you meant to type: we are not ready to close issue #1389 (I didn't want to edit your comment)
Yes. thanks @christinach; I fixed that typo.
mentioned
by None at 2021-06-09 15:38:20.subscribed
by None at 2021-06-09 15:38:21.mentioned
by Christina Chortaria at 2021-06-09 15:45:40.subscribed
by Christina Chortaria at 2021-06-09 15:45:40.convert_to_draft
by James R. Griffin III at 2021-06-09 17:25:51.referenced
by Christina Chortaria at 2021-06-09 20:26:57.merged
by Christina Chortaria at 2021-06-09 20:26:57.closed
by Christina Chortaria at 2021-06-09 20:26:57.head_ref_deleted
by Christina Chortaria at 2021-06-09 20:26:57.deployed
by Trey Pendragon at 2021-06-09 15:41:03.deployed
by Trey Pendragon at 2021-06-09 17:29:41.deployed
by Trey Pendragon at 2021-06-09 19:09:25.deployed
by Trey Pendragon at 2021-06-09 20:32:34.closed by #1408
assigned
by None at 2021-06-09 17:59:31.labeled
by None at 2021-06-09 17:59:45.referenced
by None at 2021-06-09 19:32:53.closed
by Christina Chortaria at 2021-06-09 20:27:37.labeled
by Christina Chortaria at 2021-06-09 21:10:35.assigned
by Christina Chortaria at 2021-06-09 21:10:36.renamed
by Christina Chortaria at 2021-06-09 21:11:07.closed
by Kevin McElwee at 2021-06-09 20:54:57.Just double checked on prod, it's all set.
closed
by Kevin McElwee at 2021-06-09 15:52:41.labeled
by Kevin McElwee at 2021-06-09 18:55:18.assigned
by Kevin McElwee at 2021-06-09 18:55:18.We did this ! 🎉
closed
by Kevin McElwee at 2021-06-09 19:01:33.assigned
by Kevin McElwee at 2021-06-09 19:10:28.assigned
by Bess Sadler at 2021-06-09 19:10:28.A simple environment variable error.
assigned
by Kevin McElwee at 2021-06-09 20:18:51.closed
by Kevin McElwee at 2021-06-09 20:21:29.closed
by Kevin McElwee at 2021-06-09 20:55:38.This happened to fix itself (?)
closed
by Kevin McElwee at 2021-06-09 20:56:50.We did it 🎉
closed
by Kevin McElwee at 2021-06-09 20:59:02.referenced
by Kevin McElwee at 2021-06-09 13:30:27.closed
by Kevin McElwee at 2021-06-09 13:31:14.referenced
by Kevin McElwee at 2021-06-09 13:30:27.closed
by Kevin McElwee at 2021-06-09 14:16:14.closed
by Kevin McElwee at 2021-06-09 14:16:47.closed
by Kevin McElwee at 2021-06-09 15:02:33.closed
by Kevin McElwee at 2021-06-09 15:16:28.closed
by Kevin McElwee at 2021-06-09 15:16:59.labeled
by Kevin McElwee at 2021-06-09 15:17:19.closed
by Kevin McElwee at 2021-06-09 15:17:26.I deleted the most recently created monogram, which had a broken thumbnail, and that allowed the form to work.
closed
by Trey Pendragon at 2021-06-09 17:20:06.Done.
closed
by Trey Pendragon at 2021-06-09 18:04:31.labeled
by Trey Pendragon at 2021-06-09 18:36:59.@kelynch Those are all properties of the coin, not the issue: https://figgy.princeton.edu/catalog/parent/e0a46faa-8c53-49c6-b89b-ff35c743ec6e/e74585f8-e46a-4fff-8066-81eca8917843
👍🏻 I followed up with Alan clarifying that the fields are visible in the Coins input form (https://figgy.princeton.edu/concern/numismatics/coins/new). Thanks @eliotjordan and @tpendragon
mentioned
by Kate Lynch at 2021-06-09 17:09:36.subscribed
by Kate Lynch at 2021-06-09 17:09:36.closed
by Kate Lynch at 2021-06-09 19:23:47.mentioned
by Eliot Jordan at 2021-06-09 19:23:47.subscribed
by Eliot Jordan at 2021-06-09 19:23:47.mentioned
by Trey Pendragon at 2021-06-09 19:23:47.subscribed
by Trey Pendragon at 2021-06-09 19:23:47.convert_to_draft
by James R. Griffin III at 2021-06-09 17:26:49.Coverage increased (+0.003%) to 96.734% when pulling 4e172fe9337557e3cb8ad0ab57da42029a0ed4f0 on linkbackto_catalog into f26832d2163fdd3ccddb88df0111a099f684339d on alma.
assigned
by James R. Griffin III at 2021-06-09 19:55:43.Coverage remained the same at 96.73% when pulling d68a323df04179bbabfef3c4ce1794560b7c5ab3 on issues-2411-jrgriffiniii-figgy-thumbs into f26832d2163fdd3ccddb88df0111a099f684339d on alma.
This needs to be implemented to support regenerating the Bib. ID from the Voyager ID (the latter is returned from the GraphQL response, and the client can simply prefix and append a constant suffix to generate this consistently).
convert_to_draft
by James R. Griffin III at 2021-06-09 13:28:24.Coverage remained the same at 96.73% when pulling a093dff008fb1b282d275bb348bb28d602239961 on issue2413show into f26832d2163fdd3ccddb88df0111a099f684339d on alma.
ready_for_review
by Hector Correa at 2021-06-09 21:02:16.referenced
by Bess Sadler at 2021-06-09 12:50:48.merged
by Bess Sadler at 2021-06-09 12:50:48.closed
by Bess Sadler at 2021-06-09 12:50:48.head_ref_deleted
by Bess Sadler at 2021-06-09 12:50:48.closed
by Francis Kayiwa at 2021-06-09 15:19:27.head_ref_force_pushed
by Francis Kayiwa at 2021-06-09 15:40:25.referenced
by Francis Kayiwa at 2021-06-09 16:27:11.merged
by Francis Kayiwa at 2021-06-09 16:27:11.closed
by Francis Kayiwa at 2021-06-09 16:27:11.head_ref_deleted
by Francis Kayiwa at 2021-06-09 16:27:12.referenced
by James R. Griffin III at 2021-06-09 17:13:29.merged
by James R. Griffin III at 2021-06-09 17:13:29.closed
by James R. Griffin III at 2021-06-09 17:13:30.head_ref_deleted
by James R. Griffin III at 2021-06-09 17:13:30.referenced
by Eliot Jordan at 2021-06-09 16:56:06.merged
by Eliot Jordan at 2021-06-09 16:56:06.closed
by Eliot Jordan at 2021-06-09 16:56:06.referenced
by James R. Griffin III at 2021-06-09 19:08:01.merged
by James R. Griffin III at 2021-06-09 19:08:01.closed
by James R. Griffin III at 2021-06-09 19:08:01.head_ref_deleted
by James R. Griffin III at 2021-06-09 19:08:05.unlabeled
by None at 2021-06-08 22:52:24.labeled
by None at 2021-06-08 22:52:42.Coverage decreased (-0.4%) to 99.636% when pulling 943a48e08f94c7431650384646c45593273a3899 on linkbackto_catalog into 0ebe8082cb436dd149f73c2f385f44364d1e5de9 on main.
review_requested
by Kevin Reiss at 2021-06-09 04:16:11.referenced
by Shaun Ellis at 2021-06-09 13:35:22.merged
by Shaun Ellis at 2021-06-09 13:35:22.closed
by Shaun Ellis at 2021-06-09 13:35:22.head_ref_deleted
by Shaun Ellis at 2021-06-09 13:35:23.This has been addressed.
closed
by Kevin Reiss at 2021-06-09 15:18:40.labeled
by Shaun Ellis at 2021-06-09 15:38:26.renamed
by Kevin Reiss at 2021-06-09 16:00:42.Another example item with this status: Item ID:<PHONE_NUMBER>0006421Holdings ID:<PHONE_NUMBER>0006421MMS ID:<PHONE_NUMBER>506421
renamed
by Kevin Reiss at 2021-06-09 22:09:13.labeled
by Kevin Reiss at 2021-06-09 22:09:19.assigned
by Shaun Ellis at 2021-06-09 22:09:25.labeled
by Kevin Reiss at 2021-06-09 22:39:46.assigned
by Kevin McElwee at 2021-06-09 15:33:13.referenced
by Kevin McElwee at 2021-06-09 15:49:40.review_requested
by Kevin McElwee at 2021-06-09 15:50:02.assigned
by Kevin McElwee at 2021-06-09 20:16:24.assigned
by Bess Sadler at 2021-06-09 20:16:40.


After our meeting with Vince Ball at Nytec, we spent many hours developing a brand-new concept in response to our design question. We realized that a successful response, which removes the barrier between creation and consumption of journalism, should harness the power of citizen journalism at its best.
Now, what is citizen journalism, and what does it mean for it to be “at its best”? TED speaker Paul Lewis’s 2011 TEDxThessaloniki talk shared a powerful and practical vision for a future of investigative journalism in which reporters activately motivate and direct everyday people to submit the source material needed to uncover the truth. This is a different view of crowdsourcing in which citizens help reporters do their jobs rather than replace reporters altogether.
We began to wonder, what would a crowdsourced platform for immersive, expository content look like? How could it enable reporters and readers to build up a living, immersive coverage space, filled with captures, embedded content, and storytelling? How could it enable faraway walkthroughs? How could it give context to readers’ eyewitness accounts of a scene? How could it change when and why articles are written in response to events and happenings in the world?
These are all questions we are thinking about as we further develop our new concept: “Stitch”. We’ve prepared several storyboards describing “Stitch” in action, which you can view below.
What is “Stitch”?
“Stitch” is a platform that enables immersive exploration of the news through three-dimensional locations and content embedded within the space, contributed by journalists and readers alike. The platform gives publishers a powerful way to combine the best of professional and citizen journalism: readers can not only immerse themselves the very spaces where the news happens, but they can also use the depth cameras in their (future) smartphones and tablets to seamlessly contribute their own captures to the space.
What kinds of content end up in a “Stitch” environment?
In addition to 3D captures, journalists and readers may embed other media, such as video, photos, audio, or written text, at specific points in the space, thereby giving all reader contributions greater context in the target location. They may also create narrated walkthroughs of the space to highlight specific environment features or content. In this way, the “Stitch” environments also serve as a space to create new stories from contributed content.
How do “Stitch” environments fit into the news?
The 3D environments of “Stitch” would be a joint production between journalists and readers in the field, and can be populated in several ways:
- As a response to a speculative piece, in which a publication would solicit and incentivize readers to submit their 3D captures, videos, photos, and eyewitness accounts to build up an exploration space for a story.
- As a supplement to a published story, where readers would embed their own content, walkthroughs, and other content into an existing or entirely reader-contributed 3D environment.
- As a wholly reader-contributed response to an event or happening, which would provide captures and eyewitness accounts from which the publisher may generate their own published stories and other coverage in reference to the 3D environment and the content embedded in it.
Who benefits from “Stitch”?
“Stitch” benefits publishers by giving them a powerful new storytelling tool, one which gives unprecedented presence and context to the news they already cover. It also enables them to leverage the contributions of readers around the world to help journalists and readers explore, experience, and capture places they cannot be. This new way to contextualize reader contributions within a physical space also lets journalists validate their own coverage and generate new coverage in response. Finally, the immersive nature of “Stitch” and its deep integration to the publisher’s existing web coverage gives readers a new experience that extends well beyond the snippets of coverage they see elsewhere online.
“Stitch” benefits readers by offering them a compelling and immersive experience of the news by virtually taking them on-location and letting them explore for themselves. Readers who are actually on-site—especially those in places where the publisher is not—are now empowered to contribute their own captures and experiences to an environment. Further, readers can receive rewards and incentives in exchange for their valuable contributions, such as access to more content on the publisher’s website. In this way, readers are invited as collaborators to get more involved in the work news-making.
Next Steps
We’ve already begun to expand on our concept with these system component and interaction diagrams:
This week we are diving head-first into prototyping interfaces as well.


Directory and File Busting
Output:
Copy to clipboard
Clear
Download output
Listener Configuration:
URL:
Response
codes to hide (seperated by a
comma
):
File
extensions to append (seperated by a
comma
):
Threads (default 50)
Max
Wordlist
common
small
medium
small-lowercase
medium-lowecase
Start
Shutdown Server


EVENTS
*These dates are subject to change, please join our mailing list or check back to see updates.
Week of November 17 – Joint event with the MIT Data Ventures Club and pre-release of data to participants
Week of November 24 – Release data for all participants
Week of December 15 – Conclude contest
Week of December 29 – Judge submissions and announce contest winners
Week of January 5 – Event with the Cambridge City Council


Claim your NHS Pension
Confirm your address
This is the address we'll send your pension confirmation letter to, it is the most recently updated address we have for you in our records.
Address:
- 10 Madeup Road,
- Madeupistown,
- Madeupville.
- MDE 0UP.
Claim your NHS Pension
This is the address we'll send your pension confirmation letter to, it is the most recently updated address we have for you in our records.


Oscilloscope data by LuboJ! ...added text on Raspi Zero!
Real-time reloding
timeToRead (s):
sampleRate (kS):
created by LuboJ :)


Chapter 8 Simple queries (11)
8.1 Some extra handy libraries
Here are some packages that we find handy in the preliminary investigation of a database (or a problem that involves data from a database).
##
## Attaching package: 'skimr'
## The following object is masked from 'package:knitr':
##
## kable
8.2 Basic investigation
- Need both familiarity with the data and a focus question
- An interative process
- Each informs the other
- R tools for data investigation
- glimpse
- str
- View and kable
- overview investigation: do you understand your data
- documentation and its limits
- what’s missing from the database: (columns, records, cells)
- find out how the data is used by those who enter it and others who’ve used it before
- why is there missing data?
8.3 Using Dplyr
We already started, but that’s OK.
8.3.1 finding out what’s in the database
- DBI / RPostgres packages
- R tools like glimpse, skimr, kable.
- Tutorials like: https://suzan.rbind.io/tags/dplyr/
- Benjamin S. Baumer, A Grammar for Reproducible and Painless Extract-Transform-Load Operations on Medium Data: https://arxiv.org/pdf/1708.07073
8.3.2 sample query
- rental
- date subset
8.3.3 Subset: only retrieve what you need
- Columns
- Rows
- number of row
- specific rows
- Counts & stats
8.3.4 Make the server do as much work as you can
discuss this simple example? http://www.postgresqltutorial.com/postgresql-left-join/
- dplyr joins on the server side
- Where you put
(collect(n = Inf))
really matters
8.4 What is dplyr sending to the server?
- show_query as a first draft
8.5 Writing SQL queries directly to the DBMS
- dbquery
- Glue for constructing SQL statements
- parameterizing SQL queries
8.6 Chosing between dplyr and native SQL
- performance considerations: first get the right data, then worry about performance
- Trade offs between leaving the data in PostgreSQL vs what’s kept in R:
- browsing the data
- larger samples and complete tables
- using what you know to write efficient queries that do most of the work on the server
| * left join staff * left join customer |
| * dplyr joins in the R |
| # Leftovers (12) |
| Most of the content in this file has een moved elsewhere. |
| ## Some extra handy libraries |
| Here are some packages that we find handy in the preliminary investigation of a database (or a problem that involves data from a database). |
r library(glue) library(skimr) |
## ## Attaching package: 'skimr' |
## The following object is masked from 'package:knitr': ## ## kable |
| ## More topics * Check this against Aaron Makubuya’s workshop at the Cascadia R Conf. |
| ## Standards for production jobs |
| * writing tests for your queries |
| # Joins and complex queries (13) |
| Libraries loaded and functions are loaded |
| ## Verify Docker is up and running: |
r result <- system2("docker", "version", stdout = TRUE, stderr = TRUE) result |
## [1] "Client:" ## [2] " Version: 18.06.1-ce" ## [3] " API version: 1.38" ## [4] " Go version: go1.10.3" ## [5] " Git commit: e68fc7a" ## [6] " Built: Tue Aug 21 17:21:31 2018" ## [7] " OS/Arch: darwin/amd64" ## [8] " Experimental: false" ## [9] "" ## [10] "Server:" ## [11] " Engine:" ## [12] " Version: 18.06.1-ce" ## [13] " API version: 1.38 (minimum version 1.12)" ## [14] " Go version: go1.10.3" ## [15] " Git commit: e68fc7a" ## [16] " Built: Tue Aug 21 17:29:02 2018" ## [17] " OS/Arch: linux/amd64" ## [18] " Experimental: true"
verify pet DB is available, it may be stopped. |
r result <- system2("docker", "ps -a", stdout = TRUE, stderr = TRUE) result |
## [1] "CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES" ## [2] "2b833b610d1b postgres:10 \"docker-entrypoint.s…\" 25 seconds ago Up 5 seconds <IP_ADDRESS>:5432->5432/tcp sql-pet" |
r any(grepl('Up .+pet$',result)) |
## [1] TRUE
Start up the docker-pet container |
r result <- system2("docker", "start sql-pet", stdout = TRUE, stderr = TRUE) result |
## [1] "sql-pet" |
| now connect to the database with R |
| ```r # need to wait for Docker & Postgres to come up before connecting. |
| con <- wait_for_postgres(user = Sys.getenv(“DEFAULT_POSTGRES_USER_NAME”), password = Sys.getenv(“DEFAULT_POSTGRES_PASSWORD”), dbname = “dvdrental”, seconds_to_test = 10) ``` |
| ```r ## select examples ## dbGetQuery returns the entire result set as a data frame. ## For large returned datasets, complex or inefficient SQL statements, this may take a ## long time. |
| ## dbSendQuery: parses, compiles, creates the optimized execution plan. ## dbFetch: Execute optimzed execution plan and return the dataset. ## dbClearResult:remove pending query results from the database to your R environment ``` |
| How many customers are there in the DVD Rental System |
r rs1 <- dbGetQuery(con,'select * from customer;') kable(head(rs1)) |
| customer_id store_id first_name last_name email address_id activebool create_date last_update active |
524 1 Jared Ely<EMAIL_ADDRESS>530 TRUE 2006-02-14 2013-05-26 14:49:45 1
1 1 Mary Smith<EMAIL_ADDRESS>5 TRUE 2006-02-14 2013-05-26 14:49:45 1
2 1 Patricia Johnson<EMAIL_ADDRESS>6 TRUE 2006-02-14 2013-05-26 14:49:45 1
3 1 Linda Williams<EMAIL_ADDRESS>7 TRUE 2006-02-14 2013-05-26 14:49:45 1
4 2 Barbara Jones<EMAIL_ADDRESS>8 TRUE 2006-02-14 2013-05-26 14:49:45 1
5 1 Elizabeth Brown<EMAIL_ADDRESS>9 TRUE 2006-02-14 2013-05-26 14:49:45 1
pco <- dbSendQuery(con,'select * from customer;')
rs2 <- dbFetch(pco)
dbClearResult(pco)
kable(head(rs2))
| customer_id | store_id | first_name | last_name | address_id | activebool | create_date | last_update | active | |
|---|---|---|---|---|---|---|---|---|---|
| 524 | 1 | Jared | Ely |<EMAIL_ADDRESS>| 530 | TRUE | 2006-02-14 | 2013-05-26 14:49:45 | 1 |
| 1 | 1 | Mary | Smith |<EMAIL_ADDRESS>| 5 | TRUE | 2006-02-14 | 2013-05-26 14:49:45 | 1 |
| 2 | 1 | Patricia | Johnson |<EMAIL_ADDRESS>| 6 | TRUE | 2006-02-14 | 2013-05-26 14:49:45 | 1 |
| 3 | 1 | Linda | Williams |<EMAIL_ADDRESS>| 7 | TRUE | 2006-02-14 | 2013-05-26 14:49:45 | 1 |
| 4 | 2 | Barbara | Jones |<EMAIL_ADDRESS>| 8 | TRUE | 2006-02-14 | 2013-05-26 14:49:45 | 1 |
| 5 | 1 | Elizabeth | Brown |<EMAIL_ADDRESS>| 9 | TRUE | 2006-02-14 | 2013-05-26 14:49:45 | 1 |
# insert yourself as a new customer
dbExecute(con
,"insert into customer
(store_id,first_name,last_name,email,address_id
,activebool,create_date,last_update,active)
values(2,'Sophie','Yang','dodreamdo@yahoo.com',1,TRUE,'2018-09-13','2018-09-13',1) returning customer_id;
"
)
## [1] 0
## anti join -- Find customers who have never rented a movie.
rs <- dbGetQuery(con,
"select c.first_name
,c.last_name
,c.email
from customer c
left outer join rental r
on c.customer_id = r.customer_id
where r.rental_id is null;
"
)
head(rs)
## first_name last_name email
## 1 Sophie Yang<EMAIL_ADDRESS>## how many films and languages exist in the DVD rental application
rs <- dbGetQuery(con,
" select 'film' table_name,count(*) count from film
union select 'language' table_name,count(*) count from language
;
"
)
head(rs)
## table_name count
## 1 film 1000
## 2 language 6
## what is the film distribution based on language
rs <- dbGetQuery(con,
"select l.language_id id
,l.name
,sum(case when f.language_id is not null then 1 else 0 end) total
from language l
full outer join film f
on l.language_id = f.language_id
group by l.language_id,l.name
order by l.name;
;
"
)
head(rs)
## id name total
## 1 1 English 1000
## 2 5 French 0
## 3 6 German 0
## 4 2 Italian 0
## 5 3 Japanese 0
## 6 4 Mandarin 0
## Store analysis
### which store has had more rentals and income
rs <- dbGetQuery(con,
"select *
from ( select 'actor' tbl_name,count(*) from actor
union select 'category' tbl_name,count(*) from category
union select 'film' tbl_name,count(*) from film
union select 'film_actor' tbl_name,count(*) from film_actor
union select 'film_category' tbl_name,count(*) from film_category
union select 'language' tbl_name,count(*) from language
union select 'inventory' tbl_name,count(*) from inventory
union select 'rental' tbl_name,count(*) from rental
union select 'payment' tbl_name,count(*) from payment
union select 'staff' tbl_name,count(*) from staff
union select 'customer' tbl_name,count(*) from customer
union select 'address' tbl_name,count(*) from address
union select 'city' tbl_name,count(*) from city
union select 'country' tbl_name,count(*) from country
union select 'store' tbl_name,count(*) from store
) counts
order by tbl_name
;
"
)
head(rs)
## tbl_name count
## 1 actor 200
## 2 address 603
## 3 category 16
## 4 city 600
## 5 country 109
## 6 customer 600
## Store analysis
### which store has the largest income stream
rs <- dbGetQuery(con,
"select store_id,sum(amount) amt,count(*) cnt
from payment p
join staff s
on p.staff_id = s.staff_id
group by store_id order by 2 desc
;
"
)
head(rs)
## store_id amt cnt
## 1 2 31059.92 7304
## 2 1 30252.12 7292
## Store analysis
### How many rentals have not been paid
### How many rentals have been paid
### How much has been paid
### What is the average price/movie
### Estimate the outstanding balance
rs <- dbGetQuery(con,
"select sum(case when payment_id is null then 1 else 0 end) missing
,sum(case when payment_id is not null then 1 else 0 end) found
,sum(p.amount) amt
,count(*) cnt
,round(sum(p.amount)/sum(case when payment_id is not null then 1 else 0 end),2) avg_price
,round(round(sum(p.amount)/sum(case when payment_id is not null then 1 else 0 end),2)
* sum(case when payment_id is null then 1 else 0 end),2) est_balance
from rental r
left outer join payment p
on r.rental_id = p.rental_id
;
"
)
head(rs)
## missing found amt cnt avg_price est_balance
## 1 1452 14596 61312.04 16048 4.2 6098.4
### what is the actual outstanding balance
rs <- dbGetQuery(con,
"select sum(f.rental_rate) open_amt,count(*) count
from rental r
left outer join payment p
on r.rental_id = p.rental_id
join inventory i
on r.inventory_id = i.inventory_id
join film f
on i.film_id = f.film_id
where p.rental_id is null
;"
)
head(rs)
## open_amt count
## 1 4297.48 1452
### Rank customers with highest open amounts
rs <- dbGetQuery(con,
"select c.customer_id,c.first_name,c.last_name,sum(f.rental_rate) open_amt,count(*) count
from rental r
left outer join payment p
on r.rental_id = p.rental_id
join inventory i
on r.inventory_id = i.inventory_id
join film f
on i.film_id = f.film_id
join customer c
on r.customer_id = c.customer_id
where p.rental_id is null
group by c.customer_id,c.first_name,c.last_name
order by open_amt desc
limit 25
;"
)
head(rs)
## customer_id first_name last_name open_amt count
## 1 293 Mae Fletcher 35.90 10
## 2 307 Joseph Joy 31.90 10
## 3 316 Steven Curley 31.90 10
## 4 299 James Gannon 30.91 9
## 5 274 Naomi Jennings 29.92 8
## 6 326 Jose Andrew 28.93 7
### what film has been rented the most
rs <- dbGetQuery(con,
"select i.film_id,f.title,rental_rate,sum(rental_rate) revenue,count(*) count --16044
from rental r
join inventory i
on r.inventory_id = i.inventory_id
join film f
on i.film_id = f.film_id
group by i.film_id,f.title,rental_rate
order by count desc
;"
)
head(rs)
## film_id title rental_rate revenue count
## 1 103 Bucket Brotherhood 4.99 169.66 34
## 2 738 Rocketeer Mother 0.99 32.67 33
## 3 382 Grit Clockwork 0.99 31.68 32
## 4 767 Scalawag Duck 4.99 159.68 32
## 5 489 Juggler Hardly 0.99 31.68 32
## 6 730 Ridgemont Submarine 0.99 31.68 32
### what film has been generated the most revenue assuming all amounts are collected
rs <- dbGetQuery(con,
"select i.film_id,f.title,rental_rate
,sum(rental_rate) revenue,count(*) count --16044
from rental r
join inventory i
on r.inventory_id = i.inventory_id
join film f
on i.film_id = f.film_id
group by i.film_id,f.title,rental_rate
order by revenue desc
;"
)
head(rs)
## film_id title rental_rate revenue count
## 1 103 Bucket Brotherhood 4.99 169.66 34
## 2 767 Scalawag Duck 4.99 159.68 32
## 3 973 Wife Turn 4.99 154.69 31
## 4 31 Apache Divine 4.99 154.69 31
## 5 369 Goodfellas Salute 4.99 154.69 31
## 6 1000 Zorro Ark 4.99 154.69 31
### which films are in one store but not the other.
rs <- dbGetQuery(con,
"select coalesce(i1.film_id,i2.film_id) film_id
,f.title,f.rental_rate,i1.store_id,i1.count,i2.store_id,i2.count
from (select film_id,store_id,count(*) count
from inventory where store_id = 1
group by film_id,store_id) as i1
full outer join
(select film_id,store_id,count(*) count
from inventory where store_id = 2
group by film_id,store_id
) as i2
on i1.film_id = i2.film_id
join film f
on coalesce(i1.film_id,i2.film_id) = f.film_id
where i1.film_id is null or i2.film_id is null
order by f.title ;
"
)
head(rs)
## film_id title rental_rate store_id count store_id..6
## 1 2 Ace Goldfinger 4.99 NA <NA> 2
## 2 3 Adaptation Holes 2.99 NA <NA> 2
## 3 5 African Egg 2.99 NA <NA> 2
## 4 8 Airport Pollock 4.99 NA <NA> 2
## 5 13 Ali Forever 4.99 NA <NA> 2
## 6 20 Amelie Hellfighters 4.99 1 3 NA
## count..7
## 1 3
## 2 4
## 3 3
## 4 4
## 5 4
## 6 <NA>
# Compute the outstanding balance.
rs <- dbGetQuery(con,
"select sum(f.rental_rate) open_amt,count(*) count
from rental r
left outer join payment p
on r.rental_id = p.rental_id
join inventory i
on r.inventory_id = i.inventory_id
join film f
on i.film_id = f.film_id
where p.rental_id is null
;"
)
head(rs)
## open_amt count
## 1 4297.48 1452
list what’s there
## [1] "actor_info" "customer_list"
## [3] "film_list" "nicer_but_slower_film_list"
## [5] "sales_by_film_category" "staff"
## [7] "sales_by_store" "staff_list"
## [9] "category" "film_category"
## [11] "country" "actor"
## [13] "language" "inventory"
## [15] "payment" "rental"
## [17] "city" "store"
## [19] "film" "address"
## [21] "film_actor" "customer"
Clean up
# dbRemoveTable(con, "cars")
# dbRemoveTable(con, "mtcars")
# dbRemoveTable(con, "cust_movies")
# diconnect from the db
dbDisconnect(con)
result <- system2("docker", "stop sql-pet", stdout = TRUE, stderr = TRUE)
result
## [1] "sql-pet"


Master StudentSJTU
Home
Research
Code
Personal
Social Email
Contact:ParisTech InstituteShanghai Jiao Tong University
I am currently a Master Student majors in Computer Science in SJTU.
My research interests include Natural Language Processing and Machine Learning.


Mail
Logout
Compose
Inbox
1
Sent
Draft
3
Contacts
Groups
profile
Send
New Message
X
Send
New Message
X
Send
Gredenco Sebratov
Dear Barney, It is true that you are from canada...
11/03/2019
Gredenco Seb
Dear Barney, It is going to be legndary tonight...
10/03/2019
Gredenco Sebratov
Dear Barney, What's your job description in...
09/03/2019
Lily Aldrin
Marshall Erickson
Ted Mosby
Barney Stinson
Robin Scherbatsky
create group
Onwuchekwa Chisom
<EMAIL_ADDRESS>0123456789
Add by email
X
Add
Cancel
member
admin
Add
Cancel
Add
Cancel


Neuroplasticity talks about that the brain is malleable and it can grow your minds and ability to achieve things in life which the people thought wasn’t possible before. Below are the few points to take advantage of Neuroplasticity to benefit in your life.
- Having a positive mental attitude and imagination helps to grow your mind tremendously. The power of positive thoughts and imagination plays an important part in Neuroplasticity.
- Challenging self with a difficult task and having a positive affirmation of ‘I can do it’ will go a long way than thinking about its too difficult and ‘I can’t do it’
- Practice on a regular basis, working really hard and keeping the above two points in mind can build thicker, stronger, more hard-wired connection in the brain.
- Linking to what you have studied with your day to day lives will help you to remember things and concepts.
The first and foremost thing that I will be focusing on is keeping a positive thoughts and imagination. Reminding myself with positive affirmation whenever I feel it’s too difficult or I can’t do it. Enjoying the current process of studying and learning rather than thinking it’s too much to study and I am not sure whether I will be able to finish it before the end of this sprint. Practice, practice and practice and enjoying this process.
- By challenging your mind with a difficult task and being persistent and positive about it.
- This is the most important one, Practice regularly and focusing on small achievement.
- Changing your bad habits or acquiring a new habit that you want can increase neuroplasticity
- https://www.youtube.com/watch?v=ELpfYCZa87g
- https://www.youtube.com/watch?v=bbLP-as1ABk
Growth mindset is the ability to grow your mind by efforts and hard work. Carol Dweck talks about Growth and Fixed mindset people and the main distinguish between them is growth mindset people focus on process whereas fixed mindset people think they can’t change their life and believe if they work hard or put more effort they will come across stupid and dumb. Growth mindset people engage deeply in their work and if they come across any hurdle they won’t put themselves down instead will work harder to solve it.
The relevance of growth mindset is its helps people to have a positive perspective of life in general. Thinking in terms of growth mindset will help to achieve more in life and more importantly be happy and can become successful whatever they desire.
Yes, one of the aspect that surprise me was about the ‘Yet’ and ‘Not Yet’. Doing any work or task and focusing more on the process and thinking in terms of Yet and Not Yet will help to grow your mind and finish any challenging task with ease.
I will try to be consciously aware and will focus more on the process of Yet and Not Yet. Having positive mental thoughts, working hard, practicing regularly and focusing more on a journey of continual improvement.
https://www.youtube.com/watch?v=M1CHPnZfFmU
I have really enjoyed this session and have understood the importance of how to grow your mind by having positive imagination and affirmation of I can do it and simultaneously putting more efforts on my work. Understanding about Neuroplasticity and Growth mindset will help me a lot in my learning plan. Focusing more on the process and thinking in terms of Yet and Not yet will help me to clear hurdles that I will come across in future.


@* * Copyright 2010-2013 Artima, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @(selectedStyle: examples.StyleTraitExamples) @import controllers.Application.milestoneVersion @import controllers.Application.milestoneScaladoc @fullPage("At A Glance") {
For Matchers
syntax, please see Matchers Quick Reference instead.
Show examples in:
@styleTraitOpts(selectedStyle.name)| Style | |||
|---|---|---|---|
@Html(selectedStyle.exampleUsage) |
|||
| Build Integration | |||
| "org.scalatest" % "scalatest_2.10" % "@milestoneVersion" % "test" | SBT/Play2 | build.sbt/Build.scala | |
@Html(selectedStyle.play2Example) |
Play2 Example | ||
| Do Not Discover | |||
@Html(selectedStyle.doNotDiscover) |
Instruct ScalaTest Runner or SBT to not discover this suite | ||
| Test | |||
@Html(selectedStyle.ignoreTest) |
Ignore A Test | ||
@Html(selectedStyle.pendingTest) |
A Pending Test | ||
@Html(selectedStyle.taggingTest) |
Tag a Test | ||
@Html(selectedStyle.infoTest) |
Provide information. | ||
| Fixture | |||
@Html(selectedStyle.fixtureNoArgTest) |
withFixture using NoArgTest for style traits in org.scalatest package |
||
@Html(selectedStyle.fixtureOneArgTest) |
withFixture using OneArgTest for style traits in org.scalatest.fixture package |
||
| Matchers - Equality and identity | |||
import org.scalatest.Matchers._ val result = 5 - 2 result should equal (3) |
Calls left == right, except for arrays |
||
import org.scalatest.Matchers._ Array(1, 2) should equal (Array(1, 2)) |
Arrays are compared structurally, by calling left.deep == right.deep | ||
import org.scalatest.Matchers._ val result = "thick".substring(1, 3) result should be ("hi") |
Calls left == right, except for arrays |
||
import org.scalatest.Matchers._ Array(1, 2) should be (Array(1, 2)) |
Arrays are compared structurally, by calling left.deep == right.deep | ||
import org.scalatest.Matchers._ val result = 21 / 3 result should be === 7 |
Calls left == right, except for arrays |
||
import org.scalatest.Matchers._ Array(1, 2) should be === (Array(1, 2)) |
Arrays are compared structurally, by calling left.deep == right.deep | ||
import org.scalatest.Matchers._ val list = List(1, 2, 3) val ref1 = list val ref2 = list ref1 should be theSameInstanceAs ref2 |
Calls left eq right |
||
| Matchers - Expected exceptions | |||
import org.scalatest.Matchers._ val s = "hai" evaluating { s.charAt(-1) } should produce [IndexOutOfBoundsException] |
Checks that a particular exception type is thrown by a bit of code | ||
import org.scalatest.Matchers._ val s = "hai" val caught = evaluating { s.charAt(-1) } should produce [IndexOutOfBoundsException] caught.getMessage should be ("String index out of range: -1") |
Inspects the caught exception | ||
| Matchers - Size and length | |||
import org.scalatest.Matchers._ val result = "hai" result should have length 3 |
Works for any object with length field or method or getLength method; length can be Int or Long |
||
import org.scalatest.Matchers._ val result = "hai" result should have size 3 |
Works for any object with size field or method or getSize method; size can be Int or Long |
||
| Matchers - Strings and regular expressions | |||
import org.scalatest.Matchers._ val string = "Hello World" string should startWith ("Hello") |
Starts with substring | ||
import org.scalatest.Matchers._ val string = "hello world" string should endWith ("world") |
Ends with substring | ||
import org.scalatest.Matchers._ val string = "six seven eight" string should include ("seven") |
Includes substring | ||
import org.scalatest.Matchers._ val string = "Hello" string should startWith regex "Hel*o" |
Starts with substring matching regular expression string | ||
import org.scalatest.Matchers._ val string = "Hello World" string should startWith regex "Hel*o".r |
Starts with substring matching regular expression Regex |
||
import org.scalatest.Matchers._ val string = "hello world" string should endWith regex "wo.ld" |
Ends with substring matching regular expression string | ||
import org.scalatest.Matchers._ val string = "hello world" string should endWith regex "wo.ld".r |
Ends with substring matching regular expression Regex |
||
import org.scalatest.Matchers._ val string = "hello world" string should include regex "wo.ld" |
Includes substring matching regular expression string | ||
import org.scalatest.Matchers._ val string = "hello world" string should include regex "wo.ld".r |
Includes substring matching regular expression Regex |
||
import org.scalatest.Matchers._ val string = "3.142" string should fullyMatch regex """(-)?(\d+)(\.\d*)?""" |
Fully matches regular expression string | ||
import org.scalatest.Matchers._ val string = "3.142" string should fullyMatch regex """(-)?(\d+)(\.\d*)?""".r |
Fully matches regular expression Regex |
||
| Matchers - Order and ranges | |||
import org.scalatest.Matchers._ val one = 1 one should be < 7 |
Works for any type implicitly convertible to Ordered[T] |
||
import org.scalatest.Matchers._ val one = 1 one should be > 0 |
Works for any type implicitly convertible to Ordered[T] |
||
import org.scalatest.Matchers._ val one = 1 one should be <= 7 |
Works for any type implicitly convertible to Ordered[T] |
||
import org.scalatest.Matchers._ val one = 1 one should be >= 0 |
Works for any type implicitly convertible to Ordered[T] |
||
import org.scalatest.Matchers._ val num = 8 num should (be >= 1 and be <= 10) |
One way to ensure within a range or tolerance | ||
import org.scalatest.Matchers._ val seven = 7 seven should be (6 plusOrMinus 2) |
Another way to ensure within a range or tolerance | ||
import org.scalatest.Matchers._ 7.0 should be (6.9 plusOrMinus 0.2) |
plusOrMinus works for both integral and floating point types |
||
Matchers - Checking boolean properties with be |
|||
import org.scalatest.Matchers._ Set.empty[String] should be ('empty) |
Accesses empty or isEmpty dynamically (For the details on how a field or method is dynamically selected, see the documentation for BeWord .) |
||
import org.scalatest.Matchers._ import java.io.File val temp = new File("aFile.txt") temp should be a ('file) |
Can insert an 'a' | ||
import org.scalatest.Matchers._ import java.awt._ import event.KeyEvent val canvas = new Canvas val keyEvent = new KeyEvent(canvas, 0, 0, 0, 0, '0') keyEvent should be an ('actionKey) |
Can insert an 'an' | ||
import org.scalatest._ import Matchers._ import matchers._ import java.io.File class FileBePropertyMatcher extends BePropertyMatcher[java.io.File] { def apply(left: File) = BePropertyMatchResult(left.isFile, "file") } val file = new FileBePropertyMatcher val temp = new File("aFile.txt") temp should be a file |
For static checking (and to get rid of the unslightly tick mark), use a BePropertyMatcher |
||
Matchers - Using arbitrary be matchers |
|||
import org.scalatest._ import Matchers._ import matchers._ class OddMatcher extends BeMatcher[Int] { def apply(left: Int) = MatchResult( left % 2 == 1, left.toString + " was even", left.toString + " was odd" ) } val odd = new OddMatcher 7 should be (odd) |
To place an arbitrary token after be , use a BeMatcher .
| ||
Checking arbitrary properties with have |
|||
import org.scalatest.Matchers._ case class Book(title: String, author: String, pubYear: Int) val book = Book("A Book", "Sally", 2008) book should have ( 'title ("A Book"), 'author ("Sally"), 'pubYear (2008) ) |
Check arbitrary properties dynamically with Symbols (For the details on how a field or method is selected during this
process, see HavePropertyMatcherGenerator .) |
||
import org.scalatest._ import Matchers._ import matchers._ case class Book(title: String, author: String) def title(expectedValue: String) = new HavePropertyMatcher[Book, String] { def apply(book: Book) = HavePropertyMatchResult( book.title == expectedValue, "title", expectedValue, book.title ) } def author(expectedValue: String) = new HavePropertyMatcher[Book, String] { def apply(book: Book) = HavePropertyMatchResult( book.author == expectedValue, "author", expectedValue, book.author ) } val book = Book("A Book", "Sally") book should have ( title ("A Book"), author ("Sally") ) |
Check arbitrary properties statically with HavePropertyMatchers |
||
| Working with Scala and Java collections | |||
import org.scalatest.Matchers._ List.empty[Int] should be ('empty) |
Check whether a collection is empty | ||
import org.scalatest.Matchers._ List.empty[Int] should be (Nil) |
Another way to check whether a list is empty | ||
import org.scalatest.Matchers._ Map.empty[Int, String] should be (Map()) |
Another way to check whether a map (or other collection type) is empty | ||
import org.scalatest.Matchers._ Set.empty[Int] should be (Set.empty) |
Another way to check whether a set (or other collection type) is empty | ||
import org.scalatest.Matchers._ Set(1, 2, 3) should have size (3) |
Check the size of a collection | ||
import org.scalatest.Matchers._ List(1, 2, 3) should have length (3) |
Check the length of a Seq |
||
import org.scalatest.Matchers._ Set("three", "five", "seven") should contain ("five") |
Check whether a traversable contains an element | ||
import org.scalatest.Matchers._ Map(1 -> "one", 2 -> "two", 3 -> "three") should contain key (1) |
Check whether a map contains a particular key | ||
import org.scalatest.Matchers._ Map(1 -> "Hi", 2 -> "Howdy", 3 -> "Hei") should contain value ("Howdy") |
Check whether a map contains a particular value | ||
import org.scalatest._ import Matchers._ import PartialFunctionValues._ Map("I" -> 1, "II" -> 2, "III" -> 3).valueAt("II") should equal (2) |
State both that a map is defined at a key as well as something about its value | ||
import org.scalatest.Matchers._ import java.util._ val javaCol = new ArrayList[Int] javaCol should be ('empty) |
Check the size of a java.util.Collection |
||
import org.scalatest.Matchers._ import java.util._ val javaMap = new java.util.HashMap[Int, String] javaMap.put(1, "one") javaMap.put(2, "two") javaMap.put(3, "three") javaMap should have size (3) |
Check the size of a java.util.Map |
||
import org.scalatest.Matchers._ import java.util._ val javaList = new ArrayList[Int] javaList.add(1) javaList.add(2) javaList.add(3) javaList should have length (3) |
Check the length of a java.util.List |
||
import org.scalatest.Matchers._ import java.util._ val javaCol = new HashSet[String] javaCol.add("three") javaCol.add("five") javaCol.add("seven") javaCol should contain ("five") |
Check whether a java.util.Collection contains a particular element |
||
import org.scalatest.Matchers._ import java.util._ val javaMap = new HashMap[Int, String] javaMap.put(1, "one") javaMap.put(2, "two") javaMap.put(3, "three") javaMap should contain key (1) |
Check whether a java.util.Map contains a particular key |
||
import org.scalatest.Matchers._ import java.util._ val javaMap = new HashMap[Int, String] javaMap.put(1, "Hi") javaMap.put(2, "Howdy") javaMap.put(3, "Hai") javaMap should contain value ("Howdy") |
Check whether a java.util.Map contains a particular value |
||
Working with Option and Either |
|||
import org.scalatest.Matchers._ val option = Some(1) option should be (Some(1)) |
Check whether an option contains a certain value | ||
import org.scalatest.Matchers._ val option = Some(1) option should be ('defined) |
Check whether an option is defined | ||
import org.scalatest.Matchers._ val option = None option should be ('empty) |
Check whether an option is empty | ||
import org.scalatest.Matchers._ val option = None option should be (None) |
Another way to check whether an option is empty | ||
import org.scalatest.Matchers._ import org.scalatest.OptionValues._ val option = Some(3) option.value should be < 7 |
State both that an option is defined as well as something about its value | ||
import org.scalatest.Matchers._ val either = Left(1) either should be (Left(1)) |
Check whether an either is Left with a certain value |
||
import org.scalatest.Matchers._ val either = Left(1) either should be ('left) |
Check whether an either is left | ||
import org.scalatest.Matchers._ val either = Right(1) either should be (Right(1)) |
Check whether an either is Right with a certain value |
||
import org.scalatest.Matchers._ val either = Right(1) either should be ('right) |
Check whether an either is right | ||
import org.scalatest.Matchers._ import org.scalatest.EitherValues._ val either = Right(3) either.right.value should be < 7 |
State both how an either is defined as well as something about its value | ||
Matchers - Logical expressions with and , or , and not |
|||
import org.scalatest.Matchers._ val result = 8 result should (be > 0 and be < 10) |
You can and matcher expressions together with and |
||
import org.scalatest.Matchers._ Map("hi" -> "HI", "hei" -> "HEI", "he" -> "HE") should (contain key ("hi") or contain key ("ho")) |
You can or matcher expressions together with or |
||
import org.scalatest.Matchers._ val result = "Hello Word" result should not be (null) |
You can negate the meaning of a matcher expression with not |
||
import org.scalatest.Matchers._ Map("one" -> 1, "two" -> 2, "three" -> 3) should (contain key ("two") and not contain value (7)) |
Another example of negation with not |
||
| Matchers - When you need a different matcher | |||
import org.scalatest.Matchers._ import java.awt._ import event.KeyEvent val canvas = new Canvas val keyEvent = new KeyEvent(canvas, 0, 0, 0, 0, '0') keyEvent should be an ('actionKey) |
You can check boolean properties dynamically with be and a Symbol (the tick mark syntax); For statically typed approach,
use a BePropertyMatcher or
BeMatcher . |
||
import org.scalatest.Matchers._ case class Book(title: String, author: String) val book = Book("A Tale of Two Cities", "Sally") book should have ('title("A Tale of Two Cities")) |
You can check arbitrary properties dynamically with have and a Symbol (the tick mark syntax); For a statically type approach,
use a HavePropertyMatchers |
||
import org.scalatest.Matchers._ val defined = 'defined Some("hi") should be (defined) |
One way to get rid of the tick mark for a dynamic property check | ||
import org.scalatest.Matchers._ val beDefined = be ('defined) Some("hi") should beDefined |
One way to get rid of the tick mark and a pair of parentheses | ||
import org.scalatest.Matchers._ val beWithinTolerance = be >= 0 and be <= 10 8 should beWithinTolerance |
You can create new matchers by combining existing matchers with and , or , and not |
||
import org.scalatest._ import Matchers._ import matchers._ val beOdd = Matcher((i: Int) => MatchResult(i % 2 != 0, i + " is not odd", i + " is odd")) val beOddAsInt = beOdd compose { (s: String) => s.toInt } "3" should beOddAsInt |
You can compose a matcher with a function that transforms the input type | ||
import org.scalatest.Matchers._ import java.io.File def endWithExtension(ext: String) = endWith(ext) compose { (f: File) => f.getPath } new File("output.txt") should endWithExtension("txt") |
You can also use matcher composition to create a new matcher given a parameter | ||
import org.scalatest._ import Matchers._ import matchers._ val beOdd = Matcher { (left: Int) => MatchResult( left % 2 == 1, left + " was not odd", left + " was odd" ) } 3 should beOdd |
You can use a factory method to define a custom matcher (such factory methods
also exist for BeMatcher , BePropertyMatcher , and HavePropertyMatcher ). |
||
import org.scalatest._ import Matchers._ import matchers._ val beOdd = new Matcher[Int] { def apply(left: Int) = MatchResult( left % 2 == 1, left + " was not odd", left + " was odd" ) } 3 should beOdd |
Or you can write a full-blown matcher. | ||
| Selenium DSL | |||
@Html(selectedStyle.seleniumExample) |
Example of using Note: You'll need to setup your project to use Selenium and HtmlUnit driver for the example to work correctly. |
||
go to "http://www.scalatest.org" |
Go to ScalaTest website | ||
pageTitle should be ("ScalaTest") |
Check page title | ||
click on "q" |
Click on element which has attribute id or name = "q" | ||
click on id("q") |
Click on element which has attribute id = "q" | ||
click on name("name") |
Click on element which has attribute name = "q" | ||
click on tagName("input") |
Click on element which is a input tag |
||
click on className("quickref") |
Click on element which has CSS class quickref tag |
||
cssSelector("a[id='aLink']").element.tagName should be ("a") |
Check a element's tag name, selected by using CSS selector | ||
linkText("Click Me!").element.tagName should be ("a") |
Check a element's tag name, selected by using the link text | ||
partialLinkText("Click").element.tagName should be ("a") |
Check a element's tag name, selected by using the partial link text | ||
enter("Cheese!") |
Enter "Cheese!" into currently selected text element | ||
submit() |
Submit form | ||
textField("q").value = "Cheese!" |
Set text field (which has attribute id or name = "q") to "Cheese!" | ||
textField("q").value should be ("Cheese!") |
Read and check a text field (which has attribute id or name = "q") value | ||
radioButtonGroup("group1").value = "Option 2" // or radioButtonGroup("group1").selection = Some("Option 2") |
Set radio button group (which has group name = "group1") to choose "Option 2" | ||
radioButtonGroup("group1").value should be ("Option 2") // or radioButtonGroup("group1").selection should be (Some("Option 2")) |
Read and check radio button group (which has group name = "group1") chosen value | ||
click on radioButton("opt1") |
Click on a radio button (which has attribute id or name = "opt1") | ||
radioButton("opt1").isSelected should be (true) |
Check if a radio button (which has attribute id or name = "opt1") is selected | ||
checkbox("cbx1").select() |
Select a check box (which has attribute id or name = "cbx1") | ||
checkbox("cbx1").clear() |
Clear a check box (which has attribute id or name = "cbx1") | ||
checkbox("cbx1").isSelected should be (true) |
Check if a check box (which has attribute id or name = "cbx1") is selected | ||
singleSel("select1").value = "option2" // or singleSel("select1").selection = Some("option2") |
Set a single-selection dropdown list (which has attribute id or name = "select1") to choose "option2" | ||
singleSel("select1").clear() // or singleSel("select1").selection = None |
Clear the selection of a single-selection dropdown list (which has attribute id or name = "select1") | ||
singleSel("select1").value should be ("option2") // or singleSel("select1").selection should be (Some("option2")) |
Read and check currently selected value of a single-selection dropdown list (which has attribute id or name = "select1") | ||
multiSel("select2").values = Seq("option5", "option6") |
Set the selection of a multi-selection list (which has attribute id or name = "select2") | ||
multiSel("select2").values += "option3" |
Select "option3" in addition to current selection of a multi-selection list (which has attribute id or name = "select2") | ||
multiSel("select2").clear("option5") |
Clear "option5" from current selection of a multi-selection list (which has attribute id or name = "select2") | ||
multiSel("select2").clearAll() |
Clear all selection of a multi-selection list (which has attribute id or name = "select2") | ||
multiSel("select2").values should have size 2 multiSel("select2").values(0) should be ("option5") multiSel("select2").values(1) should be ("option6") | Read and check currently selected values of a multi-selection list (which has attribute id or name = "select2") | ||
goBack() |
Go back to previous page in history | ||
goForward() |
Go forward to next page in history | ||
reloadPage() |
Reload the current page | ||
add cookie ("name1", "value1") |
Add new cookie with name = "name1" and value = "value1" | ||
cookie("name1").value should be ("value1") |
Read and check a cookie's value | ||
delete cookie "name1" |
Delete cookie "name1" | ||
delete all cookies |
Delete all cookies under the same domain. | ||
capture to "MyScreenShot" |
Capture the screen and save as "MyScreenShot.png" | ||
setCaptureDir("/home/your_name/screenshots") |
Set the directory to save captured pictures. | ||
withScreenshot { assert("Gold" == "Silver", "Expected gold, but got silver") } |
Auto capture screen when something goes wrong (e.g. test failed) | ||
close() |
Close current browser window | ||
quit() |
Close all windows and exit the driver | ||
| Concurrent Support | |||
import org.scalatest._ import concurrent.Eventually._ import Matchers._ val it = Vector("sad", "happy").iterator eventually { it.next shouldBe "happy" } |
eventually retries the past block until it no longer throws an exception, using
a timeout and interval taken from an implicit PatienceConfig .
The default PatienceConfig is 150 milliseconds timeout and 15 milliseconds interval. If you import IntegrationPatience, you'll get 15 seconds timeout and 150 milliseconds interval. If you want something else, you can define your own implicit PatienceConfig like the next example.
|
||
import concurrent.Eventually._ import org.scalatest.time.SpanSugar._ implicit val patienceConfig = PatienceConfig(timeout = scaled(2 seconds), interval = scaled(5 millis)) |
Define custom implicit PatienceConfig |
||
import org.scalatest.concurrent.Eventually._ import org.scalatest.time._ eventually (timeout(Span(5, Seconds))) { /*code omitted*/ } |
Use eventually with explicit timeout |
||
import org.scalatest.concurrent.Eventually._ import org.scalatest.time.SpanSugar._ eventually (timeout(5 seconds), interval(5 millis)) { /*code omitted*/ } |
Use eventually with explicit timeout and interval |
||
| Inspectors | |||
import org.scalatest._ import Matchers._ import Inspectors._ forAll(List(1, 2, 3)) { _ should be > 0 } |
Use forAll to check that every element passes the assertion block |
||
import org.scalatest._ import Matchers._ import Inspectors._ forAtLeast(1, List(1, 2, 3)) { _ should be > 2 } |
Use forAtLeast to check that at least the specified number of elements pass the assertion block |
||
import org.scalatest._ import Matchers._ import Inspectors._ forAtMost(2, List(1, 2, 3)) { _ should be > 1 } |
Use forAtMost to check that at most the specified number of elements pass the assertion block |
||
import org.scalatest._ import Matchers._ import Inspectors._ forBetween(2, 4, List(1, 2, 3, 4, 5)) { _ should be > 2 } |
Use forBetween to check that the specified minimum and maximum number of elements (inclusive) pass the assertion block |
||
import org.scalatest._ import Matchers._ import Inspectors._ forEvery(List(1, 2, 3)) { _ should be > 0 } |
Use forEvery to check that every element passes the assertion block, it'll list all failing elements if it fails (whereas forAll just reports the first failing element) |
||
import org.scalatest._ import Matchers._ import Inspectors._ forExactly(2, List(1, 2, 3)) { _ should be > 1 } |
Use forExactly to check that the exact specified number of elements pass the assertion block |
||
| Other Goodies | |||
import org.scalatest._ import Matchers._ import Inside._ case class Name(first: String, middle: String, last: String) case class Record(name: Name, age: Int) val rec = Record( Name("Sally", "Anna", "Jones"), 38 ) inside (rec) { case Record(name, age) => inside (name) { case Name(first, middle, last) => first should be ("Sally") } } |
Inside |
||
import org.scalatest._ import Matchers._ import OptionValues._ val anOption = Some(18) anOption.value should be > 9 |
OptionValues |
||
import org.scalatest._ import Matchers._ import EitherValues._ val either1: Either[String, Int] = Right(16) either1.right.value should be > 9 val either2: Either[String, Int] = Left("Muchas problemas") either2.left.value should be ("Muchas problemas") |
EitherValues |
||
import org.scalatest._ import Matchers._ import PartialFunctionValues._ val map = Map("one" -> 1, "two" -> 2, "three" -> 3) map.valueAt("two") should equal (2) |
PartialFunctionValues |
||
import org.scalatest.PrivateMethodTester._ class TaxCalculator { private def calc(amount: Double, percentage: Double): Double = amount * percentage / 100.00 def calculateTax(amount: Double): Double = calc(amount, 5.00) } val calculator = new TaxCalculator val calcMethod = PrivateMethod[Double]('calc) calculator invokePrivate calcMethod(1000.00, 8.88) |
PrivateMethodTester |


1,000 oranges, at 50% off, is $500.
Note: Without JavaScript, the above animation might not play. In that case, the animation can be directly accessed here.