Tutorial by Examples: c

To get a value associated to the key, use the .get() method. If there's no value associated to the key, it returns undefined. const obj1 = {}, obj2 = {}; const weakmap = new WeakMap([[obj1, 7]]); console.log(weakmap.get(obj1)); // 7 console.log(weakmap.get(obj2)); // undefined
To check if an element with a specified key exits in a WeakMap, use the .has() method. It returns true if it exits, and otherwise false. const obj1 = {}, obj2 = {}; const weakmap = new WeakMap([[obj1, 7]]); console.log(weakmap.has(obj1)); // true console.log(weakmap.has(obj2)); // false...
In order to compile docker its recommended you have at least 2 GB RAM. Even with that it fails sometimes so its better to go for 4GB instead. make sure git and make is installed sudo apt-get install make git-core -y install a new kernel (at least 4.2) sudo apt-get install linux-generic...
# create docker container export cid=$(docker run -d --security-opt seccomp:unconfined busybox /bin/sh -c 'i=0; while true; do echo $i; i=$(expr $i + 1); sleep 1; done') # container is started and prints a number every second # display the output with docker logs $cid # checkpoint the cont...
The effective type of a data object is the last type information that was associated with it, if any. // a normal variable, effective type uint32_t, and this type never changes uint32_t a = 0.0; // effective type of *pa is uint32_t, too, simply // because *pa is the object a uint32_t* pa = &a...
Create a Security class to run your ACL logic. <?php namespace Plugins; use Phalcon\Events\Event; use Phalcon\Mvc\Dispatcher; use Phalcon\Acl; use Phalcon\Acl\Role; use Phalcon\Acl\Resource; use Phalcon\Acl\Adapter\Memory as AclList; class Security extends \Phalcon\Mvc\User\Plugin ...
To use SQL syntax with model, that would transfer result to proper instantions, you should use directly one of Phalcon\Mvc\Model\Resultset classes: $users = new \Application\Models\Users(); // bitwise operation on `flag` field $sql = 'SELECT * FROM phorum.users WHERE (15 & (1 <&...
-- Create demo database CREATE DATABASE SQL2016_Demo ON PRIMARY ( NAME = N'SQL2016_Demo', FILENAME = N'C:\Dump\SQL2016_Demo.mdf', SIZE = 5120KB, FILEGROWTH = 1024KB ) LOG ON ( NAME = N'SQL2016_Demo_log', FILENAME = N'C:\Dump\SQL2016_Demo_log.ldf', ...
SELECT OBJECT_ID('MemOptTable1') AS MemOptTable1_ObjectID, OBJECT_ID('MemOptTable2') AS MemOptTable2_ObjectID GO SELECT name,description FROM sys.dm_os_loaded_modules WHERE name LIKE '%XTP%' GO Show all Memory Optimized Tables: SELECT name,type_desc,durability_desc,...
For faster performance you can memory-optimize your table variable. Here is the T-SQL for a traditional table variable: DECLARE @tvp TABLE ( col1 INT NOT NULL , Col2 CHAR(10) ); To define memory-optimized variables, you must first create a memory-optimized table type and...
Recommendation Because the symbols i and j can represent significantly different things in MATLAB, their use as loop indices has split the MATLAB user community since ages. While some historic performance reasons could help the balance lean to one side, this is no longer the case and now the choice...
CREATE TABLE dbo.Employee ( [EmployeeID] int NOT NULL PRIMARY KEY CLUSTERED , [Name] nvarchar(100) NOT NULL , [Position] varchar(100) NOT NULL , [Department] varchar(100) NOT NULL , [Address] nvarchar(1024) NOT NULL , [AnnualSalary] decimal (10,2) NOT NULL ...
Returns a table with a rows containing the values that were actual (current) at the specified point in time in the past. SELECT * FROM Employee FOR SYSTEM_TIME AS OF '2016-08-06 08:32:37.91'
Required compiler features can be specified on a target using the command target_compile_features: add_library(foo foo.cpp ) target_compile_features(foo PRIVATE # scope of the feature cxx_constexpr # list of features ) The features must be part of CMAKE_C_COMPILE_FE...
MailApp is the api from Google App Script that can be used to send mail function sendEmails() { var subject = "A subject for your new app!"; var message = "And this is the very first message" var recipientEmail = "[email protected]"; MailApp.sendEmail(rec...
function getSheetData() { var sheet = SpreadsheetApp.getActiveSheet(); var startRow = 2; // First row of data to process var numRows = 100; // Number of rows to process var startCol = 1; //First column of data to process var numCols = 15; // Number of columns to process ...
In the above example, if we want to send out HTML content as message in the email, then create a HTML file by going to File -> New -> HTML file Now you can see a HTML file besides your gs file as follows : Now, update the getMessage() method from above example as follows : function getMes...
A simple PL/pgSQL function: CREATE FUNCTION active_subscribers() RETURNS bigint AS $$ DECLARE -- variable for the following BEGIN ... END block subscribers integer; BEGIN -- SELECT must always be used with INTO SELECT COUNT(user_id) INTO subscribers FROM users WHERE subscribed...
You can iterate over the contents of a dictionary with dict for, which is similar to foreach: set theDict {abcd {ab cd} bcde {ef gh} cdef {ij kl}} dict for {theKey theValue} $theDict { puts "$theKey -> $theValue" } This produces this output: abcd -> ab cd bcde -> ef gh c...
Sometimes you need to match a literal (sub-)string with a regular expression despite that substring containing RE metacharacters. While yes, it's possible to write code to insert appropriate backslashes to make that work (using string map) it is easiest to just prefix the pattern with ***=, which ma...

Page 455 of 826