Tag Archives: Utils

File Sorting based on parameters

Many times our file directories are full of files that we may like to be sorted in some particular manner. Below is the code to sort theĀ files as per the following ways: Month Sorting Alphabetic Sorting Music Album Sorting Extension … Continue reading

Posted in Java, Open Source | Tagged , , , , , , | Leave a comment

Code to Encrypt Folder Structure Completely

Below is the code to encrypt/decrypt complete folder structure in java import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import javax.crypto.Cipher; import javax.crypto.CipherInputStream; import javax.crypto.CipherOutputStream; import javax.crypto.spec.SecretKeySpec; public class CryptoX { static String pwd = “”; private static String compressPassword(String … Continue reading

Posted in Java | Tagged , , , , , , , | Leave a comment

Code to Download File from URL in Java

Below is the code to download the complete contents of a URL to your local hard drive. //IMPORTS import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.io.File; METHOD CODE private static void download(String url) throws … Continue reading

Posted in Java | Tagged , , , , , , | Leave a comment

Email Validation

CHALLENGE DESCRIPTION: You are given several strings that may/may not be valid emails. You should write a regular expression that determines if the email id is a valid email id or not. You may assume all characters are from the … Continue reading

Posted in Java | Tagged , , , | Leave a comment

How to check if 2 Date Ranges Overlap in Java

Code to check if 2 date ranges overlap each other or not. /** * @return boolean true in case the date ranges overlap. */ boolean isOverLaped(Date start1,Date end1,Date start2,Date end2) throws NullPointerException{ if ((start1.before(start2) && end1.after(start2)) || (start1.before(end2) && end1.after(end2)) … Continue reading

Posted in Java | Tagged , , | 8 Comments

ADF – Displaying Multi-Line Text with outputText Component

To display multi-line text, the basic idea is applying the white-space CSS property to the element with one of following values: pre, pre-wrap and pre-line. This property controls the processing of whitespace inside an element. The exact value you need … Continue reading

Posted in CSS, Oracle ADF | Tagged , , , | Leave a comment

PHPMAILER: Attach A File To An Email In PHP

The steps below shows you how to set up and use the PHPMailer library: Import the PHPMailer Lib into your project either using Autoloader or Include. Library can be found @ Implement the code as below: include(‘phpmailer.php’); $email = new … Continue reading

Posted in PHP | Tagged , , , | Leave a comment