|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.dnd.DropTargetAdapter
public abstract class DropTargetAdapter
An abstract adapter class for receiving drop target events. The methods in this class are empty. This class exists only as a convenience for creating listener objects.
Extend this class to create a DropTargetEvent
listener
and override the methods for the events of interest. (If you implement the
DropTargetListener
interface, you have to define all of
the methods in it. This abstract class defines a null implementation for
every method except drop(DropTargetDropEvent)
, so you only have
to define methods for events you care about.) You must provide an
implementation for at least drop(DropTargetDropEvent)
. This
method cannot have a null implementation because its specification requires
that you either accept or reject the drop, and, if accepted, indicate
whether the drop was successful.
Create a listener object using the extended class and then register it with
a DropTarget
. When the drag enters, moves over, or exits
the operable part of the drop site for that DropTarget
, when
the drop action changes, and when the drop occurs, the relevant method in
the listener object is invoked, and the DropTargetEvent
is
passed to it.
The operable part of the drop site for the DropTarget
is
the part of the associated Component
's geometry that is not
obscured by an overlapping top-level window or by another
Component
higher in the Z-order that has an associated active
DropTarget
.
During the drag, the data associated with the current drag operation can be
retrieved by calling getTransferable()
on
DropTargetDragEvent
instances passed to the listener's
methods.
Note that getTransferable()
on the
DropTargetDragEvent
instance should only be called within the
respective listener's method and all the necessary data should be retrieved
from the returned Transferable
before that method returns.
DropTargetEvent
,
DropTargetListener
| Constructor Summary | |
|---|---|
DropTargetAdapter()
|
| Method Summary | |
|---|---|
void |
dragEnter(DropTargetDragEvent dtde)
Called while a drag operation is ongoing, when the mouse pointer enters the operable part of the drop site for the DropTarget
registered with this listener. |
void |
dragExit(DropTargetEvent dte)
Called while a drag operation is ongoing, when the mouse pointer has exited the operable part of the drop site for the DropTarget registered with this listener. |
void |
dragOver(DropTargetDragEvent dtde)
Called when a drag operation is ongoing, while the mouse pointer is still over the operable part of the drop site for the DropTarget
registered with this listener. |
void |
dropActionChanged(DropTargetDragEvent dtde)
Called if the user has modified the current drop gesture. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.awt.dnd.DropTargetListener |
|---|
drop |
| Constructor Detail |
|---|
public DropTargetAdapter()
| Method Detail |
|---|
public void dragEnter(DropTargetDragEvent dtde)
DropTarget
registered with this listener.
dragEnter
in interface DropTargetListener
dtde
- the DropTargetDragEvent
public void dragOver(DropTargetDragEvent dtde)
DropTarget
registered with this listener.
dragOver
in interface DropTargetListener
dtde
- the DropTargetDragEvent
public void dropActionChanged(DropTargetDragEvent dtde)
dropActionChanged
in interface DropTargetListener
dtde
- the DropTargetDragEvent
public void dragExit(DropTargetEvent dte)
DropTarget
registered with this listener.
dragExit
in interface DropTargetListener
dte
- the DropTargetEvent
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.


{{! Copyright 2015, Jakob Korherr Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. }} {{< ../page1}} {{$dialog}}
{{/dialog}} {{/ ../page1}}


If you have any queries please contact us on (08) 9432 9111 or email<EMAIL_ADDRESS>Kind Regards Rottnest Island Authority www.rottnestisland.com


1) Press Mee and Meep buttons to write Mee(p)-based communication 2) Press Translate to get an English-language translation
Meep Mee (Clear Meeps)
Translate!


College Cleaners is a platform that connects you to local cleaning staff. The cleaning staff will arrive and get to work within minutes of a request!
Find Out More
1. Go To The Payment Page.
2. Pay The Venmo Address The Proper Amount. (See Pricing)
3. Leave Your Address And Phone Number As The Comment.
4. Wait For Your On Demand Clean!
Our cleaning staff typically arrive within minutes of a request.
Being an on-demand service allows you to request when convenient for you!
Services are priced with college students in mind.
Make a request in just a few clicks!
Have questions we didn't answer? We'd be glad to help! Give us a call or send us an email and we will get back to you as soon as possible!
234-401-7422


Stinking Bishop is a full fat pasteurised cow's milk soft cheese made by Charles Martell & Son since 1972 at their Laurel Farm in Dymock, England. Milk of rare Gloucester cattle is used to produce the cheese though sometimes their milk is mixed with the milk of Fresian cattle.
Made with vegetarian rennet, this cheese is also suitable for vegetarians. The rind is washed in perry, an alcoholic drink made with the local variety of Stinking Bishop pear, which gives the cheese its name. The alcoholic wash gives the cheese its distinctive pungent aroma and brown/pink rind colour. As a result of the natural rind, changeable hues of mold spots appear on the cheese from time to time.
This unique cheese dates its history to the Cistercian order of monks. To keep up with the tradition of monastic cheeses, Stinking Bishop is also matured in humid cave-like conditions.
The colour of the cheese paste varies from white-yellow to beige, with an orange to grey rind. It is available in 5lbs wheels, each measuring 8-inches in diameter and 2-inches deep. The affinage takes from six to eight weeks. Stinking Bishop is produced in very limited quantities but its stinky smell has made it very popular in the United Kingdom and abroad.
-
Made from pasteurized
cow
's milk
-
Country of origin:
United Kingdom
-
Region: Gloucestershire
-
Type:
semi-soft
, artisan
-
Fat content: 48%
-
Texture:
creamy
and
smooth
-
Rind: washed
-
Colour: cream
-
Flavour: full-flavored, strong
-
Aroma: pungent, stinky
-
Vegetarian: yes
-
Producers: Charles Martell & Son Limited
-
Other cheeses from United Kingdom:
-
hard cheeses:
Acorn
,
Appleby's Double Gloucester
,
Basing
,
Berkswell
,
Bermondsey Hard Pressed
,
Buffalo
,
Caerphilly
,
Cheshire
,
Coverdale
,
Davidstow 3 Year Reserve Special Vintage
,
...
show all
... ,
Davidstow Extra Mature Cheddar
,
Davidstow Mature Cheddar
,
Double Gloucester
,
Double Worcester
,
Duddleswell
,
Dunlop
,
Extra Mature Wensleydale
,
Gloucester
,
Gospel Green
,
Hafod
,
Hereford Hop
,
Huntsman
,
Isle of Mull
,
Keens Cheddar
,
Lairobell
,
Lincolnshire Poacher
,
Little Black Bomber
,
Llanglofan Farmhouse
,
Lyburn's Winchester
,
Marble Cheddar
,
Marbled Cheeses
,
Mature Wensleydale
,
Oak Smoked Wensleydale
,
Old Harry
,
Old Winchester
,
Orkney Extra Mature Cheddar
,
Orkney Mature Cheddar
,
Penbryn
,
Red Leicester
,
Scotch Bonnet Cheddar
,
Seator's Orkney
,
Seriously Strong Cheddar
,
Spenwood
,
Sraffordshire Organic
,
Tregonwell
,
Tyn Grug
,
Wellesley
,
Wensleydale
,
Wookey Hole Cave Aged Cheddar
-
semi-hard cheeses:
Abbot’s Gold
,
Applewood
,
Burwood Bole
,
Colston Bassett Stilton
,
Cornish Yarg
,
Cotherstone
,
Cotswold
,
Criffel
,
Derby
,
Devon Blue
,
...
show all
... ,
Devon Garland
,
Huntsman
,
Lord of the Hundreds
,
Lyburn Gold
,
Lyburn Lightly Oak Smoked
,
Maisie's Kebbuck
,
Malvern
,
Montgomery's Cheddar
,
Old Ford
,
Orkney Medium Coloured Cheddar
,
Red Windsor
,
Sage Derby
,
Sharpham Rustic
,
Sharpham Rustic Chive & Garlic
,
Sharpham Savour
,
Stoney Cross
,
Teifi
,
Ticklemore
,
White Stilton with Mango & Ginger
-
semi-soft cheeses:
Ailsa Craig
,
Burwash Rose
,
Cardo
,
Celtic Promise
,
Chorlton Blue Cheshire
,
Cropwell Bishop Blue Stilton
,
Exmoor Blue
,
Francis
,
Gorwydd Caerphilly
,
Harbourne Blue
,
...
show all
... ,
Harlech Truckle
,
Innes Brick
,
Kirkham's Lancashire
,
Lake District Extra Mature Cheddar
,
Little Colonel
,
Lyburn Garlic and Nettle
,
Marbled Cheeses
,
May Hill Green
,
Ogleshield
,
Oxford Blue
,
Pembrokeshire Extra Mature Cheddar
,
Pembrokeshire Mature Cheddar
,
Red Dragon Truckle
,
Stichelton
,
Tilly Whim
,
Waterloo
,
Wigmore
-
soft cheeses:
Baron Bigod
,
Bartlett
,
Bath Blue
,
Bath Cheese
,
Beenleigh Blue
,
Blacksticks Blue
,
Bonchester
,
Bosworth
,
Buxton Blue
,
Cornish Brie
,
...
show all
... ,
Cote Hill Blue
,
Cottage Cheese
,
Cranborne
,
Cremet
,
Delamere Goats Cheese Logs
,
Dorset White
,
Dorstone
,
Dunsyre Blue
,
Finn
,
Flower Marie
,
Golden Cross
,
Innes Log
,
Lake District Mature Cheddar
,
Ragstone
,
Sharpham
,
Sharpham Elmhirst
,
Somerset Brie
,
Stawley
,
St Jude
,
Tunworth
,
Yorkshire Blue
-
fresh firm cheeses:
Wensleydale with Cranberries
-
fresh soft cheeses:
Cerney Pyramid
,
Childwickbury
,
Innes Button
,
Olde York
,
Pant ys Gawn
,
Perroche
,
Sleightlett
,
Vulscombe
,
Windrush Cheeses


JavaScript Variables
JavaScript variables are containers for storing data values.
Check the type of Data inside Inspect then goto console


