Tutorial by Examples

We write custom action filters for various reasons. We may have a custom action filter for logging, or for saving data to database before any action execution. We could also have one for fetching data from the database and setting it as the global values of the application. To create a custom actio...
To get the timestamp in seconds Math.floor((new Date().getTime()) / 1000)
With UIAlertController, action sheets like the deprecated UIActionSheet are created with the same API as you use for AlertViews. Simple Action Sheet with two buttons Swift let alertController = UIAlertController(title: "Demo", message: "A demo with two buttons", preferredStyle...
getPreferences(int) returns the preferences saved by Activity's class name as described in the docs : Retrieve a SharedPreferences object for accessing preferences that are private to this activity. This simply calls the underlying getSharedPreferences(String, int) method by passing in this acti...
You may want to create a duplicate of a table: CREATE TABLE ClonedEmployees AS SELECT * FROM Employees; You can use any of the other features of a SELECT statement to modify the data before passing it to the new table. The columns of the new table are automatically created according to the selec...
To get your most recent stash after running git stash, use git stash apply To see a list of your stashes, use git stash list You will get a list that looks something like this stash@{0}: WIP on master: 67a4e01 Merge tests into develop stash@{1}: WIP on master: 70f0d95 Add user role to loca...
YourAsyncTask task = new YourAsyncTask(); task.execute(); task.cancel(); This doesn't stop your task if it was in progress, it just sets the cancelled flag which can be checked by checking the return value of isCancelled() (assuming your code is currently running) by doing this: class YourAsyn...
The following is an excerpt from Gradle - What is a non-zero exit value and how do I fix it?, see it for the full discussion. Let's say you are developing an application and you get some Gradle error that appears that generally will look like so. :module:someTask FAILED FAILURE: Build failed with...
To spawn a new process in which you need unbuffered output (e.g. long-running processes which might print output over a period of time rather than printing and exiting immediately), use child_process.spawn(). This method spawns a new process using a given command and an array of arguments. The retu...
Classes can be created as follow: class InputField { int maxLength; String name; } The class can be instantiated using the new keyword after which the field values will be null by default. var field = new InputField(); Field values can then be accessed: // this will trigger the sette...
<p contenteditable>This is an editable paragraph.</p> Upon clicking on the paragraph, the content of it can be edited similar to an input text field. When the contenteditable attribute is not set on an element, the element will inherit it from its parent. So all child text of a conte...
The java.math.BigInteger class provides operations analogues to all of Java's primitive integer operators and for all relevant methods from java.lang.Math. As the java.math package is not automatically made available you may have to import java.math.BigInteger before you can use the simple class nam...
You can compare BigIntegers same as you compare String or other objects in Java. For example: BigInteger one = BigInteger.valueOf(1); BigInteger two = BigInteger.valueOf(2); if(one.equals(two)){ System.out.println("Equal"); } else{ System.out.println("Not Equal"...
{ "name": "my-project", "version": "0.0.1", "description": "This is a project.", "author": "Someone <[email protected]>", "contributors": [{ "name": "Som...
"dependencies": { "module-name": "0.1.0" } exact: 0.1.0 will install that specific version of the module. newest minor version: ^0.1.0 will install the newest minor version, for example 0.2.0, but won't install a module with a higher major version e.g. 1.0.0 newe...
This command will drop index in the table. It works on SAP ASE server. Syntax: DROP INDEX [table name].[index name] Example: DROP INDEX Cars.index_1
Look at the contents of /etc/redhat-release cat /etc/redhat-release Here is the output from a Fedora 24 machine: Fedora release 24 (Twenty Four) As mentioned in the debian-based response, you can also use the lsb_release -a command, which outputs this from a Fedora 24 machine: LSB Version: ...
ReactJS is an open-source, component based front end library responsible only for the view layer of the application. It is maintained by Facebook. ReactJS uses virtual DOM based mechanism to fill in data (views) in HTML DOM. The virtual DOM works fast owning to the fact that it only changes individ...
GroupBy is an easy way to sort a IEnumerable<T> collection of items into distinct groups. Simple Example In this first example, we end up with two groups, odd and even items. List<int> iList = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var grouped = iList.GroupBy(x => x ...
Post::find()->all(); // SELECT * FROM post or the shorthand (Returns an active record model instance by a primary key or an array of column values.) Post::findAll(condition); returns an array of ActiveRecord instances. Find All with where Condition $model = User::find() ->w...

Page 185 of 1336