Tutorial by Examples: bas

A ViewPager allows to show multiple fragments in an activity that can be navigated by either fliping left or right. A ViewPager needs to be feed of either Views or Fragments by using a PagerAdapter. There are however two more specific implementations that you will find most useful in case of using ...
Razor code can be inserted anywhere within HTML code. Razor code blocks are enclosed in @{ ... }. Inline variable and functions start with @. Code inside the Razor brackets follow the normal C# or VB rules. Single line statement: @{ var firstNumber = 1; } Multi-line code block: @{ var sec...
First create an express app: const express = require('express'); const app = express(); Then you can define routes like this: app.get('/someUri', function (req, res, next) {}) That structure works for all HTTP methods, and expects a path as the first argument, and a handler for that path, w...
This query will return the number of tables in the specified database. USE YourDatabaseName SELECT COUNT(*) from INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' Following is another way this can be done for all user tables with SQL Server 2008+. The reference is here. SELECT COUNT(...
The STUFF() function inserts a string into another string by first deleting a specified number of characters. The following example, deletes "Svr" and replaces it with "Server". This happens by specifying the start_position and length of the replacement. SELECT STUFF('SQL Svr D...
Basic table usage includes accessing and assigning table elements, adding table content, and removing table content. These examples assume you know how to create tables. Accessing Elements Given the following table, local example_table = {"Nausea", "Heartburn", "Indigesti...
You can pass data to a template in a custom variable. In your views.py: from django.views.generic import TemplateView from MyProject.myapp.models import Item class ItemView(TemplateView): template_name = "item.html" def items(self): """ Get all Ite...
This is a continuous collector that uses the hadoop fs -du -s /hbase/* command to get details about the HDFS disk usage. This metric is very useful for tracking space in an OpenTSDB system. #!/bin/bash while true; do while read -r bytes raw_bytes path; do echo "hdfs.du $(date +&...
It’s a good practice to declare the primary language of the document in the html element: <html lang="en"> If no other lang attribute is specified in the document, it means that everything (i.e., element content and attribute text values) is in that language. If the document con...
What is Serialization Serialization is the process of converting an object's state (including its references) to a sequence of bytes, as well as the process of rebuilding those bytes into a live object at some future time. Serialization is used when you want to persist the object. It is also used b...
You can use a template in a function based view as follows: from django.shortcuts import render def view(request): return render(request, "template.html") If you want to use template variables, you can do so as follows: from django.shortcuts import render def view(request):...
The CREATE TABLE statement is used to create a table in a MySQL database. CREATE TABLE Person ( `PersonID` INTEGER NOT NULL PRIMARY KEY, `LastName` VARCHAR(80), `FirstName` VARCHAR(80), `Address` TEXT, `City` VARCHAR(100) ) Engine=InnoDB; Ev...
Method 1: Below query will be applicable for SQL Server 2000+ version (Contains 12 columns) SELECT * FROM dbo.sysdatabases Method 2: Below query extract information about databases with more informations (ex: State, Isolation, recovery model etc.) Note: This is a catalog view and will be availa...
If a selection on multiple arguments for a type generic expression is wanted, and all types in question are arithmetic types, an easy way to avoid nested _Generic expressions is to use addition of the parameters in the controlling expression: int max_int(int, int); unsigned max_unsigned(unsigned, ...
Step 1: Open a Workbook Step 2 Option A: Press Alt + F11 This is the standard shortcut to open the VBE. Step 2 Option B: Developer Tab --> View Code First, the Developer Tab must be added to the ribbon. Go to File -> Options -> Customize Ribbon, then check the box for developer. ...
Few people have issue regarding error message not displaying if existing value is being entered in textbox. So, For Example I'm not allowing user to enter existing email. signup.php (Page where you wanted to sign up new user without existing email id) Remove use yii\bootstrap\ActiveForm; (if p...
Some people have issues regarding error messages not being displayed if an existing value is being entered. For example I'm not allowing a user signup with an existing email. View <?php ...................... <?= $form->field($modelUser, 'email')->textInput(['class'=&gt...
The static (compile-time) type is used rather than the dynamic (run-time type) to match parameters. public class Base { public virtual string GetName() { return "Base"; } } public class Derived : Base { public override string GetName() { ...
Rails uses sqlite3 as the default database, but you can generate a new rails application with a database of your choice. Just add the -d option followed by the name of the database. $ rails new MyApp -T -d postgresql This is a (non-exhaustive) list of available database options: mysql oracle...
INSERT INTO `table_name` (`field_one`, `field_two`) VALUES ('value_one', 'value_two'); In this trivial example, table_name is where the data are to be added, field_one and field_two are fields to set data against, and value_one and value_two are the data to do against field_one and field_two resp...

Page 6 of 65