Wednesday, June 9, 2010

Debug merupakan proses yang sering dilakukan pada saat membangun semua aplikasi guna menemukan dan atau memperbaiki bugs pada aplikasi tersebut. Salah satu cara untuk men-debug adalah menggunakan Debugging tools yang terdapat di eclipse.

Cara debugging pada aplikasi potlet (JSR168/JSR 286) sedikit berbeda dengan aplikasi servlet biasa, berikut langkah-langkahnya:

  1. Buat environment variable berikut :

    CATALINA_HOME: [user_path]\liferay-portal-5.2.3\tomcat-6.0.18
    JPDA_ADDRESS: 8000
    JPDA_TRANSPORT: dt_socket

  2. Buat Konfigurasi Debug pada eclipse:
    -Klik menu : Run-Debug Configurations
    -Buat konfigurasi baru pada "Remote Java Application"
    Masukkan parameter-parameter yang di butuhkan
  3. Jalankan Liferay portal dengan mode "JPDA", pada command prompt jalankan perintah berikut :
    [Liferay Path]\tomcat-6.0.18\bin\catalina.bat jpda run

    Pastikan muncul informasi bahwa tomcat listen ke port 8000
    [Liferay Path]\tomcat-6.0.18\bin>catalina.bat jpda run
    Listening for transport dt_socket at address: 8000

  4. Tentukan breakpoints pada class yang akan di debug.
  5. Run Debug

thanks to: erfin buat advice nya :)

Debug Liferay Portal dengan Eclipse

Read More

Monday, August 3, 2009

“Iconfinder provides high quality icons for webdesigners and developers in an easy and efficient way”

this is icon's search engine, that very useful for desaigner.
Website :

Icon Finder

Read More

Wednesday, July 15, 2009

In this article, I will write about Simple Shoutbox Application with JQuery. With Ajax (Asynchronous JavaScript and XML) , we can send a form submission and get response back without refreshing current page. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.

Javascript Code :

 $(function() {
$(".submit").click(function() {
var name = $("#name").val();
var comment = $("#comment").val();
var dataString = 'name='+ name + '&comment=' + comment;

if(name=='' || comment=='')
 alert('Please Give Valide Details');
} else {
 $("#flash").fadeIn(400).html('<img src="img/ajax-loader.gif" align="absmiddle"> <span class="loading">Loading Comment...</span>');
   type: "POST",
   url: "ajaxshoutbox.jsp",
   data: dataString,
   cache: false,
   success: function(html){
   $("ol#update li:last").fadeIn("slow");
 return false;

Explanation :

$.ajax({}) is JQuery event to call ajax request, it’s has an object of key/value pairs , that are used to initialize and handle the request.
  1. type : The type of request to make ("POST" or "GET"), default is "GET"
  2. url: The url to request
  3. data: Data to be sent to the server
  4. chace : if set to false it will force the pages that you request to not be cached by the browser
  5. success : A function to be called if the request succeeds
<form action="#" method="post">
<label><input type="text" name="name" id="name"/>
<span class="titles">Name</span><span class="star">*</span>
</label><br />
 <textarea name="comment" id="comment"></textarea>
 <span class="titles">Comment</span>
</label><br />
<input type="submit" class="submit" value=" Submit Comment " />    </form>
><li class="box">
<span style="  font-weight:bold">Name :</span>
<span style="font-size:16px; color:#663399;"><%= request.getParameter("name") %></span> <br />
<span style="  font-weight:bold">Comment :</span> <%= request.getParameter("comment") %>

Download Sourcecode :

Simple Shoutbox Ajax with JQuery & JSP

Read More

Tuesday, June 23, 2009

In my previous project, I will be required to call Stored Procedure in SQL Server with Spring & Hibernate. Using HibernateTemplate class extends from HibernateDaoSupport, you can call the stored procedure in SQL Server.

The Stored Procedure:
USE [sample];
(@Param1 nvarchar(50), @Param2 nvarchar(50))
declare @Concatenation nvarchar(150)

set @Concatenation = @Param1 + ' and ' + @Param2

select @Param1,@Param2,@Concatenation
SampleDao Source:
public class SampleDao extends HibernateDaoSupport {

public String callSP(String param1, String Param2) {
  // create session from active session
Session ses = getSession(true);

// create query for call the stored procedure
SQLQuery q = ses.createSQLQuery("exec SP_Sample :param1, :param2");
q.setString("param1", param1);
q.setString("param2", param2);
  //execute stored procedure and get list result
List l = q.list();
StringBuilder result = new StringBuilder();

if (l.size()>0){    
 for(Iterator it=l.iterator();it.hasNext();){
  Object[] row = (Object[]);
  result.append("Param 1 : " + row[0] + ", Param 2 : " + row[1] + ", Concatenation : " + row[2]);

return result.toString();

Accessing SQL Server Stored Procedure With Hibernate

Read More