Sunday, September 17, 2017

Trade Credit

As everybody is aware, in any trade transaction, there will be two parties 1- Buyer and 2-Seller In a trade transaction following are type of payment and risk. Type of Payment and Risk: Advance: Seller has no risk while Buyer has to rely on seller (100%). Open A/C: Seller has to rely on buyer while buyer has no risk. D/P Collection:Seller has a risk of non payment of draft while buyer has to depend on seller to supply of goods ordered. Assurance of shipment would be there. D/A Collection: Seller has more risk as non payment of bill of exchange, even though Buyer has the mechandise. While Buyer has minimal risk and may refuse to pay at maturity. Sight L/C:Seller has minimum risk as issuing/conforming bank's obligation to pay if documents conform to lc while buyer has assurance of shipment, but depends on seller to supply goods ordered. Usance L/C:Seller has minimum risk as issuing/conforming bank's obligation to pay if documents conform to lc while buyer has to pay at maturity regardless of product quality. Above are only illustrative purpose only.

Tuesday, October 19, 2010

Mysql workbench

MySQL workbench:

To download mysql work bench .Click here

Recently i got chance to work on database. and my assignment was to create database and ER diagram. And to complete this assignment, i used MySQL workbench.

About MySQL Workbench

MySQL Workbench is a cross-platform, visual database design tool developed by MySQL. It is the highly anticipated successor application of the DBDesigner4 project. MySQL Workbench is available as a native GUI tool on Windows, Linux and OS X in different editions. See the following link for more information about the editions available.

If you are familier with other gui tools like MySQL query browser and mysql administrator, both features are available in workbench. Other is data modeling, there you can create ER diagram.
Three parts of MySQL workbench:

1) SQL development: You can run your database query. very similar to mysql query browser.

2) Data Modeling: You can create ER diagram.

3)Server: very similar to mysql administrator browser. You acan create backup and restore of your database script.

I installed on windows 7 and vista. It was creating problems in XP. Error was .netframework, i tried but did not complete it.

Thanks
Deepak

Saturday, September 25, 2010

Firbug

Firebug:

To download the firbug development tool:
http://getfirebug.com/

Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.

Features:
Inspect HTML and modify style and layout in real-time: After installing or adding plug-in of firebug, see at the bottom of, an icon image (a worm image), click here,
Use the most advanced JavaScript debugger available for any browser
Accurately analyze network usage and performance

Some very helpful shortcuts and commands when working with firebug. Thanks to Duvet-Dayez for creating this cheat sheet.

Firebug cheat sheet

Deepak

Thursday, September 23, 2010

Internationalization in GWT

In my last assignment, i got good assignments on GWT like internationalization, history implementation and maintenance of log.
They are easy, but while you are doing these thing first time specially in GWT,then it is not a simple nut.

So i would like to discuss internationalization here.

First create GWT project. (Here i am creating project name: UsePropertyScreen)

Create 2 interface and 2 properties file with same name like PropertConstant.java and PropertyMessage.java and property files with PropertyConstant.properties and PropertyMessage.properties.

Code for PropertConstant.java
package deepak;
import com.google.gwt.i18n.client.Constants;
public interface PropertConstant extends Constants {

String hello();
//Add more key values here
}

Code for PropertyMessage.java

package deepak;
import com.google.gwt.i18n.client.Messages;
public interface PropertyMessage extends Messages {

String alertMessage();
String alertParameter(String arg);
}

Now Make entries in .property file also. Please provide same key as you gave in java file. i.e function name in java =key value in properties

PropertyConstant.properties
hello=Hello Deepak

PropertyMessage.java
alertMessage=Hello deepak!, welcome
alertParameter= Hello {0}

So if you want to pass more parameter, define function with parameter and in property file use {0} for first parameter and {1} for second parameter etc

Now make samall change in UsePropertyScreen.gwt.xml.file

<inherits name="com.google.gwt.i18n.I18N">

<extend-property name="locale" values="PropertyMessage">

And now use these key value inside client side file. It can't be used server side files.

Screen.java
package deepak;

import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.gwtext.client.widgets.MessageBox;

public class UsePropertyScreen implements {
private final PropertyMessage message=GWT.create(PropertMessage.class);
private final PropertyConstant constant=GWT.create(PropertConstant.class);
public UsePropertyScreen(){
MessageBox.alert(constant.hello());
MessageBOx.alert(message.alertMessage());
MessageBOx.alert(message.alertParameter("Deepak Pandey"));

RootPanel.get().add(new Label(constant.hello()));

}

}

Now run this application.

YOu will get 3 alert,
First with : "Hello Deepak"
Second with : "Hello Deepak!, welcome"
Third with : Hello Deepak Pandey

