Tutorial by Examples: al

Partial application means calling a function with less arguments than it has and saving the result as another function (that waits for the rest of the arguments). multiplyBy: Int -> Int -> Int multiplyBy x y = x * y multiplyByTwo : Int -> Int -- one Int has disappeared! we ...
Enum classes as any other classes can have a constructor and be initialized enum class Color(val rgb: Int) { RED(0xFF0000), GREEN(0x00FF00), BLUE(0x0000FF) }
There are many situation where you want to draw an image that is rotated, scaled, and translated. The rotation should occur around the center of the image. This is the quickest way to do so on the 2D canvas. These functions a well suited to 2D games where the expectation is to render a few hundred e...
Pyinstaller is a normal python package. It can be installed using pip: pip install pyinstaller Installation in Windows For Windows, pywin32 or pypiwin32 is a prerequisite. The latter is installed automatically when pyinstaller is installed using pip. Installation in Mac OS X PyInstaller works...
In the simplest use-case, just navigate to the directory your file is in, and type: pyinstaller myfile.py Pyinstaller analyzes the file and creates: A myfile.spec file in the same directory as myfile.py A build folder in the same directory as myfile.py A dist folder in the same directory as m...
This command will display all the registered Valet links you have created and their corresponding file paths on your computer. Command: valet links Sample Output: ... site1 -> /path/to/site/one site2 -> /path/to/site/two ... Note 1: You can run this command from anywhere not just f...
Detailed instructions on getting model-view-controller set up or installed.
XML pre-defines five general entities that can be used without declaring them: & " ' < > They are associated with the names amp, quot, apos, lt and gt. <?xml version="1.0"?> <entities> & is an ampersand. " is a quote. ' is...
It is possible to define one's own general entities. The declaration occurs in the DTD subset, with a name and the associated replacement text. It can then be used in the document using the entity reference syntax &...;, either in text, or in attribute values. <?xml version="1.0"?...
${parameter:-word} If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted. $ unset var $ echo "${var:-XX}" # Parameter is unset -> expansion XX occurs XX $ var="" # Parameter is null ...
To create a JAR containing all of its dependencies, it is possible to use the built-in descriptor format jar-with-dependencies. The following example configures an execution of the Assembly Plugin bound to the package phase, using this built-in descriptor and declaring a main class of com.example: ...
In [15]: df = pd.DataFrame({"A":[1,1,2,3,1,1],"B":[5,4,3,4,6,7]}) In [21]: df Out[21]: A B 0 1 5 1 1 4 2 2 3 3 3 4 4 1 6 5 1 7 To get unique values in column A and B. In [22]: df["A"].unique() Out[22]: array([1, 2, 3]) In [23]: df[&qu...
You can take advantage of Apache Maven's powerful features in Eclipse by installing the M2Eclipse feature. Follow these steps to install Maven in Eclipse: Open Eclipse and select Help → Install New Software… In the opened dialog, select the Add... button to add a new repository. Fill ...
Supported by IE11+ View Result Use these 3 lines to vertical align practically everything. Just make sure the div/image you apply the code to has a parent with a height. CSS div.vertical { position: relative; top: 50%; transform: translateY(-50%); } HTML <div class="vertica...
$ man -w find /usr/share/man/man1/find.1.gz $ man -w printf /usr/share/man/man1/printf.1.gz $ man -w man /usr/share/man/man1/man.1.gz
The most common way to test Angular 2 apps is with the Jasmine test framework. Jasmine allows you to test your code in the browser. Install To get started, all you need is the jasmine-core package (not jasmine). npm install jasmine-core --save-dev --save-exact Verify To verify that Jasmine is...
You can search for man pages containing a particular string in their description using: man -k <string> For example: man -k unzip Might return: man -k unzip IO::Uncompress::Bunzip2(3pm) - Read bzip2 files/buffers IO::Uncompress::Gunzip(3pm) - Read RFC 1952 files/buffers IO::Uncom...
The following terms describe different ways to case identifiers. Pascal Casing The first letter in the identifier and the first letter of each subsequent concatenated word are capitalized. You can use Pascal case for identifiers of three or more characters. For example: BackColor Camel Casing Th...
Use a signal's connect method to connect a function to a signal. When a signal is sent, each connected function is called with the sender and any named arguments the signal provides. from flask import template_rendered def log_template(sender, template, context, **kwargs): sender.logger.in...
You can create a UIColor from a hexadecimal number or string, e.g. 0xff00cc, "#FFFFFF" Swift Int Value extension UIColor { convenience init(hex: Int, alpha: CGFloat = 1.0) { let r = CGFloat((hex >> 16) & 0xff) / 255 let g = CGFloat((hex >> 08) &amp...

Page 58 of 269