Proposal for HttpClient Package
(0) Rationale
HTTP is the main protocol used today on the internet. Although the JDK
includes basic support for building HTTP-aware client applications, it
doesn't provide the flexibility or ease of use needed for many projects.
A Commons package would give committers an opportunity to coordinate
their efforts to create and maintain a efficient, feature-rich package
under the ASF license.
(1) Scope of the Package
The package shall create and maintain a Java library implementing the client
side of the HTTP/1.1 protocol, as defined in RFC 2616 and RFC 2617.
The package should :
- Have an API which should be as simple to use as possible
- Be as easy to extend as possible
- Provide unconditional support for HTTP/1.1
The package is quite different from the HTTP client provided as part of the JDK
(java.net.HttpURLConnection), as it focuses on the HTTP methods being sent
(instead of making that transparent to the user), and generally allows more
interaction with the lower level connection. The JDK client is also not very
intuitive to use.
The package is used by the Slide project to build a WebDAV client
library supporting WebDAV level 2.
(1.5) Interaction With Other Packages
HttpClient relies on:
- Java Development Kit (Version 1.1 or later; 1.3 or later recommended)
(2) Initial Source of the Package
The initial codebase exists in the jakarta-slide cvs tree under the
org.apache.webdav.lib package. It would be moved to commons under
the http subdirectory.
The proposed package name for the new component is
org.apache.commons.httpclient.
(3) Required Jakarta-Commons Resources
- CVS Repository - New directory
httpclient
in the
jakarta-commons
CVS repository.
- Initial Committers - The list is provided below. Some of the proposed
committers are not currently jakarta-commons committers, but are committers
on the jakarta-slide project, and contributed to this component.
- Mailing List - Discussions will take place on the general
<EMAIL_ADDRESS>mailing list. To help list
subscribers identify messages of interest, it is suggested that the
message subject of messages about this component be prefixed with
[HttpClient].
- Bugzilla - New component "HttpClient" under the "Commons" product
category, with appropriate version identifiers as needed.
- Jyve FAQ - New category "commons-httpclient" (when available).
(4) Initial Committers
The initial committers on the Digester component shall be:
- Remy Maucherat.
- B.C.Holmes
- Sung-Gu Park
- Juergen Pill
- Costin Manolache


Rules
We have a small but strict set of rules on our server. Please read over them and take them on board - if you don't understand anything or need some clarification, feel free to ask any staff member!
- Be polite, and do not spam
- Follow the Discord community guidelines
- Be patient both with users asking questions, and the users answering them
- Listen to and respect the staff members - we're here to help, but we're all human beings
-
All discussion should be kept within the relevant channels for the subject.
- General Python help and support requests go to one of the three help channels - pick the one that is the quietest at the time.
- The topical channels can be used for help and support requests, but general discussion about the subjects covered by them should go there also.
-
If you're working with one of the bots, we ask you to specifically do that in
#bot-commands
, to keep the other channels clear of bot output. -
If you're working on a Python project or something directly related to our server, feel
free to post a link to it in
#show-your-projects
. We prefer links to source code over websites, but we'll also accept screenshots and videos if you're not yet ready to release the code.-
If you or someone else posts a project to
#show-your-projects
, you may discuss it in#show-your-projects-discussion
.#show-your-projects
is intended to be a listing channel, and any discussion there is removed regularly. - Please note, we do not allow postings for communities (such as forums or other Discord servers) or commercial projects.
-
If you or someone else posts a project to
- This is an English-speaking server. Please speak English to the best of your ability. Google translate is fine if you're not sure.
- Keep all discussions SFW - No ecchi or NSFW media. If you wouldn't want the entire world to know about your interest in it, it doesn't belong on this server.
- We do not allow advertisements for communities or commercial projects - Contact us directly if you want to discuss a partnership!
Infractions
We have a generally no-nonsense policy when it comes to our rules. If you notice someone breaking them, feel free to mention or DM a staff member and we'll try to deal with it as soon as possible.
The possible actions we take based on infractions can include the following:
- A public verbal/textual warning
- A short temporary mute
- A long temporary mute
- A kick from the server
- A temporary ban from the server
- A permanent ban from the server
While we do discuss more serious matters internally before handing out a punishment, simpler infractions are dealt with directly by individual staffers and the punishment they hand out is left to their own decision-making.


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xerces.dom.DeepNodeListImpl
This class implements the DOM's NodeList behavior for Element.getElementsByTagName()
The DOM describes NodeList as follows:
1) It may represent EITHER nodes scattered through a subtree (when returned by Element.getElementsByTagName), or just the immediate children (when returned by Node.getChildNodes). The latter is easy, but the former (which this class addresses) is more challenging.
2) Its behavior is "live" -- that is, it always reflects the current state of the document tree. To put it another way, the NodeLists obtained before and after a series of insertions and deletions are effectively identical (as far as the user is concerned, the former has been dynamically updated as the changes have been made).
3) Its API accesses individual nodes via an integer index, with the listed nodes numbered sequentially in the order that they were found during a preorder depth-first left-to-right search of the tree. (Of course in the case of getChildNodes, depth is not involved.) As nodes are inserted or deleted in the tree, and hence the NodeList, the numbering of nodes that follow them in the NodeList will change.
It is rather painful to support the latter two in the getElementsByTagName case. The current solution is for Nodes to maintain a change count (eventually that may be a Digest instead), which the NodeList tracks and uses to invalidate itself.
Unfortunately, this does _not_ respond efficiently in the case that the dynamic behavior was supposed to address: scanning a tree while it is being extended. That requires knowing which subtrees have changed, which can become an arbitrarily complex problem.
We save some work by filling the vector only as we access the item()s... but I suspect the same users who demanded index-based access will also start by doing a getLength() to control their loop, blowing this optimization out of the water.
NOTE: Level 2 of the DOM will probably _not_ use NodeList for its extended search mechanisms, partly for the reasons just discussed.
| Field Summary | |
|---|---|
protected int |
changes
|
protected boolean |
enableNS
|
protected java.util.Vector |
nodes
|
protected java.lang.String |
nsName
|
protected NodeImpl |
rootNode
|
protected java.lang.String |
tagName
|
| Constructor Summary | |
|---|---|
DeepNodeListImpl(NodeImpl rootNode,
java.lang.String tagName)
Constructor. |
|
DeepNodeListImpl(NodeImpl rootNode,
java.lang.String nsName,
java.lang.String tagName)
Constructor for Namespace support. |
| Method Summary | |
|---|---|
int |
getLength()
Returns the length of the node list. |
org.w3c.dom.Node |
item(int index)
Returns the node at the specified index. |
protected org.w3c.dom.Node |
nextMatchingElementAfter(org.w3c.dom.Node current)
Iterative tree-walker. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected NodeImpl rootNode
protected java.lang.String tagName
protected int changes
protected java.util.Vector nodes
protected java.lang.String nsName
protected boolean enableNS
| Constructor Detail |
public DeepNodeListImpl(NodeImpl rootNode, java.lang.String tagName)
public DeepNodeListImpl(NodeImpl rootNode, java.lang.String nsName, java.lang.String tagName)
| Method Detail |
public int getLength()
getLength
in interface org.w3c.dom.NodeList
public org.w3c.dom.Node item(int index)
item
in interface org.w3c.dom.NodeList
org.w3c.dom.NodeList
index
- Index into the collection.index
th position in the
NodeList
, or null
if that is not a valid
index.protected org.w3c.dom.Node nextMatchingElementAfter(org.w3c.dom.Node current)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Student's First name : {{ student.first_name }}
Student's Last name : {{ student.last_name }}
Orders made by student are:
{% for order in orders.all %}
- {{ order }}
{% for course in order.courses.all %}
- {{ course }}
{% endfor %}
{% endfor %}
Topics in which student is intertested are:
{% for topic in topics.all %}
- {{ topic.name }}
{% endfor %}


The modal search is a component to search wherever you are on the page.
You can open it via cmd+k (on mac) or ctrl+e. You can also open it via the search button on the top left corner. Then search any NgWiziBulma component to keyboardNavigate to it.
You can give to the service an array of strings to search to and use you own filter method. See the demo app file


Create Your Account
The purpose of this study is to modify materials for a new, experimental fear reduction intervention.
You may be presented with experimental fear reduction interventions. Alternatively, you may be asked to complete “control” tasks, which are tasks that are similar to experimental fear reduction techniques, but not designed to reduce fear. You may be asked to complete questionnaires in which you describe your thoughts and mood, a task that requires you to look at words and determine where targets appear, and a task in which you read brief stories, answer questions, and complete word fragments. For some participants, being asked questions about their thoughts and mood can be temporarily distressing. At the end of the study, you will receive more detail about the study's rationale and design.
You are part of a “pilot” group, which is designed to help us edit our materials and procedures. You will not be asked to complete the full experiment. Rather, you will be asked to do some of the tasks listed above and we will ask your opinions about some of the procedures via questionnaires and interviews.
Remember that participation in this study is voluntary, and you may end your individual session participation at any time. Please ask the researcher, or contact<EMAIL_ADDRESS>if you have any questions about the study, or wish to withdraw from the study. You will not be penalized for withdrawing from the study.
MindTrails does not provide specific diagnostic or medical advice on our website. The study you are about to complete is an experimental anxiety intervention study. All data collected through the Project Implicit Mental Health website are confidential and are only accessible by the research team.
Privacy Policy. Mobile CBM uses the same secure hypertext transfer protocol (HTTPS) that banks and other commercial websites use to transfer credit card information in an encrypted format. This provides strong security for data transfer to and from our website, though privacy is necessarily limited by the security of the technology that is being used. To view the entire privacy policy in a separate pop up window, please click here.
You will receive $40 compensation for participating in the study, which is expected to take 2 hours.
MindTrails is not able to offer financial compensation nor to absorb the costs of treatment should you feel you have been injured as a result of participating in this research study.
Who to contact about your rights in the study: Tonya Moon, Chair, Institutional Review Board for the Social and Behavioral Sciences , One Morton Dr Suite 500 University of Virginia, P.O. Box 800392, Charlottesville, VA 22908-0392 Telephone:<PHONE_NUMBER>; Email<EMAIL_ADDRESS>Website: www.virginia.edu/vprgs/irb
By clicking the button below you are indicating that you have read the informed consent statement above and agree to participate.
Please use the form below to create your new Mobile Study account.


