What's the most difficult part of the APA style for students? Continuing the practice from 2010, I’ll demonstrate the typical mistakes found in the manuscripts submitted for the 4th issue of the Journal of European Psychology Students (JEPS). Given that JEPS requires submitted manuscripts to follow APA style, this post may be useful for anyone writing papers according to these regulations.
This post will also refer to any material that would provide more information on how to avoid the incompatibility with the APA style.
The Method
Manuscripts submitted to JEPS go through what we call a technical review, which means we’ll check if they agree with our submission guidelines and APA Style. We give authors feedback on changes to be made, and the data presented here is based on this feedback. As it can be assumed the students submitting to JEPS tend to be more knowledgeable about the APA formatting rules than an average student, I'd therefore urge readers not to apply this data on all psychology students. This merely shows what should students pay most attention to when formatting their work according to the guidelines provided by the American Psychological Association.
The Results
There are several ways to quantify the number of mistakes made. In the following analyses, the number of mistakes has not been taken into account, just the area of making them. Therefore, the data offers a proportional overview of mistakes made in the named categories across manuscripts. The data however does not reflect the number of mistakes made in total.
Compared to last year, two new categories are introduced as they gained a considerable proportion of mistakes compared to previous analysis. Figure 1 illustrates the most common mistakes in APA style in JEPS submissions. The results will be explained and dissected below with references given to avoid the errors.
Referencing
Thirty seven per cent of manuscripts submitted to JEPS this year had had some difficulty with referencing. In fact, when the two new categories are excluded, referencing errors would constitute again 51% of all mistakes made, like they did in the 2010 analysis. Referencing then clearly poses a major problem for students submitting to JEPS. At the same time, the referencing errors differ in their character (see Figure 2) which also illustrates the complexity of this category.
Suggestions
The devil is still in the details (as it was last year). The issue with referencing cannot be underestimated--a failure to appropriately indicate the sources used, could lead to allegations of plagiarism. Correct referencing requires vast amounts of time, patience, and attention to detail when doing it manually. However, using a reference management program would solve each of these problems within a few clicks (those needed to download the citation to the program and those needed to insert the citation to the proper place in the text). The JEPS Bulletin will soon publish a post on using such programs, so stay tuned!
Other formatting
Seventeen per cent of manuscripts contained errors made in the running head, pagination numbers, title page and font. JEPS submission guidelines do not specifically state how these should be formatted but lets APA manual guide the area. It could be assumed a number of students have either not consulted with the book or have not found the formatting of these not significant enough to follow.
Suggestions
Psychologists know that first impression does matter. Those formatting issues in question here constitute the first thing one notices in a paper. Better make the paper look good! Still, formatting the title page, running head etc. are often regulated differently in submission guidelines for journals or manuals for course papers and theses at universities. Students should then pay attention to how the institution for which they are writing their work, wants to see the piece formatted. Should it not be defined in specifics, however, you can’t go wrong following APA style as a psychology student.
Abstract and Keywords
Summarising their work in only a few words constitutes a difficulty authors of 14% of the manuscripts could not overcome. In some cases, the problem was wordiness—120 words is a strict limit, others had troubles finding keywords or formatting them accurately.
Suggestions
Use word count, choose shorter expressions, omit everything that is not relevant. Consider the role of every single word you are writing. The trouble with keywords on the other hand is just forgetting to add them. Make sure you have them underneath your abstract, centered – they make it easy for others to find your article once it gets published.
See more in JEPS Bulletin:
How to write a brilliant abstract?
Grammar and Style
The fact that only 10% of the manuscripts had difficulties with English is remarkable given that JEPS receives manuscripts from most corners of the continent. Correct use of English however cannot be underestimated—not only does good grammar improve the readability of the paper, proper style also assures the text doesn't offer any possibilities for ambiguity of the content.
Suggestions
The JEPS Bulletin hast tackled the issue on a number of occasions:
The core features of the scientific writing style
The core features of the scientific writing style II
How to make (scientific) texts sound professional?
Lost in translating?
...only caused problems in 9% of the manuscripts. Some of them can perhaps be explained by the change in the APA manual compared to its older (5th) version.
Suggestions
My suggestion remains the same from last year: read the latest APA manual (APA, 2009) and create a template or a style sheet for the text editing program you are using. This will ease your efforts considerably. You can then select the correct formatting of the heading according to its level from the menu. Compatibility with APA style will be guaranteed. The headings provide an overview of your paper, something a reader can skim through quickly to know what will be written. Go through your manuscript keeping that in mind – will the formatting (and wording) of your headings aid reader in gaining a quick understanding of what would await them should they decide to read your paper?
Tables and Figures
Only a small proportion of manuscripts (7%) did not agree with the APA manual in this regard. Of course, not all submitted manuscripts had tables or figures in them, so the proportion of the mistakes made could be higher. Most common mistakes emerge from the details—authors forget to omit vertical lines, introduce headings to all columns or forget to make sure the figures/tables are correctly labelled. In some cases, the numbering of tables or figures did not match with what was indicated in the text.
Suggestions
Again, creating a template to follow in your text editing program could facilitate formatting the tables and figures considerably. There are also tools and programs which offer automatic numbering and referencing (MS Word, for example, has this feature already in it).
For table formatting, you may find this JEPS Bulletin post useful: Table formatting according to APA.
Ensuring Blind Review
Six per cent of the manuscripts violated the rules for blind review. Although the requirement is not always there (i.e., professors usually do like to know the authors of the course papers they are going to assess). Still, JEPS insists on keeping it a secret.
Suggestions
When submitting to JEPS or any other journal that has the same policy, make sure you do not only omit your name from the title page: It is equally important that the properties of the document do not contain your details. JEPS Blind Review Guidelines will give more specific instructions.
Acknowledgements
Many thanks to the JEPS editorial board for providing the authors with the feedback on APA style and allowing me to use the data.
References
American Psychological Association. (2009). Publication Manual of the American Psychological Association (6th ed.). Washington, DC: American Psychological Association.


facts and statistics collected together for reference or analysis
Source: Google
Source: Fotolia
To help students make better decisions about their education
To understand the results of this election and its (un)predictibility
To figure out where to allocate public resources
To understand human health and disease prevention / treatment
Infectious Diseases in Context
To see what people are talking about in real-time
Watch the world light up on Twitter to celebrate @Simone_Biles winning #gold at #Rio2016 https://t.co/iVEAm59HHP pic.twitter.com/uNgH6yj4VL
— Twitter Data (@TwitterData) August 12, 2016
To do analyses for fun!
Hillary Mason, data scientist, founder of Fast Forward Labs, a machine intelligence research company


What is it?
Salaspils Laukskola is an archaeological complex that is made up of multiple archaeologicaly significat sites. It is located about 25 km away from Riga - the capital of Latvia, near a smaller town called Salaspils. Today almost all of the sites in the complex are underwater due to the construction of the "Riga HES" (Hydroelectric power plant) during the end of 60-ties and 70-ties. In fact, because of this construction and expected flooding of surrounding areas the former soviet government of LPSR (soviet republic of Latvia) allocated significant funds to archaeologists so that they could conduct protective excavations. As a result one of the largest excavations in 20th century Latvia were held in surrounding region that led to significant discoveries, including at this Salaspils Laukskolas complex.
Excavations
The site of Salaspils Laukskola was already known from older archaeological expedition, which was led by V. Ģinters in 1936. and 1937. During this expedition 24 burials were uncovered, most of them (16) buried in individual mounds, however the local topography indicated, that there could be many more. Based on excavated finds and artifacts they were able to determine that gravesite was used by ancient Livs, one of the tribes that populated lower Daugava during late iron age (10th - 13th century CE) meaning that these were the people who met the first german crusaders that arrived to this region at the end of 12th century. In 1967. When the Riga HES construction began, a new expedition to Laukskola gravesite was formed, led by archaeologist A. Zariņa. The excavations were held in 10 ha areal for the next 8 years (until 1975.), in the end an additional 586 burials were uncovered. There were several more important discoveries. First of all to the east and west of the extensive ancient burial site, the remnants of the old settlements were found, where these people lived their lives. However, there was one discovery that was even more fascinating, unexpected and groundbreaking.
The unexpected discovery
In 1973. during the excavations in the main burial ground a deeper archaeological layer was uncovered, in which appeared to be multiple areas (6 in total) that were intensely saturated with flint pieces. The excavation of these areas was taken over by stone age expert and archaeologist I. Zagorska, since the nature of flint finds indicated a presence of much older culture. During her excavations in these areas about 2000 pieces of flint were collected, more importantly, 550 of those were determined to be actual flint tools, like arrowheads, knives and drills. But the most stunning part was the actual age of these artifacts, based on analougue finds in Poland and Lithuania, and dating data, they were as old as 9000 years BCE, meaning they were from paleolithic age. What archaeologists, A. Zariņa and I. Zagorska had actually discovered in Salaspils Laukskola was oldest known settlement site in the teritory of Latvia. Below are possible reconstructions of the howels these hunters-gatherers lived in.
In conclusion
Salaspils Laukskolas complex consists of these sites:
- Salaspils Laukskolas 10th - 13th century garvesite
- Salaspils Laukskolas 10th - 13th century eastern settlement
- Salaspils Laukskolas 10th - 13th century western settlement
- Salaspils Laukskolas Paleolithic age (11000 years old) settlement
And the Archaeologists that discovered this complex are:
- V. Ģinters
- A. Zariņa
- I. Zagorska
For those who are interested in other archaeological sites in Latvian teritory I would recommend this book


You want to sell your Amazon FBA business? We have more than 25 years of experience in transacting and building companies, and we are focused on the Amazon ecosystem and similar e-commerce platforms
Lorem Ipsum Dolor Sit Amet, Consectetur Adipi


Brazil
Brazil is a movie starring Jonathan Pryce, Kim Greist, and Robert De Niro. A bureaucrat, in a retro-future world, tries to correct an administrative error and becomes an enemy of the state.


Back
Mixed Content
Features:
Any type of content (images, text, video)
Lightweight, 7Kb minified
One dependency (jQuery Easing)
Autoplay
Widget by
Marcos Iglesias
•
•
•


