-
-
PRODUCT
-
- PRODUCTS
-
- 2Sell Accept mobile and online payments from buyers worldwide
- 2Subscribe Subscription management solution to maximize recurring revenue
- 2Monetize Full commerce solution built for digital goods sales
- Add-ons Additional services to boost online sales
-
- SOLUTIONS
- CLIENTS
- COMPANY
- PRICING
This website is using cookies. By continuing to browse, you are agreeing to our use of cookies as explained in our Cookie Policy.
-
PRODUCT
- AVANGATE MONETIZATION PLATFORM
- Global Payments
- Digital Commerce
- Subscription Billing
- Reporting & Analytics
- Global Tax & Financial Services
- Risk Management & Compliance
- Merchant & Shopper Services
- Partner Sales
- PRODUCTS
- 2Sell
- 2Subscribe
- 2Monetize
- Add-ons
- CONNECTORS
- Shopping Cart Integrations
- API & 3rd Party Integrations
- SOLUTIONS
- CLIENTS
- COMPANY
- PRICING
- Resources
- Support
- Partners
Legal Overview
All you need to know about 2Checkout Legal
Other
Other
Cookies Policy
1. Use of cookies
Cookies are small text files that are placed on your computer by websites that you visit. They are widely used in order to make websites work, or work more efficiently, as well as to provide web services and functionalities for the users.
Cookies may be either "persistent" cookies or "session" cookies. A persistent cookie consists of a text file sent by a web server to a web browser, which will be stored by the browser and will remain valid until its set expiry date (unless deleted by the user before the expiry date). A session cookie, on the other hand, will expire at the end of the user session, when the web browser is closed.
2. Site cookies
The table below explains the site cookies we use at avangate.com and why we use them.
Cookie Source
Cookie Name
Function
Expiry Date
Crazy Egg
is_returning
This cookie is used for login and comment functions on this site. It is created in order to track whether a visitor is new or returning. A "returning" visitor is one that has previously visited any tracked page on your domain within the last 5 years.
5 years from the date that it was set
Avangate
_rfrr
This cookie is a persistent cookie used for storing internal reports regarding Google Analytics information
1,000 days from the date that it was set
Avangate
_rfrr_start_time
This cookie is a persistent cookie used for tracking sign up time of the visitor on avangate.com
1,000 days from the date that it was set
Avangate
_avangate_trk
This cookie is a persistent cookie in order to track whether a visitor is new or returning. A "returning" visitor is one that has previously visited any tracked page on your domain within the last 90 days. It also tracks personal information about you in order to prefill forms on website.
90 days from the date that it was set
Cookie Source:
Crazy Egg
Cookie Name:
is_returning
Function:
This cookie is used for login and comment functions on this site. It is created in order to track whether a visitor is new or returning. A "returning" visitor is one that has previously visited any tracked page on your domain within the last 5 years.
Expiry Date:
5 years from the date that it was set
Cookie Source:
Avangate
Cookie Name:
_rfrr
Function:
This cookie is a persistent cookie used for storing internal reports regarding Google Analytics information
Expiry Date:
1,000 days from the date that it was set
Cookie Source:
Avangate
Cookie Name:
_rfrr_start_time
Function:
This cookie is a persistent cookie used for tracking sign up time of the visitor on avangate.com
Expiry Date:
1,000 days from the date that it was set
Cookie Source:
Avangate
Cookie Name:
_avangate_trk
Function:
This cookie is a persistent cookie in order to track whether a visitor is new or returning. A "returning" visitor is one that has previously visited any tracked page on your domain within the last 90 days. It also tracks personal information about you in order to prefill forms on website.
Expiry Date:
90 days from the date that it was set
On our order page we use the following cookies:
Cookie Source
Cookie Name
Function
Expiry Date
Avangate
GKD
This cookie allows Avangate to identify a user session.
10 years
Avangate
PHPSESSID
This cookie is a session cookie used to establish a user session and to pass state data via a temporary cookie
end of session/close of browser
Avangate
ui_tabs_1/2
These cookies are used for graphic interface dimensions, numeric values
1 month from the date that it was set
Avangate
main_menu_slide
These cookies are used for graphic interface dimensions, numeric values
1 day from the date that it was set
Adobe
s_cc
s_fid
s_sq
s_vi
These (Adobe) Analytics cookies help Avangate to measure and understand how you use our apps, websites, social networking pages, and advertising campaigns.
We use Adobe (formerly Omniture) SiteCatalyst to give us insights into how many people visit our website, and how our users interact with it.
The SiteCatalyst cookies are s_cc (session), s_sq (session) and s_vi (persistent). More information can be found at http://www.omniture.com/en/privacy.
s_vi - 2 years from the date that it was set
s_cc, s_sq - end of session/close
Avangate
AVG_AFF[encoded]
Avangate affiliate cookie is used to track affiliate sales within the Avangate ordering system at the product level.
The information stored in the cookie consists of:
- Avangate product ID
- Cookie placement date
- Avangate affiliate ID
30-180 days from the date that it was set (to be decided by the vendor)
Avangate
AVG_AFF_encoded~
Avangate affiliate cookie is used to track affiliate sales within the Avangate ordering system at the vendor level.
The information stored in the cookie consists of:
- Avangate vendor code
- Cookie placement date
- Avangate affiliate ID
30-180 days from the date that it was set, decided by the vendor
Cookie Source:
Avangate
Cookie Name:
GKD
Function:
This cookie allows Avangate to identify a user session.
Expiry Date:
10 years
Cookie Source:
Avangate
Cookie Name:
PHPSESSID
Function:
This cookie is a session cookie used to establish a user session and to pass state data via a temporary cookie
Expiry Date:
end of session/close of browser
Cookie Source:
Avangate
Cookie Name:
ui_tabs_1/2
Function:
These cookies are used for graphic interface dimensions, numeric values
Expiry Date:
1 month from the date that it was set
Cookie Source:
Avangate
Cookie Name:
main_menu_slide
Function:
These cookies are used for graphic interface dimensions, numeric values
Expiry Date:
1 day from the date that it was set
Cookie Source:
Adobe
Cookie Name:
s_cc
s_fid
s_sq
s_vi
Function:
These (Adobe) Analytics cookies help Avangate to measure and understand how you use our apps, websites, social networking pages, and advertising campaigns.
We use Adobe (formerly Omniture) SiteCatalyst to give us insights into how many people visit our website, and how our users interact with it.
The SiteCatalyst cookies are s_cc (session), s_sq (session) and s_vi (persistent). More information can be found at http://www.omniture.com/en/privacy.
Expiry Date:
s_vi - 2 years from the date that it was set
s_cc, s_sq - end of session/close
Cookie Source:
Avangate
Cookie Name:
AVG_AFF[encoded]
Function:
Avangate affiliate cookie is used to track affiliate sales within the Avangate ordering system at the product level.
The information stored in the cookie consists of:
- Avangate product ID
- Cookie placement date
- Avangate affiliate ID
Expiry Date:
30-180 days from the date that it was set (to be decided by the vendor)
Cookie Source:
Avangate
Cookie Name:
AVG_AFF_encoded~
Function:
Avangate affiliate cookie is used to track affiliate sales within the Avangate ordering system at the vendor level.
The information stored in the cookie consists of:
- Avangate vendor code
- Cookie placement date
- Avangate affiliate ID
Expiry Date:
30-180 days from the date that it was set, decided by the vendor
3. Third party cookies
The table below explains the third party cookies we use and why we use them. These cookies are set by a third party and not by this site.
Cookie Source
Cookie Name
Function
Expiry Date
Google Analytics
_utma
_utmb
_utmc
_utmz
These cookies belong to third parties and are used to collect information on how visitors use this site. Collected information is used to compile reports and to help improving the site. The cookies collect information in an anonym way, including (i) the number of visitors to the site, (ii) where visitors have come to this site from and (iii) the pages of this site they visited. Click here for an overview of privacy at Google.
_utma: 2 years from the date that it was set
_utmb: 30 mins from the date that it was set
_utmc: end of session/close of browser
_utmz: 6 months from the date that it was set
Adobe
s_cc
s_cq
Adobe uses cookies, log file data and embedded code to gather data on behalf of the Avangate about visits to the Avangate sites. Avangate uses this information to track volume of usage on the Avangate sites and to help improve the services it provides to users.
Marketo
_mkto_trk
This tracks your activity on the site (pages visited, resources downloaded etc). It also tracks personal information about you including IP address.
2 years from the date that it was set
Google AdSense
_ar_v4
These cookies are set by our advertising partner Google in order to show you relevant adverts.
6 years from the date that it was set
Cookie Source:
Google Analytics
Cookie Name:
_utma
_utmb
_utmc
_utmz
Function:
These cookies belong to third parties and are used to collect information on how visitors use this site. Collected information is used to compile reports and to help improving the site. The cookies collect information in an anonym way, including (i) the number of visitors to the site, (ii) where visitors have come to this site from and (iii) the pages of this site they visited. Click here for an overview of privacy at Google.
Expiry Date:
_utma: 2 years from the date that it was set
_utmb: 30 mins from the date that it was set
_utmc: end of session/close of browser
_utmz: 6 months from the date that it was set
Cookie Source:
Adobe
Cookie Name:
s_cc
s_cq
Function:
Adobe uses cookies, log file data and embedded code to gather data on behalf of the Avangate about visits to the Avangate sites. Avangate uses this information to track volume of usage on the Avangate sites and to help improve the services it provides to users.
Expiry Date:
Cookie Source:
Marketo
Cookie Name:
_mkto_trk
Function:
This tracks your activity on the site (pages visited, resources downloaded etc). It also tracks personal information about you including IP address.
Expiry Date:
2 years from the date that it was set
Cookie Source:
Google AdSense
Cookie Name:
_ar_v4
Function:
These cookies are set by our advertising partner Google in order to show you relevant adverts.
Expiry Date:
6 years from the date that it was set
4. Don't Accept Cookies
If you do not want to accept cookies you should end your browsing on this site.
Please note that the above button do not block third party cookies. Third party cookies can be deleted by changing cookie setting in your browser as further described below.
5. Change cookie settings in your browser
Most web browsers allow control of the above listed cookies through the browser settings. To find out more about cookies, including how to see, what cookies have been set and how to manage and delete them, visit www.aboutcookies.org or www.allaboutcookies.org.
To opt out of being tracked by Google Analytics visit http://tools.google.com/dlpage/gaoptout.
Please note that if cookie settings in your browser are changed the above functions specified under section 3 may not be available.
6. Cookies and personal information
Cookies do not contain any information that personally identifies you, but personal information that we store about you may be linked to the information stored in and obtained only from Avangate Tracking cookies.
7. Privacy policy and cookies policy
This Cookies policy constitutes an inseparable part of the Terms of Use and Privacy Policy of this site. Click here for Terms of Use and Privacy Policy.
8. Contact us
This website is owned and operated by Avangate B.V.
If you have any questions about our cookies or this cookies policy, please contact us:
(a) by email to<EMAIL_ADDRESS>(b) by post to: De Cuserstraat 93, 2nd floor, 207-208 office, 1081 CN Amsterdam, The Netherland
Version 01 - June 2014
reffer
Simplify the eCommerce process. Try 2Checkout.
The most flexible digital commerce platform that can give your business a real boost.


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object kdl.prox.model2.common.sources.Source
public abstract class Source
Represents a source for a model. It is used in the pre-processing pass, when the Feature Vectors are created, to specify the source for the data. Example implementations are an attribute, a temporal attribute, or a structural attribute
How to create a new Source. - Extend this class - define toString() - define computeSourceTable(), which should return a [subg_id, value] NST - By default, the type of the source is the type of the value column in sourceTable. Overload getType if you need to - By default, the source is continuous if the type is FLT or DBL, discrete otherwise. Overload isContinuous if you need to - By default, the number of bins is the class's default. Overload getNumDistinctContinuousValues if you need to - [All these options (type, continuous, bins) can be set manually via standard setters] - by default, the distinct values are taken from the [value] column, binned if continuous. Overload computeDistinctValues if you have to - by default, the distinct subgraphs are computed from the sourceTable. Overload computeDistinctSubgraphs if you have to (see ItemSource, eg) - the values for distinctValues and distinctSubgraphs are cached. Overload the getters if for some reason this is not good for you
| Field Summary | |
|---|---|
protected NST |
distinctSubgraphs
|
protected java.util.List |
distinctValues
|
protected java.lang.Boolean |
isContinuous
|
protected java.lang.Boolean |
isSingleValue
|
protected int |
numDistinctContinuousValues
|
protected NST |
sourceTable
|
protected DataTypeEnum |
type
|
| Constructor Summary | |
|---|---|
Source()
|
|
Source(org.jdom.Element containerEle)
Create an instance of Source with the values specified in the XML element Derived classes can extend this constructor to read in values from the source-elements child |
| Method Summary | |
|---|---|
protected void |
assertIsInitialized()
|
protected NST |
computeDistinctSubgraphs()
Find the distinct subgraphs [subg_id] |
protected java.util.List |
computeDistinctValues()
Find the different values in the source table |
protected abstract NST |
computeSourceTable(Container cont,
NSTCache cache)
This is the main method. |
abstract boolean |
equals(java.lang.Object x)
|
NST |
getDistinctSubgraphs()
Returns the NST with [subg_id] of distinct subg_id, which was computed during init() |
java.util.List |
getDistinctValues()
Returns the List of distinct values in the source, which was computed during init() |
int |
getNumDistinctContinuousValues()
|
NST |
getSourceTable()
Returns the NST with [subg_id, value], which was computed during init() |
DataTypeEnum |
getType()
Get source type |
int |
hashCode()
|
Source |
init(Container cont,
NSTCache cache)
Passes in the container, and initializes all the tables it needs |
boolean |
isContinuous()
|
boolean |
isSingleValue()
Is this source single value? |
Source |
setIsContinuous(boolean isContinuous)
|
Source |
setIsSingleValue(boolean isSingleValue)
|
void |
setNumDistinctContinuousValues(int numDistinctContinuousValues)
|
void |
setType(DataTypeEnum type)
|
abstract java.lang.String |
toString()
|
org.jdom.Element |
toXML()
Creates an XML element to represent the source Creates the basic elements, and then derived classes can extend this and add elements to the source-elements child |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int numDistinctContinuousValues
protected DataTypeEnum type
protected java.lang.Boolean isContinuous
protected java.lang.Boolean isSingleValue
protected NST sourceTable
protected java.util.List distinctValues
protected NST distinctSubgraphs
| Constructor Detail |
|---|
public Source()
public Source(org.jdom.Element containerEle)
containerEle
- | Method Detail |
|---|
protected void assertIsInitialized()
protected java.util.List computeDistinctValues()
protected NST computeDistinctSubgraphs()
public abstract boolean equals(java.lang.Object x)
equals
in class java.lang.Object
protected abstract NST computeSourceTable(Container cont, NSTCache cache)
public int getNumDistinctContinuousValues()
public java.util.List getDistinctValues()
public NST getDistinctSubgraphs()
public NST getSourceTable()
public DataTypeEnum getType()
public int hashCode()
hashCode
in class java.lang.Object
public Source init(Container cont, NSTCache cache)
cont
- cache
- public boolean isContinuous()
public boolean isSingleValue()
public Source setIsContinuous(boolean isContinuous)
public Source setIsSingleValue(boolean isSingleValue)
public void setNumDistinctContinuousValues(int numDistinctContinuousValues)
public void setType(DataTypeEnum type)
public abstract java.lang.String toString()
toString
in class java.lang.Object
public org.jdom.Element toXML()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


