Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Syed Javed
11 articles
How to find the size of a variable without using sizeof in C#?
In C#, the sizeof operator is commonly used to determine the size of a value type in bytes. However, there are alternative approaches to find the size of a variable without using sizeof, such as using the BitConverter class or Marshal.SizeOf method. Syntax Using sizeof operator − int size = sizeof(dataType); Using BitConverter.GetBytes() method − byte[] dataBytes = BitConverter.GetBytes(variable); int size = dataBytes.Length; Using Marshal.SizeOf() method − int size = Marshal.SizeOf(typeof(dataType)); Using BitConverter.GetBytes() Method The BitConverter.GetBytes() method converts a value to its byte array representation. ...
Read MoreHow to change font size in HTML?
To change the font size in HTML, use the CSS font-size property. You can apply it using the style attribute for inline styles, internal CSS with the tag, or external CSS files. HTML5 does not support the deprecated tag, so CSS is the modern approach. Keep in mind that inline styles using the style attribute override any global styles set in tags or external stylesheets. Using Inline Styles The simplest method is using the style attribute directly on HTML elements: ...
Read More:active pseudo class in CSS
The CSS :active pseudo-class represents an element that is being activated by the user. This occurs during the brief moment when the element is being clicked or pressed, typically on links, buttons, or any clickable element. Syntax selector:active { property: value; } Example 1: Active Link Color The following example changes the link color to green when clicked − a:active { color: green; } ...
Read MoreCURL context options in PHP
In PHP, CURL context options allow you to configure HTTP and FTP requests when using stream contexts with functions like file_get_contents() or fopen(). These options provide fine-grained control over request behavior without directly using the cURL extension. Note: CURL context options are available when the CURL extension was compiled using the --with-curlwrappers configure option (deprecated in newer PHP versions). Available CURL Context Options Option Description method HTTP method supported by the remote server. Defaults to GET. header Additional headers to be sent during request ...
Read MoreHow is down-casting possible in Java?
Yes, a variable can be downcast to its lower range substitute by casting. It may lead to data loss although. See the example below −Examplepublic class Tester { public static void main(String[] args) { int a = 300; byte b = (byte)a; System.out.println(b); } }OutputIt will print output as −44
Read MoreLocal variables in Java
Local variables are declared in methods, constructors, or blocks.Local variables are created when the method, constructor or block is entered and the variable will be destroyed once it exits the method, constructor, or block.Access modifiers cannot be used for local variables.Local variables are visible only within the declared method, constructor, or block.Local variables are implemented at stack level internally.There is no default value for local variables, so local variables should be declared and an initial value should be assigned before the first use.ExampleHere, age is a local variable. This is defined inside pupAge()method and its scope is limited to only ...
Read MoreFibonacci series program in Java without using recursion.
Following is the required program.Examplepublic class Tester { public static void main(String args[]) { int n1 = 0, n2 = 1, n3, i, max = 5; System.out.print(n1 + " " + n2); for (i = 2; i < max; ++i) { n3 = n1 + n2; System.out.print(" " + n3); n1 = n2; n2 = n3; } } }Output0 1 1 2 3
Read MoreHow can we set PRIMARY KEY on multiple columns of an existing MySQL table?
We can set PRIMARY KEY constraint on multiple columns of an existing table by using ADD keyword along with ALTER TABLE statement.ExampleSuppose we have a table ‘Room_allotment’ as follows −mysql> Create table Room_allotment(Id Int, Name Varchar(20), RoomNo Int); Query OK, 0 rows affected (0.20 sec) mysql> Describe Room_allotment; +--------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+-------+ | Id | int(11) | YES | | NULL | | | Name | varchar(20) | YES | | NULL ...
Read MoreAdvantages of naming conventions in Java
Following the the best practices while declaring a variable. These best practices maintains code readability, understandability as project code size increases.Variables names should be short or long enough as per the scope. For example, loop counter variable, i is fine whereas employee as loop variable.Specific words should not be used like equals, compare, data.Use meaningful names which can explain the purpose of the variable. For example cnt Vs counter.Don't use _ to declare a variable name, Use camel casing. For example, employeeName is better than employee_name.Each organization has its own syntax specific standards. Follow those rules to maintain consistency ...
Read MoreHow the Table statement works in ABAP
With table statement, you are able to get a single line of data corresponding to the dictionary structure you specify. The fields of structure can be used as select options and the structure can be passed as variable in the program.
Read More