pymatgen.core.lattice module¶
-
class
Lattice
(matrix: Union[List[float], List[List[float]], numpy.ndarray])[source]¶ Bases:
monty.json.MSONable
A lattice object. Essentially a matrix with conversion matrices. In general, it is assumed that length units are in Angstroms and angles are in degrees unless otherwise stated.
Create a lattice from any sequence of 9 numbers. Note that the sequence is assumed to be read one row at a time. Each row represents one lattice vector.
Parameters: matrix – Sequence of numbers in any form. Examples of acceptable input. i) An actual numpy array. ii) [[1, 0, 0], [0, 1, 0], [0, 0, 1]] iii) [1, 0, 0 , 0, 1, 0, 0, 0, 1] iv) (1, 0, 0, 0, 1, 0, 0, 0, 1) Each row should correspond to a lattice vector. E.g., [[10, 0, 0], [20, 10, 0], [0, 0, 30]] specifies a lattice with lattice vectors [10, 0, 0], [20, 10, 0] and [0, 0, 30]. -
a
¶ a lattice parameter.
-
abc
¶ Lengths of the lattice vectors, i.e. (a, b, c)
-
alpha
¶ Angle alpha of lattice in degrees.
-
angles
¶ Returns the angles (alpha, beta, gamma) of the lattice.
-
as_dict
(verbosity: int = 0) → Dict[KT, VT][source]¶ “” Json-serialization dict representation of the Lattice.
Parameters: verbosity (int) – Verbosity level. Default of 0 only includes the matrix representation. Set to 1 for more details.
-
b
¶ b lattice parameter.
-
beta
¶ Angle beta of lattice in degrees.
-
c
¶ c lattice parameter.
-
static
cubic
(a: float)[source]¶ Convenience constructor for a cubic lattice.
Parameters: a (float) – The a lattice parameter of the cubic cell. Returns: Cubic lattice of dimensions a x a x a.
-
d_hkl
(miller_index: Union[List[float], numpy.ndarray]) → float[source]¶ Returns the distance between the hkl plane and the origin
Parameters: miller_index ([h,k,l]) – Miller index of plane Returns: d_hkl (float)
-
dot
(coords_a: Union[List[float], numpy.ndarray], coords_b: Union[List[float], numpy.ndarray], frac_coords: bool = False) → numpy.ndarray[source]¶ Compute the scalar product of vector(s).
Parameters: - coords_b (coords_a,) – Array-like objects with the coordinates.
- frac_coords (bool) – Boolean stating whether the vector corresponds to fractional or cartesian coordinates.
Returns: one-dimensional numpy array.
-
find_all_mappings
(other_lattice: pymatgen.core.lattice.Lattice, ltol: float = 1e-05, atol: float = 1, skip_rotation_matrix: bool = False) → Iterator[Tuple[pymatgen.core.lattice.Lattice, Optional[numpy.ndarray], numpy.ndarray]][source]¶ Finds all mappings between current lattice and another lattice.
Parameters: - other_lattice (Lattice) – Another lattice that is equivalent to this one.
- ltol (float) – Tolerance for matching lengths. Defaults to 1e-5.
- atol (float) – Tolerance for matching angles. Defaults to 1.
- skip_rotation_matrix (bool) – Whether to skip calculation of the rotation matrix
Yields: (aligned_lattice, rotation_matrix, scale_matrix) if a mapping is found. aligned_lattice is a rotated version of other_lattice that has the same lattice parameters, but which is aligned in the coordinate system of this lattice so that translational points match up in 3D. rotation_matrix is the rotation that has to be applied to other_lattice to obtain aligned_lattice, i.e., aligned_matrix = np.inner(other_lattice, rotation_matrix) and op = SymmOp.from_rotation_and_translation(rotation_matrix) aligned_matrix = op.operate_multi(latt.matrix) Finally, scale_matrix is the integer matrix that expresses aligned_matrix as a linear combination of this lattice, i.e., aligned_matrix = np.dot(scale_matrix, self.matrix)
None is returned if no matches are found.
-
find_mapping
(other_lattice: pymatgen.core.lattice.Lattice, ltol: float = 1e-05, atol: float = 1, skip_rotation_matrix: bool = False) → Optional[Tuple[pymatgen.core.lattice.Lattice, Optional[numpy.ndarray], numpy.ndarray]][source]¶ Finds a mapping between current lattice and another lattice. There are an infinite number of choices of basis vectors for two entirely equivalent lattices. This method returns a mapping that maps other_lattice to this lattice.
Parameters: - other_lattice (Lattice) – Another lattice that is equivalent to this one.
- ltol (float) – Tolerance for matching lengths. Defaults to 1e-5.
- atol (float) – Tolerance for matching angles. Defaults to 1.
Returns: (aligned_lattice, rotation_matrix, scale_matrix) if a mapping is found. aligned_lattice is a rotated version of other_lattice that has the same lattice parameters, but which is aligned in the coordinate system of this lattice so that translational points match up in 3D. rotation_matrix is the rotation that has to be applied to other_lattice to obtain aligned_lattice, i.e., aligned_matrix = np.inner(other_lattice, rotation_matrix) and op = SymmOp.from_rotation_and_translation(rotation_matrix) aligned_matrix = op.operate_multi(latt.matrix) Finally, scale_matrix is the integer matrix that expresses aligned_matrix as a linear combination of this lattice, i.e., aligned_matrix = np.dot(scale_matrix, self.matrix)
None is returned if no matches are found.
-
classmethod
from_dict
(d: Dict[KT, VT], fmt: str = None, **kwargs)[source]¶ Create a Lattice from a dictionary containing the a, b, c, alpha, beta, and gamma parameters if fmt is None.
If fmt == “abivars”, the function build a Lattice object from a dictionary with the Abinit variables acell and rprim in Bohr. If acell is not given, the Abinit default is used i.e. [1,1,1] Bohr
Example
Lattice.from_dict(fmt=”abivars”, acell=3*[10], rprim=np.eye(3))
-
static
from_lengths_and_angles
(abc: List[float], ang: List[float])[source]¶ Create a Lattice using unit cell lengths and angles (in degrees).
Parameters: - abc (3x1 array) – Lattice parameters, e.g. (4, 4, 5).
- ang (3x1 array) – Lattice angles in degrees, e.g., (90,90,120).
Returns: A Lattice with the specified lattice parameters.
-
static
from_parameters
(a: float, b: float, c: float, alpha: float, beta: float, gamma: float, vesta: bool = False)[source]¶ Create a Lattice using unit cell lengths and angles (in degrees).
Parameters: - a (float) – a lattice parameter.
- b (float) – b lattice parameter.
- c (float) – c lattice parameter.
- alpha (float) – alpha angle in degrees.
- beta (float) – beta angle in degrees.
- gamma (float) – gamma angle in degrees.
- vesta – True if you import Cartesian coordinates from VESTA.
Returns: Lattice with the specified lattice parameters.
-
gamma
¶ Angle gamma of lattice in degrees.
-
get_all_distances
(fcoords1: Union[List[float], numpy.ndarray, List[Union[List[float], numpy.ndarray]]], fcoords2: Union[List[float], numpy.ndarray, List[Union[List[float], numpy.ndarray]]]) → numpy.ndarray[source]¶ Returns the distances between two lists of coordinates taking into account periodic boundary conditions and the lattice. Note that this computes an MxN array of distances (i.e. the distance between each point in fcoords1 and every coordinate in fcoords2). This is different functionality from pbc_diff.
Parameters: - fcoords1 – First set of fractional coordinates. e.g., [0.5, 0.6, 0.7] or [[1.1, 1.2, 4.3], [0.5, 0.6, 0.7]]. It can be a single coord or any array of coords.
- fcoords2 – Second set of fractional coordinates.
Returns: 2d array of cartesian distances. E.g the distance between fcoords1[i] and fcoords2[j] is distances[i,j]
-
get_brillouin_zone
() → List[List[numpy.ndarray]][source]¶ Returns the Wigner-Seitz cell for the reciprocal lattice, aka the Brillouin Zone.
Returns: A list of list of coordinates. Each element in the list is a “facet” of the boundary of the Brillouin Zone. For instance, a list of four coordinates will represent a square facet.
-
get_cartesian_coords
(fractional_coords: Union[List[float], numpy.ndarray]) → numpy.ndarray[source]¶ Returns the cartesian coordinates given fractional coordinates.
Parameters: fractional_coords (3x1 array) – Fractional coords. Returns: Cartesian coordinates
-
get_distance_and_image
(frac_coords1: Union[List[float], numpy.ndarray], frac_coords2: Union[List[float], numpy.ndarray], jimage: Union[List[int], numpy.ndarray, None] = None) → Tuple[float, numpy.ndarray][source]¶ Gets distance between two frac_coords assuming periodic boundary conditions. If the index jimage is not specified it selects the j image nearest to the i atom and returns the distance and jimage indices in terms of lattice vector translations. If the index jimage is specified it returns the distance between the frac_coords1 and the specified jimage of frac_coords2, and the given jimage is also returned.
Parameters: - fcoords1 (3x1 array) – Reference fcoords to get distance from.
- fcoords2 (3x1 array) – fcoords to get distance from.
- jimage (3x1 array) – Specific periodic image in terms of lattice translations, e.g., [1,0,0] implies to take periodic image that is one a-lattice vector away. If jimage is None, the image that is nearest to the site is found.
Returns: distance and periodic lattice translations of the other site for which the distance applies. This means that the distance between frac_coords1 and (jimage + frac_coords2) is equal to distance.
Return type: (distance, jimage)
-
get_frac_coords_from_lll
(lll_frac_coords: Union[List[float], numpy.ndarray]) → numpy.ndarray[source]¶ Given fractional coordinates in the lll basis, returns corresponding fractional coordinates in the lattice basis.
-
get_fractional_coords
(cart_coords: Union[List[float], numpy.ndarray]) → numpy.ndarray[source]¶ Returns the fractional coordinates given cartesian coordinates.
Parameters: cart_coords (3x1 array) – Cartesian coords. Returns: Fractional coordinates.
-
get_lll_frac_coords
(frac_coords: Union[List[float], numpy.ndarray]) → numpy.ndarray[source]¶ Given fractional coordinates in the lattice basis, returns corresponding fractional coordinates in the lll basis.
-
get_miller_index_from_coords
(coords: Union[List[float], numpy.ndarray], coords_are_cartesian: bool = True, round_dp: int = 4, verbose: bool = True) → Tuple[int, int, int][source]¶ Get the Miller index of a plane from a list of site coordinates.
A minimum of 3 sets of coordinates are required. If more than 3 sets of coordinates are given, the best plane that minimises the distance to all points will be calculated.
Parameters: - coords (iterable) – A list or numpy array of coordinates. Can be cartesian or fractional coordinates. If more than three sets of coordinates are provided, the best plane that minimises the distance to all sites will be calculated.
- coords_are_cartesian (bool, optional) – Whether the coordinates are in cartesian space. If using fractional coordinates set to False.
- round_dp (int, optional) – The number of decimal places to round the miller index to.
- verbose (bool, optional) – Whether to print warnings.
Returns: The Miller index.
Return type: (tuple)
-
get_niggli_reduced_lattice
(tol: float = 1e-05) → pymatgen.core.lattice.Lattice[source]¶ Get the Niggli reduced lattice using the numerically stable algo proposed by R. W. Grosse-Kunstleve, N. K. Sauter, & P. D. Adams, Acta Crystallographica Section A Foundations of Crystallography, 2003, 60(1), 1-6. doi:10.1107/S010876730302186X
Parameters: tol (float) – The numerical tolerance. The default of 1e-5 should result in stable behavior for most cases. Returns: Niggli-reduced lattice.
-
get_points_in_sphere
(frac_points: List[Union[List[float], numpy.ndarray]], center: Union[List[float], numpy.ndarray], r: float, zip_results=True) → Union[List[Tuple[numpy.ndarray, float, int, numpy.ndarray]], Tuple[List[numpy.ndarray], List[float], List[int], List[numpy.ndarray]]][source]¶ Find all points within a sphere from the point taking into account periodic boundary conditions. This includes sites in other periodic images.
Algorithm:
place sphere of radius r in crystal and determine minimum supercell (parallelpiped) which would contain a sphere of radius r. for this we need the projection of a_1 on a unit vector perpendicular to a_2 & a_3 (i.e. the unit vector in the direction b_1) to determine how many a_1”s it will take to contain the sphere.
Nxmax = r * length_of_b_1 / (2 Pi)
keep points falling within r.
Parameters: - frac_points – All points in the lattice in fractional coordinates.
- center – Cartesian coordinates of center of sphere.
- r – radius of sphere.
- zip_results (bool) – Whether to zip the results together to group by point, or return the raw fcoord, dist, index arrays
Returns: - [(fcoord, dist, index, supercell_image) …] since most of the time, subsequent
processing requires the distance, index number of the atom, or index of the image
- else:
fcoords, dists, inds, image
Return type: if zip_results
-
get_vector_along_lattice_directions
(cart_coords: Union[List[float], numpy.ndarray])[source]¶ Returns the coordinates along lattice directions given cartesian coordinates.
Note, this is different than a projection of the cartesian vector along the lattice parameters. It is simply the fractional coordinates multiplied by the lattice vector magnitudes.
For example, this method is helpful when analyzing the dipole moment (in units of electron Angstroms) of a ferroelectric crystal. See the Polarization class in pymatgen.analysis.ferroelectricity.polarization.
Parameters: cart_coords (3x1 array) – Cartesian coords. Returns: Lattice coordinates.
-
get_wigner_seitz_cell
() → List[List[numpy.ndarray]][source]¶ Returns the Wigner-Seitz cell for the given lattice.
Returns: A list of list of coordinates. Each element in the list is a “facet” of the boundary of the Wigner Seitz cell. For instance, a list of four coordinates will represent a square facet.
-
static
hexagonal
(a: float, c: float)[source]¶ Convenience constructor for a hexagonal lattice.
Parameters: - a (float) – a lattice parameter of the hexagonal cell.
- c (float) – c lattice parameter of the hexagonal cell.
Returns: Hexagonal lattice of dimensions a x a x c.
-
inv_matrix
¶ Inverse of lattice matrix.
-
lengths_and_angles
¶ Returns (lattice lengths, lattice angles).
-
lll_inverse
¶
-
lll_mapping
¶
-
lll_matrix
¶
-
matrix
¶ Copy of matrix representing the Lattice
-
metric_tensor
¶ The metric tensor of the lattice.
-
static
monoclinic
(a: float, b: float, c: float, beta: float)[source]¶ Convenience constructor for a monoclinic lattice.
Parameters: - a (float) – a lattice parameter of the monoclinc cell.
- b (float) – b lattice parameter of the monoclinc cell.
- c (float) – c lattice parameter of the monoclinc cell.
- beta (float) – beta angle between lattice vectors b and c in degrees.
Returns: Monoclinic lattice of dimensions a x b x c with non right-angle beta between lattice vectors a and c.
-
norm
(coords: Union[List[float], numpy.ndarray], frac_coords: bool = True) → float[source]¶ Compute the norm of vector(s).
Parameters: - coords – Array-like object with the coordinates.
- frac_coords – Boolean stating whether the vector corresponds to fractional or cartesian coordinates.
Returns: one-dimensional numpy array.
-
static
orthorhombic
(a: float, b: float, c: float)[source]¶ Convenience constructor for an orthorhombic lattice.
Parameters: - a (float) – a lattice parameter of the orthorhombic cell.
- b (float) – b lattice parameter of the orthorhombic cell.
- c (float) – c lattice parameter of the orthorhombic cell.
Returns: Orthorhombic lattice of dimensions a x b x c.
-
reciprocal_lattice
¶ Return the reciprocal lattice. Note that this is the standard reciprocal lattice used for solid state physics with a factor of 2 * pi. If you are looking for the crystallographic reciprocal lattice, use the reciprocal_lattice_crystallographic property. The property is lazily generated for efficiency.
-
reciprocal_lattice_crystallographic
¶ Returns the crystallographic reciprocal lattice, i.e., no factor of 2 * pi.
-
static
rhombohedral
(a: float, alpha: float)[source]¶ Convenience constructor for a rhombohedral lattice.
Parameters: - a (float) – a lattice parameter of the rhombohedral cell.
- alpha (float) – Angle for the rhombohedral lattice in degrees.
Returns: Rhombohedral lattice of dimensions a x a x a.
-
scale
(new_volume: float) → pymatgen.core.lattice.Lattice[source]¶ Return a new Lattice with volume new_volume by performing a scaling of the lattice vectors so that length proportions and angles are preserved.
Parameters: new_volume – New volume to scale to. Returns: New lattice with desired volume.
-
static
tetragonal
(a: float, c: float)[source]¶ Convenience constructor for a tetragonal lattice.
Parameters: - a (float) – a lattice parameter of the tetragonal cell.
- c (float) – c lattice parameter of the tetragonal cell.
Returns: Tetragonal lattice of dimensions a x a x c.
-
volume
¶ Volume of the unit cell.
-
-
get_integer_index
(miller_index: bool, round_dp: int = 4, verbose: bool = True) → Tuple[int, int, int][source]¶ Attempt to convert a vector of floats to whole numbers.
Parameters: - miller_index (list of float) – A list miller indexes.
- round_dp (int, optional) – The number of decimal places to round the miller index to.
- verbose (bool, optional) – Whether to print warnings.
Returns: The Miller index.
Return type: (tuple)


