RSS

Life is easier with QR Codes

You are welcome once again to today’s information session. I will start by asking if you have a smart phone?
If your answer to my question is yes it is most likely that you have never used it to scan a QR Code.

What is a QR Code(QRC)?

QRC stands for Quick Response Code and in simple terms It is a way of encoding information such as website links or web systems
so that other devices such as smartphones can gain easy access to the system. You still do not understand? Okay, i will give an example.
Let us assume you run a business that has a  website and you want your clients to be able to visit you website through their smartphones; there are two ways i can think of right now of achieving such:

1. Giving them the link to your website(by mouth, on paper and through SMS/email) and then they copy and paste that on
the browser application on their smartphones (mozilla firefox, internet explorer and several others) to be able to view your website.

2. Giving them a thank you note that has printed on it a QR Code.

Despite the fact that many may be used to the first method, I definitely see the second as a faster, easier and a more professional option. First is because it will enable you direct the client at every point in time to what you exactly want them to see on your website. In this case if you want them to respond to a question, they do not need to click a question button by the side when they get to the site, the code takes them straight to the question or the item you want them to see at that particular point in time.

How do i read a QR Code?

You can read a QRC using the following simple steps:

1. Download and install a QR code reader from the respective app store.
For android smartphones you should be familiar with an image like the one shown below.

2. When the QRC reader is launched, place your phone camera against any QR Code be it on your computer or on paper and your phone will automatically read and interpret the code.

Do you want to grow your business by using this technology? Would you like to have it as a free version or you do not mind paying? Get your your comment and feedback across.

 
Leave a comment

Posted by on August 4, 2014 in Android

 

Tags: , , , , , ,

unsupported major.minor version

Yet another time to look into the resolution of another uncommon type of error encountered in the java world, the ‘unsupported major.minor version’ error. This error majorly occurs during run-time when the java version that was used to compile a java code into a class is different from the java version being used at run-time.

The solution as has been described in this post is to check for the version of the java being used at run-time and make use of the same java version when recompiling your java code (i used the netbeans IDE). Lets take an example of the error message in this way:

unsupported major.minor version 51.0

This message is simply saying the the java version needed is 1.5 and this is contrary to the version found in your application.

How do we resolve the error using the netbeans IDE.

1. Make sure the project is selected in netbeans and then press the ‘F11′ key, it should give you a box as shown below.

netbeans f11

2. Click on Project Properties in the above box, it should give you the box below

netbeans jdk change

3. Change the Source/Binary format (right at the lower part) to the one required and click the ‘ok’ button to save your changes, here I have changed it to version 1.5 as specified in the error. The warning message below should be ignored:

warning: [options] bootstrap class path not set in conjunction with -source 1.6

1 warning

4.You can then recompile and go run your application again.

 
Leave a comment

Posted by on August 18, 2013 in Java

 

Tags: , , , , , , , , , , ,

024 Vintage in Microfinance… How Others Look at It…

024 Vintage in Microfinance… How Others Look at It….

 
Leave a comment

Posted by on July 31, 2013 in Uncategorized

 

Jasper Reports with T24 Jbase

Hello all,

Today we shall be looking at how to generate a simple pdf report from T24 on Jbase with Jasper.  This report retrieves the Mnemonic, Sector and Industry from the Customer table.

Although it is required to have a knowledge of Java to be able to follow this tutorial, contributions and questions would be highly appreciated.

You as a reader might decide to achieve this your own way and this would mean that you do not have to follow this tutorial if you have a better way :)

Lets get started.

Step 1: Create a java class that connects to jbase and performs all the other magic acts

This can be achieved by using any favourite IDE of yours and this tutorial will not be based on any particular IDE. The code snippet of the main class is pasted below.

==============================

package newjsp;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JRException;
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.JasperReport;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;

