I’ve written about Java regular expression to validate email addresses before. Today I am sharing another Java regex to validate Gmail address. It is quite simple and self-explanatory.
Following simple Java program shows how to read input values and then print smallest and largest values. It reads the input from standard input using Scanner and then uses methods from Math class to determine the largest and smallest numbers entered by the user.
Although Java’s Arrays class has a built-in method to sort an array, it is important for good Java developers to know how to sort an array on their own. Bubble sort is the simplest sorting algorithm.
Here is a list of 10 commonly used Eclipse shortcuts for Java developers. Ctrl + Shift + T: Open a type (e.g.; a class, an interface) without browsing through list of packages Ctrl + Shift + R: Open any file quickly without browsing for it in the Package Explorer Ctrl + O: Go directly to […]
Joomla is a wonderful platform to publish websites. With readily available templates you can have your website up and running in no time. Sometimes though you may need to direct your visitors to a different page than your regular home page, for instance you may want to direct all the visitors to a promotion page […]
If you need to search for a phrase or a string in a text file Java regular expression is the easiest way to accomplish this task. Here is a simple example that demonstrates how you can use Java regular expression to find a string or a phrase in a text file.
If you need to read properties file in your Spring application all you need is to configure a PropertyPlaceholderConfigurer bean in your application context. Following example shows how to read property values from a properties file named config.properties. This file needs to be in your classpath so Spring can find it. Let’s begin by creating […]
Sometimes when you upload or FTP files from a Windows system to a UNIX box you will see ^M at the end of each line. ^M is the UNIX equivalent of DOS line break. Not only does it not look pretty, this extra character may break all sorts of scripts that you try to run […]
For PL/SQL developers put_line is a quite useful method. I use it for logging purposes. Recently I found out that the method has an annoying limitation. You cannot print more than 255 characters per line! Now that is a strange feature. I don’t know what is the reasoning behind this restriction but it does make […]