Tutorial by Examples: an

You can make function passed to test() method async - then you can use await keyword. Your test will wait until Promises resolve and testing asynchronous code becomes easier and more readable. In the following example call that returns a Promise is changeset.validate(). Please notice also wrapping s...
If you don't think that malicious scripts can harm your site, you are wrong. Here is a list of what a malicious script could do: Remove itself from the DOM so that it can't be traced Steal users' session cookies and enable the script author to log in as and impersonate them Show a fake "Yo...
public class Foo { private String name; public Foo(@NonNull String name){...}; ... } Here @NonNull is annotation which is processed compile time by the android studio to warn you that the particular function needs non null parameter.
Ensure you met all requirements, as per Requirements Mount the temporary API filesystems: cd /location/of/new/root mount -t proc proc proc/ mount --rbind /sys sys/ mount --rbind /dev dev/ mount --rbind /run run/ (optionally) If you need to use an internet connection in the c...
There are three types of annotations. Marker Annotation - annotation that has no method @interface CustomAnnotation {} Single-Value Annotation - annotation that has one method @interface CustomAnnotation { int value(); } Multi-Value Annotation - annotation that...
For creating custom annotations we need to decide Target - on which these annotations will work on like field level, method level, type level etc. Retention - to what level annotation will be available. For this, we have built in custom annotations. Check out these mostly used ones: @Target...
You can create a new notebook in RStudio with the menu command File -> New File -> R Notebook If you don't see the option for R Notebook, then you need to update your version of RStudio. For installation of RStudio follow this guide
When a notebook .Rmd is saved, an .nb.html file is created alongside it. This file is a self-contained HTML file which contains both a rendered copy of the notebook with all current chunk outputs (suitable for display on a website) and a copy of the notebook .Rmd itself. More info can be found at R...
A Django model typically refers to a table in the database, attributes of that model becomes the column of that table. In more of a real-world example, you would create a model for any entity in your application, and store its attributes with django fields which automatically handles data-types conv...
A simple example would be for a library management application; you would have 2 models, for example, student and book in models.py: from django.db import models class student(models.Model): roll_no = models.IntegerField(primary_key=True) first_name = models.CharField(max_length=30) ...
import pip command = 'install' parameter = 'selenium' second_param = 'numpy' # You can give as many package names as needed switch = '--upgrade' pip.main([command, parameter, second_param, switch]) Only needed parameters are obligatory, so both pip.main(['freeze']) and pip.main(['freeze'...
When you use python file as module there is no need always check if package is installed but it is still useful for scripts. if __name__ == '__main__': try: import requests except ImportError: print("To use this module you need 'requests' module") t ...
Two main techniques allow passing data between GUI functions and Callbacks: setappdata/getappdata and guidata (read more about it). The former should be used for larger variables as it is more time efficient. The following example tests the two methods' efficiency. A GUI with a simple button is cre...
ifconfig The above command will show all active interface of the machine and also give the information of IP address assign to interface MAC address of the interface Broadcast address Transmit and Receive bytes Some example ifconfig -a The above command also show the disable interfac...
The first function, using an array, is much faster If called without the optional parameter, will default to .ThisWorkbook.ActiveSheet If the range is empty will returns Cell( 1, 1 ) as default, instead of Nothing Speed: GetMaxCell (Array): Duration: 0.0000790063 seconds GetMaxCell (Find ...
Deleting rows is slow, specially when looping through cells and deleting rows, one by one A different approach is using an AutoFilter to hide the rows to be deleted Copy the visible range and Paste it into a new WorkSheet Remove the initial sheet entirely With this method, th...
Require is a statement that Node interprets as, in some sense, a getter function. For example, say you have a file named analysis.js, and the inside of your file looks like this, function analyzeWeather(weather_data) { console.log('Weather information for ' + weather_data.time + ': '); consol...
Node's require is also very helpful when used in tandem with an NPM package. Say, for example, you would like to use the NPM package require in a file named getWeather.js. After NPM installing your package through your command line (git install request), you are ready to use it. Your getWeather.js f...
fun startNewActivity(){ val intent: Intent = Intent(context, Activity::class.java) startActivity(intent) } You can add extras to the intent just like in Java. fun startNewActivityWithIntents(){ val intent: Intent = Intent(context, Activity::class.java) intent.putExtra(KEY_NA...

Page 300 of 307