devxlogo

We are an award-winning tech entrepreneurship website where trusted experts can provide value globally.

Since 1998, DevX has helped people start businesses, build websites, and provide enterprise technology to people globally. Interviewing the likes of Microsoft’s co-founder, Steve Ballmer, the publication brings comprehensive, reliable, and accessible insights to the Internet.

devxlogo

Trusted for 26 years

Over 30K Articles

1M+ Readers

Expert-reviewed

10K+ Tech Terms

As seen in:

microsoft logo
business_insider_logo
wired_logo
berkley
arstechnica_logo
hackernoon

The Latest

Quick Approach to Creating a Custom RuntimeException

The quickest way to create a custom RuntimeException is as follows (simply extend RuntimeException): public class IncorrectFileException extends RuntimeException { public IncorrectFileException(String errorMessage, Throwable err) { super(errorMessage, err); }}

Moving a Folder in Java

The move method accepts three arguments. The 1st and 2nd being the source and target Path attributes and the 3rd being the replace option. import java.nio.file.*;import static java.nio.file.StandardCopyOption.*;public class FileMove{

Merge Two Dictionaries in Python

The Dictionary class in Python provide an update() function that allows you to merge two dictionaries. For example: employeeScore = { ‘Emp1’:100, ‘Emp2’:98, ‘Emp3’:96}employee2019Score= { ‘Emp1’:101, ‘Emp2’:104} To merge, just

Pick N Items in an Array in a Specified Order

Using the OrderBy operator in conjunction with Take in C#, we can pick a selected number of items based on an order. int n = 3;var firstThreeStates = states.OrderBy(s =

Syntax for Unicode Escapes in Java

In addition to the string and character escape sequences, Java has a more general Unicode escaping mechanism, as defined in JLS 3.3. Unicode Escapes. A Unicode escape has the following

Three Levels of Data Abstraction in SQL

The process of hiding irrelevant details from a user is called data abstraction. The three levels of Data Abstraction in SQL are: Physical Level Logical Level View Level

Change Colors with the CSS Transition Property

Using the transition property on an element, we can do amazing CSS transitions. See below for a example. The div will change color on hover with a transition. HTML: Hover

Trigger a GET Request via the JDK 11 HttpClient API

The JDK 11 HttpClient API is very flexible and intuitive. Here it is a sample of triggering a GET request and printing the response: HttpClient client = HttpClient.newHttpClient();HttpRequest request =

Find the Number of Processors Available

There are abundant resources available in the java.lang package. Learn more about the server/host on which you are working. The Runtime class has numerous functionalities. To learn the number of

Check Whether an Input Argument Is Null in C#

Use this extension method in C# to check whether or not an input argument is null, and throw an error if necessary. Extension method: public static void CheckIfParameterIsValid(this T o,

Delete Data Safely with SQL

You never know what can happen when you attempt to delete data. Some may argue that it is best to delete data through a client application, some may say it

Autoplay an Audio File Using the Audio Tag

The audio tag lets you play an audio file on a webpage. Its syntax is very simple. Please note the usage of “autoplay” attribute. It auto plays the music file

Validate Arguments via Google Guava

Google Guava Preconditions are quite useful for validating arguments of methods. Here it is an example: public void setAge(int age) { Preconditions.checkArgument(assert age = 0, “Age cannot be negative”); …}

Extension Method to Update All Items in a List

See how to use an extension method in C# to update all items in a list. public static IEnumerable ForEach(this IEnumerable collection, Action action){//Loop thru the collectionforeach (T item in

How to Check Whether a Port is Free

We can check if a given port is free by trying to construct a ServerSocket with the port that needs to be checked: import java.io.*;import java.net.*;public class CheckingIfPortIsFree{ public static

Name All of the Normalization Forms in SQL

Get a list of the names of all normalization forms in SQL. 1NF 2NF 3NF BCNF Boyce-Codd Normal Form 4NF 5NF ONF: Optimal Normal Form DKNF: Domain-Key Normal Form

Determine Files Present in a Zip File

A zip file is a compressed file that can hold one or more files. The following code snippet lets us scan the contents of a given zip file. Code snippet:

Add Log4j2 in a Spring Boot Application

Adding Log4j2 in a Spring Boot application can be done in two steps. For Maven, in pom.xml, exclude Spring Boot’s default logging: org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-starter-logging Further, add Log4j2 dependency:

How Reverse a String in C#

See how to reverse a string. public static string ReverseString( string input) { char[] array = input.ToCharArray(); Array.Reverse(array); return new string(array); }Console.WriteLine(ReverseString(“devx”));

Working with ArrayList Operations

ArrayList has an overloaded method that accepts a string, as well as an Integer, as an argument. The remove method can remove elements based on the string, along with the

TCP: out of memory — consider tuning tcp_mem

Recently we experienced an interesting production problem. This application was running on multiple AWS EC2 instances behind Elastic Load Balancer. Application was running on GNU/Linux OS, Java 8, Tomcat 8 application server. All of sudden one of the application instances became unresponsive. All other application instances were handling the traffic properly. Whenever HTTP request was sent to this application instance from the browser, we were getting following response to be printed on the browser.

Discovering the Reason for Poor Query Performance

What can cause poor performance of a query? Any or a combination of these: No indexes exist for the tables Unnecessarily complicated joins Excess usage of cursors Excess usage of

Java Support for the Hijri Calendar

The Hijri calendar system is somewhat different from the Gregorian calendar. This example does not discuss the complete Hijri calendar. This is only to educate you regarding the existence of

Tip: Java Support for the Hijrah Calendar

The Hijri calendar system is somewhat different from the Gregorian calendar. This example does not discuss the complete Hijri calendar. This is only to educate you regarding the existence of

Usage of the Repository Factory Class

Spring Data provide a class named RepositoryFactorySupport. Via this class we can access any repository, as in the following example: RepositoryFactorySupport factory = … // code that instantiate the factory;CustomerRepository

Format the Currency for a Culture in C#

Use the CultureInfo class to format values based on a culture. See below for an example: public static void Main() { decimal inputValue = 233; CultureInfo currentCulture = new CultureInfo(“en-US”);

Variable Arguments in Java

Moving away from the age old way of fixed arguments, Java supports variable arguments. The code sample below illustrates variable arguments. If the method has multiple arguments, it is mandatory