Tutorial by Examples: n

open(my $fh, '<', "/some/path") or die $!; my @ary = <$fh>; When evaluated in list context, the diamond operator returns a list consisting of all the lines in the file (in this case, assigning the result to an array supplies list context). The line terminator is retained, and ...
XE2 program CrossPlatformHelloWorld; uses FMX.Dialogs; {$R *.res} begin ShowMessage('Hello world!'); end. Most of the Delphi supported platforms (Win32/Win64/OSX32/Android32/iOS32/iOS64) also support a console so the WriteLn example fits them well. For the platforms that require...
Switching into Protected Mode is easy: you just need to set a single bit in a Control Register. But staying in Protected Mode, without the CPU throwing up its hands and resetting itself due to not knowing what to do next, takes a lot of preparation. In short, the steps required are as follows: ...
GitHub helps you quickly add a license to your repository, as an alternative for adding your own text/markdown file. In your repository, click 'Create new file' On next page: Type LICENSE.md or LICENSE.txt as the new file's file name. The Want to use a new template? dialog will appea...
AnchorPane a is a layout that allows placing the content at a specific distance from it's sides. There are 4 methods for setting and 4 methods for getting the distances in AnchorPane. The first parameter of these methods is the child Node. The second parameter of the setters is the Double value to ...
TextInputDialog allows the to ask the user to input a single String. TextInputDialog dialog = new TextInputDialog("42"); dialog.setHeaderText("Input your favourite int."); dialog.setTitle("Favourite number?"); dialog.setContentText("Your favourite int: ");...
Dim aList as New List(Of String) aList.Add("one") aList.Add("two") aList.Add("three") For Each str As String in aList System.Console.WriteLine(str) Next Produces the following output: one two three Another option, would be to loop through using the ...
Microsoft Access is an Application Generator for developing databases and data-driven applications, primarily for local use. Microsoft Access consists of two main elements: A Relational Database Management System (RDBMS) that combines the Microsoft Jet Database Engine (Access 2003 and earler) or ...
Related to Monads are F# computation expressions (CE). A programmer typically implements a CE to provide an alternative approach to chaining Monads, ie instead of this: let v = m >>= fun x -> n >>= fun y -> return_ (x, y) You can write this: let v = ce { let! x = m ...
Overview: The default data type for numeric arrays in MATLAB is double. double is a floating point representation of numbers, and this format takes 8 bytes (or 64 bits) per value. In some cases, where e.g. dealing only with integers or when numerical instability is not an imminent issue, such high ...
Most programming languages, including F#, evaluate computations immediately in accord with a model called Strict Evaluation. However, in Lazy Evaluation, computations are not evaluated until they are needed. F# allows us to use lazy evaluation through both the lazy keyword and sequences. // define ...
F#, like most programming languages, uses Strict Evaluation by default. In Strict Evaluation, computations are executed immediately. In contrast, Lazy Evaluation, defers execution of computations until their results are needed. Moreover, the results of a computation under Lazy Evaluation are cached,...
In Emacs, file has the same meaning as in the operating system, and is used for permanent storage of data. A buffer is the internal representation of a file being edited. Files can be read into buffers using C-x C-f, and buffers can be written to files using C-x C-s (save file at its current locatio...
Emacs's user interface uses terms that were coined early and can be unsettling to users used to a more modern terminology. Frame In Emacs, what is otherwise called a window (the area of the display used by a program) is called a frame. Emacs starts using one frame, though additional frames may b...
Sometimes it is desirable to evaluate a nullable expression in an if-else fashion. The elvis operator, ?:, can be used in Kotlin for such a situation. For instance: val value: String = data?.first() ?: "Nothing here." The expression above returns "Nothing here" if data?.firs...
!! suffixes ignore nullability and returns a non-null version of that type. KotlinNullPointerException will be thrown if the object is a null. val message: String? = null println(message!!) //KotlinNullPointerException thrown, app crashes
The & character appears first in entity references and must be escaped in element content or in attribute content. <?xml version="1.0"?> <document attribute="An ampersand is escaped as &"> An ampersand can also be escaped as & in element conte...
The < character appears first in entity tags and must be escaped in element content or in attribute content. <?xml version="1.0"?> <document attribute="A lower-than sign is escaped as <"> 2 + 2 < 5 </document>
The ]]> character sequence is not allowed in element content. The easiest way to escape it is to escape > as >. <?xml version="1.0"?> <document> The sequence ]]> cannot appear in element content. </document>
Attribute values can appear in simple or double quotes. The appropriate character must be escaped. <?xml version="1.0"?> <document quot-attribute="This is a "double quote" and this one is 'simple'" apos-attribute='This is a 'simple quot...

Page 397 of 1088