Chapter 7 Introduction to sf and stars
This chapter introduces R packages sf
and stars
. sf
provides
a table format for simple features, feature geometry is carried in
a list-column. R package stars
was written to support raster and
vector datacubes (Chapter 6), and has raster data stacks
and feature time series as special cases. sf
first appeared
on CRAN in 2016, stars
in 2018. Development of both packages
received support from the R Consortium as well as a strong of
community engagement. The packages were designed to work together.
All functions operating on sf
or stars
objects start with st_
,
making it easy to recognize them or to search for them when using
command line completion.
7.1 Package sf
R Package sf
(Pebesma 2018) was developed to succeed and, over time,
replace R packages sp
, rgeos
and the vector parts of rgdal
. It
provides simple features access (J. Herring and others 2011), natively,
to R. It provides an interface to several tidyverse
packages,
in particular by ggplot2
, dplyr
and tidyr
. It can read
and write data through GDAL, use geometrical operations using
GEOS or s2geometry, and carry out coordinate transformations or
conversions using PROJ (figure 1.6). These
libraries are interfaced using Rcpp (Eddelbuettel 2013).
Package sf
represents sets of simple features in sf
objects,
a sub-class of a data.frame
or tibble. sf
objects contain
at least one geometry list-column of class sfc
, which for each
element contains the geometry as an R object that subclasses sfg
.
An sf
object has the following meta-data held in attributes:
- the name of the (active) geometry column in
sf_column
- the attribute-geometry relationships in
agr
An sfc
geometry list-column has the following meta-data held in attributes:
- the coordinate reference system in
crs
- the bounding box in
bbox
- the precision in
precision
- the number of empty geometries in
n_empty
The most safe way to access or set these attributes is to use
functions like st_bbox
, st_crs
, st_set_crs
, st_agr
,
st_set_agr
, st_precision
, and st_set_precision
.
One could create an sf
object from scratch e.g. by
library(sf)
p1 = st_point(c(7.35, 52.42)); p2 = st_point(c(7.22, 52.18)); p3 = st_point(c(7.44, 52.19))
sfc = st_sfc(p1, p2, p3, crs = 'EPSG:4326')
st_sf(elev = c(33.2, 52.1, 81.2), marker = c("Id01", "Id02", "Id03"), geom = sfc)
# Simple feature collection with 3 features and 2 fields
# Geometry type: POINT
# Dimension: XY
# Bounding box: xmin: 7.22 ymin: 52.2 xmax: 7.44 ymax: 52.4
# Geodetic CRS: WGS 84
# elev marker geom
# 1 33.2 Id01 POINT (7.35 52.4)
# 2 52.1 Id02 POINT (7.22 52.2)
# 3 81.2 Id03 POINT (7.44 52.2)
Figure 7.1 gives an explanation of the components printed.
7.1.1 Creation
7.1.2 Reading and writing
7.1.3 Subsetting
7.1.4 tidyverse
7.2 Spatial joins
In regular (left, right or inner) joins, joined records from a pair of tables are reported when one or more selected attributes match (are identical) in both tables. A spatial join is similar, but the criterion to join records is not equality of attributes but a spatial predicate. This leaves a wide variety of options in order to define spatially matching records, using binary predicates listed in section 3.2.2. The concepts of “left”, “right”, “inner” or “full” joins remain identical to the non-spatial join as the options for handling records that have no spatial match.
When using spatial joins, each record may have several matched records, yielding a large result table. A way to reduce this complexity may be to select from the matching records the one with the largest overlap with the target geometry. An example of this is shown (visually) in figure 7.2.
# example of largest = TRUE:
nc <- st_transform(read_sf(system.file("shape/nc.shp", package="sf")), 2264)
gr = st_sf(
label = apply(expand.grid(1:10, LETTERS[10:1])[,2:1], 1, paste0, collapse = " "),
geom = st_make_grid(nc))
gr$col = sf.colors(10, categorical = TRUE, alpha = .3)
# cut, to check, NA's work out:
gr = gr[-(1:30),]
suppressWarnings(nc_j <- st_join(nc, gr, largest = TRUE))
# the two datasets:
opar = par(mfrow = c(2,1), mar = rep(0,4))
plot(st_geometry(nc_j))
plot(st_geometry(gr), add = TRUE, col = gr$col)
text(st_coordinates(st_centroid(st_geometry(gr))), labels = gr$label)
# the joined dataset:
plot(st_geometry(nc_j), border = 'black', col = nc_j$col)
text(st_coordinates(st_centroid(st_geometry(nc_j))), labels = nc_j$label, cex = .8)
plot(st_geometry(gr), border = 'green', add = TRUE)
Another way to reduce the result set is to aggregate, after a join, all matching records, and union their geometry; see Section ??.
7.3 stars
basics
Athough package sp
has always had limited support for raster data,
over the last decade R package raster
has clearly been dominant
as the prime package for powerful, flexible and scalable raster analysis.
Its data model is that of a 2D raster, or a set of raster layers (a
“raster stack”). This follows the classical static “GIS world view”,
where the world is modelled as a set of layers, each representing
a different theme. A lot of data available today however is dynamic,
and comes as time series of rasters for different themes. A raster
stack does not meaningfully reflect this, requiring the user to
keep a register of which layer represents what.
Also, the raster
package does an excellent job in scaling
computations up to datasizes no larger than the local storage
(the computer’s hard drives). Recent datasets however, including
satellite imagery, climate model or weather forecasting data, often
no longer fit in local storage.
Package spacetime
addresses the analysis of time series of
vector geometries or raster grid cells, but does not extend to
higher-dimensional arrays.
We introduce a new package for analysing data cubes (with raster
analysis as a special case), called stars
(for scalable,
spatiotemporal tidy arrays). The package
- allows for representing dynamic raster stacks,
- in addition to regular grids handles rotated, sheared, rectilinear and curvilinear rasters,
- provides a tight integration with package
sf
, - follows the tidyverse design principles,
- aims at being scalable, also beyond local disk size,
- also handles array data with non-raster spatial dimensions, the vector datacubes,
- provides further integration of novel features in the GDAL library than other R packages have given so far.
Vector data cubes include for instance time series for simple features, or spatial graph data such as origin-destination matrices. The wider concept of spatial vector and raster data cubes is explained in section 6.4
7.3.1 Reading and writing raster data
Raster data typically are read from a file. We read an example
file of a regular, non-rotated grid from the package stars
:
The dataset contains (a section of) a Landsat 7 scene, with the 6 30m-resolution bands (bands 1-5 and 7) for a region covering the city of Olinda, Brazil. A short summary of the data is given by
# stars object with 3 dimensions and 1 attribute
# attribute(s):
# L7_ETMs.tif
# Min. : 1.0
# 1st Qu.: 54.0
# Median : 69.0
# Mean : 68.9
# 3rd Qu.: 86.0
# Max. :255.0
# dimension(s):
# from to offset delta refsys point values x/y
# x 1 349 288776 28.5 UTM Zone 25, Southern Hem... FALSE NULL [x]
# y 1<PHONE_NUMBER> -28.5 UTM Zone 25, Southern Hem... FALSE NULL [y]
# band 1 6 NA NA NA NA NULL
where we see the offset, cellsize, coordinate reference system,
and dimensions. The object x
is a simple list of length one, holding
a three-dimensional array:
# [1] 1
# [1] "array"
# x y band
# 349 352 6
and in addition holds an attribute with a dimensions table with all the metadata required to know what the array values refer to, obtained by
# from to offset delta refsys point values x/y
# x 1 349 288776 28.5 UTM Zone 25, Southern Hem... FALSE NULL [x]
# y 1<PHONE_NUMBER> -28.5 UTM Zone 25, Southern Hem... FALSE NULL [y]
# band 1 6 NA NA NA NA NULL
We can get the spatial extent of the array by
# xmin ymin xmax ymax
#<PHONE_NUMBER>729<PHONE_NUMBER>761
Raster data can be written to local disk using write_stars
:
where the format (in this case, GeoTIFF) is derived from the file extension. As for simple features, reading and writing uses the GDAL library; the list of available drivers for raster data is obtained by
7.3.2 Plotting raster data
We can use the base plot method for stars
objects, shown in figure 7.3.
The default color scale uses grey tones, and stretches this such that color breaks correspond to data quantiles over all bands. A more familiar view is the rgb or false color composite:
par(mfrow = c(1, 2))
plot(x, rgb = c(3,2,1), reset = FALSE, main = "RGB") # rgb
plot(x, rgb = c(4,3,2), main = "False color (NIR-R-G)") # false color
7.3.3 Analysing raster data
Element-wise mathematical operations on stars
objects are just passed
on to the arrays. This means that we can call functions and create
expressions:
# stars object with 3 dimensions and 1 attribute
# attribute(s):
# L7_ETMs.tif
# Min. :0.00
# 1st Qu.:3.99
# Median :4.23
# Mean :4.12
# 3rd Qu.:4.45
# Max. :5.54
# dimension(s):
# from to offset delta refsys point values x/y
# x 1 349 288776 28.5 UTM Zone 25, Southern Hem... FALSE NULL [x]
# y 1<PHONE_NUMBER> -28.5 UTM Zone 25, Southern Hem... FALSE NULL [y]
# band 1 6 NA NA NA NA NULL
# stars object with 3 dimensions and 1 attribute
# attribute(s):
# L7_ETMs.tif
# Min. : 1.0
# 1st Qu.: 62.0
# Median : 77.5
# Mean : 77.1
# 3rd Qu.: 94.9
# Max. :266.1
# dimension(s):
# from to offset delta refsys point values x/y
# x 1 349 288776 28.5 UTM Zone 25, Southern Hem... FALSE NULL [x]
# y 1<PHONE_NUMBER> -28.5 UTM Zone 25, Southern Hem... FALSE NULL [y]
# band 1 6 NA NA NA NA NULL
or even mask out certain values:
# stars object with 3 dimensions and 1 attribute
# attribute(s):
# L7_ETMs.tif
# Min. : 50
# 1st Qu.: 64
# Median : 75
# Mean : 79
# 3rd Qu.: 90
# Max. :255
# NA's :149170
# dimension(s):
# from to offset delta refsys point values x/y
# x 1 349 288776 28.5 UTM Zone 25, Southern Hem... FALSE NULL [x]
# y 1<PHONE_NUMBER> -28.5 UTM Zone 25, Southern Hem... FALSE NULL [y]
# band 1 6 NA NA NA NA NULL
or un-mask areas:
# stars object with 3 dimensions and 1 attribute
# attribute(s):
# L7_ETMs.tif
# Min. : 0
# 1st Qu.: 54
# Median : 69
# Mean : 63
# 3rd Qu.: 86
# Max. :255
# dimension(s):
# from to offset delta refsys point values x/y
# x 1 349 288776 28.5 UTM Zone 25, Southern Hem... FALSE NULL [x]
# y 1<PHONE_NUMBER> -28.5 UTM Zone 25, Southern Hem... FALSE NULL [y]
# band 1 6 NA NA NA NA NULL
Dimension-wise, we can apply functions to array dimensions of stars
objects just like apply
does this to matrices. For instance, to
compute for each pixel the mean of the 6 band values we can do
# stars object with 2 dimensions and 1 attribute
# attribute(s):
# mean
# Min. : 25.5
# 1st Qu.: 53.3
# Median : 68.3
# Mean : 68.9
# 3rd Qu.: 82.0
# Max. :255.0
# dimension(s):
# from to offset delta refsys point values x/y
# x 1 349 288776 28.5 UTM Zone 25, Southern Hem... FALSE NULL [x]
# y 1<PHONE_NUMBER> -28.5 UTM Zone 25, Southern Hem... FALSE NULL [y]
A more meaningful function would e.g. compute the NDVI (normalized differenced vegetation index):
# stars object with 2 dimensions and 1 attribute
# attribute(s):
# ndvi
# Min. :-0.753
# 1st Qu.:-0.203
# Median :-0.069
# Mean :-0.064
# 3rd Qu.: 0.187
# Max. : 0.587
# dimension(s):
# from to offset delta refsys point values x/y
# x 1 349 288776 28.5 UTM Zone 25, Southern Hem... FALSE NULL [x]
# y 1<PHONE_NUMBER> -28.5 UTM Zone 25, Southern Hem... FALSE NULL [y]
Alternatively, to compute for each band the mean of the whole image we can do
# band mean
# 1 1 79.1
# 2 2 67.6
# 3 3 64.4
# 4 4 59.2
# 5 5 83.2
# 6 6 60.0
which is so small it can be printed here as a data.frame
. In these
two examples, entire dimensions disappear. Sometimes, this does not
happen; we can for instance compute the three quartiles for each band
# stars object with 2 dimensions and 1 attribute
# attribute(s):
# L7_ETMs.tif
# Min. : 32.0
# 1st Qu.: 60.8
# Median : 66.5
# Mean : 69.8
# 3rd Qu.: 78.8
# Max. :112.0
# dimension(s):
# from to offset delta refsys point values
# quantile 1 3 NA NA NA NA 25%, 50%, 75%
# band 1 6 NA NA NA NA NULL
and see that this creates a new dimension, quantile
, with three values.
Alternatively, the three quantiles over the 6 bands for each pixel are
obtained by
# stars object with 3 dimensions and 1 attribute
# attribute(s):
# L7_ETMs.tif
# Min. : 4.0
# 1st Qu.: 55.0
# Median : 69.2
# Mean : 67.2
# 3rd Qu.: 81.2
# Max. :255.0
# dimension(s):
# from to offset delta refsys point
# quantile 1 3 NA NA NA NA
# x 1 349 288776 28.5 UTM Zone 25, Southern Hem... FALSE
# y 1<PHONE_NUMBER> -28.5 UTM Zone 25, Southern Hem... FALSE
# values x/y
# quantile 25%, 50%, 75%
# x NULL [x]
# y NULL [y]
7.3.4 Curvilinear rasters
There are several reasons why non-regular rasters occur. For one, when the data is Earth-bound, a regular raster does not fit the Earth surface, which is curved. Other reasons are:
- when we convert or transform a regular raster data into another coordinate reference system, it will become curvilinear unless we resample; resampling always goes at the cost of some loss of data and is not reversible.
- observation may lead to irregular rasters; e.g. for satellite swaths, we may have a regular raster in the direction of the satellite (not aligned with \(x\) or \(y\)), and rectilinear perpendicular to that (e.g. if the sensor discretizes the viewing angle in equal sections)
7.3.5 Handling large raster datasets
A common challenge with raster datasets is not only that they come in large files (single Sentinel-2 tiles are around 1 Gb), but that many of these files, potentially thousands, are needed to address the area and time period of interest. At time of writing this, the Copernicus program which runs all Sentinel satellites publishes 160 Tb of images per day. This means that a classic pattern in using R, consisting of
- downloading data to local disc,
- loading the data in memory,
- analysing it
is not going to work.
Cloud-based Earth Observation processing platforms like Google Earth Engine (Gorelick et al. 2017) or Sentinel Hub recognize this and let users work with datasets up to 20 petabyte rather easily and with a great deal of interactivity. They share the following properties:
- computations are posponed as long as possible (lazy evaluation),
- only the data you ask for are being computed and returned, and nothing more,
- storing intermediate results is avoided in favour of on-the-fly computations,
- maps with useful results are generated and shown quickly to allow for interactive model development.
This is similar to the dbplyr
interface to databases
and cloud-based analytics environments, but differs in the aspect of
what we want to see quickly: rather than the first \(n\) records,
we want a quick overview of the results, in the form of a map
covering the whole area, or part of it, but at screen resolution
rather than native (observation) resolution.
If for instance we want to “see” results for the United States on screen with 1000 x 1000 pixels, we only need to compute results for this many pixels, which corresponds roughly to data on a grid with 3000 m x 3000 m grid cells. For Sentinel-2 data with 10 m resolution, this means we can subsample with a factor 300, giving 3 km x 3 km resolution. Processing, storage and network requirements then drop a factor \(300^2 \approx 10^5\), compared to working on the native 10 m x 10 m resolution. On the platforms mentioned, zooming in the map triggers further computations on a finer resolution and smaller extent.
A simple optimisation that follows these lines is how stars’ plot method works: in case of plotting large rasters, it subsamples the array before it plots, drastically saving time. The degree of subsampling is derived from the plotting region size and the plotting resolution (pixel density). For vector devices, such as pdf, R sets plot resolution to 75 dpi, corresponding to 0.3 mm per pixel. Enlarging plots may reveal this, but replotting to an enlarged devices will create a plot at target density.
7.3.6 stars
proxy objects
To handle datasets that are too large to fit in memory, stars
provides stars_proxy
objects. To demonstrate its use, we will
use the starsdata
package, an R data package with larger datasets
(around 1 Gb total). It can be installed by
We can “load” a Sentinel-2 image from it by
granule = system.file("sentinel/S2A_MSIL1C_20180220T105051_N0206_R051_T32ULE_20180221T134037.zip", package = "starsdata")
file.size(granule)
# [1] 7.69e+08
base_name = strsplit(basename(granule), ".zip")[[1]]
s2 = paste0("SENTINEL2_L1C:/vsizip/", granule, "/", base_name, ".SAFE/MTD_MSIL1C.xml:10m:EPSG_32632")
(p = read_stars(s2, proxy = TRUE))
# stars_proxy object with 1 attribute in 1 file(s):
# $`MTD_MSIL1C.xml:10m:EPSG_32632`
# [1] "[...]/MTD_MSIL1C.xml:10m:EPSG_32632"
#
# dimension(s):
# from to offset delta refsys point values x/y
# x 1 10980 3e+05 10 WGS 84 / UTM zone 32N NA NULL [x]
# y 1 10980 6e+06 -10 WGS 84 / UTM zone 32N NA NULL [y]
# band 1 4 NA NA NA NA B4,...,B8
# 11160 bytes
and we see that this does not actually load any of the pixel
values, but keeps the reference to the dataset and fills the
dimensions table. (The convoluted s2
name is needed to point
GDAL to the right file inside the .zip
file containing 115 files
in total).
The idea of a proxy object is that we can build expressions like
but that the computations for this are postponed. Only when we
really need the data, e.g. because we want to plot it, is p * 2
evaluated. We need data when either
- we want to
plot
data, or - we want to write an object to disk, with
write_stars
, or - we want to explicitly load an object in memory, with
st_as_stars
In case the entire object does not fit in memory, plot
and
write_stars
choose different strategies to deal with this:
plot
fetches only the pixels that can be seen, rather than all pixels available, andwrite_stars
reads, processes, and writes data chunk by chunk.
Downsampling and chunking is implemented for spatially dense images, not e.g. for dense time series, or other dense dimensions.
As an example,
only fetches the pixels that can be seen on the plot device, rather than the 10980 x 10980 pixels available in each band. The downsampling ratio taken is
# [1] 19
meaning that for every 19 x 19 sub-image in the original image, only one pixel is read, and plotted. This value is still a bit too high as it ignores the white space and space for the key on the plotting device.
7.3.7 Operations on proxy objects
A few dedicated methods are available for stars_proxy
objects:
# [1] [ [[<- adrop aggregate aperm
# [6] as.data.frame c coerce dim droplevels
# [11] filter initialize mapView Math merge
# [16] mutate Ops plot predict print
# [21] pull select show slice slotsFromS3
# [26] split st_apply st_as_sf st_as_stars st_crop
# [31] st_mosaic st_redimension st_sample st_set_bbox transmute
# [36] write_stars
# see '?methods' for accessing help and source code
We have seen plot
and print
in action; dim
reads out
the dimension from the dimensions metadata table.
The three methods that actually fetch data are st_as_stars
,
plot
and write_stars
. st_as_stars
reads the actual data into a
stars
object, its argument downsample
controls the downsampling
rate. plot
does this too, choosing an appropriate downsample
value from the device resolution, and plots the object. write_stars
writes a star_proxy
object to disc.
All other methods for stars_proxy
objects do not actually operate
on the raster data but add the operations to a to do list,
attached to the object. Only when actual raster data are fetched,
e.g. by calling plot
or st_as_stars
, the commands in this list
are executed.
st_crop
limits the extent (area) of the raster that will be
read. c
combines stars_proxy
objects, but still doesn’t read
any data. adrop
drops empty dimensions, aperm
changes dimension
order.
write_stars
reads and processes its input chunk-wise; it has an
argument chunk_size
that lets users control the size of spatial
chunks.
7.4 Vector data cube examples
7.4.1 Example: aggregating air quality time series
Air quality data from package spacetime
were
obtained from the airBase European air quality data
base.
Downloaded were daily average PM\(_{10}\) values for rural background
stations in Germany, 1998-2009.
We can create a stars
object from the air
matrix, the dates
Date vector and the stations
SpatialPoints
objects by
# space time
# 70 4383
d = st_dimensions(station = st_as_sfc(stations), time = dates)
(aq = st_as_stars(list(PM10 = air), dimensions = d))
# stars object with 2 dimensions and 1 attribute
# attribute(s):
# PM10
# Min. : 0
# 1st Qu.: 10
# Median : 15
# Mean : 18
# 3rd Qu.: 22
# Max. :274
# NA's :157659
# dimension(s):
# from to offset delta refsys point
# station 1 70 NA NA +proj=longlat +datum=WGS8... TRUE
# time 1 4383 1998-01-01 1 days Date FALSE
# values
# station POINT (9.59 53.7),...,POINT (9.45 49.2)
# time NULL
We can see from figure 7.5 that the time series are quite long, but also have large missing value gaps. Figure 7.6 shows the spatial distribution measurement stations and mean PM\(_{10}\) values.
plot(st_as_sf(st_apply(aq, 1, mean, na.rm = TRUE)), reset = FALSE, pch = 16,
ylim = st_bbox(DE)[c(2,4)])
# Warning in sp::proj4string(obj): CRS object has comment, which is lost in output
We can now aggregate these station time series to area means,
mostly as a simple exercise. For this, we use the aggregate
method for stars
objects
# stars object with 2 dimensions and 1 attribute
# attribute(s):
# PM10
# Min. : 1
# 1st Qu.: 11
# Median : 15
# Mean : 18
# 3rd Qu.: 22
# Max. :172
# NA's :25679
# dimension(s):
# from to offset delta refsys point
# geometry 1 16 NA NA +proj=longlat +datum=WGS8... FALSE
# time 1 4383 1998-01-01 1 days Date FALSE
# values
# geometry MULTIPOLYGON (((9.65 49.8, ...,...,MULTIPOLYGON (((10.8 51.6, ...
# time NULL
and we can now for instance show the maps for six arbitrarily chosen days (figure 7.7),
or a time series of mean values for a single state (figure 7.8).
7.4.2 Example: Bristol origin-destination datacube
The data used for this example come from (Lovelace, Nowosad, and Muenchow 2019), and concern origin-destination (OD) counts: the number of persons going from region A to region B, by transportation mode. We have feature geometries for the 102 origin and destination regions, shown in figure 7.9.
library(spDataLarge)
plot(st_geometry(bristol_zones), axes = TRUE, graticule = TRUE)
plot(st_geometry(bristol_zones)[33], col = 'red', add = TRUE)
and the OD counts come in a table with OD pairs as records, and transportation mode as variables:
# # A tibble: 6 x 7
# o d all bicycle foot car_driver train
# <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
# 1 E02002985 E02002985 209 5 127 59 0
# 2 E02002985 E02002987 121 7 35 62 0
# 3 E02002985 E02003036 32 2 1 10 1
# 4 E02002985 E02003043 141 1 2 56 17
# 5 E02002985 E02003049 56 2 4 36 0
# 6 E02002985 E02003054 42 4 0 21 0
We see that many combinations of origin and destination are implicit zeroes, otherwise these two numbers would have been the same:
# [1] 10404
# [1] 2910
We will form a three-dimensional vector datacube with origin,
destination and transportation mode as dimensions. For this, we
first “tidy” the bristol_od
table to have origin (o), destination (d),
transportation mode (mode), and count (n) as variables, using gather
:
# create O-D-mode array:
bristol_tidy <- bristol_od %>% select(-all) %>% gather("mode", "n", -o, -d)
head(bristol_tidy)
# # A tibble: 6 x 4
# o d mode n
# <chr> <chr> <chr> <dbl>
# 1 E02002985 E02002985 bicycle 5
# 2 E02002985 E02002987 bicycle 7
# 3 E02002985 E02003036 bicycle 2
# 4 E02002985 E02003043 bicycle 1
# 5 E02002985 E02003049 bicycle 2
# 6 E02002985 E02003054 bicycle 4
Next, we form the three-dimensional array a
, filled with zeroes:
od = bristol_tidy %>% pull("o") %>% unique
nod = length(od)
mode = bristol_tidy %>% pull("mode") %>% unique
nmode = length(mode)
a = array(0L, c(nod, nod, nmode),
dimnames = list(o = od, d = od, mode = mode))
We see that the dimensions are named with the zone names (o, d)
and the transportation mode name (mode).
Every row of bristol_tidy
denotes an array entry, and we can
use this to to fill the non-zero entries of the bristol_tidy
table
with their appropriate value (n
):
To be sure that there is not an order mismatch between the zones
in bristol_zones
and the zone names in bristol_tidy
, we can
get the right set of zones by:
order = match(od, bristol_zones$geo_code) # it happens this equals 1:102
zones = st_geometry(bristol_zones)[order]
(It happens that the order is already correct, but it is good practice to not assume this).
Next, with zones and modes we can create a stars dimensions object:
# from to offset delta refsys point
# o 1 102 NA NA WGS 84 FALSE
# d 1 102 NA NA WGS 84 FALSE
# mode 1 4 NA NA NA FALSE
# values
# o MULTIPOLYGON (((-2.51 51.4,...,...,MULTIPOLYGON (((-2.55 51.5,...
# d MULTIPOLYGON (((-2.51 51.4,...,...,MULTIPOLYGON (((-2.55 51.5,...
# mode bicycle,...,train
and finally build or stars object from a
and d
:
# stars object with 3 dimensions and 1 attribute
# attribute(s):
# N
# Min. : 0
# 1st Qu.: 0
# Median : 0
# Mean : 5
# 3rd Qu.: 0
# Max. :1296
# dimension(s):
# from to offset delta refsys point
# o 1 102 NA NA WGS 84 FALSE
# d 1 102 NA NA WGS 84 FALSE
# mode 1 4 NA NA NA FALSE
# values
# o MULTIPOLYGON (((-2.51 51.4,...,...,MULTIPOLYGON (((-2.55 51.5,...
# d MULTIPOLYGON (((-2.51 51.4,...,...,MULTIPOLYGON (((-2.55 51.5,...
# mode bicycle,...,train
We can take a single slice through from this three-dimensional
array, e.g. for zone 33 (figure 7.9), by odm[,,33]
,
and plot it:
# Warning in st_as_sf.stars(x): working on the first sfc dimension only
# Warning in st_bbox.dimensions(st_dimensions(obj), ...): returning the bounding
# box of the first geometry dimension
# Warning in st_bbox.dimensions(st_dimensions(obj), ...): returning the bounding
# box of the first geometry dimension
Subsetting this way, we take all attributes (there is only one: N) since the first argument is empty, we take all origin regions (second argument empty), we take destination zone 33 (third argument), and all transportation modes (fourth argument empty, or missing).
We plotted this particular zone because it has the largest number of travelers as its destination. We can find this out by summing all origins and travel modes by destination:
# [1] 33
Other aggregations we can carry out include: total transportation by OD (102 x 102):
# stars object with 2 dimensions and 1 attribute
# attribute(s):
# sum
# Min. : 0
# 1st Qu.: 0
# Median : 0
# Mean : 19
# 3rd Qu.: 19
# Max. :1434
# dimension(s):
# from to offset delta refsys point
# o 1 102 NA NA WGS 84 FALSE
# d 1 102 NA NA WGS 84 FALSE
# values
# o MULTIPOLYGON (((-2.51 51.4,...,...,MULTIPOLYGON (((-2.55 51.5,...
# d MULTIPOLYGON (((-2.51 51.4,...,...,MULTIPOLYGON (((-2.55 51.5,...
Origin totals, by mode:
# stars object with 2 dimensions and 1 attribute
# attribute(s):
# sum
# Min. : 1
# 1st Qu.: 58
# Median : 214
# Mean : 490
# 3rd Qu.: 771
# Max. :2903
# dimension(s):
# from to offset delta refsys point
# o 1 102 NA NA WGS 84 FALSE
# mode 1 4 NA NA NA FALSE
# values
# o MULTIPOLYGON (((-2.51 51.4,...,...,MULTIPOLYGON (((-2.55 51.5,...
# mode bicycle,...,train
Destination totals, by mode:
# stars object with 2 dimensions and 1 attribute
# attribute(s):
# sum
# Min. : 0
# 1st Qu.: 13
# Median : 104
# Mean : 490
# 3rd Qu.: 408
# Max. :12948
# dimension(s):
# from to offset delta refsys point
# d 1 102 NA NA WGS 84 FALSE
# mode 1 4 NA NA NA FALSE
# values
# d MULTIPOLYGON (((-2.51 51.4,...,...,MULTIPOLYGON (((-2.55 51.5,...
# mode bicycle,...,train
Origin totals, summed over modes:
Destination totals, summed over modes (we had this):
We take o
and d
together and plot them by
There is something to say for the argument that such maps give the wrong message, as both amount (color) and polygon size give an impression of amount. To take out the amount in the count, we can compute densities (count / km\(^2\)), by
# udunits database from /usr/share/xml/udunits/udunits2.xml
7.4.3 Tidy array data
The tidy data paper (Wickham 2014b) may suggest that such array data should be processed not as an array, but in a long table where each row holds (region, class, year, value), and it is always good to be able to do this. For primary handling and storage however, this is often not an option, because
- a lot of array data are collected or generated as array data, e.g. by imagery or other sensory devices, or e.g. by climate models
- it is easier to derive the long table form from the array than vice versa
- the long table form requires much more memory, since the space occupied by dimension values is \(O(nmp)\), rather than \(O(n+m+p)\)
- when missing-valued cells are dropped, the long table form loses the implicit indexing of the array form
To put this argument to the extreme, consider for instance that
all image, video and sound data are stored in array form; few
people would make a real case for storing them in a long table
form instead. Nevertheless, R packages like tsibble
take this
approach, and have to deal with ambiguous ordering of multiple records
with identical time steps for different spatial features and index
them, which is solved for both automatically by using the array form.
Package stars
tries to follow the tidy
manifesto
to handle array sets, and has particularly developed support for the
case where one or more of the dimensions refer to space, and/or time.
7.5 raster-to-vector, vector-to-raster
(see Ch 1)
- direct rasterization of points, lines or polygons (section 7.5)
7.6 transforming and warping rasters
7.7 Exercises
- NDVI, normalized differenced vegetation index, is coputed as (NIR-R)/(NIR+R), with NIR the near infrared and R the red band. Read the
L7_ETMs.tif
file into objectx
, and distribute the band dimensions over attributes bysplit(x, "band")
. Then, compute NDVI by using an expression that uses the NIR (band 4) and R (band 3) attributes directly. - Compute NDVI for the S2 image, using
st_apply
and an a functionndvi = function(x) (x[4]-x[3])/(x[4]+x[3])
. Plot the result, and write the result to a GeoTIFF. Explain the difference in runtime between plotting and writing. - Use
st_transform
to transform thestars
object read fromL7_ETMs.tif
to EPSG 4326. Print the object. Is this a regular grid? Plot the first band using argumentsaxes=TRUE
andborder=NA
, and explain why this takes such a long time. - Use
st_warp
to warp theL7_ETMs.tif
object to EPSG 4326, and plot the resulting object withaxes=TRUE
. Why is the plot created much faster than afterst_transform
?
References
Eddelbuettel, Dirk. 2013. Seamless R and C++ Integration with Rcpp. Springer.
Gorelick, Noel, Matt Hancher, Mike Dixon, Simon Ilyushchenko, David Thau, and Rebecca Moore. 2017. “Google Earth Engine: Planetary-Scale Geospatial Analysis for Everyone.” Remote Sensing of Environment 202: 18–27. https://doi.org/10.1016/j.rse.2017.06.031.
Herring, John, and others. 2011. “Opengis Implementation Standard for Geographic Information-Simple Feature Access-Part 1: Common Architecture [Corrigendum].”
Lovelace, Robin, Jakub Nowosad, and Jannes Muenchow. 2019. Geocomputation with R. Chapman; Hall/CRC. https://geocompr.robinlovelace.net/.
Pebesma, Edzer. 2018. “Simple Features for R: Standardized Support for Spatial Vector Data.” The R Journal 10 (1): 439–46. https://doi.org/10.32614/RJ-2018-009.
Wickham, Hadley. 2014b. “Tidy Data.” Journal of Statistical Software 59 (1). https://www.jstatsoft.org/article/view/v059i10.