MaxScript Release 1.5 Source (2/18/1999) MAX 2.5 ONLY
Copyright (c) 1999 by Borislav Petrov, Bobo's Rendert**ls.
SHORT DESCRIPTION
FreehandSpline (FHS) lets you draw freeform splines
with the mouse or tablet similar to drawing with a pencil.
It lets you quickly create complex shapes with control
over form and quality.
(The image above was created in just about 20 seconds
without any additional tweaking of the splines)
HOW DOES IT WORK?
FHS converts the mouse world coordinates into
spline knot (vertex) points with user-defined precision.
When the distance of mouse to the last
point drawn exceeds the user-specified Min.Segment Length,
the next point is generated. FHS allows
for multiple splines in a single shape, open/closed splines, curve/line
segments, renderable splines, and extruded or meshed contours.
FEATURES AND USAGE
Version 1.5 (2/18/99)
NEW: Implemented Bezier Vertex type as option.
NOTE that the splines are drawn as usual, but if the "Bezier Verts" checkbutton is pressed, the vertex types
will be converted to Beziers AFTER the curve has been finished. This means that default
tangents will be generated based on the Curve vertices, and you cannot mix Bezier and Smooth
types while drawing (but you can edit them afterwards in Modify tab/Editable Spline).
This function lets you go straight to Sub-Object level and edit tangents WITHOUT an additional step of converting
vertex types manually.
Version 1.4 (2/18/99)
NEW: Added the option to select between CURVE
and LINE segments.
By default, you can draw everything with curve
segments with user-defined Interpolation steps.
You can switch between Curve and Line modes
while drawing by pressing the [k] and [l] buttons, or by pressing [p] to
pause and checking the respective buttons in the utility's rollout.
The Interpolation Steps value corresponds
to the Interpolation Steps in the Editable Spline object. It is used to
specify the internal divisions between two vertices. If you set the value
to 0 (right-click on spinner arrows), the splines are drawn as in the older
Versions of FreehandSpline. Values in the Utility are limited to 10.
After drawing a shape, and before starting
a new shape, you can change the Interpolation Steps interactively for the
last shape created. (But you can edit it later in Modify tab, too)
You can convert a FreehandSpline Shape to
a Bezier curve by just going to Modify/Sub-Object/Vertex, selecting all
vertices, right-clicking them and changing the Type to Bezier. I will probably
implement Bezier splines in the next Version.
NEW: All settings except the user color are
saved on closing the utility, and are loaded next time you start. The settings
a written to the file "FHSPLINE.INI" in your Scripts directory.
There is a new [Reset To Defaults] button
to return to the default state.
In Version 1.4, if you press [START DRAWING]
and right-click immediately to cancel, NO SPLINE will be created. In older
versions, there was a "null" spline with a name but no segments.
Version 1.3 (2/18/99)
Start the script in MAX 2.5. In MAX 2.0, the
script will disable itself and will refuse to run.
By default, the Min.Seg.Length is set to 10.0.
It defines the min. distance between two vertices in the spline. Higher
values give lower quality - longer linear segments, fewer vertices.
Press the [START DRAWING] button.
Click in the Top or Perspective viewport to
start drawing a spline
Move the mouse - a spline trail will appear
behind the mouse, following each mouse movement.
The MAXScript Listener will report the current
drawing mode and provide help with the available commands.
Press the left or right mouse button to END
drawing. Optionally, you may press any other keyboard key not assigned
a command.
Press the [d] key to take Pen Up. This will
finish the drawing of the current spline, and will let you move the mouse
normally around without drawing. You can change settings like the Min.Seg.
Length or Extrude Amount. With the next mouse click in the viewport, a
NEW SPLINE in the SAME SHAPE will be created. The previous spline will
remain open.
Press the [p] key to take the Pen Up. This
will just pause the drawing of the current spline, and will let you change
settings in the control panel before continuing with the generation of
the SAME SPLINE from the last point drawn.
Press the [c] key to close the current spline
in the shape. With the next klick, a NEW SPLINE in the SAME SHAPE will
be started. This command is similar to [d], but it closes the previous
spline before starting another.
Press the [SPACE BAR] to close the last spline
and END drawing of the shape.
Press [m] to close the last spline drawn,
and convert the shape to a flat mesh. If there are open splines in the
shape, you will be prompted to confirm the operation. The utility uses
a Normal modfier to force mesh conversion. You can remove the modfier from
the stack to revert to EditableSpline anytime.
Press [e] to close the last spline drawn and
extrude the shape at the amount set in the Extrude Options/Extrude Amount.
No check for closed shapes will be done.
The whole drawing operation can be undone
with a single Undo button click.
By default, all shapes will be made renderable
and will receive the Spline Thickness set in the utility panel.
By default, all shapes will use the custom
color set in the utility panel. You can change the color or uncheck the
checkbox to let the spline use MAX's default wirecolor assignments.
All splines will have linear segments and
Smooth vertex settings. You can edit the resulting splines as usual.
Every shape will have a unique name with the
base prefix "FHS_Shape" followed by a number.
BUGS:
Version 1.3 fixes a problem with the spline topology.
All splines in a shape except the first used to have the first vertex doubled.
This led to some strange behaviour with the Outline command.
Known limitation: Currently, splines created in the
front and side views will not extrude correctly because the local Z axis
of each vertex is aligned to the World's Z.
Known limitation: The MAXScript Listener MUST be open
for the keyboard commands to be interpreted correctly.
Known limitation: The mouse does not report valid world
position values when over a floating window (like the Listener)


{{ define "body_classes" }}page-contact{{ end }} {{ define "main" }}
Your feedback is very important to us!!


class FileDownloader implements FileDownloaderInterface
Class FileDownloader
Methods
|
__construct(LoggerInterface $logger, Translator $translator)
|
||
| static $this |
getInstance()
|
|
|
download(string $url, string $pathToStore)
|
Details
at line 36
public
__construct(LoggerInterface $logger, Translator $translator)
at line 43
static public $this
getInstance()
at line 57
public
download(string $url, string $pathToStore)


