Tutorial by Examples: del

AngularJS code for two-way binding on a text input: <input ng-model="ScopePropertyX" type="text" /> KnockoutJS equivalent: <input data-bind="textInput: ScopeObservableX" type="text" />
#!/bin/bash NO_SNAPSHOTS="No snapshots have been taken yet" SNAPSHOT_OUTPUT=$(vagrant snapshot list | grep "${NO_SNAPSHOTS}") if [ -z "${SNAPSHOT_OUTPUT}" ]; then echo "Found some snapshots, going to remove them" for SNAPSHOT in $(vagrant snap...
ElementAt will return the item at index n. If n is not within the range of the enumerable, throws an ArgumentOutOfRangeException. int[] numbers = { 1, 2, 3, 4, 5 }; numbers.ElementAt(2); // 3 numbers.ElementAt(10); // throws ArgumentOutOfRangeException ElementAtOrDefault will return the item...
To generate an ActiveRecord model that automagically creates the correct db migrations & boilerplate test files for your model, enter this command rails generate model NAME column_name:column_type 'NAME' is the name of the model. 'field' is the name of the column in the DB table and 'type' i...
Closures are inline anonymous methods that have the ability to use Parent method variables and other anonymous methods which are defined in the parent's scope. In essence, a closure is a block of code which can be executed at a later time, but which maintains the environment in which it was firs...
There are three kinds of numeric RangeFields in Python. IntegerField, BigIntegerField, and FloatField. They convert to psycopg2 NumericRanges, but accept input as native Python tuples. The lower bound is included and the upper bound is excluded. class Book(models.Model): name = CharField(max_l...
It's simpler and easier to input values as a Python tuple instead of a NumericRange. Book.objects.create(name='Pro Git', ratings_range=(5, 5)) Alternative method with NumericRange: Book.objects.create(name='Pro Git', ratings_range=NumericRange(5, 5))
MySQL's DELETE statement can use the JOIN construct, allowing also to specify which tables to delete from. This is useful to avoid nested queries. Given the schema: create table people ( id int primary key, name varchar(100) not null, gender char(1) not null ); insert people (id,na...
-> Note: make sure you set up HStoreField first before going on with this example. (above) No parameters are required for initializing a HStoreField. from django.contrib.postgres.fields import HStoreField from django.db import models class Catalog(models.model): name = models.C...
Pass a native python dictionary mapping strings to strings to create(). Catalog.objects.create(name='Library of Congress', titles_to_authors={ 'Using HStoreField with Django': 'CrazyPython and la communidad', 'Flabbergeists and thingamajigs': 'La Artista Fooista', 'Pro Git': 'Scott C...
ClientContext clientContext = new ClientContext(siteUrl); Web oWebsite = clientContext.Web; List oList = oWebsite.Lists.GetByTitle("My Announcements List"); oList.DeleteObject(); clientContext.ExecuteQuery();
ClientContext clientContext = new ClientContext(siteUrl); SP.List oList = clientContext.Web.Lists.GetByTitle("Announcements"); ListItem oListItem = oList.GetItemById(2); oListItem.DeleteObject(); clientContext.ExecuteQuery();
ClientContext oClientContext = new ClientContext("http://MyServer/sites/MySiteCollection"); File oFile = oClientContext.Web.GetFileByServerRelativeUrl("/sites/MySiteCollection/SitePages/Home.aspx "); LimitedWebPartManager limitedWebPartManager = oFile.GetLimitedWebPartManager(P...
[HttpPost] public ActionResult ContactUs(ContactUsModel contactObject) { // This line checks to see if the Model is Valid by verifying each Property in the Model meets the data validation rules if(ModelState.IsValid) { } return View(contactObject); } The model class p...
when the object is deleted, delete all the objects in the association.
when the object is deleted, delete all the objects in the association. In addition to that, when an object is removed from the association and not associated with another object (orphaned), also delete it.
when an object is save/update/delete, check the associations and save/update/delete all the objects found. In additional to that, when an object is removed from the association and not associated with another object (orphaned), also delete it.
If you need to delete a lot of records quickly, ActiveRecord gives .delete_all method. to be called directly on a model, to delete all records in that table, or a collection. Beware though, as .delete_all does not instantiate any object hence does not provide any callback (before_* and after_destroy...
# this method can be anything and anywhere as long as it is accessible for connection @pyqtSlot() def run_on_complete(): pass # An object containing methods you want to run in a thread class Worker(QObject): complete = pyqtSignal() @pyqtSlot() def a_method_to_run...
Select the .xcdatamodeld file. You will notice you have no entities. You will have to create one yourself. At the bottom of Xcode you will notice a button that says "Add Entity" click it and you will have a new entity for you to work with on the project. In this step there are ...

Page 6 of 23