Tutorial by Examples: com

To compare strings alphabetically, use localeCompare(). This returns a negative value if the reference string is lexicographically (alphabetically) before the compared string (the parameter), a positive value if it comes afterwards, and a value of 0 if they are equal. var a = "hello"; va...
A compound view is a custom ViewGroup that's treated as a single view by the surrounding program code. Such a ViewGroup can be really useful in DDD-like design, because it can correspond to an aggregate, in this example, a Contact. It can be reused everywhere that contact is displayed. This means t...
The combined assignment operators are a shortcut for an operation on some variable and subsequently assigning this new value to that variable. Arithmetic: $a = 1; // basic assignment $a += 2; // read as '$a = $a + 2'; $a now is (1 + 2) => 3 $a -= 1; // $a now is (3 - 1) => 2 $a *= 2; //...
/// <summary> /// Returns the data for the specified ID and timestamp. /// </summary> /// <param name="id">The ID for which to get data. </param> /// <param name="time">The DateTime for which to get data. </param> /// <returns>A Data...
To generate an XML documentation file from documentation comments in the code, use the /doc option with the csc.exe C# compiler. In Visual Studio 2013/2015, In Project -> Properties -> Build -> Output, check the XML documentation file checkbox: When you build the project, an XML file wi...
Horizontally vim -o file1.txt file2.txt Vertically vim -O file1.txt file2.txt You may optionally specify the number of splits to open. The following example opens two horizontal splits and loads file3.txt in a buffer: vim -o2 file1.txt file2.txt file3.txt
Component code: angular.module('myModule', []).component('myComponent', { bindings: { myValue: '<' }, controller: function(MyService) { this.service = MyService; this.componentMethod = function() { return 2; }; } }); The test: describe('myComponent', f...
If you are building a function that may be heavy on the processor (either clientside or serverside) you may want to consider a memoizer which is a cache of previous function executions and their returned values. This allows you to check if the parameters of a function were passed before. Remember, p...
Removing a variable name from the scope using del v, or removing an object from a collection using del v[item] or del[i:j], or removing an attribute using del v.name, or any other way of removing references to an object, does not trigger any destructor calls or any memory being freed in and of itsel...
use std::io::{Read, Result as IoResult}; use std::fs::File; struct Config(u8); fn read_config() -> IoResult<String> { let mut s = String::new(); let mut file = File::open(&get_local_config_path()) // or_else closure is invoked if Result is Err. .or_els...
The StringBuffer, StringBuilder, Formatter and StringJoiner classes are Java SE utility classes that are primarily used for assembling strings from other information: The StringBuffer class has been present since Java 1.0, and provides a variety of methods for building and modifying a "buf...
git config --global merge.conflictstyle diff3 Sets the diff3 style as default: instead of the usual format in conflicted sections, showing the two files: <<<<<<< HEAD left ======= right >>>>>>> master it will include an additional section containi...
Generally, dialog relies on a div within the HTML. Sometimes you may want to create a dialog from scratch, programmatically. Here is an example of a complex modal dialog created dynamically with interactive functions. HTML <div id="users-contain" class="ui-widget"> &lt...
git commit -m 'Fix UI bug' --date 2016-07-01 The --date parameter sets the author date. This date will appear in the standard output of git log, for example. To force the commit date too: GIT_COMMITTER_DATE=2016-07-01 git commit -m 'Fix UI bug' --date 2016-07-01 The date parameter accepts t...
// Include sequence containers #include <vector> #include <deque> #include <list> // Insert sorting algorithm #include <algorithm> class Base { public: // Constructor that set variable to the value of v Base(int v): variable(v) { } i...
Assuming a source file of hello_world.v and a top level module of hello_world. The code can be run using various simulators. Most simulators are compiled simulators. They require multiple steps to compile and execute. Generally the First step is to compile the Verilog design. Second step is to ...
For programmers coming from GCC or Clang to Visual Studio, or programmers more comfortable with the command line in general, you can use the Visual C++ compiler from the command line as well as the IDE. If you desire to compile your code from the command line in Visual Studio, you first need to set...
You can use ReactJS's components easily in TypeScript. Just rename the 'jsx' file extension to 'tsx': //helloMessage.tsx: var HelloMessage = React.createClass({ render: function() { return <div>Hello {this.props.name}</div>; } }); ReactDOM.render(<HelloMessage name=&q...
The primary task of the manifest is to inform the system about the app's components. For example, a manifest file can declare an activity as follows: <?xml version="1.0" encoding="utf-8"?> <manifest ... > <application android:icon="@drawable/app_icon.pn...
While in insert mode, press <C-o> to temporarily leave insert mode and execute a one-off normal command. Example <C-o>2w jumps to the second word to the left and returns to insert mode. Note: Repeating with . will only repeat the actions from returning to insert mode This allows for ...

Page 10 of 65