Jumat, 25 November 2011
Export / Import Database DB2
1) Launch the Control Center from the Windows start menu.
2) Locate your database in the Control Center, right click on it and select Backup from the context menu. This will launch the backup Wizard:
a) Step 1: Click on Next.
b) Step 2: Click on the Add button.
i) In the System name field, select local system
ii) Browse to a location where you want to save the data and click on the OK button
c) Click Finish
3) Do not change the filename of the backup data because it will be resused later when you restore it on your remote environment
Import to DB2 :
1) Transfer the backed up content from your local environment to your remote environment.
2) Launch the DB2 Control Center.
3) Create an empty database with the same name as the one your are about restore.
4) Right click on the newly created empty database and select Restore from the context menu.
5) When the restore wizard pops-up,
a) First click on Next.
b) Click on the add button:
i) In the System name field, select local system
ii) Browse to a location where your backup content is located and click on the OK button
iii) The specific date and time must be defined accurately and can be derived from the backup content's file name. For example, my backup file is calledSAMPLE.0.DB2.NODE0000.CATN0000.20110601102445.001. So the date and time can be derived from the text marked out in red. The date is 2011/June/01 and the time is at 10:24 AM at 45 seconds.
iv) Click finish when done.
Selasa, 15 November 2011
Building Liferay on Tomcat
Introduction:
WebSynergy or Sun GlassFish Web Space Server is built on top of Liferay. The first release of WebSynergy will be built on Liferay 5.2.0. This page describes how you can checkout the source and build the core from open soruce.
Step 1: Install Apache Tomcat
- Download Apache Tomcat (6.0.18
) - Unzip tomcat 6.0.18
- cd apache-tomcat-6.0.18/bin
- chmod +x *.sh
- Create setenv.sh
- JAVA_OPTS="-Xms128m -Xmx1024m -XX:MaxPermSize=512m"
- Start tomcat
- apache-tomcat-6.0.18/bin/catalina.sh start
- Verify http://localhost:8080/

- Stop tomcat
- apache-tomcat-6.0.18/bin/catalina.sh stop
Step 2: Checkout Liferay source
- Checkout either trunk or a release branch
Step 3: Prepare build environment
Create app.server.
app.server.parent.dir=app.server.tomcat.version=6.0 app.server.tomcat.dir=${app.server.parent.dir}/apache-tomcat-6.0.18 app.server.tomcat.classes.global.dir=${app.server.tomcat.dir}/lib app.server.tomcat.lib.endorsed.dir=${app.server.tomcat.dir}/lib/ext app.server.tomcat.lib.global.dir=${app.server.tomcat.dir}/lib/ext app.server.tomcat.lib.support.dir=${app.server.tomcat.dir}/lib/ext app.server.tomcat.support.dir=${app.server.tomcat.dir}/lib/ext
| Hint You can customize the build environment further by overriding more properties from app.server.properties |
Step 4: Build
- cd trunk (or 5.2.x)
- ant start
- ant deploy
Step 5: Test
- Start tomcat
- Access http://localhost:8080/web/guest/home

