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

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

DevX - Software Development Resource

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. Related Articles Troubleshooting Timeout in AWS Elastic Beanstalk Apache Unleashes New Tomcat Open Source Web Server Embedded Jetty and Spring: The Lightweight Antidote for Java EE Complexity

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

Types of Indexes that Exist in SQL

What types of indexes are there? Answer: Clustered Sort and store data based on key values Non-clustered Each key is a pointer to the data row

Using REGEX and Patterns in Java

Java has a very powerful library for REGEX. A very basic usage of REGEX is being presented in the code snippet below and we can improve on this to develop

Countdown Timer Function in C#

See how to use this function in C# to discover how many more days are left in a given countdown. DateTime startDate = DateTime.Now;DateTime endDate = DateTime.Now.AddDays(-1);TimeSpan t = startDate

Getting the Last ID in MySQL

MySQL supports AUTO_INCREMENT column types where the value of a particular column can be auto incremented as, and when, the records are inserted. Many instances would need the last value

Three Ways to Limit Your Results in SQL Server 2016

The query below uses TOP to select the TOP 3 students: TOPSELECT TOP 3 *FROM Students; The code below uses LIMIT to only show three records: SELECT StudentName, StudentPercentageFROM StudentsLIMIT

Java StringWriter

StringWriter is similar to StringBuffer, which can collect a host of string values and work with the data. We will explore writing a porting of a given string. Code sample:

Convert a Date to ISO 8601 Format in C#

Please see below for an example of how to convert a date time to ISO 8601 format. string isoFormatDateString = dateTimeObject.ToUniversalTime().ToString(“s”) + “Z”;

Using the WEEKOFYEAR Function in MySQL

MySQL has abundant functions that support a multitude of application needs. Here, we shall use some Calendar functionality to find in which week a given date belongs. Samples: Considering the

Async Query Results

Repository queries can be executed asynchronously using @Async annotation. The result can be a Future, CompletableFuture and ListenableFuture. The method will return immediately upon invocation: @asyncFuture findByName(String name);@asyncCompletableFuture findByName(String name);@asyncListenableFuture

Creating User Defined Functions

There are many instances in which you might repeatedly use some functionality. It would be handy if you were allowed to create a function that could be used as, and

Return a MappingJacksonValue from a REST Controller

A proof of concept can be seen below: @GetMapping(“…”)public MappingJacksonValue fooMethod(…) throws JsonProcessingException { List foos = …; MappingJacksonValue wrapper = new MappingJacksonValue(fooa); … return wrapper;}