Zewo provides fast and reliable HTTP/HTTPS servers. Our servers are crafted with the same battle-tested HTTP parser used by nginx/node.js, so you can be sure we'll take good care of your requests. TLS/SSL is handled by OpenSSL, which is the most popular SSL implementation powering only about 2/3 of all webservers around the world.
import HTTPServer
import HTTPSServer
let hello = Responder { request in
return Response(body: "hello world")
}
try Server(
reusePort: true,
port: 80,
responder: hello
).startInBackground()
try Server(
reusePort: true,
port: 443,
certificate: "cert.pem",
privateKey: "key.pem",
responder: hello
).start()
You'll probably want to use a router to organize your web application. Luckily, we have an excellent Router module for that.
import HTTPServer
import Router
import ResourcefulRoute
let v1 = Router("/v1") { route in
route.post("/users", CreateUserResponder())
}
let app = Router(matcher: TrieRouteMatcher.self) { route in
route.get("/hello") { _ in
return Response(body: "hello world")
}
route.get("/hello/:name") { request in
let name = request.pathParameters["name"]!
return Response(body: "hello \(name)")
}
route.compose("/api", v1)
route.resources("/videos", VideoResources())
route.fallback = FileResponder(path: "public")
}
try Server(app).start()
Middleware allows you to reuse code for common tasks and make your life a lot easier.
import Zewo
let logger = LoggerMiddleware(log: Log())
let contentNegotiator = ContentNegotiationMiddleware(mediaTypes: JSONMediaType(), URLEncodedFormMediaType())
let userMapper = ContentMapperMiddleware(mappingTo: User.self)
let app = Router(middleware: contentNegotiator) { route in
route.post("/users", middleware: userMapper) { request in
guard let user = request.user else {
return Response(status: .BadRequest)
}
let id = User.save(user)
return Response(content: id)
}
}
try Server(middleware: logger, responder: app).start()


--- layout: post date: 2012-03-18 time: "09:00:00" authors: ["Greg Wilson"] title: And While We're Stuck Here With 21 Seconds Worth of Music to Fill... tags: ["Noticed"] ---
Scholarship in the Age of the Internetatron:
{% assign video_title="Scholarship in the Age of the Internetatron" %} {% assign video_slug="8omwsw8ibzw" %} {% assign video_time="00:02:42" %} {% include youtube %}


