ElasticSearch: Geographically Encoded Objects for ElasticSearch
(Driver available in GDAL 1.10 or later)
Driver is read-write starting with GDAL 2.1 (was write only in GDAL 2.0 or earlier)
As of GDAL 2.1, ElasticSearch 1.X and, partially, 2.X versions are supported
(5.0 known not to work). GDAL 2.2 adds supports for ElasticSearch 2.X and 5.X
ElasticSearch is an Enterprise-level
search engine for a variety of data sources. It supports full-text indexing and
geospatial querying of those data in a fast and efficient manor using a predefined REST API.
Opening dataset name syntax
Starting with GDAL 2.1, the driver supports reading existing indices from a
ElasticSearch host. There are two main possible syntaxes to open a dataset:
- Using ES:http://hostname:port (where port is typically 9200)
- Using ES: with the open options to specify HOST and PORT
The open options available are :
- HOST=hostname: Server hostname. Default to localhost.
- PORT=port. Server port. Default to 9200.
- BATCH_SIZE=number. Number of features to retrieve per batch. Default is 100.
- FEATURE_COUNT_TO_ESTABLISH_FEATURE_DEFN=number. Number of features to
retrieve to establish feature definition. -1 = unlimited. Defaults to 100.
- JSON_FIELD=YES/NO. Whether to include a field called "_json" with
the full document as JSON. Defaults to NO.
- FLATTEN_NESTED_ATTRIBUTE=YES/NO. Whether to recursively explore nested
objects and produce flatten OGR attributes. Defaults to YES.
- FID=string. Field name, with integer values, to use as FID. Defaults to 'ogc_fid'
ElasticSearch vs OGR concepts
Each mapping type inside a ElasticSearch index will be considered as a OGR layer.
A ElasticSearch document is considered as a OGR feature.
Field definitions
Fields are dynamically mapped from the input OGR data source. However, the
driver will take advantage of advanced options within ElasticSearch as defined
in a field mapping file.
The mapping file allows you to modify the mapping according to the
ElasticSearch field-specific types.
There are many options to choose from, however, most of the functionality is
based on all the different things you are able to do with text fields within ElasticSearch.
ogr2ogr -progress --config ES_WRITEMAP /path/to/file/map.txt -f "ElasticSearch" http://localhost:9200 my_shapefile.shp
The ElasticSearch writer supports the following Configuration Options. Starting
with GDAL 2.1, layer creation options are also available and should be preferred:
- ES_WRITEMAP=/path/to/mapfile.txt. Creates a mapping file that can be
modified by the user prior to insert in to the index. No feature will be written.
Note that this will properly work only if only one single layer is created.
Starting with GDAL 2.1, the WRITE_MAPPING layer creation option should rather be used.
- ES_META=/path/to/mapfile.txt. Tells the driver to the user-defined
field mappings. Starting with GDAL 2.1, the MAPPING layer creation option should rather be used.
- ES_BULK=5000000. Identifies the maximum size in bytes of the buffer
to store documents to be inserted at a time. Lower record counts help with
memory consumption within ElasticSearch but take longer to insert.
Starting with GDAL 2.1, the BULK_SIZE layer creation option should rather be used.
- ES_OVERWRITE=1. Overwrites the current index by deleting an existing one.
Starting with GDAL 2.1, the OVERWRITE layer creation option should rather be used.
Geometry types
In GDAL 2.0 and earlier, the driver was limited in the geometry it handles:
even if polygons were provided as input, they were stored as
geo point
and the "center" of the polygon is used as value of the point.
Starting with GDAL 2.1,
geo_shape
is used to store all geometry types (except curve geometries that are not handled
by ElasticSearch and will be approximated to their linear equivalents).
Filtering
The driver will forward any spatial filter set with SetSpatialFilter() to the server.
Starting with GDAL 2.2, SQL attribute filters set with SetAttributeFilter() are
converted to
ElasticSearch filter syntax.
They will be combined with the potentially defined spatial filter.
It is also possible to directly use a ElasticSearch filter by setting the string
passed to SetAttributeFilter() as a JSon serialized object, e.g.
{ "post_filter": { "term": { "properties.EAS_ID": 169 } } }
Note: if defining directly an Elastic Search JSon filter, the spatial filter specified
through SetSpatialFilter() will be ignored, and must thus be included in the JSon
filter if needed.
Paging
Features are retrieved from the server by chunks of 100. This can be
altered with the BATCH_SIZE open option.
Schema
When reading a Elastic Search index/type, OGR must establish the schema of attribute and geometry
fields, since OGR has a fixed schema concept.
In the general case, OGR will read the mapping definition and the first 100 documents (can be altered with
the FEATURE_COUNT_TO_ESTABLISH_FEATURE_DEFN open option) of the index/type and build
the schema that best fit to the found fields and values.
It is also possible to set the JSON_FIELD=YES open option so that a _json special
field is added to the OGR schema. When reading Elastic Search documents as OGR features,
the full JSon version of the document will be stored in the _json field. This might
be useful in case of complex documents or with data types that do not translate well
in OGR data types. On creation/update of documents, if the _json field is present
and set, its content will be used directly (other fields will be ignored).
Feature ID
Elastic Search have a special _id field that contains the unique ID of the document. This
field is returned as an OGR field, but cannot be used as the OGR special FeatureID
field, which must be of integer type. By default, OGR will try to read a potential
'ogc_fid' field to set the OGR FeatureID. The name of this field to look up can
be set with the FID open option. If the field is not found, the FID returned by
OGR will be a sequential number starting at 1, but it is not guaranteed to be
stable at all.
ExecuteSQL() interface
Starting with GDAL 2.2, SQL requests, involving a single layer, with WHERE and
ORDER BY statements will be translated as ElasticSearch queries.
Otherwise, if specifying "ES" as the dialect of ExecuteSQL(), a JSon string with a
serialized Elastic Search filter
can be passed. The search will be done on all indices and types, unless the
filter itself restricts the search. The returned layer will be a union of the
types returned by the FEATURE_COUNT_TO_ESTABLISH_FEATURE_DEFN first documents. It
will also contain the _index and _type special fields to indicate the provenance
of the features.
The following filter can be used to restrict the search to the "poly" index and
its "FeatureCollection" type mapping (ElasticSearch 1.X and 2.X)
{ "filter": {
"indices" : {
"no_match_filter": "none",
"index": "poly",
"filter": {
"and" : [
{ "type": { "value": "FeatureCollection" } },
{ "term" : { "properties.EAS_ID" : 158.0 } }
]
}
}
}
}
For ElasticSearch 5.X (works also with 2.X) :
{ "post_filter": {
"indices" : {
"no_match_query": "none",
"index": "poly",
"query": {
"bool": {
"must" : [
{ "type": { "value": "FeatureCollection" } },
{ "term" : { "properties.EAS_ID" : 158.0 } }
]
}
}
}
}
}
Aggregations are not supported.
Getting metadata
Getting feature count is efficient.
Getting extent is efficient, only on geometry columns mapped to ElasticSearch type geo_point.
On geo_shape fields, feature retrieval of the whole layer is done, which might be slow.
Write support
Index/type creation and deletion is possible.
Write support is only enabled when the datasource is opened in update mode.
When inserting a new feature with CreateFeature() in non-bulk mode, and if the command is successful, OGR will fetch the
returned _id and use it for the SetFeature() operation.
Spatial reference system
Geometries stored in Elastic Search are supposed to be referenced as longitude/latitude
over WGS84 datum (EPSG:4326). On creation, the driver will automatically reproject
from the layer (or geometry field) SRS to EPSG:4326, provided that the input SRS
is set and that is not already EPSG:4326.
Layer creation options
Starting with GDAL 2.1, the driver supports the following layer creation options:
- INDEX_NAME=name. Name of the index to create (or reuse). By default the index name is the layer name.
- MAPPING_NAME==name. Name of the mapping type within the index.
By default, the mapping name is "FeatureCollection" and the documents will be
written as GeoJSON Feature objects. If another mapping name is chosen, a more "flat" structure will be used.
- MAPPING=filename or JSon. Filename from which to read a user-defined
mapping, or mapping as serialized JSon.
- WRITE_MAPPING=filename. Creates a mapping file that can be modified
by the user prior to insert in to the index. No feature will be written.
This option is exclusive with MAPPING.
- OVERWRITE=YES/NO. Whether to overwrite an existing type mapping with
the layer name to be created. Defaults to NO.
- OVERWRITE_INDEX=YES/NO. (GDAL >= 2.2) Whether to overwrite the whole index to which
the layer belongs to. Defaults to NO. This option is stronger than OVERWRITE.
OVERWRITE will only proceed if the type mapping corresponding to the layer
is the single type mapping of the index. In case there are several type mappings,
the whole index need to be destroyed (it is unsafe to destroy a mapping and the
documents that use it, since they might be used by other mappings. This was
possible in ElasticSearch 1.X, but no longer in later versions).
- GEOMETRY_NAME=name. Name of geometry column. Defaults to 'geometry'.
- GEOM_MAPPING_TYPE=AUTO/GEO_POINT/GEO_SHAPE. Mapping type for geometry fields. Defaults to AUTO.
GEO_POINT uses the geo_point
mapping type. If used, the "centroid" of the geometry is used.
This is the behaviour of GDAL < 2.1.
GEO_SHAPE uses the geo_shape
mapping type, compatible of all geometry types.
When using AUTO, if there is a single geometry field of type Point, a geo_point is used.
In other cases, geo_shape is used.
- GEOM_PRECISION={value}{unit}'. Desired geometry precision. Number followed by unit. For example 1m.
For a geo_point geometry field, this causes a compressed geometry format to be used.
This option is without effect if MAPPING is specified.
- STORE_FIELDS=YES/NO. Whether fields should be stored in the index.
Setting to YES sets the "store" property of the field mapping to "true" for all fields. Defaults to NO.
(Note: prior to GDAL 2.1, the default behaviour was to store fields)
This option is without effect if MAPPING is specified.
- STORED_FIELDS=List of comma separated field names that should be stored in the index.
Those fields will have their "store" property of the field mapping set to "true".
If all fields must be stored, then using STORE_FIELDS=YES is a shortcut.
This option is without effect if MAPPING is specified.
- NOT_ANALYZED_FIELDS=List of comma separated field names that should not be analyzed during indexing.
Those fields will have their "index" property of the field mapping set to "not_analyzed"
(the default in ElasticSearch is "analyzed"). A same field should not be
specified both in NOT_ANALYZED_FIELDS and NOT_INDEXED_FIELDS.
Starting with GDAL 2.2, the {ALL} value can be used to designate all fields.
This option is without effect if MAPPING is specified.
- NOT_INDEXED_FIELDS=List of comma separated field names that should not be indexed.
Those fields will have their "index" property of the field mapping set to "no"
(the default in ElasticSearch is "analyzed"). A same field should not be
specified both in NOT_ANALYZED_FIELDS and NOT_INDEXED_FIELDS.
This option is without effect if MAPPING is specified.
- FIELDS_WITH_RAW_VALUE=(GDAL > 2.2) List of comma separated field
names (of type string) that should be created with an additional raw/not_analyzed
sub-field, or {ALL} to designate all string analyzed fields.
This is needed for sorting on those columns, and can improve performance when
filtering with SQL operators.
This option is without effect if MAPPING is specified.
- BULK_INSERT=YES/NO. Whether to use bulk insert for feature creation. Defaults to YES.
- BULK_SIZE=value. Size in bytes of the buffer for bulk upload. Defaults to 1000000 (1 million).
- FID=string. Field name, with integer values, to use as FID. Can be set to empty to disable the writing of the FID value. Defaults to 'ogc_fid'
- DOT_AS_NESTED_FIELD=YES/NO. Whether to consider dot character in field name as sub-document. Defaults to YES.
- IGNORE_SOURCE_ID=YES/NO. Whether to ignore _id field in features passed to CreateFeature(). Defaults to NO.
Examples
Open the local store:
ogrinfo ES:
Open a remote store:
ogrinfo ES:http://example.com:9200
Filtering on a Elastic Search field:
ogrinfo -ro ES: my_type -where '{ "post_filter": { "term": { "properties.EAS_ID": 168 } } }'
Using "match" query on Windows:
On Windows the query must be between double quotes and double quotes inside the query must be escaped.
C:\GDAL_on_Windows>ogrinfo ES: my_type -where "{\"query\": { \"match\": { \"properties.NAME\": \"Helsinki\" } } }"
Load an ElasticSearch index with a shapefile:
ogr2ogr -f "ElasticSearch" http://localhost:9200 my_shapefile.shp
Create a Mapping File:
The mapping file allows you to modify the mapping according to the
ElasticSearch field-specific types.
There are many options to choose from, however, most of the functionality is based
on all the different things you are able to do with text fields.
ogr2ogr -progress --config ES_WRITEMAP /path/to/file/map.txt -f "ElasticSearch" http://localhost:9200 my_shapefile.shp
or (GDAL >= 2.1):
ogr2ogr -progress -lco WRITE_MAPPING=/path/to/file/map.txt -f "ElasticSearch" http://localhost:9200 my_shapefile.shp
Read the Mapping File:
Reads the mapping file during the transformation
ogr2ogr -progress --config ES_META /path/to/file/map.txt -f "ElasticSearch" http://localhost:9200 my_shapefile.shp
or (GDAL >= 2.1):
ogr2ogr -progress -lco MAPPING=/path/to/file/map.txt -f "ElasticSearch" http://localhost:9200 my_shapefile.shp
Bulk Uploading (for larger datasets):
Bulk loading helps when uploading a lot of data. The integer value is the number of bytes that are collected before being inserted.
Bulk size considerations
ogr2ogr -progress --config ES_BULK 5000000 -f "ElasticSearch" http://localhost:9200 PG:"host=localhost user=postgres dbname=my_db password=password" "my_table" -nln thetable
or (GDAL >= 2.1):
ogr2ogr -progress -lco BULK_SIZE=5000000 -f "ElasticSearch" http://localhost:9200 my_shapefile.shp
Overwrite the current Index:
If specified, this will overwrite the current index. Otherwise, the data will be appended.
ogr2ogr -progress --config ES_OVERWRITE 1 -f "ElasticSearch" http://localhost:9200 PG:"host=localhost user=postgres dbname=my_db password=password" "my_table" -nln thetable
or (GDAL >= 2.1):
ogr2ogr -progress -overwrite ES:http://localhost:9200 PG:"host=localhost user=postgres dbname=my_db password=password" "my_table" -nln thetable
See Also


