public interface Session extends Closeable
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Session.State
The state of a Session.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Initiates a shutdown of this session instance and blocks until
that shutdown completes.
|
CloseFuture |
closeAsync()
Initiates a shutdown of this session instance.
|
ResultSet |
execute(Statement statement)
Executes the provided query.
|
ResultSet |
execute(String query)
Executes the provided query.
|
ResultSet |
execute(String query,
Map<String,Object> values)
Executes the provided query using the provided named values.
|
ResultSet |
execute(String query,
Object... values)
Executes the provided query using the provided values.
|
ResultSetFuture |
executeAsync(Statement statement)
Executes the provided query asynchronously.
|
ResultSetFuture |
executeAsync(String query)
Executes the provided query asynchronously.
|
ResultSetFuture |
executeAsync(String query,
Map<String,Object> values)
Executes the provided query asynchronously using the provided values.
|
ResultSetFuture |
executeAsync(String query,
Object... values)
Executes the provided query asynchronously using the provided values.
|
Cluster |
getCluster()
Returns the
Cluster object this session is part of. |
String |
getLoggedKeyspace()
The keyspace to which this Session is currently logged in, if any.
|
Session.State |
getState()
Return a snapshot of the state of this Session.
|
Session |
init()
Force the initialization of this Session instance if it hasn't been
initialized yet.
|
ListenableFuture<Session> |
initAsync()
Initialize this session asynchronously.
|
boolean |
isClosed()
Whether this Session instance has been closed.
|
PreparedStatement |
prepare(RegularStatement statement)
Prepares the provided query.
|
PreparedStatement |
prepare(String query)
Prepares the provided query string.
|
ListenableFuture<PreparedStatement> |
prepareAsync(RegularStatement statement)
Prepares the provided query asynchronously.
|
ListenableFuture<PreparedStatement> |
prepareAsync(String query)
Prepares the provided query string asynchronously.
|
String getLoggedKeyspace()
Cluster.connect(String)
, or to the
last keyspace logged into through a "USE" CQL query if one was used.null
if the session is logged to no keyspace.Session init()
Cluster.connect()
method
to create your Session, the returned session will be already
initialized. Even if you create a non-initialized session through
Cluster.newSession()
, that session will get automatically
initialized the first time it is used for querying. This method
is thus only useful if you use Cluster.newSession()
and want to
explicitly force initialization without querying.
Session initialization consists in connecting the Session to the known
Cassandra hosts (at least those that should not be ignored due to
the LoadBalancingPolicy
in place).
If the Cluster instance this Session depends on is not itself
initialized, it will be initialized by this method.
If the session is already initialized, this method is a no-op.Session
object.NoHostAvailableException
- if this initialization triggers the
Cluster
initialization and no host amongst the contact points can be
reached.AuthenticationException
- if this initialization triggers the
Cluster
initialization and an authentication error occurs while contacting
the initial contact points.ListenableFuture<Session> initAsync()
init()
ResultSet execute(String query)
execute(new SimpleStatement(query))
.query
- the CQL query to execute.NoHostAvailableException
- if no host in the cluster can be
contacted successfully to execute this query.QueryExecutionException
- if the query triggered an execution
exception, i.e. an exception thrown by Cassandra when it cannot execute
the query with the requested consistency level successfully.QueryValidationException
- if the query if invalid (syntax error,
unauthorized or any other validation problem).ResultSet execute(String query, Object... values)
execute(new SimpleStatement(query, values))
.query
- the CQL query to execute.values
- values required for the execution of query
. See
SimpleStatement.SimpleStatement(String, Object...)
for more details.NoHostAvailableException
- if no host in the cluster can be
contacted successfully to execute this query.QueryExecutionException
- if the query triggered an execution
exception, i.e. an exception thrown by Cassandra when it cannot execute
the query with the requested consistency level successfully.QueryValidationException
- if the query if invalid (syntax error,
unauthorized or any other validation problem).UnsupportedFeatureException
- if version 1 of the protocol
is in use (i.e. if you've forced version 1 through Cluster.Builder.withProtocolVersion(com.datastax.driver.core.ProtocolVersion)
or you use Cassandra 1.2).ResultSet execute(String query, Map<String,Object> values)
execute(new SimpleStatement(query, values))
.query
- the CQL query to execute.values
- values required for the execution of query
. See
SimpleStatement.SimpleStatement(String, Map)
for more details.NoHostAvailableException
- if no host in the cluster can be
contacted successfully to execute this query.QueryExecutionException
- if the query triggered an execution
exception, i.e. an exception thrown by Cassandra when it cannot execute
the query with the requested consistency level successfully.QueryValidationException
- if the query if invalid (syntax error,
unauthorized or any other validation problem).UnsupportedFeatureException
- if version 1 or 2 of the protocol
is in use (i.e. if you've forced it through Cluster.Builder.withProtocolVersion(com.datastax.driver.core.ProtocolVersion)
or you use Cassandra 1.2 or 2.0).ResultSet execute(Statement statement)
statement
- the CQL query to execute (that can be any Statement
).NoHostAvailableException
- if no host in the cluster can be
contacted successfully to execute this query.QueryExecutionException
- if the query triggered an execution
exception, i.e. an exception thrown by Cassandra when it cannot execute
the query with the requested consistency level successfully.QueryValidationException
- if the query if invalid (syntax error,
unauthorized or any other validation problem).UnsupportedFeatureException
- if the protocol version 1 is in use and
a feature not supported has been used. Features that are not supported by
the version protocol 1 include: BatchStatement, ResultSet paging and binary
values in RegularStatement.ResultSetFuture executeAsync(String query)
executeAsync(new SimpleStatement(query))
.query
- the CQL query to execute.ResultSetFuture executeAsync(String query, Object... values)
executeAsync(new SimpleStatement(query, values))
.query
- the CQL query to execute.values
- values required for the execution of query
. See
SimpleStatement.SimpleStatement(String, Object...)
for more details.UnsupportedFeatureException
- if version 1 of the protocol
is in use (i.e. if you've forced version 1 through Cluster.Builder.withProtocolVersion(com.datastax.driver.core.ProtocolVersion)
or you use Cassandra 1.2).ResultSetFuture executeAsync(String query, Map<String,Object> values)
executeAsync(new SimpleStatement(query, values))
.query
- the CQL query to execute.values
- values required for the execution of query
. See
SimpleStatement.SimpleStatement(String, Map)
for more details.UnsupportedFeatureException
- if version 1 or 2 of the protocol
is in use (i.e. if you've forced it through Cluster.Builder.withProtocolVersion(com.datastax.driver.core.ProtocolVersion)
or you use Cassandra 1.2 or 2.0).ResultSetFuture executeAsync(Statement statement)
ResultSetFuture
.
Note that for queries that don't return a result (INSERT, UPDATE and
DELETE), you will need to access the ResultSetFuture (that is, call one of
its get
methods to make sure the query was successful.statement
- the CQL query to execute (that can be any Statement
).UnsupportedFeatureException
- if the protocol version 1 is in use and
a feature not supported has been used. Features that are not supported by
the version protocol 1 include: BatchStatement, ResultSet paging and binary
values in RegularStatement.PreparedStatement prepare(String query)
query
- the CQL query string to preparequery
.NoHostAvailableException
- if no host in the cluster can be
contacted successfully to prepare this query.PreparedStatement prepare(RegularStatement statement)
prepare(String)
,
but note that the resulting PreparedStatement
will inherit the query properties
set on statement
. Concretely, this means that in the following code:
RegularStatement toPrepare = new SimpleStatement("SELECT * FROM test WHERE k=?").setConsistencyLevel(ConsistencyLevel.QUORUM); PreparedStatement prepared = session.prepare(toPrepare); session.execute(prepared.bind("someValue"));the final execution will be performed with Quorum consistency. Please note that if the same CQL statement is prepared more than once, all calls to this method will return the same
PreparedStatement
object
but the method will still apply the properties of the prepared
Statement
to this object.statement
- the statement to preparestatement
.NoHostAvailableException
- if no host in the cluster can be
contacted successfully to prepare this statement.IllegalArgumentException
- if statement.getValues() != null
(values for executing a prepared statement should be provided after preparation
though the PreparedStatement.bind(java.lang.Object...)
method or through a corresponding
BoundStatement
).ListenableFuture<PreparedStatement> prepareAsync(String query)
prepare(String)
except that it
does not block but return a future instead. Any error during preparation will
be thrown when accessing the future, not by this method itself.query
- the CQL query string to preparequery
.ListenableFuture<PreparedStatement> prepareAsync(RegularStatement statement)
prepareAsync(String)
,
but note that the resulting PreparedStatement
will inherit the query properties
set on statement
. Concretely, this means that in the following code:
RegularStatement toPrepare = new SimpleStatement("SELECT * FROM test WHERE k=?").setConsistencyLevel(ConsistencyLevel.QUORUM); PreparedStatement prepared = session.prepare(toPrepare); session.execute(prepared.bind("someValue"));the final execution will be performed with Quorum consistency. Please note that if the same CQL statement is prepared more than once, all calls to this method will return the same
PreparedStatement
object
but the method will still apply the properties of the prepared
Statement
to this object.statement
- the statement to preparestatement
.IllegalArgumentException
- if statement.getValues() != null
(values for executing a prepared statement should be provided after preparation
though the PreparedStatement.bind(java.lang.Object...)
method or through a corresponding
BoundStatement
).prepare(RegularStatement)
CloseFuture closeAsync()
CloseFuture.force()
can be called on the result future.
This method has no particular effect if the session was already closed
(in which case the returned future will return immediately).
Note that this method does not close the corresponding Cluster
instance (which holds additional resources, in particular internal
executors that must be shut down in order for the client program to
terminate).
If you want to do so, use Cluster.close()
, but note that it will
close all sessions created from that cluster.void close()
closeAsync().get()
.
Note that this method does not close the corresponding Cluster
instance (which holds additional resources, in particular internal
executors that must be shut down in order for the client program to
terminate).
If you want to do so, use Cluster.close()
, but note that it will
close all sessions created from that cluster.close
in interface AutoCloseable
close
in interface Closeable
boolean isClosed()
close()
and wait until it returns (or call the get method on closeAsync()
with a very short timeout and check this doesn't timeout).true
if this Session instance has been closed, false
otherwise.Cluster getCluster()
Cluster
object this session is part of.Cluster
object this session is part of.Session.State getState()


Scroll Down to View the Animation
Carousel animates ... Wait few secs
SKiLLS
Programming Skills
Html
C
Java
CSS & Bootstrap
C++
Softaware Skills
Premier Pro
Power Point
Illustrator
Photoshop
Flash
Other Skills
Sketching
Poetry
Guitar
Badminton
Logo Designing
Lorium Ipsum .. i don't know whats ahead.
Download this Demo from
GITHUB


In this post we talk about three different types of CSS positioning: relative, absolute and fixed positioning. Before we begin, let's discuss the four "helper" properties that are unlocked by the position property: top, bottom, left and right.
Now let's learn about the difference between relative, absolute and fixed positioning...
An element with position: relative;
is positioned relative to it's normal position. This means that if we just give an element position:relative
it will initially seem to do nothing. In order to see it move, we also need to tell it where to go using the helper properties.
In this example below, you will see how the relatively positioned element moves when its attributes are changed. The element moves to the right and down from its original position.
Let's begin with the HTML code:
Next comes the CSS code. Note the blue box has a position of 'static'. The static position is the default position and elements will fall into this position whether static is declared or not .
From the example above we can see that the blue box is positioned underneath the orange box by default. Now let's move the orange box next to the blue one.
Here we can see the orange box has moved 100 pixels to the right and down from it's original position. Note that declaring the position of an element as relative does not affect the position of other elements.
An element with position: absolute;
is positioned relative to it's parent element. This allows us to position our element precisely where we want it. An element with position: absolute;
is removed from the normal document flow. It is positioned automatically to the starting point (top-left corner) of its parent element. If it doesn’t have any parent elements, then the initial HTML document will be its parent.
Let's add a container as the parent element:
Now let's change the position of the orange box to absolute:
Now it looks like the blue box has disappeared, but it hasn’t. The blue box behaves like the orange box is removed, so it shifts up to the orange box’s place. Now let’s move the orange box five pixels down and 5 pixels to the right:
The coordinates of an absolute positioned element are relative to its parent if the parent also has a non-static position. Otherwise, helper properties position the element relative to the initial HTML, which is what we have seen in the example above. Now let's set the position of the container to relative:
Here we move the orange box five pixels to the left from the right-most edge of the container.
An element with position: fixed;
is positioned relative only to the viewport. Like an absolutely positioned element, fixed position elements are also removed from the normal document flow. The differences are:
I'm sure you will have noticed the cat icon in the bottom right corner of your screen by now. This element has a fixed position and hence we cannot scroll away from it. See the HTML and CSS code for this below.
I hope this post has clarified the differences between relative, absolute and fixed positioning.
Try these concepts yourself to solidify your learning!


#include <usbaudio.h>
Data Fields | |
| unsigned char | bLength |
| The length of this descriptor in bytes. | |
| unsigned char | bDescriptorType |
| unsigned char | bDescriptorSubtype |
| This will be USB_DSUBTYPE_OUT_TERM for the header. | |
| unsigned char | bTerminalID |
| unsigned short | wTerminalType |
| unsigned char | bAssocTerminal |
| unsigned char | bNrChannels |
| unsigned short | wChannelConfig |
| Describes the spatial location of the logical channels. | |
| unsigned char | iChannelNames |
| unsigned char | iTerminal |
| Index of a string descriptor, describing the Output Terminal. | |
This structure describes the Input Terminal Descriptor as defined in Universal Serial Bus Device Class Definition for Audio Devices Release 1.0.
| unsigned char tACInputTerminal::bAssocTerminal |
Constant, identifying the Input Terminal to which this Output Terminal is associated.
| unsigned char tACInputTerminal::bDescriptorType |
The type of the descriptor. For an interface descriptor, this will be USB_DTYPE_CS_INTERFACE (36).
| unsigned char tACInputTerminal::bNrChannels |
Number of logical output channels in the Terminal's output audio channel cluster.
| unsigned char tACInputTerminal::bTerminalID |
Constant uniquely identifying the Terminal within the audio function. This value is used in all requests to address this Terminal.
| unsigned char tACInputTerminal::iChannelNames |
Index of a string descriptor, describing the name of the first logical channel.
| unsigned short tACInputTerminal::wTerminalType |
Constant characterizing the type of Terminal. See USB Audio Terminal Types.


访问控制（可见性）
对属性或方法的访问控制，是通过在前面添加关键字 public（公有），protected（受保
护）或 private（私有）来实现的。被定义为公有的类成员可以在任何地方被访问。被定
义为受保护的类成员则可以被其自身以及其子类和父类访问。被定义为私有的类成员则只
能被其定义所在的类访问。
属性的访问控制
类属性必须定义为公有，受保护，私有之一。如果用 var 定义，则被视为公有。
Example #1 属性声明
public;
echo $this->protected;
echo $this->private;
}
}
$obj = new MyClass();
echo $obj->public; // 这行能被正常执行
echo $obj->protected; // 这行会产生一个致命错误
echo $obj->private; // 这行也会产生一个致命错误
$obj->printHello(); // 输出 Public、Protected 和 Private
/**
* Define MyClass2
*/
class MyClass2 extends MyClass
{
// 可以对 public 和 protected 进行重定义，但 private 而不能
protected $protected = 'Protected2';
function printHello()
{
echo $this->public;
echo $this->protected;
echo $this->private;
}
}
$obj2 = new MyClass2();
echo $obj2->public; // 这行能被正常执行
echo $obj2->private; // 未定义 private
echo $obj2->protected; // 这行会产生一个致命错误
$obj2->printHello(); // 输出 Public、Protected2 和 Undefined
?>
Note: 为了兼容性考虑，在 PHP 4 中使用 var 关键字对变量进行定义的方法在 PHP
5 中仍然有效（只是作为 public 关键字的一个别名）。在 PHP 5.1.3 之前的版本，
该语法会产生一个 E_STRICT 警告。
方法的访问控制
类中的方法可以被定义为公有，私有或受保护。如果没有设置这些关键字，则该方法默认
为公有。
Example #2 方法声明
MyPublic();
$this->MyProtected();
$this->MyPrivate();
}
}
$myclass = new MyClass;
$myclass->MyPublic(); // 这行能被正常执行
$myclass->MyProtected(); // 这行会产生一个致命错误
$myclass->MyPrivate(); // 这行会产生一个致命错误
$myclass->Foo(); // 公有，受保护，私有都可以执行
/**
* Define MyClass2
*/
class MyClass2 extends MyClass
{
// 此方法为公有
function Foo2()
{
$this->MyPublic();
$this->MyProtected();
$this->MyPrivate(); // 这行会产生一个致命错误
}
}
$myclass2 = new MyClass2;
$myclass2->MyPublic(); // 这行能被正常执行
$myclass2->Foo2(); // 公有的和受保护的都可执行，但私有的不行
class Bar
{
public function test() {
$this->testPrivate();
$this->testPublic();
}
public function testPublic() {
echo "Bar::testPublic\n";
}
private function testPrivate() {
echo "Bar::testPrivate\n";
}
}
class Foo extends Bar
{
public function testPublic() {
echo "Foo::testPublic\n";
}
private function testPrivate() {
echo "Foo::testPrivate\n";
}
}
$myFoo = new foo();
$myFoo->test(); // Bar::testPrivate
// Foo::testPublic
?>
其它对象的访问控制
同一个类的对象即使不是同一个实例也可以互相访问对方的私有与受保护成员。这是由于
在这些对象的内部具体实现的细节都是已知的。
Example #3 访问同一个对象类型的私有成员
foo = $foo;
}
private function bar()
{
echo 'Accessed the private method.';
}
public function baz(Test $other)
{
// We can change the private property:
$other->foo = 'hello';
var_dump($other->foo);
// We can also call the private method:
$other->bar();
}
}
$test = new Test('test');
$test->baz(new Test('other'));
?>
以上例程会输出：
string(5) "hello"
Accessed the private method.
User Contributed Notes 24 notes
===============================================================================
INSIDE CODE and OUTSIDE CODE
label = 'Ink-Jet Tatoo Gun';
$item->price = 49.99;
?>
Ok, that's simple enough... I got it inside and out. The big problem with this
is that the Item class is COMPLETELY IGNORANT in the following ways:
* It REQUIRES OUTSIDE CODE to do all the work AND to know what and how to do it
-- huge mistake.
* OUTSIDE CODE can cast Item properties to any other PHP types (booleans,
integers, floats, strings, arrays, and objects etc.) -- another huge mistake.
Note: we did it correctly above, but what if someone made an array for $price?
FYI: PHP has no clue what we mean by an Item, especially by the terms of our
class definition above. To PHP, our Item is something with two properties
(mutable in every way) and that's it. As far as PHP is concerned, we can pack
the entire set of Britannica Encyclopedias into the price slot. When that
happens, we no longer have what we expect an Item to be.
INSIDE CODE should keep the integrity of the object. For example, our class
definition should keep $label a string and $price a float -- which means only
strings can come IN and OUT of the class for label, and only floats can come IN
and OUT of the class for price.
label and $item->price,
* by using the protected keyword.
* 2. FORCE the use of public functions.
* 3. ONLY strings are allowed IN & OUT of this class for $label
* via the getLabel and setLabel functions.
* 4. ONLY floats are allowed IN & OUT of this class for $price
* via the getPrice and setPrice functions.
*/
protected $label = 'Unknown Item'; // Rule 1 - protected.
protected $price = 0.0; // Rule 1 - protected.
public function getLabel() { // Rule 2 - public function.
return $this->label; // Rule 3 - string OUT for $label.
}
public function getPrice() { // Rule 2 - public function.
return $this->price; // Rule 4 - float OUT for $price.
}
public function setLabel($label) // Rule 2 - public function.
{
/**
* Make sure $label is a PHP string that can be used in a SORTING
* alogorithm, NOT a boolean, number, array, or object that can't
* properly sort -- AND to make sure that the getLabel() function
* ALWAYS returns a genuine PHP string.
*
* Using a RegExp would improve this function, however, the main
* point is the one made above.
*/
if(is_string($label))
{
$this->label = (string)$label; // Rule 3 - string IN for $label.
}
}
public function setPrice($price) // Rule 2 - public function.
{
/**
* Make sure $price is a PHP float so that it can be used in a
* NUMERICAL CALCULATION. Do not accept boolean, string, array or
* some other object that can't be included in a simple calculation.
* This will ensure that the getPrice() function ALWAYS returns an
* authentic, genuine, full-flavored PHP number and nothing but.
*
* Checking for positive values may improve this function,
* however, the main point is the one made above.
*/
if(is_numeric($price))
{
$this->price = (float)$price; // Rule 4 - float IN for $price.
}
}
}
?>
Now there is nothing OUTSIDE CODE can do to obscure the INSIDES of an Item. In
other words, every instance of Item will always look and behave like any other
Item complete with a label and a price, AND you can group them together and
they will interact without disruption. Even though there is room for
improvement, the basics are there, and PHP will not hassle you... which means
you can keep your hair!
===============================================================================
If you have problems with overriding private methods in extended classes, read
this:)
The manual says that "Private limits visibility only to the class that defines
the item". That means extended children classes do not see the private methods
of parent class and vice versa also.
As a result, parents and children can have different implementations of the
"same" private methods, depending on where you call them (e.g. parent or child
class instance). Why? Because private methods are visible only for the class
that defines them and the child class does not see the parent's private
methods. If the child doesn't see the parent's private methods, the child can't
override them. Scopes are different. In other words -- each class has a private
set of private variables that no-one else has access to.
A sample demonstrating the percularities of private methods when extending
classes:
overridden();
}
private function overridden() {
echo 'base';
}
}
class child extends base {
private function overridden() {
echo 'child';
}
}
$test = new child();
$test->inherited();
?>
Output will be "base".
If you want the inherited methods to use overridden functionality in extended
classes but public sounds too loose, use protected. That's what it is for:)
A sample that works as intended:
overridden();
}
protected function overridden() {
echo 'base';
}
}
class child extends base {
protected function overridden() {
echo 'child';
}
}
$test = new child();
$test->inherited();
?>
Output will be "child".
===============================================================================
Just a quick note that it's possible to declare visibility for multiple
properties at the same time, by separating them by commas.
eg:
===============================================================================
A class A static public function can access to class A private function :
foo();
}
}
$a = new A();
A::bar($a);
?>
It's working.
===============================================================================
This has already been noted here, but there was no clear example. Methods
defined in a parent class can NOT access private methods defined in a class
which inherits from them. They can access protected, though.
Example:
$method();
}
}
class ChildClass extends ParentClass {
private function privateMethod() {
echo "hi, i'm private";
}
protected function protectedMethod() {
echo "hi, i'm protected";
}
}
$object = new ChildClass();
$object->execute('protectedMethod');
$object->execute('privateMethod');
?>
Output:
hi, i'm protected
Fatal error: Call to private method ChildClass::privateMethod() from context
'ParentClass' in index.php on line 6
In an early approach this may seem unwanted behaviour but it actually makes
sense. Private can only be accessed by the class which defines, neither parent
nor children classes.
===============================================================================
Please note that protected methods are also available from sibling classes as
long as the method is declared in the common parent. This may also be an
abstract method.
In the below example Bar knows about the existence of _test() in Foo because
they inherited this method from the same parent. It does not matter that it was
abstract in the parent.
_test();
}
}
class Foo extends Base {
protected function _test() {
echo 'Foo';
}
}
$bar = new Bar();
$bar->TestFoo(); // result: Foo
?>
===============================================================================
Beware: Visibility works on a per-class-base and does not prevent instances of
the same class accessing each others properties!
bar, "\n";
}
public function setBar($value)
{
// Neccessary method, for $bar is invisible outside the class
$this->bar = $value;
}
public function setForeignBar(Foo $object, $value)
{
// this does NOT violate visibility!
$object->bar = $value;
}
}
$a = new Foo();
$b = new Foo();
$a->setBar(1);
$b->setBar(2);
$a->debugBar($b); // 2
$b->debugBar($a); // 1
$a->setForeignBar($b, 3);
$b->setForeignBar($a, 4);
$a->debugBar($b); // 3
$b->debugBar($a); // 4
?>
===============================================================================
if not overwritten, self::$foo in a subclass actually refers to parent's
self::$foo
tell_me(); // bar
$first->change_foo("restaurant");
$second->tell_me(); // restaurant
?>
===============================================================================
The code prints
test Object ( [public] => Public var [protected:protected] => protected var
[private:test:private] => Private var )
Functions like print_r(), var_dump() and var_export() prints public, protected
and private variables, but not the static variables.
===============================================================================
To make (some) object members read-only outside of the class (revisited using
PHP 5 magic __get):
reallyPrivate = 'secret';
$this->justReadOnly = 'read only';
}
function __get ($what) {
switch ($what) {
case 'justReadOnly':
return $this->$what;
default:
# Generate an error, throw an exception, or ...
return null;
}
}
function __isset ($what) {
$val = $this->__get($what);
return isset($val);
}
}
$rom = new ReadOnlyMembers();
var_dump($rom->justReadOnly); // string(9) "read only"
$rom->justReadOnly = 'new value'; // Fatal error
var_dump($rom->reallyPrivate); // Fatal error
?>
===============================================================================
I couldn't find this documented anywhere, but you can access protected and
private member varaibles in different instance of the same class, just as you
would expect
i.e.
prot = $a;
$this->priv = $b;
}
public function print_other(A $other)
{
echo $other->prot;
echo $other->priv;
}
}
class B extends A
{
}
$a = new A("a_protected", "a_private");
$other_a = new A("other_a_protected", "other_a_private");
$b = new B("b_protected", "ba_private");
$other_a->print_other($a); //echoes a_protected and a_private
$other_a->print_other($b); //echoes b_protected and ba_private
$b->print_other($a); //echoes a_protected and a_private
?>
===============================================================================
As far as it regards the properties of objects, visibility is, yes, as the
examples show.
Private, protected methods are not accessible via syntax $a->protectedVar,
however their values are still (php 5.3.26) accessible through a number of
other methods (serializing, converting to array, and nevertheless using the
ReflectionClass methods).
As it was pointed out and such as in the example below:
bar3) . "\n";
echo ($obj->bar2) . "\n";
echo ($obj->bar) . "\n";
?>
It will output:
PHP Version: 5.3.26
O:3:"Foo":3:{s:8:"Foobar";s:20:"value of private var ";s:7:"*bar2";s:22:"value
of protected var";s:4:"bar3";s:19:"value of public var";}
Foo Object
(
[bar:Foo:private] => value of private var
[bar2:protected] => value of protected var
[bar3] => value of public var
)
Array
(
[Foobar] => value of private var
[*bar2] => value of protected var
[bar3] => value of public var
)
value of public var
While the last two lines, accessing directly the private and protected object
properties (bar2 and bar), will throw out fatal errors like:
PHP Fatal error: Cannot access private property Foo::$bar
and
PHP Fatal error: Cannot access protected property Foo::$bar2
===============================================================================
Some Method Overriding rules :
1. In the overriding, the method names and arguments (arg’s) must be same.
Example:
class p { public function getName(){} }
class c extends P{ public function getName(){} }
2. final methods can’t be overridden.
3. private methods never participate in the in the overriding because these
methods are not visible in the child classes.
Example:
class a {
private function my(){
print "parent:my";
}
public function getmy(){
$this->my();
}
}
class b extends a{
private function my(){
print "base:my";
}
}
$x = new b();
$x->getmy(); // parent:my
4. While overriding decreasing access specifier is not allowed
class a {
public function my(){
print "parent:my";
}
}
class b extends a{
private function my(){
print "base:my";
}
}
//Fatal error: Access level to b::my() must be public (as in class a)
===============================================================================
access a protected property:
foo = $afoo;
}
}
?>
if you get an instance of aa and need access to $foo:
foo;
}
}
$aainstance=someexternalfunction();
$binstance=new b;
$aafoo=$binstance->getFoo($aainstance);
?>
===============================================================================
After having the how explained, many people will still be left wondering about
the why. How should the different kinds of visibility be used in practice?
Some kind of labelling for the public and private parts of an interface is
certainly necessary. We need to be clear which methods will be part of the
public interface and which are only used internally .
In older versions of php notionally-private functions were prefixed with an
underscore - a much simpler and more elegant solution to the labelling problem.
"Protected" adds clutter which affects readability. It adds a lot of
unnecessary typing to what is already a keyboard-intensive job.
As for enforcement.. no-one ever got mixed up about public/private so long as
they were clearly labelled. As such, "protected" is an attempt to solve a
problem which simply did not exist.
Private is even worse. It specifically encourages bad object-oriented code with
the use of inheritance in places where you should be thinking about separate,
co-operating objects.
A feeling that classes which inherit from each other need to hide some of their
bits from each other is a sure sign that you need to break the code up into
separate objects. This is exactly what encapsulation is for. It doesn't make
any sense to try to encapsulate bits inside an inheritance tree. Classes which
extend other classes must always be free to override whatever it is they need
to override in their parent classes.
In short, use protected if you must, do not use private at all. Do not try to
squeeze too much new functionality into an inheritance tree: create networks of
co-operating objects with clearly-defined responsibilities instead.
It's a real shame that php took the decision to implement private and
protected. They add nothing to our ability to write good quality OO code; they
simply make that code more difficult to write and to understand. Clarity and
simplicity are incredibly important in programming but now both php programmers
and php developers are stuck with these unnecessary layers of complexity.
===============================================================================
Just wanted to share a trap for the unwary. Where there are several layers of
object assignments, setting the bottom object's properties as private will
prevent its exposure. However, if the bottom object has public properties,
intermediate objects which are themselves set as private but are derived from
the bottom object can inadvertently be exposed to updates.
This follows logically from the reference model in php ( http://php.net/manual/
en/language.oop5.references.php ), but can yield a result that is surprising
until one gets the reference model. The following example demonstrates the
phenomenon.
// underlying class for offering database results to other objects
// __construct method yields public results -- bottom object in example
class database_result {
public $column1;
public function __construct() {
// . . . database access . . .
$this->column1 = 'foo';
}
}
// application dictionary accesses database and caches results
// for application objects -- this is the second layer in the example
class dictionary {
private $reference_object;
public function __construct (){
$this->reference_object = new database_result;
}
public function get_reference_object() {
return ( $this->reference_object );
}
}
$dictionary = new dictionary;
/* $dictionary->reference_object cannot be accessed directly
* $dictionary->reference_object->column1 = 'foochanged';
* yields Fatal error: Cannot access private property
dictionary::$reference_object in /var/www/html/index.php . . .
*/
$pointer_to_dictionary = $dictionary;
/*
* if assign $dictionary to new variable, the new variable is a pointer and its
properties are still private
* $pointer_to_dictionary->reference_object->column1 = 'foochanged';
* Fatal error: Cannot access private property dictionary::$reference_object in
/var/www/html/index.php . . .
* $pointer_to_dictionary = $dictionary->reference_object;
* Fatal error: Cannot access private property dictionary::$reference_object in
/var/www/html/index.php . . .
*/
// now set up a client class that will use a working copy of the dictionary --
this is the third layer in the example
class dictionary_user {
private $pointer_to_dictionary;
public function __construct () {
global $dictionary;
// $this->pointer_to_dictionary = $dictionary->reference_object;
// Fatal error: Cannot access private property
dictionary::$reference_object in /var/www/html/index.php . . .
// still cannot directly access dictionary properties even in this
context, except through getter
$this->pointer_to_dictionary = $dictionary->get_reference_object();
}
// however, can now operate on dictionary through the pointer
public function set_pointer_to_dictionary ( $value ) {
$this->pointer_to_dictionary->column1 = $value;
}
public function get_pointer_to_reference_object(){
return ($this->pointer_to_dictionary);
}
}
$dictionary_user = new dictionary_user;
$dictionary_user->set_pointer_to_dictionary ( 'foochanged' );
echo ('
');
var_dump ( $dictionary_user->get_pointer_to_reference_object()); echo '
';
// object(database_result)#2 (1) { ["column1"]=> string(10) "foochanged" } --
of course, the user object is changed
var_dump ( $dictionary->get_reference_object() );
// object(database_result)#2 (1) { ["column1"]=> string(10) "foochanged" } --
however, the private dictionary object is also now corrupted!
// Note: If the underlying database result object $column1 as private, this
will cause set_pointer_to_dictionary to generate the usual fatal error
// but making the bottom object private may defeat its purpose of exposing
results.
===============================================================================
I want to merge notes from different comments about visibility of class members
from parent class / sibling class point of view because visibility rules are
similar. Here are main points:
1. Methods declared in parent class can access some child class members.
2. Class can access some sibling class members using methods declared in
common parent. NB: only inherited not-overridden parent method could be used,
if you override it in current class you have to call parent method statically
to get access to sibling members.
You can see list of members that could be accessed via these methods below:
- inherited protected / private property – OK;
- inherited protected / private method without overriding – OK;
- inherited protected method with overriding – OK;
- inherited private method with overriding – FAIL, original parent method will
be called;
- own protected property / method – OK;
- own private property / method – FAIL, critical error.
===============================================================================
Interestingly enough, PHP does very reasonable job in regards to interaction
between classes and plain functions (even ones defined in the same file as the
class)
bar(); // works
$test->foo(); // works
}
}
function simple_function() {
$test = new Test();
$test->bar(); // does not work
$test->foo(); // does not work
Test::foobar($test); // works
}
simple_function();
?>
===============================================================================
private , $this->public\n";
}
}
class B extends A
{
function __construct()
{
$this->private = 2;
$this->public = 2;
}
function set()
{
$this->private = 3;
$this->public = 3;
}
function get()
{
return parent::get() . "B: $this->private , $this->public\n";
}
}
$B = new B;
echo $B->get();
echo $B->set();
echo $B->get();
?>
?>
Result is
A: 1 , 2
B: 2 , 2
A: 1 , 3
B: 3 , 3
This is correct code and does not warn you to use any private.
"$this->private" is only in A private. If you write it in class B it's a
runtime declaration of the public variable "$this->private", and PHP doesn't
even warn you that you create a variable in a class without declaration,
because this is normal behavior.
===============================================================================
Private or not private?
I get baffled whenever I see this kind of an example.
things = $things;
}
public function getThing($obj){
return $obj->things;
}
}
class smallVessel{
private $things = array();
public function setThing($things){
$this->things = $things;
}
public function getThing($obj){
return $obj->things;
}
}
$basket = new vessel();
$bucket = new vessel();
$bowl = new smallVessel();
$basket->setThing(array('wine' , 'water' , 'sugar'));
// returns the contents inside basket unexpectedly
print_r($bucket->getThing($basket));
// returns error, quite rightly so!
print_r($bowl ->getThing($basket));
===============================================================================
If you miss the "package" keyword in PHP in order to allow access between
certain classes without their members being public, you can utilize the fact,
that in PHP the protected keyword allows access to both subclasses and
superclasses.
So you can use this simple pattern:
$pName;
}
protected function invokeMethod ($pObj, $pName, $pArgs) {
return call_user_func_array(array($pObj, $pName), $pArgs);
}
}
?>
The classes that should be privileged to each other simply extend this
dispatcher:
name = $pName;
$this->phoneNumbers = array();
}
public function addNumber (PhoneNumber $pNumber, $pLabel) {
$this->phoneNumbers[$pLabel] = $pNumber;
// this does not work, because "owner" is protected:
// $pNumber->owner = $this;
// instead, we get a reference from the dispatcher:
$p =& $this->accessProperty($pNumber, "owner");
// ... and change that:
$p = $this;
}
public function call ($pLabel) {
// this does not work since "call" is protected:
// $this->phoneNumbers[$pLabel]->call();
// instead, we dispatch the call request:
$this->invokeMethod($this->phoneNumbers[$pLabel], "call", array());
}
}
class PhoneNumber extends Dispatcher {
private $countryCode;
private $areaCode;
private $number;
protected $owner;
public function __construct ($pCountryCode, $pAreaCode, $pNumber) {
$this->countryCode = $pCountryCode;
$this->areaCode = $pAreaCode;
$this->number = $pNumber;
}
protected function call () {
echo("calling " . $this->countryCode . "-" . $this->areaCode . "-"
. $this->number . "\n");
}
}
$person = new Person("John Doe");
$number1 = new PhoneNumber(12, 345, 67890);
$number2 = new PhoneNumber(34, 5678, 90123);
$person->addNumber($number1, "home");
$person->addNumber($number2, "office");
$person->call("home");
?>
Without this pattern you would have to make $owner and call() public in
PhoneNumber.
Best regards,
===============================================================================
class MyClass
{
public $public = 'Public';
protected $protected = 'Protected';
private $private = 'Private';
function printHello()
{
echo $this->public;
echo $this->protected;
echo $this->private;
}
}
$obj = new MyClass();
print_r($obj)
it gives me the value of all variables
How can I hide this?
===============================================================================
I believe
in example 2 should be
.
===============================================================================
A useful extension to Example #2:
testPublic();
self::testPublic();
$this->testProtected();
self::testProtected();
$this->testPrivate();
self::testPrivate();
}
public function testPublic() {
echo "Base::testPublic\n";
}
protected function testProtected() {
echo "Base::testProtected\n";
}
private function testPrivate() {
echo "Base::testPrivate\n";
}
}
class Ext extends Base
{
public function testPublic() {
echo "Ext::testPublic\n";
}
protected function testProtected() {
echo "Ext::testProtected\n";
}
private function testPrivate() {
echo "Ext::testPrivate\n";
}
}
$ext = new Ext();
$ext->test();
// gives:
// Ext::testPublic
// Ext::testProtected
// Base::testPrivate
?>


