Tutorial by Examples: and

This is an actual useful strategy to differentiate member data from parameters... Lets take this example : // Dog Class Example #include <iostream> #include <string> using std::cout; using std::endl; /* * @class Dog * @member name * Dog's name * @function bark * ...
PHPUnit has two assertions to check values of class properties: assertAttributeSame($expected, $actualAttributeName, $actualClassOrObject, $message = '') assertAttributeNotSame($expected, $actualAttributeName, $actualClassOrObject, $message = '') These methods will check the value of a object p...
Attributes can be useful for denoting metadata on enums. Getting the value of this can be slow, so it is important to cache results. private static Dictionary<object, object> attributeCache = new Dictionary<object, object>(); public static T GetAttribute<T, V>(this V va...
Xcode 8 will automatically recognize any images you’ve got in an Asset Catalog and offer them up as a suggestion inside of a UIImage initializer. So you could basically declare a new variable and then add an asset name that you have added to your asset catalog. For example let img = dog. img does n...
Small, simple csv files can be built using just a text editor, because a CSV file is simply text. If you have spreadsheet software available these are usually an easy way to open and save CSV files. Reading and writing them, or otherwise processing their contents is done more efficiently using the ...
Consider the dataframes left and right left = pd.DataFrame([['a', 1], ['b', 2]], list('XY'), list('AB')) left A B X a 1 Y b 2 right = pd.DataFrame([['a', 3], ['b', 4]], list('XY'), list('AC')) right A C X a 3 Y b 4 join Think of join as wanting to combine to dat...
The onTouchEvents() for nested view groups can be managed by the boolean onInterceptTouchEvent. The default value for the OnInterceptTouchEvent is false. The parent's onTouchEvent is received before the child's. If the OnInterceptTouchEvent returns false, it sends the motion event down the cha...
extern crate gtk; use gtk::prelude::*; use gtk::{Window, WindowType, Label, Entry, Box as GtkBox, Orientation}; fn main() { if gtk::init().is_err() { println!("Failed to initialize GTK."); return; } let window = Window::new(WindowType::Toplevel); ...
Regular expression support for tust is provided by the regex crate, add it to your Cargo.toml: [dependencies] regex = "0.1" The main interface of the regex crate is regex::Regex: extern crate regex; use regex::Regex; fn main() { //"r" stands for "raw" str...
use std::ops::Deref; use std::fmt::Debug; #[derive(Debug)] struct RichOption<T>(Option<T>); // wrapper struct impl<T> Deref for RichOption<T> { type Target = Option<T>; // Our wrapper struct will coerce into Option fn deref(&self) -> &Option...
The STDIN stream in Julia refers to standard input. This can represent either user input, for interactive command-line programs, or input from a file or pipeline that has been redirected into the program. The readline function, when not provided any arguments, will read data from STDIN until a newl...
Reading numbers from standard input is a combination of reading strings and parsing such strings as numbers. The parse function is used to parse a string into the desired number type: julia> parse(Int, "17") 17 julia> parse(Float32, "-3e6") -3.0f6 The format expec...
Sometimes we need to collect data from google spreadsheets. We can use gspread and oauth2client libraries to collect data from google spreadsheets. Here is a example to collect data: Code: from __future__ import print_function import gspread from oauth2client.client import SignedJwtAssertionCred...
Powershell supports standard conditional logic operators, much like many programming languages. These allow certain functions or commands to be run under particular circumstances. With an if the commands inside the brackets ({}) are only executed if the conditions inside the if(()) are met $test =...
Overview The transpose function is one of Bosun's more powerful functions, but it also takes effort to understand. It is powerful because it lets us alert at different levels than the tag structure of the underlying data. Transpose changes the scope of your alert. This lets you scope things into l...
In most text editors, the standard shortcut for saving the current document is Ctrl+S (or Cmd+S on macOS). Vim doesn't have this feature by default but this can be mapped to make things easier. Adding the following lines in .vimrc file will do the job. nnoremap <c-s> :w<CR> inoremap &...
HTML to NSAttributedString conversion Code :- //HTML String NSString *htmlString=[[NSString alloc]initWithFormat:@"<!DOCTYPE html><html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>"]; //Converting HTML s...
UIDevice *deviceInfo = [UIDevice currentDevice]; NSLog(@"Device Name %@", deviceInfo.name); //Ex: myIphone6s NSLog(@"System Name %@", deviceInfo.systemName); //Device Name iPhone OS NSLog(@"System Version %@", deviceInfo.systemVersion); //System Version 9.3...
String to immutable ubyte[] string s = "unogatto"; immutable(ubyte[]) ustr = cast(immutable(ubyte)[])s; assert(typeof(ustr).stringof == "immutable(ubyte[])"); assert(ustr.length == 8); assert(ustr[0] == 0x75); //u assert(ustr[1] == 0x6e); //n assert(ustr[2] == 0x6f); //o...
Create a folder in your project folder, and add your fonts to it. Example: Example: Here we added a folder in root called "mystuff", then "fonts", and inside it we placed our fonts: Add the below code in package.json. { ... "rnpm":...

Page 108 of 153