Tutorial by Examples: ai

docker restart <container> [<container>...] Option --time : Seconds to wait for stop before killing the container (default 10) docker restart <container> --time 10
dnf install erlang elixir
docker rm can be used to remove a specific containers like this: docker rm <container name or id> To remove all containers you can use this expression: docker rm $(docker ps -qa) By default docker will not delete a container that is running. Any container that is running will produce a...
This code can be added to any event like a listener, button, etc. A blocking JDialog will appear and will remain until the process is complete. final JDialog loading = new JDialog(parentComponent); JPanel p1 = new JPanel(new BorderLayout()); p1.add(new JLabel("Please wait..."), BorderLa...
Template views are fine for static page and you could use them for everything with get_context_data but it would be barely better than using function as views. Enter ListView and DetailView app/models.py from django.db import models class Pokemon(models.Model): name = models.CharField(max...
The special variable __name__ is not set by the user. It is mostly used to check whether or not the module is being run by itself or run because an import was performed. To avoid your module to run certain parts of its code when it gets imported, check if __name__ == '__main__'. Let module_1.py be ...
You can create a tuple and use a switch like so: var str: String? = "hi" var x: Int? = 5 switch (str, x) { case (.Some,.Some): print("Both have values") case (.Some, nil): print("String has a value") case (nil, .Some): print("Int has a value&...
You can use Optional Chaining in order to call a method, access a property or subscript an optional. This is done by placing a ? between the given optional variable and the given member (method, property or subscript). struct Foo { func doSomething() { print("Hello World!") ...
models.py : from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import ( AbstractBaseUser, BaseUserManager, PermissionsMixin) from django.utils import timezone from django.utils.translation import ugettext_lazy as _ class UserManage...
Django's default authentication works on username and password fields. Email authentication backend will authenticate users based on email and password. from django.contrib.auth import get_user_model class EmailBackend(object): """ Custom Email Backend to perform authent...
There are two parts of a class: the interface and the implementation. The interface is the exposed functionality of the class. Its public methods and variables are part of the interface. The implementation is the internal workings of a class. Other classes shouldn't need to know about the implemen...
docker exec -it <container id> /bin/bash It is common to log in an already running container to make some quick tests or see what the application is doing. Often it denotes bad container use practices due to logs and changed files should be placed in volumes. This example allows us log in the...
9.0 // Since the anchor system simply returns constraints, you still need to add them somewhere. View.AddConstraints( new[] { someLabel.TopAnchor.ConstraintEqualTo(TopLayoutGuide.GetBottomAnchor()), anotherLabel.TopAnchor.ConstraintEqualTo(someLabel.BottomAnchor, 6), ...
// Using Visual Format Language requires a special look-up dictionary of names<->views. var views = new NSDictionary( nameof(someLabel), someLabel, nameof(anotherLabel), anotherLabel, nameof(oneMoreLabel), oneMoreLabel ); // It can also take a look-up dictionary for metrics (...
It is possible to mount a host directory to a specific path in your container using the -v or --volume command line option. The following example will mount /etc on the host to /mnt/etc in the container: (on linux) docker run -v "/etc:/mnt/etc" alpine cat /mnt/etc/passwd (on windows) do...
Usage: docker logs [OPTIONS] CONTAINER Fetch the logs of a container -f, --follow=false Follow log output --help=false Print usage --since= Show logs since timestamp -t, --timestamps=false Show timestamps --tail=all Number o...
To execute operations in a container, use the docker exec command. Sometimes this is called "entering the container" as all commands are executed inside the container. docker exec -it container_id bash or docker exec -it container_id /bin/sh And now you have a shell in your running...
To get all the information for a container you can run: docker inspect <container>
You can get an specific information from a container by running: docker inspect -f '<format>' <container> For instance, you can get the Network Settings by running: docker inspect -f '{{ .NetworkSettings }}' <container> You can also get just the IP address: docker inspect ...
You can make an UILabel with a dynamic height using auto layout. You need to set the numberOfLines to zero (0), and add a minimal height by setting up a constraints with a relation of type .GreaterThanOrEqual on the .Height attribute iOS 6 Swift label.numberOfLines = 0 let heightConstraint = ...

Page 6 of 47