Guidance
Funding guidance for early years initial teacher training (ITT) providers.
The National College for Teaching and Leadership ( NCTL ) allocates and funds early years ITT places each academic year. Early years ITT leads to the award of early years teacher status ( EYTS ).
We provide training bursaries and training grants to attract high-quality graduates to become early years teachers.
This funding can only be used in delivering training programmes to support trainees in meeting the Teachers’ Standards (Early Years) . The training grant includes the costs of assessment against these standards.
Trainees and potential applicants should visit the Get Into Teaching website for information about early years ITT . Employers should visit early years ITT : a guide for employers .
Early years ITT leads to the award of EYTS . We offer funding for 2 of the 4 EYTS training routes. We’ll pay training grants to you for trainees eligible for our funding.
Please look at our list of early years ITT training providers for 2017 to 2018 .
This is for graduates studying full-time. Training is typically over a 1 year period.
A training grant of £7,000 is available to cover course fees.
Trainees with high academic achievement may be eligible to receive a bursary .
You’ll receive the:
This route is for graduates in paid employment in an early years setting who require training and further experience to demonstrate the Teachers’ Standards (Early Years) .
Training is part-time and typically takes place over a one year period.
Funding of £14,000 is available for this route. This will consist of:
There’s no set list of activities for the employer incentive. It’s intended to contribute towards costs incurred by the employer in supporting and employing the trainee during their training and could include:
Funding can’t be used for sickness and maternity/paternity pay arrangements; this is the employer’s responsibility.
We recommend that you reimburse employers on a term-by-term basis in arrears unless you’ve agreed alternative arrangements. You must keep clear, accurate and up-to-date records of the payments that have been made to employers.
This route is for those who wish to undertake a level 6 degree in an early childhood related subject along with EYTS . It is typically a full time 3 or 4 year route for those entering the profession.
Funding is not available from NCTL for this route. Eligible trainees can access funding through tuition fee loans from Student Finance England .
This route is for graduates with at least 2 years’ experience of working with children from birth to 5 years old who can demonstrate the Teachers’ Standards (Early Years) without further training. An example of this is an early years teacher from overseas who has knowledge and understanding of the early years foundation stage.
This is a self-funded route.
Bursary rates are only available for the graduate entry route.
| Highest qualification | 1st (£5,000) | 2:1 (£4,000) | 2:2 (£2,000) | Other (Nil) |
|---|---|---|---|---|
| PhD | X | |||
| 1st class degree | X | |||
| Medical Masters (distinction) | X | |||
| Masters | X | |||
| 2:1 honours degree | X | |||
| 2:2 honours degree | X | |||
| 3rd class honours degree | X | |||
| Aegrotat | X | |||
| Ordinary degree | X | |||
| No first degree | X |
For a trainee to be eligible to receive a bursary you must ensure that from the first day of training, the trainee meets, and continues to meet the criteria. The trainee must:
All allocated funding is based on full-time places. A trainee is defined as full-time if their full-time equivalence ( FTE ) is more than 0.5. Trainees with an FTE of 0.5 or less will be classified as part-time.
Trainees are funded for the number of days between the start date and the planned end date of their training (unless the trainee withdraws). This includes weekends and bank holidays. It also applies to trainees who start their training during the current academic year but aren’t due to complete until a later academic year.
All training costs must be met from the funding provided by NCTL per trainee and additional fees cannot be charged.
Funding is ring-fenced for each individual route allocation. For example, graduate entry allocated places can’t be used to recruit graduate employment based trainees.
You may only use your allocated places for trainees who are eligible for our funding as defined in your grant offer agreement. All trainees on funded routes must have the right to study or work in the UK for at least the duration of training.
We’ll not fund applicants who’ve previously:
Trainees who withdraw from their programme attract funding between the start date of their training and the date of withdrawal. We’ll recover any unused funding.
You should suspend bursary payments to withdrawn trainees immediately. However, eligible trainees are entitled to be paid the training bursary for each month up to, and including, the full month in which they withdrew.
You should calculate the amount of unused training grant funding, bursary and employer incentive payments from the point of withdrawal. You must be able to demonstrate how you have calculated this.
We’ll not reimburse you for any payments made in error for trainees who have already withdrawn. We expect you to recover any overpayment from trainees and employers.
Withdrawal data should be updated in our early years ITT data management system . as soon as a trainee withdraws or at a minimum monthly. You should also email our early years team with notification of withdrawn candidates and unused funding immediately.
If a trainee defers during their programme, we’ll continue to fund you for the trainee throughout the period of deferment up to the maximum of training grant and bursary or employer incentive awarded. The deferral period is a maximum of 1 year. A trainee might seek deferment more than once during the course of their training, which should be agreed with you. Should a trainee wish to defer for more than one year this must be agreed with us.
During the deferral period you should hold on to the funding to be used when the trainee returns to their course. However, if the trainee subsequently doesn’t return to the training programme within the one year deferral period we’ll recover any surplus funding unless it has been agreed with us.
Deferral data should be updated in our early years ITT data management system as soon as the deferral is agreed or at a minimum monthly.
We’ll continue to provide funding up to the maximum amount for trainees who are away from their programme because of sickness or other special leave. If this absence will affect the trainee’s ability to meet the Teachers’ Standards (Early Years)
Funding for early years ITT will be distributed to you, the provider, not employers or individuals.
The Department for Education’s grant funding agreement underpins the funding arrangements for early years ITT . This includes arrangements to recover unused funding and assurance processes. Your grant offer letter will incorporate financial expectations.
Evidence that the monies are being spent appropriately will be sought through an annual grant report process. You’re not required to complete a separate certificate of expenditure. Assurance could also be gained through internal processes linked to the accreditation process such as internal visits and ITT provider health checks.
Funding will be paid to you in 11 monthly instalments from September to July of the academic year. We’ll make the monthly payments through BACS via the Department for Work and Pensions ( DWP ) and you’ll receive payment within the first 7 working days of each month. Recipients of grant funding will receive remittance advice from DWP containing the amount of funding to be paid and the name of the ITT provider. You will be able to review your payment profile on the ITT Extranet .
The first 3 payments will be based on an estimate of allocated places and recruitment detail. The amount may change at certain payment points to reflect the actual number of trainees recruited and any trainee withdrawals.
All unused grant funding will be recovered that is as a result of:
At the end of the academic year, funding is adjusted to take account of the actual number and type of trainees who were recruited and who completed programmes during the year.
You must hold full records of all payments made to:
We’ll seek assurance about the payments via the annual audit grant reporting process, which will need to be verified by your accounting officer and in line with the grant terms and conditions.
We reserve the right to request these details at any point during the academic year for the purpose of monitoring quality and performance.
In the event of any variances, particularly with regard to unclassified degrees, we reserve the right to contact you to request explanations of the variances and to seek further information.
You’re required to share data on trainee applications, recruitment and employment outcomes with us.
You’re required to inform us of your monthly recruitment data as outlined in your grant offer letter. This is a live and on-going data collection. Failure to supply this data within the required timeline may affect any future allocation decisions and could lead to the withholding of grant funding.
Your monthly data should be submitted to us via the online portal .
You’re required to record details of all your early years ITT trainees, training programmes, and training outcomes on our early years ITT data management system . A DMS user guide will be issued in summer 2017.
You’ll be expected to keep your trainee data up to date at all times and it should accurately reflect any changes to the status of trainees, such as withdrawals and deferments.
All trainees must be registered with us and all records finalised and correct by 11 October of the current academic year. You’ll be asked to complete a validation declaration at this point to confirm that all entries have been checked as correct. This data is a condition of funding. We’ll use information to calculate the amount of funding that you are entitled to claim for the academic year.
Published: 26 March 2015
Updated: 18 December 2015


It began as a little sleeper project—a handy tool to update Counter-Strike—and morphed pretty quickly into the world's largest online gaming platform. Steam guarantees instant access to more than 1,800 game titles and connects its 35 million active users to each other—and to us. Through Steam, fans can easily buy, play, share, modify, and build communities around Valve products as well as titles from other independent game studios. Steam is available in 237 countries and 21 different languages.


Select demo SMILE
personal
superheroes
employees
weather
Select demo JSON
personal
superheroes
employees
weather
SMILE to JSON
JSON to SMILE


To get started enter the url of an XML/A server and any required credentials. If credentials are entered they will be passed to the server in the header of post requests.


The diameter of graph
问题描述 :
The graph diameter is the length of the "longest shortest path" between any two vertices of a graph. In other words, a graph’s diameter is the longest path which must be traversed in order to travel from any vertex to another when paths which backtrack, detour, or loop are excluded from consideration.
Given an undirected graph, your mission is to count the number of diameters of it.
Given an undirected graph, your mission is to count the number of diameters of it.
输入:
The input contains multiple test cases.
For each test case, it contains n+1 lines.
Line 1: two integers m, n (2<= m <= 100, 1 <= n <= 4000) indicating that there are m vertices and n edges in the city.
Line 2~n+1: each contains three integers i, j, d (1 <= i, j <= m, 1 <= d <= 100), indicating that there is an edge of length d connecting vertex i and vertex j.
For each test case, it contains n+1 lines.
Line 1: two integers m, n (2<= m <= 100, 1 <= n <= 4000) indicating that there are m vertices and n edges in the city.
Line 2~n+1: each contains three integers i, j, d (1 <= i, j <= m, 1 <= d <= 100), indicating that there is an edge of length d connecting vertex i and vertex j.
输出:
Output the value of the diameter and the number of diameters in a single line, separated by a single space.
样例输入:
4 5 1 2 1 2 3 1 3 4 1 1 4 1 1 3 2
样例输出:
2 5
(adsbygoogle = window.adsbygoogle || []).push({});
mark, 备用
辛苦了，顶
不错，赞一个！
红绯鱼：
牛逼牛逼
aha, welcome!
可以根据二叉排序树的定义进行严格的排序树创建和后序遍历操作。如果形成的排序树相同，其树的前、中、后序遍历是相同的，但在此处不能使用中序遍历，因为，中序遍历的结果就是排序的结果。经在九度测试，运行时间90ms，比楼主的要快。
此题的样例描述不正确
跟书上的解法不一样，不知道哪个效率要高些
int L[m+1][n+1];这样定义出错，这个在gcc上可以编译通过 在VS上不行 应该改为new 或者vector
不同的编译器，printf(),执行的顺序不同，所以结果也就不同，建议不要那么写
#include <stdio.h>
int main(void)
{
int arr[] = {10,20,30,40,50,60};
int *p=arr;
printf("%d,%d,",*p++,*++p);
printf("%d,%d,%d",*p,*p++,*++p);
return 0;
}
为什么是 20,20,50,40,50. 我觉得的应该是 20,20,40,40,50 . 谁能解释下？
嗯 分析得很到位，确实用模板编程能让面试官对你的印象更好。在设置辅助栈的时候可以这样：push时，比较要push的elem和辅助栈的栈顶，elem<=min.top()，则min.push(elem).否则只要push（elem）就好。在pop的时候，比较stack.top()与min.top(),if(stack.top()<=min.top()),则{stack.pop();min.pop();}，否则{stack.pop();}.


abstract var maxAgeOfCache: Age
Used to set how old cache can be on the device before it is considered too old and new cache should be fetched.


