Selasa, 09 Februari 2010

Fungsi NVL Oracle

Fungsi NVL digunakan untuk menggantikan null value dengan nilai lain nya.

Sintak:
NVL( value_in, replace_with )

NVL bekerja seperti kode PL/SQL berikut :

if (value_in is NULL) then
return replace_with;
else
return value_in;
end if;

Sample code:

select nvl(salary, 0)
from employees;

select nvl(ref_code,'Unknown')
from users;

encode sintak di PL/SQL Oracle

SELECT DECODE (value,if this value,return this value,
if this value,return this value,
....
otherwise this value)
FROM dual;

contoh:
SELECT program_id,
DECODE(customer_id,
'AAL', 'American Airlines',
'ILC', 'Intl. Leasing Corp.',
'NWO', 'Northwest Orient',
'SAL', 'Southwest Airlines',
'SWA', 'Sweptwing Airlines',
'USAF', 'United States Air Force',
'Not Known') AIRLINE,
delivered_date
FROM airplanes
WHERE ROWNUM <>

Rabu, 29 Juli 2009

seam-gen

beberapa tahapan seam-gen:
1.seam setup
2.seam new-project
3
.seam generate-entities
4.seam explode

Tutorial belajar Seam

http://www.thescreencast.com/2007/06/jboss-seam-generator-and-eclipse-ide.html

Senin, 13 Juli 2009

Running JBoss Application Server in Windows

-Please download JBoss AS from http://www.jboss.org/jbossas/downloads/

- Set JAVA_HOME and JBOSS_HOME
  • JBOSS_HOME = C:\jboss-5.1.0.GA
  • JAVA_HOME = E:\Program Files\Java\jdk1.6.0_10\
- Set PATH
%JAVA_HOME%\bin;%JBOSS_HOME%\bin;

-run from console/command
%JBOSS_HOME/bin/run
C:\>%JBOSS_HOME%/bin/run
Calling C:\jboss-5.1.0.GA\bin\run.conf.bat
===============================================================================

JBoss Bootstrap Environment

JBOSS_HOME: C:\jboss-5.1.0.GA

JAVA: E:\Program Files\Java\jdk1.6.0_10\\bin\java

JAVA_OPTS: -Dprogram.name=run.bat -Xms128M -Xmx512M -XX:MaxPermSize=256M -Dsun
.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dorg
.jboss.resolver.warning=true -server

CLASSPATH: C:\jboss-5.1.0.GA\bin\run.jar

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

- Testing server
type : localhost:8080 in web browser


Jumat, 03 Juli 2009

install maven2 di Windows

  1. Download Maven:

    Maven 2.0.9

    GeoTools Maven Version
    2.6.x maven-2.0.9
    2.5.x maven-2.0.9
    2.4.x
    2.3.x
    2.2.x maven-2.0.5-bin.zip
  2. Unzip the maven download to your computer: C:\java\maven-2.0.9
    • The use of maven-2.0.9 is now required
    • If you do not have an unzip program may we recommend: http://www.7-zip.org/
  3. You need to have the following environmental variables set for maven to work:
    JAVA_HOME C:\j2sdk1.4.2_07\ Location of your JDK installation
    M2_HOME C:\java\maven-2.0.9 Location of your maven installation
    PATH %JAVA_HOME%\bin;%M2_HOME%\bin Include java and maven bin directory in your PATH

    (You can change all of that with Control Panel > System > Advanced > Environmental Variables)

Did it Work?

Open up a cmd window and type the following:

C:\java>mvn --version

Jumat, 14 November 2008

Displaytag pakai decorator

< name="accgroups" defaultsort="1" defaultorder="descending" requesturi="#" class="datatbl rowObject" pagesize="20" export="true" decorator="my.ListAccountStructureDecorator">
< name="basic.empty.showtable" value="true">
< name="export.excel.filename" value="groupstructure.xls">
< name="export.csv.filename" value="groupstructure.csv">
< name="export.pdf" value="false">
< property="accountType" title="Account Type" sortable="true" headerclass="sortable">
< property="accountNumber" title="Account Number" sortable="true" headerclass="sortable">
< property="accountName" title="Company Name" sortable="true" headerclass="sortable">
< property="acronym" title="Acronym" sortable="true" headerclass="sortable">
< /display:table>

Decorator:
public class ListAccountStructureDecorator extends TableDecorator {

public String getAccountNumber() {

AccGroupStructureReport data = (AccGroupStructureReport)getCurrentRowObject();

return data.getAccount().getAccountNumber();
}

public String getAccountName() {

AccGroupStructureReport data = (AccGroupStructureReport)getCurrentRowObject();

return data.getAccount().getAccountName();

}

public String getAccountType() {

AccGroupStructureReport data = (AccGroupStructureReport)getCurrentRowObject();

return data.getAccType().toString();
}
}