--- layout: page status: publish published: true title: Water Related Land Use author: display_name: Jessie Pechmann login: jpechmann email<EMAIL_ADDRESS>url: '' author_login: jpechmann author_email<EMAIL_ADDRESS>wordpress_id: 3712 wordpress_url: http://gis.utah.gov/?page_id=3712 date: '2011-11-22 14:24:57 -0700' date_gmt: '2011-11-22 21:24:57 -0700' categories: [] tags: - sgid - Data - utah - gis - map - mapping - dataset - download - agrc - layer - shapefile - geodatabase - metadata - shp - gdb - kml - lyr - digital - geographic - information - database - state - statewide ---
Data Type: GIS Data Layer
Steward(s): DNR
Abstract:
Water usage-related polygon map data, published annually by the Utah Division of Water Resources at DNR that depicts the types and extent of irrigated crops, as well as information concerning phreatophytes, wet/open water areas, dry land agriculture and residential/industrial areas.
The primary business driver for this dataset is for constructing and analyzing the state's annual water budget.
Data Content:
The following data is available for download:
The data produced by the water-related land use program are used for various planning purposes. Some of these include: determining cropland water use, evaluating irrigated land losses and conversion to urban uses, planning for new water development, estimating irrigated acreages for any area, and developing water budgets. Additionally, the data are utilized by many other state and federal agencies. Water-related land use can be used to depict Irrigation type (Irrigated, Sub-Irrigated, Non-Irrigated, Riparian, Urban, etc),
crop type and land cover,
or, irrigation and land use types.
See accompanying FGDC metadata for description of extensive Land Use, Irrigation Type, and Vegetation Cover codes.
There are no constraints or warranties with regard to the use of this dataset.
Questions regarding this dataset can be directed to Aaron Austin at the Utah Division of Water Resources.