public class Main {

Connection conn;

public void generateReport() {

try {
Class.forName(“com.jbase.jdbc.driver.JBaseJDBCDriver”);
//This is where you specify the credentials of the database you are connecting to.
conn = DriverManager.getConnection(“jdbc:jbase:thin:@localhost:9494:R09″,”R09″,”123456″);
System.out.println(“Connected…”);
System.out.println(“Loading Report Designs”);
InputStream input = new FileInputStream(new File(“resources/report3.jrxml”));
JasperDesign jasperDesign = JRXmlLoader.load(input);

System.out.println(“Compiling Report Designs”);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);

System.out.println(“Creating JasperPrint Object”);
Map<String, String> parameters = new HashMap<String, String>();
parameters.put(“ReportTitle”, “PDF JasperReport”);

System.out.println(“Filling Report to File”);

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, conn);
//System.out.println(“Sector is “+ conn );
//Exporting the report
OutputStream output = new FileOutputStream(new File(“resources/customer.pdf”));
JasperExportManager.exportReportToPdfStream(jasperPrint, output);

System.out.println(“Report Generation Complete”);
conn.close();
} catch (FileNotFoundException e) {
} catch (JRException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
}
}

public static void main(String[] args) {
new Main().generateReport();
}
}
=====================================
Before moving on there are some things that you need to do so as to be able to run the code in step 1 above successfully

1. If you are making use of some extra classes, make sure they have been placed in the right packages in the project and they are error free.
2. You may need to add some jars to your project and one of them is the jdbc jar which should come with your jbase package.

3.Make sure the agent in the database environment specified is running and this can be done using the command “jbase_agent p- <port number> “

4.You can place your questions if you are still having any other problem apart from the ones mentioned above.

Step 2: Create an xml file to be used for the formatting and retrieval of the needed information

This xml file may be created manually or created using tools like Ireport and some others. The fact is just that you should know what you want.

After creating the xml file, save it as a “.jrxml” file and you do not need to compile it to a “.jasper” file

Then specify the link to where you have placed the xml file in your java code. as in step 1.

The xml file used for this tutorial is pasted below.

==================

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE jasperReport PUBLIC “//JasperReports//DTD Report Design//EN”
http://jasperreports.sourceforge.net/dtds/jasperreport.dtd”&gt;
<jasperReport name=”CustomerReport_TeejayT24″>
<queryString>
<![CDATA[SELECT * FROM FBNK.CUSTOMER ]]>
</queryString>
<field name=”MNEMONIC” />
<field name=”SECTOR” />
<field name=”INDUSTRY” />
<title>
<band height=”50″>
<staticText>
<reportElement x=”0″ y=”0″ width=”180″ height=”15″/>
<textElement/>
<text><![CDATA[Jasper Report - Teejay]]></text>
</staticText>
<staticText>
<reportElement x=”0″ y=”30″ width=”180″ height=”15″/>
<textElement/>
<text><![CDATA[Mnemonic]]></text>
</staticText>
<staticText>
<reportElement x=”140″ y=”30″ width=”180″ height=”15″/>
<textElement/>
<text><![CDATA[SECTOR]]></text>
</staticText>
<staticText>
<reportElement x=”200″ y=”30″ width=”180″ height=”15″/>
<textElement/>
<text><![CDATA[INDUSTRY]]></text>
</staticText>
</band>
</title>
<detail>
<band height=”30″>
<textField>
<reportElement x=”0″ y=”0″ width=”69″ height=”24″ />
<textFieldExpression>
<![CDATA[$F{MNEMONIC}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x=”140″ y=”0″ width=”69″ height=”24″ />
<textFieldExpression>
<![CDATA[$F{SECTOR}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement x=”200″ y=”0″ width=”69″ height=”24″ />
<textFieldExpression>
<![CDATA[$F{INDUSTRY}]]>
</textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>

================================

Step 3: Make sure all your codes have been compiled and then run it.

A pdf report will be produced in the location you have specified in your program with the retrieved report. A sample of the generated report is as shown below.

Sample pdf report generated

That is all about this tutorial.

Please note that you can also generate any other type of report as supported by JasperReports, this tutorial is based mainly on pdf report generation.

Thanks for following the tutorial and i would also like to acknowledge the works of Suhas on jasper reports

Thanks and Regards.

 
Leave a comment

Posted by on October 20, 2012 in Java

 

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Life Lessons and morals: 5 stories from the Yoruba language and culture

Life Lessons and morals: 5 stories from the Yoruba language and culture.

 
Leave a comment

Posted by on September 21, 2012 in Life Lessons

 

Tags: , , , , , , , , , , , , , , , , ,

Seven Lessons from the Land of Oz

Seven Lessons from the Land of Oz.

 
Leave a comment

Posted by on September 2, 2012 in Office motivation

 

Tags: , , , , , ,

 
Follow

Get every new post delivered to your Inbox.