Opengraph exploration
Tools to debug and clear opengraph cache
Facebook - Debugger
Twitter - Card Validator
LinkedIn - Post Inspector
Telegram - Webpage bot
VK - api - pages.clearCache
Generators
Opengraph data generator
Web Code Tools - The Ultimate Open Graph Generator
Articles
The Open Graph protocol
(ru)
Facebook Open Graph image: You’re (probably) doing it wrong
Tweeter cards
The Best Open Graph Image Size (Stolen From Top Websites of 2018)
Facebook for webmasters
Examples
Method 1 (1200x630)
Method 2 (1200x1200) + twitter large image
FB square (279x279)
FB tall (420x630)
FB tall (500x750)
og-product
Screenshots


The purpose of this tribute page is to highlight the often overlooked distinction between the Khoekhoe(khoikhoi) and San peoples who inhabited what is now known as Cape Town and bring attention to the fact that there is no one group of Khoisan people, it is more an oversimplification for convenience-sake. There seems be a biased view of the mainstream media towards the colonists who settled in the Cape which has resulted in an unjustified dismissal of everything that took place before their arrival, which casts a shadow on the history, heritage and culture of the people who most likely are the real indigenes of the Cape.My intention is not academic in nature, but simply to shine a light on this biased view, which I too was fed, and state that there is sufficient reason to re-examine and further explore the literature and human resources available to develop a more complete and un-biased picture of our history and the people who came before us.
For a more in depth look at the vast history of these clans Visit Camissa People


{% extends "_base/base.html" %} {% block title %}Home{% endblock %} {% block style %}{% endblock %} {% block scripts %}{% endblock %} {% block subsection_title %}Welcome{% endblock %} {% block content %}
Investigo is Latin for track or trace out, investigate. The CMX Investigo is a bot for Spark, Cisco's unified communications service, which enables customers to use wireless infrastructure to locate Wi-Fi capable assets.
The Investigo is a mash-up bot that uses several solutions: Spark, Tropo, CMX, spanning from the enterprise to the Internet of Things world.


To accurately measure the qualities of the Dynaudio System 242, we set out to ensure each component would offer up its best performance traits. As the Dynaudio components were being broken in on our bench, we took the opportunity to audit their supplied specifications.
Read More...
Esotec System 242
|
Md 102 Soft Dome tweeters
|
|
Their frequency response was smooth and linear (with the microphone placed 30 degrees off-axis) from 2kHz to 16kHz, at which time they rolled off gently towards 20kHz. Their on-axis response was similar; however, the overall frequency response was extended to 23kHz before rolling off.
|
|
Mw 162 Mid-Bass driver
|
|
Dynaudio depicts the MW 162’s linear excursion limit as being 6mms peak-to-peak, with 17mms being the actual mechanical limit. During our investigation, we discovered that the MW 162s, in terms of distortion, remained sonically acceptable well beyond their 6mm X-max specification (8.3mms Peak-to-Peak).
The speed of the drivers was also beyond expectations. While electrical delays on their own are not necessarily a bad thing, they
are however a detriment to the overall stereo experience when some components within the system are operating at different times. The sound stage can collapse, bass performance can diminish and echoes can spear the intelligibility of vocals. The Dynaudio MW 162s make a positive contribution to time (phase) management, measuring virtual zero laten- cies above 82Hz.
The frequency response was measured at 30 degrees off-axis (to mimic typical installations), revealing an extremely smooth and linear response from 60Hz-4kHz, producing a ruler-flat response from 1,822Hz-3,465Hz. At 0 degress deviation, the response picked-up slightly, with the frequency extension reaching 4,423Hz @ -3dB.
|
|
Esotec X 252 crossover
|
|
We observed a phase adjustment made to the Dynaudio MW 162s and a well-managed frequency crossover between the MW 162s and the MD 102s, occurring at 2,834Hz. The MD 102s appear to have a 12dB / octave HP and the MW 162s appear to have a 6dB / octave LP. Ultimately, with the X 252 at the heart of the Dynaudio System 242, the frequency response and overall timing qualities seemed to be very well engineered and frankly, exceptional!
|


This div used the hidden div to populate its tooltip contents, the UUID is hard coded into the function!
This div uses ajax to load its contents, the UUID is a window variable set to the value of the text box.
Select a UUID:
Page Status:
Incomplete
Last Reviewed:
2013-10-29


Preparation time
over 2 hours
Cooking time
less than 10 mins
Serves
Serves 6
Bring the white wine vinegar, sugar, garlic, spices, peppercorns, bay leaf and onion to the boil in a large non-reactive pan. Reduce the heat to a simmer and simmer the mixture for 4-5 minutes.
Remove the pan from the heat, then add the salmon fillets and courgette batons and stir to coat them in the marinade mixture. Set aside until completely cooled. Cover the pan and chill in the fridge for 1½-2 hours.
When the pickled salmon has chilled and marinated, mix together the broad beans, butter beans and cherry tomato halves in a bowl. Pour over a little of the chilled marinade liquid, to taste, and stir well to combine.
To serve, divide the dressed beans and tomato mixture equally among six serving plates. Place one pickled salmon fillet on top of each. Spoon over some of the marinated onion, garlic and courgette pieces. Drizzle some of the remaining marinade liquid around the edge of each plate. Sprinkle over the mustard cress.


2 U.S. service members killed in Afghan chopper crash
by Darryl CooteNov. 20 (UPI) -- Two U.S. service members were killed in a helicopter crash in Afghanistan on Wednesday, the military said.
"Preliminary reports do not indicate it was caused by enemy fire," U.S. Forces Afghanistan said in a brief statement.
The cause of the crash is under investigation, it said, adding that the identities of the service members were being withheld for 24 hours until next of kin has been notified.
These are the first reported deaths of U.S. service members in Afghanistan since Sept. 16 when Sgt. 1st Class Jeremy W. Griffin was killed by small arms fire while engaged in combat operations in Wardak Province.
Over 2,400 U.S. service members have died in the Middle Eastern country since the war started in 2001 following the 9/11 attacks.
There are approximately 13,000 U.S. troops currently stationed in Afghanistan.


Crosshairs
Useful/good crosshairs I have come across.
Click on crosshair name to display crosshair picture and commands.
DatHost provides several online tools that help create crosshairs and custom binds.