Classes provide a means of bundling data and functionality together. Creating a new class creates a new type of object, allowing new instances of that type to be made. Each class instance can have attributes attached to it for maintaining its state. Class instances can also have methods (defined by its class) for modifying its state.
Compared with other programming languages, Python’s class mechanism adds classes with a minimum of new syntax and semantics. It is a mixture of the class mechanisms found in C++ and Modula-3. Python classes provide all the standard features of Object Oriented Programming: the class inheritance mechanism allows multiple base classes, a derived class can override any methods of its base class or classes, and a method can call the method of a base class with the same name. Objects can contain arbitrary amounts and kinds of data. As is true for modules, classes partake of the dynamic nature of Python: they are created at runtime, and can be modified further after creation.
In C++ terminology, normally class members (including the data members) are public (except see below Private Variables), and all member functions are virtual. As in Modula-3, there are no shorthands for referencing the object’s members from its methods: the method function is declared with an explicit first argument representing the object, which is provided implicitly by the call. As in Smalltalk, classes themselves are objects. This provides semantics for importing and renaming. Unlike C++ and Modula-3, built-in types can be used as base classes for extension by the user. Also, like in C++, most built-in operators with special syntax (arithmetic operators, subscripting etc.) can be redefined for class instances.
(Lacking universally accepted terminology to talk about classes, I will make occasional use of Smalltalk and C++ terms. I would use Modula-3 terms, since its object-oriented semantics are closer to those of Python than C++, but I expect that few readers have heard of it.)
Objects have individuality, and multiple names (in multiple scopes) can be bound to the same object. This is known as aliasing in other languages. This is usually not appreciated on a first glance at Python, and can be safely ignored when dealing with immutable basic types (numbers, strings, tuples). However, aliasing has a possibly surprising effect on the semantics of Python code involving mutable objects such as lists, dictionaries, and most other types. This is usually used to the benefit of the program, since aliases behave like pointers in some respects. For example, passing an object is cheap since only a pointer is passed by the implementation; and if a function modifies an object passed as an argument, the caller will see the change — this eliminates the need for two different argument passing mechanisms as in Pascal.
Before introducing classes, I first have to tell you something about Python’s scope rules. Class definitions play some neat tricks with namespaces, and you need to know how scopes and namespaces work to fully understand what’s going on. Incidentally, knowledge about this subject is useful for any advanced Python programmer.
Let’s begin with some definitions.
A namespace is a mapping from names to objects. Most namespaces
are currently implemented as Python dictionaries, but that’s normally not
noticeable in any way (except for performance), and it may change in the
future. Examples of namespaces are: the set of built-in names (containing
functions such as
abs()
, and built-in exception names); the global names in a module; and the
local names in a function invocation. In a sense the set of attributes of
an object also form a namespace. The important thing to know about
namespaces is that there is absolutely no relation between names in
different namespaces; for instance, two different modules may both define
a function maximize
without confusion — users of the modules
must prefix it with the module name.
By the way, I use the word attribute for any name following a dot
— for example, in the expression z.real
, real
is
an attribute of the object z
. Strictly speaking, references
to names in modules are attribute references: in the expression
modname.funcname
, modname
is a module object and
funcname
is an attribute of it. In this case there happens to
be a straightforward mapping between the module’s attributes and the
global names defined in the module: they share the same namespace!
1
Attributes may be read-only or writable. In the latter case, assignment to
attributes is possible. Module attributes are writable: you can write
modname.the_answer = 42
. Writable attributes may also be
deleted with the
del
statement. For example, del modname.the_answer
will remove
the attribute the_answer
from the object named by
modname
.
Namespaces are created at different moments and have different lifetimes.
The namespace containing the built-in names is created when the Python
interpreter starts up, and is never deleted. The global namespace for a
module is created when the module definition is read in; normally, module
namespaces also last until the interpreter quits. The statements executed
by the top-level invocation of the interpreter, either read from a script
file or interactively, are considered part of a module called
main
, so they have their own global namespace. (The built-in names actually
also live in a module; this is called
builtins
.)
The local namespace for a function is created when the function is called, and deleted when the function returns or raises an exception that is not handled within the function. (Actually, forgetting would be a better way to describe what actually happens.) Of course, recursive invocations each have their own local namespace.
A scope is a textual region of a Python program where a namespace is directly accessible. “Directly accessible” here means that an unqualified reference to a name attempts to find the name in the namespace.
Although scopes are determined statically, they are used dynamically. At any time during execution, there are 3 or 4 nested scopes whose namespaces are directly accessible:
the innermost scope, which is searched first, contains the local names
the scopes of any enclosing functions, which are searched starting with the nearest enclosing scope, contains non-local, but also non-global names
the next-to-last scope contains the current module’s global names
the outermost scope (searched last) is the namespace containing built-in names
If a name is declared global, then all references and assignments go
directly to the middle scope containing the module’s global names. To
rebind variables found outside of the innermost scope, the
nonlocal
statement can be used; if not declared nonlocal, those variables are
read-only (an attempt to write to such a variable will simply create a
new local variable in the innermost scope, leaving the
identically named outer variable unchanged).
Usually, the local scope references the local names of the (textually) current function. Outside functions, the local scope references the same namespace as the global scope: the module’s namespace. Class definitions place yet another namespace in the local scope.
It is important to realize that scopes are determined textually: the global scope of a function defined in a module is that module’s namespace, no matter from where or by what alias the function is called. On the other hand, the actual search for names is done dynamically, at run time — however, the language definition is evolving towards static name resolution, at “compile” time, so don’t rely on dynamic name resolution! (In fact, local variables are already determined statically.)
A special quirk of Python is that – if no
global
or
nonlocal
statement is in effect – assignments to names always go into the innermost
scope. Assignments do not copy data — they just bind names to objects. The
same is true for deletions: the statement del x
removes the
binding of x
from the namespace referenced by the local
scope. In fact, all operations that introduce new names use the local
scope: in particular,
import
statements and function definitions bind the module or function name in
the local scope.
The
global
statement can be used to indicate that particular variables live in the
global scope and should be rebound there; the
nonlocal
statement indicates that particular variables live in an enclosing scope
and should be rebound there.
This is an example demonstrating how to reference the different scopes and
namespaces, and how
global
and
nonlocal
affect variable binding:
def scope_test():
def do_local():
spam = "local spam"
def do_nonlocal():
nonlocal spam
spam = "nonlocal spam"
def do_global():
global spam
spam = "global spam"
spam = "test spam"
do_local()
print("After local assignment:", spam)
do_nonlocal()
print("After nonlocal assignment:", spam)
do_global()
print("After global assignment:", spam)
scope_test()
print("In global scope:", spam)
The output of the example code is:
After local assignment: test spam
After nonlocal assignment: nonlocal spam
After global assignment: nonlocal spam
In global scope: global spam
Note how the local assignment (which is default) didn’t change
scope_test’s binding of spam. The
nonlocal
assignment changed scope_test’s binding of spam, and the
global
assignment changed the module-level binding.
You can also see that there was no previous binding for
spam before the
global
assignment.
Classes introduce a little bit of new syntax, three new object types, and some new semantics.
The simplest form of class definition looks like this:
class ClassName:
<statement-1>
.
.
.
<statement-N>
Class definitions, like function definitions (def
statements) must be executed before they have any effect. (You could
conceivably place a class definition in a branch of an
if
statement, or inside a function.)
In practice, the statements inside a class definition will usually be function definitions, but other statements are allowed, and sometimes useful — we’ll come back to this later. The function definitions inside a class normally have a peculiar form of argument list, dictated by the calling conventions for methods — again, this is explained later.
When a class definition is entered, a new namespace is created, and used as the local scope — thus, all assignments to local variables go into this new namespace. In particular, function definitions bind the name of the new function here.
When a class definition is left normally (via the end), a
class object is created. This is basically a wrapper around the
contents of the namespace created by the class definition; we’ll learn
more about class objects in the next section. The original local scope
(the one in effect just before the class definition was entered) is
reinstated, and the class object is bound here to the class name given in
the class definition header (ClassName
in the example).
Class objects support two kinds of operations: attribute references and instantiation.
Attribute references use the standard syntax used for all
attribute references in Python: obj.name
. Valid attribute
names are all the names that were in the class’s namespace when the class
object was created. So, if the class definition looked like this:
class MyClass:
"""A simple example class"""
i = 12345
def f(self):
return 'hello world'
then MyClass.i
and MyClass.f
are valid attribute
references, returning an integer and a function object, respectively.
Class attributes can also be assigned to, so you can change the value of
MyClass.i
by assignment. __doc__
is also a valid
attribute, returning the docstring belonging to the class:
"A simple example class"
.
Class instantiation uses function notation. Just pretend that the class object is a parameterless function that returns a new instance of the class. For example (assuming the above class):
x = MyClass()
creates a new instance of the class and assigns this object to
the local variable x
.
The instantiation operation (“calling” a class object) creates an empty
object. Many classes like to create objects with instances customized to a
specific initial state. Therefore a class may define a special method
named
init()
, like this:
def __init__(self):
self.data = []
When a class defines an
init()
method, class instantiation automatically invokes
init()
for the newly-created class instance. So in this example, a new,
initialized instance can be obtained by:
x = MyClass()
Of course, the
init()
method may have arguments for greater flexibility. In that case, arguments
given to the class instantiation operator are passed on to
init()
. For example,
>>> class Complex:
... def __init__(self, realpart, imagpart):
... self.r = realpart
... self.i = imagpart
...
>>> x = Complex(3.0, -4.5)
>>> x.r, x.i
(3.0, -4.5)
Now what can we do with instance objects? The only operations understood by instance objects are attribute references. There are two kinds of valid attribute names: data attributes and methods.
data attributes correspond to “instance variables” in Smalltalk,
and to “data members” in C++. Data attributes need not be declared; like
local variables, they spring into existence when they are first assigned
to. For example, if x
is the instance of
MyClass
created above, the following piece of code will print
the value 16
, without leaving a trace:
x.counter = 1
while x.counter < 10:
x.counter = x.counter * 2
print(x.counter)
del x.counter
The other kind of instance attribute reference is a method. A method is a function that “belongs to” an object. (In Python, the term method is not unique to class instances: other object types can have methods as well. For example, list objects have methods called append, insert, remove, sort, and so on. However, in the following discussion, we’ll use the term method exclusively to mean methods of class instance objects, unless explicitly stated otherwise.)
Valid method names of an instance object depend on its class. By
definition, all attributes of a class that are function objects define
corresponding methods of its instances. So in our example,
x.f
is a valid method reference, since
MyClass.f
is a function, but x.i
is not, since
MyClass.i
is not. But x.f
is not the same thing
as MyClass.f
— it is a method object, not a function
object.
Usually, a method is called right after it is bound:
x.f()
In the MyClass
example, this will return the string
'hello world'
. However, it is not necessary to call a method
right away: x.f
is a method object, and can be stored away
and called at a later time. For example:
xf = x.f
while True:
print(xf())
will continue to print hello world
until the end of time.
What exactly happens when a method is called? You may have noticed that
x.f()
was called without an argument above, even though the
function definition for f()
specified an argument. What
happened to the argument? Surely Python raises an exception when a
function that requires an argument is called without any — even if the
argument isn’t actually used…
Actually, you may have guessed the answer: the special thing about methods
is that the instance object is passed as the first argument of the
function. In our example, the call x.f()
is exactly
equivalent to MyClass.f(x)
. In general, calling a method with
a list of n arguments is equivalent to calling the corresponding
function with an argument list that is created by inserting the method’s
instance object before the first argument.
If you still don’t understand how methods work, a look at the implementation can perhaps clarify matters. When a non-data attribute of an instance is referenced, the instance’s class is searched. If the name denotes a valid class attribute that is a function object, a method object is created by packing (pointers to) the instance object and the function object just found together in an abstract object: this is the method object. When the method object is called with an argument list, a new argument list is constructed from the instance object and the argument list, and the function object is called with this new argument list.
Generally speaking, instance variables are for data unique to each instance and class variables are for attributes and methods shared by all instances of the class:
class Dog:
kind = 'canine' # class variable shared by all instances
def __init__(self, name):
self.name = name # instance variable unique to each instance
>>> d = Dog('Fido')
>>> e = Dog('Buddy')
>>> d.kind # shared by all dogs
'canine'
>>> e.kind # shared by all dogs
'canine'
>>> d.name # unique to d
'Fido'
>>> e.name # unique to e
'Buddy'
As discussed in A Word About Names and Objects, shared data can have possibly surprising effects with involving mutable objects such as lists and dictionaries. For example, the tricks list in the following code should not be used as a class variable because just a single list would be shared by all Dog instances:
class Dog:
tricks = [] # mistaken use of a class variable
def __init__(self, name):
self.name = name
def add_trick(self, trick):
self.tricks.append(trick)
>>> d = Dog('Fido')
>>> e = Dog('Buddy')
>>> d.add_trick('roll over')
>>> e.add_trick('play dead')
>>> d.tricks # unexpectedly shared by all dogs
['roll over', 'play dead']
Correct design of the class should use an instance variable instead:
class Dog:
def __init__(self, name):
self.name = name
self.tricks = [] # creates a new empty list for each dog
def add_trick(self, trick):
self.tricks.append(trick)
>>> d = Dog('Fido')
>>> e = Dog('Buddy')
>>> d.add_trick('roll over')
>>> e.add_trick('play dead')
>>> d.tricks
['roll over']
>>> e.tricks
['play dead']
If the same attribute name occurs in both an instance and in a class, then attribute lookup prioritizes the instance:
>>> class Warehouse:
purpose = 'storage'
region = 'west'
>>> w1 = Warehouse()
>>> print(w1.purpose, w1.region)
storage west
>>> w2 = Warehouse()
>>> w2.region = 'east'
>>> print(w2.purpose, w2.region)
storage east
Data attributes may be referenced by methods as well as by ordinary users (“clients”) of an object. In other words, classes are not usable to implement pure abstract data types. In fact, nothing in Python makes it possible to enforce data hiding — it is all based upon convention. (On the other hand, the Python implementation, written in C, can completely hide implementation details and control access to an object if necessary; this can be used by extensions to Python written in C.)
Clients should use data attributes with care — clients may mess up invariants maintained by the methods by stamping on their data attributes. Note that clients may add data attributes of their own to an instance object without affecting the validity of the methods, as long as name conflicts are avoided — again, a naming convention can save a lot of headaches here.
There is no shorthand for referencing data attributes (or other methods!) from within methods. I find that this actually increases the readability of methods: there is no chance of confusing local variables and instance variables when glancing through a method.
Often, the first argument of a method is called self
. This is
nothing more than a convention: the name self
has absolutely
no special meaning to Python. Note, however, that by not following the
convention your code may be less readable to other Python programmers, and
it is also conceivable that a class browser program might be
written that relies upon such a convention.
Any function object that is a class attribute defines a method for instances of that class. It is not necessary that the function definition is textually enclosed in the class definition: assigning a function object to a local variable in the class is also ok. For example:
# Function defined outside the class
def f1(self, x, y):
return min(x, x+y)
class C:
f = f1
def g(self):
return 'hello world'
h = g
Now f
, g
and h
are all attributes
of class C
that refer to function objects, and consequently
they are all methods of instances of C
— h
being
exactly equivalent to g
. Note that this practice usually only
serves to confuse the reader of a program.
Methods may call other methods by using method attributes of the
self
argument:
class Bag:
def __init__(self):
self.data = []
def add(self, x):
self.data.append(x)
def addtwice(self, x):
self.add(x)
self.add(x)
Methods may reference global names in the same way as ordinary functions. The global scope associated with a method is the module containing its definition. (A class is never used as a global scope.) While one rarely encounters a good reason for using global data in a method, there are many legitimate uses of the global scope: for one thing, functions and modules imported into the global scope can be used by methods, as well as functions and classes defined in it. Usually, the class containing the method is itself defined in this global scope, and in the next section we’ll find some good reasons why a method would want to reference its own class.
Each value is an object, and therefore has a class (also called
its type). It is stored as object.__class__
.
Of course, a language feature would not be worthy of the name “class” without supporting inheritance. The syntax for a derived class definition looks like this:
class DerivedClassName(BaseClassName):
<statement-1>
.
.
.
<statement-N>
The name BaseClassName
must be defined in a scope containing
the derived class definition. In place of a base class name, other
arbitrary expressions are also allowed. This can be useful, for example,
when the base class is defined in another module:
class DerivedClassName(modname.BaseClassName):
Execution of a derived class definition proceeds the same as for a base class. When the class object is constructed, the base class is remembered. This is used for resolving attribute references: if a requested attribute is not found in the class, the search proceeds to look in the base class. This rule is applied recursively if the base class itself is derived from some other class.
There’s nothing special about instantiation of derived classes:
DerivedClassName()
creates a new instance of the class.
Method references are resolved as follows: the corresponding class
attribute is searched, descending down the chain of base classes if
necessary, and the method reference is valid if this yields a function
object.
Derived classes may override methods of their base classes. Because
methods have no special privileges when calling other methods of the same
object, a method of a base class that calls another method defined in the
same base class may end up calling a method of a derived class that
overrides it. (For C++ programmers: all methods in Python are effectively
virtual
.)
An overriding method in a derived class may in fact want to extend rather
than simply replace the base class method of the same name. There is a
simple way to call the base class method directly: just call
BaseClassName.methodname(self, arguments)
. This is
occasionally useful to clients as well. (Note that this only works if the
base class is accessible as BaseClassName
in the global
scope.)
Python has two built-in functions that work with inheritance:
Use
isinstance()
to check an instance’s type: isinstance(obj, int)
will be
True
only if obj.__class__
is
int
or some class derived from
int
.
Use
issubclass()
to check class inheritance: issubclass(bool, int)
is
True
since
bool
is a subclass of
int
. However, issubclass(float, int)
is
False
since
float
is not a subclass of
int
.
Python supports a form of multiple inheritance as well. A class definition with multiple base classes looks like this:
class DerivedClassName(Base1, Base2, Base3):
<statement-1>
.
.
.
<statement-N>
For most purposes, in the simplest cases, you can think of the search for
attributes inherited from a parent class as depth-first, left-to-right,
not searching twice in the same class where there is an overlap in the
hierarchy. Thus, if an attribute is not found in
DerivedClassName
, it is searched for in Base1
,
then (recursively) in the base classes of Base1
, and if it
was not found there, it was searched for in Base2
, and so on.
In fact, it is slightly more complex than that; the method resolution
order changes dynamically to support cooperative calls to
super()
. This approach is known in some other multiple-inheritance languages as
call-next-method and is more powerful than the super call found in
single-inheritance languages.
Dynamic ordering is necessary because all cases of multiple inheritance
exhibit one or more diamond relationships (where at least one of the
parent classes can be accessed through multiple paths from the bottommost
class). For example, all classes inherit from
object
, so any case of multiple inheritance provides more than one path to
reach
object
. To keep the base classes from being accessed more than once, the
dynamic algorithm linearizes the search order in a way that preserves the
left-to-right ordering specified in each class, that calls each parent
only once, and that is monotonic (meaning that a class can be subclassed
without affecting the precedence order of its parents). Taken together,
these properties make it possible to design reliable and extensible
classes with multiple inheritance. For more detail, see
https://www.python.org/download/releases/2.3/mro/.
“Private” instance variables that cannot be accessed except from inside an
object don’t exist in Python. However, there is a convention that is
followed by most Python code: a name prefixed with an underscore
(e.g. _spam
) should be treated as a non-public part of the
API (whether it is a function, a method or a data member). It should be
considered an implementation detail and subject to change without notice.
Since there is a valid use-case for class-private members (namely to avoid
name clashes of names with names defined by subclasses), there is limited
support for such a mechanism, called name mangling. Any
identifier of the form __spam
(at least two leading
underscores, at most one trailing underscore) is textually replaced with
_classname__spam
, where classname
is the current
class name with leading underscore(s) stripped. This mangling is done
without regard to the syntactic position of the identifier, as long as it
occurs within the definition of a class.
Name mangling is helpful for letting subclasses override methods without breaking intraclass method calls. For example:
class Mapping:
def __init__(self, iterable):
self.items_list = []
self.__update(iterable)
def update(self, iterable):
for item in iterable:
self.items_list.append(item)
__update = update # private copy of original update() method
class MappingSubclass(Mapping):
def update(self, keys, values):
# provides new signature for update()
# but does not break __init__()
for item in zip(keys, values):
self.items_list.append(item)
The above example would work even if MappingSubclass
were to
introduce a __update
identifier since it is replaced with
_Mapping__update
in the Mapping
class and
_MappingSubclass__update
in the
MappingSubclass
class respectively.
Note that the mangling rules are designed mostly to avoid accidents; it still is possible to access or modify a variable that is considered private. This can even be useful in special circumstances, such as in the debugger.
Notice that code passed to exec()
or eval()
does
not consider the classname of the invoking class to be the current class;
this is similar to the effect of the global
statement, the
effect of which is likewise restricted to code that is byte-compiled
together. The same restriction applies to getattr()
,
setattr()
and delattr()
, as well as when
referencing __dict__
directly.
Sometimes it is useful to have a data type similar to the Pascal “record” or C “struct”, bundling together a few named data items. An empty class definition will do nicely:
class Employee:
pass
john = Employee() # Create an empty employee record
# Fill the fields of the record
john.name = 'John Doe'
john.dept = 'computer lab'
john.salary = 1000
A piece of Python code that expects a particular abstract data type can
often be passed a class that emulates the methods of that data type
instead. For instance, if you have a function that formats some data from
a file object, you can define a class with methods read()
and
readline()
that get the data from a string buffer instead,
and pass it as an argument.
Instance method objects have attributes, too: m.__self__
is
the instance object with the method m()
, and
m.__func__
is the function object corresponding to the
method.
By now you have probably noticed that most container objects can be looped
over using a
for
statement:
for element in [1, 2, 3]:
print(element)
for element in (1, 2, 3):
print(element)
for key in {'one':1, 'two':2}:
print(key)
for char in "123":
print(char)
for line in open("myfile.txt"):
print(line, end='')
This style of access is clear, concise, and convenient. The use of
iterators pervades and unifies Python. Behind the scenes, the
for
statement calls
iter()
on the container object. The function returns an iterator object that
defines the method
next()
which accesses elements in the container one at a time. When there are no
more elements,
next()
raises a
StopIteration
exception which tells the for
loop to terminate. You can call
the
next()
method using the
next()
built-in function; this example shows how it all works:
>>> s = 'abc'
>>> it = iter(s)
>>> it
<iterator object at 0x00A1DB50>
>>> next(it)
'a'
>>> next(it)
'b'
>>> next(it)
'c'
>>> next(it)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
next(it)
StopIteration
Having seen the mechanics behind the iterator protocol, it is easy to add
iterator behavior to your classes. Define an
iter()
method which returns an object with a
next()
method. If the class defines __next__()
, then
iter()
can just return self
:
class Reverse:
"""Iterator for looping over a sequence backwards."""
def __init__(self, data):
self.data = data
self.index = len(data)
def __iter__(self):
return self
def __next__(self):
if self.index == 0:
raise StopIteration
self.index = self.index - 1
return self.data[self.index]
>>> rev = Reverse('spam')
>>> iter(rev)
<__main__.Reverse object at 0x00A1DB50>
>>> for char in rev:
... print(char)
...
m
a
p
s
Generators
are a simple and powerful tool for creating iterators. They are written
like regular functions but use the
yield
statement whenever they want to return data. Each time
next()
is called on it, the generator resumes where it left off (it remembers all
the data values and which statement was last executed). An example shows
that generators can be trivially easy to create:
def reverse(data):
for index in range(len(data)-1, -1, -1):
yield data[index]
>>> for char in reverse('golf'):
... print(char)
...
f
l
o
g
Anything that can be done with generators can also be done with
class-based iterators as described in the previous section. What makes
generators so compact is that the
iter()
and
next()
methods are created automatically.
Another key feature is that the local variables and execution state are
automatically saved between calls. This made the function easier to write
and much more clear than an approach using instance variables like
self.index
and self.data
.
In addition to automatic method creation and saving program state, when
generators terminate, they automatically raise
StopIteration
. In combination, these features make it easy to create iterators with no
more effort than writing a regular function.
Some simple generators can be coded succinctly as expressions using a syntax similar to list comprehensions but with parentheses instead of square brackets. These expressions are designed for situations where the generator is used right away by an enclosing function. Generator expressions are more compact but less versatile than full generator definitions and tend to be more memory friendly than equivalent list comprehensions.
Examples:
>>> sum(i*i for i in range(10)) # sum of squares
285
>>> xvec = [10, 20, 30]
>>> yvec = [7, 5, 3]
>>> sum(x*y for x,y in zip(xvec, yvec)) # dot product
260
>>> unique_words = set(word for line in page for word in line.split())
>>> valedictorian = max((student.gpa, student.name) for student in graduates)
>>> data = 'golf'
>>> list(data[i] for i in range(len(data)-1, -1, -1))
['f', 'l', 'o', 'g']
Footnotes
1
Except for one thing. Module objects have a secret read-only attribute
called
dict
which returns the dictionary used to implement the module’s namespace; the
name
dict
is an attribute but not a global name. Obviously, using this violates the
abstraction of namespace implementation, and should be restricted to
things like post-mortem debuggers.
10. Brief Tour of the Standard Library


