
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.
An approach for sorting a Java collection can rely on Collections.sort() method as in the following example: List names = new ArrayList(); names.add(“John”); names.add(“Alicia”); names.add(“Tom”); Collections.sort(names); // sort ascending by
Follow this example to see how to join paths in Python. root= “/root”str = os.path.join(root, “Y2019”, “2019.txt”)

Instructing Spring Boot to connect to a database can be done in application.properties via the JDBC URL, user and password as in the following example: spring.datasource.url=jdbc:mysql://localhost:3306/mydb?createDatabaseIfNotExist=truespring.datasource.username=rootspring.datasource.password=root
At times, you may want to restrict the number of connections made from a user to the database. This may be necessary to improve performance, reporting, etc. MySQL supports this
Learn how to use an extension method to update all of the items in a list with C#. public static IEnumerable ForEach(this IEnumerable collection, Action action){ //Loop thru the collection
One way to convert a list to an array is shown below: List list = Arrays.asList(1, 2, 3);Integer[] array = new Integer[list.size()];array = list.toArray(array);
MySQL allows you to explicitly convert a number to a string with the help of CAST function. The example below illustrates how to use it. SELECT 55.5 AS NUMBER, CAST(55.5

Python’s str string objects have no built-in .reverse() method like you might expect if you’re coming to Python from a different language. str = “devx”print(“reverse string is “, str[::-1])
Dear Editors,I sent an email to [email protected] on December 1 with an attached tip ???Passing a function instead of a function???s result to an another function in Python???.I used to use her email address a number of years ago. I would like to know if the tip was received and what is its status.My email is [email protected]. Thanks,Boris Eligulashvili
Query methods defined in repositories can be executed asynchronously. This means that the query method will return immediately upon invocation. The sample code below relies on @Async annotation and Future,
MySQL is a very robust database that supports JSON as a data type. This will be very useful for applications that need the JSON data type for certain types of
Use the join operator to concatenate strings in a list. str = [“devx”, “is”, “for”, “developers”] str = (” “.join(str))
In order to selectively expose CRUD operations, we need to define an intermediate interface, annotated as below: @NoRepositoryBeaninterface IntermediateRepository extends Repository { // add here the selected CRUD, for example
MySQL supports multiple types of storage engines. There are specific engines that are meant for specific needs. Understanding of these storage engines is beyond the scope of the current discussion.
For defining a SynchronousQueue in Java, we need the BlockingQueue interface as follows: BlockingQueue queue = new SynchronousQueue();
Working with and comparing multiple queries at the same time can be a pain, at least for me. Two independent query windows take up more space on screen, or having
Use getsizeof method to retrieve the size of an object in bytes. See below for an example: str = “devx” print(sys.getsizeof(str))
MySQL provides numerous mathematical calculations that can be computed with inbuilt functions. In order to find the TAN of a number, we can use the following: Query: SELECT TAN(400); Sample
Converting List to Set: List list = Arrays.asList(1, 2, 3);Set set = new HashSet(list); Converting Set to List: Set set = Sets.newHashSet(1, 2, 3);List list = new ArrayList(set);

The quickest solution for sorting an array in Java relies on Arrays.sort() method as below: int[] arr = {5, 12, 3, 44, 55}; Arrays.sort(arr);
There are numerous times when we get confused with the paths of our imported modules. A quick way to see their path in code is by performing a print. For

Consider a Review object with three properties: article, book and magazine. Let’s assume that only one of these three properties should be set as non-null. For checking this constraint we
The SUBSTRING_INDEX helps in extracting a part of the given string from the beginning to the match in the index. Query: SELECT SUBSTRING_INDEX(‘MySQL Database’, ‘a’, 2) AS SUBSTRING_INDEX; Here, the
The best way to declare a Pattern in Java is as a constant, since Pattern is immutable. Use the following code: private static final Pattern PATTERN = Pattern.compile(” +”); Further,
Sometimes you want to select all the columns, without using the *. Specifying column names speeds up your query. The problem comes in with large tables or tables with difficult
Use the dir() function to return the list of the attributes and methods of the object. Syntax :dir({object})
If we have a code-point, we can check if it is a Unicode surrogate pair as follows: int cp = some_code_point;if(Character.charCount(cp) == 2) { // 2 means a surrogate pair
Port BindExceptions can occur if a port is already occupied by some other process and you try to use it again. Below is a simple example that demonstrates this and
To convert, e.g., the number 144 to the string ???144???, use the built-in type constructor??str()
Passing parameters to an SQL query written via @Query can be done via @Param or via positional parameters: // via @Param@Query(value = “SELECT p FROM Product p WHERE p.department=:department”)List fetchByDepartment(@Param(“department”)











