Monday, September 18, 2017

Descriptions of the Gradle build structure

Be The First To Comment
Descriptions of the build gradle file’s parts

Build Java code

apply plugin: ‘java’
apply plugin: ‘war’

This task compiles, tests, and assembles the code into a JAR or WAR file, 
when you run - gradle build

Specify project folder structure


Build with Gradle Wrapper

task wrapper(type: Wrapper) {
    gradleVersion = '2.7'

The Gradle Wrapper is the preferred way of starting a Gradle build. It consists of a batch 
script for Windows and a shell script for OS X and Linux. These scripts allow you to run 
a Gradle build without requiring that Gradle be installed on your system.

Tuesday, November 25, 2014

Solution: IntelliJ not recognizing a particular file correctly, instead its stuck as a text file

I had mistakenly save my class as fileName.text file and tried to rename it with fileName .java but the IntelliJ couldn't recognize it and throws the error saying..
After spending long hours on internet, I found a solution and sharing/keeping here for future reference.

Step 1: Click "File"==> "Settings"
Step 2: Expand "Editor" & Click "File Types"
Step 3: You will see all file types on Right. Navigate to the "Text Files" and Click it
Step 4: You should able to see your file name on the bottom of Registered Patterns (lower box)
Step 5: Remove your file from the Registered Patterns. The problem should solved and let you to rename with
Step 6: If not, delete the file from the project and create it again with name fileName

Get PDF fonts information line by line using PDFBox API

Sample code snippet on extracting font information line by line using PDFBox API in JAVA.

 public String[] getFontLineByLineFromPdf(String fileName)throws IOException  
     PDDocument doc= PDDocument.load(fileName);  
     PDFTextStripper stripper = new PDFTextStripper() {  
       String prevBaseFont = "";  
       protected void writeString(String text, List<TextPosition> textPositions) throws IOException  
         StringBuilder builder = new StringBuilder();  
         for (TextPosition position : textPositions)  
           String baseFont = position.getFont().getBaseFont();  
           if (baseFont != null && !baseFont.equals(prevBaseFont))  
             prevBaseFont = baseFont;  
     String content=stripper.getText(doc);  
     String pdfLinesWithFont[]= content.split("\\r?\\n");  
     return pdfLinesWithFont;  

Tuesday, March 13, 2012

Solved: AutomationException 0x80004005 - Unspecified error

1 Comment

I was writing ArcGIS extension for Geoprocessing using JAVA and ArcObjects 10. My need was to process about 1000 PRISM raster datasets globally to compute various environments.

My application did work up to 45- 50 raster files without any problems in loop, then if fails with “AutomationException 0x80004005 - Unspecified error”. If I restarted the application again works for next 45-50 raster files and then crashes with the same error.

I still couldn’t figure out what was the exact cause for application failure-my guess is it may be due to memory management/garbage collection problem among ArcGIS COM objects and JAVA objects.
Fortunately, I solved this issue by reinitializing ArcGIS engine (hope re-initialization breaks the locks and flushes the garbage) after 20 raster files processing. Now, the application works well without any breaks but little bit slower while initializing the ArcGIS engine after 20 raster files processing.

© 2011 GIS and Remote Sensing Tools, Tips and more .. ToS | Privacy Policy | Sitemap

About Me