During learn and experience

آدمهای بزرگ

برای انسانهای بزرگ هیچ بن بستی وجود ندارد ، زیرا آنان بر این باورند که :
یا راهی خواهم یافت و یا راهی خواهم ساخت
۰۲ بهمن ۸۶ ، ۰۷:۴۹ ۴ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

Change jvm heap size

Hi

We can change jvm heap size with following runtime parameter :

java -Xms -Xmx

example :

java -Xms32m -Xmx512m

you can see these links for more parameter(switch) :

http://performance.netbeans.org/howto/jvmswitches/index.html
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp
http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html
۲۳ دی ۸۶ ، ۱۲:۵۹ ۰ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

Using apt to install one or more .deb files

Hi friends

First create a directory where you will place all your .deb files. For this example, I will use /home/debs. Copy all .deb files to this directory. Change into this directory:

cd /home/debs

Create a Packages.gz file with this command:

dpkg-scanpackages . /dev/null | gzip -c -9 > Packages.gz

Edit to your sources.list file and add a line like this:

deb file:///home/debs /

Update your package lists:

apt-get update

Now you can install your package with apt-get.

۱۶ دی ۸۶ ، ۱۳:۴۴ ۰ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

Access to the dom element on the client side in woodstock components

Hi friends

I had some problem with accessing to the dom element in Netbeans 6 visual web . my problem solved with this post from venky .

thanks venky.
۱۱ دی ۸۶ ، ۱۵:۴۷ ۰ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

owning side of the relationship in JPA

Hi friends

There are some peculiarities with bidirectional relationships in JPA. With all bidirectional relationship types, including one-to-one, there is always the concept of an owning side of the relationship. see this sample :

@Entity
public class CreditCard implements java.io.Serializable
{
@OneToOne(mappedBy="creditCard")
private Customer customer;

public Customer getCustomer( )
{
return this.customer;
}

public void setCustomer(Customer customer)
{
this.customer = customer;
}
}


@Entity
public class Customer implements java.io.Serializable
{
@OneToOne
(cascade={CascadeType.ALL})
@JoinColumn(name="CREDIT_CARD_ID")
private CreditCard creditCard;

public CreditCard getCreditCard( )
{
return creditCard;
}

public void setCreditCard(CreditCard card)
{
this.creditCard = card;
}
}

Although a setCustomer( ) method is available in the CreditCard bean class, it will not cause a
change in the persistent relationship if we set it. When we marked the @OneToOne relationship in the CreditCard bean class with the mappedBy( ) attribute, this designated the CreditCard entity as the inverse side of the relationship. This means that the Customer entity is the owning
side of the relationship.
If you wanted to associate a CreditCard instance with a different Customer , you would have to call setCreditCard( ) on the old Customer, passing in null, and then call setCreditCard( ) on the new Customer:

Customer newCust = em.find(Customer.class, newCustId);
CreditCard card = oldCustomer.getCreditCard( );
oldCustomer.setCreditCard(null);
newCust.setCreditCard(card);

bye.
۰۱ دی ۸۶ ، ۱۴:۲۴ ۰ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

User Interface Prototype

Hi friends

User interface prototype is one of the most important artifact i have ever seen because this artifact is useful for almost all member of project team member . this artifact impact to the other artifact.
for example requirements specifiers can use this artifact for better gathering requirement of the project .
For creating user interface prototype we have to use Storyboard artifact and they have to be the same .

۰۷ آذر ۸۶ ، ۱۵:۰۷ ۰ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

Create and run GWT project in Netbeans without using plugin

Hi friends

1. Create a directory named GWTSample (I will refer to it as GWT_Sample_DIR).
2. In the command prompt go to the GWT home and run following instruction :

applicationCreator.cmd -out GWT_Sample_DIR com.saeed.SampleGWT.client.HelloGWT

3. The above step will create the folder structure and generate several files in the GWT_Sample_DIR.
4. In the Netbeans create Java Project with Existing Source.
5. In the step 3 add GWT_Sample_DIR directory in source package folder.


6. Add 3
jar file from GWT home .
gwt-dev-windows.jar
gwt-servlet.jar
gwt-user.jar



7.
You can use Open in System like bellow image to use GWT .cmd file.




Tip :

Don’t run project from Run button in Netbeans for running project you must using xxx-shel.cmd.

Don’t care to package error in HelloGWT.java file .

please insert ur comment.

bye all






۲۵ آبان ۸۶ ، ۱۱:۵۱ ۰ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

What is difference between Discipline & Workflow?

Hi friends

RUP mentions that Discipline is a concept for organizing Software Engineering Process and says a discipline is a collection of related activities that are related to a major 'area of concern' within the overall project and it helps to us for better understanding and easily management the process .
But RUP mentions that Workflow is a tool for expressing Software Engineering Process and a Workflow is a sequence of activities that produces a result of observable value . Workflow is useful for better understanding our task .

please insert ur comment .

bye
۲۰ آبان ۸۶ ، ۲۱:۲۵ ۰ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

Using @Lob in JPA

Hi friends

