Tutorial by Examples: ado

The = operator is used for assignment. The == operator is used for comparison. One should be careful not to mix the two. Sometimes one mistakenly writes /* assign y to x */ if (x = y) { /* logic */ } when what was really wanted is: /* compare if x is equal to y */ if (x == y) { ...
Wildfly, part of the JBoss umbrella of projects, can also be executed via Docker. On a machine with Docker properly configured, run: $ docker run -it jboss/wildfly Once the image is pulled, the container starts and the following line can be seen: 09:44:49,225 INFO [org.jboss.as] (Controller Bo...
We can create empty thread objects and assign work to them later. If we assign a thread object to another active, joinable thread, std::terminate will automatically be called before the thread is replaced. #include <thread> void foo() { std::this_thread::sleep_for(std::chrono::seco...
Python 2.x2.7 In Python 2 filter, map and zip built-in functions return a sequence. map and zip always return a list while with filter the return type depends on the type of given parameter: >>> s = filter(lambda x: x.isalpha(), 'a1b2c3') >>> s 'abc' >>> s = map(lambd...
Flash Player 10 introduced the Vector.<*> generic list type that was faster than the Array. However, this is not entirely true. Only the following Vector types are faster than the Array counterparts, due to the way they are implemented in Flash Player. Vector.<int> - Vector of 32-bit ...
ClientContext clientContext = new ClientContext(siteUrl); SP.List oList = clientContext.Web.Lists.GetByTitle("MyList"); int itemId = 3; ListItem oListItem = oList.Items.GetById(itemId); oListItem.BreakRoleInheritance(false); User oUser = clientContext.Web.SiteUsers.GetByLoginNam...
ClientContext clientContext = new ClientContext(siteUrl); SP.List oList = clientContext.Web.Lists.GetByTitle("MyList"); int itemId = 2; ListItem oListItem = oList.Items.GetById(itemId); oListItem.BreakRoleInheritance(true); User oUser = clientContext.Web.SiteUsers.GetByLoginName...
The when-statement is an alternative to an if-statement with multiple else-if-branches: when { str.length == 0 -> print("The string is empty!") str.length > 5 -> print("The string is short!") else -> print("The string is long!") ...
Let's say we need to add a button for each piece of loadedData array (for instance, each button should be a slider showing the data; for the sake of simplicity, we'll just alert a message). One may try something like this: for(var i = 0; i < loadedData.length; i++) jQuery("#container&q...
Hibernate has some strategies of inheritance. The JOINED inheritance type do a JOIN between the child entity and parent entity. The problem with this approach is that Hibernate always bring the data of all involved tables in the inheritance. Per example, if you have the entities Bicycle and Mounta...
Variables are SHADOWED and methods are OVERRIDDEN. Which variable will be used depends on the class that the variable is declared of. Which method will be used depends on the actual class of the object that is referenced by the variable. class Car { public int gearRatio = 8; public St...
Autoboxing can come at a substantial memory overhead. For example: Map<Integer, Integer> square = new HashMap<Integer, Integer>(); for(int i = 256; i < 1024; i++) { square.put(i, i * i); // Autoboxing of large integers } will typically consume substantial amount of memory (...
Consider a simple rectangle that is drawn by the bezier path. UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRect: CGRectMake(x,y,width,height)]; [UIColor.grayColor setFill]; [rectanglePath fill]; Basic Outer-fill shadow: CGContextRef context = UIGraphicsGetCurrentContext();...
docker network create app-backend This command will create a simple bridged network called appBackend. No containers are attached to this network by default.
docker network rm app-backend This command removes the user-defined app-backend network from the Docker host. All containers on the network not otherwise connected via another network will lose communication with other containers. It is not possible to remove the default bridge bridge network, th...
docker network inspect app-backend This command will output details about the app-backend network. The of the output of this command should look similar to: [ { "Name": "foo", "Id": "a0349d78c8fd7c16f5940bdbaf1adec8d8399b8309b2e8a969bd4e...
Using docker-machine is the best method to install Docker on a machine. It will automatically apply the best security settings available, including generating a unique pair of SSL certificates for mutual authentication and SSH keys. To create a local machine using Virtualbox: docker-machine create...
Upgrading a docker machine implies a downtime and may require planing. To upgrade a docker machine, run: docker-machine upgrade docker-machine-name This command does not have options
In Java (and other languages), using null is a common way of indicating that there is no value attached to a reference variable. In Scala, using Option is preferred over using null. Option wraps values that might be null. None is a subclass of Option wrapping a null reference. Some is a subclass of...
To get the IP address of a docker machine, you can do that with this command : docker-machine ip machine-name

Page 2 of 7