Tutorial by Examples: ect

The Collections class allows for you to move objects around in the list using various methods (ls is the List): Reversing a list: Collections.reverse(ls); Rotating positions of elements in a list The rotate method requires an integer argument. This is how many spots to move it along the line b...
WeakMap object allows you to store key/value pairs. The difference from Map is that keys must be objects and are weakly referenced. This means that if there aren't any other strong references to the key, the element in WeakMap can be removed by garbage collector. WeakMap constructor has an optional...
The effective type of a data object is the last type information that was associated with it, if any. // a normal variable, effective type uint32_t, and this type never changes uint32_t a = 0.0; // effective type of *pa is uint32_t, too, simply // because *pa is the object a uint32_t* pa = &a...
To use SQL syntax with model, that would transfer result to proper instantions, you should use directly one of Phalcon\Mvc\Model\Resultset classes: $users = new \Application\Models\Users(); // bitwise operation on `flag` field $sql = 'SELECT * FROM phorum.users WHERE (15 & (1 <&...
The WeakSet object is used for storing weakly held objects in a collection. The difference from Set is that you can't store primitive values, like numbers or string. Also, references to the objects in the collection are held weakly, which means that if there is no other reference to an object stored...
Our server object is given an 'application' parameter which can be any callable application object (see other examples). It writes first the headers, then the body of data returned by our application to the system standard output. import os, sys def run(application): environ['wsgi.inpu...
To do this first locate config folder in your root. Then open connections.js Locate // someMysqlServer: { // adapter: 'sails-mysql', // host: 'YOUR_MYSQL_SERVER_HOSTNAME_OR_IP_ADDRESS', // user: 'YOUR_MYSQL_USER', //optional // password: 'YOUR_MYSQL_PASSWORD', //optional /...
What is a "Shape"? You typically save your shapes by creating a JavaScript "shape" object representing each shape. var myCircle = { x:30, y:20, radius:15 }; Of course, you're not really saving shapes. Instead, you're saving the definition of how to draw the shapes. Then put...
This code adds outwardly increasing shadows to an image to create a "sticker" version of the image. Notes: In addition to being an ImageObject, the "img" argument can also be a Canvas element. This allows you to stickerize your own custom drawings. If you draw text on the Can...
Depending on the structure of your data, you can create variables that update dynamically. DECLARE @CurrentID int = (SELECT TOP 1 ID FROM Table ORDER BY CreateDate desc) DECLARE @Year int = 2014 DECLARE @CurrentID int = (SELECT ID FROM Table WHERE Year = @Year) In most cases, you will want...
To achieve the simplest task in Entity Framework - to connect to an existing database ExampleDatabase on your local instance of MSSQL you have to implement two classes only. First is the entity class, that will be mapped to our database table dbo.People. class Person { public int...
Some collection types can be initialized at the declaration time. For example, the following statement creates and initializes the numbers with some integers: List<int> numbers = new List<int>(){10, 9, 8, 7, 7, 6, 5, 10, 4, 3, 2, 1}; Internally, the C# compiler actually converts this...
The :only-child CSS pseudo-class represents any element which is the only child of its parent. HTML: <div> <p>This paragraph is the only child of the div, it will have the color blue</p> </div> <div> <p>This paragraph is one of the two children of the ...
SQL Server 2012 In Transact SQL , you may define an object as Date (or DateTime) using the [DATEFROMPARTS][1] (or [DATETIMEFROMPARTS][1]) function like following: DECLARE @myDate DATE=DATEFROMPARTS(1988,11,28) DECLARE @someMoment DATETIME=DATEFROMPARTS(1988,11,28,10,30,50,123) The parameter...
Here are simplified steps (based on the official documentation) required to create a Firebase project and connect it with an Android app. Add Firebase to your app Create a Firebase project in the Firebase console and click Create New Project. Click Add Firebase to your Android app and fol...
Right click on the solution, Add new project From the Test section, select an Unit Test Project Pick a name for the assembly - if you are testing project Foo, the name can be Foo.Tests Add a reference to the tested project in the unit test project references
Create blank Multi-Device (Firemonkey) application. Drop Rectangle on Form. In Object inspector window (F11) find RotationAngle click on drop down button, and select "Create New TFloatAnimation". Object inspector window is automatically switched to a newly added TFloatAnimation, you...
Following are the Prerequisites for installing Cookiecutter: pip virtualenv PostgreSQL Create a virtualenv for your project and activate it: $ mkvirtualenv <virtualenv name> $ workon <virtualenv name> Now install Cookiecutter using: $ pip install cookiecutter Change dire...
Print the path to the active developer directory (selected Xcode) xcode-select -p Select a different version of Xcode, e.g. Beta sudo xcode-select -s /Applications/Xcode-beta.app Reset to the default version of Xcode sudo xcode-select -r This is equivalent to running sudo xcode-select -s /Appl...
In this example, a destructor is explicitly invoked for an object that will later be automatically destroyed. struct S { ~S() { std::cout << "destroying S\n"; } }; int main() { S s; s.~S(); } // UB: s destroyed a second time here A similar issue occurs when a st...

Page 56 of 99