COVID-19 Dashboard
Blacklist
Whitelist
Total Infected
0
Total Deaths
0
Total Recovered
0
Mortality Rate
0
Raw Stats
Linear
Logarithmic


import { NgModule } from '@angular/core';
import { L10nDatePipe, L10nDateAsyncPipe } from '../pipes/l10n-date.pipe';
import { L10nNumberPipe, L10nNumberAsyncPipe } from '../pipes/l10n-number.pipe';
import { L10nTimeAgoPipe, L10nTimeAgoAsyncPipe } from '../pipes/l10n-time-ago.pipe';
import { L10nDateDirective } from '../directives/l10n-date.directive';
import { L10nNumberDirective } from '../directives/l10n-number.directive';
import { L10nTimeAgoDirective } from '../directives/l10n-time-ago.directive';
import { L10nIntlService } from '../services/l10n-intl.service';
@NgModule({
declarations: [
L10nDatePipe,
L10nNumberPipe,
L10nTimeAgoPipe,
L10nDateAsyncPipe,
L10nNumberAsyncPipe,
L10nTimeAgoAsyncPipe,
L10nDateDirective,
L10nNumberDirective,
L10nTimeAgoDirective
],
exports: [
L10nDatePipe,
L10nNumberPipe,
L10nTimeAgoPipe,
L10nDateAsyncPipe,
L10nNumberAsyncPipe,
L10nTimeAgoAsyncPipe,
L10nDateDirective,
L10nNumberDirective,
L10nTimeAgoDirective
],
providers: [L10nIntlService]
})
export class L10nIntlModule { }


{% extends "admin/base_site.html" %} {% load admin_static admin_modify i18n %} {% block extrahead %}{{ block.super }} {{ media }} {% endblock %} {% block extrastyle %}{{ block.super }}{% endblock %} {% block content %}
Images are rotated 90 degrees clockwise.
Note: rotation, though successful, may not appear to have worked without refreshing the page.
Click the reload arrow next to the URL bar to refresh the site. Pressing the shift key and reloading may work better on some browsers.


Place the item in front of Camera
CAPTURE
Quantity :
Add to Cart
Proceed to Checkout
Sr. No
Product ID
Name of Product
Quantity
Cost of Product
Final Cost of Product
Final Cost :


Definition: Although often used synonymously, the terms Merger and Acquisition mean slightly different things. When one company takes over another and clearly establishes itself as the new owner, the purchase is called an acquisition. From a legal point of view, the target company ceases to exist, the buyer "swallows" the business and the buyer's stock continues to be traded.
In the pure sense of the term, a merger happens when two firms agree to go forward as a single new company rather than remain separately owned and operated. This kind of action is more precisely referred to as a "merger of equals". The firms are often of about the same size. Both companies' stocks are surrendered and new company stock is issued in its place. In practice, however, actual mergers of equals don't happen very often.
Acquisitions make sense strategically when a company is trying to grow fast, enter a new market or acquire capabilities that will create a barrier to entry. As a fast growing market matures, there is likely to be consolidation of players facilitated by a series of acquisitions.
Interview Tip In practice you are unlikely to be asked to value a company for the purpose of an acquisition during an interview (in fact consultants do not do this much). However, there are two main methods to be aware of (a) Multiples and (b) Discounted Cash Flow. These are described under a separate listing.


This year we've decided to hold out conference at
the Studio Theater. Built in 1978, the Studio Theater
is a non-profit theater production company located in
Logan Cirle. This venue offers a intimate setting for
one of the most important talks of the current times.
The specific address to the venue is as follows:
1501 14th Street NW
Washington, D.C. 20005