Trading_DiscountProfileType Class Reference
| Inherits from | NSObject |
| Conforms to | PicoBindable |
| Declared in | Trading_DiscountProfileType.h Trading_DiscountProfileType.m |
Tasks
-
discountProfileID
The unique eBay-created ID for the shipping discount, assigned when the
property
profile is created. On input, if ModifyActionCode is Add, this is ignored if
provided. If ModifyActionCode is Modify, all details of the new version of the
profile must be provided. If ModifyActionCode is Delete, DiscountProfileID is
required, MappingDiscountProfileID is optional, and all other fields of
DiscountProfile are ignored. -
discountProfileName
The user’s title for this profile. On input, if ModifyActionCode is Add, this
property
is ignored (if provided) if this is the first profile being created and
required if there is more than one profile of that type (flat rate versus
calculated) already. To modify the name, set ModifyActionCode to Update and
provide all details for the profile. On output, DiscountProfileName is only
returned if the user defined more than one profile. -
eachAdditionalAmount
The amount, if the seller specified EachAdditionalAmount as the type of profile,
property
as noted in FlatShippingDiscount.DiscountName.
Flat rate shipping only. -
eachAdditionalAmountOff
The amount, if the seller specified EachAdditionalAmountOff as the type of profile,
property
as noted in FlatShippingDiscount.DiscountName.
Flat rate shipping only. -
eachAdditionalPercentOff
The percent (expressed in decimal, as in .5 for 50%), if the seller specified
property
EachAdditionalPercentOff as the type of profile,
as noted in FlatShippingDiscount.DiscountName.
Flat rate shipping only. -
weightOff
The weight by which to reduce the combined item weight, if the seller
property
specified WeightOff as the type of profile, as noted in
CalculatedShippingDiscount.DiscountName. The smallest unit is used (e.g.
ounces).
Calculated shipping only. -
mappedDiscountProfileID
For SetShippingDiscountProfiles, if MappedDiscountProfileID is omitted when
property
ModifyActionCode is Delete, any listings currently using the profile
identified by DiscountProfileID will have that profile removed. For
SetShippingDiscountProfiles and GetItem, this is the intended discount profile
mapping. -
any
(public property)
property
Properties
any
(public property)
@property (nonatomic, retain) NSMutableArray *any
Discussion
(public property)
entry type : PicoAnyElement, wrapper for primitive anyelement
Declared In
Trading_DiscountProfileType.h
discountProfileID
The unique eBay-created ID for the shipping discount, assigned when the
profile is created. On input, if ModifyActionCode is Add, this is ignored if
provided. If ModifyActionCode is Modify, all details of the new version of the
profile must be provided. If ModifyActionCode is Delete, DiscountProfileID is
required, MappingDiscountProfileID is optional, and all other fields of
DiscountProfile are ignored.
@property (nonatomic, retain) NSString *discountProfileID
Discussion
The unique eBay-created ID for the shipping discount, assigned when the
profile is created. On input, if ModifyActionCode is Add, this is ignored if
provided. If ModifyActionCode is Modify, all details of the new version of the
profile must be provided. If ModifyActionCode is Delete, DiscountProfileID is
required, MappingDiscountProfileID is optional, and all other fields of
DiscountProfile are ignored.
type : NSString, wrapper for primitive string
Declared In
Trading_DiscountProfileType.h
discountProfileName
The user’s title for this profile. On input, if ModifyActionCode is Add, this
is ignored (if provided) if this is the first profile being created and
required if there is more than one profile of that type (flat rate versus
calculated) already. To modify the name, set ModifyActionCode to Update and
provide all details for the profile. On output, DiscountProfileName is only
returned if the user defined more than one profile.
@property (nonatomic, retain) NSString *discountProfileName
Discussion
The user’s title for this profile. On input, if ModifyActionCode is Add, this
is ignored (if provided) if this is the first profile being created and
required if there is more than one profile of that type (flat rate versus
calculated) already. To modify the name, set ModifyActionCode to Update and
provide all details for the profile. On output, DiscountProfileName is only
returned if the user defined more than one profile.
type : NSString, wrapper for primitive string
Declared In
Trading_DiscountProfileType.h
eachAdditionalAmount
The amount, if the seller specified EachAdditionalAmount as the type of profile,
as noted in FlatShippingDiscount.DiscountName.
Flat rate shipping only.
@property (nonatomic, retain) Trading_AmountType *eachAdditionalAmount
Discussion
The amount, if the seller specified EachAdditionalAmount as the type of profile,
as noted in FlatShippingDiscount.DiscountName.
Flat rate shipping only.
type : class Trading_AmountType
Declared In
Trading_DiscountProfileType.h
eachAdditionalAmountOff
The amount, if the seller specified EachAdditionalAmountOff as the type of profile,
as noted in FlatShippingDiscount.DiscountName.
Flat rate shipping only.
@property (nonatomic, retain) Trading_AmountType *eachAdditionalAmountOff
Discussion
The amount, if the seller specified EachAdditionalAmountOff as the type of profile,
as noted in FlatShippingDiscount.DiscountName.
Flat rate shipping only.
type : class Trading_AmountType
Declared In
Trading_DiscountProfileType.h
eachAdditionalPercentOff
The percent (expressed in decimal, as in .5 for 50%), if the seller specified
EachAdditionalPercentOff as the type of profile,
as noted in FlatShippingDiscount.DiscountName.
Flat rate shipping only.
@property (nonatomic, retain) NSNumber *eachAdditionalPercentOff
Discussion
The percent (expressed in decimal, as in .5 for 50%), if the seller specified
EachAdditionalPercentOff as the type of profile,
as noted in FlatShippingDiscount.DiscountName.
Flat rate shipping only.
type : NSNumber, wrapper for primitive float
Declared In
Trading_DiscountProfileType.h
mappedDiscountProfileID
For SetShippingDiscountProfiles, if MappedDiscountProfileID is omitted when
ModifyActionCode is Delete, any listings currently using the profile
identified by DiscountProfileID will have that profile removed. For
SetShippingDiscountProfiles and GetItem, this is the intended discount profile
mapping.
@property (nonatomic, retain) NSString *mappedDiscountProfileID
Discussion
For SetShippingDiscountProfiles, if MappedDiscountProfileID is omitted when
ModifyActionCode is Delete, any listings currently using the profile
identified by DiscountProfileID will have that profile removed. For
SetShippingDiscountProfiles and GetItem, this is the intended discount profile
mapping.
type : NSString, wrapper for primitive string
Declared In
Trading_DiscountProfileType.h
weightOff
The weight by which to reduce the combined item weight, if the seller
specified WeightOff as the type of profile, as noted in
CalculatedShippingDiscount.DiscountName. The smallest unit is used (e.g.
ounces).
Calculated shipping only.
@property (nonatomic, retain) Trading_MeasureType *weightOff
Discussion
The weight by which to reduce the combined item weight, if the seller
specified WeightOff as the type of profile, as noted in
CalculatedShippingDiscount.DiscountName. The smallest unit is used (e.g.
ounces).
Calculated shipping only.
type : class Trading_MeasureType
Declared In
Trading_DiscountProfileType.h


One morning, when Gregor Samsa woke from troubled.
$70
57
$3,990
Support tickets list doesn't support commas
I'd have gone up to the boss and told him just what i think.
$70
12
$840
Fix website issues on mobile
I am so happy, my dear friend, so absorbed in the exquisite.
$70
31
$2,170
Authorized person
Eugene Kopyov
2269 Elba Lane
Paris, France
888-555-2311
Total due
Subtotal:
$7,000
Tax: (25%)
$1,750
Total:
$8,750
Other information
Thank you for using Limitless. This invoice can be paid via PayPal, Bank transfer, Skrill or Payoneer. Payment is due within 30 days from the date of delivery. Late payment is possible, but with with a fee of 10% per month. Company registered in England and Wales #6893003, registered office: 3 Goodman Street, London E1 8BF, United Kingdom. Phone number:<PHONE_NUMBER>


Provide evidence of fiscal responsibility and/or burial receipts
Provide shut off notice (Must meet requirement of the board to receive funds)
Provide fire report
Provide documentation to support need


Classes | |
| class | AcceptedSwitch |
| class | Delayed |
Public Member Functions | |
| Mode (GameController game, int priority) | |
| void | add_switch_handler (string Name, string Event_Type, double Delay=0, SwitchAcceptedHandler Handler=null) |
| Adds a switch handler to the list. | |
| void | delay (string Name, EventType Event_Type, double Delay, Delegate Handler, object Param=null) |
| void | cancel_delayed (string Name) |
| bool | handle_event (Event evt) |
| virtual void | mode_started () |
| Notifies the mode that it is now active on the mode queue. | |
| virtual void | mode_stopped () |
| Notifies the mode that it has been removed from the mode queue. | |
| virtual void | mode_topmost () |
| Notifies the mode that it is now the topmost mode on the mode queue. | |
| virtual void | mode_tick () |
| void | dispatch_delayed () |
| Called by the GameController to dispatch any delayed events. | |
| virtual void | update_lamps () |
| override string | ToString () |
Public Attributes | |
| const bool | SWITCH_STOP = true |
| const bool | SWITCH_CONTINUE = false |
Properties | |
| GameController | Game [get, set] |
| int | Priority [get, set] |
| void NetProcGame.game.Mode.add_switch_handler | ( | string | Name, |
| string | Event_Type, | ||
| double | Delay = 0 , |
||
| SwitchAcceptedHandler | Handler = null |
||
| ) |
Adds a switch handler to the list.
| Name | Switch Name |
| Event_Type | 'open', 'closed', 'active' or 'inactive' |
| Delay | float number of seconds that the state should be held before invoking the handler, or None if it should be invoked immediately. |
| Handler | The handler to invoke |
Called by the GameController to dispatch any delayed events.
| bool NetProcGame.game.Mode.handle_event | ( | Event | evt | ) |
Filter out all of the delayed events that have been disqualified by this state change. Remove all items that are for this switch (sw_name) but for a different state (type). In other words, keep delayed items pertaining to other switches, plus delayed items pertaining to this switch for another state
| virtual void NetProcGame.game.Mode.mode_started | ( | ) | [virtual] |
Notifies the mode that it is now active on the mode queue.
Reimplemented in NetProcGame.modes.TestMode.
| virtual void NetProcGame.game.Mode.mode_stopped | ( | ) | [virtual] |
Notifies the mode that it has been removed from the mode queue.
Reimplemented in NetProcGame.modes.Trough, and NetProcGame.modes.BallSave.
| virtual void NetProcGame.game.Mode.mode_topmost | ( | ) | [virtual] |
Notifies the mode that it is now the topmost mode on the mode queue.


Switch languages for:
Review Summary
TrustScore Seal
Arabic
Chinese
Chinese (traditional)
Danish
Dutch
English
Finnish
French
German
Greek
Hebrew
Indonesian
Italian
Japanese
Korean
Lithuanian
Malay
Norwegian
Polish
Portuguese
Portuguese (Brasilian)
Russian
Spanish
Swedish
Thai
Turkish
Vietnamese
Your browser doesn't support iframes.


