I am a programmer but I hate grammar. Here you will find what I did, doing , will do ... Scattered pieces of knowledge that I have deleted from my mind to the trash bin through out my boring daily coding life. I will also report some of my failures in life so dear to me not success, because I have always learnt much only when I fail.
Thursday, December 31, 2020
Monday, December 14, 2020
Saturday, December 12, 2020
Friday, November 27, 2020
Friday, November 20, 2020
Monday, July 6, 2020
Saturday, July 4, 2020
Sunday, June 28, 2020
Sunday, June 21, 2020
Monday, June 8, 2020
Sunday, June 7, 2020
Wednesday, June 3, 2020
Friday, May 29, 2020
Dev Tips#43 Connect MYSQL to a Jasper report in Java and JDBC
In this tutorial, I show you how to retrieve data from MySQL to a Jasper Report in Java. JDBC is used to get an instance of the connection and passed to the jasper report engine...
Settings.xml:
POM.xml:
Main Java Class:
Settings.xml:
mirror1 central mirror1 https://repo.maven.apache.org/maven2/
net.sf.jasperreports jasperreports 6.8.0 jar compile commons-collections commons-collections commons-beanutils commons-beanutils commons-digester commons-digester commons-logging commons-logging commons-digester commons-digester 2.1 compile false mysql mysql-connector-java 5.1.6
package com.mycompany.mavenprojectdemov1; import net.sf.jasperreports.engine.*; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.design.JasperDesign; import net.sf.jasperreports.engine.xml.JRXmlLoader; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; /** * Hello world! * */ public class App { public static Connection getDbaseConnection(String HOST_NAME, String DBASE_NAME, String USER_NAME, String USR_PASS) throws SQLException, ClassNotFoundException { Class.forName("com.mysql.jdbc.Driver"); //String connectionURL = "jdbc:mysql://" + hostName + ":3306/" + dbName; String CNTION_URL = "jdbc:mysql://" + HOST_NAME + "/" + DBASE_NAME; Connection conn = DriverManager.getConnection(CNTION_URL, USER_NAME,USR_PASS); return conn; } public static void main( String[] args ) { //Database credential String hostName = "localhost"; String dbName = "springboot"; String userName = "springboot"; String password = "springboot"; //Jasper file location String fileNameJrxml = "E:/Jasper/jasperv1.jrxml"; String fileNamePdf = "E:/Jasper/jasperv1.pdf"; try { //Getting a connection instance Connection connInstance = getDbaseConnection(hostName,dbName,userName,password); System.out.println("Loading the .JRMXML file ...."); JasperDesign jasperDesign = JRXmlLoader.load(fileNameJrxml); System.out.println("Compiling the .JRMXML file to .JASPER file...."); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); System.out.println("filling parameters to .JASPER file...."); JasperPrint jprint = (JasperPrint) JasperFillManager.fillReport(jasperReport, null,connInstance); System.out.println("exporting the JASPER file to PDF file...."); JasperExportManager.exportReportToPdfFile(jprint, fileNamePdf); System.out.println("Successfully completed the export"); } catch (Exception e) { System.out.print("Exception:" + e); } } }
Wednesday, May 27, 2020
Dev Tips#42 Passing parameters to a Jasper Report in Java
In this tutorial, I show you how to pass parameteres to a Jasper report in JAVA running in Netbeans IDE 8.
Settings.xml:
POM.xml:
Main Java Class:
Settings.xml:
mirror1 central mirror1 https://repo.maven.apache.org/maven2/
net.sf.jasperreports jasperreports 6.8.0 jar compile commons-collections commons-collections commons-beanutils commons-beanutils commons-digester commons-digester commons-logging commons-logging commons-digester commons-digester 2.1 compile false
package com.mycompany.mavenprojectdemov1; import java.util.HashMap; import net.sf.jasperreports.engine.*; import net.sf.jasperreports.engine.JREmptyDataSource; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.design.JasperDesign; import net.sf.jasperreports.engine.xml.JRXmlLoader; /** * Hello world! * */ public class App { public static void main( String[] args ) { String fileNameJrxml = "E:/Jasper/Blank_A4_Paramv2.jrxml"; String fileNamePdf = "E:/Jasper/Blank_A4_Paramv2.pdf"; try { System.out.println("Loading the .JRMXML file ...."); JasperDesign jasperDesign = JRXmlLoader.load(fileNameJrxml); System.out.println("Compiling the .JRMXML file to .JASPER file...."); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); String first_language = "Java"; String second_language = "Structured text"; HashMaphm = new HashMap (); hm.put("Param_First_Language", first_language); hm.put("Param_Second_Language", second_language); System.out.println("filling parameters to .JASPER file...."); JasperPrint jprint = (JasperPrint) JasperFillManager.fillReport(jasperReport, hm, new JREmptyDataSource()); System.out.println("exporting the JASPER file to PDF file...."); JasperExportManager.exportReportToPdfFile(jprint, fileNamePdf); System.out.println("Successfully completed the export"); } catch (Exception e) { System.out.print("Exception:" + e); } } }
Tuesday, May 26, 2020
Sunday, May 24, 2020
Saturday, May 23, 2020
Friday, May 22, 2020
Dev Tips#39 Jasper report in Java 8 and Netbeans 8
In this video I show you how to create a jasper report in Java 8 and Netbeans 8 with dependencies handled by maven to export a PDF. How to export a PDF in java.
Settings.xml:
Dependencies:
Java code:
Settings.xml:
mirror1 central mirror1 https://repo.maven.apache.org/maven2
Dependencies:
net.sf.jasperreports jasperreports 6.8.0 jar compile commons-collections commons-collections commons-beanutils commons-beanutils commons-digester commons-digester commons-logging commons-logging commons-digester commons-digester 2.1 compile false net.sf.jasperreports jasperreports-fonts 6.8.0
Java code:
package com.mycompany.mavenprojectdemov1; import java.util.HashMap; import net.sf.jasperreports.engine.*; import net.sf.jasperreports.engine.JREmptyDataSource; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.design.JasperDesign; import net.sf.jasperreports.engine.xml.JRXmlLoader; /** * Hello world! * */ public class App { public static void main( String[] args ) { String fileNameJrxml = "E:/Jasper/HelloPDF.jrxml"; String fileNamePdf = "E:/Jasper/HelloPDFv2.pdf"; try { System.out.println("Loading the .JRMXML file ...."); JasperDesign jasperDesign = JRXmlLoader.load(fileNameJrxml); System.out.println("Compiling the .JRMXML file to .JASPER file...."); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); HashMaphm = new HashMap (); System.out.println("filling parameters to .JASPER file...."); JasperPrint jprint = (JasperPrint) JasperFillManager.fillReport(jasperReport, hm, new JREmptyDataSource()); System.out.println("exporting the JASPER file to PDF file...."); JasperExportManager.exportReportToPdfFile(jprint, fileNamePdf); System.out.println("Successfully completed the export"); } catch (Exception e) { System.out.print("Exception:" + e); } } }
Thursday, May 21, 2020
Dev Tips#38 Java Maven project in Netbeans : or one of its dependencies ...
If you are getting this type of error message while creating a maven project in Netbeans follow my video tutorial and add the mirror show below in your netbeans settings.xml.
Error message: Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom. Return code is: 501, ReasonPhrase: HTTPS Required. -> [Help 1]
Solution:
Here are the dependencies to be added in the settings.xml
Error message: Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom. Return code is: 501, ReasonPhrase: HTTPS Required. -> [Help 1]
Solution:
Here are the dependencies to be added in the settings.xml
OR mirror1 central mirror1 https://repo.maven.apache.org/maven2/ google-maven-central Google Maven Central https://maven-central.storage.googleapis.com/maven2/ central
Sunday, May 17, 2020
Dev Tips#37 Create your first Jasper report in Java and VS code maven
In this tutorial, I show you how to create a simple jasper report with a static text in TIBCO Jasper Report Studio. Then run the jrmxl file in a Maven Java Project in visual studio code to get a pdf.
Main Class
package com.abc; import java.util.HashMap; import net.sf.jasperreports.engine.*; import net.sf.jasperreports.engine.JREmptyDataSource; import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperExportManager; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.design.JasperDesign; import net.sf.jasperreports.engine.xml.JRXmlLoader; /** * Hello world! * */ public class App { public static void main( String[] args ) { String fileNameJrxml = "E:/Jasper/HelloPDF.jrxml"; String fileNamePdf = "E:/Jasper/HelloPDF.pdf"; try { System.out.println("Loading the .JRMXML file ...."); JasperDesign jasperDesign = JRXmlLoader.load(fileNameJrxml); System.out.println("Compiling the .JRMXML file to .JASPER file...."); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); HashMaphm = new HashMap (); System.out.println("filling parameters to .JASPER file...."); JasperPrint jprint = (JasperPrint) JasperFillManager.fillReport(jasperReport, hm, new JREmptyDataSource()); System.out.println("exporting the JASPER file to PDF file...."); JasperExportManager.exportReportToPdfFile(jprint, fileNamePdf); System.out.println("Successfully completed the export"); } catch (Exception e) { System.out.print("Exception:" + e); } } }
junit junit 4.11 test net.sf.jasperreports jasperreports 6.8.0 commons-beanutils commons-beanutils 1.9.3 compile false commons-digester commons-digester 2.1 compile false commons-logging commons-logging 1.1.1 compile false org.apache.commons commons-collections4 4.2 compile false com.lowagie itext 2.1.7.js6 compile false org.bouncycastle bcmail-jdk15on org.bouncycastle bcpkix-jdk15on org.apache.poi poi 4.0.1 compile true org.apache.poi poi-ooxml 4.0.1 compile true org.eclipse.jdt.core.compiler ecj 4.4.2 compile false org.codehaus.groovy groovy-all 2.4.5 compile true org.apache.logging.log4j log4j-core 2.8.2 test org.apache.logging.log4j log4j-jcl 2.8.2 test net.sf.jasperreports jasperreports-fonts 6.8.0 test org.apache.lucene lucene-core 7.3.0 compile true org.apache.lucene lucene-analyzers-common 7.3.0 compile true org.apache.lucene lucene-queryparser 7.3.0 compile true org.olap4j olap4j 0.9.7.309-JS-3 compile true org.apache.commons commons-pool2 2.4.2 compile true commons-codec commons-codec 1.5 compile true net.sf.jasperreports jasperreports-metadata 6.8.0 compile true
Saturday, May 16, 2020
Monday, May 11, 2020
Saturday, May 9, 2020
Blender 2.8.0 and other versions crashes on startup in windows 32bit or ...
Version 280 sub 39 date unknown hash unknown
AL lib: (EE) UpdateDeviceParams: Failed to set 48000hz, got 44100hz instead
Error : EXCEPTION_ACCESS_VIOLATION Address : 0x0B8F4376 Module : C:\Windows\system32\ig7icd32.dll
0. Check the desired release here:
https://download.blender.org/release/
1. update intel graphic driver:
https://downloadcenter.intel.com/product/80939/Graphics-Drivers
2. Download the dll:
https://download.blender.org/opengl/software-emulation/windows32/opengl32.dll
https://download.blender.org/opengl/software-emulation/windows64/opengl32.dll
3. put in:
G:\Blender Foundation\Blender
4. open cmd and go to :
G:\Blender Foundation\Blender
run > blender.exe --debug
Follows all these steps in my video below:
Error : EXCEPTION_ACCESS_VIOLATION Address : 0x0B8F4376 Module : C:\Windows\system32\ig7icd32.dll
0. Check the desired release here:
https://download.blender.org/release/
1. update intel graphic driver:
https://downloadcenter.intel.com/product/80939/Graphics-Drivers
2. Download the dll:
https://download.blender.org/opengl/software-emulation/windows32/opengl32.dll
https://download.blender.org/opengl/software-emulation/windows64/opengl32.dll
3. put in:
G:\Blender Foundation\Blender
4. open cmd and go to :
G:\Blender Foundation\Blender
run > blender.exe --debug
Follows all these steps in my video below:
Friday, May 1, 2020
Thursday, April 30, 2020
Subscribe to:
Posts (Atom)