//Creates a Random instance with a seed of 12345.
Random random = new Random(12345L);
//Gets a ThreadLocalRandom instance
ThreadLocalRandom tlr = ThreadLocalRandom.current();
//Set the instance's seed.
tlr.setSeed(12345L);
Using the same seed to generate random numbers will return the sa...
When a page is part of a series of articles, for instance, one can use prev and next to point to pages that are coming before and after.
<link rel="prev" href="http://stackoverflow.com/documentation/java/topics">
<link rel="next" href="http://stackover...
Preconnect
The preconnect relationship is similar to dns-prefetch in that it will resolve the DNS. However, it will also make the TCP handshake, and optional TLS negotiation.
This is an experimental feature.
<link rel="preconnect" href="URL">
DNS-Prefetch
Informs bro...
Development and Evaluation Installations
Alfresco provides a number of different installers for different operating systems and platforms. However, these installers are not recommended for production environments.
https://www.alfresco.com/alfresco-community-download
https://sourceforge.net/projec...
# Process substitution with paste command is common
# To compare the contents of two directories
paste <( ls /path/to/directory1 ) <( ls /path/to/directory1 )
We can use PrintStream class to write a file. It has several methods that let you print any data type values. println() method appends a new line.
Once we are done printing, we have to flush the PrintStream.
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.time.Local...
When you run sails lift with blueprints enabled, the framework inspects your
controllers, models, and configuration in order to bind certain routes automatically. These implicit blueprint routes allow your app to respond
to certain requests without you having to bind those routes manually in your
...
Blueprint actions (not to be confused with blueprint action routes) are
generic actions designed to work with any of your controllers that have a model
of the same name (e.g. ParrotController would need a Parrot model). Think of
them as the default behavior for your application. For instance, if...
Global basis:
Blueprint API configuration is defined in /config/blueprint.js file. You can
enable or disable all three types of blueprint routes for all controllers from
there. As example, if you want to disable blueprint shortcut routes for all of
your controllers but want to keep both acti...
set alpha 1
proc myproc {} {
puts $alpha
}
myproc
This code doesn't work because the two alphas are in different scopes.
The command set alpha 1 creates a variable in the global scope (which makes it a global variable).
The command puts $alpha is executed in a scope that is created ...
To print the value of a pointer to an object (as opposed to a function pointer) use the p conversion specifier. It is defined to print void-pointers only, so to print out the value of a non void-pointer it needs to be explicitly converted ("casted*") to void*.
#include <stdlib.h> /*...
PHP provides support for the HTTP PUT method used by some clients to store files on a server. PUT requests are much simpler than a file upload using POST requests and they look something like this:
PUT /path/filename.html HTTP/1.1
Into your PHP code you would then do something like this:
<?p...
Consider the following three equations:
x0 + 2 * x1 + x2 = 4
x1 + x2 = 3
x0 + x2 = 5
We can express this system as a matrix equation A * x = b with:
A = np.array([[1, 2, 1],
[0, 1, 1],
[1, 0, 1]])
b = np.array([4, 3, 5])
Then, use np.linalg....
The current frame rate (in FPS, Frames Per Second) and total number of SKNodes in the scene (nodeCount, each sprite is an SKNode but other objects in the scene are also SKNodes) can be shown in the bottom right hand corner of the view.
These can be useful when turned on (set to true) for debugging ...
When a function returns an object (as opposed to using one that's passed in by the caller), be careful an exception doesn't cause the object to leak.
function MakeStrings: TStrings;
begin
// Create a new object before entering the try-block.
Result := TStringList.Create;
try
// Execu...
A try-finally block may be nested inside a try-except block.
try
AcquireResources;
try
UseResource;
finally
ReleaseResource;
end;
except
on E: EResourceUsageError do begin
HandleResourceErrors;
end;
end;
If an exception occurs inside UseResource, then execution...
A try-except block may be nested inside a try-finally block.
AcquireResource;
try
UseResource1;
try
UseResource2;
except
on E: EResourceUsageError do begin
HandleResourceErrors;
end;
end;
UseResource3;
finally
ReleaseResource;
end;
If an EResourceUsageE...
The angular.copy function takes an object, array or a value and creates a deep copy of it.
angular.copy()
Example:
Objects:
let obj = {name: "vespa", occupation: "princess"};
let cpy = angular.copy(obj);
cpy.name = "yogurt"
// obj = {name: "vespa", ...
In order to print the value of a variable such as,
set tempVar "This is a string."
The argument in the puts statement is preceded by a $ sign, which tells Tcl to use the value of the variable.
% set tempVar "This is a string."
This is a string.
% puts $tempVar
This is a s...