Step 6: Customize
- Stop Tomcat
- To use sample data, copy lportal.script
- cp trunk/sql/lportal.script apache-tomcat-6.0.18/bin
- Create apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/classes/portal-ext.properties
- schema.run.minimal=false
- Start Tomcat
| Tip Always cd to the bin directory and then start Tomcat so the lportal.script is used by HSQL, otherewise it will create a fresh one which will not have any sample data. |
If you do not want the url to be opened automatically in the browser, set this in portal-ext,
browser.launcher.url=
If you have MySQL up and running, then create a database "lportal" and add following lines to portal-ext
jdbc.default.driverClassName=com.mysql.jdbc.Driver jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false jdbc.default.username=root jdbc.default.password=
There are tons of properties that can be overridden in portal-ext. Look at trunk/portal-impl/src/portal.properties for what you can override.
source : http://wikis.sun.com/display/websynergy/Building+Liferay+on+Tomcat
Ant View and go to Run As > External Tools Configuration > Environment and add a new Variable:
Name: ANT_OPTS
Value: -Xmx1024m -XX:MaxPermSize=256m
Since Eclipse is invoking Ant it needs the variable.
Rabu, 03 Agustus 2011
Hibernate dialect
DB2 - org.hibernate.dialect.DB2Dialect
HypersonicSQL - org.hibernate.dialect.HSQLDialect
Informix - org.hibernate.dialect.InformixDialect
Ingres - org.hibernate.dialect.IngresDialect
Interbase - org.hibernate.dialect.InterbaseDialect
Pointbase - org.hibernate.dialect.PointbaseDialect
PostgreSQL - org.hibernate.dialect.PostgreSQLDialect
Mckoi SQL - org.hibernate.dialect.MckoiDialect
Microsoft SQL Server - org.hibernate.dialect.SQLServerDialect
MySQL - org.hibernate.dialect.MySQLDialect
Oracle (any version) - org.hibernate.dialect.OracleDialect
Oracle 9 - org.hibernate.dialect.Oracle9Dialect
Progress - org.hibernate.dialect.ProgressDialect
FrontBase - org.hibernate.dialect.FrontbaseDialect
SAP DB - org.hibernate.dialect.SAPDBDialect
Sybase - org.hibernate.dialect.SybaseDialect
Sybase Anywhere - org.hibernate.dialect.SybaseAnywhereDialect
Rabu, 30 Maret 2011
Store Procedure Crystal Report
/* temporary table */ CREATE GLOBAL TEMPORARY TABLE "TMP_AREA_TABLE" ( "LOCGRP_CODE" VARCHAR2(6 BYTE), "LOCGRP_NAME" VARCHAR2(30 BYTE), "LOC_CODE" VARCHAR2(6 BYTE), "LOC_NAME" VARCHAR2(30 BYTE), "DEPO" VARCHAR2(1 BYTE) ) ON COMMIT PRESERVE ROWS ;
/* report package */create or replace PACKAGE Report_PackageAS TYPE Report_Type IS REF CURSOR;TYPE Report_Type2 IS REF CURSOR RETURN TMP_AREA_TABLE%ROWTYPE;END Report_Package;
/* Store Procedure Report */create or replace PROCEDURE P_RPT_AREAL1_TMP (Report_Cursor IN OUT Report_Package.Report_Type2, pUserType VARCHAR2, pLocCode VARCHAR2, pLocGrpCode VARCHAR2) AS TEMP_ROW TMP_AREA_TABLE%ROWTYPE;
CURSOR AREA_CURSOR IS SELECT LcGrps.LOCGRP_CODE, LcGrps.LOCGRP_NAME, Locs.LOC_CODE, Locs.LOC_NAME, Locs.DEPO FROM LOCATIONS Locs INNER JOIN LOCATION_GROUPS LcGrps ON Locs.LOCGRP_CODE=LcGrps.LOCGRP_CODE; BEGIN set_vpd_context.set_akses_user(pUserType, pLocCode, pLocGrpCode); delete from TMP_AREA_TABLE; OPEN AREA_CURSOR(); LOOP FETCH AREA_CURSOR INTO TEMP_ROW; EXIT WHEN AREA_CURSOR%NOTFOUND; INSERT INTO TMP_AREA_TABLE(LOCGRP_CODE, LOCGRP_NAME, LOC_CODE, LOC_NAME, DEPO) VALUES(TEMP_ROW.LOCGRP_CODE, TEMP_ROW.LOCGRP_NAME, TEMP_ROW.LOC_CODE, TEMP_ROW.LOC_NAME, TEMP_ROW.DEPO); END LOOP; OPEN Report_Cursor FOR SELECT LOCGRP_CODE, LOCGRP_NAME, LOC_CODE, LOC_NAME, DEPO FROM TMP_AREA_TABLE;
END;
Kamis, 26 November 2009
Using a New Thread for Network Activity
dan keisengan itupun berlanjut saat coding J2ME..
nemu error ky gini
Warning: To avoid potential deadlock, operations that may block, such as
networking, should be performed in a different thread than the
commandAction() handler.
Saking paniknya, nih error sampe ta masukin field search nya google...
Dan akhirnya... taaarrrraaaa....
menemukan kasus yg sama d forum ny SUN
satu demi satu thread dibaca dan dikasih link kesini
http://developers.sun.com/mobility/midp/articles/threading/
dibaca satu persatu... dan nemu tulisan ini
Using a New Thread for Network Activity
public void commandAction(Command c, Displayable s) {
if (c == mExitCommand)
notifyDestroyed();
else if (c == mConnectCommand) {
Thread t = new Thread() {
public void run() {
connect();
}
};
t.start();
}
}
pusing dah, ga tau maksud nya apaan
yang penting copas copas dan copas
dan di Run... yes berhasil...
Om Google menyelamatkan saya lagi
dan malam ini saya bisa tidur nyenyak....
nite all
Rabu, 25 November 2009
JavaScript for Number Validation
ketika harus mem-validasi inputan yg harusnya berupa nomor
dari String diubah ke Long ??? pake spring validasi lagi...
fuih... ga ngerti lah...
maka digunakan cara hardcode seperti ini
function CalcKeyCode(aChar) {
var character = aChar.substring(0,1);
var code = aChar.charCodeAt(0);
return code;
}
function checkNumber(val) {
var strPass = val.value;
var strLength = strPass.length;
var lchar = val.value.charAt((strLength) - 1);
var cCode = CalcKeyCode(lchar);
/* Check if the keyed in character is a number
do you want alphabetic UPPERCASE only ?
or lower case only just check their respective
codes and replace the 48 and 57 */
if (cCode <> 57 ) {
var myNumber = val.value.substring(0, (strLength) - 1);
val.value = myNumber;
}
return false;
}
Nah, cara manggil d field nya tinggal ditulis
onkeyup="checkNumber(namaForm.namaField);"Ga tau kenapa cara ini gampang d tembus...
ketika tombol dipencet dan ditahan,
maka inputan bukan number dapat masuk
sehingga di field itu juga aku tambahin
onkeydown="checkNumber(namaForm.namaField);"Awalnya kupikir selesai...
karena setiap inputan yg bukan nomor pada keyboard bakal ditolak.
Teman2ku mencari celah agar inputan bukan nomor masuk kedalam field ini
hahaha, mereka menemukan dengan cara copas dr mouse
sialan... grrrr....
masa harus di tambahin lagi "on mouse bla bla bla.."
ribet man !!
Cara ini ga efektif bgt, jangan dipraktekin boleh,
tp bakal banyak celah untuk menembus kesana....
NB : pusing juga jadi programmer... wkwkwk
Jumat, 20 Maret 2009
Spring - bagian 1
Spring Servlet Declaration
Declare Spring DispatcherServlet dan map "*.html" URL, dalam WEB-INF/web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>
jsp/index.jsp
</welcome-file>
</welcome-file-list>
</web-app>
Spring Servlet Configuration
membuat Spring configuration file pada WEB-INF/springmvc-servlet.xml (nama berdasarkan nama servlet di atas):
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean name="/hello_world.html" class="springmvc.web.HelloWorldController"/>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>
Map URL /hello_world.html ke Controller HelloWorldController
Controller
buat controller HelloWorldController.java
package springmvc.web;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
public class HelloWorldController implements Controller {
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String aMessage = "Hello World MVC!";
ModelAndView modelAndView = new ModelAndView("hello_world");
modelAndView.addObject("message", aMessage);
return modelAndView;
}
}
Controller ini memanggil tampilan 'hello_world', melalui 'message' (seperti Struts attribute)
View
buat jsp/hello_world.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<body>
<p>This is my message: ${message}</p>
</body>
</html>Menampilkan message attribute yang telah di-set dalam Controller.
diambil dan di terjemahkan dari :
http://maestric.com/en/doc/java/spring/hello_world