Requirement Constraints

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Friday, 18 May 2012

Tuning Eclipse Performance and Avoiding OutOfMemoryExceptions

Posted on 01:02 by Unknown


If you are using 4 GB Ram, the following will help you to increase the speed of the eclipse

Goto the Folder where eclipse.exe is located.

Open the eclipse.ini


-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
C:/Program Files/Java/jdk1.6.0_21/bin/javaw
-vmargs
-Xmn128m
-Xms1024m
-Xmx1024m
-Xss2m
-XX:PermSize=128m
-XX:MaxPermSize=128m
-XX:+UseParallelGC


For other than 4 GB, read the following article



http://madhucm.wordpress.com/2007/12/19/tuning-eclipse-performance-and-avoiding-outofmemoryexceptions/


Read More
Posted in Eclipse Tips | No comments

Listitem Mold Paging - Add components in the pagination bar

Posted on 00:57 by Unknown

<zk>
<zscript>
Object[] o = new Object[50];
</zscript>
<toolbar>
<hlayout sclass="z-valign-middle">
<toolbarbutton label="other button 1"></toolbarbutton>
<paging id="pagenavi" pageSize="10"></paging>
<toolbarbutton label="other button 2"></toolbarbutton>
</hlayout>
</toolbar>
<listbox id="listbox" mold="paging" paginal="${pagenavi}">
<listhead>
<listheader label="name"></listheader>
</listhead>
<listitem forEach="${o}">
<listcell label="item ${forEachStatus.index}" />
</listitem>
</listbox>
</zk>

For more information, please refer the following thread
http://www.zkoss.org/forum/listComment/19535-Listbox-mold-paging

Read More
Posted in ZK Listitem Pagination | No comments

Thursday, 17 May 2012

ZK Calling Another ZUL File

Posted on 22:28 by Unknown
Method 1


<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="new page title" border="normal">
New Content Here!
<button label="click me" href="../main/Practice.zul"/>
</window>
</zk>


Method 2


<zk>
  <window id="mainwin" border="normal" title="hello" xmlns:c="client">
 
  <button label="Practice">
          <attribute name="onClick">
            Executions.createComponents("../main/Practice.zul",mainwin,null);
          </attribute>
    </button>
  </window>
</z
Read More
Posted in ZK Calling Another ZUL | No comments

ZK Installation Guide

Posted on 21:46 by Unknown

Part 1.
Explains how to setup java, maven, Tomcat and Eclipse IDE. You can download the document here.

Part 2
Explains how to setup ZK Studio and ZK CE Version. You can download the document here.

Part 3
Explains how to download and setup ZK Sample 2 application locally. You can download the document here.


 
Read More
Posted in ZK Installation | No comments

Wednesday, 16 May 2012

List Box CSS

Posted on 23:46 by Unknown

<?page title="Practice List" contentType="text/html;charset=UTF-8"?>
<zk>
<style>
div.z-listbox
{ background: none repeat scroll 0 0 #FFFFFF;
border: 1px solid #CFCFCF; overflow: hidden;
}

tr.z-listitem-seld
{
background-image: none;
}


/* Selected rows with the mouse hovering over them */
tr.overseld,td.overseld,tr.z-listitem-over,tr.z-listitem-over-seld
{
background-image: none;
background-color: transparent;
}

/* Odd rows in a listbox */ tr.odd
td.gc,tr.odd,tr.z-listbox-odd,tr.z-grid-odd
td.z-row-inner,tr.z-grid-odd
{
background: #E3F0F8 none repeat
scroll 0 0;
}

/* Odd rows in a listbox mouse over when we move */ tr.odd
tr.z-listitem.z-listbox-odd.z-listitem-over
{
background-image: none;
background-color: #E3F0F8;
}

/* List item Header Color */
.z-listbox div.z-listbox-header tr.z-list-head, .z-listbox
div.z-listbox-header tr.z-auxhead , .z-listbox
div.z-listbox-header tr.z-listhead, .z-listbox
div.z-listbox-header tr.z-auxhead
{
background-image : none;
background-color : #99CC99;
color:white;
}

div.z-listfooter-cnt, div.z-listheader-cnt
{
border: 0 none;
color: black;
font-family: verdana,arial,sans-serif;
font-size:
12px; margin: 0;
}

