See Swift 3 example for usage information and notes
func pbkdf2SHA1(password: String, salt: [UInt8], keyCount: Int, rounds: Int) -> [UInt8]? {
return pbkdf2(CCPBKDFAlgorithm(kCCPRFHmacAlgSHA1), password:password, salt:salt, keyCount:keyCount, rounds:UInt32(rounds))
}
func pbkdf2SHA256(p...
Func<int, int> add1 = i => i + 1;
Func<int, int, int> add = (i, j) => i + j;
// Behaviourally equivalent to:
int Add1(int i)
{
return i + 1;
}
int Add(int i, int j)
{
return i + j;
}
...
Console.WriteLine(add1(42)); //43
Console.WriteLine(Add1(42));...
See Swift 3 example for usage information and notes
func pbkdf2SHA1Calibrate(password:String, salt:[UInt8], msec:Int) -> UInt32 {
let actualRoundCount: UInt32 = CCCalibratePBKDF(
CCPBKDFAlgorithm(kCCPBKDF2),
password.utf8.count,
salt.count,
CCPseudoRandom...
Determine the number of PRF rounds to use for a specific delay on the current platform.
Several parameters are defaulted to representative values that should not materially affect the round count.
password Sample password.
salt Sample salt.
msec Targeted duration we want to achieve f...
You can push tasks or data to the firebase realtime database and run a worker which listens to the firebase queue to run some background processess
Setup firebase
Create a Firebase project in the Firebase console, if you don't already have one. If you already have an existing Google project a...
USE TDE
CREATE DATABASE ENCRYPTION KEY
WITH ALGORITHM = AES_256
ENCRYPTION BY SERVER CERTIFICATE My_New_Cert
GO
ALTER DATABASE TDE
SET ENCRYPTION ON
GO
This uses 'Transparent Data Encryption' (TDE)
Azure SQL Database has different editions and performance tiers.
You can find version, edition (basic, standard, or premium), and service objective (S0,S1,P4,P11, etc.) of SQL Database that is running as a service in Azure using the following statements:
select @@version
SELECT DATABASEPROPERTYEX...
You can scale-up or scale-down Azure SQL database using ALTER DATABASE statement:
ALTER DATABASE WWI
MODIFY (SERVICE_OBJECTIVE = 'P6')
-- or
ALTER DATABASE CURRENT
MODIFY (SERVICE_OBJECTIVE = 'P2')
If you try to change service level while changing service level of the current database is sti...
You can create a secondary replica of database with the same name on another Azure SQL Server, making the local database primary, and begins asynchronously replicating data from the primary to the new secondary.
ALTER DATABASE <<mydb>>
ADD SECONDARY ON SERVER <<secondaryserver>...
You can put your azure SQL Database in SQL elastic pool:
CREATE DATABASE wwi
( SERVICE_OBJECTIVE = ELASTIC_POOL ( name = mypool1 ) )
You can create copy of an existing database and place it in some elastic pool:
CREATE DATABASE wwi
AS COPY OF myserver.WideWorldImporters
( SERVICE_OBJECTIV...
CLR procedures are not enabled by default. You need to run the following queries to enable CLR:
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'clr enabled', 1;
GO
RECONFIGURE;
GO
In addition, if some CLR module need external access, you should set TRUSTWORTHY pr...
The basic method to escape reserved words for SQL Server is the use of the square brackets ([ and ]). For example, Description and Name are reserved words; however, if there is an object using both as names, the syntax used is:
SELECT [Description]
FROM dbo.TableName
WHERE [Name] = 'foo'
T...
Will talk about directory structure of CakePHP, what each folder means.
CakePHP has some main folders
app - It Contains our application source code, all our code lies under this directory.
lib - This is the cakephp core liberary, it contains all the base cakephp library code. Editing code insid...
For this example, we want to make sure that any Employee who is marked as a Project Resource also has an appropriate Labor Cost defined.
// 1.0, Revealing Module pattern
var myNamespace = myNamespace || {};
myNamespace.example = (function () {
/**
* User Event 1.0 example detailing...
// 1.0
// Utilize the type argument and raw Strings to filter your
// execution by the action
function beforeLoad(type, form, request) {
// Don't do anything on APPROVE
// Note that `type` is an Object, so we must use ==, not ===
if (type == "approve") {
return...
In SuiteScript 1.0, we retrieve the current execution context using nlapiGetContext().getExecutionContext(), then we compare the result to the appropriate raw Strings.
// 1.0 in Revealing Module pattern
var myNamespace = myNamespace || {};
myNamespace.example = (function () {
var exports =...
Creating a new array is slightly confusing, as there is no real identifier for an array in awk. So, an array cannot really be initialised with our AWK code.
An array in awk is associative, meaning that any string or number can be a key. This means that the array is more like a key-value pair dictio...
The following example will contain a block of code that is meant to be split into several source files, as denoted by // filename comments.
Source Files
// my_function.h
/* Note how this header contains only a declaration of a function.
* Header functions usually do not define implementations...
const correctness is the practice of designing code so that only code that needs to modify an instance is able to modify an instance (i.e. has write access), and conversely, that any code that doesn't need to modify an instance is unable to do so (i.e. only has read access). This prevents the insta...