{% extends "pageLayout.html" %} {% block bodyClass %}{{ super() }} default-page{% endblock %} {% block main %} {# Commented this out because it's confusing in this context, but it's #} {# a good demo of singleton widgets of a fixed type. #} {% if false %} {# Demonstrate singletons: areas that must feature one and only one #} {# widget of a specified type #} {% if (not edit) and aposSingletonIsEmpty({ area: page.areas.sidebarVideo, type: 'video' }) %}
No one has selected a featured video yet.
{% else %}


{% extends "common-base.html" %} {% load custom_tags %} {% load messages %} {% block extrahead %} {% endblock %} {% block container_class %}{{ block.super }} documentation{% endblock %} {% block right_content %} {% box 'table' %}
A guide to understand IndexTank supported Query Format
All the examples in this page use an index composed of the following documents:
documentA = { "text" : "Hello world. I'm the content of the 'text' field. It's the default field for queries.", "city" : "San Francisco, CA", "author" : "Java Power Coder" } documentB = { "text" : "Good morning! The default field of this document contains 'tea'.", "city" : "London, UK", "author" : "World Class Developer" } documentC = { "text" : "Goodbye world. This is the default field of the last document.", "city" : "San Diego, CA", "author" : "PHP Power Coder" }
There are two types of basic queries: Terms and Phrases. A Term is a single word such as "hello" or "world". For example:
hellowill match:
documentAand
worldwill match:
documentA, documentC
A Phrase is a group of words by double quotes such as "hello world". Documents matching phrase queries will contain the exact phrase.
For example:"hello wold"will match:
documentAand
"default field"will match:
documentA, documentB, documentC
By default, all basic queries are executed against the Text field of the indexed documents. It's possible to select a different field, by prefixing a basic query with a field name.
For example:author:worldwill match:
documentBand
author:"power coder"will match:
documentA, documentC
You can combine basic queries with Boolean operators to form a more complex query. Boolean operators define the relationships between Terms or Phrases. IndexTank supports the following Boolean operators: AND, "+", OR, NOT and "-". Please note that Boolean operators must be all uppercase.
This is the default operator. It will be used if there is no Boolean operator between two terms. For example:
default documentis the same as
default AND documentand will match:
documentB, documentC
This operator makes its surrounding terms optional, but at least one must match the document. For example:
hello OR lastwill match:
documentA, documentC
The NOT operator excludes documents that contain the term (or phrase) after NOT. For example:
world NOT contentwill match:
documentCand
world NOT "default field"will match:
documentAYou can use the NOT operator several times in the same query. For example:
world NOT content NOT author:coderwill not match any document.
# no documents matching
hello OR lastis the same as
last OR helloand will match the same documents,
documentA, documentCIf you need to modify precedence for complex queries, you can use parentheses. For example:
(good AND world) OR author:powerwill match:
documentA, documentCand
good AND (world OR author:power)will match:
documentC
You can also use parentheses to specify the field only once.
For example:author:(world class)is the same as:
author:world author:classand will match:
documentB
You can boost terms in a query by appending the caret operator at the end of a term. Example:
author:world^2 OR city:san^10This will match all documents, and documentC will be the last result. {% endblock %}


--- title: Setting up Search keywords: fastai sidebar: home_sidebar summary: "Using Google Custom Search" ---
If you want to include Search functionality on your docs site, you need to set up a Google Custom Search engine (click 'add' on this link to create one), and then link it to your _config.yml
. In the following sections we've listed all the settings we used for search functionality in docs.fast.ai, since they will probably we a reasonable starting point for you too. Once you've created the custom search engine in Google, copy the "search engine id" and use it as the value for "google_search" in docs/_config.yml
.
To see what documents google is currently indexing at any particular URL, use the site: operator without any search term. e.g. "site:docs.fast.ai". You can use this to sense check what a search term ought to return as the result


BZMORE(1) BZMORE(1) NAME bzmore, bzless - file perusal filter for crt viewing of bzip2 compressed text SYNOPSIS bzmore [ name ... ] bzless [ name ... ] NOTE In the following description, bzless and less can be used interchangeably with bzmore and more. DESCRIPTION Bzmore is a filter which allows examination of compressed or plain text files one screenful at a time on a soft-copy terminal. bzmore works on files compressed with bzip2 and also on uncompressed files. If a file does not exist, bzmore looks for a file of the same name with the addi‐ tion of a .bz2 suffix. Bzmore normally pauses after each screenful, printing --More-- at the bottom of the screen. If the user then types a carriage return, one more line is displayed. If the user hits a space, another screenful is dis‐ played. Other possibilities are enumerated later. Bzmore looks in the file /etc/termcap to determine terminal characteris‐ tics, and to determine the default window size. On a terminal capable of displaying 24 lines, the default window size is 22 lines. Other sequences which may be typed when bzmore pauses, and their effects, are as follows (i is an optional integer argument, defaulting to 1) : i<space> display i more lines, (or another screenful if no argument is given) ^D display 11 more lines (a ``scroll''). If i is given, then the scroll size is set to i. d same as ^D (control-D) iz same as typing a space except that i, if present, becomes the new window size. Note that the window size reverts back to the default at the end of the current file. is skip i lines and print a screenful of lines if skip i screenfuls and print a screenful of lines q or Q quit reading the current file; go on to the next (if any) e or q When the prompt --More--(Next file: file) is printed, this command causes bzmore to exit. s When the prompt --More--(Next file: file) is printed, this command causes bzmore to skip the next file and continue. = Display the current line number. i/expr search for the i-th occurrence of the regular expression expr. If the pattern is not found, bzmore goes on to the next file (if any). Otherwise, a screenful is displayed, starting two lines before the place where the expression was found. The user's erase and kill characters may be used to edit the regular expression. Erasing back past the first column cancels the search command. in search for the i-th occurrence of the last regular expression entered. !command invoke a shell with command. The character `!' in "command" are replaced with the previous shell command. The sequence "\!" is replaced by "!". :q or :Q quit reading the current file; go on to the next (if any) (same as q or Q). . (dot) repeat the previous command. The commands take effect immediately, i.e., it is not necessary to type a carriage return. Up to the time when the command character itself is given, the user may hit the line kill character to cancel the numerical argument being formed. In addition, the user may hit the erase character to redisplay the --More-- message. At any time when output is being sent to the terminal, the user can hit the quit key (normally control-\). Bzmore will stop sending output, and will display the usual --More-- prompt. The user may then enter one of the above commands in the normal manner. Unfortunately, some output is lost when this is done, due to the fact that any characters waiting in the terminal's output queue are flushed when the quit signal occurs. The terminal is set to noecho mode by this program so that the output can be continuous. What you type will thus not show on your terminal, except for the / and ! commands. If the standard output is not a teletype, then bzmore acts just like bzcat, except that a header is printed before each file. FILES /etc/termcap Terminal data base SEE ALSO more(1), less(1), bzip2(1), bzdiff(1), bzgrep(1) BZMORE(1)


--- layout: default title: Hello ---
I am a Soc Power Engineer working at Apple Inc. Previously, I worked at Intel corporation building energy efficient products.


2020-04-04 Material constants of anisotropic linear piezoelectric material 2020-03-28 Markdown Cheatsheet 2020-03-25 Comsol Simulation of Wave Propagation in Beam Please enable JavaScript to view the comments powered by Disqus. Blog Categories All 3 Comsol 1 Guides 1 Mechanics 1


Stormzy and John Legend to perform at awards ceremony for poverty activists
Chris Martin is billed as a ‘special guest’ on the night at London’s Royal Albert Hall.
Stormzy, John Legend and Sting are among the stars confirmed to perform at an awards ceremony that recognises activists working to end extreme poverty.
The grime artist and the singers will be joined by music stars Jennifer Hudson and Raphael Saadiq, and special guests Chris Martin and H.E.R., at the Global Citizen Prize Award Ceremony at London’s Royal Albert Hall on Friday December 13.
US singer-songwriter and record producer Legend will also serve as the host of the event, which will be televised the following week.
Global Citizen is an international advocacy group that supports sustainable development goals set by the United Nations.
The group’s mission is to end world poverty by 2030.
The Global Citizen Prize will be recognised across five categories, including a youth leadership award, which honours an individual aged 18 to 30 who has contributed meaningfully towards the goal of ending extreme poverty.
The prize includes 250,000 US dollars (£193,327) to be paid to the organisation through which the winner has achieved impact.
There will be a public vote open in all countries up to and including November 26 which will go towards determining the winner of the youth leadership prize.
The ceremony will also include a business leader prize, given to an individual in the business community who has combined business goals with positive human impact, and a Global Citizen of the Year accolade, which honours someone who has proven exceptional and sustained impact towards the goal of ending extreme poverty.
The new event is the first major event of Global Citizen’s 2020 campaign to “get the world back on track” to achieve the UN’s Global Goals by 2030.
The ceremony will air on Saturday December 21 at 7pm on Sky.


Select two colors to calculate their similarity.
There are many different methods for calculating the difference between colors. The algorithm we use attempts to approximate similarity according to how the average human eye perceives them. The bigger the number, the more different the colors will appear. [TODO: Citation needed!]
There's a lot of fun stuff you can do once you figure out the visual relationship between two colors! [TODO: Show, don't tell!]


Date and Time of report: {{report.prettyTime}}
Report Category: {{report.category}}
Report Area: Near {{report.prettyAddress}}
Incident Comments:{{report.comments}}
Exact Location: {{report.location.latitude}}, {{report.location.longitude}}
Nearby Nodes: {{val.envAssetUid}}


Turn any element into a file dropzone and you decide how you want to render the files. The control's value will be the File[].
Internet Explorer doesn't allow dropping folders or extracting the files from a folder, so if the dropped files contain at least one folder, it'll return an empty array. Works as expected on Edge.
import {{ "{" }} NgEzFileModule {{ "}" }} from '@ngez/core';


Preparation time
1-2 hours
Cooking time
1 to 2 hours
Serves
Serves 4
For the kebabs, combine the rump steak, yoghurt, ginger, garlic, lemon juice and paprika in a large bowl. Cover and marinate for at least one hour in the fridge. Soak eight wooden skewers in cold water for at least ten minutes.
Thread the meat and peppers alternately on the wooden skewers until all of the meat and peppers are used up. Set aside.
For the coconut jus, heat half of the vegetable oil in a pan. Add the cardamom pods and the cloves and fry for 2-3 minutes. Add the chopped fresh tomatoes and the tinned tomatoes. Add the water, bring to the boil and simmer for about 40 minutes, or until the sauce has slightly thickened and the tomatoes have completely broken down.
In a separate pan, heat the remaining oil and add the onions and the curry leaves. Cook for 4-5 minutes, or until the onions are softened and the curry leaves are aromatic. Turn up the heat, then add the beef bones and stir in the garam masala and cook for 5-6 minutes, stirring continually, or until the bones start to colour.
Add the tomato mixture to the pan with the bones and mix well. Add enough water to just cover the top of the bones, then simmer for one hour, or until the mixture is thickened and aromatic. Pass the mixture through a fine sieve into a clean pan and discard the solids.
Add the coconut milk to the pan and bring to the boil, cooking for 10-15 minutes, or until the liquid has reduced by half. Keep warm.
For the rice, heat the oil in a pan over a medium heat. Add the onions, cardamom pods, cumin and bay leaves and fry for 5-6 minutes, or until the onion is softened and the spices are aromatic.
Drain the basmati rice and add to the pan. Stir until all the rice is coated and the spices are evenly distributed. Fry for 2-3 more minutes, then add the water and bring to the boil. Cover with a lid and cook for 10-12 minutes, or until the rice is tender and all of the water has been absorbed. Remove from the heat and set aside.
For the spinach, heat the oil in a pan until smoking. Add the garlic and fry for 2-3 minutes, or until softened. Squeeze out any excess moisture from the spinach, then add to the pan and stir until the spinach has wilted.
For the kebabs, heat a griddle pan until smoking. Place the kebabs onto the griddle and cook for about 2-3 minutes on each side, or until cooked through and golden-brown all over.
To serve, stir the grapes and chopped coriander into the cooked rice. Spoon onto serving plates and lay the kebabs alongside. Whisk the butter into the coconut jus, then drizzle around the plate.


Dictionary in pictures
The site has images for 123 Toki Pona's words and its translations to English, Russian and Italian.
We were excited to know whether it is easy to learn other language having a bridge via pictures and the famous syntactic language.
As an extra constraint we have chosen not to use any of symbols or signs in modern culture as much as it will possible.
Besides all these, it was fun to see some stories with pictures we made. We hope, you will enjoy as well.
Toki Pona Language
Toki Pona is an artificial language which was invented in 2001 by translator and linguist Sonja Lang. That is a 'language of good' by its construction. 'It was my attempt to understand the meaning of life in 120 words'. Read more in Wikipedia or official website.


PNR NUMBER
6327949227
CURRENT STATUS
CNF
CHART STATUS
NOT PREPARED
REFRESH
FROM
ROURKELA | ROU
09:20 PM
TO
BHUBANESWAR | BBS
06:15 AM
JOURNEY TIME
9H 0MDAY OF BOARDING
16-04-2019
CLASS
AC 3 Tier
PF# (TENTATIVE)
1
BOOKING STATUS
CURRENT STATUS
CONFIRMATION PROBABILITY
CNF
CNF
CNF
CNF