By default it will take above files. But if you want to change propert file according to your language. Create property file in following manner:
PropertyMessage_hi.properties
and select Hindi language or use hi in url address. So you are able to identify.
and change in UsePropertyScreen.gwt.xml,
<extend-property name="locale" values="hi">

cheers!

Thursday, August 26, 2010

Google Web Toolkit: Jar not loaded

When a Google Web Toolkit (GWT) web application is deployed to Tomcat web server,
you may encounter a warning message as follows.
org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(<$webAppsFolder$>\WEB-INF\lib\gwt-user.jar) - jar not loaded.
See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

This raises just because WebappClassLoader has loaded the servlet.jar already. The gwt-user.jar already contain the content of the servlet.jar file. Even though this message can be ignored, this warning message can be avoided just by replacing the gwt-user.jar file with gwt-servlet.jar (which comes with Google Web Toolkit (GWT) download).

gwt-servlet.jar has been created by removing the content of the servlet.jar from the gwt-user.jar, so this change will not have any impact on your project.

Friday, July 30, 2010

Rs symol

Hello friends,

Indian rupee had got its sign like $ etc. and i hope that currency will receive greater international recognition with the launch of a new symbol for the currency.


Following is the link from where you can download Foradian.ttf font.
http://blog.foradian.com/

After downloading,paste fordian.ttf into control panel-->Font folder.
Now select font Rupee foradian in your document.
And use (~) key just below the Esc key.

Image of symbol:



Feel proud to be an Indian.
"Sare jahan se achha Hindostan hamara"

Saturday, July 24, 2010

JExcel API

In my last assignment, i got requirment to write data into excel file.I got the solution JExcel API.I got solution in the form of JExcel.Today, i will try to demonstrate JExcel API.
JExcelApi allows developers to read Excel spreadsheets and to generate Excel spreadsheets dynamically.It also contains a mechanism which allows java applications to read in a spreadsheet, modify some cells and write out the new spreadsheet.

Download JExcelApi JAR files from

http://jexcelapi.sourceforge.net/

Benifit of this API is:
Any operating system which can run a Java virtual machine (i.e., not just Windows) can both process and deliver Excel

spreadsheets. Because it is Java, the API can be invoked from within a servlet, thus giving access to Excel spreadsheets over

internet and intranet web applications.

Demo Application:

imported packages are following:
import jxl.Workbook;
import jxl.format.Colour;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;


public ByteArrayOutputStream generateExcelReport() throws IOException, WriteException {
/* Stream containing excel data */
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

/* Create Excel WorkBook and Sheet */
WritableWorkbook workBook = Workbook.createWorkbook(outputStream);

or writing data in to generated xls
//Workbook workbook = Workbook.getWorkbook(new File(“Deepak.xls”));
WritableSheet sheet = workBook.createSheet("Project List", 0);

/* Generates Headers Cells */
WritableFont headerFont = new WritableFont(WritableFont.TAHOMA, 12, WritableFont.BOLD);
WritableCellFormat headerCellFormat = new WritableCellFormat(headerFont);
headerCellFormat.setBackground(Colour.PALE_BLUE);
sheet.addCell(new Label(1, 1, "Project Id", headerCellFormat));
sheet.addCell(new Label(2, 1, "Project Name", headerCellFormat));

/* Generates Data Cells */
WritableFont dataFont = new WritableFont(WritableFont.TAHOMA, 12);
WritableCellFormat dataCellFormat = new WritableCellFormat(dataFont);

int currentRow = 2;
for (User user : getUsers()) {
sheet.addCell(new Label(1, currentRow, user.getLastName(),dataCellFormat));
sheet.addCell(new Label(2, currentRow, user.getFirstName(),dataCellFormat));
currentRow++;
}

/* Write & Close Excel WorkBook */
workBook.write();
workBook.close();

return outputStream;
}

public List getUsers() {

try{
Class.forName("com.mysql.jdbc.Driver");
Connection

con=DriverManager.getConnection("jdbc:mysql://localhost/pmsdatabase2?user=root&password=mysql");
PreparedStatement ps=con.prepareStatement("select project_code,project_name from project");
ResultSet rs=ps.executeQuery();
while(rs.next()){
users.add(new User(rs.getString(1),rs.getString(2)));
}

}catch(Exception e){
System.out.println("Coming here!!"+e);
}
return users;
}

COde for User.java:

class User{

private String firstName;
private String lastName;
//getter and setter of firstName and lastName
public User(){}

public User(String lastName,String firstName){
this.firstName=firstName;
this.lastName=lastName;

}

}

Call this method by using any servlet.
A complete document is available on sourceforge or other sites.

Thanks!
Deepak