.z-listheader-cnt :hover
{
border: 0 none; color: white;
font-family: verdana,arial,sans-serif;
font-size: 12px;
margin: 0;
}

div.z-listbox-header th.z-listheader-sort-over
{
background-image: none;
}

div.z-listfooter-cnt, div.z-listcell-cnt, div.z-listheader-cnt
{
font-size : 12px;
font-family: verdana,arial,sans-serif;
}

.z-paging-os
{
padding-left: 40%;
}

.z-paging
{
padding-left: 40%;
background: none repeat scroll 0 0 transparent;
}

.z-listheader-sort-img
{
float: left;
font-size: 0;
left: 90%;
margin-left: auto;
margin-right: auto;
position: absolute;
}

div.z-paging-os-cnt-l, div.z-paging-os-cnt-r,
div.z-paging-os-cnt-m, div.z-paging-os-cnt-seld-l,
div.z-paging-os-cnt-seld-r, div.z-paging-os-cnt-seld-m,
div.z-paging-os-cnt-l-over
{
background-image : none;
}


.listitemlink.z-a
{
color: blue !important;
}

div.z-listbox-body .z-listcell, div.z-listbox-footer
.z-listfooter
{
cursor: default;
}

</style>
<window title="Practice List" height="500px" border="normal">
<listbox id="box" mold="paging" pageSize="5"
pagingPosition="top">
<listhead sizable="true">
<listheader label="Practice Name" sort="auto" />
<listheader label="City" sort="auto" />
<listheader label="State" sort="auto" />
<listheader label="Zip Code" sort="auto" />
</listhead>
<listitem>
<listcell>
<a href="http://www.zkoss.org"
label="Adult Medical Day Care" sclass="listitemlink" />
</listcell>
<listcell label="Cumberland" />
<listcell label="Maryland" />
<listcell label="21502" />
</listitem>
<listitem>
<listcell>
<a href="http://www.zkoss.org"
label="Baptist Medical Center" sclass="listitemlink" />
</listcell>
<listcell label="Kansas" />
<listcell label="Missouri" />
<listcell label="64131" />
</listitem>
<listitem>
<listcell>
<a href="http://www.zkoss.org"
label="California Medical Facility" sclass="listitemlink" />
</listcell>
<listcell label="Vacaville" />
<listcell label="California" />
<listcell label="95696" />
</listitem>
<listitem>
<listcell>
<a href="http://www.zkoss.org"
label="Garden Park Medical Cente" sclass="listitemlink" />
</listcell>
<listcell label="Gulfport" />
<listcell label="Mississipp" />
<listcell label="395033085" />
</listitem>
<listitem>
<listcell>
<a href="http://www.zkoss.org"
label="Albion Health Center" sclass="listitemlink" />
</listcell>
<listcell label="Albion" />
<listcell label="New york" />
<listcell label="14420" />
</listitem>
<listitem>
<listcell>
<a href="http://www.zkoss.org"
label="Beacon Community Health Center" sclass="listitemlink" />
</listcell>
<listcell label="Beacon" />
<listcell label="New york" />
<listcell label="12508" />
</listitem>
<listitem>
<listcell>
<a href="http://www.zkoss.org"
label="Bolton Health Center" sclass="listitemlink" />
</listcell>
<listcell label="Bolton Landing" />
<listcell label="New york" />
<listcell label="12814" />
</listitem>
<listitem>
<listcell>
<a href="http://www.zkoss.org"
label="Inwood Medical Practice" sclass="listitemlink" />
</listcell>
<listcell label="Bronx" />
<listcell label="New york" />
<listcell label="10452" />
</listitem>
<listitem>
<listcell>
<a href="http://www.zkoss.org"
label="Urban Horizons Family Practice" sclass="listitemlink" />
</listcell>
<listcell label="Bronx" />
<listcell label="New york" />
<listcell label="10452" />
</listitem>
<listitem>
<listcell>
<a href="http://www.zkoss.org"
label="Bedford Medical" sclass="listitemlink" />
</listcell>
<listcell label="Brooklyn" />
<listcell label="New york" />
<listcell label="11229" />
</listitem>
</listbox>
</window>
</zk>
Read More
Posted in ZK CSS | No comments

Thursday, 3 May 2012

Eclipse Tips and Tricks

Posted on 12:37 by Unknown
1. External Browser

