MathF.Truncate Method in C# with Examples

AmitDiwan
Updated on 05-Nov-2019 07:47:44

410 Views

The MathF.Truncate() method in C# is used to calculate an integral part of a specified single number or single-precision floating-point number.SyntaxFollowing is the syntax −public static float Truncate (float val);Above, Val is the specified number to be truncatedExampleLet us now see an example to implement the MathF.Truncate() method −using System; public class Demo {    public static void Main(){       float val1 = float.PositiveInfinity;       float val2 = float.NegativeInfinity;       Console.WriteLine("MathF.Truncate(val1) = "+MathF.Truncate(val1));       Console.WriteLine("MathF.Truncate(val2) = "+MathF.Truncate(val2));    } }OutputThis will produce the following output −MathF.Truncate(val1) = Infinity MathF.Truncate(val2) = -InfinityExampleLet us ... Read More

MySQL Query to Select Rows Where Column Value is Only 0 Group By Another Column

AmitDiwan
Updated on 05-Nov-2019 07:47:33

308 Views

For this, use group by. Let us first create a table −mysql> create table DemoTable1344    -> (    -> `SequenceId` int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> ClientId int,    -> isMarried tinyint(1)    -> ); Query OK, 0 rows affected (0.49 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1344(ClientId, isMarried) values(4567, 0); Query OK, 1 row affected (0.45 sec) mysql> insert into DemoTable1344(ClientId, isMarried) values(9876, 0); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1344(ClientId, isMarried) values(5432, 1); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1344(ClientId, isMarried) ... Read More

MathF.Tanh Method in C# with Examples

AmitDiwan
Updated on 05-Nov-2019 07:44:22

173 Views

The MathF.Tanh() method in C# returns the hyperbolic tangent of a given single value argument.SyntaxFollowing is the syntax −public static float Tanh (float val);Above, Val is the is number whose hyperbolic tangent is to be returned.ExampleLet us now see an example to implement the MathF.Tanh() method −using System; public class Demo {    public static void Main(){       float val1 = 10f;       float val2 = float.NaN;       Console.WriteLine("MathF.Tanh(val1) = "+MathF.Tanh(val1));       Console.WriteLine("MathF.Tanh(val2) = "+MathF.Tanh(val2));    } }OutputThis will produce the following output −MathF.Tanh(val1) = 1 MathF.Tanh(val2) = NaNExampleLet us now see ... Read More

Insert All Values in a Table with a Single MySQL Query

AmitDiwan
Updated on 05-Nov-2019 07:42:58

276 Views

Let us first create a table −mysql> create table if not exists DemoTable1343    -> (    -> `_ClientId` int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> ClientName varchar(40),    -> ClientProjectDeadline date    -> )ENGINE=MyISAM, AUTO_INCREMENT=1000; Query OK, 0 rows affected (0.21 sec)Insert some records in the table using insert command with a single query −mysql> insert into DemoTable1343(ClientName, ClientProjectDeadline) values('Chris', '2019-09-24'), ('Bob', '2015-12-09'),    -> ('Mike', '2017-01-20'), ('Carol', '2018-03-31'); Query OK, 4 rows affected (0.10 sec) Records: 4 Duplicates: 0 Warnings: 0Display all records from the table using select statement −mysql> select * from DemoTable1343;This will produce the ... Read More

MathF.Tan Method in C# with Examples

AmitDiwan
Updated on 05-Nov-2019 07:42:02

186 Views

The MathF.Tan() method in C# is used to return the tangent of a given float value argument.SyntaxFollowing is the syntax −public static float Tan (float val);Above, Val is the angle whose tangent is to be returned.ExampleLet us now see an example to implement the MathF.Tan() method −using System; public class Demo {    public static void Main(){       float val1 = 10f;       float val2 = float.NaN;       Console.WriteLine("MathF.Tan(val1) = "+MathF.Tan(val1));       Console.WriteLine("MathF.Tan(val2) = "+MathF.Tan(val2));    } }OutputThis will produce the following output −MathF.Tan(val1) = 0.6483608 MathF.Tan(val2) = NaNExampleLet us now see ... Read More

Convert toBase64String Method in C#

AmitDiwan
Updated on 05-Nov-2019 07:37:58

1K+ Views

The Convert.ToBase64String() method in C# is used to convert the value of an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits.SyntaxFollowing is the syntax −public static string ToBase64String (byte[] arr);Above, arr is an array of 8-bit unsigned integers.ExampleLet us now see an example to implement the Convert.ToBase64String() method −Using System; public class Demo {    public static void Main(){       byte[] val1 = {5, 10, 15, 20, 25, 30};       string str = Convert.ToBase64String(val1);       Console.WriteLine("Base 64 string: '{0}'", str);       byte[] val2 = ... Read More

jQuery First Selector

AmitDiwan
Updated on 05-Nov-2019 07:37:24

268 Views

The :first selector in jQuery is used to select the first DOM element.SyntaxThe syntax is as follows −$(":first")ExampleLet us now see an example to implement the :first() selector −    .demo {       background-color: red;       color: white;       font-size: 16px;       border: 2px blue dashed;    }    $(document).ready(function(){       $("input:first").addClass("demo");    }); Job Application Applicant Name: Rank: Resume: OutputThis will produce the following output −

Convert ToBase64CharArray Method in C#

AmitDiwan
Updated on 05-Nov-2019 07:36:26

294 Views

The Convert.ToBase64CharArray() method in C# is used to convert a subset of an 8-bit unsigned integer array to an equivalent subset of a Unicode character array encoded with base-64 digits.SyntaxFollowing is the syntax −public static int ToBase64CharArray (byte[] arr, int offsetIn, int length, char[] outArray, int offsetOut);Here, arr − An input array of 8-bit unsigned integers.offsetIn − A position within arr.length − The number of elements of arr to convert.outArray − An output array of Unicode characters.offsetOut − A position within outArray.ExampleLet us now see an example to implement the Convert.ToBase64CharArray() method −using System; public class Demo {    public ... Read More

Add Column from Select Query with Row Count in MySQL

AmitDiwan
Updated on 05-Nov-2019 07:30:01

367 Views

For this, you can use MySQL row_number(). Let us first create a table −mysql> create table DemoTable1342    -> (    -> Score int    -> ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1342 values(80); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable1342 values(98); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1342 values(78); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1342 values(89); Query OK, 1 row affected (0.07 sec)Display all records from the table using select statement −mysql> select ... Read More

jQuery File Selector

AmitDiwan
Updated on 05-Nov-2019 07:24:41

616 Views

The :file selector in jQuery is used to select all input elements with type=”file”.SyntaxThe syntax is as follows −$(":file")ExampleLet us now see an example to implement the :file() selector −    .demo {       background-color: blue;       color: white;       font-size: 16px;       border: 2px blue dashed;    }    $(document).ready(function(){       $(":file").addClass("demo");    }); Job Application Applicant Name: Rank: Resume: OutputThis will produce the following output −

Advertisements