Tutorial by Examples: by

Consider following html code <ul> <li id=“one” class=“main”>Item 1</li> <li id=“two” class=“main”>Item 2</li> <li id=“three” class=“main”>Item 3</li> <li id=“four”>Item 4</li> </ul> Following dom tree will be constructed ba...
# example data DT = data.table(iris) DT[, Bin := cut(Sepal.Length, c(4,6,8))] Using .N .N in j stores the number of rows in a subset. When exploring data, .N is handy to... count rows in a group, DT[Species == "setosa", .N] # 50 or count rows in all groups, DT[, .N,...
var go = GameObject.Find("NameOfTheObject"); ProsConsEasy to usePerformance degrades along the number of gameobjects in sceneStrings are weak references and suspect to user errors
var go = GameObject.FindGameObjectWithTag("Player"); ProsConsPossible to search both single objects and entire groupsStrings are weak references and suspect to user errors.Relatively fast and efficientCode is not portable as tags are hard coded in scripts.
ExampleScript script = GameObject.FindObjectOfType<ExampleScript>(); GameObject go = script.gameObject; FindObjectOfType() returns null if none is found. ProsConsStrongly typedPerformance degrades along the number of gameobjects needed to evaluatePossible to search both single objects...
> List.repeat 3 "abc" ["abc","abc","abc"] : List String You can give List.repeat any value: > List.repeat 2 {a = 1, b = (2,True)} [{a = 1, b = (2,True)}, {a = 1, b = (2,True)}] : List {a : Int, b : (Int, Bool)}
List.sortBy allows to use a function on the elements and use its result for the comparison. > List.sortBy String.length ["longest","short","medium"] ["short","medium","longest"] : List String -- because the lengths are: [7,5,6] It ...
class SortDataObject extends DataObject { private static $db = array( 'Name' => 'Varchar', 'SortOrder' => 'Int' ); private static $default_sort = 'SortOrder DESC'; }
Given the following DataFrame: In [11]: df = pd.DataFrame(np.random.randn(6, 3), columns=['A', 'B', 'C']) In [12]: df.set_index(['A', 'B'], inplace=True) In [13]: df Out[13]: C A B 0.902764 -0.259656 -1.864541 -0.695893 0.308893 0...
SELECT department, COUNT(*) AS "Man_Power" FROM employees GROUP BY department;
SELECT department, COUNT(*) AS "Man_Power" FROM employees GROUP BY department HAVING COUNT(*) >= 10; Using GROUP BY ... HAVING to filter aggregate records is analogous to using SELECT ... WHERE to filter individual records. You could also say HAVING Man_Power >= 10 since HAVIN...
If you need to sort the results of a UNION, use this pattern: ( SELECT ... ) UNION ( SELECT ... ) ORDER BY Without the parentheses, the final ORDER BY would belong to the last SELECT.
There are a couple of default recognizers available in Xamarin.Forms, one of them is the TapGestureRecognizer. You can add them to virtually any visual element. Have a look at a simple implementation which binds to an Image. Here is how to do it in code. var tappedCommand = new Command(() => {...
# example data DT = data.table(Titanic) Suppose we want to see each class only if a majority survived: DT[, if (sum(N[Survived=="Yes"]) > sum(N[Survived=="No"]) ) .SD, by=Class] # Class Sex Age Survived N # 1: 1st Male Child No 0 # 2: 1st Fema...
sudo apt-add-repository ppa:brightbox/ruby-ng Hit Enter to confirm sudo apt-get update Then you can install your ruby version of choice (the ppa supports ruby2.0 ruby2.1 ruby2.2 ruby2.3 and legacy versions ruby1.8 ruby1.9.1) Don't forget to include the respective -dev package for your version. Ot...
From the documentation : In C#, arguments can be passed to parameters either by value or by reference. Passing by reference enables function members, methods, properties, indexers, operators, and constructors to change the value of the parameters and have that change persist in the calling e...
Get all Google Forms with the word "Untitled" in the file name. function mainSearchFunction(searchStr) { var fileInfo,arrayFileIDs,arrayFileNames,arrayOfIndexNumbers, allFileIDsWithStringInName,i,searchStr,thisID;//Declare variables if (!searchStr) { searchStr = &quo...
The easiest way to install and manage various versions of Ruby with rbenv is to use the ruby-build plugin. First clone the rbenv repository to your home directory: $ git clone https://github.com/rbenv/rbenv.git ~/.rbenv Then clone the ruby-build plugin: $ git clone https://github.com/rbenv/rub...
import java.util.ArrayList; import java.util.List; import static java.lang.System.out; public class PolymorphismDemo { public static void main(String[] args) { List<FlyingMachine> machines = new ArrayList<FlyingMachine>(); machines.add(new FlyingMachine())...
You can get the current location and local places of user by using the Google Places API. Ar first, you should call the PlaceDetectionApi.getCurrentPlace() method in order to retrieve local business or other places. This method returns a PlaceLikelihoodBuffer object which contains a list of PlaceLi...

Page 9 of 23