Whenever you run the application, you can see the output using internal browser. By normally i will not prefer that method. So you can change the settings, to open the output using any external browser

Here is the steps

1. Click Window -> Preferences-> General-> Web Browser
    Change to External web Browser. Choose from the list. Here my choice is fire fox


Read More
Posted in Eclipse Tips | No comments

Hibernate Introduction Part 3

Posted on 06:42 by Unknown

Data query.


Well, Now we will see how to query all the records inserted into the database that we have done
in part 1 and part 2.

For all the future examples (including this), i am going use only JPA Annotations

let's start.

Step 1: Development environment

1. My sql server 5.0  Download
2. Hibernate 4.1.1 Download
3. JDBC Driver for Mysql ((mysql-connector-java-5.1.19.zip)) Download
4. Eclipse IDE

Unzip the hibernate buddle and you should have the following structure after you unzip
Documentation folder
lib Folder
Project folder
log text file
hibernate logo image
license text file


Step 2:

Open mysql and create the following table in any of the exisitng database or create new database.
Here is the script for our table


CREATE TABLE `patient`
 (
    `ID` INT(11) NOT NULL AUTO_INCREMENT,
    `FirstName` VARCHAR(100) DEFAULT NULL,
    `LastName` VARCHAR(100) DEFAULT NULL,
    `Email` VARCHAR(200) DEFAULT NULL,
     PRIMARY KEY  (`ID`)
 )  ENGINE=INNODB DEFAULT


Step 3: Eclipse Java project

1. Click File -> New -> Other -> Java Project

2. Say Example3 for Project Name and leave all other to default values.
   (Make sure, JRE has been configured).

3. Next we will add all dependencies in the example3. Now click Example3 project in the project
   explorer and right click -> Click New-> Folder. Say folder name as lib

   Now copy the following files into lib folder
   (Note : Eclipse project explorer accepts all copy and paste operation. For example, you can copy    

   file or folder in windows explorer and then you can come back to eclipse project explorer and paste

  it)

   All the files in Hibernate->Lib->required.
   All the files in Hibernate->Lib->jpa.
   All the files in Hibernate->Lib->envers
   mysql-connector-java-5.1.18-bin.jar


4. Now  setup the build path. In order to execute our example, all the above jar files should be in
   class build path

   Again, click on the Example1, right click, and select build Path->configure build path.
   Go to Libraries-> External jars,  browse lib folder you created earlier. Then add external jars by
   selecting all jar files that you copied to lib folder in one of previous step


Step 4: Creating Java beans

Now let us create the java bean for the patient where we want to store in the database.

Again, right click on Example1, Select New -> Class; Package Name : mypack and Class name

:patient Leave the all other to default values

Now type or copy the following


package mypack;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;

@Entity
@Table(name="patient")
public class patient {

private Integer id;
private String firstName;
private String lastName;

@Id
@GeneratedValue
@Column(name="ID")
public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

@Column(name="firstname")
public String getFirstName() {
return firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

@Column(name="lastname")
public String getLastName() {
return lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}

}



Step 6 : Hibernate Configuration

Now we have the persistent class and its mapping information using Annotations in place.
Let’s configure Hibernate.



Right Click src->New->File. File Name as hibernate.hbm.xml
Paste following code there. Save it as hibernate.cfg.xml. Here you have to give the

username,password and database name according to your MySQL account.


<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
 <!-- Database connection settings -->
 <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
 <property name="connection.url">jdbc:mysql://localhost/sampledb</property>
 <property name="connection.username">root</property>
 <property name="connection.password">123</property>

 <!-- JDBC connection pool (use the built-in) -->
 <property name="connection.pool_size">1</property>

 <!-- SQL dialect -->
 <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

  <!-- Enable Hibernate's automatic session context management -->
  <property name="current_session_context_class">thread</property>

  <!-- Disable the second-level cache -->
  <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

  <!-- Echo all executed SQL to stdout -->
  <property name="show_sql">true</property>

  <!-- Drop and re-create the database schema on startup -->
  <property name="hbm2ddl.auto">update</property>

  <!-- Mapping files -->
  <mapping resource="patient.hbm.xml" />

