Tutorial by Examples: del

Many languages allow regex to be enclosed or delimited between a couple of specific characters, usually the forward slash /. Delimiters have an impact on escaping: if the delimiter is / and the regex needs to look for / literals, then the forward slash must be escaped before it can be a literal (\/...
EntityFramewok Fluent API is a powerful and elegant way of mapping your code-first domain models to underlying database. This also can be used with code-first with existing database. You have two options when using Fluent API: you can directly map your models on OnModelCreating method or you can cre...
ALTER TABLE Person DROP CONSTRAINT pk_PersonSSN
MERGE INTO targetTable USING sourceTable ON (targetTable.PKID = sourceTable.PKID) WHEN MATCHED AND (targetTable.PKID > 100) THEN DELETE WHEN MATCHED AND (targetTable.PKID <= 100) THEN UPDATE SET targetTable.ColumnA = sourceTable.ColumnA, targetTable.Co...
When you created your own Models in a app, they still need to be registered in order to become available in the admin pages. This is done in the admin submodule. If your app was created using manage.py startapp, an admin.py file should already lay in you app module. Otherwise create it. #myapp/a...
Let's see MVP in action using a simple Login Screen. There are two Buttons—one for login action and another for a registration screen; two EditTexts—one for the email and the other for the password. LoginFragment (The View) public class LoginFragment extends Fragment implements LoginContract.Prese...
Validation attributes can be used to easily configure model validation. public class MyModel { public int id { get; set; } //sets the FirstName to be required, and no longer than 100 characters [Required] [StringLength(100)] public string FirstName { get; set; } } Th...
Considering a (post)model: public class User { public string FirstName { get; set; } public bool IsAdmin { get; set; } } With a view like so: @using (Html.BeginForm()) { @Html.EditorFor(model => model.FirstName) <input type="submit" value="Save" /...
scrollViewDidEndDecelerating: this tells the delegate that the scroll view has ended decelerating the scrolling movement. Objective C: - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { [self stoppedScrolling]; } - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView w...
This example shows how to define a simple model in Sails.js You can generate an empty model file by typing sails generate model car You'll find the new file Car.js in api/models/. Next, you fill in some details. modules.exports = { tableName : 'cars', connection : 'mongodb', attr...
Suppose you have a parentView into which you want to insert a new subView programmatically (eg. when you want to insert an UIImageView into a UIViewController's view), than you can do it as below. Objective-C [parentView addSubview:subView]; Swift parentView.addSubview(subView) You can also...
This example shows a helper class that contains methods useful, when executing the queries for data. Every method here uses Java Generic's in order to be very flexible. public <T> List<T> selectElements(AbstractDao<T, ?> dao) { if (dao == null) { return null; } ...
Shade is a library developed by OpenStack to simplify interactions with OpenStack clouds, like DreamHost. $ pip install shade
In same cases different models could have same fields and same procedures in the product life cycle. To handle these similarities without having code repetition inheritance could be used. Instead of inheriting a whole class, mixin design pattern offers us to inherit (or some says include) some met...
string path = @"c:\path\to\file.txt"; File.Delete(path); While Delete does not throw exception if file doesn't exist, it will throw exception e.g. if specified path is invalid or caller does not have the required permissions. You should always wrap calls to Delete inside try-catch bloc...
class base { }; class derived: public base { }; int main() { base* p = new derived(); delete p; // The is undefined behavior! } In section [expr.delete] §5.3.5/3 the standard says that if delete is called on an object whose static type does not have a virtual destructor: if the...
A lot of users find themselves in a situation where they just want to copy, move or delete a line quickly and return to where they were. Usually, if you'd want to move a line which contains the word lot below the current line you'd type something like: /lot<Esc>dd<C-o>p But to boost...
UISplitViewController must be the rootViewController of your application. AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.window = [[UIWindow alloc] i...
UISplitViewController needs to the root view controller of your app’s window AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] self.window.ba...
QModelIndex does not actually know about it's parent/child indexes, it only contains a row, a column and a pointer, and it is the models responsibility to use this data to provide information an index's relations. The model therefore needs to do a lot of conversions from the void* stored inside the ...

Page 11 of 23