|
headless_no_windows_needed.py
|
#!/usr/bin/env python
"""How to use pygame with no windowing system, like on headless servers.
Thumbnail generation with scaling is an example of what you can do with pygame.
NOTE: the pygame scale function uses mmx/sse if available, and can be run
in multiple threads.
"""
useage = """-scale inputimage outputimage new_width new_height
eg. -scale in.png out.png 50 50
"""
import os, sys
# set SDL to use the dummy NULL video driver,
# so it doesn't need a windowing system.
os.environ["SDL_VIDEODRIVER"] = "dummy"
import pygame.transform
if 1:
#some platforms need to init the display for some parts of pygame.
import pygame.display
pygame.display.init()
screen = pygame.display.set_mode((1,1))
def scaleit(fin, fout, w, h):
i = pygame.image.load(fin)
if hasattr(pygame.transform, "smoothscale"):
scaled_image = pygame.transform.smoothscale(i, (w,h))
else:
scaled_image = pygame.transform.scale(i, (w,h))
pygame.image.save(scaled_image, fout)
def main(fin, fout, w, h):
"""smoothscale image file named fin as fout with new size (w,h)"""
scaleit(fin, fout, w, h)
if __name__ == "__main__":
if "-scale" in sys.argv:
fin, fout, w, h = sys.argv[2:]
w, h = map(int, [w,h])
main(fin, fout, w,h)
else:
print (useage)


There are many styles of salsa dance. They can differ in many ways. Some of the ways in which they may differ are very nuanced. However, there are two primary defining characteristics:
- The traveling style
- The timing used for the break step in the basic step
The break step determines when to change directions in the basic step.
Break Step: A two step sequence in which the second step is in the opposite direction as the first.
In On1 timing, Leader will break forwards on beat one, and break backwards on beat five. Follower does the opposite, breaking back on beat one and forwards on beat five.
On1 LA Style Basic Step:
On1 basic step: Uses 8 beats to complete; with the feet alternating step on beats 1,2,3; pause on beat 4; stepping on beats 5,6,7; pausing on beat 8
Los Angeles Style is often referred to as LA Style and also as West Coast Style. LA style salsa is an eight beat dance made up of six steps and two pauses. The eight beats cover two musical bars. It is an “On1” style because its break step is on the first beat of the musical bar. Steps 4 and 8 are paused.
A common way of counting the steps over two musical bars is “1-2-3, 5-6-7”. Another common way of counting the steps is to recite "quick quick slow, quick quick slow", with each quick
taking one beat, and each slow
taking two beats. The following animation illustrates the On1 Basic Step for the Leader.
On1 Basic Step:
The following animation illustrates the On1 Basic Step for the Leader and Follower, from the perspective of Leader.
On1 Basic Step for Leader and Follower facing each other:
Some styles have their break step on the second beat of the musical bar. For this reason, many refer to such styles as “On2”. In On2 timing, Leader is breaking on beats two and six.
On2 basic step: Uses 8 beats to complete but breaking on beat two of the musical bar, equivalently on beats two and six of the eight beat count. This can be done in several ways.
Several styles utilize On2 timing, including New York Style, Mambo On2, Eddie Torres Style, Mambo Palladium Style, Classic Mambo, and Son Cubano.
How the step is counted can vary within the On2 styles. The Palladium style basic step counts its steps as "2-3-4, 6-7-8". One can also count the steps by reciting "quick quick slow, quick quick slow", with the first quick
on beat two, and a slow
step on beats 4&5, and on beats 8&1. It is like On1, but delayed a beat.
Even though Eddie Torres style uses On2 timing, it counts its steps as "1-2-3, 5-6-7", just like the classic On1 style illustrated above. If counting the steps by reciting "quick quick slow, quick quick slow", then the first quick
occurs when the leader's right foot returns to center on beat one, with a slow
step on beats 3&4 and on beats 7&8.
Another defining characteristic of a style of salsa dance is whether the dancers tend to travel along a line or circle around each other. Traveling along a line is known as “in the slot”. LA Style and New York style are “in the slot”, and are also referred to as “crossbody” styles.
On1, In the Slot:
In a circular style, the dancers revolve around each other. A workable analogy is to compare crossbody styles with West Coast Swing, whereas circular styles are akin to East Coast Swing. Cuban Style is a circular style, as is Casino Rueda Style.
Circular:
Yet other styles!
Though many of the core elements are common among styles of salsa dance, styles use their own terminology for many terms. Know that salsa dance is regional. Having a vocabulary and an eye for the component building blocks will help understand other styles. That said, be forewarned that other styles and even regions that appear similar may use a different vocabulary.
We covered just a few of the many styles of salsa dance. There are others not mentioned above, including Puerto Rican Style, Colombian Style, Cali Style, Miami Style, Cuban Style, and Ballroom Style Salsa.
More Reading
To learn more about salsa dance check out these books:
-
Illustrated Handbook of Salsa Dance: Positions
-
Illustrated Handbook of Salsa Dance: Patterns
-
Illustrated Handbook of Salsa Dance: Butterfly Patterns


| Time | Source | Team | Channel | User | Search Query | Did Find Match? | |
|---|---|---|---|---|---|---|---|
| {{entry.timestamp_utc | date:short}} | {{entry.source}} | {{entry.source_team_name}} | {{entry.source_channel_name}} | {{entry.source_user_name}} | {{entry.search_query}} | {{entry.did_find_match}} | {{entry.did_find_match}} |


 Your computer uses the DNS to look up domain names and get the associated IP address which is used to connect your computer to the destination on the internet.
One DNS server can handle all the requests from all devices. DNS servers are connected In a Distributed Hierarchy. They split up responsibility for the major domains such as .org, .com, .next, etc.
DNS was created to be an open and public communication protocol for government and educational institutions. Because of its openness, however, DNS is susceptible to cyber attacks.
An example attack is called DNS spoofing when a hacker taps into a DNS server and changes it to match a domain name with the wrong IP address. They send the user to an imposter website. To prevent this, a secure link between your computer and a website must be established using HTTPS protocols. This topic is discussed further on the next page.
Example of DNS
The image above shows the command nslookup, which shows the servers used in DNS lookup. In the example, if you look up nytimes.com, you see that the website uses four different IP addresses.
Why we use DNS
DNS is designed to make the internet accessible to human beings. The main way computers find one another is through their IP Address. Because it is difficult for the human mind to remember long lists of numbers, DNS uses letters rather than numbers and then links a precise series of letters with a precise series of numbers.
For example, instead of typing <IP_ADDRESS> into your web browser, you can just type in icann.org. There are many advantages to this system. One advantage is that a particular domain name does not have to be tied to one particular computer since the link between a certain domain and IP address can be changed quickly and easily.
Because of the constantly updating DNS infrastructure, this change will be recognized by the entire Internet within 48 hours.


| Details | |
|---|---|
| Violation No | {{ violation.violationNo }} |
| Name | |
| Team | |
| Reporter | |
| Case | {{ violation.case }} |
| Remark | {{ violation.remark }} |
| Phone | |
| {{employee.email}}
|
|
| Status | {{ employee.status === 'a' ? 'Active' : employee.status === 's' ? 'Suspended' : '-' }} |


Blade Runner
Blade Runner is a movie starring Harrison Ford, Rutger Hauer, and Sean Young. A blade runner must pursue and terminate four replicants who stole a ship in space, and have returned to Earth to find their creator.


2019 Actual Sales($)
1.7B
2020 Forecasted Sales($)
+4%
2020 Projected Inventory
+10%
2020 Forecasted($) Sales by Ebay
+5%
2020 Forecasted Global Sales($)
Forecasted Sales by Popular Stores ($M)
New Purchases
Asian Market
Europe Market
Monthly Forecasted Sales by Store and Product (Qty)
Store:
Product:
Sales: 2019 vs 2020(forecasted)
Sales Report
| Product Name | 2019 Sales($M) | 2020 ^Sales($M) | Δ |
|---|---|---|---|
| Item #1 Name | Unavailable | Nov 18 | $12 |
| Item #2 Name | New | Nov 19 | $34 |
| Item #3 Name | New | Nov 20 | -$45 |
| Item #4 Name | Unavailable | Nov 21 | $65 |
| Item #5 Name | Used | Nov 22 | $78 |
| Item #6 Name | Used | Nov 23 | -$88 |
| Item #7 Name | Old | Nov 22 | $56 |


124 Results so far
Now you can make food happen pretty much wherever you are thanks to the free easy-to-use Food Delivery & Takeout App.


{% comment %} The format is as follows. {% include components/widgets/image.html href="path/to/image" alt="description-text" %} Doesn't support adding width and height though.. {% endcomment %}