  </session-factory>
</hibernate-configuration>


Step 7: Create Test class to store the objects

To create new class right click on "mypack" package and select New --> Class and give Name as

Test.java and paste the following code in class file.



package mypack;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.HibernateException;

public class Test {

private static SessionFactory factory;
private static ServiceRegistry serviceRegistry;

public static void main(String[] args) {
createRecords();

}

public static void createRecords() {

try {
Configuration configuration = new Configuration();
configuration.configure();
serviceRegistry = new ServiceRegistryBuilder().applySettings(
configuration.getProperties()).buildServiceRegistry();
factory = configuration.buildSessionFactory(serviceRegistry);
} catch (Throwable ex) {
System.err.println("Failed to create sessionFactory object." + ex);
throw new ExceptionInInitializerError(ex);
}
System.out.println("**Example : Hibernate 4 SessionFactory**");
System.out.println("----------------------------------------");

Session session = factory.openSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
patient pt = new patient();
pt.setFirstName("John124");
pt.setLastName("Smith234");
session.saveOrUpdate(pt);
tx.commit();
} catch (HibernateException e) {
if (tx != null)
tx.rollback();
e.printStackTrace();
} finally {
session.close();
}
}

}


Now right click on test.java file and select Run as -> Java Application
If every thing configured correctly, then you will the see the following lines in the console at the
end

INFO: HHH000126: Indexes: [primary]
Apr 29, 2012 10:14:49 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000232: Schema update complete
**Example : Hibernate 4 SessionFactory**
----------------------------------------
Hibernate: insert into PATIENT (FIRSTNAME, LASTNAME) values (?, ?)

Now go to database and check records are inserted into patient table.

Run again and again to insert more records by changing the last name and first name.
So that in the next step, we can see how we can retrieve the records.


Step 7: Get records and display in the console.

Small Intro on Hibernate Query Language

Hibernate uses a powerful query language (HQL) that is similar in appearance to SQL. Compared with SQL,

however, HQL is fully object-oriented and understands notions like inheritance, polymorphism and

association. Since it is an object-oriented equivalent of SQL, all of the functions of retrieval are

provided out-of-the-box in HQL. These functions can be classified into four categories:

1. Projection

2. Restriction

3. Aggregation

4. Grouping


Examples for Projection
"from patient"

The above will returns all of the instances of the patient.
This is equivalent to the following SQL : SELECT * FROM patient

Examples for Restriction
SELECT * FROM patient WHERE lastname='John';

Coming back to our example, let us get all the patients from the database and print the last name
in the console.

Modified Test.Java as follows

package mypack;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
import org.hibernate.HibernateException;

public class Test {

private static SessionFactory factory;
private static ServiceRegistry serviceRegistry;

public static void main(String[] args) {
createRecords();
getAllRecords();

}

public static void createRecords() {

try {
Configuration configuration = new Configuration();
configuration.configure();
serviceRegistry = new ServiceRegistryBuilder().applySettings(
configuration.getProperties()).buildServiceRegistry();
factory = configuration.buildSessionFactory(serviceRegistry);
} catch (Throwable ex) {
System.err.println("Failed to create sessionFactory object." + ex);
throw new ExceptionInInitializerError(ex);
}
System.out.println("**Example : Hibernate 4 SessionFactory**");
System.out.println("----------------------------------------");

Session session = factory.openSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
patient pt = new patient();
pt.setFirstName("John12");
pt.setLastName("Smith23");
session.saveOrUpdate(pt);
tx.commit();
} catch (HibernateException e) {
if (tx != null)
tx.rollback();
e.printStackTrace();
} finally {
session.close();
}
}

public static void getAllRecords() {

try {
Configuration configuration = new Configuration();
configuration.configure();
serviceRegistry = new ServiceRegistryBuilder().applySettings(
configuration.getProperties()).buildServiceRegistry();
factory = configuration.buildSessionFactory(serviceRegistry);
} catch (Throwable ex) {
System.err.println("Failed to create sessionFactory object." + ex);
throw new ExceptionInInitializerError(ex);
}
System.out.println("**Example : Hibernate  SessionFactory**");
System.out.println("----------------------------------------");

List allpatients;

Session session = factory.openSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
Query q1 = session.createQuery("from patient");
allpatients = q1.list();
for (int i =0; i < allpatients.size(); i++)
{
patient pt = (patient) allpatients.get(i);
System.out.println(pt.getLastName());
}
tx.commit();
} catch (HibernateException e) {
if (tx != null)
tx.rollback();
e.printStackTrace();
} finally {
session.close();
}
}

}


