Tutorial by Examples: calcul

This function will take 2 datetime parameters, the DOB, and a date to check the age at CREATE FUNCTION [dbo].[Calc_Age] ( @DOB datetime , @calcDate datetime ) RETURNS int AS BEGIN declare @age int IF (@calcDate < @DOB ) RETURN -1 -- If a DOB is supplied a...
Include using System.Numerics and add a reference to System.Numerics to the project. using System; using System.Numerics; namespace Euler_25 { class Program { static void Main(string[] args) { BigInteger l1 = 1; BigInteger l2 = 1; ...
Utilizing .Net System.Security.Cryptography.HashAlgorithm namespace to generate the message hash code with the algorithms supported. $example="Nobody expects the Spanish Inquisition." #calculate $hash=[System.Security.Cryptography.HashAlgorithm]::Create("sha256").ComputeHas...
The Julia REPL is an excellent calculator. We can start with some simple operations: julia> 1 + 1 2 julia> 8 * 8 64 julia> 9 ^ 2 81 The ans variable contains the result of the last calculation: julia> 4 + 9 13 julia> ans + 9 22 We can define our own variables usi...
If you have a moment object you can use add and substract to manipulate it or set any property of the time directly moment("2016-01-01").add(1, 'year').format('YYYY-MM-DD') // -> "2017-01-01" Or use .day(), .month(), .year(), .seconds(), .milliseconds() to set those val...
This example is divided into two pillars SalaryCalculation Class : Calculating the net salary after tax deduction SalaryCalculationTests Class : For testing the method that calculates the net salary Step 1: Create Class Library, name it WagesLibrary or any appropriate name. Then rename the cl...
Automatic calculation of low and high thresholds for the Canny operation in opencv
Lets first understand the problem, consider this figure- We want to calculate ϴ, where we know A, B & O. Now, if we want to get ϴ, we need to find out α and β first. For any straight line, we know- y = m * x + c Let- A = (ax, ay), B = (bx, by), and O = (ox, oy). So for the line OA- oy =...
To compare the difference of two dates, we can do the comparison based on the timestamp. var date1 = new Date(); var date2 = new Date(date1.valueOf() + 5000); var dateDiff = date1.valueOf() - date2.valueOf(); var dateDiffInYears = dateDiff/1000/60/60/24/365; //convert milliseconds into years ...
The code below calculates the value of PI using a recursive approach. Modify the MAX_PARALLEL_RECURSIVE_LEVEL value to determine at which recursion depth stop creating tasks. With this approach to create parallelism out of recursive applications: the more tasks you create, the more parallel tasks cr...
If you use formulas, Excel will ask you to save the file every time, even if there were no changes made. To prevent this behaviour you can set the calculation mode to manual. excelPackage.Workbook.CalcMode = ExcelCalcMode.Manual; //fill the sheet with data and set the formulas excelPackage....
Private Const HashTypeMD5 As String = "MD5" ' https://msdn.microsoft.com/en-us/library/system.security.cryptography.md5cryptoserviceprovider(v=vs.110).aspx Private Const HashTypeSHA1 As String = "SHA1" ' https://msdn.microsoft.com/en-us/library/system.security.cryptography.sha1c...
Another variation from the code above gives you more performance when you want to get hash codes of all files from a root folder including all sub folders. Example of Worksheet: Code Option Explicit Private Const HashTypeMD5 As String = "MD5" ' https://msdn.microsoft.com/en-us/libr...
<%@ WebService Language="C#" Class="Util" %> using System; using System.Web.Services; public class Util: WebService { [WebMethod] public int CalculatorAdd(int operandA, int operandB) { return operandA + operandB; } [WebMethod] ...
Let's consider the below snippet, Get-ChildItem -Path C:\MyFolder | Select-Object Name, CreationTime, Length It simply output the folder content with the selected properties. Something like, What if I want to display the file size in KB ? This is where calcualted properties comes handy. Get-...
use Time::HiRes qw( time ); my $start = time(); #Code for which execution time is calculated sleep(1.2); my $end = time(); printf("Execution Time: %0.02f s\n", $end - $start); This will print execution time of Code in seconds
Calculating the power of a given number can be done recursively as well. Given a base number n and exponent e, we need to make sure to split the problem in chunks by decreasing the exponent e. Theoretical Example: 2² = 2x2 2³ = 2x2x2 or, 2³ = 2² x 2In there lies the secret of our recursive al...
// logger middlerware that logs time taken to process each request func Logger(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { startTime := time.Now() h.ServeHttp(w,r) endTime := time.Since(startTime) log...
To calculate the sum of terms (of type float, int or big integer) of a number list, it is preferable to use List.sum In other cases, List.fold is the function that is best suited to calculate such a sum. Sum of complex numbers In this example, we declare a list of complex numbers and we calcu...
Example of how to calculate the output shape and overcome the difficulties of using tf.nn.conv2d_transpose with unknown batch size (when input.get_shape() is (?, H, W, C) or (?, C, H, W)). def upconvolution (input, output_channel_size, filter_size_h, filter_size_w, stride_h, str...

Page 2 of 3