Tutorial by Examples: and

Useful information The very beginning of the text field text: let startPosition: UITextPosition = textField.beginningOfDocument The very end of the text field text: let endPosition: UITextPosition = textField.endOfDocument The currently selected range: let selectedRange: UITextRange? = tex...
Rust tuples, as in most other languages, are fixed-size lists whose elements can all be of different types. // Tuples in Rust are comma-separated values or types enclosed in parentheses. let _ = ("hello", 42, true); // The type of a tuple value is a type tuple with the same number of el...
Considering the following document : <?xml version='1.0' encoding='UTF-8' ?> <library> <book id='1'>Effective Java</book> <book id='2'>Java Concurrency In Practice</book> </library> One can use the following code to build a DOM tree out of a St...
Method references make excellent self-documenting code, and using method references with Streams makes complicated processes simple to read and understand. Consider the following code: public interface Ordered { default int getOrder(){ return 0; } } public interface Valued&lt...
$ cat ip.txt address range substitution pattern sample Add Sub Mul Div Line number to line matching pattern $ sed -n '2,/pat/p' ip.txt range substitution pattern Line matching pattern to line number $ sed '/pat/,$d' ip.txt address range substitution GNU sed ...
package { import flash.events.TimerEvent; import flash.events.TimerEvent; import flash.utils.Timer; public class RandomTimer extends Timer { public var minimumDelay:Number; public var maximumDelay:Number; private var _count:uint = 0; privat...
If we want to get the x-cordinate of origin of the view, then we need to write like: view.frame.origin.x For width, we need to write: view.frame.size.width But if we add a simple extension to an UIView, we can get all the attributes very simply, like: view.x view.y view.width view.height...
If you use the paste command from your terminal emulator program, Vim will interpret the stream of characters as if they were typed. That will cause all kind of undesirable effects, particularly bad indendation. To fix that, from command mode: :set paste Then move on to insert mode, with i, for...
$ read -r foo <<EOF > this is a line >EOF $ printf '%s\n' "$foo" this is a line
ggplot(data = diamonds, aes(x = cut, fill =color)) + geom_bar(stat = "count", position = "dodge") it is possible to obtain an horizontal bar chart simply adding coord_flip() aesthetic to the ggplot object: ggplot(data = diamonds, aes(x = cut, fill =color)) + geom_ba...
Note: There will be some Objective-c in this example.. We will make a wrapper to C++ in this example, So don't worry to much about it. First start Xcode and create a project. And select a Cocoa application Delete all sources except the Info.plist file.(Your app won't work without it) Creat...
Angular js directives can be nested or be made interoperable. In this example, directive Adir exposes to directive Bdir it's controller $scope, since Bdir requires Adir. angular.module('myApp',[]).directive('Adir', function () { return { restrict: 'AE', controlle...
Once the type handlers are registered, everything should work automatically, and you should be able to use these types as either parameters or return values: string redmond = "POINT (122.1215 47.6740)"; DbGeography point = DbGeography.PointFromText(redmond, DbGeography.DefaultCoordi...
Match (node_name:node_type {}), (node_name_two:node_type_two {}) CREATE (node_name)-[::edge_name{}]->(node_name_two)
The chan-signal crate provides a solution to handle OS signal using channels, altough this crate is experimental and should be used carefully. Example taken from BurntSushi/chan-signal. #[macro_use] extern crate chan; extern crate chan_signal; use chan_signal::Signal; fn main() { // S...
The nix crate provides an UNIX Rust API to handle signals, however it requires using unsafe rust so you should be careful. use nix::sys::signal; extern fn handle_sigint(_:i32) { // Be careful here... } fn main() { let sig_action = signal::SigAction::new(handle_sigint, ...
Static method: Dim parseMethod = GetType(Integer).GetMethod("Parse",{GetType(String)}) Dim result = DirectCast(parseMethod.Invoke(Nothing,{"123"}), Integer) Instance method: Dim instance = "hello".ToUpper Dim method = Gettype(String).GetMethod("ToUpper&quo...
ArrayList is one of the inbuilt data structures in Java. It is a dynamic array (where the size of the data structure not needed to be declared first) for storing elements (Objects). It extends AbstractList class and implements List interface. An ArrayList can contain duplicate elements where it mai...
To get more information about any git command – i.e. details about what the command does, available options and other documentation – use the --help option or the help command. For example, to get all available information about the git diff command, use: git diff --help git help diff Similarl...
A Cordova application runs as a website on a WebView component within the native mobile platform. Debugging a cordova application can therefore be done by utilizing your favourite browsers development tools. The following steps are needed to hook the application, running on the device, to the Chrome...

Page 59 of 153