Tutorial by Examples: is

Use case: remember the current URL to return to after adding a new record in a different (related) controller, for instance create a new contact to add to an invoice being edited. InvoiceController / actionUpdate: Url::remember(Url::current(), 'returnInvoice'); ContactController / actionCreate:...
Screenshot Adapter Class private class MyAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { final int EMPTY_VIEW = 77777; List<CustomData> datalist = new ArrayList<>(); MyAdapter() { super(); } @Override public RecyclerView.ViewHolder onCreateViewH...
first add the OkHttp to the gradle build file of the app module compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.squareup.okhttp:okhttp:2.4.0' compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2' Then make a class extending Application import android.app.Application; ...
Form object package formSubmission; public class Person { private String name; private int age; public String getName() { return name; } public void setName(String name) { this.name= name; } public int getAge() { return age; ...
Occasionally it's useful to assign one or more ports manually vs using the defaults. Doing so can solve port availability/permissions issues or accommodate running more than one ember instance at a time. To have ember-cli attempt to identify and assign an available port, use: ember serve --port ...
In Sprite-Kit, there is the concept of collisions which refers to the SK physics engine handling how physics objects interact when they collide i.e. which ones bounce off which other ones. It also has the concept of contacts, which is the mechanism by which your program gets informed when 2 physics...
There is a way to simplify defining autolayout for views using VFL. It may seem hard at first, but it is actually really easy to use. Some definitions first: | represents superview H: or V: represent current orientation - horizontal or vertical view names should be enclosed in square brackets ...
import UIKit class DoggyListViewController: UIViewController, UITableViewDataSource { @IBOutlet weak var emptyView: UIView? @IBOutlet weak var tableView: UITableView? @IBOutlet weak var spinner: UIActivityIndicatorView? fileprivate let dogPresenter = DoggyPresenter(dogSe...
You'll often want to assign something to an object if it is None, indicating it has not been assigned. We'll use aDate. The simplest way to do this is to use the is None test. if aDate is None: aDate=datetime.date.today() (Note that it is more Pythonic to say is None instead of == None.) ...
Below is an Employer entity class which is mapped to the table employer. As you can see I used fetch = FetchType.LAZY instead of fetch = FetchType.EAGER. The reason I am using LAZY is because Employer may have a lot of properties later on and every time I may not need to know all the fields of an Em...
To illustrate this, here is a function that has 3 different "wrong" behaviors parameter is completely stupid: we use a user-defined expression parameter has a typo: we use Oracle standard NO_DATA_FOUND error another, but not handled case Feel free to adapt it to your standards: DE...
Redis provides the SCAN command to iterate over the keys in the database matching a particular pattern. Redis supports glob style pattern matching in the SCAN command. The SCAN command provides a cursor-based iterator over the Redis keyspace. The iterative call sequence to SCAN starts with the us...
The redis-py client provides two classes StrictRedis and Redis to establish a basic connection to a Redis database. The Redis class is provided for backwards compatibility and new projects should use the StrictRedis class. One of the recommended ways to establish a connection, is to define the con...
The VisibleExp property is a boolean expression, that determines if given tab is visible (when logical expression is TRUE) or hidden. You specify VisibleExp property for PXTab controls in Aspx page: <px:PXTabItem Text="Credit Card Processing Info" BindingContext="form" ...
Drop/Delete your database If you are using SQLite for your database, just delete this file. If you are using MySQL/Postgres or any other database system, you will have to drop the database and then recreate a fresh database. You will now need to delete all the migrations file except "init.py...
For this example, we will used 4 bodies and will show only the last 8 bits of the bit masks for simplicity. The 4 bodies are 3 SKSpriteNodes, each with a physics body and a boundary: let edge = frame.insetBy(dx: 0, dy: 0) physicsBody = SKPhysicsBody(edgeLoopFrom: edge) Note that the 'ed...
Let's implement a basic protocol that converts Kelvin and Fahrenheit temperatures to Celsius. defmodule Kelvin do defstruct name: "Kelvin", symbol: "K", degree: 0 end defmodule Fahrenheit do defstruct name: "Fahrenheit", symbol: "°F", degree: 0 en...
A shift register of generic length. With serial in and serial out. library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity SHIFT_REG is generic( LENGTH: natural := 8 ); port( SHIFT_EN : in std_logic; SO : out std_logic; ...
When a Bash project turns into a library, it can become difficult to add new functionality. Function names, variables and parameters usually need to be changed in the scripts that utilize them. In scenarios like this, it is helpful to decouple the code and use an event driven design pattern. In said...
In the File menu, choose the 'Import...' option. This opens up the Import dialog box, which asks for the type of project/file you want to import. For a basic Java project, choose 'Existing Projects into Workspace' from the 'General' folder. Next, select the directory where the project(s) is lo...

Page 96 of 109