Tutorial by Examples: f

RAISERROR with severity (second parameter) less or equal to 10 will not throw exception. BEGIN TRY print 'First statement'; RAISERROR( 'Here is a problem!', 10, 15); print 'Second statement'; END TRY BEGIN CATCH print 'Error: ' + ERROR_MESSAGE(); END CATCH After RAISER...
The following example code is slower than it needs to be : Map<String, String> map = new HashMap<>(); for (String key : map.keySet()) { String value = map.get(key); // Do something with key and value } That is because it requires a map lookup (the get() method) for each ...
The Java Collections Framework provides two related methods for all Collection objects: size() returns the number of entries in a Collection, and isEmpty() method returns true if (and only if) the Collection is empty. Both methods can be used to test for collection emptiness. For example: C...
MySQL does not support the FULL OUTER JOIN, but there are ways to emulate one. Setting up the data -- ---------------------------- -- Table structure for `owners` -- ---------------------------- DROP TABLE IF EXISTS `owners`; CREATE TABLE `owners` ( `owner_id` int(11) NOT NULL AUTO_INCREMENT,...
You can convert a single function with a callback argument to a Promise-returning version with Promise.promisify, so this: const fs = require("fs"); fs.readFile("foo.txt", (err, data) => { if(err) throw err; console.log(data); }); becomes: const promisify = requ...
var firstItem = fetch("/api1").then(x => x.json()); var secondItem = fetch("/api2").then(x => x.json()); Promise.all([firstItem, secondItem]).spread((first, second) => { // access both results here, both requests completed at this point });
program typical_loop use omp_lib implicit none integer, parameter :: N = 1000000, kd = kind( 1.d0 ) real( kind = kd ) :: sum, tbegin, wtime integer :: i sum = 0 tbegin = omp_get_wtime() !$omp parallel do reduction( +: sum ) do i = 1, N sum = ...
Let f(n) and g(n) be two functions defined on the set of the positive real numbers, c, c1, c2, n0 are positive real constants. Notationf(n) = O(g(n))f(n) = Ω(g(n))f(n) = Θ(g(n))f(n) = o(g(n))f(n) = ω(g(n))Formal definition∃ c > 0, ∃ n0 > 0 : ∀ n ≥ n0, 0 ≤ f(n) ≤ c g(n)∃ c > 0, ∃ n0 > 0 ...
realloc is conceptually equivalent to malloc + memcpy + free on the other pointer. If the size of the space requested is zero, the behavior of realloc is implementation-defined. This is similar for all memory allocation functions that receive a size parameter of value 0. Such functions may in fact ...
to check if the given path exists path = '/home/john/temp' os.path.exists(path) #this returns false if path doesn't exist or if the path is a broken symbolic link
to check if the given path is a directory dirname = '/home/john/python' os.path.isdir(dirname) to check if the given path is a file filename = dirname + 'main.py' os.path.isfile(filename) to check if the given path is symbolic link symlink = dirname + 'some_sym_link' os.path.islink(symli...
A class or struct can have member functions as well as member variables. These functions have syntax mostly similar to standalone functions, and can be defined either inside or outside the class definition; if defined outside the class definition, the function's name is prefixed with the class' nam...
Member functions can also be declared virtual. In this case, if called on a pointer or reference to an instance, they will not be accessed directly; rather, they will look up the function in the virtual function table (a list of pointers-to-member-functions for virtual functions, more commonly know...
configuration EnableIISFeature { node localhost { WindowsFeature IIS { Ensure = “Present” Name = “Web-Server” } } } If you run this configuration in Powershell (EnableIISFeature), it will produce a localho...
Starting a DSC on a remote machine is almost just as simple. Assuming you've already set up Powershell remoting (or enabled WSMAN). $remoteComputer = "myserver.somedomain.com" $cred = (Get-Credential) Start-DSCConfiguration -ServerName $remoteComputer -Credential $cred -Verbose Nb: A...
Sometimes it can be useful to test your Powershell data files and iterate through the nodes and servers. Powershell 5 (WMF5) added this neat little feature for doing this called Import-PowerShellDataFile . Example: $data = Import-PowerShellDataFile -path .\MydataFile.psd1 $data.AllNodes
Before you can use a resource in a configuration, you must explicitly import it. Just having it installed on your computer, will not let you use the resource implicitly. Import a resource by using Import-DscResource . Example showing how to import the PSDesiredStateConfiguration resource and the F...
In classic ASP we can specify a for loop with the for keyword. With the for statement we need the next statement which will increment the counter. For i = 0 To 10 Response.Write("Index: " & i) Next The step keyword can be used to changed the how the next statement will modify...
Apart from primitives, the Explicit Layout structs (Unions) in C#, can also contain other Structs. As long as a field is a Value type and not a Reference, it can be contained in a Union: using System; using System.Runtime.InteropServices; // The struct needs to be annotated as "Explici...
Often you might need to execute an unsigned script that doesn't comply with the current execution policy. An easy way to do this is by bypassing the execution policy for that single process. Example: powershell.exe -ExecutionPolicy Bypass -File C:\MyUnsignedScript.ps1 Or you can use the shorthan...

Page 265 of 457