Lunch Express
Order Meal
Meat Ball Sub - varies by size
BLT Sub - varies by size
Turkey Club - varies by size
Casear Salad - $7.99
Choose Entree
Large ($7.99)
Medium ($6.99)
Small ($5.99)
French Fries - varies by size
Bagged Chips - $1.50
Choose Side
Large ($2.99)
Medium ($1.99)
Small ($1.50)
Coke - varies by size
Pepsi - varies by size
Seven Up - varies by size
Bottled Water - $1.99
Choose Drink
Large ($1.99)
Medium ($1.50)
Small ($0.99)
Special Notes:
Go Back
Review Order


Clara Miralles de Imperial
After having worked in Product Marketing roles, I had the chance to collaborate hand in hand with the development team, what fostered my curiosity into coding. That’s why I decided to learn front-end development, to be able to create the websites myself with my new awesome skills! And I actually do love it :)
Irene Gómez de la Fuente
I have been dedicated to graphic design since 2005. I have always liked the web and development world, and a few years ago I had the opportunity to create a website with content managers, but I needed something more. I decided to join Adalab and learn everything I needed to be able to dedicate myself to be front-end developer
Miren Guerra
Coming from civil engineering, mobility and urban accessibility and now learning to be a junior developer in front-end. In love with logic games and math problems. Daring when it comes to facing new challenges because I always use a lifejacket: "ctrl + s". A secret?: folding socks relaxes me.


All of the methods return the BoxStyle object to enable the chaining of configuration options
Alternatively, you can build an associative array, using the method names as keys, and pass the array into the BoxStyle's constructor


On the File menu, click Open, and then double-click the file you want to modify.
Move the slider to where you want to insert the other sound file.
On the Edit menu, click Insert File.
Enter the name of the file you want to insert.
Notes
You can insert a sound file only into an uncompressed sound file. If you do not see the green line in Sound Recorder, the file is compressed and you cannot modify it unless you change the sound quality.
If you insert a sound into an existing sound file, the new sound replaces the original sound after the insertion point.


{% extends '../virs-base.html' %} {% block title %}{{ title }}{% endblock title%} {% block content %}
VIRS works better with pure text files (.txt).
In spite of VIRS accepting other formats, there is no parsing nor text extraction from formats such as .pdf and .docx. The text content from these files will not be correctly retrieved.


pip_services3_rpc.services package¶
Submodules¶
- pip_services3_rpc.services.CommandableHttpService module
- pip_services3_rpc.services.HeartbeatRestService module
- pip_services3_rpc.services.HttpEndpoint module
- pip_services3_rpc.services.HttpResponseSender module
- pip_services3_rpc.services.IRegisterable module
- pip_services3_rpc.services.RestQueryParams module
- pip_services3_rpc.services.RestService module
- pip_services3_rpc.services.SimpleServer module
- pip_services3_rpc.services.StatusRestService module
Module contents¶
pip_services3_rpc.services.__init__¶
Rpc module implementation
| copyright: | Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details. |
|---|---|
| license: | MIT, see LICENSE for more details. |
-
class
pip_services3_rpc.services.
CommandableHttpService
(name)¶ Bases:
pip_services3_rpc.services.RestService.RestService
Abstract service that receives remove calls via HTTP/REST protocol to operations automatically generated for commands defined in ICommandable components. Each command is exposed as POST operation that receives all parameters in body object. Commandable services require only 3 lines of code to implement a robust external HTTP-based remote interface.
### Configuration parameters ###
- base_route: base route for remote URI
- dependencies:
- endpoint: override for HTTP Endpoint dependency
- controller: override for Controller dependency
- connection(s):
- discovery_key: (optional) a key to retrieve the connection from IDiscovery
- protocol: connection protocol: http or https
- host: host name or IP address
- port: port number
- uri: resource URI or connection string with all parameters in it
### References ###
- :logger::*:1.0 (optional) ILogger components to pass log messages
- :counters::*:1.0 (optional) ICounters components to pass collected measurements
- :discovery::*:1.0 (optional) IDiscovery services to resolve connection
- :endpoint:http::1.0 (optional) HttpEndpoint reference
- Example:
- class MyCommandableHttpService(CommandableHttpService):
- def __init__(self):
- super(MyCommandableHttpService, self).__init__() self._dependencyResolver.put(“controller”, Descriptor(“mygroup”,”controller”,”*”,”*”,”1.0”))
…
service = MyCommandableHttpService() service.configure(ConfigParams.from_tuples(“connection.protocol”, “http”,
“connection.host”, “localhost”, “connection.port”, 8080))service.set_references(References.from_tuples(Descriptor(“mygroup”,”controller”,”default”,”default”,”1.0”), controller)) service.open(“123”) …
-
add_route
()¶
-
class
pip_services3_rpc.services.
RestService
¶ Bases:
pip_services3_commons.run.IOpenable.IOpenable
,pip_services3_commons.config.IConfigurable.IConfigurable
,pip_services3_commons.refer.IReferenceable.IReferenceable
,pip_services3_commons.refer.IUnreferenceable.IUnreferenceable
,pip_services3_rpc.services.IRegisterable.IRegisterable
Abstract service that receives remove calls via HTTP/REST protocol.
### Configuration parameters ###
- base_route: base route for remote URI
- dependencies:
- endpoint: override for HTTP Endpoint dependency
- controller: override for Controller dependency
- connection(s):
- discovery_key: (optional) a key to retrieve the connection from IDiscovery
- protocol: connection protocol: http or https
- host: host name or IP address
- port: port number
- uri: resource URI or connection string with all parameters in it
### References ###
- :logger::*:1.0 (optional) ILogger components to pass log messages
- :counters::*:1.0 (optional) ICounters components to pass collected measurements
- :discovery::*:1.0 (optional) IDiscovery services to resolve connection
- :endpoint:http::1.0 (optional) HttpEndpoint reference
- Example:
- class MyRestService(RestService):
_controller = None …
- def __init__(self):
- super(MyRestService, self).__init__() self._dependencyResolver.put(“controller”, Descriptor(“mygroup”,”controller”,”*”,”*”,”1.0”))
- def set_references(self, references):
- super(MyRestService, self).set_references(references) self._controller = self._dependencyResolver.get_required(“controller”)
- def register():
- …
service = MyRestService() service.configure(ConfigParams.from_tuples(“connection.protocol”, “http”,
“connection.host”, “localhost”, “connection.port”, 8080))service.set_references(References.from_tuples(Descriptor(“mygroup”,”controller”,”default”,”default”,”1.0”), controller)) service.open(“123”)
-
add_route
()¶
-
close
(correlation_id)¶ Closes component and frees used resources.
Parameters: correlation_id – (optional) transaction id to trace execution through call chain.
-
configure
(config)¶ Configures component by passing configuration parameters.
Parameters: config – configuration parameters to be set.
-
create_endpoint
()¶
-
get_correlation_id
()¶
-
get_data
()¶
-
get_filter_params
()¶
-
get_paging_params
()¶
-
get_param
(param, default=None)¶
-
is_opened
()¶ Checks if the component is opened.
Returns: true if the component has been opened and false otherwise.
-
open
(correlation_id)¶ Opens the component.
Parameters: correlation_id – (optional) transaction id to trace execution through call chain.
-
register_route
(method, route, schema, handler)¶ Registers an action in this objects REST server (service) by the given method and route.
Parameters: - method – the HTTP method of the route.
- route – the route to register in this object’s REST server (service).
- schema – the schema to use for parameter validation.
- handler – the action to perform at the given route.
-
send_created_result
(result)¶ Creates a callback function that sends newly created object as JSON. That callack function call be called directly or passed as a parameter to business logic components.
If object is not null it returns 201 status code. For null results it returns 204 status code. If error occur it sends ErrorDescription with approproate status code.
Parameters: result – a body object to result. Returns: execution result.
-
send_deleted_result
()¶ Creates a callback function that sends newly created object as JSON. That callack function call be called directly or passed as a parameter to business logic components.
If object is not null it returns 200 status code. For null results it returns 204 status code. If error occur it sends ErrorDescription with approproate status code.
Returns: execution result.
-
send_error
(error)¶ Sends error serialized as ErrorDescription object and appropriate HTTP status code. If status code is not defined, it uses 500 status code.
Parameters: error – an error object to be sent.
-
send_result
(result)¶ Creates a callback function that sends result as JSON object. That callack function call be called directly or passed as a parameter to business logic components.
If object is not null it returns 200 status code. For null results it returns 204 status code. If error occur it sends ErrorDescription with approproate status code.
Parameters: result – a body object to result. Returns: execution result.
-
set_references
(references)¶ Sets references to dependent components.
Parameters: references – references to locate the component dependencies.
-
unset_references
()¶ Unsets (clears) previously set references to dependent components.
-
class
pip_services3_rpc.services.
RestQueryParams
(correlation_id=None, filter=None, paging=None)¶ Bases:
dict
-
add_correlation_id
(correlation_id=None)¶
-
add_filter_params
(filter)¶
-
add_paging_params
(paging)¶
-
-
class
pip_services3_rpc.services.
SimpleServer
(host='<IP_ADDRESS>', port=8080, **options)¶ Bases:
bottle.WSGIRefServer
-
run
(app)¶
-
shutdown
()¶
-
-
class
pip_services3_rpc.services.
StatusRestService
¶ Bases:
pip_services3_rpc.services.RestService.RestService
Service that returns microservice status information via HTTP/REST protocol. The service responds on /status route (can be changed) with a JSON object:
- {
- “id”: unique container id (usually hostname)
- “name”: container name (from ContextInfo)
- “description”: container description (from ContextInfo)
- “start_time”: time when container was started
- “current_time”: current time in UTC
- “uptime”: duration since container start time in milliseconds
- “properties”: additional container properties (from ContextInfo)
- “components”: descriptors of components registered in the container
}
### Configuration parameters ###
- base_route: base route for remote URI
- dependencies:
- endpoint: override for HTTP Endpoint dependency
- controller: override for Controller dependency
- connection(s):
- discovery_key: (optional) a key to retrieve the connection from IDiscovery
- protocol: connection protocol: http or https
- host: host name or IP address
- port: port number
- uri: resource URI or connection string with all parameters in it
### References ###
- :logger::*:1.0 (optional) ILogger components to pass log messages
- :counters::*:1.0 (optional) ICounters components to pass collected measurements
- :discovery::*:1.0 (optional) IDiscovery services to resolve connection
- :endpoint:http::1.0 (optional) HttpEndpoint reference
- Example:
service = StatusService() service.configure(ConfigParams.from_tuples(“connection.protocol”, “http”,
“connection.host”, “localhost”, “connection.port”, 8080))service.open(“123”) …
-
configure
(config)¶ Configures component by passing configuration parameters.
Parameters: config – configuration parameters to be set.
-
register
()¶ Registers all service routes in HTTP endpoint.
-
set_references
(references)¶ Sets references to dependent components.
Parameters: references – references to locate the component dependencies.
-
status
()¶
-
class
pip_services3_rpc.services.
IRegisterable
¶ Bases:
object
Interface to perform on-demand registrations.
-
register
()¶ Perform required registration steps.
-
-
class
pip_services3_rpc.services.
HttpResponseSender
¶ Bases:
object
Helper class that handles HTTP-based responses.
-
static
send_created_result
(result, to_json)¶
-
static
send_deleted_result
()¶
-
static
send_error
(error)¶ Sends error serialized as ErrorDescription object and appropriate HTTP status code. If status code is not defined, it uses 500 status code.
Parameters: error – an error object to be sent. Returns: HTTP response status
-
static
send_result
(result, to_json)¶
-
static
-
class
pip_services3_rpc.services.
HttpEndpoint
¶ Bases:
pip_services3_commons.run.IOpenable.IOpenable
,pip_services3_commons.config.IConfigurable.IConfigurable
,pip_services3_commons.refer.IReferenceable.IReferenceable
Used for creating HTTP endpoints. An endpoint is a URL, at which a given service can be accessed by a client.
### Configuration parameters ###
Parameters to pass to the [[configure]] method for component configuration:
- connection(s) - the connection resolver’s connections;
- “connection.discovery_key” - the key to use for connection resolving in a discovery service;
- “connection.protocol” - the connection’s protocol;
- “connection.host” - the target host;
- “connection.port” - the target port;
- “connection.uri” - the target URI.
### References ###
A logger, counters, and a connection resolver can be referenced by passing the following references to the object’s [[setReferences]] method:
- :logger::*:1.0 (optional) ILogger components to pass log messages
- :counters::*:1.0 (optional) ICounters components to pass collected measurements
- :discovery::*:1.0 (optional) IDiscovery services to resolve connection
- Example:
- def my_method(_config, _references):
endpoint = HttpEndpoint() if (_config)
endpoint.configure(_config)- if (_references)
- endpoint.setReferences(_references)
…
endpoint.open(correlationId) …
-
close
(correlation_id)¶ Closes this endpoint and the REST server (service) that was opened earlier.
Parameters: correlation_id – (optional) transaction id to trace execution through call chain.
-
configure
(config)¶ Configures this HttpEndpoint using the given configuration parameters.
- connection(s) - the connection resolver’s connections;
- “connection.discovery_key” - the key to use for connection resolving in a discovery service;
- “connection.protocol” - the connection’s protocol;
- “connection.host” - the target host;
- “connection.port” - the target port;
- “connection.uri” - the target URI.
Parameters: config – configuration parameters, containing a “connection(s)” section.
-
get_data
()¶
-
is_opened
()¶ Checks if the component is opened.
Returns: whether or not this endpoint is open with an actively listening REST server.
-
open
(correlation_id)¶ Opens a connection using the parameters resolved by the referenced connection resolver and creates a REST server (service) using the set options and parameters.
Parameters: correlation_id – (optional) transaction id to trace execution through call chain.
-
perform_registrations
()¶
-
register
(registration)¶ Registers a registerable object for dynamic endpoint discovery.
Parameters: registration – the registration to add.
-
register_route
(method, route, schema, handler)¶ Registers an action in this objects REST server (service) by the given method and route.
Parameters: - method – the HTTP method of the route.
- route – the route to register in this object’s REST server (service).
- schema – the schema to use for parameter validation.
- handler – the action to perform at the given route.
-
set_references
(references)¶ Sets references to this endpoint’s logger, counters, and connection resolver.
- :logger::*:1.0 (optional) ILogger components to pass log messages
- :counters::*:1.0 (optional) ICounters components to pass collected measurements
- :discovery::*:1.0 (optional) IDiscovery services to resolve connection
Parameters: references – an IReferences object, containing references to a logger, counters, and a connection resolver.
-
unregister
(registration)¶ Unregisters a registerable object, so that it is no longer used in dynamic endpoint discovery.
Parameters: registration – the registration to remove.


