July 25, 2014, 4:17 pm
Test if two values are almost equal.
///
/// Test if two doubles are approximately equal
///
/// Test variable one
/// Test variable two
/// epsilon a measure of equality
/// boolean true = values are approximately equal, false = values are not equal
public static Boolean almostEqual(double a, double b, double eps)
{
return Math.Abs(a - b) < eps;
}
Example using the function.
double a = 1.234;
double b = 1.235;
double eps = 0.01;
Console.WriteLine("equal = " + almostEqual(a, b, eps).ToString());
July 22, 2014, 9:47 pm
A simple SQL example of using the To_Date function to format a date.
INSERT INTO EXAMPLETBL (EXAMPLEID, EXAMPLEDATE) VALUES ('5', TO_DATE('2014-05-08 08:06:24', 'YYYY-MM-DD HH24:MI:SS'))
July 22, 2014, 9:18 pm
This simple batch script creates a new folder based on the date and time and then executes a oracle database dump.
REM Backup oracle database
@echo Starting database backup
REM get the current datestamp in the format year-month-day-hour-minute
SET DATESTAMP=%date:~6,4%-%date:~3,2%-%date:~0,2%-%time:~0,2%-%time:~3,2%
REM Create a new directory
md "c:\backup\%DATESTAMP%"
REM backup database
REM Dont forget to change username and password
exp username/password@xe FILE="c:\backup\%DATESTAMP%\databasename.dmp"
@echo Finished backing up database to c:\backup\%DATESTAMP%