2 Kings 12:1
In the seventh year of Jehu Jehoash began to reign; and forty years reigned he in Jerusalem. And his mother's name was Zibiah of Beersheba.


--- layout: page title: "About" description: "What We Do" header-img: "img/boulder.jpg" ---
Activision Game Science is based in two awesome places: Santa Monica, CA (the Mothership) and Boulder, CO (God's Country). We develop statistical tools and services to integrate into our games and their operations. Examples include anomaly detection, recommendation systems, and computer vision. We work at the interface of design, big data engineering, and math to help deliver epic entertainment experiences.


Week 14 Study
Guide
Table of
Contents
Getting Started with
React - EOD Lecture Notes
Explain how React
uses a tree data structure called the "virtual DOM" to model the DOM
Use
React.createElement to create virtual DOM nodes
Use ReactDOM.render
to have React render your virtual DOM nodes into the actual Web page
Use JSX to create
virtual DOM nodes
Describe how JSX
transforms into React.createElement calls
Use Array#map to
create an array of virtual DOM nodes while specifying a unique key for each created virtual DOM node
React Class
Components Objectives
Create a simple React
application by removing items and content from a project generated by the Create React App default
template
Files you can
delete
Create a simple React
application using a custom Create React App template
Create a React
component using ES2015 class syntax
Describe when it's
appropriate to use a class component
Initialize and update
state within a class component
Provide default
values for a class component's props
Add event listeners
to elements
Prevent event default
behavior
Safely use the this
keyword within event handlers
Describe what the
React SyntheticEvent object is and the role it plays in handling events
Create a React class
component containing a simple form
Define a single event
handler method to handle onChange events for multiple "input" elements
Add a "textarea"
element to a form
Add a "select"
element to a form
Implement form
validations
Describe the
lifecycle of a React component
Recall that the
commonly used component lifecycle methods include componentDidMount, componentDidUpdate, and
componentWillUnmount
Use the
componentDidMount component lifecycle method to fetch data from an API
Utilize official
documentation to gain an understanding of how new technology works
React Router
Objectives
Use the
react-router-dom package to set up React Router in your applications
Create routes using
the `` component from the react-router-dom package
Generate navigation
links with the and components from the react-router-dom package
Create `` routes and
manage the order of rendered components
Use the React Router
match prop to access router parameters
Use the React Router
history prop to programmatically change the browser's URL
Redirect users by
using the component in a route
Describe what nested
routes are and how to create them
React Builds
Objectives
Describe what
frontend builds are and why they're needed
Describe at a high
level what happens in a Create React App when you run npm start
Prepare to deploy a
React application into a production environment
Set up Environment
variables
Set up the browser
list
Build the app
React Context
Objectives
Use Context to share
and manage global information within a React application
Creating the
context
Create a wrapper
component with Context.Provider to set a component's default context
Recommended example
(Using a 'Provider' component)
Create a wrapper
component with Context.Consumer to share the global context through render props
static contextType
and this.context
Wrapping a `` around
our component
Create and pass a
method through Context to update the global state from a nested component
Getting Started with
React - EOD Lecture Notes
Explain how React
uses a tree data structure called the "virtual DOM" to model the DOM
The Virtual DOM is an
in-memory tree representation of the browser's Document
Object Model. React's
philosophy is to interact with the Virtual DOM instead
of the regular DOM
for developer ease and performance.
By abstracting the
key concepts from the DOM, React is able to expose additional
tooling and
functionality increasing developer ease.
By trading off the
additional memory requirements of the Virtual DOM, React is
able to optimize for
efficient subtree comparisons, resulting in fewer, simpler
updates to the less
efficient DOM. The result of these tradeoffs is improved
performance.
Supporting
performant Virtual DOM comparisons informs a key aspect of the React
philosophy:
In our experience,
thinking about how the UI should look at any given moment,
rather than how to
change it over time, eliminates a whole class of bugs.
Use
React.createElement to create virtual DOM nodes
Every Virtual DOM
Node is eventually constructed using the React.createElement
function.
createElement
accepts three arguments, which represent the three key components of every Virtual
DOM Node, it's type , it's props , and it's children
(i.e. it's
contents).
React.createElement(
type, // Either an html element "h1", _or_ a React Component `Component`
props, // These are _static_ properties && any html attributes
children // An array of Virtual DOM Nodes, or a string of content
);
Use ReactDOM.render to
have React render your virtual DOM nodes into the actual Web page
ReactDOM.render
is a simple function which accepts 2 arguments: what to render and where to render
it:
ReactDOM.render(
component,
// The react component to render
target // the browser DOM node to render it to
);
Use JSX to create
virtual DOM nodes
Describe how JSX
transforms into React.createElement calls
JSX is a special
format to let you construct virtual DOM nodes using familiar
HTML-like syntax. You
can put the JSX directly into your .js files,
however
you must run the JSX
through a pre-compiler like Babel
in order for the
browser to understand it.
const Clock = (props) => {
return (

Clock

Time:

{props.hours}:{props.minutes}:{props.seconds}

);
}
Here we initialize a
Clock component using JSX instead of React.createElement .
Using Babel this code is compiled to a series of
recursively nested createElement calls:
const Clock = (props) => {
return React.createElement(
"div",
null,
[
React.createElement("h1", null, "Clock"),
React.createElement("div", {className:
"clock"}, [
React.createElement("p", null, [
React.createElement("span",
null, "Time:"),
React.createElement("span", props,
"{props.hours}:{props.minutes}:{props.seconds}")
])
])
]
);
}
JSX is a convenience
syntax, but not magic.
Use Array#map to
create an array of virtual DOM nodes while specifying a unique key for each created virtual DOM node
is often used to
change an array of values into another array of values of
equal length, it's a
perfect way to convert an array of data or
state into
a list of React
Components.
There's one
gotcha when doing this, though. In order for React to
keep track
of which components
in the list it's rendered and which ones it needs to
re-render when the
data changes, you MUST provide a unique key
attribute to the
rendered Components.
const rootDiv = document.getElementById("root");
const StarTrekCard = (props) => {
return (

{props.content}

);
}
const StarTrekCardDeck = (props) => {
return (

// Here we are
mapping the cards into <StarTrekCard>
components
{props.cards.map(card =>
<StarTrekCard
imgUrl={card.imgUrl}
content={card.content}
key={card.name} />
)}

);
}
const cards = [
{
name:
"Martok",
content: "Ferocious
Klingon"
},
{
name:
"Mijural",
content: "Shrike
Class Romulan"
}
];
ReactDOM.render(
<StarTrekCardDeck
cards={cards} />,
rootDiv
)
React Class
Components Objectives
Create a simple React
application by removing items and content from a project generated by the Create React App default
template
To generate a React
project
npx create-react-app
my-app-name
Files you can
delete
Remove the following
files from the public folder:
favicon.ico
robots.txt
logo192.png
logo512.png
manifest.json
You can replace all
the content of index.html with the boilerplate HTML generated by the html:5 command. Don't forget to add a div
inside body with an id of "root".
Remove the following
files from the src folder:
App.css
App.test.js
logo.svg
serviceWorker.js
setupTests.js
Create a simple React
application using a custom Create React App template
To use aA's custom
template:
npx create-react-app
my-app-name --template @appacademy/simple
Create a React
component using ES2015 class syntax
import React from 'react'
class Hello extends React.Component {
constructor() {
super();
this.state = {
name: this.pickRandomName()
}
}
pickRandomName()
{
const randomNum = Math.floor(Math.random() * 3);
const names = ['LeBron', 'Messi', 'Serena']
return names[randomNum];
}
changeName = () =>
{
this.setState({
name: this.pickRandomName()
});
}
render() {
return (
<>

Hello {this.state.name}!

<button
onClick={this.changeName}>Change
name</button>
</>
)
}
}
export default Hello;
Describe when it's
appropriate to use a class component
Since the release of
React Hooks (which we will learn about next week) any
advantages for class
based components have evaporated, so this Learning
Objective does not
make a lot of sense anymore and you can safely ignore it.
Initialize and update
state within a class component
Initialize the state
inside the component's constructor:
this.state = {
name: '',
email: '',
password:
''
}
The update can happen
inside any instance method except for render():
handleEmail = (e) =>
{
this.setState({
email:
e.target.value
});
}
Provide default
values for a class component's props
import React from 'react'
class Books extends React.Component {
render() {
return (

{this.props.books.map(book => {
return (

{book.title} by
{book.author}

);
})}

)
}
}
Books.defaultProps =
{
books: [
{title: "Don Quixote", author: "Miguel De
Cervantes"},
{title: "Pedro Paramo", author: "Juan
Rulfo"}
]
};
export default Books;
Add event listeners
to elements
render() {
return (
<form onSubmit={this.handleSubmit}>
<input
type="text" value={this.state.value}/>
<button>Submit!</button>
</form>
)
}
Prevent event default
behavior
handleSubmit = e =>
{
e.preventDefault();
const inputVal = this.state.value;
//
this.props.submitForm is an example of a method passed
// as part of the
props. It is not a built-in method.
// The software
engineer writing this code would need to write it.
// Tipically the
method will take the response and attach
// it to the body of
an AJAX request
this.props.submitForm(inputVal);
}
Safely use the this
keyword within event handlers
We can use the
experimental syntax that consist of using a fat arrow function:
changeEmail = e =>
{
this.setState({
email:
e.target.value
});
}
We can also bind the
method inside the constructor:
constructor() {
super();
this.state = { email: ''};
this.changeEmail = this.changeEmail.bind(this);
}
Describe what the
React SyntheticEvent object is and the role it plays in handling events
The SyntheticEvent
object mimics the characteristics of the event passed to the callback in an event handler but adding more data
to it.
These are two common
uses:
e.preventDefault();
e.stopPropagation();
Create a React class
component containing a simple form
class Simpleform extends React.Component {
constructor() {
super();
this.state = {
response:
''
}
}
handleResponse = e =>
{
this.setState({
response:
e.target.value
});
}
handleSubmit = e =>
{
e.preventDefault();
this.props.submitForm(this.state.response);
}
render() {
return (
<form onSubmit={this.handleSubmit}>
<input
onChange={this.handleResponse}
type="text"
value={this.state.response}
/>
<button>Submit</button>
</form>
);
}
}
Define a single event
handler method to handle onChange events for multiple "input" elements
onChange = (e) =>
{
const { name, value } = e.target;
this.setState({ [name]: value });
}
render() {
return(
<form onSubmit={this.onSubmit}>
<input
onChange={this.onChange}
name='email'
type="text"
value={this.state.email}
/>
<input
onChange={this.onChange}
name='password'
type="text"
value={this.state.password}
/>
<button>Submit</button>
</form>
);
}
Add a "textarea"
element to a form
The textarea element
in React uses a value attribute instead of inner content. It is handled the same way you would handle an input
element. It will be a self-closing tag.
<textarea
value={this.state.text} onChange={this.onChange}/>
Add a "select"
element to a form
<select
name='timezone' onChange={this.onChange} value={this.state.timezone}>
<option>PST</option>
<option>CST</option>
<option>EST</option>
</select>
Implement form
validations
Create a validate
method and invoke it on the submit handler method.
validate(spiritAnimal) {
const validationErrors = [];
if (!spiritAnimal) {
validationErrors.push('Please provide a spirit animal');
}
return validationErrors;
}
onSubmit = e =>
{
e.preventDefault();
const { spiritAnimal } = this.state;
const validationErrors = this.validate(spiritAnimal);
if (validationErrors.length > 0)
{
this.setState({ validationErrors });
} else {
this.props.submitForm(spiritAnimal);
this.setState({ spiritAnimal: ''});
}
}
Describe the
lifecycle of a React component
A React component
usually will go through three stages: mounting, updating, and unmounting.
Recall that the
commonly used component lifecycle methods include componentDidMount, componentDidUpdate, and
componentWillUnmount
When a React
component is added to the virtual DOM:
The constructor
method is called.
The render method is
called.
The DOM gets
updated.
The componentDidMount
method is called.
When a React
component is updated:
The render method is
called.
The DOM gets
updated.
The
componentDidUpdate method is called.
Just before a React
component gets removed from the virtual DOM, the componentWillUnmount method is called.
Use the
componentDidMount component lifecycle method to fetch data from an API
You should not fetch
data from within the constructor. Use componentDidMount instead.
componentDidMount()
{
fetch(url)
.then(response =>
response.json())
.then(data =>
this.setState({ movieInfo: data }));
}
Utilize official
documentation to gain an understanding of how new technology works
React Router
Objectives
Use the
react-router-dom package to set up React Router in your applications
npm install --save
<EMAIL_ADDRESS>import {
BrowserRouter } from 'react-router-dom`;
const App = () =>
{
return (
<BrowserRouter>

 // Note that
BrowserRouter can only have a single child Component!
// Include components
here you want to be controlled by the Router, including
// the <Route>
tag

</BrowserRouter>
);
};
Create routes using
the <Route> component from the react-router-dom
package
the
<Route>
Component takes the following arguments:
path - A pattern to match the URL in the browser. You can include placeholders
by prefixing them
with a
: character.
<Route
path='/users/:userId'/>
<Route
path='/users/:userId/stories/:storyId'/>
component
- You usually pass a single component to this attribute. When the path
is matched, this
component will be rendered and passed props containing history
location
and match
properties.
Example: When
someone visits /users/1 this will render the
Component UserProfile
<Route
path='/users/:userId' component={UserProfile}/>
render - An alternative to component this
will cause a component to render,
you can pass this an
arrow function that renders multiple components. Usually
we use this so we can
pass custom props to the component. Using the component
tag doesn't let us do
this.
Example: Assume we
want to pass an extra prop called "token" to the user Profile page
We can do it like
this, but we need to pass the regular props from
<Route>
down as well by using
the spread operator : {...props} .
<Route
path='/users/:userId'
render={props =>
<UserProfile {...props}
token={token} }/>
Generate navigation
links with the and components from the react-router-dom package
<Link>
simple renders an anchor tag
that when clicked, changes
the window.location.href to the url, which triggers BrowserRouter to parse
the url and look for
matching
<Route>
components.
<Link
to="/">App</Link>
<Link
to="/users">Users</Link>
<Link
to="/users/1">Andrew's Profile</Link>
<NavLink>
is just like
<Link>
except that it has an optional activeClassName
and activeStyle props that will set a css class or css styles when
the NavLink
is the currently
selected hyperlink.
<NavLink
to="/">App</NavLink>
<NavLink
activeClassName="red" to="/users">Users</NavLink>
<NavLink
activeClassName="blue" to="/hello">Hello</NavLink>
<NavLink
activeClassName="green" to="/users/1">Andrew's Profile</NavLink>
<NavLink to="/"
onClick={handleClick}>App with click handler</NavLink>
Create <Switch> routes and manage the order of rendered
components
By default React
Router matches paths for the
<Route>
component by treating it
as a prefix. This means all routes here will match when the url
is
/
<Route
path='/' ... >
<Route
path='/users' ... >
<Route
path='/users/:userId' ... >
To change this
behavior so it doesn't match all three but only the exact matching route you can either change all three to
include the exact prop set to true,
or you can wrap them
in a <Switch> component which causes only one of
the routes
inside the to be
rendered at any given time. By combining exact
and
<Switch>
you can solve many complex routing problems.
Remember the first
route to match in a <Switch> is the
winner!
<Switch>
<Route
path="/users/:userId" component={(props) => <Profile users={users} {...props} />} />
<Route
exact path="/users" render={() => <Users users={users} />} />
<Route
path="/hello" render={() =>
Hello!
} />
<Route
exact path="/" component={App} />
<Route
render={() =>
404: Page not found
} />
</Switch>
Use the React Router
match prop to access router parameters
Given the
following
<Route>
:
<Route
path='/users/:userId/stories/:storyId'
component={UserStories}/>
If the url
were
/users/1/storties/2
then props.match.params
inside of
UserStories
would look like this:
console.log(props.match.params);
// Will log
this
// {
// userId: 1,
// storyId: 2
// }
Use the React Router
history prop to programmatically change the browser's URL
props.history
is one of the props that a
<Route>
sends to your component.
There are two
functions on props.history
push - Pushes a new url onto the history stack. The user can use the Back
button in the
browser to go back to the previous url.
replace - Replaces the current url with the new one. The back button in the
browser won't work
to take you to the previous url.
// Pushing a new URL
(and adding to the end of history stack):
const handleClick = () => this.props.history.push('/some/url');
// Replacing the
current URL (won't be tracked in history stack):
const redirect = () => this.props.history.replace('/some/other/url');
Redirect users by
using the component in a route
To redirect the user
to a different URL (Like say after they've logged in)
use the <Redirect> component.
<Redirect
to="/">
Describe what nested
routes are and how to create them
Nested routes are
when we use a <Route> component inside a
component
that hasn't been
rendered yet instead of creating them in your top level
component directly
under
<BrowserRouter>
.
This allows us to
keep those routes close to the components they render, and it
means we are
dynamically adding routes on the fly.
For instance inside
the UserProfile component you might render more routes to the
sub components of
that component.
// Destructure
`match` prop
const UserProfile = ({ match: { url, path, params }) => {
// Custom call to
database to fetch a user by a user ID.
const user = fetchUser(params.userId);
const { name, id } = user;
return (

Welcome to the profile of {name}!

{/* Replaced
`/users/${id}` URL with `props.match.url` */}
<Link to={`${url}/posts`}>{name}'s Posts</Link>
<Link to={`${url}/photos`}>{name}'s Photos</Link>
{/* Replaced
`/users/:userId` path with `props.match.path` */}
<Route
path={`${path}/posts`} component={UserPosts} />
<Route
path={`${path}/photos`} component={UserPhotos} />

}
);
};
React Builds
Objectives
Describe what
frontend builds are and why they're needed
Frontend Builds are
where we run a series of programs on the code we write to
transpile (convert) and bundle our javascript
code.
Frontend Builds are
needed for the following reasons:
1. To convert
( Transpile ) code written in newer JavaScript or JSX
into code
that is compatible
with certain browsers, even if those browsers do not
support those
features of the language yet.
2. To compress your
front end assets (JS, CSS, etc) into a few large files that can
be loaded into the
browser more efficiently. This can use the processes of Minification , Bundling and Tree Shaking to accomplish this.
3. To check your code
for errors ( Linting )
Describe at a high
level what happens in a Create React App when you run npm start
Create React App runs
a development web server when you run npm start .
This webserver is
controlled by a piece of software called WebPack. The webserver
transpiles and
bundles your JS, CSS and other files in memory, and then serves it up
to the browser. By
doing it in emory it can support many nice features such as
hot reloading of the
code, and nice error reporting in the browser.
Here's the steps that
occur:
Environment variables
are loaded
The list of browsers
to support are checked
The configured HTTP
port is checked to ensure that it's available;
The application
compiler is configured and created;
webpack-dev-server is
started;
webpack-dev-server
compiles your application;
The index.html file
is loaded into the browser; and
A file watcher is
started to watch your files, waiting for changes.
Prepare to deploy a
React application into a production environment
Set up Environment
variables
You can setup the
environment variables in a .env file just like we
did
with express, the
only difference is, they must be prefixed with REACT_APP_
to be available
inside the WebPack build process.
Set up the browser
list
You can setup the
list of supported browsers in your package.json file. This will
inform Webpack on
which rules it should use when transpiling your code.
{
"browserslist":
{
"production": [
">0.2%",
"not dead",
"not op_mini
all"
],
"development":
[
"last 1 chrome
version",
"last 1 firefox
version",
"last 1 safari
version"
]
}
}
Build the app
When you get ready to
deploy a React application into production, you will run
the npm run build command, which will use Webpack to bundle and
transpile your
code into a folder
called build .
You should not check
this folder into source control!
You will deploy this
folder onto any webserver (Express, Nginx, Apache etc.). The webserver you use doesn't matter, but it needs to
be configured so it serves up the index.html file no
matter which
URL the user visits.
This is because React is
a Single Page
Application (SPA) framework.
React Context
Objectives
Context is a way of
connecting two components together so they can both access the
same state. Think of
context like a pipe that connects a Context.Provider to a
Context.Consumer. You
will still need a regular React component to store the
state in, but by
adding that state to the Context.Provider and pulling it out with a
Context.Consumer you
can allow multiple components to access the state without having
to pass the piece of
state down via nested props.
Use Context to share
and manage global information within a React application
Creating the
context
You create the
Context by using createContext . We can put this in
it's own
module and export the
created context object so we can use it in multiple
components…
//
PupContext.js
import { createContext } from 'react';
const PupContext = createContext(); // You can pass arguments here to
setup
// a default context
if you need to.
export default PupContext;
Create a wrapper
component with Context.Provider to set a component's default context
Recommended example
(Using a 'Provider' component)
Using a custom
provider component that can wrap any element, means our
provider is reusable.
We use this.props.children to make it so we
can
wrap any component
with this.
import PupContext from './PupContext';
//
PuppyProvider.js
class PuppyProvider extends React.Component {
constructor() {
super();
this.state = {
puppyType:
speedy,
};
}
render() {
return (
<PupContext.Provider value={this.state}>
{/* this allows us to
wrap this component around any other component */}
{this.props.children}
</PupContext.Provider>
);
}
}
export default PuppyProvider;
In App.js we can simply wrap this provider around any part of the
app that needs
to access the
context. The context will be available to any component in the
component tree under
the Provider. (Any descendant)
// App.js
import React from 'react';
import PuppyProvider from './PuppyProvider';
import banana from './pups/banana-pup.jpg'
import sleepy from './pups/sleepy-pup.jpg'
import speedy from './pups/speedy-pup.jpg'
const App = ({ puppyType }) => (
<PuppyProvider>

<Puppy/>

</PuppyProvider>
);
Create a wrapper
component with Context.Consumer to share the global context through render props
…Somewhere deep
inside of the <Puppy> component might live a
<PuppyImage>
component…
There are two ways to
access the puppyType stored in our Provider. With the static
contextType variable,
or by wrapping our component with
<PupContext.Consumer> .
This is by far the
simplest way to access context.
static contextType
and this.context
import React from 'react';
import PupContext from './PupContext';
class PuppyImage extends React.Component {
static contextType = PupContext
render() {

}
}
Wrapping a
<PupContext.Consumer> around our component
You must pass a
Consumer tag a function that receives the value stored
in the
context.
import React from 'react';
import PupContext from './PupContext';
class PuppyImage extends React.Component {
static contextType = PupContext
render() {
return (
<PupContext.Consumer> {
puppy => { // This is
the function the consunmer will call
// so we can get the
data from the context provider.
return (

);
}
}
</PupContext.Consumer>
);
}
}
This method is handy
if you need to access multiple contexts in a single
component… Imagine we
also need the UserContext to get details on the
user of the
application as well so we can put a caption under the image.
import React from 'react';
import PupContext from './PupContext';
import UserContext from './UserContext';
class PuppyImage extends React.Component {
static contextType = PupContext
render() {
return (
<UserContext.Consumer> {
user => {
<PupContext.Consumer> {
puppy => {
return (

{`by ${user.name}`}

);
}
}
</PupContext.Consumer>
}
}
</UserContext.Consumer>
);
}
}
As you can see this
can get ugly in a hurry, but don't worry, next week we will
be learning React
Hooks, which will make this much easier and cleaner.
Create and pass a
method through Context to update the global state from a nested component
If you take our
example PuppyProvider component from earlier, you can see how
we can just add a
function which updates the state of the PuppyProvider into
the PuppyProvider's
state.
import PupContext from './PupContext';
//
PuppyProvider.js
class PuppyProvider extends React.Component {
constructor() {
super();
this.state = {
puppyType:
speedy,
// We can just add
the function to the state
// So we can call it
from the Consumer
setPuppyType:
this.setPuppyType
};
}
// This function
updates the puppyType in the state
setPuppyType =
(puppyType) => {
this.setState({
puppyType
});
}
render() {
return (
<PupContext.Provider value={this.state}>
{this.props.children}
</PupContext.Provider>
);
}
}
export default PuppyProvider;
Since it's now in the
Provider's state, it's accessible from the Consumer.
Imagine we have a
form that lets you pick a new puppy type.
We just have to call
the function we added to the context to set the
puppy type when we
submit the form.
```js
import React from
'react';
import PupContext
from './PupContext';
class PuppyTypeForm
extends React.Component {
static contextType =
PupContext;
// Bonus: We can
setup the initial state this way
// instead of using a
constructor! Fancy!
state = {
chosenPuppyType:
''
}
updateChosenPuppyType
= e => {
this.setState({
chosenPuppyType =
e.target.value
});
}
handleSubmit = e =>
{
e.preventDefault();
// This is the magic,
we reach into the context and set
// the puppy type by
calling the function we stored there.
this.context.setPuppyType(this.state.chosenPuppyType);
}
render() {
return (
{this.chosenPuppyType}/
Update Puppy
Type
)
}
}


Be familiar with the coding style and contributing guides.
 With one exception (see below), every change needs at least one review.
If one or more people know an area of code particularly well, code that affects that area should ordinarily get a review from one of them.
The riskier, more subtle, or more complicated the change, the more careful the review required. When a change needs careful review, use good judgment regarding the quality of reviews. If a change adds 1000 lines of new code, and a review posted 5 minutes later says just "Looks good," then this is probably not a quality review.
(The size of a change is correlated with the amount of care needed in review, but it is not strictly tied to it. A search and replace across many files may not need much review, but one-line optimization changes can have widespread implications.)
Your own small changes to fix a recently broken build ("make") or tests ("make check"), that you believe to be visible to a large number of developers, may be checked in without review. If you are not sure, ask for review. If you do push a build fix without review, send the patch to ovs-dev afterward as usual, indicating in the email that you have already pushed it.
Regularly review submitted code in areas where you have expertise. Consider reviewing other code as well.
Do not push merge commits to the Git repository without prior discussion on ovs-dev.
If you apply a change (yours or another's) then it is your responsibility to handle any resulting problems, especially broken builds and other regressions. If it is someone else's change, then you can ask the original submitter to address it. Regardless, you need to ensure that the problem is fixed in a timely way. The definition of "timely" depends on the severity of the problem.
If a bug is present on master and other branches, fix it on master first, then backport the fix to other branches. Straightforward backports do not require additional review (beyond that for the fix on master).
Feature development should be done only on master. Occasionally it makes sense to add a feature to the most recent release branch, before the first actual release of that branch. These should be handled in the same way as bug fixes, that is, first implemented on master and then backported.
Keep the authorship of a commit clear by maintaining a correct list of "Signed-off-by:"s. If a confusing situation comes up, as it occasionally does, bring it up on the mailing list. If you explain the use of "Signed-off-by:" to a new developer, explain not just how but why, since the intended meaning of "Signed-off-by:" is more important than the syntax. As part of your explanation, quote or provide a URL to the Developer's Certificate of Origin in the contributing guide.
Use Reported-by: and Tested-by: tags in commit messages to indicate the source of a bug report.
Keep the AUTHORS file up to date.


Port of the OpenBSD bcrypt_pbkdf
function to pure Javascript. npm
-ified
version of [Devi Mandiri's port]
(https://github.com/devi/tmp/blob/master/js/bcrypt_pbkdf.js),
with some minor performance improvements. The code is copied verbatim (and
un-styled) from Devi's work.
This product includes software developed by Niels Provos.
bcrypt_pbkdf.pbkdf(pass, passlen, salt, saltlen, key, keylen, rounds)
Derive a cryptographic key of arbitrary length from a given password and salt,
using the OpenBSD bcrypt_pbkdf
function. This is a combination of Blowfish and
SHA-512.
See this article for further information.
Parameters:
pass
, a Uint8Array of length passlen
passlen
, an integer Numbersalt
, a Uint8Array of length saltlen
saltlen
, an integer Numberkey
, a Uint8Array of length keylen
, will be filled with outputkeylen
, an integer Numberrounds
, an integer Number, number of rounds of the PBKDF to runbcrypt_pbkdf.hash(sha2pass, sha2salt, out)
Calculate a Blowfish hash, given SHA2-512 output of a password and salt. Used as part of the inner round function in the PBKDF.
Parameters:
sha2pass
, a Uint8Array of length 64sha2salt
, a Uint8Array of length 64out
, a Uint8Array of length 32, will be filled with output


Kirstie Allsop declines Piers Morgan's GMB job offer
Kirstie Allsop has rejected Piers Morgan’s offer for a presenting job on Good Morning Britain as he continued to raise doubts about his future on the programme.
Piers wasted no time in asking whether the Location, Location, Location host wanted a position on the ITV show, with Susanna Reid pointing out that her on-screen partner could be about to leave for good.
‘It’s a natural progression for me,’ Piers insisted. ‘Glamourous brunette at the top of her game, a big TV star.’
Advertisement Advertisement
He continued: ‘The question really is, Kirstie, if there is a vacancy, God forbid we’d lose Susanna but we’d all move on…’
Kirstie politely refused the role though, and graciously replied: ‘I would no more seek this job that someone with the patience of a saint does every day.’
‘Very diplomatic of you,’ Piers remarked.
Last week, Piers confirmed that he could quit Good Morning Britain in January ahead of the show’s time extension.
Piers’s future on the show comes as petitions were formed to get him out of the show over his outspoken views on gender fluidity, often slamming the ideas of the series.
Susanna has already been courting potential replacements on-air, joking Bill Turnbull could take over her co-host’s spot after leaving BBC Breakfast.
The pair even auditioned mini Piers and Susanna on today’s show as they continued raising suspicions and searched for potential replacements.
Susanna has previously joked that ITV ‘can’t afford’ Piers and he then began educating viewers about the importance of knowing their worth.
‘You have to understand your own value and then you have to stick to it,’ Piers said. ‘I value myself at X You value me at Y therefore, I’m taking my toys out of the pram and going to Z.’
Advertisement Advertisement
Good Morning Britain airs weekdays from 6am on ITV.
Got a showbiz story?
If you've got a celebrity story, video or pictures get in touch with the Metro.co.uk entertainment team by emailing us<EMAIL_ADDRESS>calling 020 3615 2145 or by visiting our Submit Stuff page - we'd love to hear from you.


Knick - Knack!
Your best choise
Simple online shopping
that saves your time
Recommendations
View all products and make your best choice
All fruits
Apples
Bananas
Apricots
Melons
Barries
2020
Plan your shopping
Create a shopping list to by
everything you need
Simple payment
Pay for the order in a fast way and
without any troubles
Share your experience
Become a part of the community and
make new friends
My orders
All for our audince
∘ Bunch of bananas
Ripe and sweet, perfect for
smoothies or pancakes
Report
∘ Mini plant
Someneting you'd like to take care
of and get coziess back
Report
∘ All countries
Carelly prepared dinner to
save your cooking time
Report


To Anyone Seeing This:
This app is currently in development. Here's what does and doesn't work on the website right now:
Does Work
- Creating items ("CREATE" tab)
- Deleting items (be careful around those delete buttons)
- Viewing items (eye buttons)
- Editing items (pencil buttons)
Doesn't Work
- Nothing for now. There are no extraneous features on this site at the moment!
TODO LIST
design view dialog
implement view dialog
design edit dialog
implement edit dialog
show message after creating a pyramid
- create mass delete button in table -- OR -- remove select functionality
- create filter by unit
- refactor "pyramid" to "tower"
- OPTIONAL: implement column sorting
- implement game


| Standards |
|
Have tried to follow some standards while working
on this site.
1) My purpose to build this site is to make it as a ongoing effort rather
then make a build and forget kinda site.So maintainance of files and ease
of future working is prime concern
2) All pages should have a last updated date at upper right corner.
3) Name of html files will never be *.htm it will always be *.html and the names will always in singular instead of plural. standard.html instead of standards.html
4)


To bring quality, style and the wish for good fortune to all of our guests. We provide a high-end experience through Chinese cuisine.
TOWN combines a variety of Chinese cuisine to excite and delight our customers. Our vision for the future is to create experiential dining that is more than just a night out. We aim to bring quality and luxury across all aspects of our brand. The approach of TOWN is to develop our brand with the understanding of both our culture and consumer insights. Within our vision always lives the promise of inspiring creativity, conversation, and quality. Our audience is a high-end clientele who values a dining experience. The age range of our customers is from early 30s-60s. We would like them to come back for both personal dining and events.
Exciting promotions happening this month:
Try our featured entrees:
Mark your calendars for these upcoming events:


WITNESS LIST Natural Resources Committee March 13, 1997-2:00P SB 1 On: Blackhurst, Steve (TNRCC), Austin Loeffler, Cindy L. (Tx Parks and Wildlife), Austin McKinney, Larry D. (Tx Parks and Wildlife), Austin Pearson, Dan (TNRCC), Austin Pedersen, Craig (Tx Water Dev. Board), Austin Sneed, John J. (Tx Dept. of Agriculture), Austin Ward, J. Kevin (Tx Water Dev. Board), Austin Registering, but not testifying: On: Eaton, Terri Kay (RRC), Austin SB 201 For: Black, John Scott (Self), Austin Schmitt, Jeff G. (Guadalupe River Trout), Austin Registering, but not testifying: For: Schmitt, Cyndie (Texas Trout Unlimited), Austin SB 347 For: Welst, Jon H. (Tarrant County), Arlington Registering, but not testifying: For: Lee, Donald (Conference of Urban Co.), Austin


Next: Special Pathname Component Values, Previous: Local Case in Pathname Components, Up: Interpreting Pathname Component Values
For the functions in Figure~19–2, a value of :common for the :case argument that these functions should receive and yield strings in component values according to the following conventions:
All uppercase means to use a file system’s customary case.
All lowercase means to use the opposite of the customary case.
Mixed case represents itself.
Note that these conventions have been chosen in such a way that translation from :local to :common and back to :local is information-preserving.


TWO MUCH A film review by Ben Hoffman Copyright 1996 Ben Hoffman
This should have been called "Too Long." Not only was the two-hours film boring but it was entirely derivative and predictable. Everything that you have ever seen in a comedy film (good or bad) was thrown into this mess. When you see the comic hero (Antonio Banderas) running out of a house which has a pool, you know he is going to end up in it. Remember the famous scene in the Marx Bros. film where they are facing each other as if they were looking in a mirror? That was a work of genius. This silly thing tried to imitate it with a variation that was just a poor imitation.
An art dealer/cum con man, Art (Dodge. . . is that a pun for Dickens' "Artful Dodger?") pretends he is a twin brother to Bart. Both parts are played by Antonio Banderas. As the twin, he lets his long hair down and puts on glasses.
The cast consists of well-known names. Aside from Banderas, there is Melanie Griffith, Daryl Hannah, Joan Cusack, Danny Aiello and Joan Cusack. What a waste of talent.
Question, when is Aiello going to refuse to play a mafia-type surrounded by bone-breaking bodyguards? He has the talent but he has been typecast as an Italian gangster and apparently the money that part brings him overshadows the fact that he is a good actor and ought to insist that his agent find him a new role.
Directed by Fernando Trueba
1 byte 4 Bytes = Superb 3 Bytes = Too good to miss 2 Bytes = Average 1 Byte = Save your money
Copyright 1996 Ben Hoffman
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Marketshop is HTML Ecommerce Template. This is a CMS block. You can insert any content (HTML, Text, Images) Here.
Damiipratii © 2018
Formas de pagamento


Watch our in-depth dip exploring NERUOON, the biomedical sleepmark that helps you sleep better! Part of the series "Virtual Valley".


6.1
domestic | energy | carbon dioxide emissions | 2010
Every
building
must be designed and
constructed
in such a way that:
(a)
the energy performance is estimated in accordance with a
methodology of calculation approved under regulation 7(a) of
the Energy Performance of Buildings (Scotland) Regulations
2008; and
(b)
the energy performance of the
building
is capable of reducing
carbon dioxide emissions.
Limitation:
This standard does not apply to:
(a)
alterations and extensions to
buildings
, other than alterations and
extensions to
stand-alone buildings
having an area less than 50
square metres that would increase the area to 50 square metres
or more, or alterations to
buildings
involving the fit-out of the
building
shell which is the subject of a continuing requirement;
(b)
conversions
of
buildings
;
(c)
non-
domestic buildings
and
buildings
that are ancillary to a
dwelling
that are
stand-alone
having an area less than 50 square
metres;
(d)
buildings
, which will not be heated or cooled other than by heating
provided solely for the purpose of frost protection; or
(e)
l
imited life buildings
which have an intended life of less than 2
years.
6.1.0 Introduction
Standard 6.1 focuses on the reduction of carbon dioxide emissions arising
from the use of heating, hot water and lighting in a new
dwelling.
The
guidance sets an overall level for maximum carbon dioxide emissions in
buildings
by use of a methodology which incorporates a range of parameters
that influence energy use. This means that, for new
dwellings
, a designer is
obliged to consider energy performance as a complete package rather than
looking only at individual elements such as insulation or boiler efficiency - a
‘whole
dwelling
approach’ to energy which offers a significant degree of
design flexibility.
For the majority of new
buildings
, standard 6.1 has the greatest influence on
design for energy performance. Standards 6.2 to 6.10, in the main,
recommend benchmark and backstop levels to be achieved for individual
elements or systems. To achieve compliance with standard 6.1 it will be
necessary to improve on these backstop levels or incorporate additional
energy efficiency measures, such as low carbon equipment (LCE).
EU Directive
2009/28/EC
Article 13
Directive
2009/28/EC
promotes the use of energy from renewable sources.
Where the
dwelling
design will include use of renewable energy for heating,
Article 13 of the Directive recommends, amongst other measures,
consideration of use of the following:
•
•
for heat pumps, those that fulfil the minimum requirements of eco-labelling
established in Commission Decision 2007/742/EC of 9 November 2007
establishing the ecological criteria for the award of the Community
6.1
—
6.1.0
for biomass equipment, conversion efficiencies of 85%;
domestic | energy | carbon dioxide emissions | 2010
eco-label to electrically driven, gas driven or gas absorption heat pumps;
and
•
for solar thermal systems, those that are subject to EU standards,
including eco-labels and other technical reference systems established by
the European standardisation bodies.
Conversions
In the case of conversions, as specified in regulation 4, this standard does
not apply.
6.1.1
Dwellings
Objective
The calculated carbon dioxide emissions (measured in kilograms per square
emissions rate (DER), should be less than or equal to the target carbon
dioxide emissions for a ‘notional
dwelling
’, the target emissions rate (TER).
Summary of procedure
In order to establish the target carbon dioxide emissions rate (TER) for the
fraction' as the proposed
dwelling
), the dimensions and 'living area fraction' of
the proposed
dwelling
and a set of standard values are input into the
methodology. To calculate the emissions for the proposed
dwelling
(DER) a
second calculation is carried out where the proposed values are input into the
methodology. An alternative way of meeting standard 6.1 which avoids the
use of the calculation methodology is to design to the set of values used for
the ‘notional
dwelling
’. This elemental approach is described in clause 6.1.6.
The Government’s Standard Assessment Procedure for Energy Rating of
Dwellings (SAP 2009) is the calculation tool used with the methodology which
conforms with the European Directive
2002/91/EC
and is approved to
calculate the energy performance and the carbon dioxide emissions of an
individual
dwelling
. At all stages, the conventions in the SAP document
should be read in conjunction with the specific guidance given in the clauses
to this section.
Non-domestic
use within
dwellings
Some new
dwellings
may incorporate surgeries, consulting
rooms, offices
or
other accommodation of a floor area not exceeding 50 m² in aggregate, used
by an occupant of the
dwelling
in a professional or business capacity. Where
this occurs, the accommodation should be considered as a part of the
dwelling
.
6.1.2 Setting the target carbon dioxide emissions level
To set the target carbon dioxide emissions level, (i.e. the level that should not
be exceeded, the TER), refer to the table to this clause. The package of
measures for the fuel type for the main space heating of the proposed
dwelling
is selected. This package of measures is used in the methodology
and no improvement factors are applied. In addition, this ‘notional
dwelling’
is
to have the same size, shape (including floor, roof, exposed wall areas and
terms are explained in SAP 2009.
Software vendors providing BRE - approved SAP 2009 software will
incorporate a function that, with ‘Scotland’ selected, automatically generates
the target CO
2
emissions level once the fuel type is selected and the ‘notional
dwelling
’ dimensions and 'living area fraction' have been input into the
programme.
6.1.0
—
6.1.2
domestic | energy | carbon dioxide emissions | 2010
Measures to calculate target carbon dioxide emissions for the 'notional
dwelling
'
The measures identified in this table are set to deliver on aggregate, 30%
fewer carbon dioxide emissions than the 2007 standards. Whilst it is possible
6.1.6), this table is provided for the purpose of setting the target emission rate
(TER) for the ‘notional’
dwelling
.
Main space heating system fuel [1] [2]
Element or
system
Gas
(Package 1)
LPG
(Package 2)
Oil
(Package 3)
Electricity
(Package 4)
Biomass [3]
(Package 5)
Walls
U = 0.19
U = 0.19
U = 0.19
U = 0.19
U = 0.19
Floors
U = 0.15
U = 0.15
U = 0.15
U = 0.15
U = 0.15
Roofs
U = 0.13
U = 0.13
U = 0.13
U = 0.13
U = 0.13
Openings [4]
U = 1.5
U = 1.5
U = 1.5
U = 1.5
U = 1.5
Allowance
for thermal
bridging [5]
0.08 x total
exposed
surface area
0.08 x total
exposed
surface
0.08 x total
exposed
surface
0.08 x total
exposed
surface
0.08 x total
exposed
surface
Open
flues
None
One
One
None
One
Heating
system
(pump in
heated
space)
Air to water
heat pump
[6]
Wood pellet
boiler
HETAS
approved
Heating
system
controls
Hot water
(HW) system
(not
applicable if
combi-
boiler)
Stored HW
(from boiler)
separate time
control for
space and
water heating
Stored HW
(from boiler)
separate time
control for
space and
water heating
Stored HW
(from boiler)
separate time
control for
space and
water heating
Stored HW
by electric
immersion
Stored HW
(from boiler)
separate time
control for
space and
water heating
Secondary
space
heating
none
10% electric none
Solar
thermal
system
Yes [8]
Yes [8]
Yes [8]
Yes [8]
Yes [8]
6.1.2
—
6.1.2
domestic | energy | carbon dioxide emissions | 2010
For the 'notional
dwelling
' in addition all of the following applies in every fuel type:
Windows, doors, and rooflights
area 25% of total floor area [9]
Orientation
all
glazing
orientated east/west
Shading
average overshading
Number of sheltered sides
2
none
Ventilation system
natural ventilation with intermittent extract fans.
4 for
dwellings
with floor area more than 80 m
2,
3 for smaller
dwellings
Air infiltration through
building
fabric
7 m³/m²h at 50 Pa
Hot water cylinder (combined cylinder with 75
litre solar store)
150 litre cylinder insulated with 50 mm of factory
applied foam (cylinder in heated space);
cylinder temperature controlled by thermostat
Primary water heating losses
(where applicable)
primary pipework insulated
Low energy light fittings
100% of fixed outlets
Thermal mass parameter
The value identified for the proposed
building
should be used
Party wall heat loss (applicable to cavity
0.2 W/m²K
Notes:
1.
Where dual fuel solutions or a multi fuel appliance are proposed, assessment of both TER
and DER should be based upon the fuel option with the highest carbon factor.
2.
Where solid mineral fuel is proposed for the main space heating system, the TER should be
calculated using the values identified for oil as a fuel (package 3). This will require
improvements in performance within the DER specification for compliance.
3.
The biomass column should be used not only where biomass fuel is to be used but also for
biogas, large scale waste combustion from boilers and waste heat from power stations.
4.
U is the average
U-value
of all openings (windows, doors, rooflights) based on one opaque
door 1.85 m² of U=1.5, any other doors fully
glazed
. For windows, doors etc a frame factor of
0.7, light transmittance of 0.80 and solar energy transmittance of 0.63 are assumed.
5.
For the purposes of setting the TER, a Y-value of 0.08 is identified, which assumes
using the principles set out in the BSD document
‘Accredited Construction
Details (Scotland) 2010'
In determining the DER, guidance on designing to limit heat loss
from non-repeating thermal bridges is given in clause 6.2.3.
6.
For calculation of the TER, radiators should be identified as the distribution system.
7.
The closed wood log-burning
room
heater should be capable of burning wood only, not
multi-fuel.
8.
Evacuated tube (collector efficiency
η
ο
= 0.6, heat loss coefficient a
1
= 3), oriented between
SE and SW, pitch not more than 45º from horizontal, solar powered circulation pump. Panel
size for TER calculation, rounded to the nearest 0.1 m², determined as follows:
Dwelling
area
<
100m² : 0.75 + (0.0375 x total floor area)
Dwelling
area > 100m² : 4.3 + (0.002 x total floor area)
For
dwellings
smaller than 35 m², a panel size of 2 m² should be used in the TER calculation.
9.
If total exposed façade area is less than 25% of the floor area, the area of windows, doors
and roofs should be taken as the area of the total exposed facade area.
6.1.2
—
6.1.2
domestic | energy | carbon dioxide emissions | 2010
6.1.3 Calculating carbon dioxide emissions for the proposed
dwelling
The second calculation involves establishing the carbon dioxide emissions
for the proposed
dwelling
(DER). To do this the values proposed for the
heating system, etc.
The exceptions to entering the
dwelling
specific values are:
a. it may be assumed that all
glazing
is orientated east/west;
b. average overshading may be assumed if not known. 'Very little' shading
should not be entered;
c. 2 sheltered sides should be assumed if not known. More than 2 sheltered
sides should not be entered;
no appliance installed the worst case should be assumed i.e. a
decorative
fuel-effect gas appliance
with 20% efficiency. If there is no gas point, an
open fire with 37% efficiency should be assumed, burning solid mineral
fuel for
dwellings
outwith a smokeless zone and smokeless solid mineral
fuel for those that are within such a zone.
All other values can be varied, but before entering values into the
methodology, reference should be made to:
•
the back-stop
U-values
identified in guidance to standard 6.2; and
•
guidance on systems and equipment within standards 6.3 to 6.6.
terrace of
houses
) the average carbon dioxide emissions for the proposed
block or terrace (DER) may be compared to the average target CO
2
emissions (TER) for the ‘notional block or terrace'.
The average emissions for the block or terrace is the floor-area-weighted
average for all the individual
dwelling
emissions, i.e:
{(emissions
1
x floor area
1
)+(emissions
2
x floor area
2
)+(emissions
3
x floor
area
3
)+…..)} ÷ {(floor area
1
+ floor area
2
+ floor area
3
) + …..}.
The degree of flexibility which is provided by averaging out
building
emissions should be used carefully. It is not intended that one or more
another may be
constructed
with a high percentage of
glazing
.
associated with the
dwellings
) should be assessed either by:
a. using the guidance to standard 6.1 for non-
domestic buildings
; or
b. ensuring that the
glazing
does not exceed 25% of the total communal floor
values equal or better those given for the gas 'notional
dwelling
' (package
1 in the table to clause 6.1.2).
However where the common areas are less than 50 m² in total these
rooms
or areas may be treated as a
stand-alone building
and are not therefore
subject to standard 6.1.
6.1.3
—
6.1.5
domestic | energy | carbon dioxide emissions | 2010
6.1.6 A simplified approach
Where a
dwelling
is designed to one of the packages of measures in the
table to clause 6.1.2, it can be considered to reduce carbon dioxide
emissions to the same level as by use of the methodology, calculating and
comparing DER with TER.
In using a package of measures east/west orientation, average overshading
and 2 sheltered sides may be assumed for the proposed
dwelling
.
The simplified approach may still be used where there are minor deviations of
input values that will clearly achieve the same or a better level of emissions.
For example:
•
a boiler with a higher SEDBUK efficiency;
•
a ground source heat pump instead of an air source heat pump;
•
where secondary heating forms part of the TER calculation, a secondary
space heating system of equal or better performance (e.g. a closed,
biomass-burning
room
heater);
•
area of openings between 20% and 25% of total floor area (windows,
doors, rooflights, and roof windows);
•
a hot water cylinder with a declared heat loss figure (BS 1566-1: 2002) not
exceeding 2.11 kWh/day.
This simplified approach should not be used where there is any deviation
from values in the table which will result in higher CO
2
emissions. An
example is if the
dwelling
has more than 4 extract fans or windows of a
poorer
U-value
. Likewise, if some elements offer poorer performance and
others offer higher performance, the simplified approach should not be used.
This approach should also not be used where there is a likelihood of high
internal temperature in hot weather or where air-conditioning is proposed.
Reference should be made to the guidance to standard 6.6.
Note that an Energy Performance Certificate (EPC) will still be required, on
completion of the
dwelling
, to meet standard 6.9.
6.1.7
Conservatories
and
stand-alone buildings
should be assessed as if there was no
conservatory
proposed.
the guidance and methodology for non-
domestic buildings
should be
followed.
6.1.6
—
6.1.7
•
a declared air infiltration of 7 m³/m².h at 50 Pa or lower;


HooHacks QR Code System
🎥 Unable to access video stream (please make sure you have a webcam enabled)
No QR code detected.
Check In
Saturday Breakfast
Saturday Lunch
Saturday Dinner
Sunday Breakfast
Sunday Lunch
Hardware Out
Hardware In


|
This service regrids a variable from a dataset according to the lat/lon/plev specified by the user, and mades the regridded data downloadable by the user. |
|||
| data source: | variable name: | ||
| atmosphere pressure level (hPa), or ocean pressure level (dbar) | |||
| start year-month: | end year-month: | ||
| start lat (deg): | end lat (deg): | grid size (deg): | |
| start lon (deg): | end lon (deg): | grid size (deg): | |
| Execution purpose | |||


UI/UX/Graphic Design - Project Management & Development
Guitar Center approached me for the next stage of incorporating Touch Interfaces for their hardware products, this time for a PA speaker system. The goal was to provide a Mobile Touch interface to accompany their newest pro audio speaker line, the VARI 4000 lineup.
The speaker already came with a small LCD with a single push-rotary knob, allowing the user to utilize some of the functionality built into the hardware, so our mission was to build a mobile touch interface that would allow the customer to dig deeper into the hardware functionality via bluetooth, providing ability to walk around a venue freely and tune the speakers for any given location of the room, by the comfort of the customer’s iPhone or iPad.
The project manager provided a rough mockup of the main screen and a detailed written spec describing the remaining feature set. My role was to:
The first initial wireframe was provided by the Project manager. It was my task to find any improvements, determine how the user will get from feature to feature, then convert to Full fidelity design while maintaining the branding of the Harbinger brand.
I mapped out the users’ steps to see how I could simplify their journey to help them instantly reach the most important features of the product, and return to the main page as quickly as possible. Everything must center around the main page. It should take no more than one button to get back to the main page.
One major problem arose, we originally specified that the save functionality would work like a traditional Overwrite file functionality in a traditional OS. However after receiving the first beta firmware version for the hardware, we quickly learned that the save functionality was not traditionally written in the firmware OS. Instead, each time the user wants to save, they had to save the current working memory into a slot. So I had to go back and redesign the save functionality midway through the beta stage.
The solution was to provide the user the option to choose a slot before saving, after selecting a slot the user is provided the option to rename before saving. The lesson learned in this situation is to clarify the firmware specification for important OS functionality (like saving files), before entering the alpha stage.
Since the app will mostly be used in dark environments, I decided to stick with a dark theme and only use color where necessary. In order to highlight the most important areas of the UI, and make them stand out in the dark environment, I limited color to only represent a selected state and added color to the area that provides the most information, the EQ graph. I decided to use a blue>red gradient that shows red when the EQ is boosted (to convey risk), and blue where the EQ is lowered (to convey safety). Any tappable/unselected button will remain white.
It took several iterations of color pallets. I provided several options to run by the marketing department, ultimately we settled with blue as it matched this new VARI 4000 model’s branding.
To achieve a unique look, we custom designed the main page, but to save cost on development, we used traditional iOS elements to fulfill the remaining UI, such as the Tools page and the save/load routine.
I found working with the project manager at Guitar Center to be an enlightening experience. I was often challenged with new suggestions to improve the design, many of these being post-design-handoff and during development. So my role was to determine how we could modify the design with minimum development scope-creep.
In my earlier design days, my initial instincts would typically be to say, “no, its too late”, but I learned a much more valuable response strategy, and that is to at least prototype the change request, and test with my own eyes to see if the improvement is valuable enough. Often times I could find a solution with minimum development change.
For example, I was asked if I could create a signal strength meter for the bluetooth signal, just weeks before deployment. I checked with the developer, and found that the signal strength data is easily available. So then I took an existing Icon that already had several “signal bands” built into the design, and now we utilize that icon as the signal strength meter, along with its original functionality as the bluetooth disconnect button. It took minimal effort from development, and didn’t require any change to the UI layout.
Throughout the project there was an overwhelming responsibility to get the user experience right for our customer. Our customer is typically in a high stress situation, where music is being played live, any disruptions in the sound could be a showstopper. I maintained constant user testing during alpha & beta stages, and with the help of our external QA team, we managed to weed out all the UX bottlenecks and bugs before launch.
We currently maintain a 5 star review status in the App Store!
...Check out the VARI 4000 App in the AppStore


Say someting about you :
Say it!
Say it on :
Last tweets
- By
under
#


{{about|the Jewish pasta|the puppet character used in Nestlé advertising|Farfel the Dog}} {{Refimprove|date=October 2008}} {{Infobox prepared food | name = Farfel | image = | caption = | alternate_name = | country = | region = | creator = | course = | type = Pasta | served = | main_ingredient = Egg noodle dough | variations = | calories = | other = }} Farfel (Yiddish: פֿאַרפֿל, farfl; from Middle High German varveln) is small pellet or flake shaped pasta used in Ashkenazi Jewish cuisine. It is made from an egg noodle dough and is frequently toasted before being cooked. It can be served in soups or as a side dish. In the United States, it can also be found pre-packaged as egg barley.<ref>Nathan, Joan. Jewish Cooking in America, Knopf: New York. 1994 (Pp. 286-87)</ref>
During the Jewish holiday of Passover, when dietary laws pertaining to grains are observed, "matzah farfel" takes the place of the egg noodle version. Matzah farfel is simply matzah broken into small pieces.
{{Reflist}}
{{Pasta}} {{Noodle}}
{{Yiddish-stub}} {{Jewish-cuisine-stub}}


Phone Number<PHONE_NUMBER>262. Private Email<EMAIL_ADDRESS>I Need Your Urgent Reply. {MONEY TRANSACTION} Dear Sir,Madam My name is Mr.Cyril Beko, and I work in the International operation department in a Local Bank here in South Africa. On a routine inspection I discovered a dormant domiciliary account with a BAL. Of 36,000,000 (Thirty Six Million USD) on further discreet investigation, I also discovered that the account holder has long since passed away (dead) leaving no beneficiary to the account. The bank will approve this money to any foreigner because the former operator of the a/c is a foreigner and from Iraq in particular and I am certainly sure that he is dead, and nobody will come again for the claim of this money A foreigner can only claim this money with legal claims to the account Holder; therefore I need your cooperation in this transaction. I will provide the necessary information needed in order to claim this money, But you will need to open an account where this can be transferred. If interested send your private Telephone No. And Fax number including full details of the account to be used for the Deposit I wish for utmost confidentiality in handling this transaction as my job and the future of my family would be jeopardized if it were breached. I want to assure you that the transaction is without risk if due process is followed accordingly. Finally, I will give you 25% for your corporation. I look forward to your earliest reply through this email or my private<EMAIL_ADDRESS>should try to call me on my satelite phone no.<PHONE_NUMBER>262. I look forward to a favorable response from you. Yours Mr.Cyril. ________________________________________________________________________ BT Yahoo! Broadband - Save £80 when you order online today. Hurry! Offer ends 21st December 2003. The way the internet was meant to be. http://uk.rd.yahoo.com/evt=21064/*http://btyahoo.yahoo.co.uk


Here's a class representing Batman
, the protector of Gotham. This class uses the standard constructor (no parameters) and has a method intimidate_villain
that doesn't take any parameters. This class is already created, you do NOT need to create it.
Your task, on the other hand, is to create an instance of the class Batman
and call the method intimidate_villain
. Do NOT print anything.


Records Continue To Fall For Mancini's Italy
by SL InternationalEuropean giants Italy recorded their biggest win in more than 70 years when they defeated Armenia 9-1 on Monday night, and the result also saw Roberto Mancini's side break a number of longstanding records.
Click through the gallery above to see some images from Italy's record-breaking win over Armenia!
The Azzurri trounced Armenia courtesy of goals from Federico Chiesa, Riccardo Orsolini, Jorginho, Alessio Romagnoli, Nicolo Barella, Nicolo Zaniolo and Ciro Immobile, with the latter pairing netting a brace each.
The result was Italy's biggest win since a 9-0 victory over the United States in 1948, and saw the nation complete their qualification campaign for the 2020 UEFA European Championship with a perfect record of 10 wins from 10.
Earn Airtime & Data With Soccer Laduma's Social Media App - Download Now
In doing so, Mancini's charges broke a number of longstanding records, including one for the most wins in a calendar year with 10.
According to Tribal Football, the record had previously stood at nine wins in a given year, which had been achieved on four occasions by the four-time FIFA World Cup champions, namely in 1990, 1994, 2000 and 2003.
Former Manchester City boss Mancini has led to his side to 11 consecutive wins stretching back to 2018, bettering the previous record of nine set by Vittorio Pozzo's side across 1938 and 1939.
Read: Europe's Top 10 Dribblers Revealed
Mancini has been at Italy's since May 2018, when he replaced interim manager Luigi Di Biagio, and has won 14 of his 20 matches in charge of the nation.


Earth Space is a Virtual Reality (VR) exploration game set thousands of years after a nuclear holocaust has forced humans to abandon a hypothetical Earth, in favor of living in space. The player has been chosen as the first person to set foot on Earth in 3,000 years, and is tasked with setting up base camp to re-colonize Earth.
This is a school project I created in Unity using Oculus Rift over the course of a year or so, including programming in C#, making 3D assets in Blender & Maya, creating textures in Blender & Photoshop, and making sound effects & music in Logic Pro X. It has a networked side-quest mode where players can meet each other in Earth Space.
Research and testing were also important to the creation of this demo. I had fun imagining what possible eco-systems would spring up in this kind of environment given enough time without humanity, so upon entering the game we notice that fungi and mushrooms have become a huge proportion of the eco-system. In order to develop this game world my research lead my creativity. Each mushroom in Earth Space is a whimsical version of a type of mushroom.
Moderated usability testing followed by surveys showed that participants were quite drawn into the VR world around them, and were interest in the further content that would have been associated with a fully built game. Overall, 83.3 % of test subjects found the VR menu system easy to navigate and understand, whereas only 66.7% were able to easily identify & use intractable game objects such as buttons to open doors. This seems to suggest that traditional game interactions (like menus & stick navigation) are more easily understood by players than the new kinds of interaction that VR game worlds provide. Feedback from test subjects showed that 66% would have enjoyed more exposition or story development, as well as even more interactivity. Popular suggestions for types of interactivity included developing further relationships with the animals on the planet (33%), as well as having a detailed world building mode (50%).
The purpose of this demo game is to allow users to experience the idea that while the Earth doesn’t necessarily need humanity, humanity does need Earth. Whimsical colors and textures, delightful sounds, and a world to explore offer a sense of childlike wonder to this narrative. This project allowed me to use my versatility as a ux designer & developer, and use a liberal hand with color, texture, and sound.


Table of contents
- Background
- Latent Variable Models: What is it good for?
- Training Latent Variable Models
- Maximum likelihood principle recap
- Make your best guess. The EM algorithm
- Variational inference
- The evidence lower bound
- Stochastic variational inference
- Amortized variational inference
- Information theoretic intuition of the ELBO
- Autoencoders as generative models
- The double-edged sword: $D_{KL}(q||p)$
- Improving the models: the Holy Trinity
- Evaluating the model
- Variance reduction


Welcome to JavaGrounds!
Home
|
Hours
|
Menu
|
Locations
We here at JavaGrounds provide a pet friendly atmosphere along with
free wifi
!!!


3 Concepts¶
Now that you’ve installed the Astra SDK and ran through a brief tutorial on its basic use, let’s focus our lens on three core SDK concepts - streams, streamsets and readers. Understanding these concepts is vital to harnessing the power of the SDK with finesse and confidence. Furthermore, possessing a solid understanding of these concepts will help you to quickly pick up both more advanced and new SDK features as they are introduced in the future.
3.1 Streams¶
A stream is the sequential flow of frames from a particular data source. Imagine an old-time movie reel, with the video recorded as individual image snapshots in sequence on a long stripe of film. Each image snapshot is a frame, and you can imagine the full film as a stream, with the distinction that a stream doesn’t necessarily have a definite end.
Streams come in a variety of flavors. For instance, a color stream produces color frames, and a depth stream produces depth frames. Both of these stream types usually come from physical sensors (such as the Astra), but streams can also be generated by the SDK through “plugins” (more on plugins in a different section). For instance, the hand tracker in the SDK uses the depth stream from a sensor to generate a hand stream.
3.2 StreamSets¶
A streamset is a group of closely related streams. Continuing with the analogy above, modern movies aren’t only sequenced image frames - they have sound as well. The audio and video for a film are packaged together as a movie, since they are inextricably related to each other. In our terms, this combined package of audio and video can be thought of as a streamset.
While a streamset could be entirely composed of streams arriving from a physical sensor, it can also contain streams created through the SDK plugins. As an example, the Astra camera is represented by a streamset containing a depth stream, a color stream, as well as middleware-generated streams such as the hand stream.
Streamsets are addressed by a string-based unique identifier (URI) which allows developers to access multiple distinct streamsets at once in code. This becomes useful when working with multiple StreamSets, or perhaps addressing a server that produces higher-level streams created by a network of StreamSets.
3.3 StreamReaders¶
A stream reader is our window to the frames in the stream. Before we can actually look at each individual frame of any given type coming from our streamsets, we use the streamset to create a reader in order to access the frames of that stream. To help with understanding what a reader does, let’s continue with the film analogy one more time. While the audio/video film contains all of the information that we need to playback a movie, the film alone isn’t sufficient to presenting the movie. Another device is needed - a reel-to-reel projector. The projector not only advances the film and projects the images onto a screen, but also synchronizes the film’s audio to the video for a smooth, seamless performance.
A stream reader is functionally similar to a reel-to-reel projector. It consumes specified streams coming from a streamset (i.e. the film) and coordinates the actual delivery of each frame (the projector) to the application. Each reader can read multiple types of streams at once, and a streamset can create as many readers as are necessary for a given application. If more than one stream type is started by the reader, the reader will synchronize the streams before delivering them.
3.4 A Flexible, Scalable Pattern¶
By now, you should understand how the Astra SDK delivers data from the sensor to your application. As a quick review, individual packets of any type of data coming from a sensor are stored in frames, and these frames are delivered in streams that are grouped in streamsets and accessed by a stream reader.
Why this pattern, though? Two words - flexibility and scalability. Since streams can be of any type, even types that aren’t currently supported or aren’t even provided by sensors yet, the architecture can easily be extended through the addition of plugins to add new stream types. Even better, the new stream types will obey all of the same conventions as existing stream types, so no need to learn a new pattern every time new stream types are introduced.


Slick is a modern database query and access library for Scala. It allows you to work with stored data almost as if you were using Scala collections while at the same time giving you full control over when a database access happens and which data is transferred. You can write your database queries in Scala instead of SQL, thus profiting from the static checking, compile-time safety and compositionality of Scala. Slick features an extensible query compiler which can generate code for different backends.
create table producer(
id bigserial primary key,
name text not null
);
create table coffee(
id bigserial primary key,
name text not null,
price double precision,
producer_id bigserial references producer
);
class Coffee(tag: Tag) extends
Table[(Long, String, Double, Long)](tag, "coffee") {
def id = column[Long]("id")
def name = column[String]("name")
def price = column[Option[Double]]("price")
def producerId = column[Long]("producer_id")
def * = (id, name, price, producer_id)
}
val Coffee = TableQuery(tag => new Coffees(tag))
class Producer(tag: Tag) extends
Table[(Long, String)](tag, "producer") {
def id = column[Long]("id")
def name = column[String]("name")
def * = (id, name)
}
val Producer = TableQuery(tag => new Producer(tag))
select producer.name, coffee.name, coffee.price from coffee, producer where coffee.producer_id = producer.id
for { c <- Coffee p <- Producer if c.producerId === p.id } yield (p.name, c.name, c.price)
class Coffee(tag: Tag) extends Table[(Long, String, Double, Long)](tag, "coffee") { ... def producerId = column[Long]("producer_id") lazy val producerFk = foreignKey("coffee_producer_id_fkey", producerId, Producer)(p => p.id) }
for { c <- Coffee p <- c.producerFk } yield (p.name, c.name, c.price)
case class ProducerRow(id:Long, name:String)
class Producer(tag: Tag) extends
Table[ProducerRow](tag, "producer") {
def id = column[Long]("id")
def name = column[String]("name")
def * = (id, name) <> (ProducerRow.tupled, ProducerRow.unapply)
}
def get(id:Long):Option[ProducerRow] = ...
def get(id:ProducerId):Option[ProducerRow] = ... def get(id:CoffeeId):Option[ProducerRow] = ...
implicit val MappedProducerId =
MappedColumnType.base[ProducerId, Long](_.id, ProducerId)
implicit val MappedCoffeeId =
MappedColumnType.base[CoffeeId, Long](_.id, CoffeeId)
class Coffee(tag: Tag) extends
Table[(CoffeeId, String, Double, ProducerId)](tag, "coffee") {
def id = column[CoffeeId]("id")
...
def producerId = column[ProducerId]("producer_id")
def * = (id, name, price, producer_id)
lazy val producerFk =
foreignKey("coffee_producer_id_fkey", producerId, Producer)(r => r.id)
}
def get(id:ProducerId):Option[ProducerRow] = db.withSession{ implicit s =>
Producer.filter(_.id === id).firstOption
}
def get(id:CoffeeId):Option[ProducerRow] = db.withSession{ implicit s =>
(for {
c <- Coffee
if c.id === id
p <- c.producerFk
} yield p).firstOption
}
"com.typesafe.slick" %% "slick-codegen" % "2.1.0"
scala.slick.codegen.SourceCodeGenerator.main(
Array(slickDriver, jdbcDriver, url, outputFolder, pkg))
// https://www.parleys.com/tutorial/customizable-code-generation-other-slick-2-features
val typemap = Map(
"coffee.id" -> "coffee.CofeeId",
"coffee.provider_id" -> "coffee.ProviderId",
"provider.id" -> "coffee.ProviderId")
val generator = new SourceCodeGenerator(model){
override def parseType(tpe: String) =
Map("java.sql.Timestamp" -> "org.joda.time.DateTime").getOrElse(tpe, tpe)
override def Table = new Table(_){
override def Column = new Column(_){
override def rawType = typemap.getOrElse(
model.table.table+"."+model.name, super.rawType)
}
}
}
Db.dbName := "coffee_${Git.branch}"
Flyway.flywayUrl <<= Db.dbUrl
Slick.packageName := "coffee.db"
Slick.typemap ++= Seq(
"coffee.id" -> "coffee.CoffeeId",
"coffee.provider_id" -> "coffee.ProviderId",
"provider.id" -> "coffee.ProviderId")
Slick.generator <<= Slick.generator.dependsOn(Flyway.flywayMigrate)
sourceGenerators in Compile <+= Slick.generator
def coffees(producer:Query[Producer, ProducerRow, Seq]) =
for {
p <- Producer
c <- Coffee
if c.producerId === p.id
} yield c
def all = coffees(Producer)
def forProducer(p:ProducerId) =
coffees(Producer.filter(_.id === p))
def getCoffees(implicit s:Session) = Coffees.list
def getProducers(implicit s:Session) = Producers.list
def getCoffeesAndProducers(implicit s:Session) =
(getCoffees, getProducers)
val database = Database.forDataSource(...)
def coffeesAndProducers = db.withTransaction{ implicit s =>
getCoffeesAndProducers
}
trait SessionSuite extends fixture.Suite {
type FixtureParam = Session
private val database = Database.forDataSource(...)
protected def withFixture(test: OneArgTest) =
database.withTransaction{ s =>
try { test(s) } finally s.rollback()
}
}
class ProducerTest extends fixture.FunSuite with SessionSuite {
test("producer"){ implicit s =>
val names = Producer.map(_.name)
names.insert("Hello")
names.insert("World")
assert(names.list === List("Hello", "World"))
}
}
trait DbSuite extends fixture.Suite {
type FixtureParam = Database
private val database = Database.forDataSource(...)
protected def withFixture(test: OneArgTest) =
database.withTransaction{ s =>
object rollbackDb extends DatabaseDef {
def createConnection() = ???
override def withSession[T](f: Session => T) = f(s)
override def withTransaction[T](f: Session => T) = f(s)
}
try { test(rollbackDb) } finally s.rollback()
}
}
class Producers(db: Database) {
private val q = Producer.map(_.name)
def +=(name: String) = db.withSession { implicit s => q.insert(name) }
def names = db.withSession { implicit s => q.list }
}
class ProducersTest extends fixture.FunSuite with DbSuite {
test("producers.names"){ db =>
val p = new Producers(db)
p += "Hello"
p += "World"
assert(p.names === List("Hello", "World"))
}
}
sql"select distinct(name) from coffee".as[String].list