Tutorial by Examples: c

Coercion happens with data types in R, often implicitly, so that the data can accommodate all the values. For example, x = 1:3 x [1] 1 2 3 typeof(x) #[1] "integer" x[2] = "hi" x #[1] "1" "hi" "3" typeof(x) #[1] "character" ...
Used for the RAII style acquiring of try locks, timed try locks and recursive locks. std::unique_lock allows for exclusive ownership of mutexes. std::shared_lock allows for shared ownership of mutexes. Several threads can hold std::shared_locks on a std::shared_mutex. Available from C++ 14. std:...
A shared_lock can be used in conjunction with a unique lock to allow multiple readers and exclusive writers. #include <unordered_map> #include <mutex> #include <shared_mutex> #include <thread> #include <string> #include <iostream> class PhoneBook { ...
std::call_once ensures execution of a function exactly once by competing threads. It throws std::system_error in case it cannot complete its task. Used in conjunction with std::once_flag. #include <mutex> #include <iostream> std::once_flag flag; void do_something(){ std::ca...
Renaming the server.php to index.php Copy the .htaccess from public folder to root folder Changing .htaccess a bit as follows for statics: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|ro...
Kernel manages operating system resources. User program can only access to those resources by making system calls to the kernel. System call is similar to an API of kernel, which in term, runs kernel tasks your program needs. str = "something" // run on user space x = x + 1 // run on use...
Use top command to exam CPU time allocation between user space and kernel space. Explanation: 24.8 us (user space): 24.8% of CPU time is spent on user process. 0.5 sy (system): 0.5% of CPU time is spent on kernel space. ni (niceness): the ratio of CPU time spent on low priority processes. i...
Use time command. time ./perl-timeout-example 100.100.100 We could not ping the desired address! real 0m5.0013s user 0m0.004s sys 0m0.008s Real: Total time from start to finish of the call, including the CPU time spent on other processes. User: The amount of CPU time spent i...
using UnityEngine; using UnityEngine.Advertisements; public class Example : MonoBehaviour { #if !UNITY_ADS // If the Ads service is not enabled public string gameId; // Set this value from the inspector public bool enableTestMode = true; // Enable this during development #en...
Steps to copy heroku database to local database: 1. Run copy process in terminal: heroku pg:pull DATABASE_URL change_to_your_data_base_name --app change_to_your_app_name 2. Change db owner using this query: GRANT ALL PRIVILEGES ON DATABASE change_to_your_data_base_name to change_to_your_user; A...
Different procedures can give out the same result, but they would use different processing time. In order to check out which one is faster, a code like this can be used: time1 = Timer For Each iCell In MyRange iCell = "text" Next iCell time2 = Timer For i = 1 To 30 MyRan...
Using with blocks can accelerate the process of running a macro. Instead writing a range, chart name, worksheet, etc. you can use with-blocks like below; With ActiveChart .Parent.Width = 400 .Parent.Height = 145 .Parent.Top = 77.5 + 165 * step - replacer * 15 .Parent.Left = 5 E...
$service = new NetSuiteService(); $search = new TransactionSearchAdvanced(); $internalId = '123';//transaction internalId $search->criteria->basic->internalIdNumber->searchValue = $internalId; $search->criteria->basic->internalIdNumber->operator = "equalTo"; ...
$service = new NetSuiteService(); $search = new TransactionSearchAdvanced(); $internalId = '123';//transaction internalId $search->criteria->basic->internalIdNumber->searchValue = $internalId; $search->criteria->basic->internalIdNumber->operator = "equalTo"; ...
Dim duplicateFruits = New List(Of String) From {"Grape", "Apple", "Grape", "Apple", "Grape"} 'At this point, duplicateFruits.Length = 5 Dim uniqueFruits = duplicateFruits.Distinct(); 'Now, uniqueFruits.Count() = 2 'If iterated over at this poin...
Often you want to lock the entire object while you perform multiple operations on it. For example, if you need to examine or modify the object using iterators. Whenever you need to call multiple member functions it is generally more efficient to lock the whole object rather than individual member fu...
You can define the signing configuration to sign the apk in the build.gradle file. You can define: storeFile : the keystore file storePassword: the keystore password keyAlias: a key alias name keyPassword: A key alias password You have to define the signingConfigs block to create a signin...
When one with typeof operator one gets type object it falls into somewhat wast category... In practice you might need to narrow it down to what sort of 'object' it actually is and one way to do it is to use object constructor name to get what flavour of object it actually is: Object.prototype.toSt...
platform.ready().then(() => { // Okay, so the platform is ready and our plugins are available. // Here you can do any higher level native things you might need. var url= "https://blog.knoldus.com/"; var browserRef = window.cordova.InAppBrowser.open(url, &qu...
Instead of this (unfortunately too often seen in the real code) "masterpiece": function isEven(n) { return n % 2 == 0; } function isOdd(n) { if (isEven(n)) { return false; } else { return true; } } You can do the parity check much more effecti...

Page 762 of 826