JavaScript Function Definition in Chrome: How to Find It

Giri Raju
Updated on 22-Jun-2020 14:33:58

4K+ Views

To find the JavaScript function definition in Google Chrome, open the web browser and press F12 to reach Developer Tools.Now press Ctrl + Shift + FCheck Regular Expression as shown below −Search for function and that’s it.

C# Program to Get the Name of the Drive

Ankith Reddy
Updated on 22-Jun-2020 14:33:38

195 Views

Set the drive for which you want to display the name −DriveInfo info = new DriveInfo("C");Now, to get the drive name, use the Name property −info.NameHere is the complete code with output −Exampleusing System; using System.Linq; using System.IO; public class Demo {    public static void Main() {       DriveInfo info = new DriveInfo("C");       Console.WriteLine(“Drive: “+info.Name);    } }OutputThe following is the output −D:/

C# Program to Get the Name of Root Directory

George John
Updated on 22-Jun-2020 14:33:02

644 Views

Use the RootDirectory property to get the name of the root directory.Firstly, use DriveInfo to set the drive for which you want the root directory −DriveInfo dInfo = new DriveInfo("C");Now, the RootDirectory gives you the result −dInfo.RootDirectoryExampleHere is the complete code −using System; using System.Linq; using System.IO; public class Demo {    public static void Main() {       DriveInfo dInfo = new DriveInfo("C");       Console.WriteLine("Root Directory: "+dInfo.RootDirectory);    } }OutputThe following is the output −C:\

Get All Drives in C#

Arjun Thakur
Updated on 22-Jun-2020 14:31:43

677 Views

Firstly, use GetDrives to get the name of all the drives −var drv = DriveInfo.GetDrives();Loop through to get the name of all the drives on the system −foreach (DriveInfo dInfo in drv) {    Console.WriteLine(dInfo.Name); }Let us see the complete code −Example Live Demousing System; using System.Linq; using System.IO; public class Demo {    public static void Main() {       var drv = DriveInfo.GetDrives();       foreach (DriveInfo dInfo in drv) {          Console.WriteLine(dInfo.Name);       }    } }Output/etc/resolv.conf /etc/hostname /etc/hosts /run/secrets /home/cg/rootNote: The result will vary on different Operating Systems. The above ... Read More

Get List of MySQL Databases Using PHP Script

Priya Pallavi
Updated on 22-Jun-2020 14:31:14

2K+ Views

We can write the following PHP script to get the list of available MySQL databases −Example

TakeWhile Method in C#

Ankith Reddy
Updated on 22-Jun-2020 14:31:14

476 Views

With the TakeWhile() method, you can get methods by setting a condition base on Predicate.Firstly, declare and initialize an array −int[] arr = { 25, 40, 65, 70};Now, use the TakeWhile() method and predicate to get all the elements that are less than 30.var val = arr.TakeWhile(ele => ele < 30);Let us see the same example, wherein we have displayed the values less than 30 using Predicate −Example Live Demousing System; using System.Linq; using System.IO; public class Demo {    public static void Main() {       int[] arr = { 25, 40, 65, 70};       var val = arr.TakeWhile(ele => ele < 30);       foreach (int res in val) {          Console.WriteLine(res);       }    } }Output25

Aggregate Method in C#

George John
Updated on 22-Jun-2020 14:30:53

1K+ Views

Use the Aggregate method in C# to perform mathematical operations such as Sum, Min, Max, Average, etc.Let us see an example to multiply array elements using Aggregate method.Here is our array −int[] arr = { 10, 15, 20 };Now, use Aggregate() method −arr.Aggregate((x, y) => x * y);Here is the complete code −Example Live Demousing System; using System.Linq; using System.IO; public class Demo {    public static void Main() {       int[] arr = { 10, 15, 20 };       // Multiplication       int res = arr.Aggregate((x, y) => x * y);       Console.WriteLine(res);    } }Output3000

Count Affected Rows by MySQL Query in PHP

vanithasree
Updated on 22-Jun-2020 14:30:45

406 Views

PHP uses mysql_affected_rows( ) function to find out how many rows a query changed. To illustrate it we are having the following example −Example           Rows affected by query                  

All Methods in C#

Chandu yadav
Updated on 22-Jun-2020 14:30:29

376 Views

The All() extension method is part of the System.Linq namepspace. Using this method, you can check whether all the elements match a certain condition or not.Set an array −int[] arr = { 6, 7, 15, 40, 55 };The following is an example. It checks whether all the elements in the array is greater than and equal to 2 or not −arr.All(element => element > = 2);Here is the complete code −Example Live Demousing System; using System.Linq; class Program {    static void Main() {       int[] arr = { 6, 7, 15, 40, 55 };       bool res = arr.All(element => element >= 2);       Console.WriteLine(res);    } }OutputTrue

MySQL GENERATED COLUMN and Its Usage in Table Creation

Lakshmi Srinivas
Updated on 22-Jun-2020 14:30:09

1K+ Views

Basically generated columns are a feature that can be used in CREATE TABLE or ALTER TABLE statements and is a way of storing the data without actually sending it through the INSERT or UPDATE clause in SQL. This feature has been added in MySQL 5.7. A generated column works within the table domain. Its syntax would be as follows −Syntaxcolumn_name data_type [GENERATED ALWAYS] AS (expression) [VIRTUAL | STORED] [UNIQUE [KEY]]Here, first of all, specify the column name and its data type.Then add the GENERATED ALWAYS clause to indicate that the column is a generated column.Then, indicate whether the type of ... Read More

Advertisements