Designing with Class: Sinatra + PostgreSQL + Heroku
Know a little Ruby? Ready to start web development?  It’s the perfect learning tool. My recommendation: Start with a basic dynamic website, backed with SQLite. Create and manage your database tables with raw SQL. Practice deploying on Heroku. Practice.
Once you feel good, add another step. Perhaps switch to DataMapper or ActiveRecord for managing your database with objects. Add a more complex database, such as PostgreSQL.
Finally, get familiar with front-end. Start with Bootstrap. Play around with JavaScript.
Updates:
- September 29, 2013: bootstrap 3, jQuery, css
- November 21, 2013: added the ability to edit posts, demonstrated how to escape HTML
- May 4, 2014: added a captcha to the new post form to help prevent spam (see blog post here)
Contents
- In this tutorial …
- Getting started
- Model
- Version Control
- Templates and views
- Validation and Flash Messages
- Styles
- Edit Posts
- Test and Commit to Git
- Properly Escaping
- Deploy
- Add a captcha
In this tutorial …
… we’ll be hitting the middle ground. You’ll be creating a basic blog app. Before you yawn and move on, we will be using some awesome tools/gems for rapid development:
- Sinatra: the web framework, of course
- PostgreSQL: the database management system
- ActiveRecord: the ORM
- sinatra-activerecord: ports ActiveRecord for Sinatra
- Tux: provides a Shell for Sinatra so we can interact with our application
This tutorial assumes you are running a Unix-based environment - e.g, Mac OSX, straight Linux, or Linux VM through Windows. I will also be using Sublime 2 as my text editor.
Let’s get Sinatra singing!
Getting started
Start by creating a project directory somewhere on your file system:
$ mkdir sinatra-blog
Setup your gems using a Gemfile. Create the following Gemfile (no extension) within your main directory:
# Gemfile
source 'https://rubygems.org'
ruby "2.0.0"
gem "sinatra"
gem "activerecord"
gem "sinatra-activerecord"
gem 'sinatra-flash'
gem 'sinatra-redirect-with-flash'
group :development do
gem 'sqlite3'
gem "tux"
end
group :production do
gem 'pg'
end
Notice how we’re using SQLite3 for our development environment and PostgreSQL for production, in order to simply the dev process.
Install the gems:
$ bundle install
This will create Gemfile.lock, displaying the exact versions of each gem that were installed.
Create a config.ru file, which is a standard convention that Heroku looks for.
# config.ru
require './app'
run Sinatra::Application
Model
Create a file called environments.rb and include the following code for our database configuration:
configure :development do
set :database, 'sqlite:///dev.db'
set :show_exceptions, true
end
configure :production do
db = URI.parse(ENV['DATABASE_URL'] || 'postgres:///localhost/mydb')
ActiveRecord::Base.establish_connection(
:adapter => db.scheme == 'postgres' ? 'postgresql' : db.scheme,
:host => db.host,
:username => db.user,
:password => db.password,
:database => db.path[1..-1],
:encoding => 'utf8'
)
end
Next, create the main application file, “app.rb”. Make sure to include the required gems and the environments.rb file we just created.
# app.rb
require 'sinatra'
require 'sinatra/activerecord'
require './environments'
class Post < ActiveRecord::Base
end
Create a Rakefile (again, no extension) so we can use migrations for setting up the data model:
# Rakefile
require './app'
require 'sinatra/activerecord/rake'
Now run the following command to setup the migration files:
$ rake db:create_migration NAME=create_posts
If you look at your project structure. You’ll see a new folder called “db” and within that folder another folder called “migrate.” You should then see a Ruby script with a timestamp. This is a migration file. The timestamp tells ActiveRecord the order in which to apply the migrations in case there is more than one file.
Essentially, these migration files are used for setting up your database tables. Edit the file now.
The up method is used when we complete the migration (
rake db:migrate
), while the down method is ran when we rollback the last migration (rake db:rollback
).
class CreatePosts < ActiveRecord::Migration
def self.up
create_table :posts do |t|
t.string :title
t.text :body
t.timestamps
end
end
def self.down
drop_table :posts
end
end
Run the migration
$ rake db:migrate
Just so you know, ActiveRecord created these table columns: id
, title
, body
, created_at
, updated_at
When you create a new post, you only need to specify the title and body; the remaining fields are generated automatically with ActiveRecord’s magic! Pretty cool, eh?
Use tux in order to add some data to the database.
$ tux
>> Post.create(title: 'Testing the title', body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum venenatis eros eget lectus hendrerit, sed mattis quam pretium. Aenean accumsan eget leo non cursus. Aliquam sagittis luctus mi, quis suscipit neque venenatis et. Pellentesque vitae elementum diam. Quisque iaculis eget neque mattis fermentum. Donec et luctus eros. Suspendisse egestas pharetra elit vel bibendum.')
>>
>> Post.all
D, [2013-06-08T12:26:44.929333 #42914] DEBUG -- : Post Load (0.2ms) SELECT "posts".* FROM "posts"
=> [#<Post id: 1, title: "Testing the title", body: "Lorem ipsum dolor sit amet, consectetur adipiscing ...", created_at: "2013-06-08 12:24:12", updated_at: "2013-06-08 12:24:12">]
Did you notice the actual SQL syntax used for each command? No? Look again.
Add a few more posts. Then exit:
>>> exit
Version Control
Before moving on, let’s get this app under version control.
$ git init
$ git add .
$ git commit -am "initial commit"
Templates and views
Add the following code to app.rb to setup the first route:
get "/" do
@posts = Post.order("created_at DESC")
@title = "Welcome."
erb :"posts/index"
end
This maps the /
url to the template index.html (or index.erb in Ruby terms), found in “views/posts/” directory.
Note: The app.rb file is the controller in MVC-style architecture.
Add the helper for the title variable:
helpers do
def title
if @title
"#{@title}"
else
"Welcome."
end
end
end
Fire up the dev server:
$ ruby app.rb
Then navigate to http://localhost:4567/. You should see an error indicating the template can’t be found - “/sinatra-blog/views/posts/index.erb”. In other words, the URL routing is working; we just need to set up a template.
First create two new directories - “views/posts” …
Now, setup the associated template called index.erb:

<% @posts.each do |post| %>

<a href="/posts/<%= post.id %>"><%= post.title %>

Created: <%= post.created_at %>

<% end %>

Save this file within the “posts” directory.
Now set up the layout.erb template, which is used as the parent template for all other templates. This is just a convention used to speed up development. Child templates, such as index.erb inherent the HTML and CSS (common code) from the parent template.

<title><%= title %></title>

Home

New Post

<%= yield %>

Save this file within the “views” directory.
The yield method indicates where templates are embedded.
Kill the server. Fire it back up. Go back to http://localhost:4567/. Refresh. You should see your basic blog. Click on a link for one of the posts. Since we don’t have a route associated with that URL, Sinatra gives us a little suggestion.
Route and template for viewing each post.
Route:
get "/posts/:id" do
@post = Post.find(params[:id])
@title = @post.title
erb :"posts/view"
end
Template (called view.erb):

<%= @post.title %>

<%= @post.body %>

Route and template for adding new posts.
Route:
get "/posts/create" do
@title = "Create post"
@post = Post.new
erb :"posts/create"
end
Template (called create.erb):

Create Post

<form action="/posts" method="post"role="form">

Title:

<input id="post_title" class="form-control" name="post[title]" type="text" value="<%= @post.title %>" style="width=90%"/>

Body:

<textarea id="post_body" name="post[body]" class="form-control" rows="10"><%= @post.body %></textarea>

<button type="submit" class="btn btn-success">Submit</button>
</form>
We also need a route for handling the POST requests.
post "/posts" do
@post = Post.new(params[:post])
if @post.save
redirect<EMAIL_ADDRESS>else
erb :"posts/create"
end
end
Test this out. Did it work? If you get this error “Couldn’t find Post with ID=new” you need to put the last two routes above the route for viewing each post:
# app.rb
require 'sinatra'
require 'sinatra/activerecord'
require './environments'
class Post < ActiveRecord::Base
end
get "/" do
@posts = Post.order("created_at DESC")
@title = "Welcome."
erb :"posts/index"
end
helpers do
def title
if @title
"#{@title}"
else
"Welcome."
end
end
end
get "/posts/create" do
@title = "Create post"
@post = Post.new
erb :"posts/create"
end
post "/posts" do
@post = Post.new(params[:post])
if @post.save
redirect<EMAIL_ADDRESS>else
erb :"posts/create"
end
end
get "/posts/:id" do
@post = Post.find(params[:id])
@title = @post.title
erb :"posts/view"
end
Validation and Flash Messages
Add some basic validation to app.rb:
class Post < ActiveRecord::Base
validates :title, presence: true, length: { minimum: 5 }
validates :body, presence: true
end
So, both the title and body cannot be null, and the title has to be at least 5 characters long.
Navigate to http://localhost:4567/posts/create. Try to submit a blank post and then submit a real one. It’s a bit confusing to the user when a blank post is submitted and nothing happens, so add some messages indicating that an error has occurred.
First, add this to the top of app.rb:
require 'sinatra/flash'
require 'sinatra/redirect_with_flash'
enable :sessions
Update the POST request route:
post "/posts" do
@post = Post.new(params[:post])
if @post.save
redirect<EMAIL_ADDRESS>:notice => 'Congrats! Love the new post. (This message will disappear in 4 seconds.)'
else
redirect "posts/create", :error => 'Something went wrong. Try again. (This message will disappear in 4 seconds.)'
end
end
Add the following code to the layout.erb template just above the yield method:
<% if flash[:notice] %>

<%= flash[:notice] %>
<% end %>
<% if flash[:error] %>

<%= flash[:error] %>
<% end %>
Now test it again!
Styles
The app is ugly. Add some quick bootstrap styling.
Updated layout.erb:
<!DOCTYPE html>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title><%= title %></title>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">

<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

</button>
Sinatra Sings

Home

New Post

<% if flash[:notice] %>

<%= flash[:notice] %>
<% end %>
<% if flash[:error] %>

<%= flash[:error] %>
<% end %>
<%= yield %>

Looking good? Well, a little better.
$ git add .
$ git commit -am "updated"
Edit Posts
Alright. We need to be able to edit live posts.
Update app.rb
# app.rb
require 'sinatra'
require 'sinatra/activerecord'
require './environments'
require 'sinatra/flash'
require 'sinatra/redirect_with_flash'
enable :sessions
class Post < ActiveRecord::Base
validates :title, presence: true, length: { minimum: 5 }
validates :body, presence: true
end
helpers do
def title
if @title
"#{@title}"
else
"Welcome."
end
end
end
# get ALL posts
get "/" do
@posts = Post.order("created_at DESC")
@title = "Welcome."
erb :"posts/index"
end
# create new post
get "/posts/create" do
@title = "Create post"
@post = Post.new
erb :"posts/create"
end
post "/posts" do
@post = Post.new(params[:post])
if @post.save
redirect<EMAIL_ADDRESS>:notice => 'Congrats! Love the new post. (This message will disapear in 4 seconds.)'
else
redirect "posts/create", :error => 'Something went wrong. Try again. (This message will disapear in 4 seconds.)'
end
end
# view post
get "/posts/:id" do
@post = Post.find(params[:id])
@title = @post.title
erb :"posts/view"
end
# edit post
get "/posts/:id/edit" do
@post = Post.find(params[:id])
@title = "Edit Form"
erb :"posts/edit"
end
put "/posts/:id" do
@post = Post.find(params[:id])
@post.update(params[:post])
redirect<EMAIL_ADDRESS>end
Add an edit template

Edit Post

<form action="/posts/<%= @post.id %>" method="post">

<input type="hidden" name="_method" value="put" />
Title:

<input id="post_title" class="form-control" name="post[title]" type="text" value="<%= @post.title %>" />

Body:

<textarea id="post_body" name="post[body]" class="form-control" rows="5"><%= @post.body %></textarea>

<button type="submit" class="btn btn-success">Submit</button>
</form>
Update the view template

<%= @post.title %>

<%= @post.body %>

<a href="/posts/<%= @post.id %>/edit">Edit Post
Test and Commit to Git
Yes, test to ensure you can edit posts locally, then add and commit to Git.
Properly Escaping
Currently, you can enter really anything into the input boxes for the title and body, including HTML. Test this out. Enter these code snippets in the title and/or or body:
Very, very strong

See the issue? We need to escape the text properly in order to avoid this.
Update app.rb
Add the following helper:
helpers do
include Rack::Utils
alias_method :h, :escape_html
end
Update the view template

<%=h @post.title %>

<%=h @post.body %>

<a href="/posts/<%= @post.id %>/edit">Edit Post
Update the edit template

Edit Post

<form action="/posts/<%= @post.id %>" method="post">

<input type="hidden" name="_method" value="put" />
Title:

<input id="post_title" class="form-control" name="post[title]" type="text" value="<%=h @post.title %>" />

Body:

<textarea id="post_body" name="post[body]" class="form-control" rows="5"><%=h @post.body %></textarea>

<button type="submit" class="btn btn-success">Submit</button>
</form>
Update the index template

<% @posts.each do |post| %>

<a href="/posts/<%= post.id %>"><%=h post.title %>

Created: <%=h post.created_at %>

<% end %>

Now try to enter Very, very strong
. Notice the difference? See this page for further explanation.
Commit to Git again.
Deploy
Finally, let’s get this app live on Heroku!
Create an account on Heroku. (if needed)
Install the gem - sudo gem install heroku
(if needed)
Generate an SSH key. (if needed)
Push to Heroku:
$ heroku create <my-app-name>.
$ git push heroku master
Rake the remote database:
$ heroku rake db:migrate
Boom! Check out your live app.
Links:
- My app: http://sinatra-sings.herokuapp.com/
- Git Repo: https://github.com/mjhea0/sinatra-blog
Sinatra has ended his set (crowd applauds as he exits the main stage).
Add a captcha
Help eliminate spam by adding a captcha to the new post form. View the blog post - Adding a Captcha to Sinatra to Minimize Spam.


Module: Concurrent::Actress::Context
- Includes:
- CoreDelegations, TypeCheck
- Included in:
- AdHoc, Root
- Defined in:
- lib/concurrent/actress/context.rb
Overview
This module is used to define actors. It can be included in any class, only requirement is to override #on_message method.
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary (collapse)
-
- (Object) core
readonly
Returns the value of attribute core.
Instance Method Summary (collapse)
- - (Object) actor_class (also: #actress_class) included from CoreDelegations
- - (Object) Child!(value, *types) included from TypeCheck
- - (Boolean) Child?(value, *types) included from TypeCheck
- - (Object) children
- - (Object) executor included from CoreDelegations
-
- (Object) log(level, progname, message = nil, &block)
delegates to core.log.
- - (Object) Match!(value, *types) included from TypeCheck
- - (Boolean) Match?(value, *types) included from TypeCheck
- - (Object) name included from CoreDelegations
- - (Object) on_envelope(envelope) private
-
- (Object) on_message(message)
abstract
A result which will be used to set the IVar supplied to Reference#ask.
- - (Object) parent included from CoreDelegations
- - (Object) path included from CoreDelegations
- - (Object) reference (also: #ref) included from CoreDelegations
- - (Object) spawn(*args, &block)
- - (Object) terminate!
- - (Object) terminated included from CoreDelegations
- - (Boolean) terminated? included from CoreDelegations
- - (Object) Type!(value, *types) included from TypeCheck
- - (Boolean) Type?(value, *types) included from TypeCheck
Instance Attribute Details
- (Object) core (readonly)
Returns the value of attribute core
19 20 21 |
# File 'lib/concurrent/actress/context.rb', line 19 def core @core end |
Instance Method Details
- (Object) actor_class Also known as: actress_class Originally defined in module CoreDelegations
- (Object) Child!(value, *types) Originally defined in module TypeCheck
- (Boolean) Child?(value, *types) Originally defined in module TypeCheck
- (Object) children
44 45 46 |
# File 'lib/concurrent/actress/context.rb', line 44 def children core.children end |
- (Object) executor Originally defined in module CoreDelegations
- (Object) log(level, progname, message = nil, &block)
delegates to core.log
55 56 57 |
# File 'lib/concurrent/actress/context.rb', line 55 def log(level, progname, = nil, &block) core.log(level, progname, , &block) end |
- (Object) Match!(value, *types) Originally defined in module TypeCheck
- (Boolean) Match?(value, *types) Originally defined in module TypeCheck
- (Object) name Originally defined in module CoreDelegations
- (Object) on_envelope(envelope)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
31 32 33 34 35 36 |
# File 'lib/concurrent/actress/context.rb', line 31 def on_envelope(envelope) @envelope = envelope envelope. ensure @envelope = nil end |
- (Object) on_message(message)
This method is abstract.
override to define Actor's behaviour
Note:
self should not be returned (or sent to other actors), Concurrent::Actress::CoreDelegations#reference should be used instead
Returns a result which will be used to set the IVar supplied to Reference#ask
26 27 28 |
# File 'lib/concurrent/actress/context.rb', line 26 def () raise NotImplementedError end |
- (Object) parent Originally defined in module CoreDelegations
- (Object) path Originally defined in module CoreDelegations
- (Object) reference Also known as: ref Originally defined in module CoreDelegations
- (Object) spawn(*args, &block)
39 40 41 |
# File 'lib/concurrent/actress/context.rb', line 39 def spawn(*args, &block) Actress.spawn(*args, &block) end |
- (Object) terminate!
49 50 51 |
# File 'lib/concurrent/actress/context.rb', line 49 def terminate! core.terminate! end |


LOGO
Orchestra Name
{{reservation.seat.name}}
{{reservation.category.name}}
{{reservation.event.name}}
{{reservation.event.location}}
{{reservation.event.dateandtime}}
$ {{reservation.price}} {% if reservation.isReduced %}(reduced){% endif %}


| Package | Description |
|---|---|
| com.destroystokyo.paper.event.player | |
| org.bukkit |
More generalized classes in the API.
|
| org.bukkit.block |
Classes used to manipulate the voxels in a
world ,
including special states. |
| org.bukkit.enchantments |
Classes relating to the specialized enhancements to
item stacks , as part of the meta data . |
| org.bukkit.entity |
Interfaces for non-voxel objects that can exist in a
world , including all players, monsters, projectiles, etc. |
| org.bukkit.event.block | |
| org.bukkit.event.entity | |
| org.bukkit.event.inventory | |
| org.bukkit.event.player | |
| org.bukkit.generator |
Classes to facilitate
world generation
implementation. |
| org.bukkit.inventory |
Classes involved in manipulating player inventories and item interactions.
|
| org.bukkit.material |
Classes that represents various voxel types and states.
|
| Modifier and Type | Method and Description |
|---|---|
Set<Material> |
PlayerArmorChangeEvent.SlotType.getTypes()
Gets an immutable set of all allowed material types that can be placed in an
armor slot.
|
| Modifier and Type | Method and Description |
|---|---|
static PlayerArmorChangeEvent.SlotType |
PlayerArmorChangeEvent.SlotType.getByMaterial(Material material)
Gets the type of slot via the specified material
|
static boolean |
PlayerArmorChangeEvent.SlotType.isEquipable(Material material)
Gets whether or not this material can be equipped to a slot
|
| Modifier and Type | Method and Description |
|---|---|
Material |
ChunkSnapshot.getBlockType(int x,
int y,
int z)
Get block type for block at corresponding coordinate in the chunk
|
static Material |
Material.getMaterial(int id)
Deprecated.
Magic value
|
static Material |
Material.getMaterial(String name)
Attempts to get the Material with the given name.
|
Material |
UnsafeValues.getMaterialFromInternalName(String name)
Deprecated.
|
static Material |
Material.matchMaterial(String name)
Attempts to match the Material with the given name.
|
static Material |
Material.valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Material[] |
Material.values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
| Modifier and Type | Method and Description |
|---|---|
FallingBlock |
World.spawnFallingBlock(Location location,
Material material,
byte data)
Deprecated.
Magic value
|
| Modifier and Type | Method and Description |
|---|---|
Material |
Jukebox.getPlaying()
Gets the record being played.
|
Material |
Block.getType()
Gets the type of this block
|
Material |
BlockState.getType()
Gets the type of this block state.
|
| Modifier and Type | Method and Description |
|---|---|
void |
Jukebox.setPlaying(Material record)
Sets the record being played.
|
void |
Block.setType(Material type)
Sets the type of this block
|
void |
BlockState.setType(Material type)
Sets the type of this block state.
|
void |
Block.setType(Material type,
boolean applyPhysics)
Sets the type of this block
|
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
EnchantmentTarget.includes(Material item)
Check whether this target includes the specified item.
|
| Modifier and Type | Method and Description |
|---|---|
Material |
FallingBlock.getMaterial()
Get the Material of the falling block
|
| Modifier and Type | Method and Description |
|---|---|
void |
Player.decrementStatistic(Statistic statistic,
Material material)
Decrements the given statistic for this player for the given material.
|
void |
Player.decrementStatistic(Statistic statistic,
Material material,
int amount)
Decrements the given statistic for this player for the given material.
|
int |
HumanEntity.getCooldown(Material material)
Get the cooldown time in ticks remaining for the specified material.
|
int |
Player.getStatistic(Statistic statistic,
Material material)
Gets the value of the given statistic for this player.
|
boolean |
HumanEntity.hasCooldown(Material material)
Check whether a cooldown is active on the specified material.
|
void |
Player.incrementStatistic(Statistic statistic,
Material material)
Increments the given statistic for this player for the given material.
|
void |
Player.incrementStatistic(Statistic statistic,
Material material,
int amount)
Increments the given statistic for this player for the given material.
|
void |
Player.sendBlockChange(Location loc,
Material material,
byte data)
Deprecated.
Magic value
|
void |
HumanEntity.setCooldown(Material material,
int ticks)
Set a cooldown on the specified material for a certain amount of ticks.
|
void |
Player.setStatistic(Statistic statistic,
Material material,
int newValue)
Sets the given statistic for this player for the given material.
|
| Modifier and Type | Method and Description |
|---|---|
List<Block> |
LivingEntity.getLastTwoTargetBlocks(Set<Material> transparent,
int maxDistance)
Gets the last two blocks along the living entity's line of sight.
|
List<Block> |
LivingEntity.getLineOfSight(Set<Material> transparent,
int maxDistance)
Gets all blocks along the living entity's line of sight.
|
Block |
LivingEntity.getTargetBlock(Set<Material> transparent,
int maxDistance)
Gets the block that the living entity has targeted.
|
| Modifier and Type | Method and Description |
|---|---|
Material |
BlockPhysicsEvent.getChangedType()
Gets the type of block that changed, causing this event
|
Material |
BlockCanBuildEvent.getMaterial()
Gets the Material that we are trying to place.
|
| Modifier and Type | Method and Description |
|---|---|
Material |
EntityChangeBlockEvent.getTo()
Gets the Material that the block is changing into
|
| Constructor and Description |
|---|
EntityChangeBlockEvent(Entity what,
Block block,
Material to,
byte data)
Deprecated.
Magic value
|
| Modifier and Type | Method and Description |
|---|---|
Material |
FurnaceExtractEvent.getItemType()
Get the Material of the item being retrieved
|
| Constructor and Description |
|---|
FurnaceExtractEvent(Player player,
Block block,
Material itemType,
int itemAmount,
int exp) |
| Modifier and Type | Method and Description |
|---|---|
Material |
PlayerBucketEvent.getBucket()
Returns the bucket used in this event
|
Material |
PlayerInteractEvent.getMaterial()
Convenience method.
|
Material |
PlayerStatisticIncrementEvent.getMaterial()
Gets the Material if
getStatistic() is a block
or item statistic otherwise returns null. |
| Constructor and Description |
|---|
PlayerBucketEmptyEvent(Player who,
Block blockClicked,
BlockFace blockFace,
Material bucket,
ItemStack itemInHand) |
PlayerBucketEvent(Player who,
Block blockClicked,
BlockFace blockFace,
Material bucket,
ItemStack itemInHand) |
PlayerBucketFillEvent(Player who,
Block blockClicked,
BlockFace blockFace,
Material bucket,
ItemStack itemInHand) |
PlayerStatisticIncrementEvent(Player player,
Statistic statistic,
int initialValue,
int newValue,
Material material) |
| Modifier and Type | Method and Description |
|---|---|
Material |
ChunkGenerator.ChunkData.getType(int x,
int y,
int z)
Get the type of the block at x, y, z.
|
| Modifier and Type | Method and Description |
|---|---|
void |
ChunkGenerator.ChunkData.setBlock(int x,
int y,
int z,
Material material)
Set the block at x,y,z in the chunk data to material.
|
void |
ChunkGenerator.ChunkData.setRegion(int xMin,
int yMin,
int zMin,
int xMax,
int yMax,
int zMax,
Material material)
Set a region of this chunk from xMin, yMin, zMin (inclusive)
to xMax, yMax, zMax (exclusive) to material.
|
| Modifier and Type | Method and Description |
|---|---|
Material |
ItemStack.getType()
Gets the type of this item
|
| Modifier and Type | Method and Description |
|---|---|
ShapelessRecipe |
ShapelessRecipe.addIngredient(int count,
Material ingredient)
Adds multiples of the specified ingredient.
|
ShapelessRecipe |
ShapelessRecipe.addIngredient(int count,
Material ingredient,
int rawdata)
Deprecated.
Magic value
|
ShapelessRecipe |
ShapelessRecipe.addIngredient(Material ingredient)
Adds the specified ingredient.
|
ShapelessRecipe |
ShapelessRecipe.addIngredient(Material ingredient,
int rawdata)
Deprecated.
Magic value
|
HashMap<Integer,? extends ItemStack> |
Inventory.all(Material material)
Returns a HashMap with all slots and ItemStacks in the inventory with
the given Material.
|
ItemMeta |
ItemFactory.asMetaFor(ItemMeta meta,
Material material)
Returns an appropriate item meta for the specified material.
|
boolean |
Inventory.contains(Material material)
Checks if the inventory contains any ItemStacks with the given
material.
|
boolean |
Inventory.contains(Material material,
int amount)
Checks if the inventory contains any ItemStacks with the given
material, adding to at least the minimum amount specified.
|
int |
Inventory.first(Material material)
Finds the first slot in the inventory containing an ItemStack with the
given material
|
ItemMeta |
ItemFactory.getItemMeta(Material material)
This creates a new item meta for the material.
|
boolean |
ItemFactory.isApplicable(ItemMeta meta,
Material material)
This method checks the item meta to confirm that it is applicable (no
data lost if applied) to the specified Material.
|
void |
Inventory.remove(Material material)
Removes all stacks in the inventory matching the given material.
|
ShapelessRecipe |
ShapelessRecipe.removeIngredient(int count,
Material ingredient)
Removes multiple instances of an ingredient from the list.
|
ShapelessRecipe |
ShapelessRecipe.removeIngredient(int count,
Material ingredient,
int rawdata)
Deprecated.
Magic value
|
ShapelessRecipe |
ShapelessRecipe.removeIngredient(Material ingredient)
Removes an ingredient from the list.
|
ShapelessRecipe |
ShapelessRecipe.removeIngredient(Material ingredient,
int rawdata)
Deprecated.
Magic value
|
ShapedRecipe |
ShapedRecipe.setIngredient(char key,
Material ingredient)
Sets the material that a character in the recipe shape refers to.
|
ShapedRecipe |
ShapedRecipe.setIngredient(char key,
Material ingredient,
int raw)
Deprecated.
Magic value
|
FurnaceRecipe |
FurnaceRecipe.setInput(Material input)
Sets the input of this furnace recipe.
|
FurnaceRecipe |
FurnaceRecipe.setInput(Material input,
int data)
Deprecated.
Magic value
|
void |
ItemStack.setType(Material type)
Sets the type of this item
|
| Constructor and Description |
|---|
FurnaceRecipe(ItemStack result,
Material source)
Create a furnace recipe to craft the specified ItemStack.
|
FurnaceRecipe(ItemStack result,
Material source,
int data)
Deprecated.
Magic value
|
FurnaceRecipe(ItemStack result,
Material source,
int data,
float experience)
Deprecated.
Magic value
|
ItemStack(Material type)
Defaults stack size to 1, with no extra data
|
ItemStack(Material type,
int amount)
An item stack with no extra data
|
ItemStack(Material type,
int amount,
short damage)
An item stack with the specified damage / durability
|
ItemStack(Material type,
int amount,
short damage,
Byte data)
Deprecated.
this method uses an ambiguous data byte object
|
| Modifier and Type | Field and Description |
|---|---|
protected static Material |
Leaves.DEFAULT_TYPE |
protected static Material |
Crops.DEFAULT_TYPE |
protected static Material |
WoodenStep.DEFAULT_TYPE |
protected static Material |
Tree.DEFAULT_TYPE |
protected static Material |
Wood.DEFAULT_TYPE |
| Modifier and Type | Method and Description |
|---|---|
Material |
MaterialData.getItemType()
Gets the Material that this MaterialData represents
|
Material |
TexturedMaterial.getMaterial()
Gets the current Material this block is made of
|
static Material |
Door.getWoodDoorOfSpecies(TreeSpecies species)
Returns the item type of a wooden door for the given tree species.
|
| Modifier and Type | Method and Description |
|---|---|
List<Material> |
SmoothBrick.getTextures() |
abstract List<Material> |
TexturedMaterial.getTextures()
Retrieve a list of possible textures.
|
List<Material> |
MonsterEggs.getTextures() |
List<Material> |
Step.getTextures() |
| Modifier and Type | Method and Description |
|---|---|
void |
TexturedMaterial.setMaterial(Material material)
Sets the material this block is made of
|
| Constructor and Description |
|---|
Banner(Material type) |
Banner(Material type,
byte data)
Deprecated.
Magic value
|
Bed(Material type) |
Bed(Material type,
byte data)
Deprecated.
Magic value
|
Button(Material type) |
Button(Material type,
byte data)
Deprecated.
Magic value
|
Cake(Material type) |
Cake(Material type,
byte data)
Deprecated.
Magic value
|
Chest(Material type) |
Chest(Material type,
byte data)
Deprecated.
Magic value
|
Coal(Material type) |
Coal(Material type,
byte data)
Deprecated.
Magic value
|
Command(Material type) |
Command(Material type,
byte data)
Deprecated.
Magic value
|
Comparator(Material type) |
Comparator(Material type,
byte data)
Deprecated.
Magic value
|
Crops(Material type)
Constructs a crop block of the given type and in the seeded state
|
Crops(Material type,
byte data)
Deprecated.
Magic value
|
Crops(Material type,
CropState state)
Constructs a crop block of the given type and in the given growth state
|
DetectorRail(Material type) |
DetectorRail(Material type,
byte data)
Deprecated.
Magic value
|
Diode(Material type) |
Diode(Material type,
byte data)
Deprecated.
Magic value
|
DirectionalContainer(Material type) |
DirectionalContainer(Material type,
byte data)
Deprecated.
Magic value
|
Dirt(Material type) |
Dirt(Material type,
byte data)
Deprecated.
Magic value
|
Dispenser(Material type) |
Dispenser(Material type,
byte data)
Deprecated.
Magic value
|
Door(Material type) |
Door(Material type,
BlockFace face)
Constructs the bottom half of a door of the given material type, facing the specified direction and set to closed
|
Door(Material type,
BlockFace face,
boolean isOpen)
Constructs the bottom half of a door of the given material type, facing the specified direction and set to open
or closed
|
Door(Material type,
boolean isHingeRight)
Constructs the top half of door of the given material type and with the hinge on the left or right
|
Door(Material type,
byte data)
Deprecated.
Magic value
|
DoublePlant(Material type) |
DoublePlant(Material type,
byte data)
Deprecated.
Magic value
|
Dye(Material type) |
Dye(Material type,
byte data)
Deprecated.
Magic value
|
EnderChest(Material type) |
EnderChest(Material type,
byte data)
Deprecated.
Magic value
|
ExtendedRails(Material type) |
ExtendedRails(Material type,
byte data)
Deprecated.
Magic value
|
FlowerPot(Material type)
Deprecated.
|
FlowerPot(Material type,
byte data)
Deprecated.
Magic value
|
Furnace(Material type) |
Furnace(Material type,
byte data)
Deprecated.
Magic value
|
FurnaceAndDispenser(Material type) |
FurnaceAndDispenser(Material type,
byte data)
Deprecated.
Magic value
|
Hopper(Material type) |
Hopper(Material type,
byte data)
Deprecated.
Magic value
|
Ladder(Material type) |
Ladder(Material type,
byte data)
Deprecated.
Magic value
|
Leaves(Material type)
Constructs a leaf block of the given type.
|
Leaves(Material type,
byte data)
Deprecated.
Magic value
|
Leaves(Material type,
TreeSpecies species)
Constructs a leaf block of the given type and tree species.
|
Leaves(Material type,
TreeSpecies species,
boolean isDecayable)
Constructs a leaf block of the given type and tree species and flag for
whether this leaf block will disappear when too far from a log.
|
Lever(Material type) |
Lever(Material type,
byte data)
Deprecated.
Magic value
|
LongGrass(Material type) |
LongGrass(Material type,
byte data)
Deprecated.
Magic value
|
MaterialData(Material type) |
MaterialData(Material type,
byte data)
Deprecated.
Magic value
|
MonsterEggs(Material type) |
MonsterEggs(Material type,
byte data)
Deprecated.
Magic value
|
Mushroom(Material shroom)
Constructs a brown/red mushroom block with all sides set to pores.
|
Mushroom(Material shroom,
BlockFace capFace)
Constructs a brown/red mushroom cap block with the specified face or
faces set to cap texture.
|
Mushroom(Material shroom,
byte data)
Deprecated.
Magic value
|
Mushroom(Material shroom,
MushroomBlockTexture texture)
Constructs a brown/red mushroom block with the specified textures.
|
NetherWarts(Material type) |
NetherWarts(Material type,
byte data)
Deprecated.
Magic value
|
Observer(Material type) |
Observer(Material type,
byte data)
Deprecated.
Magic value
|
PistonBaseMaterial(Material type) |
PistonBaseMaterial(Material type,
byte data)
Deprecated.
Magic value
|
PistonExtensionMaterial(Material type) |
PistonExtensionMaterial(Material type,
byte data)
Deprecated.
Magic value
|
PoweredRail(Material type) |
PoweredRail(Material type,
byte data)
Deprecated.
Magic value
|
PressurePlate(Material type) |
PressurePlate(Material type,
byte data)
Deprecated.
Magic value
|
Prismarine(Material type) |
Prismarine(Material type,
byte data)
Deprecated.
Magic value
|
Pumpkin(Material type) |
Pumpkin(Material type,
byte data)
Deprecated.
Magic value
|
Rails(Material type) |
Rails(Material type,
byte data)
Deprecated.
Magic value
|
RedstoneTorch(Material type) |
RedstoneTorch(Material type,
byte data)
Deprecated.
Magic value
|
RedstoneWire(Material type) |
RedstoneWire(Material type,
byte data)
Deprecated.
Magic value
|
Sand(Material type) |
Sand(Material type,
byte data)
Deprecated.
Magic value
|
Sandstone(Material type) |
Sandstone(Material type,
byte data)
Deprecated.
Magic value
|
Sapling(Material type)
Constructs a sapling of the given type.
|
Sapling(Material type,
byte data)
Deprecated.
Magic value
|
Sapling(Material type,
TreeSpecies species)
Constructs a sapling of the given type and tree species.
|
Sapling(Material type,
TreeSpecies species,
boolean isInstantGrowable)
Constructs a sapling of the given type and tree species and if is it
instant growable
|
Sign(Material type) |
Sign(Material type,
byte data)
Deprecated.
Magic value
|
SimpleAttachableMaterialData(Material type) |
SimpleAttachableMaterialData(Material type,
BlockFace direction) |
SimpleAttachableMaterialData(Material type,
byte data)
Deprecated.
Magic value
|
Skull(Material type) |
Skull(Material type,
byte data)
Deprecated.
Magic value
|
SmoothBrick(Material type) |
SmoothBrick(Material type,
byte data)
Deprecated.
Magic value
|
Sponge(Material type) |
Sponge(Material type,
byte data)
Deprecated.
Magic value
|
Stairs(Material type) |
Stairs(Material type,
byte data)
Deprecated.
Magic value
|
Step(Material type) |
Step(Material type,
byte data)
Deprecated.
Magic value
|
Stone(Material type) |
Stone(Material type,
byte data)
Deprecated.
Magic value
|
TexturedMaterial(Material m) |
TexturedMaterial(Material type,
byte data)
Deprecated.
Magic value
|
Torch(Material type) |
Torch(Material type,
byte data)
Deprecated.
Magic value
|
TrapDoor(Material type) |
TrapDoor(Material type,
byte data)
Deprecated.
Magic value
|
Tree(Material type)
Constructs a tree block of the given type.
|
Tree(Material type,
byte data)
Deprecated.
Magic value
|
Tree(Material type,
TreeSpecies species)
Constructs a tree block of the given type and tree species.
|
Tree(Material type,
TreeSpecies species,
BlockFace dir)
Constructs a tree block of the given type and tree species, and facing
the given direction.
|
Wood(Material type)
Constructs a wood block of the given type.
|
Wood(Material type,
byte data)
Deprecated.
Magic value
|
Wood(Material type,
TreeSpecies species)
Constructs a wood block of the given type and tree species.
|
WoodenStep(Material type,
byte data)
Deprecated.
Magic value
|
Wool(Material type) |
Wool(Material type,
byte data)
Deprecated.
Magic value
|
Copyright © 2021. All rights reserved.


This package won't show up on your devlog-only game page. Switch your game page to early access or complete from the Overview/Setup page for it to show.
Go to Overview/Setup page
Package Preview
This package has builds that are still processing. They will be available in the package as soon as they're finished processing.


Try out our Premium Member services: Virtual Legal Assistant, Query Alert Service and an ad-free experience. Free for one month and pay only if you like it.
Gujarat High Court Case Information System Print CR.MA/818/2012 6/ 6 ORDER IN THE HIGH COURT OF GUJARAT AT AHMEDABAD CRIMINAL MISC.APPLICATION No. 818 of 2012 ========================================= RANA VISHNOI & 4 - Applicant(s) Versus GUJARAT POLLUTION CONTROL BOARD & 1 - Respondent(s) ========================================= Appearance : MR NITIN M AMIN for Applicant(s) : 1 - 5. None for Respondent(s) : 1, MR JK SHAH ADDL. PUBLIC PROSECUTOR for Respondent(s) : 2, ========================================= CORAM : HONOURABLE MR.JUSTICE ANANT S. DAVE Date : 13/02/2012 ORAL ORDER
1. Draft amendment granted.
2. This petition under Section 482 of the Code of Criminal Procedure, 1973 for quashing the Criminal Case No. 4531 of 1992 is filed by the applicants on the ground that ingredients as required under Section 47 of the Water (Prevention and Control of Pollution) Act, 1974 are not satisfied and further private complainant who happened to be an officer of the Gujarat Pollution Control Board has not averred about the manner and method of involvement of the applicants who are Directors of the Company in day to day business.  At such an advance stage of their life they may not be subjected to criminal prosecution particularly, when the trial has not progressed so far and only one witness is examined and that witness has also deposed to the extent of no liability of the applicants.
3. Mr.
Nitin Amin, learned advocate for the applicants has placed reliance on the decision of the Apex Court in the case of National Small Industries Corporation Limited v. Harmeet Singh Paintal & Anr. [(2010) 3 SCC 330], Saroj Kumar Poddar v. State (NCT of Delhi) [(2007) 3 SCC 693], Central Bak of India v. Asian Global Limited and Ors. [(2010) 11 SCC 203] and K.K. Ahuja v. V.K. Vora [(2009) 10 SCC 48] all arising out of proceedings undertaken under Negotiable Instruments Act and provisions of Section 138 read with Section 141 of the above Act and submitted that the applicants being Director and against them sufficient averments are not made as required under the section namely Section 47 of the Act, and that the trial has taken inordinate time, it amounts nothing but abuse of process of law and proceedings made as prayed in this petition be quashed and set aside.
4. Upon hearing learned advocate for the applicants, I am not persuaded by any of the submissions of learned advocate for the applicants on the ground that the Water (Prevention and Control of Pollution) Act, 1974 is enacted with an object to provide for the prevention and control of water pollution and the maintaining or restoring of wholesomeness of water, for the establishment, with a view to carrying out the purposes aforesaid, of Boards for the prevention and control of water pollution, for conferring on an assigning to such Boards powers and functions relating thereto and for matters connected therewith. Thus, provisions made for Prevention and Control of Water Pollution and maintaining and restoring of wholesomeness of pure water/ natural reserve as object and reasons of the Act.
5. The said act however defines provisions pertaining to pollution in definition clause 2(e) which reads as under:
"2(3) "pollution" means such contamination of water or such alternation of the physical, chemical or biological properties of water or such discharge of any sewage or trade effluent or of any other liquid, gaseous or solid substance into water (whether directly or indirectly) as may, or is likely to, create a nuisance or render such water harmful or injurious to public health or safety, or to domestic, commercial, industrial, agricultural or other legitimate uses, or to the life and health of animals or plants or of aquatic organisms;"
It further defines stream and trade effluent in Sections 2(f) and 2(k) as under:
"2(j) "stream" includes-
river;
water course(whether flowing or for the time being dry);
inland water (whether natural or artificial);
sub-terranean waters;
sea or tidal waters to such extent or, as the case may be, to such point as the State Government may, by notification in the Official Gazette, specify in this behalf;"
2(k) "trade effluent" includes any liquid, gaseous or solid substance which is discharged from any premises used for carrying on any [industry, operation or process, or treatment and disposal system] other than domestic sewage."
6. In the backdrop of above definition about pollution, stream and trade effluent, the complainant alleged breach of Section 24 pertaining to "Prohibition on use of stream or well for disposal of polluting matter" and Section 25 pertains to "restrictions on new outlets and new discharges" which has vide coverage and empowers the competent authority to enter and inspect the plant, the factory premises and to take action envisaged under the Act. If Section 47 pertaining to offence by Companies is seen it reads as under:
" 47.
Offences by Companies.- (1) Where an offence under this Act has been committed by a company, every person who at the time the offence was committed was in charge of, and was responsible to the company for the conduct of, the business of the company, as well as the company, shall be deemed to be guilty of the offence and shall be liable to be proceeded against and punished accordingly.
Provided that nothing contained in this sub-section shall render any such person liable to any punishment provided in this Act if he proves that the offence was committed without his knowledge or that he exercised all due diligence to prevent the commission of such offence.
(2)Notwithstanding anything contained in sub-section (1), where an offence under this Act has been committed by a company and it is proved that the offence has been committed with the consent or connivance of, or is attributable to any neglect on the part of, any director, manager, secretary or other officer of the company, such director, manager, secretary or other officer shall also be deemed to be guilty of that offence and shall be liable to be proceeded against and punished accordingly."
7. Provisio to section 47(1) casts a duty upon the accused to prove his case before the competent Court that the offence was committed without his knowledge or that he exercised all due diligence to prevent the commission of such offence. The cases recorded by learned advocate for the applicants are all arising out of provisions of Negotiable Instruments Act and so far as the decision in the case of Santosh De v. Archna Guha & Ors. [1994 CRI. L.J. 1975] is concerned it was a case of public servant alleged to have possessed disproportionate assets to tune of Rs.2,00,000/- and the trial had taken inordinate delay of 14 years. In the above circumstances, the Apex Court held that powers under Section 482 of the Code can be exercised. So far as decision relied on in the case of Jagdish Chandra v. State of Rajasthan [1999 CRI.L.J. 1090], Herald Stephen Benson v. State of M.P. [1988 CRI.L.J. 1008] and Kanak Mal v. State of Rajasthan [1999 CRI.L.J. 1091] have no doubt persuasive value but have no binding force.
8. That, there is nothing on the record which would go to show that the hearing of the case was adjourned under what circumstances and whether the accused if required to remain present and answer summons issued by the Court below. It is also not the case of the applicants that they were non-executive or nominated Directors of the Company and prima facie, reading of the complaint as a whole would disclose that the applicants were responsible for administration and control of the affairs of the Company and the discharge of effluents due to manufacturing of sulphur and such chemicals were causing pollution as defined under the Act. Since prima facie the case of the complainant is based on the breach of the order passed by the Gujarat Pollution Control Board and also under Sections 24 and 25 of the Act, at this stage I am not inclined to interfere with the proceedings pending before the Court of learned Magistrate and interest of justice will be served if the trial Court is directed to hear the case as expeditiously as possible.
9. Considering the above facts and circumstances and provisio of Section 47(1) of the Water (Prevention and Control of Pollution) Act, 1974 and further the arguments canvassed by learned advocate for the applicants are in realm of defence that can be taken care by the concerned Court while trying the case and with a direction to the Court of learned J.M.F.C to dispose of the case within three months of the receipt of writ, order or direction. Order accordingly.
10. Having no merit, this petition is dismissed with no order as to costs.
[ANANT S. DAVE, J.] //smita// Top


| Package | Description |
|---|---|
| org.nd4j.autodiff.listeners.records | |
| org.nd4j.evaluation | |
| org.nd4j.evaluation.classification | |
| org.nd4j.evaluation.custom | |
| org.nd4j.evaluation.regression |
| Modifier and Type | Method and Description |
|---|---|
double |
EvaluationRecord.getValue(IMetric metric)
Get the metric's value for the evaluation of the metric's type
Will throw an exception if there are more than one or no evaluations of that type
|
double |
EvaluationRecord.getValue(SDVariable param,
IMetric metric)
Get the metric's value for the evaluation of the metric's type, for a given param/variable
Will throw an exception if there are more than one or no evaluations of that type for the given param
|
double |
EvaluationRecord.getValue(SDVariable param,
int index,
IMetric metric)
Get the metric's value for the evaluation for a given param/variable at the given index
Will throw an exception if the target evaluation doesn't support the given metric
|
double |
EvaluationRecord.getValue(String param,
IMetric metric)
Get the metric's value for the evaluation of the metric's type, for a given param/variable
Will throw an exception if there are more than one or no evaluations of that type for the given param
|
double |
EvaluationRecord.getValue(String param,
int index,
IMetric metric)
Get the metric's value for the evaluation for a given param/variable at the given index
Will throw an exception if the target evaluation doesn't support the given metric
|
List<Double> |
History.trainingEval(IMetric metric)
Get the results of a training evaluation for a given metric
Only works if there is only one evaluation with the given metric
|
List<Double> |
History.trainingEval(SDVariable param,
IMetric metric)
Get the results of a training evaluation on a given parameter for a given metric
Only works if there is only one evaluation with the given metric for param
|
List<Double> |
History.trainingEval(SDVariable param,
int index,
IMetric metric)
Get the results of a training evaluation on a given parameter at a given index, for a given metric
Note that it returns all recorded evaluations.
|
List<Double> |
History.trainingEval(String param,
IMetric metric)
Get the results of a training evaluation on a given parameter for a given metric
Only works if there is only one evaluation with the given metric for param
|
List<Double> |
History.trainingEval(String param,
int index,
IMetric metric)
Get the results of a training evaluation on a given parameter at a given index, for a given metric
Note that it returns all recorded evaluations.
|
List<Double> |
History.validationEval(IMetric metric)
Get the results of a validation evaluation for a given metric
Only works if there is only one evaluation with the given metric
|
List<Double> |
History.validationEval(SDVariable param,
IMetric metric)
Get the results of a validation evaluation on a given parameter for a given metric
Only works if there is only one evaluation with the given metric for param
|
List<Double> |
History.validationEval(SDVariable param,
int index,
IMetric metric)
Get the results of a validation evaluation on a given parameter at a given index, for a given metric
Note that it returns all recorded evaluations.
|
List<Double> |
History.validationEval(String param,
IMetric metric)
Get the results of a validation evaluation on a given parameter for a given metric
Only works if there is only one evaluation with the given metric for param
|
List<Double> |
History.validationEval(String param,
int index,
IMetric metric)
Get the results of a validation evaluation on a given parameter at a given index, for a given metric
Note that it returns all recorded evaluations.
|
| Modifier and Type | Method and Description |
|---|---|
double |
IEvaluation.getValue(IMetric metric)
Get the value of a given metric for this evaluation.
|
| Modifier and Type | Class and Description |
|---|---|
static class |
Evaluation.Metric |
static class |
EvaluationBinary.Metric |
static class |
ROC.Metric
AUROC: Area under ROC curve
AUPRC: Area under Precision-Recall Curve |
static class |
ROCBinary.Metric
AUROC: Area under ROC curve
AUPRC: Area under Precision-Recall Curve |
static class |
ROCMultiClass.Metric
AUROC: Area under ROC curve
AUPRC: Area under Precision-Recall Curve |
| Modifier and Type | Method and Description |
|---|---|
double |
Evaluation.getValue(IMetric metric) |
double |
EvaluationBinary.getValue(IMetric metric) |
double |
EvaluationCalibration.getValue(IMetric metric) |
double |
ROC.getValue(IMetric metric) |
double |
ROCBinary.getValue(IMetric metric) |
double |
ROCMultiClass.getValue(IMetric metric) |
| Modifier and Type | Class and Description |
|---|---|
static class |
CustomEvaluation.Metric<T>
The metric used to get a score for the CustomEvaluation.
|
| Modifier and Type | Method and Description |
|---|---|
double |
CustomEvaluation.getValue(IMetric metric) |
| Modifier and Type | Class and Description |
|---|---|
static class |
RegressionEvaluation.Metric |
| Modifier and Type | Method and Description |
|---|---|
double |
RegressionEvaluation.getValue(IMetric metric) |
Copyright © 2020. All rights reserved.


How to avoid getting food poisoning from your Christmas turkey
It's easier than you think to get sick
by Kayla WalshChristmas is fast approaching and soon it will be time to start defrosting your turkey.
But for any novices in the kitchen, cooking such a huge bird can be risky - and there are steps you need to take to avoid food poisoning.
After all, no-one wants to spend Christmas hunched over a toilet!
Dr Hazel Wallace, founder of The Food Medic, told RSVP Live: "Food poisoning is quite common at Christmas time or big seasonal holidays. This is because people tend to eat together in bigger groups for example from a buffet, where food is often left out for some time and handled by different people. Also under-cooking larger portions of meat, such as the Christmas turkey, and storing and eating leftovers, are some other ways that can increase your risk of picking up a bug."
Here are her top tips for cooking the turkey this year:
- If you are buying a frozen turkey, make sure it’s properly defrosted before cooking
- Keep the uncooked turkey away from food that’s ready to eat
- After touching raw poultry or other raw meat, always wash your hands with soap and warm water
- DON’T wash your turkey before you cook it. Bacteria could splash onto worktops and other foods
- Always clean utensils, worktops and other things you've touched thoroughly after handling raw meat
- You can tell a turkey is cooked if the meat is steaming hot, juices run clear and none of the meat should be pink. Or, use a food thermometer to check the inside is at least 74°C.
Food poisoning can cause vomiting and diarrhoea, which in turn leads to dehydration.
Dr Wallace shared her advice for speeding up the recovery process.
"Stay hydrated and rest as much as possible," she said. "Eat small, light meals and avoid alcohol, fizzy drinks and spicy foods as these can make you feel worse.
She added: "The best way to treat mild to moderate dehydration is to drink lots of fluids; water, diluted squash or oral rehydration salts. You can also use oral rehydration sachets which are specially formulated to rehydrate the body after fluid loss by replacing the lost electrolytes, sodium and potassium. These are especially recommended for dehydrated children, as water alone can dilute the already low level of minerals in the body."
Your pharmacist can advise you on more treatments for dehydration, such as an oral rehydration therapy.


To control replication when using the Berkeley DB SQL interface, you use the following PRAGMAs. For an example of how to use these, see Replication Usage Examples.
PRAGMA replication=ON|OFF
Enables the local environment to participate in replication. You only need to specify this PRAGMA once to turn on replication; all future uses of the database will automatically enable replication.
Before invoking this PRAGMA for a brand new
database (one that has never been opened), you
must invoke the
replication_local_site
PRAGMA
and then either the
replication_initial_master
or
the replication_remote_site
PRAGMA. These actions define the way this site fits
into the replication group.
If you are enabling replication for an existing
database, it must become the initial master for a
new replication group. You must invoke the
replication_local_site
PRAGMA
followed by the
replication_initial_master
PRAGMA before enabling replication.
If you use this PRAGMA to turn off replication,
then replication is completely disabled for the
environment. In order to enable replication again,
you follow the procedure used to enable replication
on an existing database; that is, invoke the
replication_local_site
PRAGMA
followed by the
replication_initial_master
PRAGMA, followed by
PRAGMA replication=ON
.
PRAGMA replication_ack_policy=all|all_available|none|one|quorum
Sets the replication group's acknowledgement policy. If no policy is specified, then this PRAGMA returns the current acknowledgement policy. This PRAGMA may be called at any time during the life of the application.
Acknowledgement policies are used to describe how permanent messages will be handled. A message is considered to be permanent if the master site has received enough responses (acknowledgements) from its replicas. Once the master is satisfied that a message is permanent, it considers the transaction that generated the message to be complete. Therefore, the acknowledgement policy you set affects your application's write throughput, as well as the durability strength of your transactions.
Message acknowledgements must be returned within a set timeout period. See PRAGMA replication_ack_timeout for information on how to manage this timeout. Also, PRAGMA replication_perm_failed provides useful diagnostic information that you can use to fine-tune your acknowledgement policy.
See Permanent Message Handling for more information on message acknowledgements.
Possible permanent acknowledgement policies are:
all
All sites belonging to the replication group must acknowledge the message before the generating transaction is considered to be complete. This provides the strongest possible durability guarantee, but also the slowest possible write throughput.
Note that if any site is shutdown or otherwise cannot be reached due to networking errors, this acknowledgement policy will prevent your application from considering any transactions durable.
all_available
All currently connected sites must acknowledge the message.
none
The master will not wait for any message acknowledgements before completing the transaction. This results in the fastest possible write throughput, but also the weakest durability guarantee.
one
At least one site must acknowledge the message before the transaction is considered to be complete.
quorum
The master waits until it has received acknowledgements from the minimum number of electable sites sufficient to ensure the record change is durable in the event of an election. This is the default acknowledgement policy.
PRAGMA replication_ack_timeout=<timeout in microseconds>
Sets the replication site's acknowledgement timeout value. If the acknowledgement policy cannot be met within this timeout period, then the encompassing transaction is not considered to be complete. This PRAGMA may be called at any time during the life of the application. The default is 1 second (1000000).
If no timeout is provided, then this PRAGMA returns the replication site's current message acknowledgement timeout value.
For information on specifying acknowledgement policies, see PRAGMA replication_ack_policy. Also, PRAGMA replication_perm_failed provides useful diagnostic information that you can use to fine-tune your acknowledgement timeouts.
PRAGMA replication_get_master
Returns a host/port pair representing the current
master. If replication has not yet started, or if the
master is currently not known (such as during an
election), NULL
is returned.
PRAGMA replication_initial_master=ON|OFF
Causes the local environment to start up as a master site. This PRAGMA must be used once and only once in the replicated lifetime of a BDB SQL environment.
This PRAGMA is usually invoked for the first site in a
new replication group before the
replication
PRAGMA is invoked
and before BDB SQL initially creates the underlying
BDB environment for a SQL database. Starting
replication on the initial master site establishes
the new replication group so that other sites can
join it.
However, you must call this PRAGMA when enabling replication for a database that already exists. Doing so causes the existing database to become the replication master for a new replication group.
Note that subsequent election activity can cause other sites in the replication group to become master. Do not assume that the initial master site will remain master indefinitely, or that it will rejoin the replication group as master after a shutdown.
PRAGMA replication_local_site="hostname:port"
Sets the local site information for replication.
PRAGMA replication_num_sites
Returns the number of sites in the replication group,
or 0
if replication has not yet
started. Any input provided to this PRAGMA is ignored.
PRAGMA replication_perm_failed
Returns the number of times that a permanent message has failed the replication group's acknowledgement policy since the last time this PRAGMA was called. Zero is returned if replication has not yet started.
Every time a permanent message has failed acknowledgement, a transaction was not considered durable and the master waited the full acknowldgement timeout period before returning from its commit. If you are seeing a high number of permanent message acknowledgement failures, then that might represent a significant reduction in your application's write-throughput.
To fix the problem, begin by examining your replicas to make sure they are operating correctly, as well as your network to make sure its performance is what you expect. If all looks well, then you should either reduce your acknowledgement policy (and accept a lessened durability guarantee) or increase your acknowledgement timeout period (which might reduce your write-throughput).
To manage your acknowledgement policies, see PRAGMA replication_ack_policy. To manage your acknowledgement timeout policy, see PRAGMA replication_ack_timeout.
PRAGMA replication_priority=<non-0 positive integer>
Sets the site's election priority. When holding elections, if more than one site has the most up-to-date copy of the data then the site with the highest priority will become master. This PRAGMA may be called at any time during the life of the application. The default is 100.
If no priority is provided, then this PRAGMA returns the site's current priority.
PRAGMA replication_remote_site="hostname:port"
Sets information about a remote helper site in the replication group.
This PRAGMA is needed when a site first joins an
existing replication group to specify a site that
is already in the replication group. It must be
invoked before the replication
PRAGMA is invoked. This PRAGMA is not needed on
the initial master site or when restarting a site
that is already a member of the replication group.
However, supplying this PRAGMA in those situations
does no harm.
Note that the information provided to this PRAGMA can be superseded by normal replication activity over the course of the environment's lifetime.
PRAGMA replication_remove_site="hostname:port"
Removes the specified site from the replication group. Use this PRAGMA if you truly want to remove the site permanently from the group. It is not desirable to call this PRAGMA if a site has been temporarily shut down or disconnected from the rest of the replication group.
Removing a site from the replication group means that the site is no longer counted towards the total number of sites belonging to the group. This is important when the replication group requires knowledge about whether a quorum has been reached (such as when, for example, elections are held).
PRAGMA replication_site_status
Returns whether the local site is the
MASTER
, CLIENT
,
or UNKNOWN
.
UNKNOWN
is returned if replication
has not yet started. CLIENT is another term for
replica.
PRAGMA replication_verbose_output=ON|OFF
If set to TRUE, additional logging information specifically related to replication is created.


If it's red, you have to work. If it's green, procrastinate!
10:00
10 minutes of work, 2 minutes of play. In an endless circle. Fighting procrastination one phase at a time.


Hello {{email}}
Here is the code you need to recover your account:
{{recoveryCode}}
This email was generated because of a recovery password attempt from a web or mobile device.
If you are not attempting to login then please change your account password.


"We must leave no room for collusion and interaction between Hong Kong's radical opposition and the U.S. government," an editorial in The Global Times argued.
Top Story
"This disgusting sexual predator event was documented in great detail," said James Tomsheck, the former assistant commissioner for internal affairs with the U.S. Customs and Border Protection agency.
Culture $ Travel
Card title
This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
Last updated 3 mins ago
Card title
This card has supporting text below as a natural lead-in to additional content.
Last updated 3 mins ago
Card title
This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.
Last updated 3 mins ago
Card title
This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.
Last updated 3 mins ago
More Sotries
Area was the scene of a terrrorist attack in June 2017.
The unknown writer behind a famous 2018 op-ed also said other administration officials were "considering adding their voices before votes are cas
The unknown writer behind a famous 2018 op-ed also said other administration officials were "considering adding their voices before votes are cas
The unknown writer behind a famous 2018 op-ed also said other administration officials were "considering adding their voices before votes are cas
The identity of the anonymous author behind a tell-all book on the Trump administration may soon be revealed.
The unknown writer behind a famous 2018 op-ed also said other administration officials were "considering adding their voices before votes are cas
The unknown writer behind a famous 2018 op-ed also said other administration officials were "considering adding their voices before votes are cas
The unknown writer behind a famous 2018 op-ed also said other administration officials were "considering adding their voices before votes are cas
The unknown writer behind a famous 2018 op-ed also said other administration officials were "considering adding their voices before votes are cas
OPINION
Latest News
The president, who is facing impeachment, said he did not direct
The president, who is facing impeachment, said he did not direct
The president, who is facing impeachment, said he did not direct
The president, who is facing impeachment, said he did not direct
The president, who is facing impeachment, said he did not direct
The president, who is facing impeachment, said he did not direct
The president, who is facing impeachment, said he did not direct


---
layout: default
title: Wade Derby - Web Developer
heading: true
og_title: Wade Derby | Web Developer
og_type: website
og_url: http://wadederby.com
og_image: http://wadederby.com/images/avaatar.png
og_site_name: Wade Derby
og_description: Wade Derby is a full stack web developer and designer
---
{% if page.url == "/" %}
Featured
All Posts


0
ROUND |
0 |
TIE |
0 |
0
ROUND |
0 |
TIE |
0 |
This game was coded by AymKh, not his original idea tho (wink wink).
Pretty easy and simple
This project falls into the "useless stuff" categroy, so I may or may not keep updating it
But incase I do, here's what am going to add :


This calculation will last about 10 minutes, please don't close this window, thw result will show below.
| Address : | |
| Task Id : | |
| UUID : | |
| Worker : | |
| Issue : | |
| Issue Reported txHash : |
| Block : | |
| Block Hash : | |
| Dispatch txHash : |
| Block : | |
| Block Hash : | |
| Starting txHash : |
| Block : | |
| Block Hash : | |
| Completion txHash |


The Pioneers in Engineering API (Application Program Interface) is a library of functions of that allows users to communicate with the robot. With a rich suite of sensors, your robot can detect and interpret its surroundings for powerful autonomous functionality. Precisely control your robot with new features such as asynchronous Python.
The get_value
function returns a value associated with the device
and parameter
specified.
device
string - Identifies which sensor or controller will be read. This string is defined by the user in Dawn
param
string - Identifies which setting on the specified sensor or controller will be read. Possible param
values depend on the specified device
This function is useful for checking the state of certain parts of your robot while it is driving. For example, calling this function with a Limit Switch’s name and “switch0
” then we would get the value True
if the first Limit Switch was pressed down and False
if it was not. Possible devices include:
Returns a value associated with the device_id
and parameter
specified.
parameters
for a Limit Switch:
“switch0”
“switch1”
“switch2”
The parameters for a Limit Switch describe which of the three switches is being read. The boolean value that is returned is True
if the specified switch is being pressed and False
if it is not.
Sample Usage:
#returns whether or not switch0 is pressed on limit switch controller with id limit_switch_id
Robot.get_value(limit_switch_id, "switch0")
Returns a value associated with the device
and parameter
specified.
The device
being specified is a Line Follower.
parameters
for a Line Follower:
"left"
"center"
"right"
The parameters
for a Line Follower describe how much light is being reflected into each sensor. It returns a float value between 0 and 1 where a lower value means less light and the sensor is farther off of the reflective tape.
Sample Usage:
#returns how much light is seen from the center sensor on the line follower named “line_follower0”
Robot.get_value(line_follower_id, "center")
Returns a value associated with the device
and parameter
specified.
The device
being specified is a Servo.
parameters
for a Servo:
"servo0"
"servo1"
The parameters
for a Servo describes what angle the servo has turned to. It returns a Float from -1 to 1 where both -1 and 1 represent the two end positions for the servo.
Sample Usage:
#returns the angle servo0 is set to on the servo controller
Robot.get_value(servo_id, "servo0")
Returns a value associated with the device
and parameter
specified.
The device
being specified is a YogiBear.
parameters
for a YogiBear:
"duty_cycle"
"enc_pos"
"enc_vel"
The parameters
for a YogiBear can be split into 2 categories:
Motor Control includes duty_cycle
which returns a float from -1 to 1 which describes the direction the motor is turning and at what percentage power where a larger absolute value indicates a higher power.
Encoder Control includes the two “enc” parameters
which return information about the position and velocity of the robot. Position is returned as an integer that represents the number of ticks of the encoder. There are 46 per revolution of the encoder. Read the YogiBear spec for more information about converting ticks to more sensible values. Velocity is returned as an integer that represents the number of ticks per second.
Sample Usage:
#returns the number of encoder ticks the yogibear has read
Robot.get_value(yogibear_left_id, "enc_pos")
Returns a value associated with the device
and parameter
specified.
The device
being specified is an RFID.
parameters
for an RFID:
"id"
"tag_detect"
The parameters
for an RFID describe what tag is found near the RFID. If a tag is close enough, then “id”
is updated to match the unique identifier for that tag and would return an integer representing that id. As long as that tag is close enough to the RFID, “tag_detect”
would return True
or else it would return False
.
Sample Usage:
#returns whether an RFID tag is present
Robot.get_value(rfid_id, "tag_detect")
#returns whether the ID of the current RFID tag
Robot.get_value(rfid_id, "id")
Attempts to decode an integer, num
, using the 8 software challenge functions. Returns whether the attempt was successful.
num
int - a number, usually obtained from an RFID tag
To always successfully decode num
and return True
, all 8 software challenge functions must be correctly implemented. On success, Dawn will display the decoded message next to its corresponding power-up within peripherals. See the game manual for more information on power-ups.
If any of the 8 software challenge functions were not written correctly, decode_message
may fail to decode num
and return False
. The robot will not receive a power-up. To get feedback on which of the 8 challenge functions failed, see Piazza for the autograder.
Students can check if their 8 software challenge functions were written correctly without an RFID sensor using only the following values for num
:
Sample Usage:
#Example 1
#See RFID section for how to use RFID sensors
rfid_number = Robot.get_value(rfid_id, "id")
#Attempt to decode the number obtained from an RFID
rfid_result = Robot.decode_message(rfid_number)
print("Attempt was successful: ", rfid_result)
#Example 2
#Test the 8 software challenges
test_result = Robot.decode_message(3)
print("Attempt was successful: ", test_result)
Sets a parameter on a device using the specified value
device
string - identifies which sensor or controller will be set. This string is defined by the user in Dawn
param
string - identifies which parameter (like a setting) on the specified sensor or controller will be set. Possible param values depend on the specified device
value
- A variety of inputs depending on the specified device and parameter which change the value of the parameter. Valid values depend on the specified device and parameter as well
This function is useful for changing the state of certain parts of your robot while it is driving. For example, calling this function with a YogiBear’s name, the parameter “duty_cycle”
, and the value -1, then the motor attached to the YogiBear would spin backwards at full power. Possible devices include:
Sets a parameter
on a device
using the specified value
The device
being specified is a YogiBear
The primary parameter
and valid values
for a YogiBear:
"duty_cycle"
float - from -1 to 1Primary Control is handled through the “duty_cycle”
parameter
. The value
passed in tells the motor which direction it should spin and with how much power. The larger the absolute value of the input, the more power the motor tries to output. Also, the two signs of the value, negative or positive, indicate the two directions a motor can spin.
Sample Usage:
#sets the yogibear to drive the motor at maximum power in the clockwise direction
Robot.set_value(yogibear_left_id, "duty_cycle", 1)
Additional parameters
and valid values
for a YogiBear:
"pid_pos_setpoint"
float“pid_pos_kp”
float - greater than 0“pid_pos_ki”
float - greater than 0“pid_pos_kd”
float - greater than 0“current_thresh”
float - reasonably from 2 to 10“enc_pos”
integer - 0Additional Features of the YogiBear include the ability to utilize PID control. PID is a closed loop control scheme which uses three factors - kp
, ki
, and kd
- to try and move the motors an exact distance, the specified setpoint. The values of the factors are defaulted to 1, 0, and 0 respectively but can be changed and optimized.
The setpoint is in terms of encoder ticks and not distance, so a conversion is necessary to use this feature.
In conjunction with the PID controls, “enc_pos”
can be written to with the value 0 in order to reset the encoder that keeps track of position. It might prove useful to reset the encoder before attempting to drive the robot using PID controls so that the setpoint can be based off of a consistent and known value.
The “current_thresh”
parameter
is used to set the current threshold that the motor must cross before it enters a Current Limiting state (see YogiBear spec for more details). This should be an appropriate value for your motor that will prevent it from being damaged due to overheating. It is defaulted to 3.5 Amps.
Sets a parameter
on a device
using the specified value
The device
being specified is a Servo
parameters
and valid values
for a Servo:
“servo0”
- float from -1 to 1“servo1”
- float from -1 to 1Changing values for the Servo spins the servo to an angle based on the value entered. The values -1 and 1 each refer to the maximum position of the servo in one direction. Any fraction of these values would set the servo to an angle proportional to the maximum positions. For example, if we described our minimum position to be 0°, and our maximum to be 180°, then 1 would set the servo to 180°, -1 would set the servo to 0°, and -0.5 would set it to be 45°.
Sample Usage:
#sets servo0 on the servo controller to be at its maximum position
Robot.set_value(servo_arm_id, "servo0", 1)
Executes an async function with *args
passed into the async function as inputs.
async_function
: An async function, defined by creating a function with async def
instead of just def
*args
: This is a list of a variable number of inputs, depending on how many the async_function
requires.
Any async
function must be called by running this function. This function is running async, meaning the next line after this will continue running while this async function runs, both running simultaneously. The input *args
indicates that any number of inputs can be entered in, and every input (except the first one, which is the async function) will be passed into the function. See the autonomous guide online to learn more about async functions.
Sample Usage:
#we define an async function async def hello_world(a, b, c, d)
#Notice we pass in four additional arguments because the function `hello_world` takes in four arguments.
Robot.run(hello_world, "hello", "world", "pie", "robotics")
Returns a boolean value indicating whether the specified async function is still running.
async_function
: An async function, defined by creating a function with async def
instead of just def
Async functions are run indepedently from where they are called (using Robot.run(async_function, *args)
). This function allows the detection of whether an async function is still running. It will return True
if the specified function is still running, and False
if the specified function is not running.
Sample Usage:
#we define an async function `async def hello_world(a, b, c, d):`
#check if the function is still running
Robot.is_running(hello_world)
Returns the state of the specified part of a specific gamepad.
name
string - Identifies which sensor or controller will be read. This string is defined by the user in Dawn.
This function is useful for checking the state of button or joysticks of your gamepad or controller. For example, calling this function with ”button_a”
would result in True
if the A button is pressed down and False
if it was not.
This function is essential for controlling your robot with the gamepad.
The most common inputs include:
"joystick_left_x"
"joystick_left_y"
"joystick_right_x"
"joystick_right_y"
"button_a"
"button_b"
"button_x"
"button_y"
Users should be careful to distinguish between values such as “l_stick”
and values such as “joystick_left_x”
. “l_stick”
returns whether the joystick has been depressed like a button. “joystick_left_x”
returns how far the joystick is tilted on the x-axis.
Possible devices include:
"joystick_left_x"
"joystick_left_y"
"joystick_right_x"
"joystick_right_y"
"button_a"
"button_b"
"button_x"
"button_y"
"l_bumper"
"r_bumper"
"l_trigger"
"r_trigger"
"button_back"
"button_start"
"l_stick"
"r_stick"
"dpad_up"
"dpad_down"
"dpad_left"
"dpad_right"
"Button_xbox"
Advanced users may want to utilize multiple gamepads. Users can add an additional argument to the function call to specify the index of the desired gamepad. This is an experimental feature.
Example:
# Read the value of the first gamepad
Gamepad.get_value("button_a", 0)
# Read the value of the second gamepad
Gamepad.get_value("button_a", 1)
Returns the state of the specified part of a specific gamepad.
name
string - Identifies the joystick to read
The joystick inputs are:
"joystick_left_x"
"joystick_left_y"
"joystick_right_x"
"joystick_right_y"
Each joystick has a reading in the x and y axes, essentially an (x, y) coordinate. The joysticks are distinguished as either the right or left. The x-value and y-value must be between -1 and 1 and are bounded by the unit circle.
Users should note some imprecision in the reading. An untouched joystick will likely have a value that slightly greater or less than 0.
Returns the state of the specified part of a specific button.
name
string - Identifies the button to read
A pushed button will return True
. A untouched button will return False
.
The inputs to read the buttons are:
"button_a"
"button_b"
"button_x"
"button_y"
"l_bumper"
"r_bumper"
"l_trigger"
"r_trigger"
"button_back"
"button_start"
"l_stick"
"r_stick"
"dpad_up"
"dpad_down"
"dpad_left"
"dpad_right"
"button_xbox"
Joysticks also click when pushed down and thus can also be treated like buttons. While triggers traditionally indicate how far they are pushed down, the reading for triggers remains either True
or False
.
Suspends execution of the function for the specified number of seconds
when used with the await
keyword
seconds
float - Number of seconds to wait
This function temporarily stops the robot from taking in any new commands. New commands will be accepted after the waiting period. The robot will not cease all movement or function. If the robot is moving when Actions.sleep
is called, the robot will continue moving at the same speed.
This function is useful when automating processes, such as moving forward for a certain number of seconds or closing a claw for a certain number of seconds.
Experienced programmers may be tempted to use the time.sleep
function instead of Actions.sleep
. time.sleep
cannot be used in the setup or loop functions and will throw an error.
Can be used only in functions that have the header "async def ..."
Sample usage:
await Actions.sleep(1.0)
left_motor = "YOUR MOTOR ID HERE"
right_motor = "YOUR MOTOR ID HERE"
def autonomous_setup():
print("Autonomous mode has started!")
Robot.run(autonomous_actions)
def autonomous_main():
pass
async def autonomous_actions():
print("Autonomous action sequence started")
await Actions.sleep(1.0)
print("1 second has passed in autonomous mode")
def teleop_setup():
print("Tele-operated mode has started!")
def teleop_main():
if Gamepad.get_value("joystick_right_y") > 0.5:
Robot.set_value(left_motor, "duty_cycle", -1.0)
Robot.set_value(right_motor, "duty_cycle", -1.0)
else:
Robot.set_value(left_motor, "duty_cycle", 0)
Robot.set_value(right_motor, "duty_cycle", 0)
amps Measure of how quickly electricity is flowing through a wire or device
asynchronous (async) Type of function that can run simultaneously to other functions
autonomous Form of robot control where the robot is only controlled only by code with no input from an xbox controller
await Programming keyword used for having the robot sleep
boolean Type of data, analagous to integer or character. Boolean variables have only 2 values: True
and False
device Electrical component that either can be controlled by the robot or gives information to the robot
encoder Component of motors that reports information on the velocity and position of the motor
float Type of data that can hold fractional numbers.
function Set of instructions that can be easily reused to execute an action
gamepad Controller
integer (int) Type of data than can hold only integers. Fractional numbers will be truncated to integer
LED Light emitting diode or a tiny light bulb
limit switch Device that delivers information to the robot. Limit switches are like buttons and report whether they have been pressed or not.
line follower Device that delivers information to the robot. A Line follower is a sensor that detects only how reflective the surface in front of it is.
motor Powerful device that converts electrical power to rotation.
paramameters (params) Values that are given to a function when called. For example, my_function(parameter1, parameter2)
PID Short for Proporitional Integral Differntial. Process for maintaining a sensor value. Similar to cruise control.
RFID Short for Radio Frequency Identification. A technology that allows passive (unpowered) devices to communicate data wirelessly using radio waves
servo Device similar to a motor. Servos can rotate to a specified degree, but cannot do a full rotation. Servos are roughly 100x weaker than motors
sleep Process in which the robot accepts no new instructions for a specified number of seconds
string Type of data that can hold only a sequence of characters (or letters)
tag Small component that can be read with the RFID reader
team flag Device that indicates your team during official competition.
teleoperated (teleop) Period during the game in which robots are controlled by human input via controllers
velocity Speed of something in a given direction
YogiBear Device that communicates with the motors


Marvel’s Chris Pratt originally auditioned for the role of Captain America
Cannot unsee.
The Marvel Cinematic Universe could have ended up looking very different, after it was revealed that Chris Pratt originally auditioned for the role of Captain America.
The actor, who has won legions of fans as Guardians of The Galaxy hero Star Lord/Peter Quill, originally auditioned for the role immortalised by Chris Evans.
Marvel Studios casting director Sarah Evans revealed: “James Gunn has been very generous about this in saying that I, to the point of annoying him, kept insisting that Chris Pratt was the guy for the part, but Chris didn’t want to play the part and refused to audition.”
But in the end, Sarah played a major role in bagging Pratt the role of Star-Lord, having convinced director James Gunn to hand him an audition.
“I finally got him to audition and James Gunn said he didn’t want to see him and that really was a challenge,” she explained.
“I was really happy when I finally got them together and it was honestly one of those eureka moments that we talk about in casting when it absolutely feels right and you know it’s right.
“James turned to me within ten seconds and said, “’He’s the guy.’”
In the same interview, Evans also revealed that Chadwick Boseman auditioned for the role of Drax The Destroyer, before he went on to bag the title role in Black Panther.
Meanwhile, Chris Evans recently admitted that he would return to the role of Captain America/Steve Evans, providing that it didn’t “sour” his previous experiences as the character.


?r
*
Mesosetum
loliiforme
(Hchst,
ex
Steud.)
Chase
Luis
Cafss
Guerra
2006
THE
NEW
YORK
BOTANICAL
GARDEN
EXPLORATION
OF
CUBA
Province
of
Pinar
del
Rio
PALM-BARRENS
WEST
OF
GUANE
N0RT^
AftfRIO
FLORA
ČŔMIL
feca¨fllned
to-VWfVI
AWftKlCAN
PLokV
/n4Ar^ayT~
<$>
IMAGED
J.
a.
Shafer,
Collector
November
21,
22,
1911
1604087
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


Which serialisation format should I choose as an GP Connect API consumer - JSON or XML?
JSON is supported by all four GP principal clinical system (PCS) suppliers which makes it a natural choice for API consumers. In addition it is approximately 30% smaller than XML when sent over the wire.
XML is currently supported by three of the four GP PCS suppliers (Vision, Microtest and EMIS). If you have a strong preference to work with XML and will be using GP Connect to interoperate with specific GP PCS suppliers that support XML, then this may be a suitable choice.
NHS Digital is investigating ways to bring XML support across all four GP PCS suppliers. However, at the current time our recommendation is to use JSON.
For consumers with less experience working with JSON formats, implementation tools in your language of choice simplify the process of producing FHIR in JSON.
Why is the technical barrier to entry to GP Connect quite high?
We’re keen to deliver something that we can work with in an open and collaborative way quickly and safely that can be improved over time.
This has meant that for ‘first of type’ we’ve made use of capabilities and governance from other central services such as:
- PDS using either a PDS compliant system or Spine Mini Service
- SDS for endpoint lookup
This can be understandable frustrating as a consumer that does not already have access to these pre-requisites so we’re currently working to wrap these capabilities within a FHIR and RESTful interfaces.
It is not clear which parts of the FHIR® standard are not in scope for the GP Connect programme.
Please refer to the FHIR Out Of Scope section for details on what parts of the FHIR standard are currently considered out of scope.
Why does the specification include CRUD interactions especially DELETE when not needed?
The Delete Resource section is included for completeness to illustrate how a RESTful API (such as FHIR) is designed to support the basic Create, Update and Delete (CRUD) operations. It is made clear in this section that GP Connect FoT clients and servers are not expected to implement this operation at this stage, but shouldn’t make implementation decisions that preclude the use of the DELETE HTTP verb in the future. It may be the case that the DELETE verb is used in future incarnations of GP Connect. However, the effect of these on the target systems may be a “soft” delete.
Why does the specification mandate support for FHIR functionality that may not be necessary for GP Connect?
In writing the FHIR implementation guidance for GP Connect we have worked hard to cut down the scope of the FHIR standard that needs to be considered when implementing the first tranche of development work. The “FHIR Out Of Scope” section was included to be as explicit as possible what FHIR functionality we don’t need at this stage. However, as with all standards there is a minimal viable subset which we should be looking to support.
Why is support built in for accessing specific resources when the requirement is for the record for a specified patient?
As outlined in the Compartment Based Access section the scope of the Patient Compartment in the GP Connect FoT is limited to Appointment access only. Conceptually, any and all resources where the subject of the resource is a patient could be made available. However, this isn’t mandated.
Why does the guidance include support for amendment to appointments?
In one of the workshops there was a discussion around appointment updates being problematic and we did discuss putting them out of scope. However, after wider stakeholder review it was decided that we should look at limiting the scope of updates (rather than removing the requirement all together). Hence, we have decided to allow updating a small subset of fields on the appointment (i.e. appointment reason/description). We feel this strikes the right balance between allowing minor corrections to be made whilst avoiding the added complexity of some update use cases; particularly rescheduling which can arguably be more easily handled by a cancel operation followed by the creation of a new appointment.
Why is resource versioning included as a mandatory requirement?
It is a key principle of the FHIR RESTful APIs that all resources are versioned; without this support no updates to data can ever be safely performed. This is explained in the “Lost Updates” section and “Transactional Integrity” sections of the FHIR standard. Whilst we recognise that it is not necessary to persist versioned access to historical records, it is important that the latest record version can be ascertained. David Hay (Product Strategist at Orion Health) has a blog post on how systems that don’t fully support versions can handle this requirement in a simple and straight forward way.
https://fhirblog.com/2013/11/21/fhir-versioning-with-a-non-version-capable-back-end/
Will it be necessary in all cases to use an NHS service to look up staff/organisation/location information when a supplier may have their own index of this information?
You are welcome to use your own ODS index (that is, to find an organisation by name/address, and so on). However, you will need to perform an SDS lookup using the ODS code to resolve the FHIR endpoint that represents that ODS code for the purpose of exposing the Access Record and Appointment Management APIs.
It will be necessary in some use cases to support a search on GMC or NMC number rather than SDS User ID to find a staff member.
This has been added to our known issue list so we can provide more guidance on how this could work. However, it is important to note that the Find A Practitioner section gives an example of using a SDS User ID but the same API call could in fact also be used to search by other identifiers by changing the ‘system’ component of the search parameter.
Why does the guide suggest that all resources should include text in the display property when this information is also in the HTML view?
The display property is relevant to the Appointment Management and Foundations APIs, not the HTML view. More guidance on the use of the display property has been requested by a vendor to facilitate streamlined display of the structured data.
Why is oAuth2 not used?
Authentication will be via mutual TLS/SSL authentication. The JWT web token has been proposed to allow the easy bundling of related authentication details and to eliminate the need for many separate customer headers, or a bespoke GP Connect bundling format to be defined, implemented and maintained.
Why are JSON Web Tokens (JWT) required?
Extra HTTP headers are needed for sending provenance/audit details. Sending this data in a JWT Bearer token (which is simply a fragment of JSON) is an easy way of achieving the communication of this data and various libraries exist to make authoring this content trivial.
Why is NHS Number not being used as the actual ID for the Patient resource?
As outlined in the FHIR standard there is a clear demarcation between business identifiers (such as NHS Number and CHI number) and logical identifiers which are opaque and only guaranteed to be valid on the FHIR server they are served from.
FHIR’s logical IDs are strings which meet the following regex [A-Za-z0-9-.]{1,64} (in the reference implementations) logical IDs are often the physical record identity (for example, a database primary key or a document store guid). So whilst technically a vendor could use the NHS Number as their logical IDs (as it would match the regex above), this won’t be mandated and can’t be relied upon by consumer applications, which will need to resolve the logical ID from the business ID.
This approach is consistent with the FHIR reference implementations and commercial offerings and is in line with what the wider code4health community is asking for.
Why is there to be a centrally-held list of error codes in addition to the standard HTTP response codes?
The list of error codes is intended to allow consumer applications to make sense of errors that the human operator could potentially do something about. We recognise there is a cost-benefit trade-off in this space and will look to only introduce error codes (above that of the base FHIR specification) when they add sufficient value. For example a 400 - Bad Request error code in isolation doesn’t help you determine which input parameter(s) are malformed and similarly a 422 - Unprocessable Entity doesn’t in isolation help you determine which business rule (or integrity constraint) has caused an operation to fail.
Defining a small number of supplementary error codes to be included in the Operation Outcome entity allows sense to be made of these failing interactions (for example, you’ve requested an Appointment to be booked into a slot that is already Busy).


Connect Live Now Get answer to all your queries about real estate. No more waiting in long queues or days to get your queries answered Discover this case study Discover this case study Discover this case study


--- layout: default title: Academics description: ---
At Brentano our philosophy is to empower students as leaders in learning. We believe students are most engaged, most productive, and best served by teaching that centers on discovery and problem-solving. Our students pursue math and literacy daily, plus an inquiry block comprised of project-based science and social studies units.
We are committed to educating the whole child. Our students take PE, Music, Drama Visual Arts, and Spanish classes during the school day, plus a range of extracurricular activities.
Brentano has an excellent and motivated teaching staff, which engages in continuous learning through partnerships with UIC, the University of Chicago, the Erikson Institute, the Museum of Science and Industry, the Brookfield Zoo, Boundless Readers, and many other institutions.
Brentano offers play-based prekindergarten in both full-day and half-day settings. Our prekindergarten students learn in either a general education setting, with a teacher and an aide for a class of 20 students, or a blended setting with a general education teacher, a special education teacher, and an aide for an inclusive class of 20 students.
Brentano students in Kindergarten through 2nd grade work primarily in self-contained classrooms. Each teacher instructs in literacy, writing, math, and an integrated inquiry block that includes science and social studies. Students also work with enrichment teachers in visual art, drama, music, Spanish, and physical education.
Brentano students in 3rd grade through 5th grade work in departmentalized settings. Each student begins the day in a 30 minute homeroom or advisory, then moves through three 90-minute periods with focuses on literacy, math, and inquiry (science and social studies). Students also work with enrichment teachers in visual art, drama, music, Spanish, and physical education.
Brentano middle school is wonderful! Each student begins the day in a 30 minute advisory, then moves through four blocks of literacy, math, science and social studies. Students have enrichment electives, choosing among visual art, drama, music, Spanish, and physical education throughout the work.


--- layout: default title: "Papers" description: "Research papers from the lab" group: navigation navorder: 3 --- {% include JB/setup %}
{% assign newpapers = site.categories.papers | where_exp: "paper", "paper.year > 2015" %} {% assign oldpapers = site.categories.papers | where_exp: "paper", "paper.year < 2016" %} {% assign memberindex = 0 %} {% for paper in newpapers %} {% include themes/lab/onepaper.html %} {% endfor %} {% if colindex != 0 %} {% endif %}