Now right click on test.java file and select Run as -> Java Application. Last name will be
printed in the console.


Read More
Posted in Hibernate Introduction | No comments
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • Understanding EDI Structure
    EDI Structure Primary Levels are 1. Interchange Envelops 2. Functional Group 3. Transaction set Data Element A data element is equival...
  • EDI 270–5010 Documentation - ISA – Interchange Control Header
    ISA – Interchange Control Header ISA – Interchange Control Header   The ISA is a fixed record length segment and all positions within ea...
  • Types of Reimbursement
    Fee-For-Service Fee-for-service is a method of payment where the provider is paid a fee for each procedure performed and billed.Most payer ...
  • ZK Example for inline Editing with Add New and Delete
    I am quite impressed on this demo from ZK . But adding new record and delete existing record is missing as part of typical CRUD. So i thoug...
  • ZK ListBox
    Let us first design a simple  static list box with crud Buttons as last column. Here is the code <?page title="Practice List" c...
  • EDI Instructions
    HIPAA Compliant Codes All the Health care EDI Transaction set should use only the following HIPAA Compliant Codes Physicians Current Pro...
  • Java Static Import
    This is one of feature in Java 5. In order to access static members, it is necessary to qualify references with the class they came from. ...
  • List Item Connected with Hibernate and Search Parameter
      Summary This example contains one list box with First name and Last Name as search Field. If the user do not give any values for first n...
  • Hibernate Validator Example 2
    In this example, we will see some more validation constraints such as @email, @past, @length, etc. And also we will also define custom error...
  • ZK Quick InputBox
    Just to get String input before do some process. For example, we will normally ask the reason to delete any record. <?xml version=...

Categories

  • Billing Process
  • C Workbook
  • C++ Workbook
  • Eclipse Tips
  • EDI 5010
  • EMR Appointment Features
  • EMR Labs Stuff
  • EMR PMS Links
  • EMR Use cases
  • EMR Vital Sign
  • Good Website Design
  • Hibernate Criteria Queries
  • Hibernate Introduction
  • Hibernate Introduction Setup
  • Hibernate Mapping
  • Hibernate POC
  • Hibernate Validator
  • Hibernate–Java Environment setup
  • HPI
  • Java
  • Maven
  • MU Certification
  • NPI
  • PQRS
  • Practice Management System
  • Spring Security
  • Tech Links
  • Today Tech Stuff
  • zk
  • ZK Hibernate
  • ZK 5 Databinding
  • ZK Application
  • ZK Calling Another ZUL
  • ZK CheckBox
  • ZK CreateComponents
  • ZK CSS
  • ZK extended Components
  • ZK Foreach
  • ZK Forum Posts
  • ZK Framework
  • ZK Hibernate Setup
  • ZK ID Space
  • ZK Include
  • ZK Installation
  • ZK iReport
  • ZK Layout
  • ZK Listitem Pagination
  • ZK Message Box
  • ZK MVC
  • ZK MVC Combox Box
  • ZK MVC CRUD Examples
  • ZK MVC Listbox
  • ZK MVVM
  • ZK MVVM Combo
  • ZK MVVM CRUD
  • ZK MVVM ListBox
  • ZK Spring
  • ZK TextBox

Blog Archive

  • ▼  2013 (105)
    • ▼  December (3)
      • EDI Instructions
      • Understanding EDI Structure
      • What is an EDI ?
    • ►  September (7)
    • ►  August (13)
    • ►  July (1)
    • ►  June (11)
    • ►  May (3)
    • ►  April (14)
    • ►  March (19)
    • ►  February (21)
    • ►  January (13)
  • ►  2012 (177)
    • ►  December (1)
    • ►  November (13)
    • ►  October (19)
    • ►  September (24)
    • ►  August (26)
    • ►  July (6)
    • ►  June (37)
    • ►  May (30)
    • ►  April (16)
    • ►  March (1)
    • ►  January (4)
  • ►  2011 (5)
    • ►  December (1)
    • ►  November (1)
    • ►  July (1)
    • ►  June (1)
    • ►  April (1)
  • ►  2010 (1)
    • ►  September (1)
Powered by Blogger.

About Me

Unknown
View my complete profile