A simple library that uses only four functions. You can easily benefit from Nextion’s wide range of features and advantages in just a few easy steps.
The library uses a custom protocol that can prove to be a powerful tool for advanced users as it can be easily modified to meet one’s needs.
This is an attempt to give a very simple method to use Nextion monitors for beginners at programming and at the same time to be a strong and reliable method that can be capable of satisfying the needs of the advance programming.
The handling of Nextion should be as simple and at the same time as professional as a display of this kind deserves.
I have invested time and resources providing open source codes, like this one. Please do not hesitate to support my work!
If you found this work useful and has saved you time and effort,
just simply paypal me at this Link<EMAIL_ADDRESS>You can find more examples, tutorials and projects with Nextion on my website seithan.com or at my YouTube channel Thanasis Seitanis
.zip
fileNOTE: .HMI
files for Nextion Editor are also included in every example’s folder.
All .HMIs
are set for 2.8" Basic screens, so as to be easier to modify it for bigger screens.
begin();
writeNum();
writeStr();
readNumber();
trigger();
readStr();
Added with version 1.0.4And the public variables:
Functions for user custom command protocol
readByte();
Added with version 1.0.5easyNexReadCustomCommand()
Added with version 1.0.5cmdGroup
(Data Type: Byte)cmdLength
(Data Type: Byte)EasyNex
class#include "EasyNextionLibrary.h" // Include EasyNextionLibrary
EasyNex myNex(Serial); // Create an object of EasyNex class with the name < myNex >
// Set as parameter the Hardware Serial you are going to use
void setup(){
myNex.begin(9600); // Begin the object with a baud rate of 9600
// If no parameter was given in the begin(), the default baud rate of 9600 will be used
pinMode(LED_BUILTIN, OUTPUT); // The built-in LED is initialized as an output
}
void loop(){
myNex.NextionListen(); // This function must be called repeatedly to response touch events
// from Nextion touch panel. Actually, you should place it in your loop function.
}
void trigger0(){
[ put your code here !!!!]
}
trigger0()
function will run every time the following sequence of bytes (in HEX format) 23 02 54 00
comes to Arduino’s Serial. To do that, write in the Touch Release Event
of the button b0, this command: printh 23 02 54 00
void trigger0(){
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
if(digitalRead(LED_BUILTIN) == HIGH){
myNex.writeNum("b0.bco", 2016); // Set button b0 background color to GREEN (color code: 2016)
myNex.writeStr("b0.txt", "ON"); // Set button b0 text to "ON"
}else if(digitalRead(LED_BUILTIN) == LOW){
myNex.writeNum("b0.bco", 63488); // Set button b0 background color to RED (color code: 63488)
myNex.writeStr("b0.txt", "OFF"); // Set button b0 text to "ON"
}
}
Enjoy the Easy Nextion Library!! Please do not forget the LED on :)
/*
* FourStepExample.ino - Simple example code
* Copyright (c) 2020 Athanasios Seitanis <<EMAIL_ADDRESS>>.
* All rights reserved. EasyNextionLibrary is licensed under the MIT License
* https://opensource.org/licenses/MIT
*/
#include "EasyNextionLibrary.h" // Include EasyNextionLibrary
EasyNex myNex(Serial); // Create an object of EasyNex class with the name < myNex >
// Set as parameter the Hardware Serial you are going to use
void setup(){
myNex.begin(9600); // Begin the object with a baud rate of 9600
// If no parameter was given in the begin(), the default baud rate of 9600 will be used
pinMode(LED_BUILTIN, OUTPUT); // The built-in LED is initialized as an output
}
void loop(){
myNex.NextionListen(); // This function must be called repeatedly to response touch events
// from Nextion touch panel. Actually, you should place it in your loop function.
}
void trigger0(){
/* Create a button on Nextion
* Write in the Touch Release Event of the button
* this command: printh 23 02 54 00
* Every time the button is pressed, the trigger0() function will run
* and the code inside will be executed once
*/
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); //If LED_BUILTIN is ON, turn it OFF, or the opposite
if(digitalRead(LED_BUILTIN) == HIGH){
myNex.writeNum("b0.bco", 2016); // Set button b0 background color to GREEN (color code: 2016)
myNex.writeStr("b0.txt", "ON"); // Set button b0 text to "ON"
}else if(digitalRead(LED_BUILTIN) == LOW){
myNex.writeNum("b0.bco", 63488); // Set button b0 background color to RED (color code: 63488)
myNex.writeStr("b0.txt", "OFF"); // Set button b0 text to "ON"
}
}
The various combinations of attribute choices provide a wide range of expected behaviors with many combinations.
This combined with the Nextion Instruction Set creates the opportunity for very powerful HMIs.
NOTE:
As these commands are using the Serial port to read and write, it is more preferred not to run them in the loop() without delay(); or some other method of not running them with the frequency of the loop and use them only when it is needed.
Using them in a loop, a delay in the loop can be noticed, especially when reading from the Serial. A Serial buffer overflow can also be caused.
Also NOTE: (from the Nextion Editor Guide)
In an HMI project a page is a localized unit. When changing pages, the existing page is removed from memory and the > > requested page is then loaded into memory. As such components with a variable scope of local are only accessible while the page they are in is currently loaded. Components within a page that have a variable scope of global are accessible by prefixing the page name to the global component .objname.
As an Example:
A global Number component n0 on page1 is accessed by page1.n0 .
A local Number component n0 on page1 can be accessed by page1.n0 or n0, but there is little sense to try access a local component if the page is not loaded. Only the component attributes of a global component are kept in memory. Event code is never global in nature.
Associated Library's Code Example:
Trigger
and
FourStepExample
Description:
This is the most important function of the library.
And this is because, it gives you the ability to use the predefined functions and run your code from there.
These predefined functions are named trigger0()
, trigger1()
, trigger2()
… up to trigger50()
.
You can use them as a simple void function out of the loop, in which you will have written a block of code to run every time it is called.
You can call those trigger()
functions and run the code they contain anytime by simply writing in a Nextion Event the command: printh 23 02 54 XX
, where XX
the id for the triggerXX() in HEX.
For example in a button’s Touch Release Event, write:
| Command | Function |
|---|---|
| printh 23 02 54 00 | trigger0() |
| printh 23 02 54 01 | trigger1() |
| … | … |
| printh 23 02 54 0A | trigger10() |
| … up to | … up to |
| printh 23 02 54 32 | trigger50() |
In Arduino code, declare a void trigger()
function with the predefined name you want to use and put your code there.
Declare the void function by simply writing:
void trigger0(){
[ put your code here !!!!]
}
Example:
#include "EasyNextionLibrary.h"
EasyNex myObject(Serial);
void setup(){
myObject.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop(){
myObject.NextionListen();
}
void trigger0(){
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
}
1st NOTE: To change the predefined names of the trigger()
functions, there are details inside the trigger.cpp
file and you can add up to 255 functions of this kind.
2nd NOTE: You can send the same printh
command, to call the same function, from more than one component from any page, depending on your needs
See Appendix at the end of the document for numbers in HEX table
Parameters:
begin(unsigned long
)
unsigned long: unsigned long baud = 9600 (default) if nothing is written in the begin() function
Description:
The begin() method of the class in which we pass the initialization data to the objects.
Syntax:
myObject.begin(115200); // for baud rate 115200
Associated Library's Code Example:
ReadAndWriteNumber
Parameters:
writeNum(String
, uint32_t
)
Description:
For writing numbers in numeric attributes in components of any kind (variables, textboxes, etc.).
| Command | Result on n0 comp. | Syntax |
|---|---|---|
| n0.val=30 | Sets n0 component’s shown value to 30 | myObject.writeNum("n0.val", 30); |
| va0.val=30 | Sets va0 variable’s value to 30 | myObject.writeNum("va0.val", 30); |
| n0.bco=63488 | Sets background color to red | myObject.writeNum("n0.bco", 63488); |
| n0.font=0 | Sets font to font style with Id = 0 | myObject.writeNum("n0.font", 0); |
| n0.pco=1055 | Sets font color to blue | myObject.writeNum("n0.pco", 1055); |
| n0.format=0 | Sets value format to decimal | myObject.writeNum("n0.format", 0); |
With the same way you can change the xcen, ycen, length and isbr
TIP: In a timer component, at the attribute < en >, you can start or stop the timer by writing 0 or 1.
Also, at the attribute < tim >, you can set the time the timer is going to repeat the commands written in timer’s User-code event.
myObject.writeNum("tm0.en", 0); // 0 = stop, 1 = start
myObject.writeNum("tm0.tim", 1000); // repeat code every 1000ms
Syntax:
myObject.writeNum("n0.val", 30); // Set the value of numeric n0 to 30
myObject.writeNum("n0.bco", 63488); // Set background color of n0 to 63488(red)
myObject.writeNum("n0.font", 0); // Set font to font style with ID 0
myObject.writeNum("n0.pco", 1055); // Set font color to blue
myObject.writeNum("n0.format", 0); // Set value format to decimal
NOTE: Only attributes shown in green in the Editor can be both read and changed by user code at runtime.
Description:
Nextion DOES NOT SUPPORT float numbers. Instead, it uses integer math and does not have real or floating support.
The Xfloat component is used for signed 32-bit integer values.
The .vvs0
sets the number of digits shown to the left of the decimal (useful for leading zeros).
The .vvs1
sets the number of digits shown to the right of the decimal.
You can send Floating-point numbers with these two ways:
,
(decimal point) automatically after the last digit if attribute vvs1
is set to 1.Example:
int tempInt = temperature*10; // Convert the float to int. Multiply it x10
myNex.writeNum("x0.val", tempInt); // Write it to x0 Xfloat component on Nextion
it is obvious that if you want 2 decimal places, you will set the attribute vvs1
to 2
and you will multiply by 100
Example:
String tempString = String(temperature, 1); // Convert the float value to String, with 1 decimal place
myNex.writeStr("t0.txt", tempString); // Write the String value to t0 Textbox component
Associated Library's Code Example:
WriteTextAndCommands
Parameters:
writeStr(String
, String
). To change the .txt
attribute in components
String No1: objectname.textAttribute (example: “t0.txt” or “b0.txt”)
String No2: value (example: “Hello World”)
writeStr(String
). To send Designing and System Commands
String: The command to send on Nextion
Description:
For writing text in Nextion. The two ways the command can be used:
First Usage of the command:
Use writeStr( String
, String
) to change the text in a textbox
Use both parameters to write text in textboxes.
1st Syntax:
myObject.writeStr("t0.txt", "Hello World"); // Change t0 text to "Hello World"
Any previous text on the textbox is deleted
Avoid using very big text Strings in the same command, as Nextion will not recognise them. Istead use a second command and in order to add to the existing text, use the +
symbol, after the .textAttribute("t0.txt+")
.
myObject.writeStr("t0.txt", "You are now transferred to page2\\rThank you\\rfor choosing my library!!!");
myObject.writeStr("t0.txt+", "\\rEnjoy the library!!!");
myObject.writeStr("t0.txt+", "\\r\\rAthanasios Seitanis\\rseithagta@gmail.com");
/* By writing \\r, you send Nextion the change line character < \r >
* The second \ is required, in order to print the \ as character
* and not as an escape character.
*/
Second Usage of the command:
Use writeStr( String
) to send Designing and System Commands according to the instructions of Nextion’s Instruction Set.
Use only the first parameter to send a command to Nextion. The commands must be syntaxed according to Nextion’s Instruction Set.
2nd Syntax:
Design Commands Example:
myObject.writeStr("page page0"); // Sending this command to change the page we are on Nextion using pageName
myObject.writeStr("page 1"); // Sending this command to change the page we are on Nextion using pageId
myObject.writeStr("cir 100,100,30,RED"); // Renders a hollow Red circle with circle center at (100,100)
System Commands Example:
myObject.writeStr("dim=50"); // Set the current brightness level to 50%
myObject.writeStr("sleep=1"); // sleep=1 (Enter sleep mode) or sleep=0 (Exit sleep mode)
NOTE: When you decide to exit the sleep mode on Nextion, use a small delay of 50ms, in order to give Nextion some time to Exit sleep mode.
WARNING: DO NOT send commands that causes data return over Serial to MCU, unless you know what you are doing.
Commands that cause data return over serial:
print
, prints
, printh
, sendme
, get
, rept
, rdfile
, twfile
TIP: Write in the debug mode the command to check if it is written correctly
Associated Library's Code Example:
ReadAndWriteNumber
Parameters:
readNumber(String
)
Description:
We use it to read the value of every components’ numeric attribute from Nextion (value, bco color, pco color…etc)
In case the function fails to read the new value, it will return the number 777777
.
The reasons of getting 777777
: (from release 1.0.2 and above)
if()
statement, in which you will ignore the value of 777777
and you can run the readNumber()
again or set a safe value or use the last good known value method.uint32_t number = 0;
uint32_t lastnumber = 0;
number = myNex.readNumber("n0.val"); // We read the value of n0 and store it to number variable
if(number != 777777){ // 777777is the return value if the code fails to read the new value
lastnumber = number;
} else if(number == 777777){
number = lastNumber;
}
Syntax:
unsigned long x = myObject.readNumber("n0.val"); // Store to x the value of numeric box n0
unsigned long x = myObject.readNumber("va0.val"); // Store to x the value of the variable va0
unsigned int y = myObject.readNumber("b0.bco"); // Strore to y the color number of the background of button b0
NOTE: Only attributes shown in green in the Editor can be both read and changed by user code at runtime.
To
Associated Library's Code Example:
ReadString
Parameters:
readStr(String
)
Description:
We use it to read the value of every components’ text attribute from Nextion (txt etc…)
In case the function fails to read the new value, it will return the text ERROR
.
The reasons of getting ERROR
: (from release 1.0.4 and above)
The chances of getting a wrong value is one in a million.
You can use this, fail return value, feature in your code, in case you handle sensitive value data, to confirm that you have the right value.
You can check it with an if()
statement, in which you will ignore the value of ERROR
and you can run the readStr()
again or set a safe value or use the last good known value method.
String text = "";
String lastText = "";
text = myNex.readStr("t0.txt"); // We read the value of t0 and store it
if(text.equals("ERROR") == false){ // ERROR is the return value if the code fails to read the new value
lastText = text;
} else if(text.equals("ERROR") == true){
text = lastText;
}
Syntax:
String x = myObject.readStr("t0.txt"); // Store to x the value of text box t0
Associated Library's Code Example:
ChangePagesAndSentFloatValues
1st Variable:
currentPageId
A variable that stores the ID number of the current page loaded on Nextion. It is VERY important that Nextion and Arduino are synced and when you send data, the data goes to the right page.
NOTE: In order to update this variable with the current Id of the page, you must write the Preinitialize Event of every page: printh 23 02 50 XX
, where XX
the id of the page in HEX.
For page0: printh 23 02 50 00
for page9: printh23 02 50 09
for page10: printh 23 02 50 0A
See Appendix at the end of the document for numbers in HEX table
It can be called by writing:
int x = myObject.currentPageId; // Store to x the currentPageId
Example:
if(myObject.currentPageId == 0){
myObject.writeStr("t0.txt", "You are on page0!");
}else if(myObject.currentPageId == 1){
myObject.writeStr("t0.txt", "You are on page1!");
}
2nd Variable:
lastCurrentPageId
This variable stores the last value of currentPageId
before currentPageId
is changed. We use it to check if the page we are on has changed, in order to send refreshing screen data to the components of the page.
After that, it can be set to equal with the currentPageId
, in order not to send unnecessary data for refreshing the components.
if(myObject.currentPageId != myObject.lastCurrentPageId){
if(myObject.currentPageId == 0){
[send the data to refresh the page0]
}else if(myObject.currentPageId == 1){
[send the data to refresh the page1]
}
myObject.lastCurrentPageId = myObject.currentPageId;
}
Find more on the Library’s Example: ChangePagesAndSentFloatValues
TIP: You can read the ID of the current Loaded page at anytime, without the use of the Library’s commands using the dp
system command
int x = myObject.readNumber("dp"); // Store to x the ID of the current Loaded page
easyNexReadCustomCommand()
has a weak attribute and will be created only when user
declares this function in the main code.
More for custom protocol and commands https://seithan.com/Easy-Nextion-Library/Custom-Protocol/
Our commands will have this format: #
len
cmd
id
id2
and we must send them from Nextion as HEX with the printh command.
For example: printh 23 03 4C 01 01
#
start marker, declares that a command followslen
declares the number of bytes that will be receivedcmd
declares the task of the command or command groupid
declares the properties of the commandid2
a second property for the commandWhen we send a custom command with the above format, the function NextionListen() will capture the start marker #
and the len
(first 2 bytes) and it will wait until all the bytes of the command, as we have declared with the len
byte, arrive to the Serial buffer and inside the timeout limits.
After that, the function will read the next byte, which is the command group and the function readCommand()
takes over and through a switch command tries to match the _cmd
variable that holds the command group value with the statements of the cases.
If we do NOT have a match with the predefined, cmd
of P
for page and T
for triggers, it will continue to the default where we store the _cmd
and _len
to the public variables cmdGroup
and cmdLenght
as we are going to need access to them from the main code in the next step.
Next we call the the easyNexReadCustomCommand()
with the precondition and ONLY if we have declared the function in the main code.
From this point we can handle the assign of cmdGroup
and IDs
from the easyNexReadCustomCommand()
in the user code, where we can go on with a switch case
for the cmdGroup
, the one that we have stored the _cmd
for public use and we can call it with myObject.cmdGroup
. This is why we made cmdGroup
a public variable.
As an example, we use 2 arrays (tables) of integers, where we are going to change the value of the position (element) with custom commands.
int dataL[4] = {0,0,0,0}; //values 0 or 255, because we use only one byte
int dataS[4] = {0,0,0,0}; // values from 0 to 255, because we use only one byte
The format is the known: #
len
cmd
id
id2
id
referred to the position (element) of the array we want to write onid2
carries the value to be written on the element of array.The custom command from Nextion: printh 23 03 4C 00 0A
dataL[]
After the command is executed by our code, the values on dataL[]
array will be
Same for the dataS[] intead that cmd is the 53 in Hex for letter S
void easyNexReadCustomCommand(){
int arrayPlace; // temp variable
int value; // temp variable
switch(myNex.cmdGroup){
case 'L': // Or <case 0x4C:> If 'L' matches
// we are going to write values in specific places in the dataL[] table
// read the next byte that determines the position on the table
arrayPlace = myNex.readByte();
// read the next byte that keeps the value for the position
value = myNex.readByte();
// update the array with the new values
dataL[arrayPlace] = value;
break;
case 'S': // Or <case 0x53:> If 'S' matches
// we are going to write values in specific places in the dataS[] table
// from Nextion printh 23 03 53 00 00
// read the next byte that determines the position on the table
arrayPlace = myNex.readByte();
// read the next byte that keeps the value for the position
value = myNex.readByte();
// update the array with the new values
dataS[arrayPlace] = value;
break;
}
}
Manage Variables
You can read/write the variables as any other component.
Use readNumber()
to read the value of a numeric variable.
Example: myNex.readNumber("va0.val");
BUT: myNex.readNumber("sys0");
Use writeNum()
to change the value of a numeric variable.
Example: myNex.writeNum("va0.val", 255);
BUT: myNex.readNumber("sys0", 375);
Use readStr()
to read the text of a String variable.
Example: myNex.readStr("va0.txt");
Use writeStr()
to change the text of a String variable.
Example: myNex.writeStr("va0.txt", "Hello World");
For this to happen, the variables you want to read/write must be at the page you are currently on.
Otherwise, if the variables are of global scope, you will need to use a prefix with the page name that the variables are at.
Example:
myNex.readNumber("page0.va0.val");
// If the variable is at page0
The same goes for the other functions as well.
Tested MCUs:
readNumber()
function for faster response and more accurate reading.readByte()
function for reading Serial buffer from user codeeasyNexReadCustomCommand()
function with a weak attribute and will be created only when user declares this function in the main code. The motivation to move this function out of the library’s files, comes from Ricardo Reis thanks to his issue https://github.com/Seithan/EasyNextionLibrary/issues/15cmdGroup
and cmdLength
ONLY for read custom commands, stores the command group ID and the length of the commandTwo more examples were added.
readCommand()
from the main EasyNextionLibrary.cpp
file. A new file is created named readCustomCommands.cpp
, in order to make easier the modifications for it when using the custom protocol.readNumberFromSerial()
. When failing to read a number, we return the number 777777 instead. The cases of having a 777777 return:
This library is licensed under MIT X11 license.
Copyright © <2020> Athanasios Seitanis
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Athanasios Seitanis or the name of EasyNextionLibrary shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Athanasios Seitanis.
Also, prior written permission is required if this software or any part of it or any modifications of it, are used for commercial purposes.
By using this software, you agree with the above terms and conditions as they are.
The owner of the software has the right to change the terms of this license at any time without a prior notification.
| DEC | HEX | - | DEC | HEX | - | DEC | HEX | - | DEC | HEX |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 00 | - | 16 | 10 | - | 32 | 20 | - | 48 | 30 |
| 1 | 01 | - | 17 | 11 | - | 33 | 21 | - | 49 | 31 |
| 2 | 02 | - | 18 | 12 | - | 34 | 22 | - | 50 | 32 |
| 3 | 03 | - | 19 | 13 | - | 35 | 23 | - | 51 | 33 |
| 4 | 04 | - | 20 | 14 | - | 36 | 24 | - | 52 | 34 |
| 5 | 05 | - | 21 | 15 | - | 37 | 25 | - | 53 | 35 |
| 6 | 06 | - | 22 | 16 | - | 38 | 26 | - | 54 | 36 |
| 7 | 07 | - | 23 | 17 | - | 39 | 27 | - | 55 | 37 |
| 8 | 08 | - | 24 | 18 | - | 40 | 28 | - | 56 | 38 |
| 9 | 09 | - | 25 | 19 | - | 41 | 29 | - | 57 | 39 |
| 10 | 0A | - | 26 | 1A | - | 42 | 2A | - | 58 | 3A |
| 11 | 0B | - | 27 | 1B | - | 43 | 2B | - | 59 | 3B |
| 12 | 0C | - | 28 | 1C | - | 44 | 2C | - | 60 | 3C |
| 13 | 0D | - | 29 | 1D | - | 45 | 2D | - | 61 | 3D |
| 14 | 0E | - | 30 | 1E | - | 46 | 2E | - | 62 | 3E |
| 15 | 0F | - | 31 | 1F | - | 47 | 2F | - | 63 | 3F |