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

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;}

Using Symbolic Links in Java

Symbolic links are a useful entity, with which you can introduce some kind of encapsulation. The Symbolic link can be created in a secure environment (ex: DMZ) where users can

Convert a String to a Byte Array

Explore how to convert a string to a byte array. String stringToBeConverted = ” ? ” ;int stringLength = stringToBeConverted.Length;byte[] bytes = new byte[stringLength / 2];for (int counter = 0;

Unwrapping a Session from EntityManager

When we need access to a Hibernate Session, we have to unwrap it from the current EntityManager via the unwrap() method as follows: // Spring and Java EE EntityManager em

T-SQL Performance Tip: NOT IN vs NOT EXISTS

Avoid using NOT IN whilst comparing nullable columns. Use NOT EXISTS instead. When NOT IN is used in a query, SQL Server compares each result to null (even if no

Use MySQL for Calculations

At times, when you want to compute the result of a mathematical formula, you can use MySQL to do the task. It is a great tool for this. Here are

Check Whether or Not an IP Is Valid in C#

See below for a short function that validates a given IP address: public static Boolean ValidateIP(string inputIP){var ipParts = inputIP.Split(‘.’);return Int32.Parse(ipParts [0]) < 256 &&Int32.Parse(ipParts [1]) < 256&Int32.Parse(ipParts [2]) <

User Creation and Scenarios

Please understand that this USER named SRIDHAR is created without a password and is also dangerous. CREATE USER SRIDHAR Alternatively, you can use the code below to create with a

Selectively Expose CRUD Methods

When a repository interface should not be instantiated at runtime, it should be marked with @NoRepositoryBean annotation as follows: @NoRepositoryBeaninterface BaseRepository extends Repository { // CRUD methods that will not

Tip: T-SQL Performance–The * Operator

It is best to avoid using the * operator in your queries, use explicit column names instead. SQL Server scans through all column names and replaces the * operator with

T-SQL Performance Tip: The * Operator

It is best to avoid using the * operator in your queries, use explicit column names instead. SQL Server scans through all column names and replaces the * operator with

Split a Concatenated String with a Delimiter

Here is how to split a concatenated string with a delimiter and remove empty entries. public static void Test() { string concatenatedString = “,ONE,,TWO,,,THREE,,”; char[] charSeparator = new char[] {‘,’};

Understanding NULL in MySQL

NULL is a unique value. It represents a value that is not defined and that is not really equal to BLANK (”). While using it in queries, we need to

Avoid Jackson Lazy Init Exceptions

First, add the following dependency to your project (Maven): com.fasterxml.jackson.datatype jackson-datatype-hibernate5 ${jackson.version} Further, add the following bean: @Beanpublic Module datatypeHibernateModule() { return new Hibernate5Module();}

Tip: T-SQL Performance–Owner or Schema Name

In order to improve your queries’ performance, you should always include the owner or schema name of an object by including its prefix before an object. Otherwise, the SQL Server

T-SQL Performance Tip: Owner or Schema Name

In order to improve your queries’ performance, you should always include the owner or schema name of an object by including its prefix before an object. Otherwise, the SQL Server

Finding the Mime Type of a File

Finding the MIME type of a file is useful when you want to perform certain actions. PS: I have placed a file named nature.jpg in the folder /home/sridhar before executing