
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.
Before Java 7, this task required a comparator and the compareTo() method. But, beginning with Java 7, is advisable to rely on Integer.compare(), which is not exposed to overflow risks
To get the last day of the current month, do the following: SELECT CONVERT(VARCHAR(25), DATEADD(DAY, -(DAY(GETDATE())), DATEADD(MONTH, 1, GETDATE())), 105) LastDay

Finding all of the available drives in the system is often useful. The following code snippet brings up a list of the available drives: */import java.io.File;public class SystemDrives{ public static
In order to obtain statistics regarding SQL queries executed via Hibernate, we need to set hibernate.generate_statistics=true. In Spring, we need to add in application.properties the following setting: spring.jpa.properties.hibernate.generate_statistics=true
You can get the current precision by executing the following command: SELECT @@MAX_PRECISION AS ‘MAX_PRECISION’
Collection has an unmodifiableCollection method that returns a collection object that cannot be modified. It means that you cannot add or remove any element from the collection. import java.util.*;public class UnmodifiableCollection{
Beginning with JDK 12, we can indent strings via String.indent(int n), in which n is the number of spaces.Example : indent text “abc” with 10 spaces: “abs”.indent(10);
You can rebuild all indexes present in your database with the following query: EXEC sp_MSforeachtable @command1=”print ‘?’ DBCC DBREINDEX (‘?’, ‘ ‘, 80)” GO EXEC sp_updatestats GO
You can get the current language of SQL Server with the following command: SELECT @@LANGUAGE AS Current_Language;
TemporalAdjusters is a class in Java that is oriented towards bettering the options of Calendar. You can easily compute the dates of firstDayOfNextMonth, lastDayOfMonth, next Wednesday, etc. TemporalAdjusters have many more methods
Beginning with JDK 11, we can return a boolean if the Optional is empty via Optional#isEmpty(): public boolean bookIsEmpty(long id) { Optional book = // code that fetches the book
You can recompile certain stored procedures with the following command: EXEC sp_recompile ‘Procedure_Name’; GO
If we want to define a valid URL instance for a file we need to add the “file” protocol as in the following example: URL url = new URL(“file:///C:/photos/me.png”);
See how to use this form of Regex below to identify whether or not a string has only alphabets present. public class RegexHasOnlyAlphabets{ public static void main(String args[]) { RegexHasOnlyAlphabets

You can RESEED?Identity Columns of all tables by using sp_MSForEachTable?to loop through all the tables and executing the DBCC CHECKIDENT?command if the specific table has an identity column: EXEC sp_MSForEachTable
See how to add or subtract days, months or years with these operations. LocalDate tomorrow = LocalDate.now().plusDays(3);LocalDateTime anHourFromNow = LocalDateTime.now().plusHours(10);Long daysBetween = java.time.temporal.ChronoUnit.DAYS.between(LocalDate.now(), LocalDate.now().plusDays(2));Duration duration = Duration.between(Instant.now(), ZonedDateTime.parse(“2018-08-30T09:00:00+01:00[Europe/Stockholm]”));
You can use the IIF statement to check quickly for conditions. For example: DECLARE @Spy varchar(20) = ’07’ SELECT IIF(@Spy = ‘007’, ‘Bond, James Bond’, ‘Ernst Stavro Blofeld’) If the
Starting with Java 8, we can join several strings with a delimiter (e.g., comma) via the String.join() method: String result = String.join(“, “, “One”, “Two”, “Three”);// One, Two, ThreeSystem.out.println(result);
An interesting statement in MySQL is the INSERT ON DUPLICATE KEY UPDATE. This statement tries to INSERT?a record, and on finding a duplicate key, performs the action provided alongside. Example:
You can make use of the built-in sys.fn_builtin_permissions SQL function to get a list of available permissions, as shown below: SELECT * FROM sys.fn_builtin_permissions(DEFAULT);SELECT * FROM sys.fn_builtin_permissions(”);
Beginning with JDK 10, we can rely on the Java Local Variable Type Inference (Var Type) in order to avoid explicit typing. Check out the following sample: var outputStream =

You can resize the tempdb temporary database in SQL by using the ALTER DATABASE command, as shown below: ALTER DATABASE tempdbMODIFY FILE (Name = tempdb_data, filesize = 100MB),MODIFY FILE (NAME
Assume there is a column named MARKS in the table STUDENT_DETAILS, and we need to calculate the average. The following query will be necessary: SELECT AVG(MARKS) AVERAGE FROM STUDENT_DETAILS; This
String and character literals provide an escape mechanism that allows express character codes that would otherwise not be allowed in the literal. An escape sequence consists of a backslash character
We use a lot of ng-templates in our HTML and have cases in which we would need to swap one with the other based on a condition. ngSwitch comes in
Java 9 has added the concept of module via Java Platform Module System. In order to obtain the names of packages from a module we can do it as follows:

You can get the language ID with the following Select statement: SET LANGUAGE ‘French’SELECT @@LANGID AS ‘Language ID’
Use the “@ts-ignore” comment before the code and the compiler will ignore errors. // @ts-ignoreimport mathUnit from ‘mathjs/lib/type/unit’
The Math package is feature-rich and some of the methods are illustrated below. public class MathPkg{public static void main(String args[]){MathPkg mathPkg = new MathPkg();mathPkg.proceed();}private void proceed(){int positiveNum = 5;int negativeNum
It is difficult to maintain correctness in mutable objects, as multiple threads could be trying to change the state of the same object. This can lead to some threads seeing