RE8015
1.
block TABLE
block TABLE
2.
block TR
block TR
3.
block TD
4.
cell11
cell12
cell21
cell22
The followings don't have problems
A1.
cell
cell
A2.
block TR


Both Javascript and CSS are interpreted in source order, which means that often you will need the files within a bundle to follow a certain sequence. For instance, if your project uses both Prototype.js and Script.aculo.us you will probably need them to be bundled together, but you need to make sure that Prototype is always loaded first since Script.aculo.us depends on it in order to work. If the generated bundle had Script.aculo.us first, there would be an inmediate Javascript error in any page that loaded it.
For example, say you have this directory structure containing both Prototype and Srcipt.aculo.us. You need to load prototype.js first, and then everything else:
To solve this problem there are three simple ways to force ordering of resources within a bundle:
Jawr will add files to bundles in the same order you specify in the mappings attribute:
jawr.js.bundle.foo.id=/bundles/lib.js # Add all files in needed ordering. jawr.js.bundle.foo.mappings=/js/lib/Protoype.js, /js/lib/scriptaculous.js, ...
The obvious drawback here is that ordering many files will mean a verbose configuration, so this option is recommended only for very simple cases.
When doing recursive mapping, Jawr will always include resources first, then subdirectories. That means that you can effectively force ordering by putting the files which should appear last in a subdirectory. For instance, in the previous example, you could move all the Script.aculo.us files to a subdir, like this:
Your mapping could then change to this:
jawr.js.bundle.foo.id=/bundles/lib.js jawr.js.bundle.foo.mappings=/js/lib/**
Since we have Prototype.js directly under /js/lib and everything else in a subfolder, with this mapping we can be sure that our bundle will contain the Prototype library first, and then the rest of our files.
Note :
If you use a mapping like "/js/lib/" or "/js/lib/**", by default Jawr will sort the resources in the directory by alphabetical order.\
Sorting files are simple descriptors that you place at any directory where you need to specify ordering. Following the previous examples, if we still had Prototype and Script.aculo.us at the same directory and we wanted to force ordering, we could create a file named .sorting at the /js/lib/ directory. The directory structure would look like this:
The contents of the sorting file would be as follows:
prototype.js
As you can see, only the files that need to go first are added. If our mapping was /js/lib/**, we would get prototype.js first, then every other resource in the directory in no particular order. If there were any subdirectory, its contents would be added afterwards.
Sorting files can also affect subdirs, so you can do things like add a resource, then everything in a subdir, then another resource, like this:
Prototype.js someSubdir/ effects.js
If our mapping was /js/lib/**, the resulting bundle would contain:


DBEnv¶
Read Oracle documentation for better understanding.
DBEnv Methods¶
-
DBEnv
(flags=0) Constructor. More info...
-
set_rpc_server
(host, cl_timeout=0, sv_timeout=0)¶ Establishes a connection for this dbenv to a RPC server. This function is not available if linked to Berkeley DB 4.8 or up. More info...
-
close
(flags=0)¶ Close the database environment, freeing resources. More info...
-
open
(homedir, flags=0, mode=0660)¶ Prepare the database environment for use. More info...
-
log_cursor
()¶ Returns a created log cursor. More info...
-
memp_stat
(flags=0)¶ Returns the memory pool (that is, the buffer cache) subsystem statistics.
The returning value is a tuple. The first element is a dictionary with the general stats. The second element is another dictionary, keyed by filename, and the values are the stats for each file.
The first dictionary contains these data:
gbytes Gigabytes of cache (total cache size is st_gbytes + st_bytes). bytes Bytes of cache (total cache size is st_gbytes + st_bytes). ncache Number of caches. max_ncache Maximum number of caches, as configured with the DB_ENV->set_cache_max() method. regsize Individual cache size, in bytes. mmapsize Maximum memory-mapped file size. maxopenfd Maximum open file descriptors. maxwrite Maximum sequential buffer writes. maxwrite_sleep Microseconds to pause after writing maximum sequential buffers. map Requested pages mapped into the process’ address space (there is no available information about whether or not this request caused disk I/O, although examining the application page fault rate may be helpful). cache_hit Requested pages found in the cache. cache_miss Requested pages not found in the cache. page_create Pages created in the cache. page_in Pages read into the cache. page_out Pages written from the cache to the backing file. ro_evict Clean pages forced from the cache. rw_evict Dirty pages forced from the cache. page_trickle Dirty pages written using the DB_ENV->memp_trickle() method. pages Pages in the cache. page_clean Clean pages currently in the cache. page_dirty Dirty pages currently in the cache. hash_buckets Number of hash buckets in buffer hash table. hash_searches Total number of buffer hash table lookups. hash_longest Longest chain ever encountered in buffer hash table lookups. hash_examined Total number of hash elements traversed during hash table lookups. hash_nowait Number of times that a thread of control was able to obtain a hash bucket lock without waiting. hash_wait Number of times that a thread of control was forced to wait before obtaining a hash bucket lock. hash_max_nowait The number of times a thread of control was able to obtain the hash bucket lock without waiting on the bucket which had the maximum number of times that a thread of control needed to wait. hash_max_wait Maximum number of times any hash bucket lock was waited for by a thread of control. region_wait Number of times that a thread of control was forced to wait before obtaining a cache region mutex. region_nowait Number of times that a thread of control was able to obtain a cache region mutex without waiting. mvcc_frozen Number of buffers frozen. mvcc_thawed Number of buffers thawed. mvcc_freed Number of frozen buffers freed. alloc Number of page allocations. alloc_buckets Number of hash buckets checked during allocation. alloc_max_buckets Maximum number of hash buckets checked during an allocation. alloc_pages Number of pages checked during allocation. alloc_max_pages Maximum number of pages checked during an allocation. io_wait Number of operations blocked waiting for I/O to complete. sync_interrupted Number of mpool sync operations interrupted. The second dictionary contains these data:
pagesize Page size in bytes. cache_hit Requested pages found in the cache. cache_miss Requested pages not found in the cache. map Requested pages mapped into the process’ address space. page_create Pages created in the cache. page_in Pages read into the cache. page_out Pages written from the cache to the backing file.
-
memp_stat_print
(flags=0)¶ Displays cache subsystem statistical information. More info...
-
memp_sync
(lsn=None)¶ Flushes modified pages in the cache to their backing files. If provided, lsn is a tuple: (file, offset). More info...
-
memp_trickle
(percent)¶ Ensures that a specified percent of the pages in the cache are clean, by writing dirty pages to their backing files. More info...
-
remove
(homedir, flags=0)¶ Remove a database environment. More info...
-
dbremove
(file, database=None, txn=None, flags=0)¶ Removes the database specified by the file and database parameters. If no database is specified, the underlying file represented by file is removed, incidentally removing all of the databases it contained. More info...
-
dbrename
(file, database=None, newname, txn=None, flags=0)¶ Renames the database specified by the file and database parameters to newname. If no database is specified, the underlying file represented by file is renamed, incidentally renaming all of the databases it contained. More info...
-
fileid_reset
(file, flags=0)¶ All databases contain an ID string used to identify the database in the database environment cache. If a physical database file is copied, and used in the same environment as another file with the same ID strings, corruption can occur. The DB_ENV->fileid_reset method creates new ID strings for all of the databases in the physical file. More info...
-
get_thread_count
()¶ Returns the thread count as set by the DB_ENV->set_thread_count() method. More info...
-
set_thread_count
(count)¶ Declare an approximate number of threads in the database environment. The DB_ENV->set_thread_count() method must be called prior to opening the database environment if the DB_ENV->failchk() method will be used. The DB_ENV->set_thread_count() method does not set the maximum number of threads but is used to determine memory sizing and the thread control block reclamation policy. More info...
-
set_encrypt
(passwd, flags=0)¶ Set the password used by the Berkeley DB library to perform encryption and decryption. More info...
-
get_encrypt_flags
()¶ Returns the encryption flags. More info...
-
get_intermediate_dir_mode
()¶ Returns the intermediate directory permissions.
Intermediate directories are directories needed for recovery. Normally, Berkeley DB does not create these directories and will do so only if the DB_ENV->set_intermediate_dir_mode() method is called.
-
set_intermediate_dir_mode
(mode)¶ By default, Berkeley DB does not create intermediate directories needed for recovery, that is, if the file /a/b/c/mydatabase is being recovered, and the directory path b/c does not exist, recovery will fail. This default behavior is because Berkeley DB does not know what permissions are appropriate for intermediate directory creation, and creating the directory might result in a security problem.
The DB_ENV->set_intermediate_dir_mode() method causes Berkeley DB to create any intermediate directories needed during recovery, using the specified permissions.
-
get_timeout
(flags)¶ Returns a timeout value, in microseconds. More info...
-
set_timeout
(timeout, flags)¶ Sets timeout values for locks or transactions in the database environment. More info...
-
get_mp_max_openfd
()¶ Returns the maximum number of file descriptors the library will open concurrently when flushing dirty pages from the cache. More info...
-
set_mp_max_openfd
(max_open_fd)¶ Limits the number of file descriptors the library will open concurrently when flushing dirty pages from the cache. More info...
-
get_mp_max_write
()¶ Returns a tuple with the current maximum number of sequential write operations and microseconds to pause that the library can schedule when flushing dirty pages from the cache. More info...
-
set_mp_max_write
(maxwrite, maxwrite_sleep)¶ Limits the number of sequential write operations scheduled by the library when flushing dirty pages from the cache. More info...
-
set_shm_key
(key)¶ Specify a base segment ID for Berkeley DB environment shared memory regions created in system memory on VxWorks or systems supporting X/Open-style shared memory interfaces; for example, UNIX systems supporting shmget(2) and related System V IPC interfaces. More info...
-
get_shm_key
()¶ Returns the base segment ID. More info...
-
set_cache_max
(gbytes, bytes)¶ Sets the maximum cache size, in bytes. The specified size is rounded to the nearest multiple of the cache region size, which is the initial cache size divided by the number of regions specified to the DB_ENV->set_cachesize() method. If no value is specified, it defaults to the initial cache size. More info...
-
get_cache_max
()¶ Returns the maximum size of the cache as set using the DB_ENV->set_cache_max() method. More info...
-
set_cachesize
(gbytes, bytes, ncache=0)¶ Set the size of the shared memory buffer pool. More info...
-
get_cachesize
()¶ Returns a tuple with the current size and composition of the cache. More info...
-
set_data_dir
(dir)¶ Set the environment data directory. You can call this function multiple times, adding new directories. More info...
-
get_data_dirs
()¶ Return a tuple with the directories. More info...
-
get_flags
()¶ Returns the configuration flags set for a DB_ENV handle. More info...
-
set_flags
(flags, onoff)¶ Set additional flags for the DBEnv. The onoff parameter specifes if the flag is set or cleared. More info...
-
set_tmp_dir
(dir)¶ Set the directory to be used for temporary files. More info...
-
get_tmp_dir
()¶ Returns the database environment temporary file directory. More info...
-
set_get_returns_none
(flag)¶ By default when DB.get or DBCursor.get, get_both, first, last, next or prev encounter a DB_NOTFOUND error they return None instead of raising DBNotFoundError. This behaviour emulates Python dictionaries and is convenient for looping.
You can use this method to toggle that behaviour for all of the aformentioned methods or extend it to also apply to the DBCursor.set, set_both, set_range, and set_recno methods. Supported values of flag:
- 0 all DB and DBCursor get and set methods will raise a DBNotFoundError rather than returning None.
- 1 Default in module version <4.2.4 The DB.get and DBCursor.get, get_both, first, last, next and prev methods return None.
- 2 Default in module version >=4.2.4 Extends the behaviour of 1 to the DBCursor set, set_both, set_range and set_recno methods.
The default of returning None makes it easy to do things like this without having to catch DBNotFoundError (KeyError):
data = mydb.get(key) if data: doSomething(data)
or this:
rec = cursor.first() while rec: print rec rec = cursor.next()
Making the cursor set methods return None is useful in order to do this:
rec = mydb.set() while rec: key, val = rec doSomething(key, val) rec = mydb.next()
The downside to this it that it is inconsistent with the rest of the package and noticeably diverges from the Oracle Berkeley DB API. If you prefer to have the get and set methods raise an exception when a key is not found, use this method to tell them to do so.
Calling this method on a DBEnv object will set the default for all DB’s later created within that environment. Calling it on a DB object sets the behaviour for that DB only.
The previous setting is returned.
-
set_private
(object)¶ Link an object to the DBEnv object. This allows to pass around an arbitrary object. For instance, for callback context.
-
get_private
()¶ Give the object linked to the DBEnv.
-
get_open_flags
()¶ Returns the current open method flags. That is, this method returns the flags that were specified when DB_ENV->open() was called. More info...
-
get_lg_filemode
()¶ Returns the log file mode. More info...
-
set_lg_filemode
(filemode)¶ Set the absolute file mode for created log files. More info...
-
get_lg_bsize
()¶ Returns the size of the log buffer, in bytes. More info...
-
set_lg_bsize
(size)¶ Set the size of the in-memory log buffer, in bytes. More info...
-
get_lg_dir
()¶ Returns the log directory, which is the location for logging files. More info...
-
set_lg_dir
(dir)¶ The path of a directory to be used as the location of logging files. Log files created by the Log Manager subsystem will be created in this directory. More info...
-
set_lg_max
(size)¶ Set the maximum size of a single file in the log, in bytes. More info...
-
get_lg_max
(size)¶ Returns the maximum log file size. More info...
-
get_lg_regionmax
()¶ Returns the size of the underlying logging subsystem region. More info...
-
set_lg_regionmax
(size)¶ Set the maximum size of a single region in the log, in bytes. More info...
-
get_lk_partitions
()¶ Returns the number of lock table partitions used in the Berkeley DB environment. More info...
-
set_lk_partitions
(partitions)¶ Set the number of lock table partitions in the Berkeley DB environment. More info...
-
get_lk_detect
()¶ Returns the deadlock detector configuration. More info...
-
set_lk_detect
(mode)¶ Set the automatic deadlock detection mode. More info...
-
set_lk_max
(max)¶ Set the maximum number of locks. (This method is deprecated.) More info...
-
get_lk_max_locks
()¶ Returns the maximum number of potential locks. More info...
-
set_lk_max_locks
(max)¶ Set the maximum number of locks supported by the Berkeley DB lock subsystem. More info...
-
get_lk_max_lockers
()¶ Returns the maximum number of potential lockers. More info...
-
set_lk_max_lockers
(max)¶ Set the maximum number of simultaneous locking entities supported by the Berkeley DB lock subsystem. More info...
-
get_lk_max_objects
()¶ Returns the maximum number of locked objects. More info...
-
set_lk_max_objects
(max)¶ Set the maximum number of simultaneously locked objects supported by the Berkeley DB lock subsystem. More info...
-
get_mp_mmapsize
()¶ Returns the the maximum file size, in bytes, for a file to be mapped into the process address space. More info...
-
set_mp_mmapsize
(size)¶ Files that are opened read-only in the memory pool (and that satisfy a few other criteria) are, by default, mapped into the process address space instead of being copied into the local cache. This can result in better-than-usual performance, as available virtual memory is normally much larger than the local cache, and page faults are faster than page copying on many systems. However, in the presence of limited virtual memory it can cause resource starvation, and in the presence of large databases, it can result in immense process sizes.
This method sets the maximum file size, in bytes, for a file to be mapped into the process address space. If no value is specified, it defaults to 10MB. More info...
-
stat_print
(flags=0)¶ Displays the default subsystem statistical information. More info...
-
log_file
(lsn)¶ Maps lsn to filenames, returning the name of the file containing the named record. More info...
-
log_printf
(string, txn=None)¶ Appends an informational message to the Berkeley DB database environment log files. More info...
-
log_archive
(flags=0)¶ Returns a list of log or database file names. By default, log_archive returns the names of all of the log files that are no longer in use (e.g., no longer involved in active transactions), and that may safely be archived for catastrophic recovery and then removed from the system. More info...
-
log_flush
()¶ Force log records to disk. Useful if the environment, database or transactions are used as ACI, instead of ACID. For example, if the environment is opened as DB_TXN_NOSYNC. More info...
-
log_get_config
(which)¶ Returns whether the specified which parameter is currently set or not. You can manage this value using the DB_ENV->log_set_config() method. More info...
-
log_set_config
(flags, onoff)¶ Configures the Berkeley DB logging subsystem. More info...
-
lock_detect
(atype, flags=0)¶ Run one iteration of the deadlock detector, returns the number of transactions aborted. More info...
-
lock_get
(locker, obj, lock_mode, flags=0)¶ Acquires a lock and returns a handle to it as a DBLock object. The locker parameter is an integer representing the entity doing the locking, and obj is an object representing the item to be locked. More info...
-
lock_id
()¶ Acquires a locker id, guaranteed to be unique across all threads and processes that have the DBEnv open. More info...
-
lock_id_free
(id)¶ Frees a locker ID allocated by the “dbenv.lock_id()” method. More info...
-
lock_put
(lock)¶ Release the lock. More info...
-
lock_stat
(flags=0)¶ Returns a dictionary of locking subsystem statistics with the following keys:
id Last allocated lock ID. cur_maxid The current maximum unused locker ID. nmodes Number of lock modes. maxlocks Maximum number of locks possible. maxlockers Maximum number of lockers possible. maxobjects Maximum number of objects possible. nlocks Number of current locks. maxnlocks Maximum number of locks at once. nlockers Number of current lockers. nobjects Number of current lock objects. maxnobjects Maximum number of lock objects at once. maxnlockers Maximum number of lockers at once. nrequests Total number of locks requested. nreleases Total number of locks released. nupgrade Total number of locks upgraded. ndowngrade Total number of locks downgraded. lock_wait The number of lock requests not immediately available due to conflicts, for which the thread of control waited. lock_nowait The number of lock requests not immediately available due to conflicts, for which the thread of control did not wait. ndeadlocks Number of deadlocks. locktimeout Lock timeout value. nlocktimeouts The number of lock requests that have timed out. txntimeout Transaction timeout value. ntxntimeouts The number of transactions that have timed out. This value is also a component of ndeadlocks, the total number of deadlocks detected. objs_wait The number of requests to allocate or deallocate an object for which the thread of control waited. objs_nowait The number of requests to allocate or deallocate an object for which the thread of control did not wait. lockers_wait The number of requests to allocate or deallocate a locker for which the thread of control waited. lockers_nowait The number of requests to allocate or deallocate a locker for which the thread of control did not wait. locks_wait The number of requests to allocate or deallocate a lock structure for which the thread of control waited. locks_nowait The number of requests to allocate or deallocate a lock structure for which the thread of control did not wait. hash_len Maximum length of a lock hash bucket. regsize Size of the region. region_wait Number of times a thread of control was forced to wait before obtaining the region lock. region_nowait Number of times a thread of control was able to obtain the region lock without waiting.
-
lock_stat_print
(flags=0)¶ Displays the locking subsystem statistical information. More info...
-
get_tx_max
()¶ Returns the number of active transactions. More info...
-
set_tx_max
(max)¶ Set the maximum number of active transactions. More info...
-
get_tx_timestamp
()¶ Returns the recovery timestamp. More info...
-
set_tx_timestamp
(timestamp)¶ Recover to the time specified by timestamp rather than to the most current possible date. More info...
-
txn_begin
(parent=None, flags=0)¶ Creates and begins a new transaction. A DBTxn object is returned. More info...
-
txn_checkpoint
(kbyte=0, min=0, flag=0)¶ Flushes the underlying memory pool, writes a checkpoint record to the log and then flushes the log. More info...
-
txn_stat
(flags=0)¶ Return a dictionary of transaction statistics with the following keys:
last_ckp The LSN of the last checkpoint. time_ckp Time the last completed checkpoint finished (as the number of seconds since the Epoch, returned by the IEEE/ANSI Std 1003.1 POSIX time interface). last_txnid Last transaction ID allocated. maxtxns Max number of active transactions possible. nactive Number of transactions currently active. maxnactive Max number of active transactions at once. nsnapshot The number of transactions on the snapshot list. These are transactions which modified a database opened with DB_MULTIVERSION, and which have committed or aborted, but the copies of pages they created are still in the cache. maxnsnapshot The maximum number of transactions on the snapshot list at any one time. nbegins Number of transactions that have begun. naborts Number of transactions that have aborted. ncommits Number of transactions that have committed. nrestores Number of transactions that have been restored. regsize Size of the region. region_wait Number of times that a thread of control was forced to wait before obtaining the region lock. region_nowait Number of times that a thread of control was able to obtain the region lock without waiting.
-
txn_stat_print
(flags=0)¶ Displays the transaction subsystem statistical information. More info...
-
lsn_reset
(file=None, flags=0)¶ This method allows database files to be moved from one transactional database environment to another. More info...
-
log_stat
(flags=0)¶ Returns a dictionary of logging subsystem statistics with the following keys:
magic The magic number that identifies a file as a log file. version The version of the log file type. mode The mode of any created log files. lg_bsize The in-memory log record cache size. lg_size The log file size. record The number of records written to this log. w_mbytes The number of megabytes written to this log. w_bytes The number of bytes over and above w_mbytes written to this log. wc_mbytes The number of megabytes written to this log since the last checkpoint. wc_bytes The number of bytes over and above wc_mbytes written to this log since the last checkpoint. wcount The number of times the log has been written to disk. wcount_fill The number of times the log has been written to disk because the in-memory log record cache filled up. rcount The number of times the log has been read from disk. scount The number of times the log has been flushed to disk. cur_file The current log file number. cur_offset The byte offset in the current log file. disk_file The log file number of the last record known to be on disk. disk_offset The byte offset of the last record known to be on disk. maxcommitperflush The maximum number of commits contained in a single log flush. mincommitperflush The minimum number of commits contained in a single log flush that contained a commit. regsize The size of the log region, in bytes. region_wait The number of times that a thread of control was forced to wait before obtaining the log region mutex. region_nowait The number of times that a thread of control was able to obtain the log region mutex without waiting.
-
log_stat_print
(flags=0)¶ Displays the logging subsystem statistical information. More info...
-
txn_recover
()¶ Returns a list of tuples (GID, TXN) of transactions prepared but still unresolved. This is used while doing environment recovery in an application using distributed transactions.
This method must be called only from a single thread at a time. It should be called after DBEnv recovery. More info...
-
set_verbose
(which, onoff)¶ Turns specific additional informational and debugging messages in the Berkeley DB message output on and off. To see the additional messages, verbose messages must also be configured for the application. More info...
-
get_verbose
(which)¶ Returns whether the specified which parameter is currently set or not. More info...
-
set_event_notify
(eventFunc)¶ Configures a callback function which is called to notify the process of specific Berkeley DB events. More info...
-
mutex_stat
(flags=0)¶ Returns a dictionary of mutex subsystem statistics with the following keys:
mutex_align The mutex alignment, in bytes. mutex_tas_spins The number of times test-and-set mutexes will spin without blocking. mutex_cnt The total number of mutexes configured. mutex_free The number of mutexes currently available. mutex_inuse The number of mutexes currently in use. mutex_inuse_max The maximum number of mutexes ever in use. regsize The size of the mutex region, in bytes. region_wait The number of times that a thread of control was forced to wait before obtaining the mutex region mutex. region_nowait The number of times that a thread of control was able to obtain the mutex region mutex without waiting.
-
mutex_stat_print
(flags=0)¶ Displays the mutex subsystem statistical information. More info...
-
mutex_set_max
(value)¶ Configure the total number of mutexes to allocate. More info...
-
mutex_get_max
()¶ Returns the total number of mutexes allocated. More info...
-
mutex_set_increment
(value)¶ Configure the number of additional mutexes to allocate. More info...
-
mutex_get_increment
()¶ Returns the number of additional mutexes to allocate. More info...
-
mutex_set_align
(align)¶ Set the mutex alignment, in bytes. More info...
-
mutex_get_align
()¶ Returns the mutex alignment, in bytes. More info...
-
mutex_set_tas_spins
(tas_spins)¶ Specify that test-and-set mutexes should spin tas_spins times without blocking. Check the default values in the Oracle webpage. More info...
-
mutex_get_tas_spins
()¶ Returns the test-and-set spin count. More info...
DBEnv Replication Manager Methods¶
This module automates many of the tasks needed to provide replication abilities in a Berkeley DB system. The module is fairly limited, but enough in many cases. Users more demanding must use the full Base Replication API.
This module requires pthread support (in Unix), so you must compile Berkeley DB with it if you want to be able to use the Replication Manager.
-
repmgr_start
(nthreads, flags)¶ Starts the replication manager. More info...
-
repmgr_site
(host, port)¶ Returns a DB_SITE handle that defines a site’s host/port network address. You use the DB_SITE handle to configure and manage replication sites. More info...
-
repmgr_site_by_eid
(eid)¶ Returns a DB_SITE handle based on the site’s Environment ID value. You use the DB_SITE handle to configure and manage replication sites. More info...
-
repmgr_set_ack_policy
(ack_policy)¶ Specifies how master and client sites will handle acknowledgment of replication messages which are necessary for “permanent” records. More info...
-
repmgr_get_ack_policy
()¶ Returns the replication manager’s client acknowledgment policy. More info...
-
repmgr_site_list
()¶ Returns a dictionary with the status of the sites currently known by the replication manager.
The keys are the Environment ID assigned by the replication manager. This is the same value that is passed to the application’s event notification function for the DB_EVENT_REP_NEWMASTER event.
The values are tuples containing the hostname, the TCP/IP port number and the link status.
-
repmgr_stat
(flags=0)¶ Returns a dictionary with the replication manager statistics. Keys are:
perm_failed The number of times a message critical for maintaining database integrity (for example, a transaction commit), originating at this site, did not receive sufficient acknowledgement from clients, according to the configured acknowledgement policy and acknowledgement timeout. msgs_queued The number of outgoing messages which could not be transmitted immediately, due to a full network buffer, and had to be queued for later delivery. msgs_dropped The number of outgoing messages that were completely dropped, because the outgoing message queue was full. (Berkeley DB replication is tolerant of dropped messages, and will automatically request retransmission of any missing messages as needed.) connection_drop The number of times an existing TCP/IP connection failed. connect_fail The number of times an attempt to open a new TCP/IP connection failed.
-
repmgr_stat_print
(flags=0)¶ Displays the replication manager statistical information. More info...
DBEnv Replication Methods¶
This section provides the raw methods for replication. If possible, it is recommended to use the Replication Manager.
-
rep_elect
(nsites, nvotes)¶ Holds an election for the master of a replication group.  More info...
-
rep_process_messsage
(control, rec, envid)¶ Processes an incoming replication message sent by a member of the replication group to the local database environment.
Returns a two element tuple.
-
rep_start
(flags, cdata=None)¶ Configures the database environment as a client or master in a group of replicated database environments.
The DB_ENV->rep_start method is not called by most replication applications. It should only be called by applications implementing their own network transport layer, explicitly holding replication group elections and handling replication messages outside of the replication manager framework.
-
rep_sync
()¶ Forces master synchronization to begin for this client. This method is the other half of setting the DB_REP_CONF_DELAYCLIENT flag via the DB_ENV->rep_set_config method. More info...
-
rep_set_config
(which, onoff)¶ Configures the Berkeley DB replication subsystem. More info...
-
rep_get_config
(which)¶ Returns whether the specified which parameter is currently set or not. More info...
-
rep_set_limit
(bytes)¶ Sets a byte-count limit on the amount of data that will be transmitted from a site in response to a single message processed by the DB_ENV->rep_process_message method. The limit is not a hard limit, and the record that exceeds the limit is the last record to be sent. More info...
-
rep_get_limit
()¶ Gets a byte-count limit on the amount of data that will be transmitted from a site in response to a single message processed by the DB_ENV->rep_process_message method. The limit is not a hard limit, and the record that exceeds the limit is the last record to be sent. More info...
-
rep_set_request
(minimum, maximum)¶ Sets a threshold for the minimum and maximum time that a client waits before requesting retransmission of a missing message. Specifically, if the client detects a gap in the sequence of incoming log records or database pages, Berkeley DB will wait for at least min microseconds before requesting retransmission of the missing record. Berkeley DB will double that amount before requesting the same missing record again, and so on, up to a maximum threshold of max microseconds. More info...
-
rep_get_request
()¶ Returns a tuple with the minimum and maximum number of microseconds a client waits before requesting retransmission. More info...
-
rep_set_nsites
(nsites)¶ Specifies the total number of sites in a replication group. More info...
-
rep_get_nsites
()¶ Returns the total number of sites in the replication group. More info...
-
rep_set_priority
(priority)¶ Specifies the database environment’s priority in replication group elections. The priority must be a positive integer, or 0 if this environment cannot be a replication group master. More info...
-
rep_get_priority
()¶ Returns the database environment priority. More info...
-
rep_set_timeout
(which, timeout)¶ Specifies a variety of replication timeout values. More info...
-
rep_get_timeout
(which)¶ Returns the timeout value for the specified which parameter. More info...
-
rep_set_clockskew
(fast, slow)¶ Sets the clock skew ratio among replication group members based on the fastest and slowest measurements among the group for use with master leases. More info...
-
rep_get_clockskew
()¶ Returns a tuple with the current clock skew values. More info...
-
rep_stat
(flags=0)¶ Returns a dictionary with the replication subsystem statistics. Keys are:
st_bulk_fills The number of times the bulk buffer filled up, forcing the buffer content to be sent. bulk_overflows The number of times a record was bigger than the entire bulk buffer, and therefore had to be sent as a singleton. bulk_records The number of records added to a bulk buffer. bulk_transfers The number of bulk buffers transferred (via a call to the application’s send function). client_rerequests The number of times this client site received a “re-request” message, indicating that a request it previously sent to another client could not be serviced by that client. (Compare to client_svc_miss.) client_svc_miss The number of “request” type messages received by this client that could not be processed, forcing the originating requester to try sending the request to the master (or another client). client_svc_req The number of “request” type messages received by this client. (“Request” messages are usually sent from a client to the master, but a message marked with the DB_REP_ANYWHERE flag in the invocation of the application’s send function may be sent to another client instead.) dupmasters The number of duplicate master conditions originally detected at this site. egen The current election generation number. election_cur_winner The election winner. election_gen The election generation number. election_lsn The maximum LSN of election winner. election_nsites The number sites responding to this site during the last election. election_nvotes The number of votes required in the last election. election_priority The election priority. election_sec The number of seconds the last election took (the total election time is election_sec plus election_usec). election_status The current election phase (0 if no election is in progress). election_tiebreaker The election tiebreaker value. election_usec The number of microseconds the last election took (the total election time is election_sec plus election_usec). election_votes The number of votes received in the last election. elections The number of elections held. elections_won The number of elections won. env_id The current environment ID. env_priority The current environment priority. gen The current generation number. log_duplicated The number of duplicate log records received. log_queued The number of log records currently queued. log_queued_max The maximum number of log records ever queued at once. log_queued_total The total number of log records queued. log_records The number of log records received and appended to the log. log_requested The number of times log records were missed and requested. master The current master environment ID. master_changes The number of times the master has changed. max_lease_sec The number of seconds of the longest lease (the total lease time is max_lease_sec plus max_lease_usec). max_lease_usec The number of microseconds of the longest lease (the total lease time is max_lease_sec plus max_lease_usec). max_perm_lsn The LSN of the maximum permanent log record, or 0 if there are no permanent log records. msgs_badgen The number of messages received with a bad generation number. msgs_processed The number of messages received and processed. msgs_recover The number of messages ignored due to pending recovery. msgs_send_failures The number of failed message sends. msgs_sent The number of messages sent. newsites The number of new site messages received. next_lsn In replication environments configured as masters, the next LSN expected. In replication environments configured as clients, the next LSN to be used. next_pg The next page number we expect to receive. nsites The number of sites used in the last election. nthrottles Transmission limited. This indicates the number of times that data transmission was stopped to limit the amount of data sent in response to a single call to DB_ENV->rep_process_message. outdated The number of outdated conditions detected. pg_duplicated The number of duplicate pages received. pg_records The number of pages received and stored. pg_requested The number of pages missed and requested from the master. startsync_delayed The number of times the client had to delay the start of a cache flush operation (initiated by the master for an impending checkpoint) because it was missing some previous log record(s). startup_complete The client site has completed its startup procedures and is now handling live records from the master. status - The current replication mode. Set to
- DB_REP_MASTER if the environment is a replication master, DB_REP_CLIENT if the environment is a replication client, or 0 if replication is not configured.
txns_applied The number of transactions applied. waiting_lsn The LSN of the first log record we have after missing log records being waited for, or 0 if no log records are currently missing. waiting_pg The page number of the first page we have after missing pages being waited for, or 0 if no pages are currently missing.
-
rep_stat_print
(flags=0)¶ Displays the replication subsystem statistical information. More info...


tl;dr
Want to take the fast track and skip the detailed tutorial below? Install Docker for your OS, clone this repo, add your WordPress site files to the wordpress directory, and from the root project directory you just cloned run:
docker-compose up -d --build
Prefer a video walk-through? Follow along with this tutorial on YouTube instead.
A Brief Intro
Before we get started, I'd like to let you know that this article isn’t a deep-dive tutorial into Docker or an explanation on the intricacies of the toolset. It’s more of a casual walk-through that explores the basics in getting a local development environment set up fast using Docker and Docker Compose. This comes as an alternative to the traditional method of installing a LAMP stack directly on your machine.
There may be better or more succinct ways of accomplishing this, but the method below is what I’ve found works the best for me when developing WordPress websites.
For those who don’t know what Docker is, let’s enjoy a brief overview. According to opensource.com:
Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package.
You can think of Docker like a VM but stream-lined, cutting out a lot of the bloat that virtual machines tend to be known for.
Why is this helpful or useful? Well if you have multiple production servers running different versions of WordPress, each one requiring a specific PHP or MySQL version, those variables can be replicated in your container definitions. Then, you can be guaranteed that the application will run precisely how it’s intended to, no matter what base machine Docker is installed on.
Sound exciting? Let’s dive in!
Installing Docker
First, let's grab the installer: https://docs.docker.com/docker-for-mac/install/.
Run through the typical application installation process, opening it up after it's complete. You may be asked to authorize Docker via your system password the first time you open it, after which you’ll see the little whale icon appearing in your status bar.
The following diagram shows the structure I’ve been using for my local WordPress Docker projects. You don’t have to follow this exactly, although the rest of this article will assume your project is set up the same.
my-wordpress-sites.com/
├── nginx/
│ └── default.conf
├── wordpress/
│ └── (WordPress source files)
├── docker-compose.yml
├── nginx.dockerfile
└── php.dockerfile
In the next few parts I’ll go over what each of these files does, but for now just create them as blank placeholders using the layout above. Additionally, add in (or download) your WordPress site's files under the wordpress/ directory.
Creating Our Stack
A great rule of thumb when using Docker is that each container should provide a single service, or handle a single process. Since we’re creating a LEMP stack, that means we’ll need one for our web server (Nginx), PHP, and MySQL. Docker has a fantastic built-in tool to create and orchestrate these containers, called Compose.
All we need to do is define the services (containers) that we need, and at runtime Docker provisions each one and wraps them all in a virtual umbrella network. This means that each service will be accessible from every other container through the use of a hostname.
To get started, create or open up the docker-compose.yml file in your project root and add the following to the top of it:
version: '3.9'
services:
A quick explanation for what we just added:
- Version: 3.9, the newest version of the Docker Compose engine, not super useful but opens us up to newer syntax goodies
- Services: Where we’ll specify the images that’ll make up our stack
Adding Nginx
Directly under the services heading that we specified at the bottom of the docker-compose.yml file above, you’ll add in the following:
nginx:
build:
context: .
dockerfile: nginx.dockerfile
ports:
- 80:80
volumes:
- ./wordpress:/var/www/html
depends_on:
- php
- mysql
Let's break down everything that this block in the Docker Compose configuration is doing:
First, we're telling Docker to create a container with a name of nginx. It's going to be built from a local Dockerfile called nginx.dockerfile
, found in the context element, which is set to the current directory.
Next, we're using the ports directive to tunnel the :80
port from our local machine (the first number) to the :80
port on the nginx container (the second number). This means that once active, listening to localhost:80 on our local machine will stream the response from our nginx container's 80 port.
After that, we're using the volumes attribute. This list is essentially a way to create symlinks between our local filesystem, and a Docker container's filesystem. The best part is that any changes to files in these folders on your machine or the container, mirror to one another. We're setting up a volume from our local wordpress
folder, to the nginx container's /var/www/html
directory.
Finally, this depends_on directive is a list of other services (or containers) that should be active and spun up before the current container is. Nginx depends on both PHP and MySQL to be ready and active, so those are the ones set here.
Okay, let's crack open that nginx.dockerfile
and add the following contents to it:
FROM nginx:stable-alpine
ADD ./nginx/default.conf /etc/nginx/conf.d/default.conf
Pretty simple, huh? We're doing all of two things here:
-
Setting up our container with the Docker Hub Nginx image, stable-alpine version. Alpine means that the base OS will be Alpine Linux, a light-weight container-friendly distro.
-
Copying a local config file in our project's nginx folder, and replacing it over the default.conf file that exists in the
nginx/conf.d
folder.
Lastly for the Nginx portion of our dev environment, open up the nginx/default.conf
file on your local system, and add in the following basic Nginx configuration that WordPress recommends:
upstream php {
server unix:/tmp/php-cgi.socket;
server php:9000;
}
server {
listen 80;
server_name wordpress-docker.test;
root /var/www/html;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass php;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
Alright, let's move on to the next part, MySQL!
Adding MySQL
In our docker-compose.yml file, after our nginx
service, let's add a new block for MySQL:
mysql:
image: mysql:latest
restart: always
ports:
- 3306:3306
environment:
MYSQL_DATABASE: wp
MYSQL_USER: wp
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: secret
This is all we need for our database. First, instead of building from a custom Dockerfile like our nginx
container, we're using an image from the Docker Hub directly with the image attribute. In this case, the latest version of MySQL.
Next, we're setting this restart attribute to always, if for any reason the container goes down, we want it to spin back up on its own. Also like with the nginx
container, we're exposing the default MySQL port (3306) from the container to our local machine.
Finally, the MySQL image expects a few environment attributes, which is a list of key value pairs, passed through on spin-up to the container. Using the above, we set the name and username of the database, as well as the password.
✨ Getting closer!
Adding PHP
Like with nginx
, we'll be building this service from a custom Dockerfile. Let's add the following to the bottom of our docker-compose.yml file:
php:
build:
context: .
dockerfile: php.dockerfile
volumes:
- ./wordpress:/var/www/html
With the PHP service, we don't need to expose any ports to our local system, since we really don't have any practical use for that. We are however, attaching the WordPress source files to the same directory that our nginx
root is set to.
Again, we're building from a custom Dockerfile, so let's open up php.dockerfile
and add in the following contents:
FROM php:7.4-fpm-alpine
ADD ./php/www.conf /usr/local/etc/php-fpm.d/www.conf
RUN addgroup -g 1000 wp && adduser -G wp -g wp -s /bin/sh -D wp
RUN mkdir -p /var/www/html
RUN chown wp:wp /var/www/html
WORKDIR /var/www/html
RUN docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-enable pdo_mysql
This Dockerfile is a bit bigger and more complex than the one we created for nginx
. Let's break it down and see what's happening.
First, we're building the container from the PHP 7.4 FPM version, with Alpine Linux as the base.
Next, we're copying over a local file, www.conf in the php directory, and replacing it with the default www.conf on the container.
After that, we're running a few commands to create a user called wp
, and use them as the owner of the site root files.
Finally, we're setting the working directory to the site root, and running the docker-php-ext-install command. This is a super helpful built-in command for this container, which as its name implies, installs PHP extensions and configures the necessary configuration files to use them. We're using that command to install mysqli, pdo, and pdo_mysql.
Okay, I think we're all done with the setup, so let's see if this runs!
Starting Docker
We have all of our individual pieces in order, now it’s finally time to assemble our Docker network! Open up a terminal window and navigate to the root directory of this project. Then, run:
docker-compose up --build
Since this is our first time starting up these containers, and since some of them are using custom Dockerfiles (php, nginx), we include this --build
option which is a shortcode for docker-compose build
. Building the containers compiles custom images from the Dockerfile commands that we've specified.
After Docker pulls the images and runs the commands for each of your containers, they'll individually come online under an umbrella network named after your project folder. Then, the output for each of your containers will start streaming to the active terminal.
Note: If you instead want to run this in the background and not see any console output, use docker-compose up -d
to use detached mode.
After this completes, head over to your browser and navigate to localhost
, and if everything worked successfully, you should see the WordPress installation screen!
Installing WordPress
This step doesn't differ much than if you were installing WordPress on a server or typical local dev environment. Select your language, and then enter in your database credentials.
If you used the same environment variables in your docker-compose.yml file as the ones earlier, that would be
- Database Name: wp
- User Name: wp
- Password: secret
- Database Host: mysql
That last one is correct, mysql
is the database host. Why not localhost
?
Remember that each service (nginx, php, and mysql) are running in their own individual containers. The php service is handling the submission of this form and the processing of the WordPress source files. If we used localhost
here, the PHP container would interpret that as itself, and look for a MySQL installation in its own container.
That doesn't exist, though. Our MySQL installation is in a separate container. But, because we're using Docker Compose and that umbrella network, the mysql container is available to every other container using its service name as the hostname, mysql
.
Clicking submit, and you should be able to finish up the installation by adding in your site name and desired login information!
💥 Boom! We have a WordPress site running locally with Docker!
Adding WP-CLI
There's a super helpful command-line tool for managing WordPress sites, plugins, and users, called wp-cli. As an addition to our local dev environment, I'd like to add this and use it with our site.
I could install it locally using their documentation, but if I don't have (or want to install) the dependencies for it on my local machine, I couldn't use it. Instead, let's add it with Docker and have our containers do the work for us.
First, we'll have to open up our docker-compose.yml file and add a new service at the bottom:
wp:
build:
context: .
dockerfile: php.dockerfile
entrypoint: ['wp', '--allow-root']
volumes:
- ./wordpress:/var/www/html
Since this tool runs on PHP, we're building it off of the same Dockerfile that our php service is running on. We're also mounting the same volume as well, wordpress
to /var/www/html
. The only new thing on this block, is an attribute called entrypoint.
Entrypoint is either a single string, or an array of strings, representing a command (and its arguments) that the container runs when spun up. We're replacing the default entrypoint of the PHP service from the Docker Hub image, with an array of two strings that compiles into the command wp --allow-root
.
Using this is super easy, instead of having to ssh into a container like a VM, we use the docker-compose run
command which expects a service name and a list of arguments that get passed to the entrypoint we just specified.
In our project root, we can get a list of all of the users on our WordPress site by running:
docker-compose run --rm wp user list
Which is equivalent to running wp user list
inside of the container.
An individual container is spun up using the php.dockerfile that we specified in the wp service. Then, the arguments are passed to the wp --allow-root
entrypoint, and the output is streamed to our console. Finally, since we specified the --rm
option, once the command completes, the container that ran it is destroyed and any memory is freed up.
All of this, with zero WordPress dependencies installed on our actual system!
End of the Line
Well, there we have it! We’ve installed Docker, set up and configured a docker-compose.yml
file, and built a LEMP stack of three containers wrapped in a single network. We've exposed ports on that network to access our website and database, and have even ran wp-cli commands using docker-compose’s run
method.
Moving forward, if you want to bring down the containers and network, it’s as simple as navigating to your project’s root folder and running:
docker-compose down
This will both bring down, and destroy, the containers and any associated non-volume data that was stored in them.
Docker has made local development an absolute breeze for me, especially when it comes to juggling multiple WordPress projects spanning different versions. I can easily have one project running on a Docker network with a PHP container using 7.1
, and if I wanted to see how my current project would perform in PHP 8 it’s as simple as changing a single character in php.dockerfile
, re-building, and bringing the docker-compose network back up.
I won't deny one caveat, you’ll get no better local development performance than running your stack directly on your machine’s hardware. I've weighed the tradeoff of performance for versatility, ease of use, parallel environments, and customization, and have decided it's just too handy to continue running dependencies like PHP and MySQL on my local hardware.
If you have any questions, comments, or want to chat more about PHP and web development in general, don’t hesitate to reach out to me on Twitter. I also run a monthly newsletter called The VOLT, for info tid-bits and tips on PHP, JavaScript, and Docker-related development.


get: {{form_by_get}}
dict key: {{form_by_dict_key}}
getunicode: {{form_by_getunicode}}
attr: {{form_by_attr}}
decode: {{form_by_decode}}
getall: {{form_by_getall}}
getall_first: {{form_by_getall_first}}
decode_getall: {{form_by_decode_getall}}
decode_getall_first: {{form_by_decode_getall_first}}
get: {{cookie_by_get}}
dict key: {{cookie_by_dict_key}}
getunicode: {{cookie_by_getunicode}}
attr: {{cookie_by_attr}}
decode: {{cookie_by_decode}}


TCMask
Swift
class TCMask : NSObject
Objective-C
@interface TCMask : NSObject
TCMask is the masking result from TCMaskView
-
Initialize a TCMask
Declaration
Swift
public init(data: [UInt8], size: CGSize)
Objective-C
- (nonnull instancetype)initWithData:(NSArray
* _Nonnull)data size:(CGSize)size OBJC_DESIGNATED_INITIALIZER; -
Data of masking result
Declaration
Swift
let data: [UInt8]
Objective-C
@property (nonatomic, readonly, copy) NSArray
* _Nonnull data; -
Size of mask
Declaration
Swift
let size: CGSize
Objective-C
@property (nonatomic, readonly) CGSize size;
-
Create a gray scale UIImage from mask
Declaration
Swift
func grayScaleImage() -> UIImage
Objective-C
- (UIImage * _Nonnull)grayScaleImage;
Return Value
Gray scale image converted from mask
-
Create a RGBA UIImage from mask
Declaration
Swift
func rgbaImage() -> UIImage
Objective-C
- (UIImage * _Nonnull)rgbaImage;
Return Value
RGBA image converted from mask, with the alpha info of premultiplied last. If a pixel value of mask is v, the corrosponding pixel value of returned RGBA image is (v, v, v, v)
-
Create a new mask which is the inversion of the original mask
Declaration
Swift
func inverted() -> TCMask
Objective-C
- (TCMask * _Nonnull)inverted;
-
Cutout a image using mask
Declaration
Swift
func cutout(image: UIImage, resize: Bool) -> UIImage?
Objective-C
- (UIImage * _Nullable)cutoutWithImage:(UIImage * _Nonnull)image resize:(BOOL)resize;
Parameters
image
Image to cutout
resize
Specify true to resize the output image to fit the result size
Return Value
Nil if resize is set to true and mask only contains 0, otherwise image with cutout
-
Cutout an image using mask
Declaration
Swift
func cutout(image: UIImage, resize: Bool, outputRect: inout CGRect) -> UIImage?
Objective-C
- (UIImage * _Nullable)cutoutWithImage:(UIImage * _Nonnull)image resize:(BOOL)resize;
Parameters
image
Image to cutout
resize
Specify true to resize the output image to fit the result size
outputRect
OUT parameter, which returns The rect of output image in original image. If the result image is nil, outputRect will be (0, 0, 0, 0); If resize is set to false, outputRect will be (0, 0, image.width, image.height)
Return Value
Nil if resize is set to true and mask only contains 0, result image with cutout otherwise
-
Create an image blended with mask
Declaration
Swift
func blend(foregroundImage: UIImage, backgroundImage: UIImage) -> UIImage
Objective-C
- (UIImage * _Nonnull)blendWithForegroundImage:(UIImage * _Nonnull)foregroundImage backgroundImage:(UIImage * _Nonnull)backgroundImage;
Parameters
foregroundImage
Foregournd image, image size should match mask size
backgroundImage
Background image, image size should match mask size
Return Value
Blended image


Head Blacksmith Lombert:
Then go! Seek out
Varka's Messenger Naran Ashanuk
and gain his tribe's trust.


TCP Connect Test Result
| averageRoundTripTime |
| connectionAttempts |
| failedAttempts |
| failedPercent |
| maximumRoundTripTime |
| minimumRoundTripTime |
| successfulConnections |
This is an embedded object that can not be directly accessed.
This object has no parents.
This object has no children.
This object has no members.
Average Round Trip Time in milliseconds
Max value: 10000
SDK attribute: averageRoundTripTime
The number of connection attempts
Max value: 10000
SDK attribute: connectionAttempts
The number of failed connection attempts
Max value: 10000
SDK attribute: failedAttempts
The percentage of failed connections
Max value: 100
SDK attribute: failedPercent
The maximum round trip time seen
Max value: 10000
SDK attribute: maximumRoundTripTime
The lowest round trip time seen
Max value: 10000
SDK attribute: minimumRoundTripTime
Total number of successful connections
Max value: 10000
SDK attribute: successfulConnections