Tutorial by Examples

Supposing the following list we can sort a variety of ways. val names = List("Kathryn", "Allie", "Beth", "Serin", "Alana") The default behavior of sorted() is to use math.Ordering, which for strings results in a lexographic sort: names.sorted /...
The first two arguments to format are an output stream and a control string. Basic use does not require additional arguments. Passing t as the stream writes to *standard-output*. > (format t "Basic Message") Basic Message nil That expression will write Basic Message to standard ou...
By default, containers created with docker run are given a random name like small_roentgen or modest_dubinsky. These names aren't particularly helpful in identifying the purpose of a container. It is possible to supply a name for the container by passing the --name command line option: docker run -...
docker run -p "8080:8080" myApp docker run -p "192.168.1.12:80:80" nginx docker run -P myApp In order to use ports on the host have been exposed in an image (via the EXPOSE Dockerfile directive, or --expose command line option for docker run), those ports need to be bound to...
main = do input <- getContents putStr input Input: This is an example sentence. And this one is, too! Output: This is an example sentence. And this one is, too! Note: This program will actually print parts of the output before all of the input has been fully read in. This m...
main = do line <- getLine putStrLn line Input: This is an example. Output: This is an example.
readFloat :: IO Float readFloat = fmap read getLine main :: IO () main = do putStr "Type the first number: " first <- readFloat putStr "Type the second number: " second <- readFloat putStrLn $ show first ++ " + " ++ show se...
Like in several other parts of the I/O library, functions that implicitly use a standard stream have a counterpart in System.IO that performs the same job, but with an extra parameter at the left, of type Handle, that represents the stream being handled. For instance, getLine :: IO String has a cou...
A bit counter-intuitive to the way most other languages' standard I/O libraries do it, Haskell's isEOF does not require you to perform a read operation before checking for an EOF condition; the runtime will do it for you. import System.IO( isEOF ) eofTest :: Int -> IO () eofTest line = do ...
During a merge, you can pass --ours or --theirs to git checkout to take all changes for a file from one side or the other of a merge. $ git checkout --ours -- file1.txt # Use our version of file1, delete all their changes $ git checkout --theirs -- file2.txt # Use their version of file2, delete ...
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 2bc9b1988080 redis "docker-entrypoint.sh" 2 weeks ago Up 2 hours 0.0.0.0:6379->6379/tcp eleph...
Docker commands which take the name of a container accept three different forms: TypeExampleFull UUID9cc69f11a0f76073e87f25cb6eaf0e079fbfbd1bc47c063bcd25ed3722a8cc4aShort UUID9cc69f11a0f7Nameberserk_wozniak Use docker ps to view these values for the containers on your system. The UUID is generat...
To stop a running container: docker stop <container> [<container>...] This will send the main process in the container a SIGTERM, followed by a SIGKILL if it doesn't stop within the grace period. The name of each container is printed as it stops. To start a container which is stoppe...
Ordinarily, images are pulled automatically from Docker Hub. Docker will attempt to pull any image from Docker Hub that doesn't already exist on the Docker host. For example, using docker run ubuntu when the ubuntu image is not already on the Docker host will cause Docker to initiate a pull of the l...
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest 693bce725149 6 days ago 967 B postgres 9.5 0f3af79d8673 10 weeks ago 265.7 MB postgres ...
Docker commands which take the name of an image accept four different forms: TypeExampleShort ID693bce725149Namehello-world (defaults to :latest tag)Name+taghello-world:latestDigesthello-world@sha256:e52be8ffeeb1f374f440893189cd32f44cb166650e7ab185fa7735b7dc48d619 Note: You can only refer to an im...
First, make sure that you have configured your package (as said in Setting up a package configuration​). Then, you have to be logged in to npmjs. If you already have a npm user npm login If you don't have a user npm adduser To check that your user is registered in the current client npm co...
Once you've paused execution on a breakpoint, you may want to follow execution line-by-line to observe what happens. Open your browser's Developer Tools and look for the Execution Control icons. (This example uses the icons in Google Chrome, but they'll be similar in other browsers.) Resume: Unpau...
In Google Chrome, you can pause execution without needing to place breakpoints. Pause on Exception: While this button is toggled on, if your program hits an unhandled exception, the program will pause as if it had hit a breakpoint. The button can be found near Execution Controls and is useful for ...
To install MongoDB, follow the steps below: For Mac OS: There are two options for Mac OS: manual install or homebrew. Installing with homebrew: Type the following command into the terminal: $ brew install mongodb Installing manually: Download the latest release here. Ma...

Page 84 of 1336