Tutorial by Examples: c

To calculate moving average of salary of the employers based on their role: val cumSum = sampleData.withColumn("cumulativeSum", sum(sampleData("Salary")) .over( Window.partitionBy("Role").orderBy("Salary"))) orderBy() sorts salary column an...
std::ifstream src("source_filename", std::ios::binary); std::ofstream dst("dest_filename", std::ios::binary); dst << src.rdbuf(); C++17 With C++17 the standard way to copy a file is including the <filesystem> header and using copy_file: std::fileystem::copy...
The first thing you need to do is create a connection to the database using the connect method. After that, you will need a cursor that will operate with that connection. Use the execute method of the cursor to interact with the database, and every once in a while, commit the changes using the comm...
.gitignore and .git/info/exclude work only for untracked files. To set ignore flag on a tracked file, use the command update-index: git update-index --skip-worktree myfile.c To revert this, use: git update-index --no-skip-worktree myfile.c You can add this snippet to your global git config ...
namespace CodeContractsDemo { using System; using System.Collections.Generic; using System.Diagnostics.Contracts; public class PaymentProcessor { private List<Payment> _payments = new List<Payment>(); public void Add(Payment payment) ...
public double GetPaymentsTotal(string name) { Contract.Ensures(Contract.Result<double>() >= 0); double total = 0.0; foreach (var payment in this._payments) { if (string.Equals(payment.Name, name)) { total += payment.Amount; } } ...
[ContractClass(typeof(ValidationContract))] interface IValidation { string CustomerID{get;set;} string Password{get;set;} } [ContractClassFor(typeof(IValidation))] sealed class ValidationContract:IValidation { string IValidation.CustomerID { [Pure] get ...
Swift class PickerViewExampleViewController : UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { @IBOutlet weak var btnFolder: UIButton! let pickerView = UIPickerView() let pickerViewRows = ["First row,", "Secound row,","Third row,","F...
A common use-case for iterators is to perform some operation over a collection of numbers. The example below demonstrates how each element within an array of numbers can be individually printed out to the console. This is possible because arrays implement the IEnumerable interface, allowing clients...
Swift let isPushEnabled = UIApplication.sharedApplication().isRegisteredForRemoteNotifications()
The logic of registering for push notification is recommended to be added in AppDelegate.swift as the callback functions (success, failure) will be called their. To register just do the following: let application = UIApplication.sharedApplication() let settings = UIUserNotificationSettings(forType...
Once user clicks on a push notification, the following callback function will be called. You can parse the JSON to get any specific info sent from backend that will helps you in deep linking: Swift func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : ...
cURL is the name of the project which depicts: 'Client for URLs' and also be called as Client URL Request Library it combines two separate packages: curl and libcurl. curl is a command line tool used to get documents/files from or send documents to a server, using any of the supported protocol...
A stream is closed by sending a closing </stream> tag. After the closing stream tag is sent, no more data should be sent on the stream (even in response to data received from the other party). Before closing the connection, the sending entity should wait for a response </stream> tag to g...
Displaying all the logs from the default buffer on the Command Line can be accomplished by: adb logcat This command will show you all the logs from the device's main buffer. Notice that if you use it for the first time, you'll get a lot of information, an enormous stream of data. So you may want...
Creates a new menu in the Spreadsheet UI. Each menu entry runs a user-defined function. var activeSheet = SpreadsheetApp.getActiveSpreadsheet(); var menuItems = []; // When the user clicks on "addMenuExample" then "Menu 1", the function Myfunction1 is executed. me...
Use tuples in a switch let switchTuple = (firstCase: true, secondCase: false) switch switchTuple { case (true, false): // do something case (true, true): // do something case (false, true): // do something case (false, false): // do something } Or in combina...
git log --stat Example: commit 4ded994d7fc501451fa6e233361887a2365b91d1 Author: Manassés Souza <[email protected]> Date: Mon Jun 6 21:32:30 2016 -0300 MercadoLibre java-sdk dependency mltracking-poc/.gitignore | 1 + mltracking-poc/pom.xml | 14 ++++++++++++-- ...
This example is written with F# in mind but the ideas are applicable in all environments The first rule when optimizing for performance is to not to rely assumption; always Measure and Verify your assumptions. As we are not writing machine code directly it is hard to predict how the compiler an...
This error happens if a unknown object is used. Variables Not compiling: #include <iostream> int main(int argc, char *argv[]) { { int i = 2; } std::cout << i << std::endl; // i is not in the scope of the main function return 0; } Fix: #i...

Page 356 of 826