Tutorial by Examples: f

C# developers get a lot of null reference exceptions to deal with. F# developers don't because they have the Option type. An Option<> type (some prefer Maybe<> as a name) provides a Some and a None return type. It makes it explicit that a method may be about to return a null record. For...
One of Angular's strength's is client-side form validation. Dealing with traditional form inputs and having to use interrogative jQuery-style processing can be time-consuming and finicky. Angular allows you to produce professional interactive forms relatively easily. The ng-model directive provide...
Imagine that we have a class Math.php with logic of calculating of fiobanacci and factorial numbers. Something like this: <?php class Math { public function fibonacci($n) { if (is_int($n) && $n > 0) { $elements = array(); $elements[1] = 1; ...
install the required Microsoft.SqlServer.Types assembly; they are not installed by default, and are available from Microsoft here as "Microsoft® System CLR Types for Microsoft® SQL Server® 2012" - note that there are separate installers for x86 and x64. install Dapper.EntityFramew...
The http_build_query() will create a query string from an array or object. These strings can be appended to a URL to create a GET request, or used in a POST request with, for example, cURL. $parameters = array( 'parameter1' => 'foo', 'parameter2' => 'bar', ); $queryString = http_b...
We can read from a text file: dt <- fread("my_file.csv") Unlike read.csv, fread will read strings as strings, not as factors by default. See the [topic on fread][need_a_link] for more examples.
For efficiency, data.table offers a way of altering a data.frame or list to make a data.table in-place: # example data.frame DF = data.frame(x = letters[1:5], y = 1:5, z = (1:5) > 3) # modification setDT(DF) Note that we do not <- assign the result, since the object DF has been modifi...
Examples of monotonic predicates are: unification with (=)/2 or unify_with_occurs_check/2 dif/2, expressing disequality of terms CLP(FD) constraints like (#=)/2 and (#>)/2, using a monotonic execution mode. Prolog predicates that only use monotonic goals are themselves monotonic. Monoton...
Here are examples of how to use monotonic predicates instead of impure, non-monotonic constructs in your programs: dif/2 is meant to be used instead of non-monotonic constructs like (\=)/2 arithmetic constraints (CLP(FD), CLP(Q) and others) are meant to be used instead of moded arithmetic predi...
It is sometimes argued that, for the sake of efficiency, we must accept the use of non-monotonic constructs in real-world Prolog programs. There is no evidence for this. Recent research indicates that the pure monotonic subset of Prolog may not only be sufficient to express most real-world programs...
List<Integer> nums = Arrays.asList(1, 2, 3); List<String> strings = nums.stream() .map(Object::toString) .collect(Collectors.toList()); That is: Create a stream from the list Map each element using Object::toString Collect the String values into a List using Collectors...
CSS div.needle { margin: 100px; height: 150px; width: 150px; transform: rotateY(85deg) rotateZ(45deg); /* presentational */ background-image: linear-gradient(to top left, #555 0%, #555 40%, #444 50%, #333 97%); box-shadow: inset 6px 6px 22px 8px #272727; } HTML <div c...
In general, UWP is used for making a single application that runs on Windows 10 across many different devices. However, it is also possible to make code tailored to specific devices. You can achieve this in several different ways. Different XAML Layout If you want to use a specific layout on for a...
Adding a footer is not natively possible. Luckily, we can make use of jQuery and CSS to add a footer to the slides of an ioslides presentation rendered with knitr. First of all we have to include the jQuery plugin. This is done by the line <script src="https://ajax.googleapis.com/ajax/libs...
fizzbuzz = fn (0, 0, _) -> "FizzBuzz" (0, _, _) -> "Fizz" (_, 0, _) -> "Buzz" (_, _, x) -> x end my_function = fn(n) -> fizzbuzz.(rem(n, 3), rem(n, 5), n) end
Modifiers are a way to indicate how external objects can access an object's data. Public Means any object can access this without restriction Private Means only the declaring object can access and view this Protected Means only the declaring object and any object that inherits from...
Dim flags = BindingFlags.Static Or BindingFlags.Public Or BindingFlags.Instance Dim members = GetType(String).GetMembers(flags) For Each member In members Console.WriteLine($"{member.Name}, ({member.MemberType})") Next
ArrayList is one of the inbuilt data structures in Java. It is a dynamic array (where the size of the data structure not needed to be declared first) for storing elements (Objects). It extends AbstractList class and implements List interface. An ArrayList can contain duplicate elements where it mai...
Test classes are created as local classes in a special unit test include. This is the basic structure of a test class: CLASS lcl_test DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. DATA: mo_cut TYPE REF TO zcl_...
This example assumes that your lookup column is named MultiLookupColumnName and that you want to set your multi-lookup field to lookup to the items with IDs 1 and 2. Using jQuery AJAX 2010 var listName = "YourListName"; var lookupList = "LookupListName"; var idOfItemToUpdate...

Page 175 of 457