+++ title = "Navidrome" linkTitle = "Navidrome" +++ {{< blocks/cover title="Welcome to Navidrome!" image_anchor="top" height="full" color="orange" >}}
{{< /blocks/cover >}} {{% blocks/lead color="primary" %}} Navidrome allows you to enjoy your music collection from anywhere, by making it available through a modern Web UI and through a wide range of third-party compatible mobile apps, for both iOS and Android devices. Navidrome is open source software distributed **free of charge** under the terms of the [GNU GPL v3](https://www.gnu.org/licenses/gpl-3.0) license. {{% /blocks/lead %}} {{< blocks/section color="light" >}} {{% blocks/feature icon="fa-mobile-alt" title="Access your music from anywhere!" url="/docs/overview" %}} Choose from a large selection of mobile clients or use the integrated web player {{% /blocks/feature %}} {{% blocks/feature icon="fa-bolt" title="Blazing fast!" url="/docs/overview" %}} Lightweight, fast and self-contained. Runs well even on resource-limited platforms (ex: Raspberry Pi) {{% /blocks/feature %}} {{% blocks/feature icon="fa-database" title="Handles large libraries!" url="/docs/overview" %}} Plays well with gigantic music collections (tested with ~900K songs - 2/3 FLAC, 1/3 MP3) {{% /blocks/feature %}} {{% blocks/feature icon="fa-compress-arrows-alt" title="Transcoding on the fly!" url="/docs/overview" %}} Converts/reduces your music files as you play them, so you don't nuke your data plan {{% /blocks/feature %}} {{% blocks/feature icon="fa-certificate" title="Modern and up-to-date" url="/docs/overview" %}} Built with new technologies ([GoLang](https://golang.org), [ReactJS](https://reactjs.org), [Material-UI](https://material-ui.com/)), to ensure modern features and compatibility {{% /blocks/feature %}} {{% blocks/feature icon="icon-subsonic" title="Subsonic API" url="/docs/overview/#apps" %}} Compatible with the de facto standard Music API, supporting all its clients and ecosystem {{% /blocks/feature %}} {{% blocks/feature icon="fa-heartbeat" title="Active project!" url="/docs/overview#road-map" %}} New releases on a regular basis, adding features and bug fixes {{% /blocks/feature %}} {{% blocks/feature icon="fab fa-github" title="Contributions welcome!" url="https://github.com/navidrome/navidrome" %}} We do a [Pull Request](https://github.com/navidrome/navidrome/pulls) contributions workflow on **GitHub**. New users are always welcome! {{% /blocks/feature %}} {{% blocks/feature icon="fas fa-comments" title="Join the conversation!" url="/community" %}} For announcement of latest features, discussions and help from your fellow users, join our [Reddit](https://www.reddit.com/r/navidrome/) or our [Discord](https://discord.gg/xh7j7yF) {{% /blocks/feature %}} {{< /blocks/section >}}


{% include "coda/coda/instances.html" %}
{% include "coda/coda/floating_ips.html" %}
{% include "coda/coda/security_groups.html" %}
{% include "coda/coda/networks.html" %}
{% include "coda/coda/subnets.html" %}
{% include "coda/coda/routers.html" %}
{% include "coda/coda/volumes.html" %}
{% include "coda/coda/images.html" %}
{% endfor %}


School of Fine Arts
Venue Page
Type
Mobile
Project Aspects
Ideation, Wireframing, Mockups, Research, Development
My Role
Created wireframes, mockups, and prototypes. Partook in
ideation of the app feature and assisted in development (CSS3).
Timeline
December – February (2 months)
Introduction
The University of Connecticut hosts a plethora of events each week. To find out more about these events, a person would have to go on each individual fine arts website to look at their calender. Because of the difficulty of finding events, the Web Dev team was requested by the Fine Arts Department to create a Fine Arts Venue section for the “MyUConn App” to showcase these events. The myUConn app is downloaded by over 10,000 students on android devices and many more on IOS. This function would be accesible to everyone with the app and also on desktop.
Goal/Objective
Our goal was to make information about events more accessible and readily available.
Before, students would have to either go on different sites individually to find out more information or to find out about events through social media. Because of this, the turnout to the events aren’t as high as it possibly could be and many people end up not hearing about events.
User Research
This is an app
This is an app that will primarily be used on mobile devices, but can also be accessed through desktop. I met with a few students and asked some questions:
-How did you usually find out about events around campus?
-Have there ever been times where you were misinformed about an event?
-Have you ever heard about events from social media? If so, what apps?
-Do you have people you know within the fine arts community?
Afterwards, I crafted a user persona that addresses the answers I received. Fine art students and those who are interested in fine art events agreed they wanted an app that would be easy to navigate and straight to the point without other confusing elements.
Early Wireframes:
I wireframed some potential ideas for both mobile and desktop, exploring different possible layouts and possible ways to organize information. After wireframing, I came to realize that the way I initially designed the buttons made the content too crammed and made it hard for the user to select one. It was important to keep accessibility in mind, so I decided to make it stacked so the buttons could be larger.
Since we were using Aurora, a system within Wordpress that the university implemented, we went with their calendar feature as a display to showcase all the events. We also had to keep development and code into mind when designing, as the team only consisted of me and another web designer/developer.
User-Flow Mapping
Conclusion
When designing for the product and looking at the end result and thinking about what came before this, I realized how difficult it was to find events for fine art events. It is such a small part of the university, and as a former fine arts student, I am glad these events were more accessible.
What really helped the flow of this feature was putting the Users needs in mind first. Finding events shouldn’t have to take any longer than a minute. Some key highlights and aspects are:
a. Straightforward user flow
We didn’t want to make it as simple and straightforward as possible so users don’t have to spend so long finding information. There is a home page that features all of the fine arts department and an individual page for each one containing all their upcoming events.
b. Simple UI/Page layout
The main goal and function of the site was to make this information easily accesible. With a
straightforward layout, users can easily spot when events are taking place and easily
access the portal to buy tickets.
What I learned from this project is less is more. The simpler the page layout and navigation, the more time you save for your users who are trying to find the information they need.


Complete By Task + Task TASKS MESSAGES WRITE A MESSAGE Send ARTICLES Article URL Title Synopsis + Article Event Name Date Location + Event EVENTS FRIENDS


Cranky Critic® movie Reviews: My Life So Far Starring Colin Firth, Rosemary Harris, Irene Jacob, Tcheky Karyo, Mary Elizabeth Mastrantonio, Robbie Norman and Malcolm McDowell Screenplay by Simon Donald Based on "Son of Adam" by Sir Denis Forman Directed by Hugh Hudson website: http://www.miramax.com
My Life So Far is the kind of slice of life old school stories that print critics wax poetic over. I could see calling it a well-acted, intimate portrait of a puritan Scots family confronted by the deadly sins of lust and greed, while dealing with a young boy's awakening sexual curiosity. That's fair, but it doesn't relay the fact that this flick is a dud.
Cranky has thought long and hard about why this beautifully photographed film falls short of expectations -- director Hugh Hudson and producer David Puttnam last worked together on Chariots of Fire; Puttnam is responsible for the most excellent and highly recommended Local Hero. My conclusions after the synopsis.
Set in Argyll, Scotland in 1927 My Life So Far is narrated by 10 year old Fraser Pettigrew (Robbie Norman), a red haired, blue eyed cutey. His father Edward (Colin Firth) is a bit of an eccentric inventor, whose obsession with creating products out of moss brings him into conflict with brother-in-law Morris (Malcolm McDowell). Morris, a self-made millionaire, wants control of the family's estate, called Kilronan, currently lorded over by his mom "Gamma MacIntosh" (Rosemary Harris). Not only is Morris rich, this sixty-ish gent is sporting a brand-new 24-year old French wife named Heloise (Irene Jacob) whose affection for young Fraser makes daddy Edward jealous. Wife Moira (Mary Elizabeth Mastrantonio) keeps a stiff upper lip when she uncovers evidence of Edward's infidelity.
Fraser narrates the story and, from time to time, inflicts bits of wisdom gleaned from his deceased Grandfather's "Encyclopedia of Ethics" into the family conversations. Problem is, the "encyclopedia" documents various sexual peccadilloes and practices that the ten year old is way to young to understand -- he suggests, for example, that his mother and new aunt engage in the practice of prostitution to raise money to aid the poor.
Yes, it's funny. Kidlets talking dirty always is, especially with the upper class language that is the territory of this tale. But having a ten year old, who has no conception of the sexual conflicts raging among the adults around him, narrate the tale does nothing but hinder the greater story. While Edward explains to Fraser that Beethoven is the music that God dreams while Jazz is music that the Devil creates, the boy is too young to understand the sexual subtext that jazz brought to the 1920s.  Hudson does a visual dance around the question of whether Edward raped Heloise, or if their one and only dalliance was consensual. (It's hard applying 1990s standards to a 1920s setting.  It matters not to Moira, whose emotions are bottled up until the very end of the flick.
Sorry, Cranky's writing like a film student. It happens from time to time. But there's only a paragraph or so to go, so hang in there.
The print critics may rave about fine acting performances, and there are two to be mentioned here: Mary Elizabeth Mastrantonio, who has little to say, and must bear her emotional consternation silently; Malcolm McDowell, as the loud (sic) I-know-better-than-you uncle whose character is a flame burning in an emotionally dense fog. As good as this pair are, it's not enough to recommend My Life So Far.
On average, a first run movie ticket will run you Eight Bucks. Were Cranky able to set his own price to My Life So Far, he would have paid...
$1.00
A Dud's a dud, regardless of the big name's attached.
Cranky Critic® is a Registered Trademark of, and Copyright © by, Chuck Schwartz. All Rights Reserved.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


For now tests must be run manually. Upon clicking "Start Tests" the question manager app will be setup with dummy data. Please test all user interactions (i.e. make on-page actions and check the console for errors).
NOTE: With the large volume of console logs that are made (50,000+) we highly recommend using Chrome to debug this app. It will still take a few seconds to process, but it is nothing compared to the time that Firefox or IE will take (minutes).


It is the technical event which is going to be to held on 18th of march.It also includes different types of technical event which is a source for all the student to learn and experience
Hackathon hosted by the Decoders Club was held on 9th of Feburary 2020. It proved to be a successfull event and many students particapipated


POKER GAME SCORE
Random
Cards
Your
Cards
1
2
3
4
5
6
7
8
9
10
J
Q
K
♣
♦
♥
♠
1
2
3
4
5
6
7
8
9
10
J
Q
K
♣
♦
♥
♠
1
2
3
4
5
6
7
8
9
10
J
Q
K
♣
♦
♥
♠
1
2
3
4
5
6
7
8
9
10
J
Q
K
♣
♦
♥
♠
1
2
3
4
5
6
7
8
9
10
J
Q
K
♣
♦
♥
♠
YOUR SCORE
GIVE ME CARDS


Icons for pressure loss calculation
| Name | Description |
|---|---|
| BendEdged_d | Geometry figure of edged bend |
| Channel_d | Geometry figure for channel |
| OrificeSuddenChangeSection_d | Geometry figure for orifice with sudden change of cross sectional area |
| OrificeThickEdged_d | Geometry figure for orifice with thick edged vena contraction |
| StraightPipe_d | Geometry figure for straight pipe |
| Valve_d | Icon for valve |
| FlowModel | Icon for flow model in Modelica.Fluid applications |
| Bend_i | Icon for bend |
| Channel_i | Icon for channel |
| General_i | Icon for general pressure drop |
| HeatExchanger_i | |
| Orifice_i | Icon for orifice |
| StraightPipe_i | Icon for straight pipe |
| Valve_i | Icon for valve |


Interface ISvgAnimateElement
This interface corresponds to the "animate" element.
Inherited Members
Namespace: SharpVectors.Dom.Svg
Assembly: SharpVectors.Core.dll
Syntax
public interface ISvgAnimateElement : ISvgAnimationElement, ISvgElement, IElement, IXmlElement, INode, IXmlNode, ISvgTests, ISvgUriReference, ISvgExternalResourcesRequired, IElementTimeControl, IEventTarget, ISvgStylable
Properties
Accumulate
Gets or sets a value that controls whether or not the animation is cumulative.
Declaration
string Accumulate { get; set; }
Property Value
| Type | Description |
|---|---|
| String | Possible value are none | sum, default is none.
|
Remarks
This attribute is ignored if the target attribute value does not support addition, or if the animation element does not repeat.
Cumulative animation is not defined for "to animation".
This attribute will be ignored if the animation function is specified with only the "to" attribute.
Additive
Gets or sets a value that controls whether or not the animation is additive.
Declaration
string Additive { get; set; }
Property Value
| Type | Description |
|---|---|
| String | Posible values are replace | sum, default is sum.
|
AttributeName
Gets or sets the name of the target attribute. An XMLNS prefix may be used to indicate the XML namespace for the attribute. The prefix will be interpreted in the scope of the current (i.e., the referencing) animation element.
Declaration
string AttributeName { get; }
Property Value
| Type | Description |
|---|---|
| String |
AttributeType
Gets or sets the namespace in which the target attribute and its associated values are defined.
Declaration
string AttributeType { get; set; }
Property Value
| Type | Description |
|---|---|
| String | The attribute value is one of the following (values are case-sensitive): CSS | XML | auto
The default value is 'auto'. |
By
Gets or sets a value that specifies a relative offset value for the animation.
Declaration
string By { get; set; }
Property Value
| Type | Description |
|---|---|
| String | Specifies a relative offset value for the animation. |
CalcMode
Gets or sets a value that specifies the interpolation mode for the animation.
Declaration
string CalcMode { get; set; }
Property Value
| Type | Description |
|---|---|
| String | This can take any of the following values. The default mode is 'linear', however if the attribute does not support linear interpolation (e.g. for strings), the "calcMode" attribute is ignored and discrete interpolation is used.
|
From
Gets or sets a value that specifies the starting value of the animation.
Declaration
string From { get; set; }
Property Value
| Type | Description |
|---|---|
| String | Specifies the starting value of the animation. |
KeySplines
Gets or sets a set of Bézier control points associated with the "keyTimes" list, defining a cubic Bézier function that controls interval pacing.
Declaration
string KeySplines { get; set; }
Property Value
| Type | Description |
|---|---|
| String | The attribute value is a semicolon-separated list of control point descriptions. Each control point description is a set of four values: x1 y1 x2 y2, describing the Bézier control points for one time segment. The values must all be in the range 0 to 1. This attribute is ignored unless the "calcMode" is set to 'spline'. |
KeyTimes
Gets or sets a semicolon-separated list of time values used to control the pacing of the animation.
Declaration
string KeyTimes { get; set; }
Property Value
| Type | Description |
|---|---|
| String | Each time in the list corresponds to a value in the "values" attribute list, and defines when the value is used in the animation function. Each time value in the "keyTimes" list is specified as a floating point value between 0 and 1 (inclusive), representing a proportional offset into the simple duration of the animation element. |
Remarks
For animations specified with a "values" list, the "keyTimes" attribute if specified must have exactly as many values as there are in the "values" attribute. For from/to/by animations, the "keyTimes" attribute if specified must have two values.
Each successive time value must be greater than or equal to the preceding time value.
The "keyTimes" list semantics depends upon the interpolation mode:
- For linear and spline animation, the first time value in the list must be 0, and the last time value in the list must be 1. The key time associated with each value defines when the value is set; values are interpolated between the key times.
- For discrete animation, the first time value in the list must be 0. The time associated with each value defines when the value is set; the animation function uses that value until the next time defined in "keyTimes".
If the interpolation mode is 'paced', the "keyTimes" attribute is ignored.
If there are any errors in the "keyTimes" specification (bad values, too many or too few values), the document fragment is in error (see error processing).
If the simple duration is indefinite, any "keyTimes" specification will be ignored.
To
Gets or sets a value that specifies the ending value of the animation.
Declaration
string To { get; set; }
Property Value
| Type | Description |
|---|---|
| String | Specifies the ending value of the animation. |
Values
Gets or sets a semicolon-separated list of one or more values.
Declaration
string Values { get; set; }
Property Value
| Type | Description |
|---|---|
| String | Vector-valued attributes are supported using the vector syntax of the "attributeType" domain. |


{% extends "email_subscription/subscription_base.html" %} {% load url from future %} {% load i18n %} {% block title %}{% trans "Subscription your email." %}{% endblock %} {% block content %}
{% trans "If you are willing to receive emails connected with this site please subscribe" %}
{% endblock %}


— Brian Moeskau (@bmoeskau)
— Chander Dhall (@csdhall)
Thanks to our venue:
Thanks to our sponsor:
| 57 | 52 | 14 15060 |
10.1 |
| 57 58 |
52 53 |
1415<PHONE_NUMBER> |
10.1 |
In-browser key/value database with:
(And a teaser of headless Chrome coming soon)
Released April 19 — Release Notes
Nothing major, lots of minor improvements.
Released April 11
Part of Windows 10 Creators Update
(Basically a rollup of stuff we've been talking about for a while)
Widely released March 27 — Release Notes
Basically brought it to parity with Chrome and FF
Which are the top 5 browsers, worldwide, across all platforms?
| 52% | 14% | 9% | 7% | 4% |
Learn more and know your audience!
Compared to pre-processors (SASS, LESS):
* You don't need to support IE, right?
Build VR websites and interactive 360 experiences with React
Coming later this year (Fall 2017)
And a whole lot more!
Find out more. Here's an example:
example.com. CAA 0 issue "letsencrypt.org"
example.com. CAA 0 iodef<EMAIL_ADDRESS>Bottom line: If you manage DNS, start using this!
The Chromium team highly recommends that you not use JavaScript dialogs.
Includes alert(), confirm(), and prompt()
They recommend instead using...
This year, over 64,000 developers told us how they learn and level up, which tools they’re using, and what they want.
This year, over 64,000 developers told us how they learn and level up, which tools they’re using, and what they want.
A civic hackathon where we hack solutions to our community problems.
/
#


Box character controller. More...
#include <PxBoxController.h>
Public Member Functions | |
| virtual PxF32 | getHalfHeight () const =0 |
| Gets controller's half height. More... | |
| virtual PxF32 | getHalfSideExtent () const =0 |
| Gets controller's half side extent. More... | |
| virtual PxF32 | getHalfForwardExtent () const =0 |
| Gets controller's half forward extent. More... | |
| virtual bool | setHalfHeight (PxF32 halfHeight)=0 |
| Sets controller's half height. More... | |
| virtual bool | setHalfSideExtent (PxF32 halfSideExtent)=0 |
| Sets controller's half side extent. More... | |
| virtual bool | setHalfForwardExtent (PxF32 halfForwardExtent)=0 |
| Sets controller's half forward extent. More... | |
| Public Member Functions inherited from PxController | |
| virtual PxControllerShapeType::Enum | getType () const =0 |
| Return the type of controller. More... | |
| virtual void | release ()=0 |
| Releases the controller. More... | |
| virtual PxControllerCollisionFlags | move (const PxVec3 &disp, PxF32 minDist, PxF32 elapsedTime, const PxControllerFilters &filters, const PxObstacleContext *obstacles=NULL)=0 |
| Moves the character using a "collide-and-slide" algorithm. More... | |
| virtual bool | setPosition (const PxExtendedVec3 &position)=0 |
| Sets controller's position. More... | |
| virtual const PxExtendedVec3 & | getPosition () const =0 |
| Retrieve the raw position of the controller. More... | |
| virtual bool | setFootPosition (const PxExtendedVec3 &position)=0 |
| Set controller's foot position. More... | |
| virtual PxExtendedVec3 | getFootPosition () const =0 |
| Retrieve the "foot" position of the controller, i.e. the position of the bottom of the CCT's shape. More... | |
| virtual PxRigidDynamic * | getActor () const =0 |
| Get the rigid body actor associated with this controller (see PhysX documentation). The behavior upon manually altering this actor is undefined, you should primarily use it for reading const properties. More... | |
| virtual void | setStepOffset (const PxF32 offset)=0 |
| The step height. More... | |
| virtual PxF32 | getStepOffset () const =0 |
| Retrieve the step height. More... | |
| virtual void | setNonWalkableMode (PxControllerNonWalkableMode::Enum flag)=0 |
| Sets the non-walkable mode for the CCT. More... | |
| virtual PxControllerNonWalkableMode::Enum | getNonWalkableMode () const =0 |
| Retrieves the non-walkable mode for the CCT. More... | |
| virtual PxF32 | getContactOffset () const =0 |
| Retrieve the contact offset. More... | |
| virtual void | setContactOffset (PxF32 offset)=0 |
| Sets the contact offset. More... | |
| virtual PxVec3 | getUpDirection () const =0 |
| Retrieve the 'up' direction. More... | |
| virtual void | setUpDirection (const PxVec3 &up)=0 |
| Sets the 'up' direction. More... | |
| virtual PxF32 | getSlopeLimit () const =0 |
| Retrieve the slope limit. More... | |
| virtual void | setSlopeLimit (PxF32 slopeLimit)=0 |
| Sets the slope limit. More... | |
| virtual void | invalidateCache ()=0 |
| Flushes internal geometry cache. More... | |
| virtual PxScene * | getScene ()=0 |
| Retrieve the scene associated with the controller. More... | |
| virtual void * | getUserData () const =0 |
| Returns the user data associated with this controller. More... | |
| virtual void | setUserData (void *userData)=0 |
| Sets the user data associated with this controller. More... | |
| virtual void | getState (PxControllerState &state) const =0 |
| Returns information about the controller's internal state. More... | |
| virtual void | getStats (PxControllerStats &stats) const =0 |
| Returns the controller's internal statistics. More... | |
| virtual void | resize (PxReal height)=0 |
| Resizes the controller. More... | |
Protected Member Functions | |
| PX_INLINE | PxBoxController () |
| virtual | ~PxBoxController () |
| Protected Member Functions inherited from PxController | |
| PX_INLINE | PxController () |
| virtual | ~PxController () |
Box character controller.
|
inlineprotected |
|
inlineprotectedvirtual |
|
pure virtual |
Gets controller's half forward extent.
|
pure virtual |
Gets controller's half height.
|
pure virtual |
Gets controller's half side extent.
|
pure virtual |
Sets controller's half forward extent.
| [in] | halfForwardExtent | The new half forward extent for the controller. |
|
pure virtual |
Sets controller's half height.
| [in] | halfHeight | The new half height for the controller. |
|
pure virtual |
Sets controller's half side extent.
| [in] | halfSideExtent | The new half side extent for the controller. |


TOY STORY 2 ***** (out of five stars) A review by Jamey Hughton
Voices of-Tom Hanks, Tim Allen, Joan Cusack, Don Rickles, Wallace Shawn, John Ratzenberger and Kelsey Grammer Director-John Lasseter Rated G Walt Disney Pictures
MOVIE VIEWS by Jamey Hughton http://Welcome.to/MovieViews
Walt Disney has dominated the Thanksgiving movie season for many a year, but since 1995, the prime justification for this has been their collaboration with Pixar animation studios. The merging of Disney and Pixar brought us the original `Toy Story', a computer-generated marvel that wowed children and parents alike with it's astounding visual style and instantly lovable characters. This last year, `A Bug's Life' was released to a similar amount of prosperity at the Thanksgiving box office. It seemed as if Disney and Pixar could never miss the target, and the thoroughly delightful `Toy Story 2' is additional proof of that fact.
I truly cannot imagine a more quality family film than `Toy Story 2'. It's an endlessly imaginative visual feast, brimming with colorful humor, endearing characters and offering a wonderful surprise around each new corner. Director John Lasseter has crafted yet another visual phenomenon, but it's also an emotionally fulfilling experience, guided by a sure-footed approach that layers on the adventurous satisfaction. For viewers of all ages (including adults with no child accompaniment), it could be the most enjoyable cinematic experience of the entire year.
Lasseter opens with space ranger Buzz Lightyear (voice of Tim Allen) battling the evil Emperor Zurg on a distant planet. This sequence is, alone, worth the price of an evening admission. Meanwhile, cowboy Woody (Tom Hanks) and the remainder of the toy gang are preparing for an upcoming yard sale. During a rescue mission, Woody is abducted by a deranged toy dealer (Wayne Knight) who recognizes the cowboy doll as a rare collector's item. He stumbles upon surprising information about his past: part of an ancient 50's television show called ‘Woody's Round-up', he rode a horse named Bullseye, romanced a pretty cowgirl named Jessie (Joan Cusack) and was mentored by the wise old Prospector (Kelsey Grammer). With the entire ‘Woody's Round-up' gang in his collection, Al the toy dealer realizes the set could be worth a pretty penny.
At time same, Buzz and company are organizing a search party to find their beloved cowboy friend. Yes, all those lovable characters from the original `Toy Story' have made a triumphant return: the irritable Mr. Potato Head (Don Rickles), Hamm the piggy bank (John Ratzenberger), the cowardly dinosaur Rex (Wallace Shawn), and Slinky Dog (Jim Varney) himself. As they travel across the city searching for Woody, it seems as if each new visual setpiece is more amazing than the last. Just one example is when the toy squadron attempts to cross a busy street, shielded only by pylons to divert the oncoming traffic. `Toy Story 2' is easily the most visually exciting movie of 1999; the human characters, especially, are animated with an amazing level of delicate detail. They look real, people.
This sequel is definitely on par with the original `Toy Story', and, in several aspects, it surpasses it. No one in the audience should be detached from the storyline for one minute. The humor is both clever and thoughtful, as Lasseter directs with wonderful motion that had me completely involved from the get-go. All of the actors are remarkable with their voice-overs, particularly Hanks, Allen and Wallace Shawn - who is all-too perfect for the voice of Rex and delivers laughs at a rapid-fire pace. And, with an agreement made with Mattel, Barbie has a cameo appearance in a toy store.
Family entertainment of this caliber is very hard to come by nowadays. I applaud `Toy Story 2' for it's ability to present a mature and effective story, and to generate so much excitement that is derived from friendship and morals instead of conventional violence. I am certainly past the age of watching movies about talking dolls, but this quality feature is one of the year's best films. Here is one excited moviegoer hoping that the collaboration of Disney and Pixar continues for years to come. After all, no one is ever too old to play with toys.
(C) 1999, Jamey Hughton
MOVIE VIEWS by Jamey Hughton http://Welcome.to/MovieViews
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


STATISTICS & MATHEMATIC
Analyzing data with mathematical methods and statistical tools
Advanced mathematics for solving physics problems: linear algebra, multidimensional calculus, ordinary and partial differential equations, group theory, differential geometry, etc.
Statistical methods for comparing theoretical prediction to experiment data Probability theory, statistical inference, hypothesis testing, Markov-chain Monte Carlo (MCMC), and Bayesian and frequentist statistics.


Who Are We?
We are the agenda team. Our role in the committee was to design the entire agenda of the conference. This includes the following:
- Recruiting speakers (agenda)
- Scout and practice with MCs
- Email surveys to collect PDP questions
Team Members
Group Leader
Ali Abu Al saud
Group Co-leader
Amaal Tashkandi
Member
Abdulrahman Alkhalaf
Member
Hanan Ali
Member
Mansour Aljarbue
Member
Mohammad Bajahzar
Member
Musaed Albrikan
Member
Waleed Alamri


--- layout: post title: Unnecessarily comprehensive look into a rather insignificant issue of global objects creation tags: - js ---
I noticed this code few days ago — in one of the “modules” of an internal app I’m working on — which looked like this:
if (MyApp == null) {
var MyApp = {}
}
This was at the beginning of the file, and was obviously a way to define global “namespace” object, if one didn’t exist. The condition in this particular case, however, looked rather unusual — if (MyApp == null)
. It got me thinking about the ridiculous number of ways in which it is possible to define a global object in Javascript.
I’m sure you’ve seen the variations of this kind:
if (typeof MyApp == 'undefined') {
var MyApp = { };
}
or:
if (!window.MyApp) {
window.MyApp = { };
}
or maybe even something as strange as:
if (MyApp === undefined) {
MyApp = { };
}
But have you ever wondered about the difference between these? Are any of them “better” than the other ones, and why? Is there a particular way you prefer, and for which reason?
If we were to look into some of the possible global object creation patterns, it turns out there’s quite a bit of interesting little details (and traps) here and there. What do you mean they’re not interesting? Of course they are! :)
As a fun exercise, let’s go over some of the more popular variations, explaining the inner workings of each one of them. We’ll take a look at troublesome ones; those that are more compatible than others; and those that differ depending on whether implementation follows ES3 or ES5 rules. Hopefully, you’ll also learn a thing or two about ECMAScript while we’re at it.
So what are the options for creating a global object if one doesn’t exist? Well, let’s see. There are conditions, used as expression in an if
statement. And there are actions used as the inner statement in an if
statement.
if (condition) {
action
}
Even if we’re not using if
statement, the general pattern of condition + action is still in effect:
condition && action
!condition || action
// etc.
The lists of conditions and actions might look like this (I’ll be using MyApp
“name” as an example):
Conditions:
!MyApp
!window.MyApp
!this.MyApp
!global.MyApp
typeof MyApp == "undefined"
typeof MyApp != "object"
MyApp === undefined
MyApp == null
"MyApp" in window
window.hasOwnProperty("MyApp")
Actions:
var MyApp = { }
window.MyApp = { }
this.MyApp = { }
global.MyApp = { } // where `global` references global object
MyApp = { }
There are undoubtedly other similar variations, such as using bracket notation instead of dot notation — if (window['MyApp']) { ... }
, or more obscure ones like eval('var MyApp = ...')
, but we’ll omit those for the sake of brevity. Arguably, some of the items in this list are rather similar to each other, like window.MyApp
, this.MyApp
, and global.MyApp
— after all, they are all assignments to a property of global object — but I’d like to show the important difference in each one of them, which is why we’ll look at them separately.
I promise not to go over all of the 50+ possible combinations. Only a handful of them.
if (typeof MyApp == 'undefined') {
var MyApp = { };
}
This is probably the most popular variation. Good old variable declaration, and a typeof check. When executed as global code, it creates a global variable (if one doesn’t exist) and assigns an object reference to it. What’s important to understand about this snippet is that variable declaration — similar to function declaration — follows the so-called “hoisting” behavior. In other words, MyApp
variable is created before any statements in the current scope are executed. This is why the snippet is functionally identical to:
var MyApp;
...
if (typeof MyApp == 'undefined') {
MyApp = { };
}
When MyApp
is already defined and references something, typeof MyApp != 'undefined'
check does not succeed and MyApp
is not overwritten. The declaration of MyApp
does nothing since binding already exists in this scope. However, if MyApp
doesn’t yet exist, typeof MyApp
evaluates to “undefined”, and MyApp
is assigned a reference to a newly created object. The reason typeof MyApp
evaluates to “undefined” is because at that point MyApp is already declared and has an undefined
value (as all undeclared variables do).
if (!MyApp) {
var MyApp = { };
}
Another common version is the same as the previous one, only with typeof
check replaced by a boolean conversion one. This one is clearly shorter but is it just as reliable? I remember being confused about it a while back. Shouldn’t MyApp
throw a ReferenceError
if MyApp
isn’t declared — I thought. My fears were certainly unfounded. The “hoisting” behavior of variable declarations prevents ReferenceError from occurring here. Similarly to the previous example, let’s see a functionally identical version of a snippet:
var MyApp;
...
if (!MyApp) {
MyApp = { };
}
var MyApp
that’s inside the block, hoists MyApp
declaration to the top of the scope. By the time execution gets to the if
statement, MyApp
is already declared and has an undefined
value. if (!MyApp)
can never throw a ReferenceError
, since the variable is always declared.
if (!MyApp) {
MyApp = { };
}
Sometimes a perfectly good second version is taken to the “next level” with this unpleasant variation. Unlike previous example, there’s no variable declaration here; only an assignment. When MyApp
doesn’t exist, !MyApp
expression throws ReferenceError
for exactly this reason — the variable is never declared, and the access to it should throw! This version is hardly practical, but it’s good to understand why it doesn’t “work”.
Before we move further, take a closer look at MyApp = { }
line. Anything looks suspicious there?
This is a so-called undeclared assignment. Instead of declaring a variable via a variable statement (i.e. var MyApp = { }
), MyApp
is being assigned a value directly. In ECMAScript, when something is being assigned to non-existing variable, the variable with that name is created on a global object and becomes available to any code. Well, to be more precise, it becomes a global property, rather than a variable, but this subtle difference is not important now.
So MyApp = { }
creates a global MyApp
property, then assigns a newly created object reference to it.
Note how very much MyApp = { }
is different from var MyApp = { }
. The former one — undeclared assignment — creates a global property, whereas latter one — variable declaration — creates a local variable.
Undeclared assignments are historically considered a bad practice. They lead to confusion and increase the risk of global collisions. There are also certain browser bugs, such as that in IE (MSHTML DOM), where undeclared assignment results in an error if element with same id/name exists in the document. There’s a big chance for beginner to forget var
and end up creating an unwanted global property. Or simply consider var’less version to be similar to that with the var
. Or not even know about having to use var
— after all, plain assignment seems to work just fine.
Since undeclared assignments are such a misleading part of the language, ECMAScript 5 — newest version of ECMAScript — specifies that when they occur in a strict mode, a ReferenceError should be thrown. This makes for more robust code with less chance for unexpected errors. And since strict mode is more or less a future direction of the language, it makes sense to avoid undeclared assignments as if they never existed.
if (typeof MyApp == 'undefined') {
MyApp = { };
}
Another harmful variation, and unfortunately the one that actually “works”. Note how there’s still an undeclared assignment, but the condition is now replaced with a typeof
check. typeof
check is exactly what makes all of this work, unlike plain variable access in the previous example. In ECMAScript, when typeof
is passed an undeclared identifier, it’s specified to return string “undefined”. This kind of leniency exists on purpose — typeof
is meant to be used with undeclared identifiers; it doesn’t throw (as regular variable access does) but returns “undefined” instead.
So when MyApp
doesn’t exist and if
expression succeeds, MyApp = { }
is evaluated and creates a global MyApp
property. The problem here is that MyApp = { }
is still an undeclared assignment and so has all the same problems as undeclared assignment from the previous example.
if (!window.MyApp) {
window.MyApp = { };
}
Stepping away from variable declarations and undeclared assignments, which other ways are there to create a global property?
Well, by assigning directly to a global object of course. In browsers global object is often referenced through global window
property. So one of the ways to create a property on a global object is by assigning to property of window
. This solution is almost perfect, except for two drawbacks.
First, it makes code less portable, as there is a reliance on presence of global window
property. If you wanted to run it in a non-browser environment (V8, Rhino, WScript, etc.) window
is likely to be non-existent there.
Second problem is a bit more vague. It’s relevant to browser environments only, and it’s about window
not referencing global object directly. HTML5 defines window
to reference not global object, but so-called WindowProxy object. Even though all operations performed on WindowProxy must also be performed on the Window object, there are few existing quirks — notably in Internet Explorer — where global (variable) object and window
are not fully interchangeable (more evidence).
Curiously, current HTML5 draft also says that window
typically references a Global Object, which makes it a non-requirement. In practice, however, window
almost always references Global Object (or at least an object that acts as if it was a global object).
If you don’t want to rely on browser-only window
, the most straightforward way to assign to a global object is by creating a reference that definitely gives us a Global Object. How to create such reference? Well, since we’re in global code, we can freely use this
keyword.
if (!this.MyApp) {
this.MyApp = { };
}
This works beautifully, and should create a global object in any respectable (i.e. ECMAScript-compliant) implementation. Note, however, that this code can only be run in global scope to ensure that this
references global object. Of course you could also run it non-globally as long as this
keeps referencing global object:
var myObject = {
myMethod: function() {
...
if (!this.MyApp) {
this.MyApp = { };
}
}
};
// call method with `this` referencing global object rather than `myObject`
myObject.myMethod.call(this);
The requirement to be able to create global object from within non-global code might seem contrived. Yet, I’ve seen quite few times how javascript files — representing different “modules” — were concatenated together and wrapped into another, global self-executing function. Or the code would be eval’d after being retrieved from the server via XHR. During evaluation, it would be executed in the scope of a caller, not in the global scope.
This kind of “global object passing” could certainly become cumbersome. If only there was a way to get access to global object from within any scope. Well, there certainly is.
The easiest way to achieve this is by creating a globally-accessible unique property referencing global object:
// from within global code
var global = this;
.. which brings us to the next variation of global object creation:
if (!global.MyApp) {
global.MyApp = { };
}
This snippet could now be executed from anywhere — as long as global
binding is not shadowed by anything in the executing scope.
(function(global){
// this obviously won't work since `global` is now a local variable and has a value of `undefined`.
if (!global.MyApp) {
globa.MyApp = { };
}
})();
We solved the problem of not being able to run code from anywhere, but at the expense of having an extra global property. We’ve also introduced a requirement to actually create that global property. If our code is run in unknown environment, where it’s not possible to create this global object shortcut, this kind of solution is out of the question. Additionally, there’s a chance of collisions if another code defines global global
property referencing something other than global object.
This is disastrous. What to do?
In ECMAScript 3 — it turns out — there’s a very easy way to retrieve global object from within any code. The beauty of the following solution is also that it’s not affected by local shadowing. It’s pretty much the perfect way to get access to global object:
var global = (function(){return this})();
The idea is simple. In ES3, when function is called as a function (not as a method; more precisely — as a non-reference or as a reference with null
base object) its this
is set to reference global object. When (function(){ ... })()
is executed, it evaluates to a non-reference, so it’s invoked with this
referencing global object.
Alternatively, we could have created a reference with null
base object, which would also execute function with this
referencing global object:
function f(){return this}
var global = f();
.. but that wouldn’t be as short and concise.
Great! We can now have global object from within anywhere. Is there a catch?
Well, yes, kind of. The catch is ECMAScript 5 and its newly-introduced strict mode. In ES5 strict mode, this
no longer references global object in the above two cases:
"use strict";
(function(){return this})(); // undefined
function f(){return this}
f(); // undefined
The rationale for this was, supposedly, to increase security by limiting access to global object. There is, however, a workaround and it involves indirect eval call (which I explained in the past):
"use strict";
var global = (1,eval)("this");
Indirect eval evaluates code in global scope, and MUST set this
to reference global object. So (1,eval)('this')
, which is an indirect eval call, should evaluate to a global object.
The downside of this workaround is potential shadowing of eval
by something other than built-in eval
. The solution is certainly not as robust as (function(){return this})()
one, which can be used in ES3 and ES5-non-strict code.
So to summarize:
var global = (function(){return this})(); // ES3, ES5 non strict
var global = (1,eval)('this'); // ES5 strict
In our current world of just-appearing ES5-compliant implementations, it’s hard to come up with a reliable cross-platform solution. Should we use ES3-ES5-non-strict snippet or ES5-strict one? The latter one sounds like a more future-proof solution, but reliance on indirect eval makes it a moving target: as we’ve seen before, indirect eval behavior varies across browsers.
Perhaps we can assume that browsers with strict mode support also follow ES5-compliant indirect eval behavior? In that case solution is simple:
"use strict";
var global = (function(){ return this || (1,eval)('this') })();
Implementations that don’t support strict mode, should evaluate left-hand side of ||
expression — this
, which would be a global object and as any object be truthy. Implementations that DO support strict mode, should evaluate right-hand side of an expression since this
would be undefined
. Right-hand side should then evaluate to a global object — if eval
still references built-in function of course.
This solution is arguably too verbose so it might not be desirable in all cases.
Another common pattern is the one that combines any of the previously discussed solutions. For example, property check as condition and variable declaration as action:
if (!window.MyApp) {
var MyApp = { };
}
or typeof
check as condition and property creation as an action:
if (typeof MyApp == 'undefined') {
window.MyApp = { };
}
Are there any problems with this variation? Benefits?
Well, first version can obviously only work when run from within global code; we need variable declaration to create global binding. The potential problem with this snippet is that we check existence of property on window
but create it on global object. If window
doesn’t reference global object, there’s a room for discrepancy. We could use previously discussed this
or global
instead of window
— to refer to a global object:
if (!this.MyApp) {
var MyApp = { };
}
In this case, the snippet is not much different from the first example:
if (typeof MyApp == 'undefined') {
var MyApp = { };
}
The only subtle difference here is that this.MyApp
check proceeds when this.MyApp
evaluates to something falsy (0, ”, NaN, null, undefined, false), whereas typeof MyApp == "undefined"
— only when MyApp
evaluates to undefined
:
var MyApp = '';
...
if (!this.MyApp) {
// this statement is executed; MyApp is overwritten
var MyApp = { };
}
if (typeof MyApp == 'undefined') {
// this statement is not executed; MyApp is not overwritten
var MyApp = { };
}
Since both this.MyApp = { }
and var MyApp = { }
will create global MyApp
binding, the only difference here is that former one makes it deletable, while latter one doesn’t. Other than that, there is no difference — both operate on a global object when run from within global code. At least in theory. In practice, though, there has been some evidence of IE having different objects as global variable object and window
object. For best cross-browser results, I would suggest to avoid mixing them up like this.
Sometimes typeof MyApp == 'undefined'
check is replaced with the opposite one — typeof MyApp != 'object'
.
if (typeof MyApp != 'object') {
...
}
There isn’t much difference here, of course, except that typeof != 'object'
check will also catch any other non-object and non-undefined values; pretty much all primitives except undefined
:
var MyApp = "trolololololo";
if (typeof MyApp != 'object') {
MyApp = { }; // MyApp is overwritten
}
Other times, typeof
check is replaced with direct comparison with undefined
or null
values:
if (MyApp === undefined) {
var MyApp = { };
}
// or
if (MyApp == null) {
var MyApp = { };
}
The second example is what I mentioned in the beginning and what got me surprised in the first place. As you probably know, comparing to null
via equality operator (==
) returns true
when value is either null
or undefined
. This is why it allows to catch undeclared variables which have undefined
values.
If you think about it, there’s really no reason to use this kind of check though. Even though it’s shorter than typeof
, comparing to undefined
is more fragile, since undefined
is a writable property in ES3 (which is why — without taking precautions — it has been generally recommended against). Comparing to null
is safer but is still unnecessary; !MyApp
is just enough and is even shorter.
in
and hasOwnProperty
There are even more exotic beasts such as those using in
operator or hasOwnProperty
method.
if (!('MyApp' in this)) {
this.MyApp = { };
}
if (!this.hasOwnProperty('MyApp')) {
this.MyApp = { };
}
Using in
is almost identical to using plain boolean conversion — if (!MyApp) ...
. The only difference is that in
will “catch” global properties with any values, whereas boolean conversion-based one — only those that have truthy values. Similarly to typeof ... == "undefined"
check, in
will catch both — undeclared variables and variables with undefined values.
hasOwnProperty
, on the other hand, is a bit more strict. Even though irrelevant in our case, it’s worth remembering that hasOwnProperty
will catch only those properties that exist directly on a global object. That means nothing from global object’s prototype chain, which could include Object.prototype
, Window.prototype
, etc.
this.hasOwnProperty('localStorage'); // false
'localStorage' in this; // true
this.hasOwnProperty('alert'); // false
'alert' in this; // true
this.hasOwnProperty('toString'); // false
'toString' in this; // true
var x;
this.hasOwnProperty('x'); // true
'x' in this; // true
global.MyApp || (global.MyApp = { });
this.MyApp = this.MyApp || { };
typeof MyApp == 'undefined' && (global.MyApp = { });
A slightly different way to write #5, #6, or #7 is using ||
operator. The functionality is the same; this is only a matter of preference.
So there you have it. A quick rundown through some of the most popular options. To summarize:
window
is not completely cross-platform; using this
(or retrieving global object) is more portable.(function(){ return this || (1,eval)('this') })()
which should work in ES3, ES5 and ES5-strict.typeof "undefined"
, or === undefined
checks; plain !
operator works just as well, as long as variable is created via declaration.if (!MyApp) var MyApp = ...
if (!this.MyApp) this.MyApp = ...
(substituting this
with window
or global
as necessary)this
/window
/global
and global variable object (used to create property during variable declaration); they could be different objects.


NHS Hack Day 4
Rachel Graves
2013-05-27 02:37:00 UTCThis weekend I attended my first ever hack day – NHS Hack Day 4. It is an event where doctors, medics, nurses, programmers, designers, ux consultants and various other talented people all get together, pitch ideas about how to make healthcare better and then form teams to make those ideas.
Not having attended a hack day before, I didn’t really know what to expect from the format. I wasn’t expecting to pitch an idea and I certainly wasn’t expecting 4 programmers and a doctor to join me in trying to build my ideas.
The idea I pitched, NHS Matchwell is a website to provide “better support for people with health conditions through matchmaking”.
I came up with this idea because I have a chronic illness. There is a problem with my heart that means that I had to be fitted with an implantable cardiac defribrilator (ICD). If I ever go into ventricular fibrulation, it will shock my heart to stop me from dieing. Both the condition and the ICD are pretty scary things to live with and it can be hard to find people who understand what I am going through. Whilst there are support groups and organisations dealing with this, I found that they were not that helpful. The support group was filled with lots of people representing worst case scenarios that frightened me, whilst the organisations are really behind in their networking.
The aim of NHS Matchwell is to connect you to people who have similar conditions and symptoms, and also on a range of user chosen fields, such as interests, age, gender and religion.
One of the interesting things about having people come to help, is that my role in the project ended up being very different than I had imagined. I intended to turn up and write some code using a Ruby framework named Padrino, however, the programmers joining the team all knew Python and Django. I ended up taking the role of project manager, frontend developer and systems administrator. I setup a kanban board to keep the team organised, implemented Vagrant and Heroku hosting for development and staging and built the frontend using getskeleton.com.


Many Thanks
Thank you for being a guinea pig testing during the potentially "dangerous" first few releases,
- Daniel Neighman<EMAIL_ADDRESS>irc: hassox ; github: http://github.com/hassox
projects: pancake, merb
- John Mettraux<EMAIL_ADDRESS>irc: jmettraux ; github: http://github.com/jmettraux
projects: ruote, rufus-tokyo
- Franco Lazzarino<EMAIL_ADDRESS>irc: flazz ; github: http://github.com/flazz
Thank you for a great write up and lots of testing during the early releases,
- Peter Cooper<EMAIL_ADDRESS>irc: petercooper ; github: http://github.com/peterc
projects: rubyinside
Thank you for helping with documentation efforts, and testing on Ubuntu,
- Anita Kuno<EMAIL_ADDRESS>irc: anteaya ; github: http://github.com/anteaya
Thank you for an Awesome Website Design,
- Jim Lindley<EMAIL_ADDRESS>irc: jlindley ; github: http://github.com/jlindley
Thank you for many great patches and testing zsh and Gentoo,
- Pistos<EMAIL_ADDRESS>irc: Pistos ; github: http://github.com/Pistos
Thank you for an insane amount of testing and great suggestions,
- Simon Arnaud<EMAIL_ADDRESS>irc: Maz ; github: http://github.com/Mazwak
Thank you for hanging out in the channel and helping people, thank you for lots of testing and helping look into new features,
- Robert Rouse<EMAIL_ADDRESS>irc: Scyllinice ; github: http://github.com/IronDigital
Thank you for much testing and debugging, and especially for helping get the gemsets working smooth,
- Thomas Kern<EMAIL_ADDRESS>irc: bosie ; github: http://github.com/thomaskern
projects: AI4R


Beautiful and inspiring uses of Bootstrap, curated by @mdo.
February 14 2013
March 7, 2014
February 26, 2014


Have you ever looked at a photograph and realized
that it was telling you a story about someone’s life?
Sometimes, pictures can ‘transmit’ very strong feelings,
touching your soul and affecting your state of mind.
When you look at them you feel a quiver inside:
this one made you smile, the other makes you choke back
tears.We’reconvinced that the followingset of
photographs will make your heart beat faster and make
syou feel truly alive.All of them are simply beautiful.


Richard Hendriks
Programmer
Summary
Richard hails from Tulsa. He has earned degrees from the University of Oklahoma and Stanford. (Go Sooners and Cardinal!) Before starting Pied Piper, he worked for Hooli as a part time software developer. While his work focuses on applied information theory, mostly optimizing lossless compression schema of both the length-limited and adaptive variants, his non-work interests range widely, everything from quantum computing to chaos theory. He could tell you about it, but THAT would NOT be a “length-limited” conversation!
Experience
12/2013 - 12/2014
CEO/President
Pied Piper is a multi-platform technology based on a proprietary universal compression algorithm that has consistently fielded high Weisman Scores™ that are not merely competitive, but approach the theoretical limit of lossless compression.
- Build an algorithm for artist to detect if their music was violating copy right infringement laws
- Successfully won Techcrunch Disrupt
- Optimized an algorithm that holds the current world record for Weisman Scores
Open Source Projects
Miss Direction ∙ missdirection.example.com
08/2016 - 08/2016
GoogleMaps
Chrome Extension
Javascript
A mapping engine that misguides you
- Won award at AIHacks 2016
- Built by all women team of newbie programmers
- Using modern technologies such as GoogleMaps, Chrome Extension and Javascript
Education
University of Oklahoma
06/2011 - 01/2014
Bachelor Information Technology
4.0
- DB1101 - Basic SQL
- CS2011 - Java Introduction
Volunteer
CoderDojo
01/2012 - Present
Teacher
Global movement of free coding clubs for young people.
- Awarded 'Teacher of the Month'
Awards
Digital Compression Pioneer Award
Techcrunch
There is no spoon.
Publications
Video compression for 3d media
10/2014
Hooli
Innovative middle-out compression algorithm that changes the way we store data.
References
It is my pleasure to recommend Richard, his performance working as a consultant for Main St. Company proved that he will be a valuable addition to any company.


I am currently a senior studying Computer Science and Engineering (among many other things) at Massachusetts Institute of Technology in Cambridge, MA. I am originally from Monterey Park, CA.
Live life to the fullest.
Some things I love: photography, going on walks, nature, dance, blogging, choral music, TED, string art, basketball, dark chocolate, jamming sessions, whistling


Promises
Agenda
-
Promises definition
-
How to use promises
-
Promises States and Fates
-
The Promise API
-
Tips and tricks when using Promises
Promises
Definition
- The Promise object is used for asynchronous computations
- A Promise is an object that serves as a placeholder for a value
Syntax
- the anonymous function is called executor
new Promise( function (resolve, reject) { ... } );
Basic usage
function asyncFunc() {
return new Promise((resolve, reject) => {
//make API call
resolve(result);
//or
reject(error);
});
}
//usage
asyncFunc()
.then(
result => {//handle success},
err => {//handle error}
);
Promises States and Fates - How Promises works
Promises States
- Fulfilled - A promise "p" is fulfilled if p.then(f, r) will call f "as soon as possible."
- Rejected - A promise "p" is rejected if p.then(f, r) will call r "as soon as possible."
- Pending- A promise is pending if it is neither fulfilled nor rejected.
- Settled Promise
Promises Fates
- Resolved
- A promise is unresolved
States and Fates
-
Fulfilled,
if it has been resolved to a non-promise value,
or resolved to a thenable which will call any passed fulfillment handler
back as soon as possible, or resolved to another promise that is fulfilled.
-
Rejected,
if it has been rejected directly,
or resolved to a thenable which will call any passed rejection handler
back as soon as possible, or resolved to another promise that is rejected.
-
Pending,
if it has been resolved to a thenable which will call neither handler
back as soon as possible, or resolved to another promise that is pending.
Promise.prototype.then()
p.then(onFulfilled[, onRejected]);
p.then(value => {
// fulfillment
}, reason => {
// rejection
}
);
Promise.prototype.catch()
p.catch(onRejected);
p.catch(reason => {
// rejection
});
Promise.resolve()
Promise.resolve(value);
Promise.resolve(promise);
Promise.resolve(thenable);
var p = Promise.resolve([1,2,3]);
p.then(v => console.log(v));// [1, 2, 3]
Promise.reject()
Promise.reject(reason);
Promise.reject(new Error('error'))
.then(error => {
// not called
}, error => {
console.log(error);
});
Promise.all()
Promise.all(iterable);
var p1 = Promise.resolve(3);
var p2 = 1337;
var p3 = new Promise((resolve, reject) => {
setTimeout(resolve, 100, 'foo');
});
Promise.all([p1, p2, p3])
.then(values => {
console.log(values); // [3, 1337, 'foo']
});
Promise.race()
Promise.race(iterable);
var p1 = new Promise(function(resolve, reject) {
setTimeout(resolve, 500, 'one');
});
var p2 = new Promise(function(resolve, reject) {
setTimeout(resolve, 100, 'two');
});
Promise.race([p1, p2]).then(function(value) {
console.log(value); // "two"
// Both resolve, but p2 is faster
});
Promise Chaining
fetch(someUrl)
.then(processTheResponse)
.then(save)
.catch(handleErrors);
Error Handling
async()
.then(
handleSuccess,
handleError
);
async()
.then(handleSuccess)
.catch(handleError);
async()
.then(
handleSuccess,
handleError
)
.then(...)
.then(...)
.then(...)
.catch(handleGeneralError);
Advantages over callbacks
- No inversion of control
- Chaining is simpler
-
Composing asynchronous calls (loops, mapping, etc.): is a little easier, because you have data (Promise objects) you can work with.
-
Error handling
Tips and tricks when using Promises
Promises chain. They are composable
//don't do this
iReturnAPromise()
.then(() => {
return new Promise((resolve, reject) => {
resolve(iReturnAPromiseToo());
});
});
//do this
iReturnAPromise()
.then(() => {
var data = iAmSynchronous();
return iReturnAPromiseToo(data);
})
.then(result => {
//Do something cool with result of iReturnAPromiseToo.
})
Use .catch() for catching errors
getUserAsync()
.then(user => {
return user.name;
})
.catch(function(err) {
console.error(err);
});
Don't use deferred objects. It's an anti-pattern.
Always return from .then()
iReturnAPromise()
.then(() => {
anotherPromise();
})
.then(result => {
//result is undefined
})
Promise fall-through
Promise.resolve('one')
.then(Promise.resolve('two'))
.then(result => console.log(result));
Promise.resolve('one')
.then(null)
.then(result => console.log(result));
Promise.resolve('one')
.then(() => Promise.resolve('two'))
.then(result => console.log(result));


Consider this Java program code: Integer one, two; one = 2; two = 1; two = two + one; one = two + one; System.out.println("one = " + one + " and two = " + two); What output is displayed in the Java Console when this code is executed? one = 1 and two = 2 one = 2 and two = 1 one = 3 and two = 3 one = 3 and two = 4 one = 3 and two = 5 one = 4 and two = 3 one = 5 and two = 3 None of these Whenever a variable appears on the right-hand side of an assignment statement, Java always uses the most recent value that has been stored in that variable. So in the last assignment statement above, two has the new value 3, which is added to the value of one, which is 2.
Integer one, two; one = 2; two = 1; two = two + one; one = two + one; System.out.println("one = " + one + " and two = " + two);
one = 1 and two = 2 one = 2 and two = 1 one = 3 and two = 3 one = 3 and two = 4 one = 3 and two = 5 one = 4 and two = 3 one = 5 and two = 3 None of these
two
one


Deal Limit Reached
Limit to 999 each per customer.
We do not have this in the weight you wanted. We've rounded your order to the nearest weight increment we stock.


What I love most about coding is that it's a constant challenge. The technologies never stop growing, changing and advancing so you're always learning and adapting. The joy of working on something for days or weeks at a time and then sharing it is something I first discovered while playing in a band. Like music, full stack development gives me the opportunity to be innovative, creative, and work with like minded people. And that's all I've ever wanted in a career.
When I'm not coding you can find me playing guitar and writing music, reading, or struggling to break 80 on the golf course.
If you'd like to work together, have questions about any of my projects, or simply want to talk about music, don't hesitate to email at mgbinder@gmail.com.


SIMILARITIES AND DIFFERENCES BETWEEN AWARDEES AND NON-AWARDEES IN THE PENNSYLVANIA HIGHER EDUCATION ASSISTANCE AGENCY SCHOLARSHIP PROGRAM 1970-71.
By Richard Russell Mellott B.S., Indiana University of Pennsylvania, 1958 M.Ed., University of Pittsburgh, 1961
Submitted to the Graduate Faculty in the School of Education in partial fulfillment of the requirements for the degree.of Doctor of Education
University of Pittsburgh 1971
Reproduced with permission of the copyright owner. Further reproduction prohibited without permission.


Before Change
@classmethod
def setupClass(cls):
if "Darwin" in platform.platform():
// For unknown reasons, blockwise fileset tests fail due to strange "too many files" errors on mac
raise nose.SkipTest
After Change
@classmethod
def setupClass(cls):
if platform.system() == "Darwin" or platform.system() == "Windows":
// For unknown reasons, blockwise fileset tests fail due to strange "too many files" errors on mac
// On windows, there are other errors, and we make no attempt to solve them (at the moment).
raise nose.SkipTest


Albert Hahn, your future programmer!
About Me
Projects
Blog
Resume
Contact Info
My Projects!
A Cheat Sheet for JavaScript Objects
Project Y (Coming Soon
Project Z (Coming Soon)