Tutorial by Examples

To easily select a buffer by filename, you can use: :b [part_of_filename]<Tab><Tab><Tab>...<Enter> The first Tab will expand the word to a full filename, and subsequent Tab presses will cycle through the list of possible matches. When multiple matches are available, you ...
<C-^> will switch to and from the previous edited file. On most keyboards <C-^> is CTRL-6. 3<C-^> will switch to buffer number 3. This is very quick, but only if you know the buffer number. You can see the buffer numbers from :ls or from a plugin such as MiniBufExplorer.
THREE.BoxGeometry builds boxes such as cuboids and cubes. Cubes Cubes created using THREE.BoxGeometry would use the same length for all sides. JavaScript //Creates scene and camera var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHe...
THREE.CylinderGeometry build cylinders. Cylinder Continuing from the previous example, the code to create the box could be replaced with the below. //Makes a new cylinder with // - a circle of radius 5 on top (1st parameter) // - a circle of radius 5 on the bottom (2nd parameter) // - a height...
extension String { func matchesPattern(pattern: String) -> Bool { do { let regex = try NSRegularExpression(pattern: pattern, options: NSRegularExpressionOptions(rawValue: 0)) let range: NSRange = NSMakeRange(...
super keyword performs important role in three places Constructor Level Method Level Variable Level Constructor Level super keyword is used to call parent class constructor. This constructor can be default constructor or parameterized constructor. Default constructor : super(); Pa...
public interface ILogger { void Log(string message); } [Export(typeof(ILogger))] [ExportMetadata("Name", "Console")] public class ConsoleLogger:ILogger { public void Log(string message) { Console.WriteLine(message); } } [Export(typeof(IL...
Label Tag Helper can be used to render label for a model property. It replaces method Html.LabelFor in previous versions of MVC. Let's say you have a model: public class FormViewModel { public string Name { get; set; } } In the view you can use label HTML element and asp-for tag helper: ...
You may need to render some content in view, which is specific to some environment only. To achieve this goal you can use Environment tag helper: <environment names="Development"> <h1>This is heading for development environment</h1> </environment> <envi...
Often one want to show the result of a command executed by root to other users. The tee command allows easily to write a file with user perms from a command running as root: su -c ifconfig | tee ~/results-of-ifconfig.txt Only ifconfig runs as root.
For null check in method Object nullableObject = methodReturnObject(); if (Objects.isNull(nullableObject)) { return; } For not null check in method Object nullableObject = methodReturnObject(); if (Objects.nonNull(nullableObject)) { return; }
In the old fashion way for collection null check List<Object> someObjects = methodGetList(); for (Object obj : someObjects) { if (obj == null) { continue; } doSomething(obj); } With the Objects.nonNull method and Java8 Stream API, we can do the above in this way: ...
Marks are like bookmarks; they help you find places you've already been. TLDR Set them in normal mode with m{a-zA-Z}, and jump to them in normal or visual mode with '{a-zA-Z} (single quote) or `{a-zA-Z} (backtick). Lowercase letters are for marks within a buffer, and capital letters and digits are...
Consider this example: public class ThreadTest implements Runnable { private boolean stop = false; public void run() { long counter = 0; while (!stop) { counter = counter + 1; } System.out.println("Counted " + counter);...
local t1, t2, t3, t4 = {}, {}, {}, {} -- Create 4 tables local maintab = {t1, t2} -- Regular table, strong references to t1 and t2 local weaktab = setmetatable({t1, t2, t3, t4}, {__mode = 'v'}) -- table with weak references. t1, t2, t3, t4 = nil, nil, nil, nil -- No more "strong" refe...
Suppose you have a long list of elements and you are only interested in every other element of the list. Perhaps you only want to examine the first or last elements, or a specific range of entries in your list. Python has strong indexing built-in capabilities. Here are some examples of how to achie...
An observable is created from the TextChanged event of the TextBox. Also any input is only selected if it's different from the last input and if there was no input within 0.5 seconds. The output in this example is sent to the console. Observable .FromEventPattern(textBoxInput, "TextChan...
What are local and global scope? All Python variabes which are accessible at some point in code are either in local scope or in global scope. The explanation is that local scope includes all variables defined in the current function and global scope includes variabled defined outside of the curren...
A transaction is a sequential group of SQL statements such as select,insert,update or delete, which is performed as one single work unit. In other words, a transaction will never be complete unless each individual operation within the group is successful. If any operation within the transaction fai...
AUTOCOMMIT MySQL automatically commits statements that are not part of a transaction. The results of any UPDATE,DELETE or INSERT statement not preceded with a BEGIN or START TRANSACTION will immediately be visible to all connections. The AUTOCOMMIT variable is set true by default. This can be chan...

Page 802 of 1336