Tutorial by Examples: er

Static server assets must be placed in the private directory. Text files Text files can be accessed by using the Assets.getText(assetPath, [asyncCallback]) method. For example, the following JSON file is named my_text_asset.json and is located in the private directory: { "title": &...
// thecontroller.js $scope.sendVerifyEmail = function() { console.log('Email sent, whaaaaam!'); currentAuth.sendEmailVerification(); } // where currentAuth came from something like this: // routerconfig .... templateUrl: 'bla.html', resolve: { currentAuth:['Auth', functio...
To delete some lines of text when you don't know exact number of lines to delete, you try 10dd , 5dd , 3dd until you remove all the lines. Relative line numbers solves this problem, suppose we have a file containing : sometimes, you see a block of text. You want to remove it but you cannot d...
The following command executes :command on lines 23 to 56: :23,56command NB: Ranges are inclusive by default.
In the following command the range starts 6 lines above the current line and ends 3 lines below: :-6,+3command
:s/foo/bar Replace the first instance of foo with bar on the current line. :s/foo/bar/g Replace every instance of foo with bar on the current line. :%s/foo/bar/g Replace foo with bar throughout the entire file.
* on the word you want to substitute. :%s//replacement/g, leaving the find pattern empty.
The original default colourmap of MATLAB (replaced in version R2014b) called jet is ubiquitous due to its high contrast and familiarity (and was the default of matplotlib for compatibility reasons). Despite its popularity, traditional colormaps often have deficiencies when it comes to representing d...
The getopts builtin can be used inside functions to write functions that accommodate flags and optional parameters. This presents no special difficulty but one has to handle appropriately the values touched by getopts. As an example, we define a failwith function that writes a message on stderr an...
If you want to detect when your user starts or finishes an activity such as walking, running, or any other activity of the DetectedActivityFence class, you can create a fence for the activity that you want to detect, and get notified when your user starts/finishes this activity. By using a Broadcast...
BroadcastReceivers are used to receive broadcast Intents that are sent by the Android OS, other apps, or within the same app. Each Intent is created with an Intent Filter, which requires a String action. Additional information can be configured in the Intent. Likewise, BroadcastReceivers register ...
The symbol NA is for a logical missing value: class(NA) #[1] "logical" This is convenient, since it can easily be coerced to other atomic vector types, and is therefore usually the only NA you will need: x <- c(1, NA, 1) class(x[2]) #[1] "numeric" If you do need a s...
DatePickerDialog is the simplest way to use DatePicker, because you can show dialog anywhere in your app. You don't have to implement your own layout with DatePicker widget. How to show dialog: DatePickerDialog datePickerDialog = new DatePickerDialog(context, listener, year, month, day); datePick...
DatePicker allows user to pick date. When we create new instance of DatePicker, we can set initial date. If we don't set initial date, current date will be set by default. We can show DatePicker to user by using DatePickerDialog or by creating our own layout with DatePicker widget. Also we can ...
Below are the PHP5 SuperGlobals $GLOBALS $_REQUEST $_GET $_POST $_FILES $_SERVER $_ENV $_COOKIE $_SESSION $GLOBALS: This SuperGlobal Variable is used for accessing globals variables. <?php $a = 10; function foo(){ echo $GLOBALS['a']; } //Which will print 10 Glo...
POST /token HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded grant_type=password&username=[USERNAME]&password=[PASSWORD] &client_id=[APP_KEY]&client_secret=[APP_SECRET] Source
To use multiple databases in Django, just specify each one in settings.py: DATABASES = { 'default': { 'NAME': 'app_data', 'ENGINE': 'django.db.backends.postgresql', 'USER': 'django_db_user', 'PASSWORD': os.environ['LOCAL_DB_PASSWORD'] }, 'users': {...
The normal obj.save() method will use the default database, or if a database router is used, it will use the database as specified in db_for_write. You can override it by using: obj.save(using='other_db') obj.delete(using='other_db') Similarly, for reading: MyModel.objects.using('other_db').al...
class Digit { public Digit(double d) { val = d; } public double val; // User-defined conversion from Digit to double public static implicit operator double(Digit d) { Console.WriteLine("Digit to double implict conversion called"); return d.val;...
Above I noticed an example to remove items from a List within a Loop and I thought of another example that may come in handy this time using the Iterator interface. This is a demonstration of a trick that might come in handy when dealing with duplicate items in lists that you want to get rid of. N...

Page 142 of 417