Tutorial by Examples: sin

Iterators produce enumerators. In C#, enumerators are produced by defining methods, properties or indexers that contain yield statements. Most methods will return control to their caller through normal return statements, which disposes all state local to that method. In contrast, methods that use y...
Vlookup finds some value in the leftmost column of a range and returns a value some number of columns to the right and in the same row. Let's say you want to find the surname of Employee ID 2 from this table: =VLOOKUP(2,$A$2:$C$4,3,0) The value you're retrieving data for is 2 The table you...
function onOpen() { // Add a custom menu to run the script var ss = SpreadsheetApp.getActiveSpreadsheet(); var searchMenuEntries = [ {name: "Run", functionName: "search"}]; ss.addMenu("Get Files", searchMenuEntries); } function getFiles() { // Get...
PMF FOR THE BINOMIAL DISTRIBUTION Suppose that a fair die is rolled 10 times. What is the probability of throwing exactly two sixes? You can answer the question using the dbinom function: > dbinom(2, 10, 1/6) [1] 0.29071 PMF FOR THE POISSON DISTRIBUTION The number of sandwhich ordered in ...
A very useful feature many people overlook is the ability to construct a Map using a SOQL query. Map<Id, Account> accounts = new Map<Id, Account>([SELECT Id, Name FROM Account]); System.debug(accounts); When you run this code, accounts then contains a Map of your Account objects, ke...
We try to extract imdb top chart movies and ratings R> library(RCurl) R> library(XML) R> url <- "http://www.imdb.com/chart/top" R> top <- getURL(url) R> parsed_top <- htmlParse(top, encoding = "UTF-8") R> top_table <- readHTMLTable(parsed_top)[...
Intuition The categorical product of two types A and B should contain the minimal information necessary to contain inside an instance of type A or type B. We can see now that the intuitive coproduct of two types should be Either a b. Other candidates, such as Either a (b,Bool), would contain a part...
First thing to do is enable the mod rewrite on wamp go to Apache modules and scroll down the list If not showing tick enable it and then restart all servers. Linux users can also use below terminal command to enable rewrite module sudo a2enmod rewrite Then restart apache using: sudo service...
Paste your fonts file inside android/app/src/main/assets/fonts/font_name.ttf Recompile the Android app by running react-native run-android Now, You can use fontFamily: 'font_name' in your React Native Styles
Join parent objects with their child entities, for example we want a relational table of each person and their hobbies DECLARE @json nvarchar(1000) = N'[ { "id":1, "user":{"name":"John"}, "hobbies":[ {...
Here we have a simple class to be tested that returns a Promise based on the results of an external ResponseProcessor that takes time to execute. For simplicty we'll assume that the processResponse method won't ever fail. import {processResponse} from '../utils/response_processor'; const ping =...
You can move a container instead of copying it: void print(const std::vector<int>& vec) { for (auto&& val : vec) { std::cout << val << ", "; } std::cout << std::endl; } int main() { // initialize vec1 with 1, 2, 3, 4 and...
COPY is PostgreSQL's bulk-insert mechanism. It's a convenient way to transfer data between files and tables, but it's also far faster than INSERT when adding more than a few thousand rows at a time. Let's begin by creating sample data file. cat > samplet_data.csv 1,Yogesh 2,Raunak 3,Varun ...
You can set a setUp and tearDown function. A setUp function prepares your environment to tests. A tearDown function does a rollback. This is a good option when you can't modify your database and you need to create an object that simulate an object brought of database or need to init a configu...
You can also perform this task recursively, but I have chosen in this example to use an iterative approach. This task is useful if you are inserting all of your nodes at the beginning of a linked list. Here is an example: #include <stdio.h> #include <stdlib.h> #define NUM_ITEMS 10...
If you want to change an attribute of a control such as a textbox or label from another thread than the GUI thread that created the control, you will have to invoke it or else you might get an error message stating: "Cross-thread operation not valid: Control 'control_name' accessed from a th...
In performing parsing, before starting, the grammar for the language needs to be specified. A source of tokens is also needed for the parser. The parser could be hand-written code, or a parser generator tool could be used. If a parser generator tool is used, then that tool will need to be downloade...
You can use parfor to execute the iterations of a loop in parallel: Example: poolobj = parpool(2); % Open a parallel pool with 2 workers s = 0; % Performing some parallel Computations parfor i=0:9 s = s + 1; end disp(s) % Outputs '10' d...
You can use the $q.all function to call a .then method after an array of promises has been successfully resolved and fetch the data they resolved with. Example: JS: $scope.data = [] $q.all([ $http.get("data.json"), $http.get("more-data.json"), ]).then(funct...
The $q constructor function is used to create promises from asynchronous APIs that use callbacks to return results. $q(function(resolve, reject) {...}) The constructor function receives a function that is invoked with two arguments, resolve and reject that are functions which are used to eithe...

Page 70 of 161