Sometimes we want to persist a java object or a binary file using JPA that require a lot of memory . for this purpose we can use @Lob annotation . for example we want to store an java object in the database .
in the Entity we must declare a property like below :

@Lob
@Basic(fetch=FetchType.LAZY)
private Serializable ob;

then we set ob property with my java object and then persist Entity .
When using @Lob it is best to mark the fetch type as lazy.

please insert ur comment

bye all
۱۴ آبان ۸۶ ، ۱۴:۴۰ ۰ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

RUP defination ?

Hi friends

It is important that we know about RUP definition and use cases .

RUP definition : The Rational Unified Process, or RUP, is a software engineering process framework developed and marketed by Rational Software .
۳۰ مهر ۸۶ ، ۱۵:۴۹ ۰ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

Using ObjectArrayDataProvider component for show list of objects in table component in VWP

Hi friends

For showing list of object in the table component best choose is ObjectListDataProvider component like this sample
But until now the ObjectListDataProvider component in the palette have not worked and we must write a class that extends ObjectListDataProvider .
But there is a component that can act return ObjectListDataProvider . this is ObjectArrayDataProvider .
We can easily drag and drop this component into design page and then set array property .
For this propose first declare an array in the page :

private Entity.Person[] arrayPerson ;

public Person[] getArrayPerson()
{
return this.arrayPerson;
}

public void setArrayPerson(Person[] arrayPerson)
{
this.arrayPerson = arrayPerson;
}

Then drag and drop ObjectArrayDataProvider component into design page and then set array property with array person.
Now we can right click on the table component in the page and select Bind to data then select ObjectArrayDataProvider1 .

please insert your comment .

bye friends
۳۰ مهر ۸۶ ، ۱۳:۲۵ ۱ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

Retrieve value from ListBox component in Netbeans VWP

Hi friends

In the com.sun.webui.jsf.model.Option constructor we can set an Object for value but for retrieving this object in the next level I encounter some problem.
I write this code for create an Option for a ListBox :

Option option = new Option(new MyEntity(1,"Saeed"),"Saeed") ;

Then I add this Option in the my ListBox .
In the valueChangeListenerExpression method I want to get MyEntity but I cannot retrieve that object I only access to the toString() value of my Object !!!!!!

Conclusion: we can only set primitive object and their wrapper in the values of ListBox component .

Please insert your comment
Bye friends
۲۸ مهر ۸۶ ، ۰۹:۰۹ ۰ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

How to use multiple persistence unit in EJB 3 ?

Hi friends

I wanted to use two EntityManager in my EJB 3 application but i encountered this exception from container : java.lang.IllegalStateException: Local transaction already has 1 non-XA Resource: cannot add more resources.

For solving this problem i find a solution . I inject a UserTransaction object into my stateless session bean then when i want to use two EntityManager i begin UserTransaction and finally commit UserTransaction like below :

@Stateless
@TransactionManagement(TransactionManagementType.BEAN)
public class BusinessBean implements BusinessRemote
{
@Resource()
private UserTransaction utx;

@PersistenceContext()
private EntityManager em1 ;

@PersistenceContext()
private EntityManager em2 ;

public void someMethod()
{
try
{
utx.begin();
//use em1
utx.commit();

utx.begin();
//use em2
utx.commit();
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}


Please insert ur comment.

bye friends

۲۳ مهر ۸۶ ، ۱۲:۰۰ ۰ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

Solve Glassfish v1 as windows service problem !!!

Hi friends

Problem:
When Sun Java application server or Glassfish v1 installed on Windows 2003 server as windows service . it works proper, but when the user logs off, the application server does not have any service.

Solution :
For solve this problem you must start admin console and go to application server section and go to JVM setting and add new option -Xrs.

bye friends
۲۱ مهر ۸۶ ، ۲۱:۲۱ ۰ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

Attach an Entity With Merg() Method (for method parameters)

Hi friends

I found that In the Java Persistence API EntityManager.merge() method cannot attach method parameter.

This sample code is wrong because merge method cannot attach method parameter, then remove method cannot execute.

public void delete(MyEntity myEntity)
{
em.merge(myEntity);
em.remove(myEntity);
}

This code is correct.

public void delete(MyEntity myEntity)
{
Object entity = em.merge(myEntity);
em.remove(entity);
}
۱۷ مهر ۸۶ ، ۰۸:۳۳ ۰ نظر موافقین ۰ مخالفین ۰
سعید زرین فام

Use expression language in Netbeans VWP

hi friens

Expression language is a powerful tool for writing JSF pages .
in this post i describe how to using this functionality in Netbeans VWP for creating flexible table .

1. Drag a table from component palette into page
















2. From travel Java DB database drag Person table into your table














3. Right click on the table component and select table layout then add a table column like following image




















4. Add following property to button1 in the JSP section like image

visible="#{(currentRow.value['PERSON.FREQUENTFLYER']==1)}"





5 . See output . all row dont have action button .




bye friends
۰۹ مهر ۸۶ ، ۱۱:۳۲ ۱ نظر موافقین ۰ مخالفین ۰
سعید زرین فام