Tutorial by Examples: del

One of the most straight forward way of making an LED blink is: turn it on, wait a bit, turn it off, wait again, and repeat endlessly: // set constants for blinking the built-in LED at 1 Hz #define OUTPIN LED_BUILTIN #define PERIOD 500 void setup() { pinMode(OUTPIN, OUTPUT); // sets t...
#include <elapsedMillis.h> void setup() { Serial.begin(115200); elapsedMillis msTimer; elapsedMicros usTimer; long int dt = 500; delay(dt); long int us = usTimer; long int ms = msTimer; Serial.print("delay(");Serial.print(dt);Serial.println(") to...
var client = new MongoClient("mongodb://localhost:27017"); var database = client.GetDatabase("test"); var collection = database.GetCollection < Interactions > ("Interactions"); collection.DeleteOne(s => s.SiteName == "New Example");
DELETE FROM Helloworlds This will delete all the data from the table. The table will contain no rows after you run this code. Unlike DROP TABLE, this preserves the table itself and its structure and you can continue to insert new rows into that table. Another way to delete all rows in table is ...
Swift 2 import UIKit extension UIDevice { var modelName: String { var systemInfo = utsname() uname(&systemInfo) let machineMirror = Mirror(reflecting: systemInfo.machine) let identifier = machineMirror.children.reduce("") { identifier, ele...
Sometimes, if an action should be bind to a collection view's cell selection, you have to implement the UICollectionViewDelegate protocol. Let's say the collection view is inside a UIViewController MyViewController. Objective-C In your MyViewController.h declares that it implements the UICollecti...
A Semantic Model offers a deeper level of interpretation and insight of code compare to a syntax tree. Where syntax trees can tell the names of variables, semantic models also give the type and all references. Syntax trees notice method calls, but semantic models give references to the precise locat...
When I first started managing the keyboard I would use separate Notifications in each ViewController. Notification Method (Using NSNotification): class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() NSNotificationCenter.defaultCenter().a...
Executes the requests with the specified delay in milliseconds, meaning that if any subsequent request happens after the previous has been queued, the first one will be skiped. The feature is available starting from JSF 2.2: Bean.java @ManagedBean @ViewScoped public class Bean { publi...
Set a convenience method in your base model namespace Base; class Model extends \Phalcon\Mvc\Model { public function sanitize($attr, $filterName) { $filter = $this->getDI()->get('filter'); $this->$attr = $filter->sanitize($this->$attr, $filterName); ...
How to create User Model Class namespace App\Model\Table; use Cake\ORM\Table; class UsersTable extends Table { public function initialize(array $config) { $this->table('users'); //define table name $this->displayField('username'); // unique or other special field of...
There are 4 types of associations(relationships) we can define in CakePHP class PostsTable extends Table { public function initialize(array $config) { // table initialization code should be here $this->belongsTo('Authors', [ 'className' => 'Authors', ...
EditableAttribute sets whether users should be able to change the value of the class property. public class Employee { [Editable(false)] public string FirstName { get; set; } } Simple usage example in XAML application <Window x:Class="WpfApplication.MainWindow" ...
A model can also be added to the partial view : @model Solution.Project.Namespace.MyModelClass <p>@Model.Property</p> In the View you can now just use: <div> @Html.Partial("PartialViewExample", new MyModelClass(){Property="my property value"}) <...
Suppose you have a Post model with a hasMany relationship with Comment. You may insert a Comment object related to a post by doing the following: $post = Post::find(1); $commentToAdd = new Comment(['message' => 'This is a comment.']); $post->comments()->save($commentToAdd); You ca...
Saving a model in tensorflow is pretty easy. Let's say you have a linear model with input x and want to predict an output y. The loss here is the mean square error (MSE). The batch size is 16. # Define the model x = tf.placeholder(tf.float32, [16, 10]) # input y = tf.placeholder(tf.float32, [16...
Restoring is also quite nice and easy. Here's a handy helper function: def restore_vars(saver, sess, chkpt_dir): """ Restore saved net, global score and step, and epsilons OR create checkpoint directory for later storage. """ sess.run(tf.initialize_all_...
Delete a document with the property { greetings: 'Whut?' } const MongoClient = require('mongodb').MongoClient; const url = 'mongodb://localhost:27017/test'; MongoClient.connect(url, function (err, db) { if (err) throw new Error(err); db.collection('myCollection').deleteOne(// Delete...
Delete ALL documents with a 'farewell' property set to 'okay'. const MongoClient = require('mongodb').MongoClient; const url = 'mongodb://localhost:27017/test'; MongoClient.connect(url, function (err, db) { if (err) throw new Error(err); db.collection('myCollection').deleteMany(// M...
Assume you want to delegate to a class but you do not want to provide the delegated-to class in the constructor parameter. Instead, you want to construct it privately, making the constructor caller unaware of it. At first this might seem impossible because class delegation allows to delegate only to...

Page 12 of 23