Tutorial by Examples

Sample Data: CREATE TABLE table_name ( id, list ) AS SELECT 1, 'a,b,c,d' FROM DUAL UNION ALL -- Multiple items in the list SELECT 2, 'e' FROM DUAL UNION ALL -- Single item in the list SELECT 3, NULL FROM DUAL UNION ALL -- NULL list SELECT 4, 'f,,g' FROM DUAL; -- NULL item...
User can add custom route, mapping an URL to a specific action in a controller. This is used for search engine optimization purpose and make URLs readable. routes.MapRoute( name: "AboutUsAspx", // Route name url: "AboutUs.aspx", // URL with parameters defaults: new { c...
Often people try to index some content and then find it. If they cannot see the expected result, they try to troubleshoot the whole end-to-end process. The better way is to see whether the content actually indexed in the expected fields. This way it splits the problem into two: indexing and searchin...
lock provides thread-safety for a block of code, so that it can be accessed by only one thread within the same process. Example: private static object _lockObj = new object(); static void Main(string[] args) { Task.Run(() => TaskWork()); Task.Run(() => TaskWork()); Task.Run((...
You can implement the swipe-to-dismiss and drag-and-drop features with the RecyclerView without using 3rd party libraries. Just use the ItemTouchHelper class included in the RecyclerView support library. Instantiate the ItemTouchHelper with the SimpleCallback callback and depending on which functi...
var dict = ["name": "John", "surname": "Doe"] // Set the element with key: 'name' to 'Jane' dict["name"] = "Jane" print(dict)
using System.Net; using System.IO; ... string requestUrl = "https://www.example.com/submit.html"; HttpWebRequest request = HttpWebRequest.CreateHttp(requestUrl); request.Method = "POST"; // Optionally, set properties of the HttpWebRequest, such as: request.AutomaticD...
using System.Net; using System.IO; ... string requestUrl = "https://www.example.com/page.html"; HttpWebRequest request = HttpWebRequest.CreateHttp(requestUrl); // Optionally, set properties of the HttpWebRequest, such as: request.AutomaticDecompression = DecompressionMethods.GZ...
using System.Net; ... string serverResponse; try { // Call a method that performs an HTTP request (per the above examples). serverResponse = PerformHttpRequest(); } catch (WebException ex) { if (ex.Status == WebExceptionStatus.ProtocolError) { HttpWebResponse...
A list can be rendered using the v-for directive. The syntax requires that you specify the source array to iterate on, and an alias that will be used to reference each item in the iteration. In the following example we use items as the source array, and item as the alias for each item. HTML <di...
let myAllKeys = ["name" : "Kirit" , "surname" : "Modi"] let allKeys = Array(myAllKeys.keys) print(allKeys)
<link rel="stylesheet" media="min-width: 600px" href="example.css" /> This stylesheet is still downloaded but is applied only on devices with screen width larger than 600px.
Common table expressions support extracting portions of larger queries. For example: WITH sales AS ( SELECT orders.ordered_at, orders.user_id, SUM(orders.amount) AS total FROM orders GROUP BY orders.ordered_at, orders.user_id ) SELECT sales.ordered_at, sales.total,...
This example generates random values between 0 and 2147483647. Random rnd = new Random(); int randomNumber = rnd.Next();
Generate a random number between 0 and 1.0. (not including 1.0) Random rnd = new Random(); var randomDouble = rnd.NextDouble();
Generate a random number between minValue and maxValue - 1. Random rnd = new Random(); var randomBetween10And20 = rnd.Next(10, 20);
When creating Random instances with the same seed, the same numbers will be generated. int seed = 5; for (int i = 0; i < 2; i++) { Console.WriteLine("Random instance " + i); Random rnd = new Random(seed); for (int j = 0; j < 5; j++) { Console.Write(rnd.Next(...
Two Random class created at the same time will have the same seed value. Using System.Guid.NewGuid().GetHashCode() can get a different seed even in the same time. Random rnd1 = new Random(); Random rnd2 = new Random(); Console.WriteLine("First 5 random number in rnd1"); for (int i = 0...
The main methods that are useful with this class are popleft and appendleft from collections import deque d = deque([1, 2, 3]) p = d.popleft() # p = 1, d = deque([2, 3]) d.appendleft(5) # d = deque([5, 2, 3])
Average The AVG() aggregate function will return the average of values selected. SELECT AVG(Salary) FROM Employees Aggregate functions can also be combined with the where clause. SELECT AVG(Salary) FROM Employees where DepartmentId = 1 Aggregate functions can also be combined with group by ...

Page 243 of 1336