Tutorial by Examples: c

Edit your package.json to add the following script : { "scripts": { "lint": "eslint .;exit 0" } } Then run it using npm run lint We use exit 0 as a trick to gracefully terminate the script when linting fails, otherwise npm will use eslint return code an...
This will create a timer to call the doSomething method on self in 5.0 seconds. [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(doSomething) userInfo:nil repeats:NO]; Setting the repeats parameter to false/NO indicates that we...
It is possible to register a process (pid) to a global alias. This can be achieved with the build in register(Alias, Pid) function, where Alias is the atom to access the process as and Pid is the process id. The alias will be globally available! It is very easy to create shared state, wich is usu...
Each process in erlang has a process identifier (Pid) in this format <x.x.x>, x being a natural number. Below is an example of a Pid <0.1252.0> Pid can be used to send messages to the process using 'bang' (!), also Pid can be bounded to a variable, both are shown below MyProcessId =...
using System.Text.RegularExpressions; string pattern = ":(.*?):"; string lookup = "--:text in here:--"; // Instanciate your regex object and pass a pattern to it Regex rgxLookup = new Regex(pattern, RegexOptions.Singleline, TimeSpan.FromSeconds(1)); // Get the match from y...
using System.Text.RegularExpressions; List<string> found = new List<string>(); string pattern = ":(.*?):"; string lookup = "--:text in here:--:another one:-:third one:---!123:fourth:"; // Instanciate your regex object and pass a pattern to it Regex rgxLookup = ...
Subtracting the values of two pointers to an object results in a signed integer *1. So it would be printed using at least the d conversion specifier. To make sure there is a type being wide enough to hold such a "pointer-difference", since C99 <stddef.h> defines the type ptrdiff_t. ...
Most performance tips are very dependent of the current state of JS engines and are expected to be only relevant at a given time. The fundamental law of performance optimization is that you must first measure before trying to optimize, and measure again after a presumed optimization. To measure cod...
Go to application/model File name - Home_model.php Inside the file class Home_model extends CI_Model { public $variable; public function __construct() { parent::__construct(); } public function get_data() { $query = $this->db->get('tabl...
Syntax $this->load->model('model_name'); $this->model_name->method_name(); Practice $this->load->model('home_model'); $this->home_model->get_data();
public function method_name($single, $array) { echo $single; print_r($array); } Beware with the order which pass from controller to model.
Python makes it extremely intuitive to check if a string contains a given substring. Just use the in operator: >>> "foo" in "foo.baz.bar" True Note: testing an empty string will always result in True: >>> "" in "test" True
Javascript engines first look for variables within the local scope before extending their search to larger scopes. If the variable is an indexed value in an array, or an attribute in an associative array, it will first look for the parent array before it finds the contents. This has implications wh...
ACID tables are supported since hive 0.14 version. Below table supports UPDATE/DELETE/INSERT Below configuration changes required in hive-site.xml. hive.support.concurrency = true hive.enforce.bucketing = true hive.exec.dynamic.partition.mode = nonstrict hive.txn.manager =org.apache.hadoop...
You can evaluate any valid C# code: int value = await CSharpScript.EvaluateAsync<int>("15 * 89 + 95"); var span = await CSharpScript.EvaluateAsync<TimeSpan>("new DateTime(2016,1,1) - DateTime.Now"); If type is not specified, the result is object: object value = ...
The CustomEvent API allows developers to create custom events and trigger them on DOM nodes, passing data along the way. event = new CustomEvent(typeArg, customEventInit); typeArg - DOMString representing the name of the event. customEventInit - is optional parameters (that will be passed as e ...
{-# LANGUAGE RecordWildCards #-} data Client = Client { firstName :: String , lastName :: String , clientID :: String } deriving (Show) printClientName :: Client -> IO () printClientName Client{..} = do p...
To copy a data.frame as a data.table, use as.data.table or data.table: DF = data.frame(x = letters[1:5], y = 1:5, z = (1:5) > 3) DT <- as.data.table(DF) # or DT <- data.table(DF) This is rarely necessary. One exception is when using built-in datasets like mtcars, which must be copi...
# example data DT <- data.table(Titanic) Suppose that, for each sex, we want the rows with the highest survival numbers: DT[Survived == "Yes", .SD[ N == max(N) ], by=Sex] # Class Sex Age Survived N # 1: Crew Male Adult Yes 192 # 2: 1st Female Adult Yes...
# example data DT = data.table(iris) DT[, Bin := cut(Sepal.Length, c(4,6,8))] Using .N .N in j stores the number of rows in a subset. When exploring data, .N is handy to... count rows in a group, DT[Species == "setosa", .N] # 50 or count rows in all groups, DT[, .N,...

Page 313 of 826