Tutorial by Examples: f

You may sometimes want to change the size of a split or vsplit. To change the size of the currently active split, use :resize <new size>. :resize 30 for example would make the split 30 lines tall. To change the size of the currently active vsplit, use :vertical resize <new size>. :vert...
Quite often it's necessary to send/upload a file to a remote server, for example, an image, video, audio or a backup of the application database to a remote private server. Assuming the server is expecting a POST request with the content, here's a simple example of how to complete this task in Andro...
Consider the program implicit none integer f, i f(i)=i print *, f(1) end Here f is a statement function. It has integer result type, taking one integer dummy argument.1 Such a statement function exists within the scope in which it is defined. In particular, it has access to variables an...
You can loop over a file. <cfloop file="#myFile#" index="line"> <cfoutput> #line#<br /> </cfoutput> </cfloop>
Instead of web pages, we can also load the document files into iOS WebView like .pdf, .txt, .doc etc.. loadData method is used to load NSData into webview. Swift //Assuming there is a text file in the project named "home.txt". let localFilePath = NSBundle.mainBundle().pathForResource(&...
+ (CALayer *)gradientBGLayerForBounds:(CGRect)bounds colors:(NSArray *)colors { CAGradientLayer * gradientBG = [CAGradientLayer layer]; gradientBG.frame = bounds; gradientBG.colors = colors; return gradientBG; }
Informally, a monad is a container of elements, notated as F[_], packed with 2 functions: flatMap (to transform this container) and unit (to create this container). Common library examples include List[T], Set[T] and Option[T]. Formal definition Monad M is a parametric type M[T] with two operatio...
Returns a sub string starting with the left most char of a string and up to the maximum length specified. Parameters: character expression. The character expression can be of any data type that can be implicitly converted to varchar or nvarchar, except for text or ntext max length. An integer n...
An interface contains the signatures of methods, properties and events. The derived classes defines the members as the interface contains only the declaration of the members. An interface is declared using the interface keyword. interface IProduct { decimal Price { get; } } class Product...
If an array happens to have one or more nil elements and these need to be removed, the Array#compact or Array#compact! methods can be used, as below. array = [ 1, nil, 'hello', nil, '5', 33] array.compact # => [ 1, 'hello', '5', 33] #notice that the method returns a new copy of the array w...
The code sample below shows one way to retrieve records from an MSSql Server in a background thread using FireDAC. Tested for Delphi 10 Seattle As written: The thread retrieves data using its own TFDConnection and TFDQuery and transfers the data to the form's FDQuery in a call to Sychronize...
In this example, a model will learn to classify fruits given certain features, using the Labels for training. WeightColorLabel0.5greenapple0.6purpleplum3greenwatermelon0.1redcherry0.5redapple Here the a model will take Weight and Color as features to predict the Label. For instance [0.15, 'red'] s...
We can use flatten() in order to lazily reduce the nesting of a multi-dimensional sequence. For example, lazy flattening a 2D array into a 1D array: // A 2D array of type [[Int]] let array2D = [[1, 3], [4], [6, 8, 10], [11]] // A FlattenBidirectionalCollection<[[Int]]> let lazilyFlatten...
Melting: The basics Melting is used to transform data from wide to long format. Starting with a wide data set: DT = data.table(ID = letters[1:3], Age = 20:22, OB_A = 1:3, OB_B = 4:6, OB_C = 7:9) We can melt our data using the melt function in data.table. This returns another data.table in long...
SAS is an integrated system of software solutions that enables you to perform the following tasks: data entry, retrieval, and management report writing and graphics design statistical and mathematical analysis business forecasting and decision support operations research and project managemen...
Validate that an attribute's value matches a regular expression using format and the with option. class User < ApplicationRecord validates :name, format: { with: /\A\w{6,10}\z/ } end You can also define a constant and set its value to a regular expression and pass it to the with: option. ...
You can check if a value is included in an array using the inclusion: helper. The :in option and its alias, :within show the set of acceptable values. class Country < ApplicationRecord validates :continent, inclusion: { in: %w(Africa Antartica Asia Australia ...
The first element of sys.argv[0] is the name of the python file being executed. The remaining elements are the script arguments. # script.py import sys print(sys.argv[0]) print(sys.argv) $ python script.py => script.py => ['script.py'] $ python script.py fizz => script.py ...
You can install NLTK over pip (pip install nltk).After it is installed, many components will not be present, and you will not be able to use some of NLTK's features. From your Python shell, run the function ntlk.download() to select which additional packages you want to install using UI. Alternati...
This example goes over how to set up CoreNLP from the latest official release. This example will take you through downloading the package, and running a simple command-line invocation of CoreNLP. Prerequisites: Java JVM 8. The command java -version should complete successfully with a line like: ...

Page 182 of 457