SudoUserClient
public protocol SudoUserClient : AnyObject
Protocol encapsulating a library of functions for calling Sudo Platform identity services, managing keys, performing cryptographic operations.
-
The release version of this instance of
SudoUserClient
.Declaration
Swift
var version: String { get }
-
isRegistered()
AsynchronousIndicates whether or not this client is registered with Sudo Platform backend.
Declaration
Swift
func isRegistered() async throws -> Bool
Return Value
true
if the client is registered. -
reset()
AsynchronousRemoves all keys associated with this client and invalidates any cached authentication credentials.
Throws
SudoUserClientError.FatalError
Declaration
Swift
func reset() async throws
-
Registers this client against the backend with a registration challenge and validation data.
Declaration
Swift
func registerWithDeviceCheck( token: Data, buildType: String, vendorId: UUID, registrationId: String? ) async throws -> String
Parameters
token
Apple DeviceCheck token..
buildType
Build type of the App from which the DeviceCheck token was retrieved, e.g. “debug” or “release”.
vendorId
An alphanumeric string that uniquely identifies a device to the app’s vendor. Obtained via
identifierForVendor
property ofUIDevice
class.registrationId
The registration ID used for uniquely identifying the registration request in case it fails.
Return Value
User ID of newly registered user.
-
Registers this client against the backend with an external authentication provider. Caller must implement
AuthenticationProvider
protocol to return appropriate authentication token required to authorize the registration request.Declaration
Swift
func registerWithAuthenticationProvider( authenticationProvider: AuthenticationProvider, registrationId: String? ) async throws -> String
Parameters
authenticationProvider
Authentication provider that provides the authentication token.
registrationId
The registrationId if known.
Return Value
User ID of newly registered user.
-
deregister()
AsynchronousDeregisters this client from the backend and resets the keychain. Will throw an error if an error occurred while attempting to reset the keychain.
Declaration
Swift
func deregister() async throws -> String
Return Value
User ID of the deregistered user.
-
signInWithKey()
AsynchronousSign into the backend using a private key. The client must have created a private/public key pair via
register
method.Declaration
Swift
func signInWithKey() async throws -> AuthenticationTokens
Return Value
Authentication tokens.
-
Sign into the backend with an external authentication provider. Caller must implement
AuthenticationProvider
protocol to return the appropriate authentication token associated with the external identity registered withregisterWithAuthenticationProvider
.Declaration
Swift
func signInWithAuthenticationProvider(authenticationProvider: AuthenticationProvider) async throws -> AuthenticationTokens
Parameters
authenticationProvider
Authentication provider that provides the authentication token.
Return Value
Authentication tokens.
-
presentFederatedSignInUI(presentationAnchor:
Asynchronous) Presents the sign in UI for federated sign in using an external identity provider.
Declaration
Swift
func presentFederatedSignInUI(presentationAnchor: ASPresentationAnchor) async throws -> AuthenticationTokens
Parameters
presentationAnchor
Window to act as the anchor for this UI.
Return Value
Authentication tokens.
-
presentFederatedSignOutUI(presentationAnchor:
Asynchronous) Presents the sign out UI for federated sign in using an external identity provider.
Declaration
Swift
func presentFederatedSignOutUI(presentationAnchor: ASPresentationAnchor) async throws
Parameters
presentationAnchor
Window to act as the anchor for this UI.
-
processFederatedSignInTokens(url:
Asynchronous) Processes federated sign in redirect URL to obtain the authentication tokens required for API access..
Declaration
Swift
func processFederatedSignInTokens(url: URL) async throws -> Bool
Parameters
url
Federated sign in URL passed into the app via URL scheme.
Return Value
Boolean indicating whether or not the FSSO token was processed successfully.
-
refreshTokens(refreshToken:
Asynchronous) Refreshes the access and ID tokens using the refresh token. The refresh token expires after 30 days so sign in again to obtain a new refresh token before its expiry. The tokens will also be refreshed automatically when you call platform APIs requiring authentication but there will be added delay in the API response. For more consistent response time for each API call, call this API to proactively keep the tokens fresh.
Declaration
Swift
func refreshTokens(refreshToken: String) async throws -> AuthenticationTokens
Parameters
refreshToken
Refresh token.
Return Value
Authentication tokens.
-
refreshTokens()
AsynchronousRefreshes the access and ID tokens using the cached refresh token. The refresh token expires after 30 days so sign in again to obtain a new refresh token before its expiry. The tokens will also be refreshed automatically when you call platform APIs requiring authentication but there will be added delay in the API response. For more consistent response time for each API call, call this API to proactively keep the tokens fresh.
Declaration
Swift
func refreshTokens() async throws -> AuthenticationTokens
Return Value
Authentication tokens.
-
Returns the user name associated with this client. The username maybe needed to contact the support team when diagnosing an issue related to a specific user.
Declaration
Swift
func getUserName() throws -> String?
Return Value
User name.
-
setUserName(name:
Asynchronous) Sets the user name associated with this client. Mainly used for testing.
Declaration
Swift
func setUserName(name: String) async throws
Parameters
name
user name.
-
Returns the subject of the user associated with this client. Note: This is an internal method used by other Sudo platform SDKs.
Declaration
Swift
func getSubject() throws -> String?
Return Value
Subject.
-
Returns the ID token cached from the last sign-in. Note: This is an internal method used by other Sudo platform SDKs.
Declaration
Swift
func getIdToken() throws -> String?
Return Value
ID token.
-
Returns the access token cached from the last sign-in. Note: This is an internal method used by other Sudo platform SDKs.
Declaration
Swift
func getAccessToken() throws -> String?
Return Value
Access token.
-
Returns the refresh token cached from the last sign-in. Use for callling
refreshTokens
API to refresh the authentication tokens.Declaration
Swift
func getRefreshToken() throws -> String?
Return Value
Refresh token.
-
Returns the ID and access token expiry cached from the last sign-in. The tokens should be refreshed before they expired otherwise the platform APIs requiring authentication may fail.
Declaration
Swift
func getTokenExpiry() throws -> Date?
Return Value
Token expiry.
-
Returns the refresh token expiry cached from the last sign-in.
Declaration
Swift
func getRefreshTokenExpiry() throws -> Date?
Return Value
Refresh token expiry.
-
clearAuthTokens()
AsynchronousClears cached authentication tokens.
Declaration
Swift
func clearAuthTokens() async throws
-
signOut()
AsynchronousSigns out the user from this device only.
Declaration
Swift
func signOut() async throws
-
globalSignOut()
AsynchronousSigns out the user from all devices.
Declaration
Swift
func globalSignOut() async throws
-
getIdentityId()
AsynchronousRetrieves and returns the identity ID associated with the temporary credential used for accessing certain backend resources, e.g. large blobs stored in AWS S3.
Declaration
Swift
func getIdentityId() async -> String?
Return Value
Identity ID.
-
Returns the specified claim associated with the user’s identity.
Declaration
Swift
func getUserClaim(name: String) throws -> Any?
Parameters
name
Claim name.
Return Value
The specified claim value. The value can be of any JSON supported types. Safe cast it the expected Swift type before using it, e.g.
Dictionary
,Array
,String
,Number
orBool
. -
isSignedIn()
AsynchronousIndicates whether or not the client is signed in. The client is considered signed in if it currently caches valid ID and access tokens.
Declaration
Swift
func isSignedIn() async throws -> Bool
Return Value
true
if the client is signed in. -
Returns the list of supported registration challenge types supported by the configured backend.
Declaration
Swift
func getSupportedRegistrationChallengeType() -> [ChallengeType]
Return Value
List of supported registration challenge types.
-
registerSignInStatusObserver(id:
Asynchronousobserver: ) Registers an observer for sign in status changes.
Declaration
Swift
func registerSignInStatusObserver(id: String, observer: SignInStatusObserver) async
Parameters
id
unique ID to associate with the observer.
observer
sign in status observer to register.
-
deregisterSignInStatusObserver(id:
Asynchronous) Deregisters an existing sign in status observer.
Declaration
Swift
func deregisterSignInStatusObserver(id: String) async
Parameters
id
ID of the observer to deregister.


These release notes cover new developer and user-facing incompatibilities, important issues, features, and major improvements.
VectorMapOperator: Missing update to AbstractMapOperator::numRows (Gopal V, reviewed by Sergey Shelukhin)
Committed to 2.2.0 and 2.1.1. Thanks Naveen for the patch.
Vectorization: LIKE should anchor the regexes
Vectorization: Fix Mapjoin overflow deserialization (Gopal V, reviewed by Matt McCline)
Vectorization: missed vectorization for const varchar()
"-d" option has been added to Hive CLI "reset" command, allowing one to reset specific settings to built-in defaults, overriding any session-specific values, as well as configuration files in use. E.g. "reset -d hive.compute.splits.in.am hive.smbjoin.cache.rows".


