Nizamuddin Siddiqui

Nizamuddin Siddiqui

1,958 Articles Published

Articles by Nizamuddin Siddiqui

Page 163 of 196

How to create a frequency polygon in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 08-Oct-2020 2K+ Views

Frequency polygons are the graphs of the values to understand the shape of the distribution of the values. They are useful in comparing different data sets and visualising cumulative frequency distribution of the data sets. In base R, we can use polygon function to create the frequency polygon but first we should create a line plot for the two variables under consideration.ExampleConsider the below vectors x and y −set.seed(999) x

Read More

How to reduce the size of the area covered by legend in R for a plot created by using plot function?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 08-Oct-2020 2K+ Views

By default, the area covered by legends for a plot created by using plot function is of full size that is 1 (the area size has a range of 0 to 1, where 1 refers to the full size and 0 refers to none). To reduce the size, we can use cex argument with the legend function as shown in the below example.ExampleConsider the below vectors and the plot created between these two vectors −x

Read More

How to create a standard normal distribution curve with 3-sigma limits in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 07-Oct-2020 461 Views

A standard normal distribution has mean equals to zero and the standard deviation equals to one. Therefore, when we plot it with three sigma limits, we have six points on the X-axis referring to the plus and minus around zero. If the limits are defined then the plotting can be shown with larger width and that will change the display of the curve. We can do this by creating a sequence for the length of the standard normal variable and its density.Consider the below vectors corresponding to the limits and density−x

Read More

How do you get the file size in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 25-Sep-2020 3K+ Views

The FileInfo class is used to deal with file and its operations in C#.It provides properties and methods that are used to create, delete and read file. It uses StreamWriter class to write data to the file. It is a part of System.IO namespace.The Directory property retrieves an object that represents the parent directory of a file.The DirectoryName property retrieves the full path of the parent directory of a file.The Exists property checks for the presence of a file before operating on it.The IsReadOnly property retrieves or sets a value that specifies whether a file can be modified.The Length retrieves ...

Read More

How to write Regex for numbers only in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 25-Sep-2020 3K+ Views

A regular expression is a pattern that could be matched against an input text.The .Net framework provides a regular expression engine that allows such matching.A pattern consists of one or more character literals, operators, or constructs.Here are basic pattern metacharacters used by RegEx −* = zero or more ? = zero or one ^ = not [] = rangeThe ^ symbol is used to specify not condition.the [] brackets if we are to give range values such as 0 - 9 or a-z or A-ZExampleclass Program{    public static void Main(){       string num = "123dh";     ...

Read More

How to post data to specific URL using WebClient in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 25-Sep-2020 6K+ Views

We can Get and Post data from a Web API using Web client. Web client provides common methods for sending and receiving data from ServerWeb client is easy to use for consuming the Web API. You can also use httpClient instead of WebClientThe WebClient class uses the WebRequest class to provide access to resources.WebClient instances can access data with any WebRequest descendant registered with the WebRequest.RegisterPrefix method.Namespace:System.Net Assembly:System.Net.WebClient.dllUploadString Sends a String to the resource and returns a String containing any response.Exampleclass Program{    public static void Main(){       User user = new User();       try{   ...

Read More

What does LINQ return when the results are empty in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 25-Sep-2020 1K+ Views

Language-Integrated Query (LINQ) is the name for a set of technologies based on the integration of query capabilities directly into the C# language.You can write LINQ queries in C# for SQL Server databases, XML documents, ADO.NET Datasets, and any collection of objects that supports IEnumerable or the generic IEnumerable interface.In Linq-to-SQL if you try to get the first element on a query with no results you will get sequence contains no elements errorToList returns an empty listExampleclass Program{    public static void Main(){       List list = new List { "a" };       IEnumerable ilist = ...

Read More

How to get the thread ID from a thread in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 25-Sep-2020 4K+ Views

A thread is defined as the execution path of a program. Each thread defines a unique flow of control. If your application involves complicated and time-consuming operations, then it is often helpful to set different execution paths or threads, with each thread performing a particular job.Threads are lightweight processes. One common example of use of thread is implementation of concurrent programming by modern operating systems. Use of threads saves wastage of CPU cycle and increase efficiency of an application.In C#, the System.Threading.Thread class is used for working with threads. It allows creating and accessing individual threads in a multithreaded application. ...

Read More

How to find the Number of CPU Cores in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 25-Sep-2020 3K+ Views

There are several different pieces of information relating to processors that we can getNumber of physical processorsNumber of coresNumber of logical processorsThese can all be different; in the case of a machine with 2 dual-core hyper-threadingenabled processors, there are 2 physical processors, 4 cores, and 8 logical processors.The number of logical processors is available through the Environment class, but the other information is only available through WMI (and you may have to install some hotfixes or service packs to get it on some systems) −Add a reference in your project to System.Management.dll In .NET Core, this is available (for Windows ...

Read More

How to calculate the total number of items defined in an enum in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 25-Sep-2020 2K+ Views

An enum is a special "class" that represents a group of constants (unchangeable/readonly variables).To create an enum, use the enum keyword (instead of class or interface), and separate the enum items with a comma −By default, the first item of an enum has the value 0. The second has the value 1, and so on.To get the integer value from an item, you must explicitly convert the item to an intYou can also assign your own enum values, and the next items will update the number accordingly −Enums are often used in switch statements to check for corresponding values −Exampleclass ...

Read More
Showing 1621–1630 of 1,958 articles
« Prev 1 161 162 163 164 165 196 Next »
Advertisements