Tutorial by Examples: ect

DataObjects in SilverStripe represent a database table row. The fields in the model have magic methods that handle getting and setting data via their property names. Given we have a simple DataObject as an example: class Fruit extends DataObject { private static $db = ['Name' => 'Varchar'...
First, install Mongoose with: npm install mongoose Then, add it to server.js as dependencies: var mongoose = require('mongoose'); var Schema = mongoose.Schema; Next, create the database schema and the name of the collection: var schemaName = new Schema({ request: String, time: Nu...
Strings Array When selecting a value in the select dropdown and providing an array of strings, the selected value will be bound to the select element's value property as a string that we can display using string interpolation. export class MyViewModel { animals = []; favouriteAnimal = nu...
Move every outlet to an NSObject. Then drag an Object from the library to the controller scene of the storyboard and hook the elements there. class ContactFormStyle: NSObject { @IBOutlet private weak var message: UILabel! { didSet { message.font = UIFont.systemFontOfSize(12) ...
Assuming the call to your web application's login handler looks like this: https://somepage.com/ajax/login.ashx?username=admin&password=123 Now in login.ashx, you read these values: strUserName = getHttpsRequestParameterString("username"); strPassword = getHttpsRequestParameterSt...
You can use the DataExtension mechanism to add extra database fields to an existing DataObject: class MyMemberExtension extends DataExtension { private static $db = [ 'HairColour' => 'Varchar' ]; } And apply the extension: # File: mysite/_config/app.yml Member: exten...
You can add public methods to a DataObject using the extension mechanism, for example: class MyMemberExtension extends DataExtension { public function getHashId() { return sha1($this->owner->ID); } } When applied to the Member class, the example above would return...
The protected internal keyword marks field, methods, properties and nested classes for use inside the same assembly or derived classes in another assembly: Assembly 1 public class Foo { public string MyPublicProperty { get; set; } protected internal string MyProtectedInternalPropert...
SELECT * FROM Cars WHERE status IN ( 'Waiting', 'Working' ) This is semantically equivalent to SELECT * FROM Cars WHERE ( status = 'Waiting' OR status = 'Working' ) i.e. value IN ( <value list> ) is a shorthand for disjunction (logical OR).
VBA is compiled in run-time, which has a huge negative impact on it's performance, everything built-in will be faster, try to use them. As an example I'm comparing SUM and COUNTIF functions, but you can use if for anything you can solve with WorkSheetFunctions. A first attempt for those would be t...
In this example we create a goroutine (a function running in a separate thread) that accepts a chan parameter, and simply loops, sending information into the channel each time. In the main we have a for loop and a select. The select will block processing until one of the case statements becomes tru...
So here, I have removed the for loops, and made a timeout by adding a second case to the select that returns after 3 seconds. Because the select just waits until ANY case is true, the second case fires, and then our script ends, and chatter() never even gets a chance to finish. // Use of the select...
The [ and [[ operators are primitive functions that are generic. This means that any object in R (specifically isTRUE(is.object(x)) --i.e. has an explicit "class" attribute) can have its own specified behaviour when subsetted; i.e. has its own methods for [ and/or [[. For example, this is...
Selection sort selects the minimum element, repeatedly, until the list is empty. import Data.List (minimum, delete) ssort :: Ord t => [t] -> [t] ssort [] = [] ssort xs = let { x = minimum xs } in x : ssort (delete x xs)
Query: SELECT * FROM Customers ORDER BY CustomerID LIMIT 3; Result: CustomerID CustomerName ContactName Address City PostalCode Country 1 Alfreds Futterkiste Maria Anders Obere Str. 57 Berlin 12209 Ge...
In this example our project name is "helloworld" which was created with stack new helloworld simple First we have to build the project with stack build and then we can run it with stack exec helloworld-exe
A simple query that selects all users from the #__users table with a username that matches John $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('*'); $query->from('#__users'); $query->where('username = '. $db->q('John')); $db->setQuery($query); ...
The angular.isObject return true if and only if the argument passed to it is an object, this function will also return true for an Array and will return false for null even though typeof null is object . angular.isObject(value) This function is useful for type checking when you need a defined ...
Every object in R is assigned a class. You can use class() to find the object's class and str() to see its structure, including the classes it contains. For example: class(iris) [1] "data.frame" str(iris) 'data.frame': 150 obs. of 5 variables: $ Sepal.Length: num 5.1 4.9 4.7 4...
Derives from Object Key members public Dispatcher Dispatcher { get; } Summary Most objects in WPF derive from DispatcherObject, which provides the basic constructs for dealing with concurrency and threading. Such objects are associated with a Dispatcher. Only the thread that the Dispatcher w...

Page 34 of 99