Tutorial by Examples: f

If we want to replace only the first occurrence in a line, we use sed as usual: $ cat example aaaaabbbbb aaaaaccccc aaaaaddddd $ sed 's/a/x/' example xaaaabbbbb xaaaaccccc xaaaaddddd But what if we want to replace all occurrences? We just add the g pattern flag at the end: $ sed 's/a/x/...
A form gives the user a way to change data in your application, in a structured way. To mutate a simple array of data, we create a form using a form builder: use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\F...
A custom form type is a class which defines a reusable form component. Custom form components can be nested to create complicated forms. Instead of creating a form in the controller using a form builder, you can use your own type to make the code more readable, reusable and maintanable. Create a c...
Field-Symbols are ABAP's equivalent to pointers, except that Field-Symbols are always dereferenced (it is not possible to change the actual address in memory). Declaration To declare a Field-Symbol the keyword FIELD-SYMBOLS must be used. Types can be generic (ANY [... TABLE]) to handle a wide vari...
Essential for data references is the addition REF TO after TYPE. Dynamic Creation of Structures If the type of a structure should be decided on runtime, we can define our target structure as reference to the generic type data. DATA wa TYPE REF TO data. To give wa a type we use the statement CR...
AppBundle/Entity/Person.php <?php namespace AppBundle\Entity; /** * Person */ class Person { /** * @var int */ private $id; /** * @var string */ private $name; /** * @var int */ private $age; /** ...
AppBundle/Entity/Person.php <?php namespace AppBundle\Entity; use DoctrineORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity * @ORM\Table(name="persons") * @ORM\Entity(repositoryClass="AppBundle\Entity\PersonRe...
It is possible to define a data type with field labels. data Person = Person { age :: Int, name :: String } This definition differs from a normal record definition as it also defines *record accessors which can be used to access parts of a data type. In this example, two record accessors are de...
You can test for IndexedDB support in the current environment by checking for the presence of the window.indexedDB property: if (window.indexedDB) { // IndexedDB is available }
Basically, the Scan object retrieves all the rows from the table, but what if you want to retrieve only the rows where the value of a given column is equal to something ? Let me introduce you the Filters, they work like the WHERE in SQL. Before starting using the filters, if you know how your row_k...
There are two ways to define an anonymous function: the full syntax and a shorthand. Full Anonymous Function Syntax (fn [x y] (+ x y)) This expression evaluates to a function. Any syntax you can use with a function defined with defn (&, argument destructuring, etc.), you can also do with wi...
In the node JS command prompt, inside your loopback project, type the following command to create a new model. slc loopback:model If you have installed LoopBack CLI tool, you can create model with: lb model The command prompt will request informations about the model to create. In this examp...
Retrieve System DateTime VBA supports 3 built-in functions to retrieve the date and/or time from the system's clock. FunctionReturn TypeReturn ValueNowDateReturns the current date and timeDateDateReturns the date portion of the current date and timeTimeDateReturns the time portion of the current d...
These functions take a Variant that can be cast to a Date as a parameter and return an Integer representing a portion of a date or time. If the parameter can not be cast to a Date, it will result in a run-time error 13: Type mismatch. FunctionDescriptionReturned valueYear()Returns the year portion ...
DateDiff() DateDiff() returns a Long representing the number of time intervals between two specified dates. Syntax DateDiff ( interval, date1, date2 [, firstdayofweek] [, firstweekofyear] ) interval can be any of the intervals defined in the DatePart() function date1 and date2 are the two ...
Suppose we want to read and stack a bunch of similarly-formatted files. The quick solution is: rbindlist(lapply(list.files(patt="csv$"), fread), id=TRUE) We might not be satisfied with this for a couple reasons: It might run into errors when reading with fread or when stacking with ...
Specifies custom foreign key name if a foreign key not following EF's convention is desired. public class Person { public int IdAddress { get; set; } [ForeignKey(nameof(IdAddress))] public virtual Address HomeAddress { get; set; } } This can also be used when you have multipl...
Split vector of texts using one pattern: stri_split_fixed(c("To be or not to be.", "This is very short sentence.")," ") # [[1]] # [1] "To" "be" "or" "not" "to" "be." # # [[2]] # [1] "This" ...
theUsers = [ {id: 1, username: 'john'} {id: 2, username: 'lexy'} {id: 3, username: 'pete'} ] To retain only users whose id is greather than 2, use the following: [{id: 3, username: 'pete'}] Method 1 - using .filter filteredUsers = theUsers.filter (user) -> user.id >= 2 Met...
/// <summary> /// Read configuration values from app.config and convert to specified types /// </summary> public static class ConfigurationReader { /// <summary> /// Get value from AppSettings by key, convert to Type of default value or typ...

Page 200 of 457