Tutorial by Examples

In elm-repl, type a piece of code to get its value and inferred type. Try the following to learn about the various types that exist: > 42 42 : number > 1.987 1.987 : Float > 42 / 2 21 : Float > 42 % 2 0 : Int > 'e' 'e' : Char > "e" "e" : St...
Type variables are uncapitalized names in type-signatures. Unlike their capitalized counterparts, such as Int and String, they do not represent a single type, but rather, any type. They are used to write generic functions that can operate on any type or types, and are particularly useful for writing...
Sometimes we want to give a type a more descriptive name. Let's say our app has a data type representing users: { name : String, age : Int, email : String } And our functions on users have type signatures along the lines of: prettyPrintUser : { name : String, age : Int, email : String } -> S...
Aliasing types cuts down on boilerplate and enhances readability, but it is no more type-safe than the aliased type itself is. Consider the following: type alias Email = String type alias Name = String someEmail = "[email protected]" someName = "Benedict" sendEmail ...
index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Trying out ports</title> </head> <body> <div id="app"></div> <script src="elm.js"></script> ...
Python 3 allows you to define function arguments which can only be assigned by keyword, even without default values. This is done by using star * to consume additional positional parameters without setting the keyword parameters. All arguments after the * are keyword-only (i.e. non-positional) arg...
Sometimes a column should show different content than just the toString value of the cell item. In this case the TableCells created by the cellFactory of the TableColumn is customized to change the layout based on the item. Important Note: TableView only creates the TableCells that are shown in the...
A common task is to convert all columns of a data.frame to character class for ease of manipulation, such as in the cases of sending data.frames to a RDBMS or merging data.frames containing factors where levels may differ between input data.frames. The best time to do this is when the data is read ...
Rational represents a rational number as numerator and denominator: r1 = Rational(2, 3) r2 = 2.5.to_r r3 = r1 + r2 r3.numerator # => 19 r3.denominator # => 6 Rational(2, 4) # => (1/2) Other ways of creating a Rational Rational('2/3') # => (2/3) Rational(3) # => (3/1...
1i # => (0+1i) 1.to_c # => (1+0i) rectangular = Complex(2, 3) # => (2+3i) polar = Complex('1@2') # => (-0.4161468365471424+0.9092974268256817i) polar.rectangular # => [-0.4161468365471424, 0.9092974268256817] rectangular.polar # => [3.605551275463989, 0.9827937232...
Metaclass syntax Python 2.x2.7 class MyClass(object): __metaclass__ = SomeMetaclass Python 3.x3.0 class MyClass(metaclass=SomeMetaclass): pass Python 2 and 3 compatibility with six import six class MyClass(six.with_metaclass(SomeMetaclass)): pass
Ubuntu On recent Ubuntu versions, you can install an up-to-date version of CouchDB with sudo apt-get install couchdb. For older versions, such as Ubuntu 14.04, you should run: sudo add-apt-repository ppa:couchdb/stable -y sudo apt-get update sudo apt-get install couchdb -y Fedora To install ...
A do construct is a looping construct which has a number of iterations governed by a loop control integer i do i=1, 5 print *, i end do print *, i In the form above, the loop variable i passes through the loop 5 times, taking the values 1 to 5 in turn. After the construct has completed th...
<!--- Define collection ---> <cfset attributes = { "name": "Sales", "type": "text", "value": "Connection" }> <!--- cfloop tag with attribute collection can be used to loop through the elements of a struc...
<cfscript> /*define collection*/ attributes = { "name": "Sales", "type": "text", "value": "Connection" }; for(attribute in attributes){ /* attribute variable will contain the key name of each key value ...
For example, if you are sending an email to a customer after starting a task, it's best to immediately redirect the user to the next page while queuing the email to be sent in the background. This will speed up the load time for the next page, since sending an email can sometimes take several second...
Each of Laravel's queue drivers are configured from the config/queue.php file. A queue driver is the handler for managing how to run a queued job, identifying whether the jobs succeeded or failed, and trying the job again if configured to do so. Out of the box, Laravel supports the following queue ...
Placeholders in the query string need to be set by using the set* methods: String sql = "SELECT * FROM EMP WHERE JOB = ? AND SAL > ?"; //Create statement to make your operations PreparedStatement statement = connection.prepareStatement(sql); statement.setString(1, "MANAGER&...
SQL Server Reporting Services can typically be installed with SQL Server installation media. An installation of SQL Server will be required, either locally or on a server. Starting with SQL Server 2008 R2, SSRS has the option to integrate with SharePoint instead of running a separate website.
Simple Dual Port RAM with separate addresses and clocks for read/write operations. module simple_ram_dual_clock #( parameter DATA_WIDTH=8, //width of data bus parameter ADDR_WIDTH=8 //width of addresses buses )( input [DATA_WIDTH-1:0] data, //da...

Page 333 of 1336