Tutorial by Examples: codec

string sqrt = "\u221A"; // √ string emoji = "\U0001F601"; // 😁 string text = "\u0022Hello World\u0022"; // "Hello World" string variableWidth = "\x22Hello World\x22"; // "Hello World"
Say you want to perform in action (in this case, logging "Foo"), while doing something else (logging "Bar"). Normally, if you don't use concurrency, one of these actions is going to be fully executed, and the other run will run only after it's completely finished. But with concur...
Rcpp features two functions that enable code compilation inline and exportation directly into R: cppFunction() and evalCpp(). A third function called sourceCpp() exists to read in C++ code in a separate file though can be used akin to cppFunction(). Below is an example of compiling a C++ function w...
The nodemon package makes it possible to automatically reload your program when you modify any file in the source code. Installing nodemon globally npm install -g nodemon (or npm i -g nodemon) Installing nodemon locally In case you don't want to install it globally npm install --save-dev nodemo...
Differences in subsetting syntax A data.table is one of several two-dimensional data structures available in R, besides data.frame, matrix and (2D) array. All of these classes use a very similar but not identical syntax for subsetting, the A[rows, cols] schema. Consider the following data stored i...
Basic code completion (the name of any class, method or variable) Windows: Ctrl + Space OS X / macOS: Cmd + Space Smart code completion (filters the list of methods and variables by expected type) Windows: Ctrl + Shift + Space OS X / macOS: Cmd + Shift + Space Overwriting code with a suggestio...
While System.Diagnostics.Contracts is included within the .Net Framework. To use Code Contracts you must install the Visual Studio extensions. Under Extensions and Updates search for Code Contracts then install the Code Contracts Tools After the tools are installed you must enable Code Contract...
The contents of files and network messages may represent encoded characters. They often need to be converted to unicode for proper display. In Python 2, you may need to convert str data to Unicode characters. The default ('', "", etc.) is an ASCII string, with any values outside of ASCII ...
There are a few changes where instant won't do its trick and a full build and reinstall fo your app will happen just like it used to happen before Instant Run was born. Change the app manifest Change resources referenced by the app manifest Change an Android widget UI element (requires a Clean ...
There are times when an include file has to generate different output from the preprocessor depending on whether the compiler is a C compiler or a C++ compiler due to language differences. For example a function or other external is defined in a C source file but is used in a C++ source file. Since...
You can use the following code for going back and forward. if (!function_exists('codepoint_encode')) { function codepoint_encode($str) { return substr(json_encode($str), 1, -1); } } if (!function_exists('codepoint_decode')) { function codepoint_decode($str) { re...
You can use the following code for going back and forward. if (!function_exists('mb_internal_encoding')) { function mb_internal_encoding($encoding = NULL) { return ($from_encoding === NULL) ? iconv_get_encoding() : iconv_set_encoding($encoding); } } if (!function_exists('mb_c...
Knitr is an R package that allows us to intermingle R code with LaTeX code. One way to achieve this is inline code chunks. This apporach is demonstrated below. # r-noweb-file.Rnw \documentclass{article} \begin{document} This is an Rnw file (R noweb). It contains a combination of LateX and ...
Knitr is an R package that allows us to intermingle R code with LaTeX code. One way to achieve this is internal code chunks. This apporach is demonstrated below. # r-noweb-file.Rnw \documentclass{article} \begin{document} This is an Rnw file (R noweb). It contains a combination of LateX a...
Run go test as normal, yet with the coverprofile flag. Then use go tool to view the results as HTML. go test -coverprofile=c.out go tool cover -html=c.out
php bin/magento setup:di:compile You might need to delete var/di (including the folder) in order to go through compilation. rm -rf var/di
AWS Codecommit can be used as storage for private GIT repositories. The setup involves a few steps, assuming you have a valid AWS account already. Sign up for AWS Codecommit. Currently only region us-east-1 is available. Create a IAM user who will have access to the repositories, eg codecommit-u...
Atlassian SourceTree is a visual tool for Mac and Windows to manage source code repositories. This can be used with Codecommit as a remote repository but need to add an extra configuration option to the local repository in SourceTree to be able to connect with codecommit. First, setup Codecommit fo...
It is a bad practice to block on async calls as it can cause deadlocks in environments that have a synchronization context. The best practice is to use async/await "all the way down." For example, the following Windows Forms code causes a deadlock: private async Task<bool> TryThis()...

Page 1 of 2