Skip to main content

Posts

Using Properties in Java

Properties file is being used commonly in every project to get external or supported parameters like configurations, urls, port numbers and ids etc. We can handle these files using file stream APIs like FileInputStream, FileOutputStream etc, provided in java by treating these files as normal text files. But another way is also there to handle the property files, which is the best and efficient way to handle these by using the API java.util.Properties . The class Properties has few methods on which the below are very important and most useful. load(InputStream in): To load the external properties file loadFromXML(InputStream in): To load an XML file as a property file getProperty(String key): To read value of a property key from the property file getProperty(String key,String defaultValue): To read value of a property key from the property file. If the key doesn’t exist then it will return the defaultValue. Let us see an example to understand how to use the Properties class. Create a pr...

Write Files

WriteFiles is a java tool to integrate several textual files to a single file. In some scenarios like where we need to copy all source code files into a document or a textual file, it is difficult to copy the content of all the files manually. For example, if you take java application where there will be different source files under different packages, it starts from a root directory (package), includes sub directories and their sub directories and so on. Each directory or sub directory may have their individual java classes. If you want to copy all these source files including the sub folders, think how difficult it is to do so. This tool can help you to do the same. Visit  Projects page of  learningmela.com for more details and to download the tool.

java.lang.OutOfMemoryError

This is a runtime error simply means that the JVM ran out of memory.  We can choose either of the below two solutions to fix it. 1)       Prevent memory leak: Yes. Preventing memory leak will also improve the performance of the application. A memory leak can be very latent. A memory leak occurs when the application creates more references to objects and never releases them. So the garbage collector will never collect those objects results less free memory will be available, hence not enough free memory is available for the application to function normally.  2)       Increase the heap size of the JVM. It can be done by using the VM argument –Xmx  Syntax : java -Xmx<size> <java class> -d<bit mode> Where, Size is the size of the memory asking JVM to take Java class is the program name to which memory is required Bit mode tells which bit mode of operating system is being used...

Excel To DB

ExcelToDB is a tool developed in Java, is a very useful tool if you want to import data from MS-Excel to data bases MS-Access or Oracle. Below is the GUI of the tool. Visit  Projects page of  learningmela.com for more details and to download the tool.

Creating a User form in MS-Excel

In this article, we are going to know how to create a user form in MS-Excel using VBA script. Download  the document to see the step-by-step procedure to know how to create a form in MS-Excel using VBA programming. Visit  articles page of the website learningmela.com for more details.

Access to Excel

Here is a small VBA script written in MS-Excel to download the data of a table from MS-Access to the excel sheet, which might useful while preparing status reports or analyzing data. Visit  Projects page of  learningmela.com for more details and to download the tool.  

Primary Key Vs Unique Key

This post is to share my knowledge on how Unique key is differs from Primary key. As both are enforces uniqueness, why can’t we go for unique key instead of primary key. In this document I tried to give some features of primary key as well as unique key. Visit  articles page of the website learningmela.com to download the document and for more details.