Tutorial by Examples: complet

class Program { static void Main(string[] args) { // Create 2 thread objects. We're using delegates because we need to pass // parameters to the threads. var thread1 = new Thread(new ThreadStart(() => PerformAction(1))); var thread2 = new Thread(...
class Program { static void Main(string[] args) { // Run 2 Tasks. var task1 = Task.Run(() => PerformAction(1))); var task2 = Task.Run(() => PerformAction(2))); // Wait (i.e. block this thread) until both Tasks are complete. Task.WaitA...
// Create a block with an asynchronous action var block = new ActionBlock<string>(async hostName => { IPAddress[] ipAddresses = await Dns.GetHostAddressesAsync(hostName); Console.WriteLine(ipAddresses[0]); }); block.Post("google.com"); // Post items to the block's ...
Step 1 If you already have Django installed, you can skip this step. pip install Django Step 2 Create a new project django-admin startproject hello That will create a folder named hello which will contain the following files: hello/ ├── hello/ │ ├── __init__.py │ ├── settings.py │...
This assumes that you have read the documentation about starting a new Django project. Let us assume that the main app in your project is named td (short for test driven). To create your first test, create a file named test_view.py and copy paste the following content into it. from django.test impo...
\bfoo\b will match the complete word with no alphanumeric and _ preceding or following by it. Taking from regularexpression.info There are three different positions that qualify as word boundaries: Before the first character in the string, if the first character is a word character. After...
The following example demonstrates the use of a BackgroundWorker to update a WinForms ProgressBar. The backgroundWorker will update the value of the progress bar without blocking the UI thread, thus showing a reactive UI while work is done in the background. namespace BgWorkerExample { public...
Future<Results> costlyQuery() { var completer = new Completer(); database.query("SELECT * FROM giant_table", (results) { // when complete completer.complete(results); }, (error) { completer.completeException(error); }); // this returns essentially im...
In Terminal on your Mac operating system, enter the following 2 commands: lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
Whenever AFNetworking is used the call is dispatched on a custom thread provided by AFNetworking. When the call returns to the completion block, it gets executed on the main thread. This example sets a custom thread that dispatch to the completion block: AFNetworking 2.xx: // Create dispatch_queu...
Basic code completion (the name of any class, method or variable) Windows: Ctrl + Space OS X / macOS: Cmd + Space Smart code completion (filters the list of methods and variables by expected type) Windows: Ctrl + Shift + Space OS X / macOS: Cmd + Shift + Space Overwriting code with a suggestio...
_mycompletion() { local command_name="$1" # not used in this example local current_word="$2" local previous_word="$3" # not used in this example # COMPREPLY is an array which has to be filled with the possible completions # compgen is used to fi...
This is very common, you memorize a path to a file or folder, you open up Vim and try to write what you've just memorized, but you are not 100% sure it's correct, so you close the editor and start over. When you want the path completion feature, and you have a file /home/ubuntu/my_folder/my_file a...
Example below shows how to create a BroadcastReceiver which is able to receive BOOT_COMPLETED events. This way, you are able to start a Service or start an Activity as soon device was powered up. Also, you can use BOOT_COMPLETED events to restore your alarms since they are destroyed when device is ...
using System; using System.Linq; using System.Security.Cryptography; namespace YourCryptoNamespace { /// <summary> /// Salted password hashing with PBKDF2-SHA1. /// Compatibility: .NET 3.0 and later. /// </summary> /// <remarks>See http://crackstation.net/h...
Summary: MVVM is an architectural pattern that is represented by three distinct components, the Model, View and ViewModel. In order to understand these three layers, it is necessary to briefly define each, followed by an explanation of how they work together. Model is the layer that drives the bus...
C# using OpenQA.Selenium using OpenQA.Selenium.Chrome; using System.Threading; namespace WebDriver Tests { class WebDriverWaits { static void Main() { IWebDriver driver = new ChromeDriver(@"C:\WebDriver"); driver.Na...
var source = new AutoCompleteStringCollection(); // Add your collection of strings. source.AddRange(new[] { "Guybrush Threepwood", "LeChuck" }); var textBox = new TextBox { AutoCompleteCustomSource = source, AutoCompleteMode = AutoCompleteMode.SuggestAppend, ...
Notepad++ provides 2 types of features for auto-completion and suggestions: Auto-completion that reads the open file and provide suggestion of words and/or functions within the file Suggestion with the arguments of functions (specific to the language) To enable it, you need to change a settin...
# The following shell function will be used to generate completions for # the "nuance_tune" command. _nuance_tune_opts () { local curr_arg prev_arg curr_arg=${COMP_WORDS[COMP_CWORD]} prev_arg=${COMP_WORDS[COMP_CWORD-1]} # The "config" option takes a file arg, so ...

Page 1 of 3