Building an API with Spring Boot
Brian McClain
Spring Boot is a framework built on top of Spring that focuses on allowing developers to quickly but safely build applications and microservices. It focuses on minimal configuration and “out-of-the-box” functionality. In just a few lines of code, a developer can have an application running on its own embedded web server. This guide will demonstrate how you can quickly build a microservice by building a REST API from scratch. You can also see the completed code on GitHub.
The Design
For this example, you’ll build an API to interact with an inventory system. The inventory tracks every item in a fictitious shop, along with the price and count of each item. Before writing the code, take a few moments to consider the design of the API. The design is, after all, the user experience for the developer, and ensuring it’s clear and simple is just as important as it is when building a frontend user interface.
If you’re familiar with the basics of REST, much of this should look pretty much as you would expect. If you’re a bit newer, or just want a refresher, make sure to check out Basics of REST, which discusses different aspects of REST such as verbs, status codes, and more. For this API, there will be just a handful of endpoints and verbs supported.
GET /items/{id}
: The endpoint that likely first comes to mind is getting information about an item in the inventory. This endpoint will take in an item ID (for example,/items/1
), look it up by that ID, and return all the relevant information about that specific item.GET /items
: If providing an ID returns one item, explicitly omitting an ID could return all items. In a production application, a lot of care should be taken when implementing operations that return an entire database worth of content. It’s expensive to both gather that information from the database as well as transmit it to the requester. In this case, the database will only contain a few items, so it’s not too expensive to perform.POST /items
: If you can get items from the inventory, you should probably also be able to create new items in the inventory. Here’s where proper and clear documentation really helps your developer,.as the existence of this endpoint alone does not tell them what they need to provide. In this case, the endpoint will take in a JSON object, and expect an item’s name, price, and count. The API will handle generating an ID for the new item.PUT /items/{id}
: An inventory system would be pretty useless if you couldn’t change the price or count of any of the items. In this case, the endpoint expects a JSON object containing either the price, count, or both.DELETE /items/{id}
: Not every product is carried forever. You could simply keep the count at zero, but to keep the inventory clean, deleting it from the database will prove to be useful.
With all of the endpoints planned out, we can now begin implementation!
Building the Application
One of the easiest ways to start a Spring Boot application is to use start.spring.io. It will allow you to define the configuration and choose the dependencies specific to your application, then generate all of the boilerplate that surrounds a Spring application. This application assumes that it will be built and run with Maven as well as the default choice of Java and Spring Boot version. What you choose for the group, artifact, name, and description fields doesn’t matter; what does matter is that you add the Spring Web dependency.
Once everything is configured, click Generate to download a ZIP file containing all of the code for your new project. Extract it and open it with your editor of choice, and you’ll find a handful of files. Most of these will be untouched since all of the code will be added to new files, but it’s important to see what’s generated out of the box.
Notably, the pom.xml
file contains all of the configuration on what dependencies your code requires, as well as configuration on how to build it. SpringBootApiDemo.java
is where your application will start; it contains the code to start everything a Spring application needs. In this example, you’ll be creating two files: one to define the Item object, and one to build the REST API.
The Item Object
The best place to start is by defining what an Item is. In the same directory as the SpringBootApiDemo.java
file, create a new file named Item.java
. Consider the code below for what this definition looks like:
public class Item {
private final long id;
private String name;
private double price;
private int count;
public Item(long id, String name, double price, int count) {
this.id = id;
this.name = name;
this.price = price;
this.count = count;
}
public long getId() {
return this.id;
}
public String getName() {
return this.name;
}
public double getPrice() {
return this.price;
}
public void setPrice(double price) {
this.price = price;
}
public int getCount() {
return this.count;
}
public void setCount(int count) {
this.count = count;
}
}
None of this code is specific to Spring, and in fact if you’re a Java developer, this is probably even routine. This code creates a new class with four fields (id
, name
, price
, and count
), a constructor, and a handful of getters and setters. Since the item ID and name will never be changed, only the price and count have setters.
The REST API
Now it’s time to build the API. In the same directory you’ve created the Item.java
file, create one more file named InventoryController.java
. This is the class that will be what’s referred to in Spring as a RestController
. In fact, that’s the exact annotation you’ll add to your class to tell Spring that this is a RestController
.
@RestController
public class InventoryController {
Before you can get into the API code, there’s one last thing you need to handle, and that’s how all of the items in the inventory are tracked. In a real application, this would mean connecting to a database as well as writing code to write to and read from that database. There are actually some great solutions provided by Spring for this as well, and if you’re interested in learning more, one great place to start is to read about Spring JPA. But, for the sake of simplicity, with this example the inventory is managed in-memory in an ArrayList
collection.
ArrayList<Item> inventory = new ArrayList<Item>(
Arrays.asList(
new Item(1, "Keyboard", 29.99, 76),
new Item(2, "Mouse", 19.99, 43),
new Item(3, "Monitor", 79.99, 7),
new Item(4, "PC", 749.99, 2),
new Item(5, "Headphones", 19.99, 14)
));
To prevent writing the same code to look up items by ID over and over, there’s one helper method you can put together:
private Item findItem(Long id) {
// Search the list of items for the item of interest.
// If the item does not exist, return null;
return inventory.stream()
.filter(i -> id.equals(i.getId()))
.findAny()
.orElse(null);
}
This code uses the Java Stream interface to iterate over all the items in the ArrayList
, returning the Item
that it matches by the ID. If no item with the given ID is found, it instead returns null
.
Get All Of The Items
With this helper code complete, it’s time to start building the actual API! Since there’s already a collection of items in an inventory, why not start by implementing the GET /items
endpoint to get all of the items?
@GetMapping("/items")
public ArrayList<Item> getInventory() {
// Spring Boot will handle the serialization of the ArrayList
// to a JSON array, so we can return the list directly.
return inventory;
}
There are two things to note here.. First, this code explicitly tells Spring that it’s the code to run when a GET
request is sent to /items
by annotating this method with @GetMapping(“/items”)
. Second, you’ll notice there’s no code to serialize the ArrayList
that is our inventory. Spring will see that it’s an ArrayList
of Item
object, inspect all of the fields that are defined in an Item
, and then send a response containing a JSON array. This code alone is enough to start sending requests and getting responses if you’d like to see it in action for yourself. Since this code was generated with Maven in mind, it can be run with:
./mvnw spring-boot:run
In a few moments, the application will be up and running, and you can try out the new endpoint:
$ curl localhost:8080/items
[{"id":1,"name":"Keyboard","price":29.99,"count":76},{"id":2,"name":"Mouse","price":19.99,"count":43},{"id":3,"name":"Monitor","price":79.99,"count":7},{"id":4,"name":"PC","price":749.99,"count":2},{"id":5,"name":"Headphones","price":19.99,"count":14}]
Congratulations! You’ve just built your first REST endpoint using Spring Boot! There’s a few more to implement, but luckily you’ll see the more complicated endpoints aren’t much harder than this one.
Get An Individual Item
Next, take a look at the GET /items/{id}
endpoint. This endpoint will return a single item if it exists, or a 404
if it does not exist.
@GetMapping("/items/{id}")
public Item getItem(@PathVariable("id") Long id) {
Item item = findItem(id);
if (item == null) {
// If the item does not exist, return 404
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Item Not Found");
} else {
return item;
}
}
Much like the previous endpoint, note the @GetMapping
annotation, this time with a templated piece in the path ({id}
). This is mapped to an argument in the Java method using one more annotation, @PathVariable(“id”) Long id
, which is how Spring will match up the variable data in the request path to the variable in the code. After that, it will call the handy findItem
helper method defined previously to look up the ID that the user provides. If the item that’s returned is null
, then the code will return 404
by throwing a ResponseStatusException
. Otherwise, the code returns an Item
object directly. Much like in the previous endpoint, Spring will observe the fields of the Item
class to figure out how to serialize it and send the response as a JSON object. Try restarting your code and trying the request out:
$ curl localhost:8080/items/1
{"id":1,"name":"Keyboard","price":29.99,"count":76}
Creating A New Item
So, now you can get the items from the inventory. But what if you want to add a new item? You’ll need some information from the developer, such as the item name.
@PostMapping("/items")
@ResponseStatus(HttpStatus.CREATED)
public Item createItem(@RequestBody Item req) {
// Since item IDs cannot be changed, generated a new ID, create a new item, add it to the
// inventory, and then return the new item.
Long newID = inventory.get(inventory.size() - 1).getId() + 1;
Item newItem = new Item(newID, req.getName(), req.getPrice(), req.getCount());
inventory.add(newItem);
return newItem;
}
If a GET
request uses the @GetMapping
annotation, then a POST
request uses the @PostMappint
annotation. Since this is responding to a different HTTP verb, there’s no issue mapping to the same path that was mapped to earlier. There’s one new annotation for the method arguments:
@RequestBody Item req
The @RequestBody
annotation tells Spring that we want to load the body of the POST
request into the req
variable, and that it should expect an object that can be deserialized to an Item
object. This is another nice feature of Spring, where this translation between JSON and Java objects is automatically handled for you. The rest of the code creates a new Item
(since IDs cannot be changed), saves it to the inventory, and returns the newly created object. Once again, restart your application and give it a try:
$ curl -XPOST http://localhost:8080/items -H "Content-Type: application/json" -d '{"name": "Speakers", "price": 49.99, "count": 30}'
{"id":6,"name":"Speakers","price":49.99,"count":30}
This cURL
request specifically sets the Content-Type
header to let our application know that it’s being sent JSON, so make sure your client of choice is doing the same.
Update An Existing Item
What good is an inventory system that can’t update the count of an item in an inventory? Take a look at the PUT /items/{id}
method. Unlike the POST
request, this PUT
request tells our REST API that we want to update an existing item:
@PutMapping("/items/{id}")
public Item updateItem(@PathVariable("id") Long id, @RequestBody Map<String, String> req) {
Item item = findItem(id);
if (item == null) {
// If the item does not exist, return 404
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Item Not Found");
} else {
// Item exists, so update an existing one
// Iterate over the POSTed JSON fields
for (String k : req.keySet()) {
// Update the items price if a price field is provided
if (k.equals("price")) {
item.setPrice(Double.parseDouble(req.get(k)));
// Update the items count if a count field is provided
} else if (k.equals("count")) {
item.setCount(Integer.parseInt(req.get(k)));
}
}
// Return the updated item
return item;
}
}
As you might have guessed, since this is responding to a PUT
call, this method has the @PutMapping(“/items/{id}
annotation. The arguments for this method also combine what we’ve seen in two different endpoints, with the @PathVariable
annotation pulling the id
from the request path, and the @RequestBody
annotation pulling the request body. You’ll also notice that the request body is being read as a Map<String, String>
this time. You could also read this as an Item
object, but remember that you don’t know if the request will define a price, a count, or both. Instead, Spring will read in the JSON as a Map
, with both keys and values of type String
.
As with the item lookup, if the item doesn’t even exist, a 404
is returned. Otherwise, the code will inspect each key of the Map<String, String>
object, and if it finds a key of either price
or count
, it will update the item that it looked up using the id
provided in the request path. Finally, the newly updated item is returned back to the requester. Give it a try for yourself by getting an item, updating, and getting it again to make sure the changes took place:
$ curl http://localhost:8080/items/1
{"id":1,"name":"Keyboard","price":29.99,"count":76}
$ curl -XPUT http://localhost:8080/items/1 -d '{"count": 175, "price": 27.99}' -H "Content-Type: application/json"
{"id":1,"name":"Keyboard","price":27.99,"count":175}
$ curl http://localhost:8080/items/1
{"id":1,"name":"Keyboard","price":27.99,"count":175}
Deleting An Item
All that remains is the DELETE /items/{id}
endpoint. This code is actually a bit simpler, as you’ll see:
@DeleteMapping("/items/{id}")
public void deleteItem(@PathVariable("id") Long id) {
Item item = findItem(id);
if (item == null) {
// If the item does not exist, return 404
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Item Not Found");
} else {
// If the item exists, delete it from the list
inventory.remove(item);
}
}
Continuing the trend, this method has the @DeleteMapping(“/items/{id}”)
annotation, and maps the id
variable in the request path to the id
variable in the method arguments. It looks up the item and returns 404
if it doesn’t exist, and if it does, it deletes it from the inventory. One slight difference is that this method doesn’t return anything. By default, if a method in a RestController
doesn’t have a return type, the HTTP request will return a 200
status code and an empty body. Give this a shot and see the two different responses you get if you send the same request twice:
$ curl -v -XDELETE http://localhost:8080/items/1
...
< HTTP/1.1 200
...
$ curl -v -XDELETE http://localhost:8080/items/1
...
< HTTP/1.1 404
...
The output has been truncated to be easier to read, but as expected, the first request returned 200
and the second returned 404
since the item had already been deleted.
Testing The Application
You should also be able to test your code, right? Luckily, Spring Boot provides a great way to test the REST APIs that you build. Take a look at the HttpRequestsTest.java
file. In this example it’s located in the /src/test/java/com/github/brianmmcclain/springbootapidemo
directory, but that will depend on what values you used when generating your code.
The first thing to do is to tell Spring that this class contains tests, as well as to set up MockMvc to mock the HTTP requests and bypass the need to set up the actual web tier to run the tests.
@SpringBootTest
@AutoConfigureMockMvc
public class HttpRequestsTest {
@Autowired
private MockMvc mockMvc;
MockMvc
is used to perform the actual tests. Take a look at the test for the GET /items
endpoint:
@Test
public void getInventoryShouldReturnAllItems() throws Exception {
this.mockMvc.perform(get("/items"))
.andExpect(status().isOk())
.andExpect(jsonPath("$").isArray())
.andExpect(jsonPath("$.length()").value(5));
}
These tests are fairly verbose, which helps make clear exactly what the tests are checking. This one sends a GET
request to /items
and ensures that the response is a JSON Array with a length of 5. Consider another one that’s more complicated and take a look at the test for POST /items
.
@Test
public void postWithoutIdShouldCreate() throws Exception {
this.mockMvc.perform(post("/items")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"name\": \"Speakers\", \"price\": 39.99, \"count\": 33}"))
.andExpect(status().isCreated())
.andExpect(jsonPath("$.id").value(6))
.andExpect(jsonPath("$.name").value("Speakers"))
.andExpect(jsonPath("$.price").value(39.99))
.andExpect(jsonPath("$.count").value(33));
}
This test will send a POST
to /items
with the data "{"name": "Speakers", "price": 39.99, "count": 33}"
, setting the Content-Type
header to application/json
. It will then ensure that the response has a status code of 201
(with status().isCreated()
, which is equal to 201
), as well as check that all the fields that are returned are what you would expect.
Learn More
The Spring website has some great guides on writing RESTful APIs with Spring Boot as well as a more in-depth look at Testing the Web Layer, which are wonderful next steps. If you’re new to REST APIs, make sure to check out the Basics of REST.


My Important Heading
London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants.
Standing on the River Thames, London has been a major settlement for two millennia, its history going back to its founding by the Romans, who named it Londinium.
London is the capital city of England. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants.
Standing on the River Thames, London has been a major settlement for two millennia, its history going back to its founding by the Romans, who named it Londinium.
Paris is the capital and most populous city of France.
Standing on the River Thames, London has been a major settlement for two millennia, its history going back to its founding by the Romans, who named it Londinium.


Homework 5¶
You may submit this homework in a group of 1-3 total students.
Due date. Before lecture on Friday of Week 5, October 29th.
Name(s):
UCI ID(s):
Setup for multi-variable linear regression¶
For \(i = 1, 2, \ldots, m\), we have an input \(\vec{x}^{\,(i)} \in \mathbb{R}^{n}\) and an output \(y^{(i)} \in \mathbb{R}\).
Given elements \(\theta_0, \theta_1, \ldots, \theta_n \in \mathbb{R}\), we get a corresponding map \(\mathbb{R}^n \rightarrow \mathbb{R}\) given by
We want to find the values of \(\theta_i\) which best model \(\vec{x}^{\,(i)} \leadsto y^{(i)}\).
By “best”, we mean the residual sum of squares loss function is as small as possible, where the loss function is given by
Define an \(m \times (n+1)\) matrix \(X\) whose \(i\)-th row is \((1, x_1^{(i)}, \ldots, x_n^{(i)})\). Let \(\vec{y}\) denote the \(m \times 1\) column vector \((y^{(1)}, \ldots, y^{(m)})^T\), and let \(\vec{\theta}\) denote the \((n+1) \times 1\) column vector \((\theta_0, \theta_1, \ldots, \theta_n)^T\).
We saw on Friday that any critical point (i.e., point where the gradient is zero) would have to satisfy
which after taking transposes would imply
Questions¶
Question 1:
(a) Geometrically, what is the meaning of \(y^{(i)} - (\theta_0 + \theta_1 x_1^{(i)} + \cdots + \theta_n x_n^{(i)})\)? Use the word vertical in your answer.
(b) Why do we have the \(1/m\) coefficient?
(c) Would it make sense to try to maximize the loss function? Do you think there is a maximum?
(d) When we try to minimize the loss function, some of the variables are treated as constants. Which ones?
(e) What matrix being invertible enables us to find the critical point? (Don’t say \(X\). The matrix \(X\) is usually not a square matrix, so it can’t be invertible.)
Your answers here
Question 2:
You will need to use some NumPy linear algebra commands, for matrix multiplication, transpose, and inverse. (Warning: you can’t multiply matrices in NumPy using *
.)
(a) Define m to be 10**5
and n to be 10**2
. Make a matrix X as above of random real numbers uniformly distributed between 0 and 200. Make a vector theta of length n+1 consisting of random integers between -20 and 20. Define y to be \(X \vec{\theta}\). (So in this case the data has a perfect linear relationship, and we should be able to find theta exactly, up to some numerical precision errors.)
(b) Check if the matrix \(X^T X\) is invertible.
(c) If it is invertible, check if \((X^T X)^{-1} X^T \vec{y}\) is equal to \(\vec{\theta}\).
# Your code here
Question 3:
How long does it take to compute \((X^T X)^{-1} X^T \vec{y}\)? What about if you multiply \(m\) by 3 (but leave \(n\) the same)? What about if you multiply \(n\) by 3 (but leave \(m\) the same)? Which scaling by 3 makes the bigger impact? Do you know what part of the computation is the most difficult for the computer?
# Your code here
Question 4:
Use LinearRegression from sklearn.linear_model
to solve for theta in another way. (You can either use fit_intercept = False
, or you can remove the column of 1s from X.)
# Your code here


public class INumber extends IDataValue
Number
value of some type.| Modifier and Type | Field and Description |
|---|---|
static INumber |
MINUS_INFINITY
Represents a numeric-value of minus-infinity
|
static INumber |
PLUS_INFINITY
Represents a numeric-value of plus-infinity
|
| Constructor and Description |
|---|
INumber(java.lang.Class<? extends java.lang.Number> numberType,
java.lang.String value)
Constructs object representing the specified numeric-value
with the specified primitive Java
Number type. |
INumber(java.lang.Number value)
Constructs object representing the specified numeric-value
with the relevant primitive Java
Number value. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
abstractValue()
Stipulates that this frame is abstract if and only if it is
an
indefinite() number. |
INumber |
add(INumber other)
Adds the other specified numeric-value to this one.
|
java.lang.Double |
asDouble()
Provides numeric-value in the form of a
Double
type object. |
java.lang.Float |
asFloat()
Provides numeric-value in the form of a
Float
type object. |
java.lang.Integer |
asInteger()
Provides numeric-value in the form of an
Integer
type object, performing any necessary rounding. |
java.lang.Long |
asLong()
Provides numeric-value in the form of a
Long
type object, performing any necessary rounding. |
java.lang.Number |
asTypeNumber()
Provides numeric-value in the form of the primitive Java
Number type that was used in constructing this
object. |
boolean |
definite()
Specifies whether this object represents a definite
value.
|
INumber |
divideBy(INumber other)
Divides this value by the other specified numeric-value.
|
boolean |
equals(java.lang.Object other)
Tests for equality between this and other specified object,
which will hold if and only if the other object is another
INumber with the same primitive Java
Number type as this one, and representing the
same numeric-value. |
boolean |
equalTo(INumber other)
Tests for equality between the numeric-values represented
by this and another specified
INumber object
(regardless of the primitive Java Number type
of the represented value). |
java.lang.Class<? extends java.lang.Number> |
getNumberType()
Provides the primitive Java
Number type of the
numeric-value. |
CNumber |
getType()
Provides the most specific numeric value-type of which
this numeric-value is an instance, which will be one
where both the minimum and maximum values are equal to
the value represented by this numeric-value.
|
int |
hashCode()
Provides hash-code based on the numeric-value.
|
boolean |
hasNumberType(java.lang.Class<? extends java.lang.Number> testNumberType)
Tests whether the primitive Java
Number type
of the numeric-value is equal to a specified type. |
boolean |
indefinite()
Specifies whether this object represents an indefinite
value, for which only the
Number -type and
range are specified. |
boolean |
infinite()
Specifies whether this object represents an infinite value
(will be true if and only if the object equals either
PLUS_INFINITY or MINUS_INFINITY ). |
boolean |
lessThan(INumber other)
Tests whether this numeric-value is strictly less-than the
other specified numeric-value.
|
boolean |
lessThanOrEqualTo(INumber other)
Tests whether this numeric-value is less-than-or-equal-to
the other specified numeric-value.
|
INumber |
max(INumber other)
Provides the maximum between this and another numeric-value.
|
INumber |
min(INumber other)
Provides the minimum between this and another numeric-value.
|
boolean |
moreThan(INumber other)
Tests whether this numeric-value is strictly greater-than the
other specified numeric-value.
|
boolean |
moreThanOrEqualTo(INumber other)
Tests whether this numeric-value is greater-than-or-equal-to
the other specified numeric-value.
|
INumber |
multiplyBy(INumber other)
Multiplies this value by the other specified numeric-value.
|
static INumber |
range(INumber min,
INumber max)
Constructs object representing the specified numeric-range.
|
boolean |
subsumes(IValue other)
Tests whether this value-entity subsumes another specified
value-entity, which will be the case if and only if the other
value-entity is another
INumber object, whose
type object (see getType() ) is subsumed by that of this
one. |
INumber |
subtract(INumber other)
Subtracts the other specified numeric-value from this one.
|
equalsStructure, getDisplayLabel, structuralHashCode, subsumesStructure, toString
public static final INumber PLUS_INFINITY
public static final INumber MINUS_INFINITY
public INumber(java.lang.Number value)
Number
value.value
- Numeric-value to be representedpublic INumber(java.lang.Class<? extends java.lang.Number> numberType, java.lang.String value)
Number
type.numberType
- Required primitive Java Number
typevalue
- String version of numeric-value to be representedpublic static INumber range(INumber min, INumber max)
indefinite()
value.min
- Minimum valuemax
- Maximum valueKModelException
- if minimum value is greater than
maximum value, or if minimum and maximum values have
incompatible number-typespublic boolean equals(java.lang.Object other)
INumber
with the same primitive Java
Number
type as this one, and representing the
same numeric-value.public int hashCode()
public CNumber getType()
public boolean abstractValue()
indefinite()
number.public boolean subsumes(IValue other)
INumber
object, whose
type object (see getType()
) is subsumed by that of this
one. If this is a definite number then subsumption is equivalent
to equality, whereas if it is an indefinite number subsumption
holds if the number represented by the other object (definite or
indefinite) falls within the relevant range.other
- Other value-entity to test for subsumptionpublic boolean infinite()
PLUS_INFINITY
or MINUS_INFINITY
).public boolean indefinite()
Number
-type and
range are specified.public boolean definite()
public java.lang.Class<? extends java.lang.Number> getNumberType()
Number
type of the
numeric-value.Number
typepublic boolean hasNumberType(java.lang.Class<? extends java.lang.Number> testNumberType)
Number
type
of the numeric-value is equal to a specified type.testNumberType
- Number
type to test forpublic boolean equalTo(INumber other)
INumber
object
(regardless of the primitive Java Number
type
of the represented value).other
- Object to test for value-equality with this onepublic boolean lessThan(INumber other)
other
- Other numeric-value to compare to this onepublic boolean lessThanOrEqualTo(INumber other)
other
- Other numeric-value to compare to this onepublic boolean moreThan(INumber other)
other
- Other numeric-value to compare to this onepublic boolean moreThanOrEqualTo(INumber other)
other
- Other numeric-value to compare to this onepublic INumber min(INumber other)
other
- Other numeric-value to compare to this oneindefinite()
public INumber max(INumber other)
other
- Other numeric-value to compare to this oneindefinite()
public INumber add(INumber other)
other
- Other numeric-value to add to this onepublic INumber subtract(INumber other)
other
- Other numeric-value to subtract from this onepublic INumber multiplyBy(INumber other)
other
- Other numeric-value by which to multiply this onepublic INumber divideBy(INumber other)
other
- Other numeric-value by which to divide this onepublic java.lang.Number asTypeNumber()
Number
type that was used in constructing this
object.public java.lang.Integer asInteger()
Integer
type object, performing any necessary rounding.public java.lang.Long asLong()
Long
type object, performing any necessary rounding.public java.lang.Float asFloat()
Float
type object.public java.lang.Double asDouble()
Double
type object.


Slide Down Box Menu with jQuery and CSS3
-
ASSETS
(Owns)
Non-Current Assets
(Long Term)
Financial Assets
FIXED DEPOSIT
LAND & BUILDINGS VEHICLES EQUIPMENT
Fixed/Tangible Assets
- LIABILITIES (Owes)
- OWNER EQUITY (Wealth of the owner)
- INCOME (Receipt)
- EXPENSE (Running costs)


BankOfSunny
Home
Transaction
Sign Out
Featured
Banking Online
ID
Checking Account
Savings Account
ACTION
1
Withdraw
Deposit
Tansfer