We are here to answer any questions you may have about our service experiences. Reach out to us and we'll respond as soon as we can.
Even if there is phone you want to have and can't find it in our offers, let us know and we promise we'll do our best to find it for you.


- System Analyzer
- A unified web interface to trace, debug and analyse patterns of how Maps/ICs are created in the real world applications.
- Callstats
- Visualize and compare runtime call stats.
- Heap Stats
- Visualize heap memory usage.
- Heap Layout
- Visualize heap memory layout.
- Parse Processor
- Analyse parse, compile and first-execution.
- Profview
- Fancy sampling profile viewer.
- Turbolizer
- Visualise the sea of nodes graph generated by TurboFan.
- Zone Stats
- Analyse zone memory usage.


Looking for mobile first, tiny foot print, fast, scaleable, flexible and pluggable...
This 4.7KB small HSB color picker is based on a subset of colors.js from it's big brother colorPicker, supports all modern features like touch and MS pointer, GPU accelerated rendering, battery friendly requestAnimationFrame and provides a lot of hooks for developers to write plugins (See demo plugins below in Demo).
$('.color').colorPicker();
Switch between plugins: (see index.html for more details...)
There is only one file you need to load... No images and no CSS required.

Tiny jQuery colorPicker only loads into memory if triggered to show and auto repositiones inside view-port if it doesn't fit. It uses battery saving technologies, super fast rendering for best performance on desktop and mobile browsers and renders perfectly smooth on retina and high resolution displays.
This colorPicker is very flexible to modify and customize and there is an easy way to write plugins to extend functionality, look and feel...
As Tiny jQuery colorPicker uses colors.js from it's big brother colorPicker, it provides a clean and rich color model and API that enables flexible extending for programmers. (See colorPicker on GitHub for more details)
The following snipped shows how easy it is to make plugins: use for mobile
window.myColorPicker = $('input.color').colorPicker({ buildCallback: function($elm) { $elm.prepend('

'); }, cssAddon: '.cp-disp {padding:10px; margin-bottom:6px; font-size:19px; height:20px; line-height:20px}' + '.cp-xy-slider {width:200px; height:200px;}' + '.cp-xy-cursor {width:16px; height:16px; border-width:2px; margin:-8px}' + '.cp-z-slider {height:200px; width:40px;}' + '.cp-z-cursor {border-width:8px; margin-top:-8px;}' + '.cp-alpha {height:40px;}' + '.cp-alpha-cursor {border-width:8px; margin-left:-8px;}', renderCallback: function($elm, toggled) { var colors = this.color.colors, rgb = colors.RND.rgb; $('.cp-disp').css({ backgroundColor: '#' + colors.HEX, color: colors.RGBLuminance > 0.22 ? '#222' : '#ddd' }).text('rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + (Math.round(colors.alpha * 100) / 100) + ')'); } });
Will follow... See tinyColorPicker on GitHub for now.


You've got to be able to get along with other people when you're in a learning or programming environment. People have different values, and regardless of your values and their values, you still need to be able to get along with them and get the job done. Empathy is important, as you can't just charge in and expect the other people in your team to be on the same page as you. They may have things going on in their lives which mean they are not in the best zone, and you've got to be able to recognise that and work with it. This leads on to self awareness, being aware to the fact that perhaps you went charging on into the work zone without consideration that your team mates dog just passed away, they're not in the work zone obviously, yet you displayed no self awareness to the fact that you just went straight into work mode and expected them to do the same.
I don't recall there being anything terribly surprising in the core learning... I'm sure if it was surprising I'd recall it, and would be my 'go to' surprise to write about...
There'd be plenty of people out there who are quite happy beavering away on the laptop in their dark bedroom turning out code that NASA would be proud of, yet those same people often lack the skills to get their code to NASA. They often lack human interaction skills, the ability to communicate, the ability to work in a team. These days, it's all about the customer, you need to be able to work with the customer, communicate with the customer, and hear the customer. From an employers point of view, I'd rather employ someone with very basic coding ability, but who is personable, who is friendly and professional, and who is open to learning, and can demonstrate that they are teachable, the person that knows that they don't know everything...
Some of it was repetitious in that I've done plenty of this sort of thing already. However, I wouldn't say it was a waste of time, as it didn't use up much time. There were definitely aspects that were worth doing, the refreshers on Neuroplasticity and how people learn, and this is something I've been interested in for years anyway. It draws me back to high school when we had Lance King do workshops with us, and I still recall and use many takeaways from his workshops.


The server has requested that an Origin Policy is applied to this origin, but it is not currently serving a suitable policy.


--- notes: | Display a notice for different things ---
This job runs on our legacy infrastructure. Read more about upgrading in our docs


Minerals are naturally occurring, inorganic, crystalline solids having a definite chemical composition and characteristic physical properties.
An ore is a mineral or combination of minerals from which a useful substance, such as a metal, can be extracted and used to manufacture a useful product.


I started my coding journey back in college, when I realized that designing websites wasn’t fun enough, so that’s when I decided to learn how to code so I could build my own website from scratch. Writing code is like a puzzle to me, where I can play all day solving problems and putting the pieces together. I am creative, detail-oriented, highly organized, and have a desire to learn about continuing developments in the field. Being surrounded by people with the same passion and ambitious as me made me more hungry to learn and to be a better developer. Today I am grateful for the opportunity and support I had to learn and develop my coding skills.
Singlecore is a platform for Customer Service Software for any organization.
Languages Used: HTML5, CSS3, Javascript and Bootstrap. Responsive Website.Yoga Natura Vida is a place where they welcome guests and visitors to practice yoga in a beautiful temple.
Languages Used: HTML5, CSS3 and SASS, Responsive Website.Fresh Salmon restaurant and some history behind their food.
Languages Used: HTML5, CSS3, JavaScript. Responsive Website.Dietitian is a nutritian blog where you can find information about healthy food.
Languages Used: HTML5, CSS3, JavaScript, Responsive Website.Massage Zen is a massage place that is committed to providing the ideal environment for you to receive a quality massage at an affordable price.
Languages Used: HTML5, CSS3, JavaScript, Responsive Website.BeCoffee Shop is your go-to neighborhood joint, any time, any day.
Languages Used: HTML5, CSS3, JavaScript, Responsive Website.Tasty & Healthy is a healthy food restaurant that can provide a fast delivery to their customer.
Languages Used: HTML5, CSS3, JavaScript.Website thats is for sell ready-to-assemble furniture, kitchen appliances and home accessories.
Languages Used: HTML5, CSS3, CSS Grid Technique.Marina is a website for people who would like to plan a trip, find activities and adventure at the marina.
Languages Used: HTML5, CSS3, JavaScript.Main area of expertise is front-end development. and everything related to web functionality. Using HTML, CSS , and Javascript, I build fast and interactive websites. My passion is to bring ideas and layout to life from scratch and my focus is to create responsive websites of a high quality.
I am experienced working in the Adobe Creative Suite and have a strong understanding of design fundamentals. I have eyes for detail and a significant understanding of typography, layout, design and web development capabilities.


{% block pageMeta %}{% endblock %}
Skip to main content
beta
This is a new service
give us feedback
.
Go to the homepage of the public registers and datasets service.
Public registers and datasets
Menu
Businesses
Personal licences
Premises
Datasets
{% block heroContent %}{% endblock %}
{% block beforeContent %}{% endblock %}
{% block content %}{% endblock %}


Reports any instance variables which may safely be made
static
. A field may be static if it is declared
final
, and is initialized with a constant.
Example:
public final String str = "sample";


Viewport
1.6
Type
:: ( Name | =
"Viewport"
)
1.6
BBox
:: Rectangle , required
1.6
Measure
:: Dictionary
MeasureRL
or Dictionary
MeasureGEO
1.6
Name
:: Text
2.0
PtData
:: Dictionary
PointData


Review the sourcecode of the JavaScript-file, then open up the console in the developer tool to do the magic to hide/show individual parts of the SVG-image.
This example does not work since the resource is loaded later. The JavaScript needs to execute om document ready to make this example with external resource work.


Alert
Basic usage
boottoast.alert("This is a simple toast!");
Basic usage, using options object
boottoast.alert({
message: "This is a toast with config options!",
title: "Big title",
smallTitle: "11 min ago",
delay: 5000 });
Basic usage, using all options object
boottoast.alert({
message: "This is a toast with config options!",
title: "Big title",
smallTitle: "11 min ago",
// additional class string applied to the top level dialog
className: null,
// whether or not to include a close button
closeButton: true,
// dialog container
container: "body",
// Horizontal placement: left, right, only works for first time when create container
horizontalPlacement: "left",
// Vertical placement: top, bottom, right, only works for first time when create container
verticalPlacement: "bottom",
// Delay hiding the toast (ms)
delay: 2000
});
Primary
Basic usage
boottoast.primary("This is a simple toast!");
// or
boottoast.primary({
message: "This is a toast with config options!",
title: "Big title",
smallTitle: "11 min ago",
delay: 5000
});
Secondary
Basic usage
boottoast.secondary("This is a simple toast!");
// or
boottoast.secondary({
message: "This is a toast with config options!",
title: "Big title",
smallTitle: "11 min ago",
delay: 5000
});
Success
Basic usage
boottoast.success("This is a simple toast!");
// or
boottoast.success({
message: "This is a toast with config options!",
title: "Big title",
smallTitle: "11 min ago",
delay: 5000
});
Danger
Basic usage
boottoast.danger("This is a simple toast!");
// or
boottoast.danger({
message: "This is a toast with config options!",
title: "Big title",
smallTitle: "11 min ago",
delay: 5000
});
Warning
Basic usage
boottoast.warning("This is a simple toast!");
// or
boottoast.warning({
message: "This is a toast with config options!",
title: "Big title",
smallTitle: "11 min ago",
delay: 5000
});
Info
Basic usage
boottoast.info("This is a simple toast!");
// or
boottoast.info({
message: "This is a toast with config options!",
title: "Big title",
smallTitle: "11 min ago",
delay: 5000
});
Light
Basic usage
boottoast.dark("This is a simple toast!");
// or
boottoast.dark({
message: "This is a toast with config options!",
title: "Big title",
smallTitle: "11 min ago",
delay: 5000
});
Dark
Basic usage
boottoast.dark("This is a simple toast!");
// or
boottoast.dark({
message: "This is a toast with config options!",
title: "Big title",
smallTitle: "11 min ago",
delay: 5000
});


Introduction¶
In the previous chapters we talked about Simplex Projection, a forecasting technique that looks for similar trends in the past to forecast the future by computing for nearest neighbors on an embedding. In this chapter, we discuss Convergent Cross Mapping (CCM) also formulated by Sugihara et al., 2012 as a methodology that uses ideas from Simplex Projection to identify causality between variables in a complex dynamical system (e.g. ecosystem) using just time series data.
We will go through the key ideas of CCM, how it addresses the limitations of Granger causality, and the algorithm behind it. We will then test the CCM framework on simulated data where we will deliberately adjust the influence of one variable over the other. Finally, we will apply CCM on some real world data to infer the relationships between variables in a system.
causal-ccm Package¶
ccm_sugihara.ipynb
explains the CCM methodology in detail. If you wish to apply this in your own projects, install the framework using pip install causal-ccm
. See using_causal_ccm_package.ipynb
notebook for details how to use.


Frequency Lists
Frequency lists, i.e. lists of the most frequently used words or phrases, have several purposes. Some language learners use them to decide what vocabulary to learn first. In the context of accessibility, they can used in processes for producing easy-to-read texts or in processes for evaluating the readability of texts. (Readability encompasses more than just vocabulary or word frequency.)
Frequency lists should be based on a corpus. Today, an electronic corpus of a million words is considered small. This page gives a non-exhaustive overview of frequency lists, organised by language or language family. Many important or “big” languages are missing from this overview due to the absence of frequency dictionaries or lists that are based on a sufficiently large corpus. For example, the following languages—each with 60 million or more native speakers—are missing: Hindi, Bengali, Punjabi, Javanese, Malay, Telugu, Vietnamese, Marathi, Tamil, Urdu and Italian. For example, the Italian English Frequency Dictionary - Essential Vocabulary: 2500 Most Used Words & 421 Most Common Verbs by J. L. Laide does not provide any information on whether it was based on a corpus. The Frequency Dictionary of Italian Words by Alphonse Juilland dates from 1973 and is probably out of date. The frequency lists listed on Wiktionary are based on very limited corpora (e.g. just subtitles). Lexiteria has frequency lists with the top 200 words for 40 languages; they may be able to produce longer lists on demand.
Frequency Lists for English
- Davies, Mark; Gardner, Dee:
A Frequency Dictionary of Contemporary American English: Word Sketches, Collocates and Thematic Lists.
Routledge, 2010. (368 pages)
ISBN<PHONE_NUMBER>634.
5,000 most frequently used words;based on data from a 385 million word corpus
. - Quasthoff, Uwe; Fielder, Sabine; Hallsteinsdóttir, Erla:
Frequency Dictionary English.
Leipziger Universitätsverlag, 2012. (110 pages and a CD-ROM)
ISBN 978-3-86583-654-0.
Most frequent 1,000 words; the CD-ROM provides a longer list; no information about the size of the corpus upon which the frequency list is based. - Word frequency data: Corpus of Contemporary American English. 5,000-60,000 word lists, based on the 450 million word Corpus of Contemporary American English (COCA).
- Audience Dialogue: Sustainable English - a vocabulary: list of the 15,000 commonest words, based on the 100 million word British National Corpus (BNC). See also Word frequencies in English.
-
subtlex-word-frequencies:
200,000 words sorted by frequency of use in spoken English
. The frequency is based onSUBTLEX US, a corpus of subtitles from English-language movie
. - Kaufman, Josh:
google-10000-english:
This repo contains a list of the 10,000 most common English words in order of frequency, as determined by n-gram frequency analysis of the Google's Trillion Word Corpus.
This is not entirely orginal work:This repo is derived from Peter Norvig's compilation of the 1/3 million most frequent English words.
Frequency Lists for Other Germanic Languages
- Tiberius, Carole; Schoonheim, Tanneke:
A Frequency Dictionary of Dutch: Core Vocabulary for Learners.
Routledge, 2014. (310 pages)
ISBN<PHONE_NUMBER>806.
5,000 most frequently used words.Based on a 290 million word corpus which includes both written and spoken material
. Also covers Belgian Dutch. See also the app on Google Play: A Frequency Dictionary of Dutch: Core Vocabulary for Learners. - Tschirner, Erwin, Jones, Randall:
A Frequency Dictionary of German: Core Vocabulary for Learners.
Routledge, 2006. (190 pages)
ISBN<PHONE_NUMBER>330.
4,034 most frequently used words.Based on a 4.2 million-word corpus which is evenly divided between spoken, fiction and non-fiction texts
. See also the app on Google Play: A Frequency Dictionary of German: Core Vocabulary for Learners. - Quasthoff, Uwe; Fielder, Sabine; Hallsteinsdóttir, Erla:
Frequency Dictionary German - Häufigkeitswörterbuch Deutsch.
Leipziger Universitätsverlag, 2011. (115 pages and a CD-ROM)
ISBN 978-3-86583-509-3.
Most frequent 1,000 words; the CD-ROM provides a longer list; no information about the size of the corpus upon which the frequency list is based. - Quasthoff, Uwe; Fielder, Sabine; Hallsteinsdóttir, Erla:
Frequency Dictionary Icelandic - Íslensk tiðniorðabók.
Leipziger Universitätsverlag, 2012. (109 pages and a CD-ROM)
ISBN 978-3-86583-656-4.
Most frequent 1,000 words; the CD-ROM provides a longer list; no information about the size of the corpus upon which the frequency list is based.
Frequency Lists for Chinese Languages
- Xiao, Richard; Rayson, Paul; McEnery, Tony:
A Frequency Dictionary of Mandarin Chinese: Core Vocabulary for Learners.
Routledge, 2009. (390 pages)
ISBN<PHONE_NUMBER>862.
5,000 most common words and 2,000 most common simplified Chinese characters.Based on a fifty-million-word corpus composed of spoken, fiction, non-fiction and news texts in current use
. - Dew, James Erwin: 6000 Chinese Words: A Vocabulary Frequency Handbook. Cheng & Tsui. (Out of print; see mention on the Linguist List, 31 March 2002.
- Jun Da:
Frequency statistics 频率统计.
(Character frequencies, not word frequencies.) - Tsai, Chih-Hao:
Frequency and Stroke Counts of Chinese Characters.
01.01.1996, updated 03.08.2005.
Frequency of usage of the 13,060 (Traditional) Chinese characters defined in the Big5 coding scheme.
Frequency Lists for Romance Languages
- Quasthoff, Uwe; Fielder, Sabine; Hallsteinsdóttir, Erla:
Frequency Dictionary Esperanto - Oftecvortaro de Esperanto.
Leipziger Universitätsverlag, 2014. (115 pages and a CD-ROM)
ISBN 978-3-86583-880-3.
Most frequent 1,000 words; the CD-ROM provides a longer list; no information about the size of the corpus upon which the frequency list is based. - Quasthoff, Uwe; Fielder, Sabine; Hallsteinsdóttir, Erla:
Frequency Dictionary French - Dictionnaire de fréquence du français.
Leipziger Universitätsverlag, 2013. (121 pages and a CD-ROM)
ISBN 978-3-86583-774-5.
Most frequent 1,000 words; the CD-ROM provides a longer list; no information about the size of the corpus upon which the frequency list is based. - Lonsdale, Deryle; Le Bras, Yvon:
A Frequency Dictionary of French: Core Vocabulary for Learners.
Routledge, 2009. (310 pages).
ISBN<PHONE_NUMBER>311.
5,000 most commonly used words.Based on a 23-million-word corpus of French which includes written and spoken material both from France and overseas
. See also the app on Google Play: A Frequency Dictionary of French: Core Vocabulary for Learners. - Davies, Mark; Raposo Preto-Bay, Ana Maria:
A Frequency Dictionary of Portuguese.
Routledge, 2008. (342 pages).
ISBN<PHONE_NUMBER>970.
5,000 most commonly used words.Based on a twenty-million-word collection of Portuguese (taken from both Portuguese and Brazilian sources)
. See also the app on Google Play: A Frequency Dictionary of Portuguese. - Davies, Mark:
A Frequency Dictionary of Spanish: Core Vocabulary for Learners.
Routledge, 2006. (286 pages).
ISBN<PHONE_NUMBER>297.
5,000 most commonly used words.Based on a twenty million word corpus evenly divided between spoken, fiction and non-fiction texts from both Spain and Latin America
. See also the app on Google Play: A Frequency Dictionary of Spanish: Core Vocabulary for Learners.
Frequency Lists for Slavic Languages
- Cermák, František; Kren, Michal:
A Frequency Dictionary of Czech: Core Vocabulary for Learners.
Routledge, 2011. (286 pages)
ISBN<PHONE_NUMBER>628.
5,000 most commonly used words.Based on data from a 100 million word corpus and evenly balanced between spoken, fiction, non-fiction and newspaper texts
. - Knowles, F. E.:
A word-frequency dictionary of Polish journalistic texts.
Birmingham: Department of Modern Languages, University of Aston, 1981.
Probably out of date. See entry in WorldCat. - McEnery, Tony; Lewandowska-Tomaszczyk, Barbara; Rayson, Paul:
A Frequency Dictionary of Polish: Core Vocabulary for Learners.
Routledge, 2006.
Out of print; no further details available. See entry in OpenISBN and entry on GoodReads. - Sharoff, Serge; Umanskaya, Elena; Wilson, James:
A Frequency Dictionary of Russian: Core Vocabulary for Learners.
Routledge, 2013. (390 pages)
ISBN<PHONE_NUMBER>420.
5,000 most commonly used words; 300 most frequent multiword constructions;based on data from a 150-million-word internet corpus taken from more than 75,000 webpages
. See also the app on Google Play: A Frequency Dictionary of Russian: Core Vocabulary for Learners. - Quasthoff, Uwe; Fielder, Sabine; Hallsteinsdóttir, Erla:
Frequency Dictionary Russian - Частотный словарь русского языка.
Leipziger Universitätsverlag, 2017. (117 pages and a CD-ROM)
ISBN 978-3-96023-103-5.
Most frequent 1,000 words; the CD-ROM provides a longer list; no information about the size of the corpus upon which the frequency list is based. - Quasthoff, Uwe; Fielder, Sabine; Hallsteinsdóttir, Erla:
Frequency Dictionary Ukrainian - Частотний словник української мови.
Leipziger Universitätsverlag, 2016. (125 pages and a CD-ROM)
ISBN 978-3-96023-008-3.
Most frequent 1,000 words; the CD-ROM provides a longer list; no information about the size of the corpus upon which the frequency list is based.
Frequency Lists for Finno-Ugric Languages
- Suakkonen, Pauli; et al.: Suomen kielen taajuussanasto [A frequency dictionary of Finnish]. Porvoo: Werner Söderström, 1979. (536 pages; contains English summary) Entry in WorldCat (no information on corpus size; probably out of date).
- Quasthoff, Uwe; Fielder, Sabine; Hallsteinsdóttir, Erla:
Frequency Dictionary Hungarian - Magyar gyakorisági szótár.
Leipziger Universitätsverlag, 2013. (123 pages and a CD-ROM)
ISBN 978-3-86583-806-3.
Most frequent 1,000 words; the CD-ROM provides a longer list; no information about the size of the corpus upon which the frequency list is based.
Frequency Lists for Austronesian Languages
- Quasthoff, Uwe; Fielder, Sabine; Hallsteinsdóttir, Erla:
Frequency Dictionary Indonesian - Kamus Frekuensi Bahasa Indonesia.
Leipziger Universitätsverlag, 2015. (109 pages and a CD-ROM)
ISBN 978-3-86583-965-7.
Most frequent 1,000 words; the CD-ROM provides a longer list; no information about the size of the corpus upon which the frequency list is based.
Frequency Lists for Indo-Iranian Languages
- Miller, Corey; Aghajanian-Stewart, Karineh:
A Frequency Dictionary of Persian: Core vocabulary for learners.
Routledge, 2017. (346 pages)
ISBN<PHONE_NUMBER>241.
5,000 most frequently used words.Based on a 150 million word corpus of written and spoken Persian texts from the Iranian world
.
Frequency Lists for Semitic Languages
- Buckwalter, Tim; Parkinson, Dilworth:
A Frequency Dictionary of Arabic: Core Vocabulary for Learners.
Routledge, 2011. (580 pages)
ISBN<PHONE_NUMBER>347.
5,000 entries.Based on a 30-million-word corpus of Arabic which includes written and spoken material from the entire Arab world
.
Frequency Lists for Turkic Languages
- Aksan, Yeşim; Aksan, Mustafa; Mersinli, Ümit; Demirhan, Umut Ufuk:
A Frequency Dictionary of Turkish.
Routledge, 2017. (350 pages)
ISBN<PHONE_NUMBER>670.
5,000 entries.Based on a 50 million word corpus
.
Frequency Lists for Language Isolates
- Tono, Yukio; Yamazaki, Makoto; Maekawa, Kikuo:
A Frequency Dictionary of Japanese.
Routledge, 2013. (374 pages)
ISBN<PHONE_NUMBER>131.
5,000 most commonly used words.Based on a100 million word corpus, composed of spoken, fiction, non-fiction and news texts in current use
. See also the app on Google Play: A Frequency Dictionary of Japanese. - Kelly, Charles: A 15,000 Japanese Word Frequency List.
- Lee, Sun-Hee; Jang, Seok Bae; Seo, Sang Kyu:
A Frequency Dictionary of Korean: Core Vocabulary for Learners.
Routledge, 2017. (348 pages)
ISBN<PHONE_NUMBER>818.
5,000 most commonly used words.Based on the Sejong National Corpora, the largest written and spoken corpora in Korean comprised of 10 million words
. - アラン ミラー:
Kanji by Frequency.
Top 229 kanji ordered by frequency in newspapers.
Other Frequency Lists
- Wiktionary: Frequency Lists. Many of the lists mentioned on this page are based on subtitle corpora.
- Hermit Dave:
Frequency Words:
Repository for Frequency Word List Generator and processed files
. - Lexiteria: Word Frequency Lists: lists with the top 200 words in 40 languages.
Corpora
Corpora for Semitic Languages
-
The Quranic Arabic Corpus,
an annotated linguistic resource which shows the Arabic grammar, syntax and morphology for each word in the Holy Quran.
The corpus data is available under the GNU General Public License (version 3) and can be downloaded if you provide your e-mail address. -
arabiCorpus,
developed at the College of Humanities at Brigham Young University
and currently maintained by
professor Dilworth B. Parkinson.
The
arabiCorpus project page
describes the corpus as
a free, untagged, 30-million-word corpus with a user-friendly interface.
- Latifa Al-Sulaiti: Arabic Corpora: overview of both free and non-free corpora and their main characteristics (source, size, purpose and material).
Algorithms and Code for Creating Frequency Lists
- Hemanth: Word frequency with Mapreduce in python. 23 September 2011.
- Speer, Rob: wordfreq: Python library for looking up word frequencies in data files. (Part of Pypi in the Python Package Index.)
- bumsfeld: Word Frequency using Python, daniWeb, 2007.
- Anderson, John Victor: A Simple Frequency List using R, 8 April 2011.
- Pringle, Robert: Corpus of Babel: Java-based parser that generates a frequency list for a given collection of text. The code has no licence.
Research on Corpora and Frequency Lists
- McEnery, Tony; Hardie, Andrew: Corpus Linguistics: Method, Theory and Practice. Cambridge University Press, 2011. (312 pages) ISBN<PHONE_NUMBER>369.
- Prinsloo, D. J.: Corpus-based Lexicography for Lesser-resourced Languages—Maximizing the Limited Corpus. Lexikos, 25 (2015): 285-300.
Corpus and Concordance Tools
- Andew Roberts:
aConCorde:
aConcorde is a multi-lingual concordance tool. Originally developed for native Arabic concordance, it posses basic concordance functionality, as well as English and Arabic interfaces. Written in Java, so will run on any platform that has the Java Runtime Environment installed.
- Laurence Anthony:
AntConc,
a
freeware corpus analysis toolkit for concordancing and text analysis.
- Laurence Anthony:
AntCorGen,
a
freeware discipline-specific corpus creation tool
. -
WebCorp: The Web as a Corpus:
WebCorp Live lets you access the Web as a corpus - a large collection of texts from which examples of real language use can be extracted.
The tool was developed by the Research and Development Unit for English Studies (RDUES) at Birmingham City University. - Lancaster University: Corpus Linguistics: Method, Analysis, Interpretation: an eight-week course hosted on FutureLearn.
- Lancaster University: #LancsBox: Lancaster University corpus toolbox. Latest release: 25 September 2017. Available for Windows (32-bit and 64 bit versions), Mac OS and GNU/Linux.
- XAIRA:
open-source software
which supports indexing and analysis of large XML textual resources such as natural language corpora
. (Licence: GNU General Public License version 2.0 (GPLv2); programming language: C++.) - Maik Stührenberg: The TEI and Current Standards for Structuring Linguistic Data, Journal of the Text Encoding Initiative, Issue 3 (November 2012).
- Institut für deutsche Sprache und Linguistik (Humboldt-Universität zu Berlin): Korpora: Links to corpora for German, English, Spanish, Portuguese, French, Dutch and a few other languages.


This example shows how to setup a carousel using CSS3 transitions for animations.
It uses a Modernizr feature detect to use transitions along with transforms to achieve full hardware acceleration when possible, falling back to jQuery-based animation otherwise.
If you use this example on your site and don't have Modernizr already included, you can use this minimal build.


If you want high quality diamond jewelry at unbeatable prices, shop online at www.anjolee.com... They are the manufacturer and sellers therefore they can pass onto the customer, great savings. Anjolee is the website launched by the prestigious and the very well reputed Sunrise Jewelry Manufacturing Corp They have been the leaders in the diamond industry for over thirty years. Anjolee has a wide selection of diamond jewelry from rings, tennis bracelets, vintage and red carpet diamond jewelry among many others. Use our discount coupons to get a great price.
Anjolee is the place to buy high end diamond jewelry at reasonable prices. Anjolee also guarantees that all diamonds that it sells are authentic and the highest quality. Anjolee allows you to design your own jewelry according your taste or budget. You can go online at www.anjolee.com and completely customize your jewelry. Select the design the metal according to your budget. The customization site allows you to look at the jewelry at a 360 angle so you are able to see very clearly as to how it looks. Get the finest diamonds at an unbeatable price from www.anjolee.com.
Anjolee has a dazzling collection of diamonds and diamond jewelry. If you are looking for a wedding band, a promise ring, tennis bracelet, earrings or any other jewelry visit www.anjolee.com. You will get the best quality exotic diamonds at an unbelievable price. Take the plunge today; say it with diamonds as diamonds are forever! Use our coupons to get an even better price on Anjolee diamond jewelry.


Maximising MicroPython speed¶
Contents
This tutorial describes ways of improving the performance of MicroPython code. Optimisations involving other languages are covered elsewhere, namely the use of modules written in C and the MicroPython inline assembler.
The process of developing high performance code comprises the following stages which should be performed in the order listed.
Design for speed.
Code and debug.
Optimisation steps:
Identify the slowest section of code.
Improve the efficiency of the Python code.
Use the native code emitter.
Use the viper code emitter.
Use hardware-specific optimisations.
Designing for speed¶
Performance issues should be considered at the outset. This involves taking a view on the sections of code which are most performance critical and devoting particular attention to their design. The process of optimisation begins when the code has been tested: if the design is correct at the outset optimisation will be straightforward and may actually be unnecessary.
Algorithms¶
The most important aspect of designing any routine for performance is ensuring that the best algorithm is employed. This is a topic for textbooks rather than for a MicroPython guide but spectacular performance gains can sometimes be achieved by adopting algorithms known for their efficiency.
RAM allocation¶
To design efficient MicroPython code it is necessary to have an understanding of the way the interpreter allocates RAM. When an object is created or grows in size (for example where an item is appended to a list) the necessary RAM is allocated from a block known as the heap. This takes a significant amount of time; further it will on occasion trigger a process known as garbage collection which can take several milliseconds.
Consequently the performance of a function or method can be improved if an object is created once only and not permitted to grow in size. This implies that the object persists for the duration of its use: typically it will be instantiated in a class constructor and used in various methods.
This is covered in further detail Controlling garbage collection below.
Buffers¶
An example of the above is the common case where a buffer is required, such as one used for communication with a device. A typical driver will create the buffer in the constructor and use it in its I/O methods which will be called repeatedly.
The MicroPython libraries typically provide support for pre-allocated buffers. For
example, objects which support stream interface (e.g., file or UART) provide read()
method which allocates new buffer for read data, but also a readinto()
method
to read data into an existing buffer.
Floating point¶
Some MicroPython ports allocate floating point numbers on heap. Some other ports may lack dedicated floating-point coprocessor, and perform arithmetic operations on them in “software” at considerably lower speed than on integers. Where performance is important, use integer operations and restrict the use of floating point to sections of the code where performance is not paramount. For example, capture ADC readings as integers values to an array in one quick go, and only then convert them to floating-point numbers for signal processing.
Arrays¶
Consider the use of the various types of array classes as an alternative to lists. The array module supports various element types with 8-bit elements supported by Python’s built in bytes and bytearray classes. These data structures all store elements in contiguous memory locations. Once again to avoid memory allocation in critical code these should be pre-allocated and passed as arguments or as bound objects.
When passing slices of objects such as bytearray instances, Python creates a copy which involves allocation of the size proportional to the size of slice. This can be alleviated using a memoryview object. memoryview itself is allocated on heap, but is a small, fixed-size object, regardless of the size of slice it points too.
ba = bytearray(10000) # big array
func(ba[30:2000]) # a copy is passed, ~2K new allocation
mv = memoryview(ba) # small object is allocated
func(mv[30:2000]) # a pointer to memory is passed
A memoryview can only be applied to objects supporting the buffer protocol - this includes arrays but not lists. Small caveat is that while memoryview object is live, it also keeps alive the original buffer object. So, a memoryview isn’t a universal panacea. For instance, in the example above, if you are done with 10K buffer and just need those bytes 30:2000 from it, it may be better to make a slice, and let the 10K buffer go (be ready for garbage collection), instead of making a long-living memoryview and keeping 10K blocked for GC.
Nonetheless, memoryview is indispensable for advanced preallocated buffer
management. readinto()
method discussed above puts data at the beginning
of buffer and fills in entire buffer. What if you need to put data in the
middle of existing buffer? Just create a memoryview into the needed section
of buffer and pass it to readinto()
.
Identifying the slowest section of code¶
This is a process known as profiling and is covered in textbooks and
(for standard Python) supported by various software tools. For the type of
smaller embedded application likely to be running on MicroPython platforms
the slowest function or method can usually be established by judicious use
of the timing ticks
group of functions documented in utime.
Code execution time can be measured in ms, us, or CPU cycles.
The following enables any function or method to be timed by adding an
@timed_function
decorator:
def timed_function(f, *args, **kwargs):
myname = str(f).split(' ')[1]
def new_func(*args, **kwargs):
t = utime.ticks_us()
result = f(*args, **kwargs)
delta = utime.ticks_diff(utime.ticks_us(), t)
print('Function {} Time = {:6.3f}ms'.format(myname, delta/1000))
return result
return new_func
MicroPython code improvements¶
The const() declaration¶
MicroPython provides a const()
declaration. This works in a similar way
to #define
in C in that when the code is compiled to bytecode the compiler
substitutes the numeric value for the identifier. This avoids a dictionary
lookup at runtime. The argument to const()
may be anything which, at
compile time, evaluates to an integer e.g. 0x100
or 1 << 8
.
Caching object references¶
Where a function or method repeatedly accesses objects performance is improved by caching the object in a local variable:
class foo(object):
def __init__(self):
self.ba = bytearray(100)
def bar(self, obj_display):
ba_ref = self.ba
fb = obj_display.framebuffer
# iterative code using these two objects
This avoids the need repeatedly to look up self.ba
and obj_display.framebuffer
in the body of the method bar()
.
Controlling garbage collection¶
When memory allocation is required, MicroPython attempts to locate an adequately sized block on the heap. This may fail, usually because the heap is cluttered with objects which are no longer referenced by code. If a failure occurs, the process known as garbage collection reclaims the memory used by these redundant objects and the allocation is then tried again - a process which can take several milliseconds.
There may be benefits in pre-empting this by periodically issuing gc.collect(). Firstly doing a collection before it is actually required is quicker - typically on the order of 1ms if done frequently. Secondly you can determine the point in code where this time is used rather than have a longer delay occur at random points, possibly in a speed critical section. Finally performing collections regularly can reduce fragmentation in the heap. Severe fragmentation can lead to non-recoverable allocation failures.
The Native code emitter¶
This causes the MicroPython compiler to emit native CPU opcodes rather than bytecode. It covers the bulk of the MicroPython functionality, so most functions will require no adaptation (but see below). It is invoked by means of a function decorator:
@micropython.native
def foo(self, arg):
buf = self.linebuf # Cached object
# code
There are certain limitations in the current implementation of the native code emitter.
Context managers are not supported (the
with
statement).Generators are not supported.
If
raise
is used an argument must be supplied.
The trade-off for the improved performance (roughly twice as fast as bytecode) is an increase in compiled code size.
The Viper code emitter¶
The optimisations discussed above involve standards-compliant Python code. The Viper code emitter is not fully compliant. It supports special Viper native data types in pursuit of performance. Integer processing is non-compliant because it uses machine words: arithmetic on 32 bit hardware is performed modulo 2**32.
Like the Native emitter Viper produces machine instructions but further optimisations are performed, substantially increasing performance especially for integer arithmetic and bit manipulations. It is invoked using a decorator:
@micropython.viper
def foo(self, arg: int) -> int:
# code
As the above fragment illustrates it is beneficial to use Python type hints to assist the Viper optimiser.
Type hints provide information on the data types of arguments and of the return value; these
are a standard Python language feature formally defined here PEP0484.
Viper supports its own set of types namely int
, uint
(unsigned integer), ptr
, ptr8
,
ptr16
and ptr32
. The ptrX
types are discussed below. Currently the uint
type serves
a single purpose: as a type hint for a function return value. If such a function returns 0xffffffff
Python will interpret the result as 2**32 -1 rather than as -1.
In addition to the restrictions imposed by the native emitter the following constraints apply:
Functions may have up to four arguments.
Default argument values are not permitted.
Floating point may be used but is not optimised.
Viper provides pointer types to assist the optimiser. These comprise
ptr
Pointer to an object.ptr8
Points to a byte.ptr16
Points to a 16 bit half-word.ptr32
Points to a 32 bit machine word.
The concept of a pointer may be unfamiliar to Python programmers. It has similarities to a Python memoryview object in that it provides direct access to data stored in memory. Items are accessed using subscript notation, but slices are not supported: a pointer can return a single item only. Its purpose is to provide fast random access to data stored in contiguous memory locations - such as data stored in objects which support the buffer protocol, and memory-mapped peripheral registers in a microcontroller. It should be noted that programming using pointers is hazardous: bounds checking is not performed and the compiler does nothing to prevent buffer overrun errors.
Typical usage is to cache variables:
@micropython.viper
def foo(self, arg: int) -> int:
buf = ptr8(self.linebuf) # self.linebuf is a bytearray or bytes object
for x in range(20, 30):
bar = buf[x] # Access a data item through the pointer
# code omitted
In this instance the compiler “knows” that buf
is the address of an array of bytes;
it can emit code to rapidly compute the address of buf[x]
at runtime. Where casts are
used to convert objects to Viper native types these should be performed at the start of
the function rather than in critical timing loops as the cast operation can take several
microseconds. The rules for casting are as follows:
Casting operators are currently:
int
,bool
,uint
,ptr
,ptr8
,ptr16
andptr32
.The result of a cast will be a native Viper variable.
Arguments to a cast can be a Python object or a native Viper variable.
If argument is a native Viper variable, then cast is a no-op (i.e. costs nothing at runtime) that just changes the type (e.g. from
uint
toptr8
) so that you can then store/load using this pointer.If the argument is a Python object and the cast is
int
oruint
, then the Python object must be of integral type and the value of that integral object is returned.The argument to a bool cast must be integral type (boolean or integer); when used as a return type the viper function will return True or False objects.
If the argument is a Python object and the cast is
ptr
,ptr
,ptr16
orptr32
, then the Python object must either have the buffer protocol (in which case a pointer to the start of the buffer is returned) or it must be of integral type (in which case the value of that integral object is returned).
Writing to a pointer which points to a read-only object will lead to undefined behaviour.
The following example illustrates the use of a ptr16
cast to toggle pin X1 n
times:
BIT0 = const(1)
@micropython.viper
def toggle_n(n: int):
odr = ptr16(stm.GPIOA + stm.GPIO_ODR)
for _ in range(n):
odr[0] ^= BIT0
A detailed technical description of the three code emitters may be found on Kickstarter here Note 1 and here Note 2
Accessing hardware directly¶
Note
Code examples in this section are given for the Pyboard. The techniques described however may be applied to other MicroPython ports too.
This comes into the category of more advanced programming and involves some knowledge of the target MCU. Consider the example of toggling an output pin on the Pyboard. The standard approach would be to write
mypin.value(mypin.value() ^ 1) # mypin was instantiated as an output pin
This involves the overhead of two calls to the Pin
instance’s value()
method. This overhead can be eliminated by performing a read/write to the relevant bit
of the chip’s GPIO port output data register (odr). To facilitate this the stm
module provides a set of constants providing the addresses of the relevant registers.
A fast toggle of pin P4
(CPU pin A14
) - corresponding to the green LED -
can be performed as follows:
import machine
import stm
BIT14 = const(1 << 14)
machine.mem16[stm.GPIOA + stm.GPIO_ODR] ^= BIT14


{% extends 'daedalus/uploader/wizard/base.html' %} {% load i18n %} {% block wizard_content %}
This form helps you bulk upload metadata using a simple CSV data dictionary format.
To get started download this template and fill in the fields to describe your metadata.
A list of fields and their description is at the bottom of the page.
The preferred designation by which a data element is known within the context of this data dictionary.
This field is based on the field described by "AS4590-2016 - 1.4.2 Name".
When imported into an Aristotle Metadata Registry this value will be stored as a
Data Element and Data Element Concept name.
A statement that expresses the essential nature of the data element
and its differentiation from all other data elements.
This field is based on the field described by "AS4590-2016 - 1.4.3 Definition".
When imported into an Aristotle Metadata Registry this value will be stored as a Data Element and
Data Element Concept definition.
The common name of the object that the data element records data about;
for example a Person, Event, Location or Object.
Including an Object Class name helps when finding similar content within a data registry by group
data about similar classes of object.
When imported into an Aristotle Metadata Registry this value will be stored as an Object Class name.
The common name of the attribute of an object that the data element records data about.
The name of the attribute should be independent of how it is recorded - for example "Age", not "Age in years".
When imported into an Aristotle Metadata Registry this value will be stored as an Property name.
The set of representations of permissible instances of the data element, according to the
representational class, representation layout, data type and maximum size specified in the
corresponding metadata components. The set can be specified by name (including an
existing classification/code scheme such as ABS 1292.0 (ANZSIC), by reference to a full
code list included as an Appendix (such as the Name Title in Appendix A, Table A1), or by
enumeration of the representation of the instances (e.g. permissible values for sex as
described below).
This field is based on the field described by "AS4590-2016 - 1.4.9 Domain values".
When imported into an Aristotle Metadata Registry this value will be stored as a the Value Domain definition.
The common name of the data type that is used to record information for this data. Where possible use broad names for data type rather than system specific representations, eg. "Text" rather than "VARCHAR(256)".
This field is based on the field described by "AS4590-2016 - 1.4.6 Representation Class".
In ISO/IEC 11179-3:2014 Data types had a change in scope and Representation classes were deprecated.
When imported into an Aristotle Metadata Registry this value will be stored as a Data Type name.
The maximum number of characters that may be recorded in the field.
This field is based on the field described by "AS4590-2016 - 1.4.7 Field size maximum".
When imported into an Aristotle Metadata Registry this value will be stored as a the Value Domain maximum length.
Detail on the format of data recorded for this data element. It is recommended that this format conforms to a known language such as "Regular expressions' of the Representation layout specified in Australian Standard 'AS 4590-2016, 1.4.8'.
This field is based on the field described by "AS4590-2016 - 1.4.8 Representation layout.
When imported into an Aristotle Metadata Registry this value will be stored as a the Value Domain format.
When recording a data dictionary against a particular data collection, this specifies the name of a column used in a particular dataset that this data element corresponds with.
When recording a data dictionary against a particular data collection,
this records additional context for this specific column within the dataset.
For example, if two columns in a dataset record a data element at two different places or two different
points in time, the notes may be used to describe the additional context for each column.


Honzi/Guides/Diablo 2: Lord of Destruction/Grind Challenge
- Downloads:
- Play a class that gets a penalty to various stats:
- -99% Better Chance of Getting Magic Items
- -99% Extra Gold from Monsters
- -99% to Experience Gained
- Rules:
- You must keep the two modified small charms in your inventory at all times.
- You cannot use experience shrines.


Selected from the Edit button in the file list dialog.
Moderate allows file descriptions to be imported wholesale from a text file. This can be used, for example, to rebuild a moderator's file list from the users' file list if it has accidentally been corrupted on CIX.
Certain assumptions are made by Moderate when processing an import file.
This is a standard file selector, but note the extra Description field number selector. This must be set to the column position (counting from one) where the file description starts.


Community Points FAQ
Will Community Points be available on mobile apps?
Currently, Community Points is only available on desktop versions of the website but it will be supported on the iOS and Android apps. However, new features may appear on desktop versions of the website before mobile, depending on development circumstances.
How can I buy the subreddit banner?
Choose the link "Buy Banner" located on the right side of the subreddit's menu bar. You cannot see it or buy the banner while using the Reddit old design. Please enable Reddit Redesign to use Community Points.
What happens if the subreddit banner's price is updated?
The current owner of the banner can update the price at any time. If the price is increased, the owner pays an additional tax corresponding to the price delta and duration of time that is left within the current tax period. If the owner decreases the price, then nothing happens.
Where goes the Photon used to buy the subreddit banner?
When someone buys the banner from you, the Photon will go to you. The daily tax paid while you're the owner of the banner will be burned.
Which images can be used with the subreddit banner?
Any images that violate Reddit's site policies and the /r/Stellar rules will be removed.
Are bot accounts excluded from Photon distribution?
Reddit bots such as /u/communitypoints and /u/automoderator do not receive Photon and they do not upvote or downvote any content in the subreddit. So, they do not influence Photon distribution or the amount each user receive.
Community Poll FAQ
What community polls should be used for?
Community Polls should be used for anything regarding Community Points or subreddit governance. If you want to make a poll about your project, if it's a third party project not included or making use of the subreddit, you should contact the subreddit moderation as each subreddit may have its own set of rules and policy.
How many options can I use in community polls?
You can use a minimum of 2 options and a maximum of 7 options per poll.
What's the difference between a General Poll and a Governance Pool?
General Polls can be used for anything you'd like and it keeps running until the voting length ends. The winner option is selected by the number of votes when the poll voting is closed, on the last day of the number of days you specify.
Governance Polls are auto-enacted and should be used for governance purposes. The winner option is selected as soon it reaches the Decision Threshold, during the number of days you specify. The Decision Threshold is based on the number of Photon that was previously voted in polls.
Are bot accounts excluded from Community Polls voting?
Reddit bots such as /u/communitypoints and /u/automoderator do not vote in community polls. So, they don't influence governance decisions made trough community polls.
If I buy Photon in the free market can I use it to have voting power in governance polls?
No. If you buy Photon in the free market you will not be able to vote on polls with it. Your voting power is tied to the amount of Photon you legitimately won from the subreddit, not the total amount you hold from various sources.
Special Membership FAQ
What is a Special Membership?
The Special Membership is a set of exclusive features available to users who purchase a premium subscription to the subreddit.
Which features do I get with Special Membership?
These are susceptible to change but you will get badges and colors to your username, premium animated emojis, and GIFs in your comments.
Are Special Membership features available on mobile apps?
The features will be supported on the iOS and Android apps, as well as desktop versions of the website. However, new features may appear on the desktop versions of the website before mobile, depending on development circumstances.
How do I cancel my Special Membership?
You can cancel your membership at any time from the User Settings page. Look for the Special Membership tab.