Project: SWARM (Sensory Web Analysis and Regression Mechanism)
Team Members:
- Jonathan Ortiz Collazo (Lead)
- Eric de Souza Piasentin
Description:
SWARM is a prototype project that aims to combine sensory data obtained from a swarm of IOT devices by utilizing
client-server architecture and the cloud. These IOT devices collect sensory data like temperature, time, windspeed,
humidity, and luminosity and transmit the data to a full-stack application which stores, analyzes and displays this
data. The full stack application will be composed of a consumable API, a storage database, and publicly accessible
website that provides visualizations.
Motivation:
Hurricane Dorian recently shocked the US with its potency and its destructive capabilities, leaving a strong
impression
on the team. We believe that collecting atmospheric data, performing data science techniques, and displaying
actionable
data are worthwhile endeavors. Sensory equipment can be acquired cheaply, and hosting software can be free if
managed.
Proposal:
Jonathan, and Eric will divide their efforts among hardware and software requirements to complete this
project.
There is a safe target and stretch target of capabilities and implementation, both of which are attainable in a
semester. In both cases the work will be divided such that Jonathan focuses on the web/server-related components, Eric
will
be focused on the hardware/sensor-related components. Each effort will be tracked, triaged, and tested throughout the semester.
Safe target:
- API
- deployed on AWS/Azure or FAU lamp.cse.fau.edu)
- private to those who know the link
- unauthenticated
- Database
- Website
- deployed on AWS/Azure or FAU lamp.cse.fau.edu
- follows SDA with dev, stage, prod deployments
- non-mobile optimized
- unauthenticated
- IOT Device
- Raspberry Pi with sensors provided by FAU lab stores
- single device
- Wi-Fi enabled
- unauthenticated
Stretch target:
- API
- deployed on AWS/Azure or FAU lamp.cse.fau.edu
- DNS registered and publicly accessible
- authenticated
- Data Science Service
- deployed on AWS/Azure or FAU lamp.cse.fau.edu
- data science / ml techniques performed on data like classification
- Database
- deployed on AWS/Azure or FAU lamp.cse.fau.edu
- replicated across two or more nodes
- authenticated
- Website
- deployed on AWS/Azure or FAU lamp.cse.fau.edu
- DNS registered and publicly accessible
- mobile optimized
- authenticated
- Mobile
- Android application to display the website
- authenticated
- IOT Device Master
- Raspberry Pi or low power microcomputer sourced externally from FAU
- Wi-Fi enabled
- authenticated / encrypted
- IOT Device Slave
- multiple device slaves
- RF communication enabled with Master
- authenticated / encrypted
- Written Publication
Related Work:
-
ISENSE Intelligent River Project
- FAU has a research institute who has worked on a project that collects environmental data in
collaboration with
Clemson University. The sensors themselves are the focal point and represent the bulk of progressing the
state of the
art while the data analysis and visualization are on the backburner.
(http://www.ceecs.fau.edu/news/1502_hallstrom.php)
-
National Weather Service Stations
- NWS and NOAA are professional government agencies who are responsible for monitoring atmospheric
developments and
providing accurate information to the public in times of natural disasters.
-
IOT Edge Computing
- The IOT movement has been gaining traction as well as the idea of “edge nodes” who either perform
rudimentary analysis
or are solely responsible for collection.
-
Home Automation
- Companies like Samsung and Google have begun developing consumer-ready products in the realm of home
automation,
utilizing low-powered devices in the consumer space backed by industry grade web-hosted applications.


| Methods' Summary |
Attributes' Summary |
Methods' Details |
Attributes' Details |
:: com :: sun :: star :: drawing ::
|
| unpublished |
interface XDrawSubController |
|
|
- Base Interfaces
XDrawSubController
┣ XDrawView
┣ ::com::sun::star::view::XSelectionSupplier
┗ ::com::sun::star::beans::XFastPropertySet
| XDrawView |
- (referenced interface's summary:)
- is implemented by views that display DrawPages or MasterPages.
|
| ::com::sun::star::view::XSelectionSupplier |
- (referenced interface's summary:)
- makes it possible to access and change the selection in a view.
|
| ::com::sun::star::beans::XFastPropertySet |
- Description
- This narrow interface is used to pass property values to and from
the sub controller. Property change listeners are handled by the
controller.
|
|
- Usage Restrictions
- not published
- Description
- View dependent part of the Draw and Impress controller.
During the lifetime of an Impress application the
DrawingDocumentDrawView
changes its sub controllers whenever the view in the center pane is
replaced by another one. The sub controller handles the things that are
not common to all views, i.e. properties, the current page/slide, and
the selection.
|
Top of Page
Copyright © 2013, The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the Apache feather logo, Apache OpenOffice and OpenOffice.org are trademarks of The Apache Software Foundation. Other names may be trademarks of their respective owners.


Username: {{Customer.username}}
Email: {{Customer.email}}
Due Amount: {{Customer.Due}}
Inactive
0">Active


Take our survey below to find out!
Your responses show that you are not a human. Are you sure you need to know how to code?


FORM
Email:
Password:
First name:
Last name:
Avatar:
DOB:
Gender:
male
female
others
Known Languages
>
Tamil
English
Malayalam
Telungu
Phone Number:
India (+91)
India (+91)
Australia (+61)
Canada (+1)
Iran (+98)
URL:


school (accessed Available collab: online: September Health health climate New schools Climate change environmental U.S. Puerto National School Change USA Environmental Federal {border-style Region children px;} #ffffff;} Rico Schools risk Agency Center Education infrastructure Public Report resilience risks York exposures national social environment hazards level public response Department Protection Virgin building community extreme vulnerability weather DC, Management Statistics United disasters efforts geographic preparedness recovery (MPG), Assessment Disaster EPA Global Healthy Office Washington, York, built include px; student {font-family Children’s Emergency Islands Recovery Research USVI World buildings children’s current data disparities example, font-size increase level, new specific students toxic used vulnerable Children Data Environ. Geneva, Jersey Organization State States Switzerland University air areas challenges determinants different double; effects health, heat impact improve included maintenance potential prevention quality related report resulting schools, serve terms underlying vary America’s Black Educational Green IPCC NY, Orleans Resilience San additional based baseline border-color border-width capacity changes changing chemical condition disaster examples federal fenceline greater healthy increased individual indoor learning living local long nationally population problems reported research resilient sea solid; storms structural support term times water {font-style {font-weight ... Am. American City Condition Crisis Disease Examples Facility Figure Furthermore, Groups High Human Impact Intergovernmental Maria, October Panel Pediatrics Reduction Risk Schools: Sheffield Simone Synthesis Table Working activities address area attention average bold communities costs courier; days educational em; existing facilities factors flooding funding help high illustrate impacts important infrastructure. levels likely located majority million occur opportunities outdoor overall particular people physical poor poverty pt;} resource respiratory result rise schools. search site sites studies study subsequent total using years


???? ????????
on 2012-04-04 14:37:00
If I might —perhaps you should consider adding a few images. I don’t mean to disrespect what you’ve said ; its very enlightening, indeed. However, I think would respond to it more positively if they could be something tangible to your ideas
acebone
on 2012-03-15 16:02:35
This will not uppercase foreign/extended chars, in order to do that simply replace [a-z] with [^\s] in the regex, so that the function looks like this:
function ucwords (str) {
// Uppercase the first character of every word in a string
//
// version: 1109.2015
// discuss at: http://phpjs.org/functions/ucwords // + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
// + improved by: Waldo Malqui Silva
// + bugfixed by: Onno Marsman
// + improved by: Robin
// + input by: James (http://www.james-bell.co.uk/) // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// * example 1: ucwords('kevin van zonneveld');
// * returns 1: 'Kevin Van Zonneveld'
// * example 2: ucwords('HELLO WORLD');
// * returns 2: 'HELLO WORLD' return (str + '').replace(/^([^\s])|\s+([^\s])/g, function ($1) {
return $1.toUpperCase();
});
Kevin van Zonneveld
on 2010-09-08 17:56:25
@ James: Thanks for your contribution! I modified the regex some more so it will only try to uppercase small letters (why try to uppercase '{' or '.' as well), and to support words separated by more than 1 spaces.
James
on 2010-08-11 13:19:22
I have modified the regex used so that it ignores spaces and numbers, new to regex so any hints, tips, changes etc.. are welcome
function ucwords(str)
{
str = str.toLowerCase(); //Optional
return (str).replace(/^([^\s0-9])|\s([^\s0-9])/g, function (l)
{
return l.toUpperCase();
});
}
Brett Zamir
on 2010-04-28 04:27:05
@Jerry: A nice idea, but that only works with English letters. If we could boil it down a bit, we could incorporate XRegExp.com along with its excellent Unicode plug-in to determine whether something was lower case or not, but that would probably end up costing more performance to check for all the Unicode values (and it would need to take into account some languages which deviate from the Unicode case mapings). Off topic slightly, our function should really be made to work with locale_set_default (whenever that gets implemented!), at least when the "unicode.semantics" ini is on.
Jerry
on 2010-04-27 23:30:06
I prefer this slightly modified version as replacement function should ONLY be called when the regex finds suitable letters instead of suitable characters.
function ucwords(str) {
return (str + '').replace(/^[a-z]|\s[a-z]/g,
function ($1) {
return $1.toUpperCase();
}
);
}
Brett Zamir
on 2010-01-29 02:36:21
@Robin: It wasn't hostility at all! I just didn't see your notice, so I was just stating what I said in a matter of fact way, not with any sarcasm or anything. And as you say, it was my mistake for missing your additional comment. We're really sorry if you were met with hostility earlier, but sometimes I think the lack of opportunity for clarification of intent may mistakenly give that impression; if you were met with genuine hostility, or we could have been more clear or more polite, our apologies certainly for that! And yes, we are eager to make JSLint fixes, so thank you very much for the function fixes! I'll see about applying them in Git now...
Robin
on 2010-01-28 18:24:04
@Brett: Thanks for the feedback, but if you read the rest of my comment, you'll see I did not intend to change the function in any way, except to make it conform to the JSLint conventions, as shown by the "Open syntax issues."
"Eventually we want all code to pass or at least take into consideration most fixes suggested by JsLint, following this JsLint configuration we’ve decided on."
If the previous statement no longer stands, I suggest you remove it from your website.
This isn't the first time I've tried to contribute to this site, and been met by hostility but thankfully, this will be the last, you may commence the group sigh of relief.
Brett Zamir
on 2010-01-26 02:47:17
@Robin: Thanks for the submission, but besides differing in a variable name, your function looks identical to what we already have...
Robin
on 2010-01-25 18:41:59
function ucwords(str) {
return (str + '').replace(/^(.)|\s(.)/g, function (m) {
return m.toUpperCase();
});
}
Now conforms to JSLint syntax conventions.
Tony
on 2010-01-11 09:52:26
Great function - and picked up #1 on google search for what I was after. Saved me a host of time. Thanks
Alessandro
on 2008-07-31 18:20:39
It doesn't work to me on Firefox 3, it returns the same input sentence (I've used a complete uppercase sentence)...
Kevin van Zonneveld
on 2008-01-31 19:43:34
@ _argos: That's good enough for me :) I'm replacing the function and leave the original one here for future reference:
function ucwords( str ) {
// http://kevin.vanzonneveld.net
// + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
// * example 1: ucwords('kevin van zonneveld');
// * returns 1: 'Kevin Van Zonneveld'
return str.toLowerCase().replace(/\w+/g, function(s){
return s.charAt(0).toUpperCase() + s.substr(1);
});
}
_argos
on 2008-01-31 18:32:33
Hi Kevin, I'm making a benchmark of this function using RegExp an is 25%-30% more faster than your original function, this is the bechmark that I try:
// _argos's function
function ucwords_w ( str ) {
return str.replace(/^(.)|\s(.)/g, function ( $1 ) { return $1.toUpperCase ( ); } );
}
// Original function
function ucwords( str ) {
return str.toLowerCase().replace(/\w+/g, function(s){
return s.charAt(0).toUpperCase() + s.substr(1);
});
}
// BENCHMARK
var start;
start=new Date();
iterations = 10000;
while ( iterations-- ) {
ucwords('Kevin van Zonneveld');
ucwords('Waldo Malqui Silva');
ucwords('Alexa Valentina Malqui Cordova');
}
console.log('strrev = ' + ( (new Date())-start))
start=new Date();
iterations = 10000;
while ( iterations-- ) {
ucwords_w('Kevin van Zonneveld');
ucwords_w('Waldo Malqui Silva');
ucwords_w('Alexa Valentina Malqui Cordova');
}
console.log( 'strrev_w = ' + ( (new Date())-start ))
Kevin van Zonneveld
on 2008-01-19 21:02:08
@ Lars: You're welcome ;)
Lars
on 2008-01-19 09:31:45
thanks!


Home
Contact
Lesson Plans by L.T. Satirof
Contact Form
Name (optional)
Prefecture (optional)
Email (optional)
Subject (please select)
Website bug/error
Mistake in a file
Suggestion/Request
Other
Message


From:Graves Jerry To:Alexander James C. Sent:2017-01-11T04:37:44.0000000Z Subject:Outage Coordination Commercial Review (Date Change)
FYI,
Please take note of the date change.
The next Outage Coordination Commercial Review meeting is 09/13/01. The purpose for the meeting is to discuss outages that have a flow impact with the Commercial groups. I will send out an outage report prior to the meeting. If you have any questions or concerns, please give me a call.
***********
EDRM Enron Email Data Set has been produced in EML, PST and NSF format by ZL Technologies, Inc. This Data Set is licensed under a Creative Commons Attribution 3.0 United States License <http://creativecommons.org/licenses/by/3.0/us/> . To provide attribution, please cite to "ZL Technologies, Inc. (http://www.zlti.com)."
***********
California


WQMY
Debt Consolidation Programs - Banking and Loans at About.com
Debt consolidation programs are usually just a big loan that pays off other smaller loans. . They might offer you a good deal in order to win your business.
http://banking.about.com/od/loans/a/debtconsolidate.htm
| elders of eastern kalimdor/gs pay seattle 2008/ roger lawson portuguese india |
|
|---|---|
| philips dvd player uk | Williamsport |
| Branding | MyNetworkTV business and debt consolidation loan |
| shakespeare festivals in the us | alfred g brummitt jr: 29 (origins of symbiosis by leon shernoff) & hotel review hilton garden inn norman-DT 45.3 (UHF) |
| san francisco studio vaction | see article |
| Owner | New Age Media, LLC Business Debt Consolidation Loan | Small Business Programs |
| First air date | December 30, 1988 |
| shana weiss m d | MYNetworkTV |
| womens size 8 converted to mens | WOLF-TV, analysis of wrong turn at lungfish |
| roger lawson portuguese india | WILF (1988-2006) |
| Former channel number(s) | How to Plan for Small Business Debt Consolidation | Chron.com |
| bessmer michigan 146.76 repeater | good eats power bars (1988-1998) specific gravity pvc resin / longitude latitude maps for teachers (1998-2006) |
| comercial premises and surrey | 50 shelley mehl in trouble 420 kW (WOLF-DT3) |
| beyonce barack obama spoof | 243 m 488 m (WOLF-DT3) |
| child does not like daycare | 52075 73375 (WOLF-DT3) |
| Transmitter coordinates | honda shadow starter circuit ron paul's skeletons in the closet (WOLF-DT3) |
Thinking About Filing Bankruptcy? - Resolve Your Debt & Save
online banking loans debt consolidations maggie valley bankruptcy lawyer consolidation of debt business credit counseling uscourts gov bankruptcy bankruptcy .
http://www.pasadenahockey.net/photos-sidemenulink/club-events
How to Get Commercial Debt Consolidation Loans | eHow.com
Commercial debt consolidation loans allow a businesses to consolidate all of their business loans into one lump sum to reduce the interest rates they pay.
http://www.ehow.com/how_2315563_get-commercial-debt-consolidation-loans.html
Contents |
[what is continuity in business] History
Debt Consolidation: Get Free Credit Card, Loan & Debt Relief Quotes
Alternative Debt Consolidation Options . Tackle Student Loans . We will give you the best advice in the business about keeping your debt levels at bay and .
http://www.debt-consolidation.co/
Get A Fresh Financial Start - Free Online Bankruptcy Evaluation
washington debt consolidation loan tallygenicom . low cost debt consolidations loans. kansas city . consolidation debt better business bureau file for .
http://www.megafood.com/authentic-nourishment
Business Debt Consolidation Services- Small Business Debt ...
May 5, 2010 . You could secure a business credit consolidation loan at lower rates of interest to pay off your business debts. This could help you to save a lot .
http://business-debtconsolidations.blogspot.com/
Small Business Debt Consolidation : Things You Need To Consider ...
Sep 24, 2010 . You can apply for business debt consolidation loans or SBA loans from traditional banks for paying off your excessive credit dues which you .
http://technorati.com/business/finance/article/small-business-debt-consolidation-things-you/
Business Debt Consolidation Calculator - Dinkytown.net Financial ...
Business Debt Consolidation Calculator: Should you consolidate your debt? . your loan amounts, credit card or credit line balances and other outstanding debt.
http://www.dinkytown.net/java/BizConsolidate.html
Debt Consolidation Information | Debt Relief Help | CreditGUARD
Our non profit debt consolidation services help consumers consolidate their . Debt consolation is a rescue term for the business owners who are over . small debts into one larger monthly loan That is what debt consolidation is all about.
http://www.creditguard.org/debt-consolidation/
debt consolidation fix debt debt consolidation - MegaFood
chiropractic consolidation debt loan student money cdr team bankruptcy co arizona bankruptcy services debt consolidation company md personal loans with .
http://www.megafood.com/69-beth/
Debt Consolidation: 5 Ways to repay debt and save dollars (A on BBB)
Largest online debt consolidation community helped 390910 people through . Debt settlement: In this debt plan, the settlement company/law firm consults with you . They give effective debt advice and help to consolidate payday loans into a .
http://www.debtconsolidationcare.com/
Debt consolidation - Wikipedia, the free encyclopedia
Debt consolidation entails taking out one loan to pay off many others. This is . Debt consolidation can simply be from a number of unsecured loans into another .
http://en.wikipedia.org/wiki/Debt_consolidation
How To Find A Reputable Debt Consolidation Company
Apr 25, 2012 . Debt Consolidation: one person or company purchases all of your debt . hopefully give you a debt consolidation loan with reasonable terms.
http://blog.readyforzero.com/how-to-find-a-reputable-debt-consolidation-company/
Business Debt Consolidation - Business.com
Using business debt consolidation loans is a common way for businesses to get their finances back on track by paying off debts with multiple creditors.
http://www.business.com/finance/business-debt-consolidation/
[winnipeg free press birth announcements] Digital channels
| Channel | Name | veronique at longwood towers | sewer outlet from basement | Programming |
|---|---|---|---|---|
| 53.1 | business and debt consolidation loan DT | pittsford mendon high school reunion | hong kong laser light show | Main business and debt consolidation loan programming / MyNetworkTV |
| 53.2 | WOLF DT | star tribune interview skills behavior questions | removing copy protection from vhs | Simulcast of windows xp operating disk |
| 53.3 | WSWB DT | 480i | 4:3 | Simulcast of good eats power bars |
debt consolidation ron - BRAD Head Start
new york debt consolidation refinance student loan debt relief programs death benefit means test bankruptcy us bankruptcy bad credit auto loan business .
http://www.bradheadstart.com/index.php?option=com_cbcontact&catid=76&Itemid=0
[cows found in wv] References
[dual path ground drive] External links
- butler creek hot lips loader ebay
- movie the fugitive kind
- head and tail game free strategy
- how many newspapers in lincoln nebraska
- samsung mythic drivers modem
- who invented the candle clock
|
|


Navigation
Home
(current)
PBS Resources
PBS 83 - Bootstrap Cards
PBS 84 — Objects as Dictionaries
Currency Codes
PBS Index
Bootstrap Docs
jQuery API
AJAX API
Currency conversion
Select at least one country for currency conversion
Check All
Uncheck All
Select Countries for Currency Conversion:
Convert One Currency
Exchange Rate Table
Enter the amount you'd like to convert:
Show Conversions
Scroll to Top


---
layout: organizers
---
The London Django Meetup Group
10th January 2017
Sponsorship
Tonight's meetup is kindly sponsored by:
Festicket
“Festival package travel startup. 50+ staff, high pay, ping pong + beer.”
The trusted global platform that inspires and enables people to experience the best of the city. Operating in 107 cities, across 39 countries, it has an average monthly global audience reach of over 111 million across all platforms.
Today's Schedule
No talks 😢
Pretty early in the year
Give a talk!
Topics:
Testing
JavaScript / front end
Making API's
Showcase a library
Pretty much anything Django/Python/web related
Today's Schedule
Django News
Today's Schedule
Eating and Drinking
Until ~20:45 - Drinks at The Space Bar
20:45 - close : Red Lion Pub (opposite), bar menu available
Djangocon EU
It's 3rd-7th April in Florence, Italy
Talk proposals just closed
Early bird tickets selling until 16th January!!
https://2017.djangocon.eu/
Channels 1.0
Released yesterday!
Some breaking changes that make it more sane
Still beta software though
Django 1.11
Feature Freeze this Friday
Alpha release next Monday or Tuesday
Django 1.11
The last Django to support Python 2! 😱👏
But Long Term Support (LTS) to last til 2020
Next is Django 2.0
Django 1.11 Major Features
Class-based model indexes
Template based widget rendering
django.contrib.auth
now has class-based views e.g. LoginView
Tests run system checks first 😀
Hiring/For hire
Grab a post-it


Dominance Timeline
Era
Sampras
Era Dominance Ratio
66.7
Season Best Player
Federer
Season Dominance Ratio
66.7
Player
Born
GOAT Pts.
2015
Roger Federer
1985
585
15
Player
Born
GOAT Pts.
2015
* Minimum
40
GOAT points
GOAT Pts. Legend
Loading...


WARNING! Read the conditions for the problems in this set very carefully!
Assume for a directed graph with numV verticies the vertex index requires vertB bytes, the pointer requires pointerB bytes, and the edge weights require edgeB bytes. Calculate the number of edges to break even on byte requirements for an adjacency list and adjacency matrix.
ANS
V * pointerBytes - V * vertBytes / edgeBytes = ANS
ADDDDD


Tabs are made of two objects: a dl
object containing the tabs themselves, and a ul
object containing the tab content.
If you want your tabs to run the full width of their container evenly, you can add class of .two-up
, .three-up
, .four-up
, and .five-up
to them.
Contained tabs have a simple added class of "contained" on the tabs-content element. What that means is the tab content has a border around it tying it to the tabs. You can still use standard column sizes inside a tab element.
If you need an alternate view for tabs (especially for filters, or similar), you can use pill-style tabs. They look like this:
If you want a standard, horizontal tab group to act vertical on small devices, adding a class of "mobile" to a standard (not vertical) tab group will switch them to full width nav bars on small screens.


The Whole note is the longest music note in general use today. It is an open note with no stem. The duration of the whole note is 4 quarter notes.
The Half note duration is 2 quarter notes. It differs from the whole note in that it has a stem, although it is still open.
The quarter note has become the de facto standard 1 beat music note. This has happened as the 4/4 time signature is the most popular (with 3/4 and 2/4 following close behind) and quarter notes have a duration of 1 in these time signatures. It is also roughly in the middle of the most used notes in the Rhythm Tree, making the quarter note the ideal candidate for ensuring whole notes don't become too long to count, and shorter, popular notes such as eighth and sixteenth notes aren't impossible to count in terms of them being fractions of a note. The quarter note changes from the half note as it is filled in, as opposed to empty.
The eighth note is worth ½ of a Quarter note. It may also be considered as a one beat note in 3/8 and similar timings, the 8 on the bottom of the time signature giving the clue that you are counting in eighth notes. This is the first note in the rhythm tree to have a flag. The flag is the name for the 'tail' added to the eighth note. Eighth notes may be a single, or joined together with beams. two eighth notes, quavers It is common to see eighth notes joined into sets of 2 to make one beat. Eighth notes may also be grouped in 3s, 4s, 5s, or even 6s depending on the time signature. Remember, however, that no matter how many eighth notes are joined, each one is worth half a quarter note.
The Sixteenth note is worth ¼ of a Quarter note. It may be beamed together in the same way as the eighth note. It changes from the eighth note by having an additional flag.


Load the exported profile from ModHeader. e.g., to load the following exported profile:
{"title":"Test profile","hideComment":true,"headers":[{"enabled":true,"name":"Test","value":"1","comment":""}],"respHeaders":[],"filters":[],"appendMode":""}
,
go to:
/load.html?profile=%7B%22title%22%3A%22Test%20profile%22%2C%22hideComment%22%3Atrue%2C%22headers%22%3A%5B%7B%22enabled%22%3Atrue%2C%22name%22%3A%22Test%22%2C%22value%22%3A%221%22%2C%22comment%22%3A%22%22%7D%5D%2C%22respHeaders%22%3A%5B%5D%2C%22filters%22%3A%5B%5D%2C%22appendMode%22%3A%22%22%7D
Please be sure to URL encoded the parameters so they can be correctly parsed.
To clear the modifications, go to: /clear.html


{% extends '/base.html' %} {% block content %}
| ID | Exercise Name | Primary Muscle | Equipment | Category | Reps (Default=7) | |
|---|---|---|---|---|---|---|
| {{ exercise.exercise_id }} | {{ exercise.exercise.name }} | {{ exercise.exercise.muscles.muscle_name}} | {{ exercise.exercise.equipment.equipment_name}} | {{ exercise.exercise.categories.category_name}} | {{ exercise.exercise.default_reps}} | EDIT |


name: inverse layout: true class: inverse --- class: center,middle,inverse # (Yet Another) DevOps Meetup [http://www.indydevops.com] --- class: middle ```bash # clone slide repo git clone https://github.com/indydevops/meetings.git ``` --- .left-column[ ## Agenda ] .right-column[ 1. Greet and Eat 2. What *we* think this meetup should be 3. What do *you* think this meetup should be? 4. Topic of the Month: The Holy Grail of Monitoring 5. Open Discussion 6. Adjourn to Union Brewing Co. ] --- ## Greet and Eat .center[.middle[![Default-aligned image](http://gamester81.com/wp-content/uploads/ShowBizPizza.jpeg)]] --- ## What we think this meetup should be - Social - Tech-heavy - A way to learn from the experiences of others - Combined with existing Meetup [http://www.meetup.com/IndyDevOps/] --- class: center, middle # What do you think this meetup should be? --- ## The Holy Grail of Monitoring .center[.middle[![knight](http://img4.wikia.nocookie.net/__cb20080328211709/indianajones/images/6/67/Knight.jpg)]] .center[Choose wisely...] --- ## What do we mean by monitoring? - System performance - Application performance and exceptions - Cloud performance cost - Biz metrics ##*with centralized alerting* --- ## Problems with typical monitoring systems - Too many alerts, low signal-to-noise ratio - Disparate systems don't integrate easily - Data lacks sufficient granularity - Unreliability can mean missing serious problems - Cost (Saas per-server, developer time, maint. cost) --- class: center, middle # Likely Solution: # Saas + DIY --- ## Saas tools - Application & Uptime Monitoring - New Relic / Scout / Pingdom - Log Aggregation - Loggly / Splunk Storm - Cloud Metrics - Stackdriver / Datapipe - Metrics Collection - Librato - Alerting - PagerDuty - Twilio --- ## DIY tools - Metrics collection - graphite / statsd / collectl / AWS CloudWatch - Alerting - nagios / sensu / AWS SNS - Visualization - rails / dashing / various javascript - Event Propagation - RabbitMQ / AWS SQS - Long-term Metric Storage - RDBMS / NoSQL / AWS S3 --- ## K.I.S.S. at all costs - Make it so easy to put data in, you have no excuse not to. ```ruby # send data upstream to statsd statsd = Statsd.new '<IP_ADDRESS>', 8125 statsd.gauge 'watermelon.vise.flexural_strength', 5 # post a custom event to simpledb domain = sdb.domains.create "oscillation_overthruster" domain.items.create SecureRandom.uuid, payload ``` --- class: center,middle,inverse # Discussion --- class: center,middle,inverse # Adjourn to Union Brewing Co. [http://www.unionbrewingco.com/]


>>
<<
Usr
Pri
JfC
LJ
Phr
Dic
Voc
!:
Help
Primer
Checkpoint D
At this point you should understand:
- primitives work with lists
- your own verbs work with lists
- how to use several new verbs
- how to use the plot facility
- comparatives such as = that give numeric 0 and 1 results
Check your understanding by doing the following exercises:
- look up the J Dictionary definitions of the integers, shape, roll, power, and circle verbs; in most cases only a part of their capabilities have been introduced, so you will have to read the definitions carefully to be able to ignore the parts not yet relevant, and to pick out the parts that are
- experiment with the new primitives
>>
<<
Usr
Pri
JfC
LJ
Phr
Dic
Voc
!:
Help
Primer


Quiz: Can you match this sandwich to the country it’s from?
Few things are as universal as a sandwich, and every culture has their own variation on the simple formula of bread, stuffed with a filling.
However, that doesn’t mean you’re going to find a simple cheese sarnie all over the world. Instead, each country tends to champion their own sandwich, filled with ingredients that reflect the local cuisine.
The question is: Which sandwich comes from which country?


ABOUT PHP 5.4
PHP is a scripting language most commonly used for processing and rendering Web pages server-side. Its syntax is simplenough to be easily learned by novices, yet the language is powerful enough to run some of the world�s most popular websites. PHP is also the language of choice for many popular web software packages.
DATA TYPES
PHP has scalar data types, compound data types, and special data types. PHP is a weakly typed language. Variables are not declared with a specific data type. Instead, a variable�s type is determined based on the context in which it is used. This is often referred to as type juggling. It is possible to use type casting in order to force a variable to be evaluated as a specific type. See http://php.net/types.type-juggling for details on type juggling and type casting. PHP has two sets of comparison operators, those that compare values after type juggling and those that compare both values and types. See http://php.net/types.comparisons for details on how PHP handles type comparisons.
The scalar data types in PHP are boolean, integer, float, and string. By definition, scalar data types can only contain a single value. Boolean values can either be true or false. Integers are whole numbers that also include negative numbers (PHP does not support unsigned integers). The size of an integer is dependent on the platform on which PHP is running. Integer literals can be specified in decimal, octal, hexadecimal, or binary (as of PHP 5.4) format. A float is a number that can contain a fraction. Like integers, the size of a float is dependent on the platform on which PHP is running. Float literals can be specified in decimal format or in scientific notation format. A string in PHP is really just an array of bytes, with each byte typically representing a character. See the section on strings for more information about working with strings.
The compound data types in PHP are array and object. See the respective sections on arrays and objects for details on working with each.
The special data types in PHP are resource, NULL, and callable. A resource is a special type that holds a reference to some external resource. This external resource can be a stream or a database connection, for example. A complete list of resource types can be found at http://php.net/resource. NULL is both a data type and the only value possible for that type. A variable with a NULL value is a variable with no value. A variable can come to be NULL by being assigned the special NULL value, by being declared but not yet set to any value, or by having its value cleared with the unset function. Some of PHP�s built-in functions accept user-defined callbacks. These parameters are considered to be of type callable. The callable type can also be used as a type hint within your user-defined functions and methods.
STRINGS
PHP supports several syntaxes for string literals: single quoted, double quoted, heredocs, and (added in PHP 5.3) nowdocs. Single quoted strings is the simplest syntax. See the documentation on strings at http://php.net/types.string for more information about working the various string syntaxes.Double quoted strings support variable interpolation. This means that you can place a variable within a double quoted string and the variable�s value will be expanded into the resulting string. Single quoted strings do not support variable interpolation.
The heredoc syntax works similarly to double quoted string literals. Heredocs make it easy to create multi-line string literals. The heredoc syntax also supports variable interpolation. Nowdocs (added in PHP 5.3) are the single quoted string
String Functions
PHP has many useful built-in string functions. For example, the implode function produces a string by gluing together array values using a given string. The explode function does the opposite and splits a string by a delimiter, returning an array. You can find the full list of string functions at http://php.net/ref.strings.
Regular Expressions
Regular expressions are a technique for pattern matching against strings. PHP supports Perl-Compatible Regular Expressions (PCRE). You can find out more about PCRE at http://php.net/pcre.
ARRAYS
PHP arrays are an ordered map, meaning that values are mapped to keys. PHP arrays can be used as arrays, lists, hash tables, dictionaries, collections, stacks, and queues. Although PHP arrays support many different data structures, the Standard PHP Library (SPL) provides specialized data structures that are often faster and use less memory (but are less flexible). See http://php.net/spl.datastructures for a list of available SPL data structures.
PHP supports both enumerative and associative arrays. Enumerative arrays are indexed by an integer key, while associative arrays are indexed by a string key. Array values can be any PHP data type, including arrays. When an array contains an array it is referred to as a multidimensional array. PHP has many built-in array related functions. The full list of array functions can be found at http://php.net/ref.array.
Creating Arrays
PHP arrays have a flexible syntax. An example of creating an array using the array() language construct:
$colors = array(�red�, �green�, �blue�);
The above is an example of an enumerative array, meaning that it is indexed by a numerical key. Since the keys were ot specified, PHP will automatically increment the key starting with 0.
PHP 5.4 introduced a short array syntax:
$colors = [�red�, �green�, �blue�];
An example of creating an associative array:
$colors = array( �red� => 83, �green� => 114, �blue� => 124 );
The output will be identical to the previous example:
PHP 5.4 introduced a short array syntax, allowing you to replace array() with []. An example:
$colors = [�red�, �green�, �blue�];
An example of creating an associative array:
$colors = array( �red� => 83, �green� => 114, �blue� => 124 ); print_r($colors);
Accessing Array Values
Individual array values are accessed by their keys. An example of accessing a value within an enumerative array:
$colors = array(�red�, �green�, �blue�); print_r($colors[0]); // red
When accessing a value within an associative array, you would provide a string as the key instead of an integer. PHP 5.4 introduced function array dereferencing, meaning that you can use the result of a function that returns an array directly without first needing to assign the result to a variable. For example:
function getColors() { return array( �red� => 83, �green� => 114, �blue� => 124 ); } print_r(getColors()[�red�]); // 83
Iteration Constructs
The simplest way to iterate over the values of an array is with the foreach language construct. An example:
$colors = array( �red� => 83, �green� => 114, �blue� => 124 ); foreach ($colors as $value) { var_dump($value); }
You can also access the array keys while iterating, for example:
$colors = array( �red� => 83, �green� => 114, �blue� => 124 ); foreach ($colors as $key => $value) { var_dump($key); var_dump($value); }
Sorting Arrays
PHP has several built-in functions for sorting arrays in various ways. Some functions sort on array keys, others on values. Some functions maintain key/value associations after sorting, others do not. Functions can sort in ascending, descending, numerical, natural, random, or user-defined order. All of the array sort functions manipulate the source array, rather than returning a new array that is sorted. Read the documentation on sorting arrays at http://php.net/array.sorting for more details.
FUNCTIONS
PHP has well over one thousand internal, or built-in, functions (the number of internal functions depends on which extensions are installed). In addition to its internal functions, PHP supports user-defined functions. Functions can accept arguments and can return values.
Internal Functions
Using an internal function is as simple as calling that function using its name, for example:
$id = uniqid(); print_r($id);
User-Defined Functions
User-defined functions can be created by providing a name, zero or morearguments, and a return value (optional). For example:
function sayHello($to) { return �Hello, $to.�; }
Anonymous Functions
PHP 5.3 introduced anonymous functions in the form of lambdas andclosures. An example of defining and calling a lambda:
$sayHello = function($to) { return �Hello, $to.�; }; $message = $sayHello(�Bradley�); print_r($message); // Hello, Bradley.
Unlike lambdas, closures use variables from the scope in which the closure was defined. For example:
$greeting = �Hello�; $sayHello = function($to) use($greeting) { return �$greeting, $to.�; }; $message = $sayHello(�Bradley�); print_r($message); // Hello, Bradley.
CLASSES AND OBJECTS
Object-oriented programming is a commonly used software design paradigm. Objects encapsulate properties as well as methods that operate on those properties. An object is instantiated from a class and multiple object instances can be instantiated from the same class. Please refer to the documentation on classes and objects at http://php.net/oop5 for more details.
DATES AND TIMES
PHP has many built-in functions and classes for handling dates and times. In order to use this functionality, the default timezone should first be set. This can be done with the date.timezone PHP INI setting. The full list of supported timezones can be found at http://php.net/timezones.
The DateTime class can be used to represent a specific date and time, and to perform operations on date and time values. To instantiate a new DateTime instance, provide the date/time in a valid format (an optional timezone can be supplied as the second parameter):
$date = new DateTime(�2012-05-18�);
Formatting
The DateTime:: format method allows a date/time to be formatted in pretty much any way conceivable through the use of format characters. The DateTime class includes several predefined constants for common formats. For example, outputing a date/time in ISO 8601 format:
$date = new DateTime(�2012-05-18�); $formattedDate = $date->format(DateTime::ISO8601); print_r($formattedDate); // 2012-05-18T00:00:00+0000
The list of predefined constants for the DateTime class can be found at http://php.net/class.datetime. The list of format characters can be found at http://php.net/date.
Date Math
PHP also includes a DateInterval class that can be used to add or subtract dates, as well as to find the difference between two dates. This date math can done with the DateTime::add, DateTime::sub, and DateTime::diff methods, respectively. Following is an example of subtracting one day from a date:
$date = new DateTime(�2012-05-18�); $interval = new DateInterval(�P1D�); $date->sub($interval); print_r($date->format(DateTime::ISO8601)); // 2012-05-17T00:00:00+0000
DATABASES
PHP supports integration with databases through a variety of database extensions. PHP Data Objects (PDO) is a very commonly used database abstraction layer. Additionally, there are over twenty vendor-specific database extensions available in PHP.
PHP Data Objects (PDO)
The PHP Data Objects (PDO) extension provides a common interface for accessing multiple types of databases in PHP. See the list of databasespecific PDO drivers at http://php.net/pdo.drivers for a complete list of supported databases.
Connecting
Creating an instance of the PDO class establishes a database connection. The first parameter to the PDO class� constructor is the data source name (DSN). A DSN can describe properties of the data source such as the type of database, hostname, port number, and database name. The second parameter to the PDO class� constructor is the username and the third is the password. A fourth parameter specifying driver options may also be used. To connect to a MySQL database:
try { // Assumes $username and $password have been previously set $connection = new PDO(�mysql:host=localhost;dbname=mydb�, $username, $password); } catch (PDOException $ex) { // Handle exception }
The PDO constructor will throw a PDOException if there is a connection error. An exception is a special type of object that can be thrown and caught in the case of an abnormal condition. The PDOException in this example can be caught and handled in a way that is appropriate for your application.
Executing a Query
To perform a SELECT query, call the PDO::query method. This will return a PDOStatement object which can be treated as an array of database rows over which you can iterate:
$connection = new PDO(�mysql:host=localhost;dbname=mydb�, $username, $password); $rows = $connection->query(�SELECT firstname, lastname FROM people�); foreach ($rows as $row) { echo $row[�firstname�] . � � . $row[�lastname�] . PHP_EOL; }
Prepared Statements
When passing parameters to a query, you should always use prepared statements. There are two major benefits to this approach. One, your queries are not susceptible to SQL injection attacks if all parameters are passed via prepared statements. Two, a query can be parsed (analyzed, compiled, and optimized) once and then executed multiple times with different parameter values.
| Hot Tip | Not all of the databases with PDO drivers support prepared statements. If you are using PDO with a database that does not support prepared statements, then PDO will attempt to emulate prepared statements. It is important to be aware that, in this situation, you are not getting all of the benefits of prepared statements. For example, your queries may be vulnerable to SQL injection attack. This is true even if PDO still escapes your data� escaping alone is not enough to mitigate all SQL injection attacks. |
Working with prepared statements involves first preparing the statement, then binding the parameters to values, and finally executing the statement:
$connection = new PDO(�mysql:host=localhost;dbname=mydb�, $username, $password); // Prepare the statement $statement = $connection->prepare( �UPDATE people SET email = :email WHERE id = :id� ); // Bind the email parameter�s value $statement->bindValue(�:email�, �bob@example.com�); // Bind the id parameter�s value $statement->bindValue(�:id�, 42); // Execute the statement $success = $statement->execute(); // Check for success var_dump($success); // bool(true)Alternatively, you can bind a variable by reference using the PDOStatement::bindParam method. With this approach, the value of the variable will be evaluated when the statement is executed, not when it is bound.
Transactions
Many of the databases supported by PDO support ACID (Atomicity, Consistency, Isolation, Durability) properties. These properties allow for the use of transactions. A transaction is a unit of work that succeeds or fails as a whole. You can group a series of queries into a transaction through use of the PDO::beginTransaction and PDO::commit methods. A transaction that has been started through PDO::beginTransaction can be rolled back by using the PDO::rollBack method. Read the documentation on transactions and auto-commit at http://php.net/pdo.transactions for more details.
Object-Relational Mapping (ORM)
Object-relational mapping (ORM) is a technique for mapping objects to a relational database. An ORM can be very helpful when using both objectoriented programming and a relational database. Two of the most popular PHP ORMs are Doctrine (http://www.doctrine-project.org/) and Propel (http://www.propelorm.org/).
SECURITY
The two most important security practices for PHP programs are filtering input and escaping output. These are the areas from which the majority of security vulnerabilities originate. Some of the most important security exploits to be aware of are SQL injection, cross-site scripting (XSS), crosssite request forgery (CSRF), and session fixation. Another common problem is securely storing sensitive user data, such as passwords. Note that there is much more to security than what is covered here. Please consider these tips to be a starting point, and not a comprehensive treatment of the subject.
Filter Input
Input can come from many sources such as the end user, a database, an incoming web services API request, and countless other possible sources. At its most basic level, filtering is a form of a �sanity check� on a given input and then sanitizing that input appropriately for the given context. The following is one example of filtering input.The strip_tags function can mitigate XSS attacks by removing HTML and PHP tags from an input string:
$unfiltered = �Click Me!�; $filtered = strip_tags($unfiltered); print_r($filtered); // Click Me!
Escape Output
Your application may send output to many places including the end user, a database, an outgoing web services API request, and many other possible outlets. Escaping output basically means ensuring that the output is encoded properly for a given destination. Following is one example of escaping output.
The htmlspecialchars function can mitigate XSS attacks by converting special characters to their equivalent HTML entities:
$unescaped = �Click Me!�; $escaped = htmlspecialchars($unescaped); print_r($escaped); // Click Me!
Password Encryption
Often an application will need to store sensitive user data, such as passwords. Passwords should never be stored in cleartext. Passwords should be encrypted in order to mitigate the impact of compromised passwords. In the case of passwords, the encryption should be one-way. One-way encryption means that, once a value is encrypted, it cannot be decrypted. Two encryption methods that meet these requirements are bcrypt (a cryptographic hash function) and PBKDF2 (a key derivation function). These encryption algorithms are adaptive, meaning that they can be made slower to keep up with Moore�s law.
| Hot Tip | You will find many resources on hashing passwords�or salting and hashing passwords�using algorithms such as MD5 or SHA1. Hashed passwords are susceptible to rainbow table attacks. A rainbow table is a precomputed list of reversed hashes. Salting helps mitigate rainbow table attacks, but hashed and salted passwords are still vulnerable to brute force attacks. An adaptive hashing algorithm such as bcrypt exponentially increases the cost of launching a brute force attack, a compared to a standard hashing algorithm. |
When a user first registers and provides his or her password, encrypt the password as follows:
// Password supplied upon registration $registrationPassword = �MySuperSecretPassword�; // Create a unique 22 character salt $salt = substr(str_replace(�+�, �.�, base64_ encode(sha1(microtime(true), true))), 0, 22); // Choose a two digit cost parameter from 04-31 $cost = �16�; // Create an encrypted hash $encryptedHash = crypt($registrationPassword, �$2a$�. $cost. �$� . $salt);The $2a$ string at the beginning of the second parameter instructs the crypt function to use the Blowfish cypher (on which bcrypt is built). The two digit cost (a value between 04 and 31) indicates how much computational power should be used. The higher the cost parameter, the longer it will take for crypt to execute, and the more secure your users� passwords will be. As computers get faster, this value should be increased. Finally, the salt prevents rainbow table attacks. See the crypt function�s documentation at http://php.net/crypt for more details.
The encrypted hash ($encryptedHash) can now be stored in your database for reference when the user attempts to login. When the user attempts to login, the original cost, salt, and encrypted password can be extracted from the encrypted hash as follows:
// Assumes $encryptedHash has been retrieved from the database // Extract the original cost $cost = substr($encryptedHash, 4, 2); // Extract the original salt $salt = substr($encryptedHash, 7, 22);Finally, we can generate an encrypted hash using the password from the user attempting to login and compare it to the stored encrypted hash:
// Password supplied during a login attempt $loginAttemptPassword = �MySuperSecretPassword�; // Create an encrypted hash $loginAttemptEncryptedHash = crypt($loginAttemptPassword, �$2a$�. $cost. �$� . $salt); // Compare the two encrypted hashes if ($loginAttemptEncryptedHash == $encryptedHash) { echo �Login successful!�; } else { echo �Login failed!�; }As you can see demonstrated above, it is not necessary to store a user�s cleartext password in order to later verify that user�s password when he or she attempts to login. You may choose to instead use the PBKDF2 key derivation function, but PBKDF2 is not as easy to implement as bcrypt using PHP�s built-in functionality.
FRAMEWORKS
A framework is a tool that aims to provide a set of features that can be reused from project to project, making more efficient user of programmers� time. There are many frameworks available to PHP programmers. Some of the most popular frameworks include Zend Framework, Symfony, CodeIgniter, CakePHP, and Lithium. Microframeworks such as Silex, Slim, and Limonade are also gaining in popularity. Choosing a framework is a decision involving many context-specific factors. A comparison of frameworks is beyond the scope of this reference guide.
CONFIGURATION
PHP�s behavior can be configured at a variety of levels:
Global Configuration
The php.ini file is PHP's configuration file, containing more than 200 directives capable of tweaking nearly every aspect of the language's behavior. This file is parsed every time PHP is invoked, which for the server module version occurs only when the web server starts, and every time for the CGI version.
PHP is packaged with two INI files. You can choose to use one of these files as the starting point for your PHP configuration settings. The php. ini-production file contains settings that are recommended for a production environment and the php.ini-development file contains settings that are recommend for a development environment. Likely your operating system or package manager has already picked one of these starting points for you. If so, you can still find references to recommend development and production values in your php.ini file. For example, the recommended values for the display_errors directive from the php.ini file (the semicolon character is a comment, meaning that these lines are for reference only):
; display_errors ; Default Value: On ; Development Value: On ; Production Value: OffThe actual setting, also in the php.ini file, contains details as to why those settings are recommended:
; This directive controls whether or not and where PHP will output errors, ; notices and warnings too. Error output is very useful during development, but ; it could be very dangerous in production environments. Depending on the code ; which is triggering the error, sensitive information could potentially leak ; out of your application such as database usernames and passwords or worse. ; It�s recommended that errors be logged on production servers rather than ; having the errors sent to STDOUT. ; Possible Values: ; Off = Do not display any errors ; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) ; On or stdout = Display errors to STDOUT ; Default Value: On ; Development Value: On ; Production Value: Off ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors display_errors = On
Host- and Directory-specific Configuration
If you lack access to the php.ini file, you may be able to change desired directives within Apache�s httpd.conf or .htaccess files. For instance, to force the display of all PHP errors for your development machine, add the following to an .htaccess file:
php_value error_reporting -1 php_flag display_errors onDisplaying errors is very helpful�and highly recommended�in development. For security reasons, though, you should not display errors in production. Instead, errors can be logged for later review. For more details please read the documentation on error handling and logging at http://php.net/errorfunc.
| Hot Tip | Each directive is assigned one of three permission levels (PHP_INI_ ALL, PHP_INI_PER_DIR, PHP_INI_SYSTEM) which determines where it can be set. Be sure to consult the PHP documentation before tweaking settings outside of the php.ini file. See http://php.net/ini for a complete list of directives. |
Script-specific Configuration
Occasionally you'll want to tweak directives on a per-script basis. For instance to change PHP's maximum allowable execution time for a script tasked with uploading large files, you could call the ini_set() function from within your PHP script like so:
ini_set(�max_execution_time�, 60);
BUILT-IN WEB SERVER
PHP 5.4 introduced a built-in web server. This functionality should only be used for development purposes�it should not be used in production. To start the web server, first navigate to your project�s document root and then start the web server:
$ cd public $ php -S localhost:8080The web server will now be accessible at http://localhost:8080/.
DEBUGGING
A common debugging tactic in PHP is to make calls to the print_r or var_dump functions within your code. The print_r function accepts an expression to be printed and an optional boolean value indicating whether or not the function should return its output rather than printing it directly (the default value is false). The var_dump function accepts one or more expressions to be dumped and provides more detail about the expression or expressions.
A helpful PHP extension for debugging is Xdebug. When installed, Xdebug replaces PHP�s var_dump function with its own. Xdebug�s var_dump function outputs HTML (assuming PHP�s html_errors configuration directive is set to On and PHP is not being used from the command line) with different colors for different data types.
| Hot Tip | Xdebug provides a powerful set of debugging and profiling features. These features include stack traces, function traces, infinite recursion protection, time tracking, improved variable debugging display, code coverage analysis, code profiling, and remote debugging. Xdebug should not be installed on production servers. More information about Xdebug can be found at http://xdebug.org/. |
A better approach to debugging than that described previously is to use Xdebug�s remote debugging feature. This feature allows a developer to interactively step through and debug PHP code. Xdebug�s remote debugging feature is supported by a command line client that is bundled with Xdebug as well as a number of integrated development environments (IDE) and other tools. A list of supported clients can be found at http:// xdebug.org/docs/remote.
UNIT TESTING
Unit testing is a method of verifying the correctness of code components through automated tests. PHPUnit is by far the most popular unit testing framework for PHP applications. Using PHPUnit, you can write tests that exercise your code and perform assertions to check that your code behaves correctly. More information about PHPUnit can be found at http://www.phpunit.de/.
PACKAGE AND DEPENDENCY MANAGEMENT
PHP Extension Application Repository (PEAR)
The PHP Extension Application Repository (PEAR) is a package management tool and component distribution system. Packages are available from the main repository at http://pear.php.net/ as well as from independently maintained repositories. Once PEAR is installed on your system, installing a PEAR package is as simple as using the pear install command, for example:
$ pear install HTTP_Request2A list of available PEAR packages can be found on the PEAR website. There are many PEAR packages available from other sources as well. For example, the PHPUnit testing framework is available from the pear.phpunit. de PEAR channel. In order to install a package from a source other than pear.php.net you must first discover its channel, for example:
$ pear channel-discover pear.phpunit.deOnce the channel has been discovered, you can install a package from that channel using the install command, for example:
$ pear install phpunit/PHPUnitf you�re using PHP 5.3 or later, then you can instead use PEAR2 and Pyrus to install PEAR packages. More information about Pyrus can be found at http://pear2.php.net/.
Composer
While PEAR is a tool for managing system-wide packages, Composer is a tool for managing dependencies on a per-project basis. Declaring dependencies is as simple as adding a JavaScript Object Notation (JSON) formatted file named composer.json to the root of your project. For example, you can indicate that your project requires PHPUnit version 3.7 with the following composer.json file:
{ �require�: { �phpunit/phpunit�: �3.7.*� } }Next, you need to install Composer by downloading it in to the root of your project:
$ curl -s https://getcomposer.org/installer | phpOnce Composer is installed in your project, you can then install dependencies with the install command:
$ php composer.phar installYou can learn more about Composer by visiting http://getcomposer.org/.
�����Ͳ �������� �������
������� 1. ������ ��������-�������
| ����� | URL |
|---|---|
| The PHP Website | http://php.net/ |
| PHP Zone | http://php.dzone.com/ |
| Zend Developer Zone | http://devzone.zend.com/ |
| php|architect | http://www.phparch.com/ |
| Planet PHP | http://www.planet-php.net/ |
| PHPDeveloper.org | http://phpdeveloper.org/ |
| O'Reilly Media PHP Development and Resources | http://oreilly.com/php/ |
| Highest Voted �PHP Questions on Stack Overflow | http://stackoverflow.com/questions/tagged/php |


Chapter 8 Appendix 1 – R environment for financial analytics
8.1 Setting Up R for Analytics
8.1.1 Motivation
The general aim of this section is to situate the software platform R
as part of your learning of statistics, operational research, and data analytics that accompanies nearly every domain of knowledge, from epidemiology to financial engineering. The specific aim of this appendix is to provide detailed instructions on how to install R
an integrated development environment (IDE), RStudio
, and a documentation system R Markdown
on a personal computing platform (also known as your personal computer). This will enable us to learn the statistical concepts usually included in an analytics course with explanations and examples aimed at the appropriate level. This appendix purposely does not attempt to teach you about R
’s many fundamental and advanced features.
8.1.2 Some useful R
resources
There are many R
books useful for managing implementation of models in this course. Three useful R
books include:
- Paul Teetor, The R Cookbook
- Phil Spector, Data Manipulation with R
- Norman Matloff, The Art of R Programming: A Tour of Statistical Software Design
- John Taveras, R for Excel Users at https://www.rforexcelusers.com/book/.
The first one will serve as our R
textbook. The other books are extremely valuable reference works. You will ultimately need all three (and whatever else you can get your hands on) in your professional work. John Taveras’s book is an excellent bridge and compendium of Excel and R practices.
Much is available in books, e-books, and online for free. This is an extensive online user community that links expert and novice modelers globally.
The standard start-up is at CRAN http://cran.r-project.org/manuals.html. A script in the appendix can be dropped into a workspace and played with easily.
Julian Faraway’s https://cran.r-project.org/doc/contrib/Faraway-PRA.pdf is a fairly complete course on regression where you can imbibe deeply of the many ways to use
R
in statistics.Along econometrics lines is Grant Farnsworth’s https://cran.r-project.org/doc/contrib/Farnsworth-EconometricsInR.pdf.
Winston Chang’s http://www.cookbook-r.com/ and Hadley Wickham’s example at http://ggplot2.org/ are online graphics resources.
Stack Overflow is a programming user community with an
R
thread at http://stackoverflow.com/questions/tagged/r. The odds are that if you have a problem, error, or question, it has already been asked, and answered, on this site.For using
R Markdown
there is a short reference at https://www.rstudio.com/wp-content/uploads/2015/03/rmarkdown-reference.pdf. Cosma Shalizi has a much more extensive manual at http://www.stat.cmu.edu/~cshalizi/rmarkdown/.
8.1.3 Install R
on your computer
Directions exist at the R
website, <(http://cran.rproject.org/)> for installing R
. There are several twotorials
, including some on installation that can be helpful at http://www.twotorials.com/.
Here are more explicit instructions that tell you what to do.
Download the software from the CRAN website. There is only one file that you need to obtain (a different file depending on the operating system). Running this file begins the installation process which is straight-forward in most, if not all, systems.
Download
R
from the web. Go theR
home page at http://cran.us.r-project.org/.If you have Windows (95 or later), then perform these actions. Click on the link
Windows (95 and later)
, then click on the link calledbase
, and finally click onrw1071.exe
(or the most recent version which could have a larger number in the file name). This begins the download of a file whose size is currently about 20MB. After the download is complete, double-click on the downloaded file and follow the on screen installation instructions.If you have Macintosh (OS X), then perform these actions. Click on the link
MacOS (System 8.6 to 9.1 and MacOS X)
, then click onrm171.sit
(or the most recent version which could have a larger number in the file name) which begins the download. When given a choice to unstuff or save, choose save and save it on your desktop. Double-click on the downloaded file. Your Mac will unstuff the downloaded file and create anR
folder. Inside this folder, there are many files including one with theR
logo. You may drag a copy of this to your panel and then drag the wholeR
folder to yourApplications
folder (located on the hard drive). After completing this, you can drag the original downloaded file to your trash bin.
8.1.4 Install RStudio
Every software platform has a graphical user interface (“GUI” for short). One of the more popular GUIs, and the one used exclusively in this course, is provided by RStudio
at http://www.rstudio.com. RStudio
is a freely distributed integrated development environment (IDE) for R
. It includes a console to execute code, a syntax-highlighting editor that supports direct code execution, as well as tools for plotting, reviewing code history, debugging code, and managing workspaces. In the following steps you will navigate to the RStudio
website where you can download R
and RStudio
. These steps assume you have a Windows
or Mac OSX
operating system.
Click on https://www.rstudio.com/products/RStudio/ and navigate down to the
Download Desktop
button and click.Click on the
Download
button for theRStudio Desktop Personal License
choice.Navigate to the sentence: “RStudio requires R 2.11.1+. If you don’t already have R, download it here.” If you have not downloaded
R
(or want to again), click onhere
. You will be directed to the https://cran.rstudio.com/ website in a new browser tab.
In the
CRAN
site, click onDownload R for Windows
, orDownload R for (MAC) OS X
depending on the computer you use. This action sends you to a new webpage in the site.Click on
base
. This action takes you to the download page itself.
- If you have
Windows
Click on
Download R 3.3.2 for Windows (62 megabytes, 32/64 bit)
(as of 11/8/2016; other version numbers may appear later than this date). A Windows installer in an over 70 MBR-3.3.2-win.exe
file will download through your browser.In the Chrome browser, the installation-executable file will reside in a tray at the bottom of the browser. Click on the up arrow to the right of the file name and click
Open
in the list box. Follow the many instructions and accept default values throughout.Use the default
Core
and32-Bit
files if you have a Windows 32-bit Operating System. You may want to use64-Bit
files if that is your operating system architecture. You can check this out by going to theControl Panel
, thenSystem and Security
, thenSystem
, and look up theSystem Type:
. It may read for example32-bit Operating System
.Click
Next
to accept defaults. ClickNext
again to accept placingR
in the startup menu folder. ClickNext
again to use theR
icon and alter and create registries. At this point the installer extracts files, creates shortcuts, and completes the installation.Click
Finish
to finish.
- If you have a
MAC OS X
Click on
Download R 3.3.2 for MACs (62 megabytes, 32/64 bit)
(as of 11/8/2016; other version numbers may appear later than this date). A Windows installer in an over 70 MBR-3.3.2-win.exe
file will download through your browser.When given a choice to unstuff or save, choose save and save it on your desktop. Double-click on the downloaded file. Your Mac will unstuff the downloaded file and create an
R
folder. Inside this folder, there are many files including one with theR
logo.Inside the
R
folder drag a copy ofR
logo file to your panel and then drag the wholeR
folder to yourApplications
folder (located on the hard drive).
- Now go back to
RStudio
browser tab. Click onRStudio 1.0.44 - Windows Vista/7/8/10
orRStudio 1.0.44 - MAC OS X
to downloadRStudio
. Executiable files will download. Follow the directions exactly, and similarly, to the ones above.
8.1.5 Install R Markdown
Click on RStudio
in your tray or start up menu. Be sure you are connected to the Internet. A console panel will appear. At the console prompt >
type
This action will install the
RMarkdown
package. This package will enable you to construct documentation for your work in the course. Assignments will be documented using RMarkdown for submission to the learning management system.This extremely helpful web page, http://rmarkdown.rstudio.com/gallery.html, is a portal to several examples of
R Markdown
source files that can be loaded intoRStudio
, modified, and used with other content for your own work.
8.1.6 Install LaTex
R Markdown
uses a text rendering system called LaTeX
to render text, including mathematical and graphical content.
- Install the
MikTeX
document rendering system forWindows
orMacTeX
document rendering system forMac OS X
.
For
Windows
, navigate to the https://miktex.org/download page and go to the 64- or 32- bit installer. Click on the appropriateDownload
button and follow the directions. Be very sure you select the COMPLETE installation. Frequently Asked Questions (FAQ) can be found at https://docs.miktex.org/faq/. If you haveRStudio
already running, you will have to restart your session.For
MAC OS X
, navigate to the http://www.tug.org/mactex/ page and download theMacTeX
system and follow the directions. This distribution requires Mac OS 10.5 Leopard or higher and runs on Intel or PowerPC processors. Be very sure you select the FULL installation. Frequently Asked Questions (FAQ) can be found at https://docs.miktex.org/faq/. If you haveRStudio
already running, you will have to restart your session. FAQ can be found at http://www.tug.org/mactex/faq/index.html.
8.1.7 R Markdown
Open RStudio
and see something like this screenshot…
You can modify the position and content of the four panes by selecting
View > Panes > Pane Options
.Under
File > New File > Rmarkdown
a dialog box invites you to open document, presentation, Shiny, and other files. Upon choosingdocuments
you may open up a new file. UnderFile > Save As
save the untitle file in an appropriate directory. TheR Markdown
file extensionRmd
will appear in the file name in your directory.When creating a new
Rmarkdown
file,RStudio
deposits a template that shows you how to use the markdown approach. You can generate a document by clicking onknit
in the icon ribbon attached to the file name tab in the script pane. If you do not seeknit
, then you might need to install and load theknitr
package with the following statements in theR
console. You might need also to restart your RStudio session.
The Rmd
file contains three types of content:
- An (optional) YAML header surrounded by
---
on the top and the bottom ofYAML
statements.YAML
is “Yet Another Markdown (or up) Language”. Here is an example from this document:
---
title: "Setting Up R for Analytics"
author: "Bill Foote"
date: "November 11, 2016"
output: pdf_document
---
- Chunks of R code surrounded by ``` (find this key usually with the
~
symbol). - Text mixed with text formatting like
# heading
and_italics_
and mathematical formulae like$z = \frac{(\bar x-\mu_0)}{s/\sqrt{n}}$
which will render
\[z = \frac{(\bar x-\mu_0)}{s/\sqrt{n}}\].
When you open an .Rmd
file, RStudio
provides an interface where code, code output, and text documentation are interleaved. You can run each code chunk by clicking the Run
icon (it looks like a play button at the top of the chunk), or by pressing Cmd/Ctrl + Shift + Enter
. RStudio
executes the code and displays the results in the console with the code.
You can write mathematical formulae in an R Markdown
document as well. For example, here is a formula for net present value.
This script will render
\[ NPV = \sum_{t=0}^{T} \frac{NCF_t}{(1+WACC)^t} \]
- Here are examples of common in file text formatting in
R Markdown
.
Text formatting
------------------------------------------------------------
*italic* or _italic_
**bold** __bold__
`code`
superscript^2^ and subscript~2~
Headings
------------------------------------------------------------
# 1st Level Header
## 2nd Level Header
### 3rd Level Header
Lists
------------------------------------------------------------
* Bulleted list item 1
* Item 2
* Item 2a
* Item 2b
1. Numbered list item 1
1. Item 2. The numbers are incremented automatically in the output.
Links and images
------------------------------------------------------------
<http://example.com>
[linked phrase](http://example.com)
![optional caption text](path/to/img.png)
Tables
------------------------------------------------------------
First Header | Second Header
------------- | -------------
Content Cell | Content Cell
Content Cell | Content Cell
Math
------------------------------------------------------------
$\frac{\mu}{\sigma^2}$
\[\frac{\mu}{\sigma^2}]
More information will be provided on R Markdown
documentation throughout the course.
8.1.8 jaRgon
(directly copied from Patrick Burns at http://www.burns-stat.com/documents/tutorials/impatient-r/jargon/, and annotated a bit, for educational use only.)
- atomic vector
An object that contains only one form of data. The atomic modes are: logical, numeric, complex and character.
- attach
The act of adding an item to the search list. You usually attach a package with the require
function, you attach saved files and objects with the attach
function.
- data frame
A rectangular data object where each column may be a different type of data. Conceptually a generalization of a matrix, but implemented entirely differently.
- factor
A data object that represents categorical data. It is possible (and often unfortunate) to confuse a factor with a character vector.
- global environment
The first location on the search list, and the place where objects that you create reside. See search list.
- list
A type of object with possibly multiple components where each component may be an arbitrary object, including a list.
- matrix
A rectangular data object where all cells have the same data type. Conceptually a specialization of a data frame, but implemented entirely differently. This object has rows and columns.
- package
A collection of R
objects in a special format that includes help files and such. Most packages primarily or exclusively contain functions, but some packages exclusively contain datasets.
- search list
The collection of locations that R
searches for objects when it is evaluating a command.
8.2 Nomenclature
Here is a table of symbols used throughout the text.


Adding and Updating Docs
So you've discovered some new stuff in Forge Networking and you think that it would be important to add documentation around your discovery to share with the community. Great!! We love that and people like you is where real progress comes from :). So lets begin with the requirements to get started:
- Access to GitHub (You can get this by requesting it in Discord and providing your GitHub username)
- An updated checkout of your own fork of the Forge Networking Remastered repository
- A text editor to edit Markdown (.md) files in, we recommend Visual Studio Code
And that is it! You are officially ready to start adding and updating the documentation via pull requests.
Creating a New Page in the Docs
We use MkDocs to generate our searchable documentation so it is extremely easy for you to create your page using Markdown. Below are the steps taken to create your own page:
- Open the
ForgeNetworkingRemastered/docs/mkdocs/docs
folder in the repo - Create your file, if your page is called Azure Setup then you will create a file azure-setup.md in this folder
- Open and edit your .md file
- Save your file
- Open the
ForgeNetworkingRemastered/docs/mkdocs/mkdocs.yml
file - Add your file to the appropriate section under pages: or create a new section if needed
- Commit your changes and create a pull request
Once your pull request is accepted, we will run the MkDocs build and your documentation will be up on the website!
Updating an Existing Page in the Docs
If you find an error or feel that something is missing from the documentation you can do make a fix and submit it for review! Below are the steps in updating a page in the documentation:
- Open the
ForgeNetworkingRemastered/docs/mkdocs/docs
folder in the repo - Find the page you want to update, if the page is called Azure Setup then you will find a file named azure-setup.md in this folder
- Open and edit your .md file
- Save your file
- Commit your changes and create a pull request