bila repo belum di update

Februari 4, 2009 at 10:13 am (java, linux ubuntu, tips)

contoh untuk hapus yg lama dan update ke yg baru :

rm -fr ~/.m2/repository/com/sun/xml

rm -fr ~/.m2/repository/com/sun/tools

untuk menghapus bagian xml dan tools

bila tidak di update maka ketika build ada tampilan mirip2 :

[INFO] Scanning for projects…
[INFO] ————————————————————————
[INFO] Building EasywebAdmin-Engine
[INFO]    task-segment: [package]
[INFO] ————————————————————————
Downloading: http://mvn03.src.dev.imocha.com.my/nexus/content/groups/public/com/sun/xml/bind/jaxb-impl/2.0-SNAPSHOT/jaxb-impl-2.0-SNAPSHOT.pom
Downloading: http://mvn03.src.dev.imocha.com.my/nexus/content/groups/public/com.sun.xml.bind/poms/jaxb-impl-2.0-SNAPSHOT.pom
Downloading: http://mvn03.src.dev.imocha.com.my/nexus/content/groups/public/com/sun/xml/bind/jaxb-impl/2.0-SNAPSHOT/jaxb-impl-2.0-SNAPSHOT.pom
Downloading: http://mvn03.src.dev.imocha.com.my/nexus/content/groups/public/com/sun/xml/bind/jaxb-xjc/2.0-SNAPSHOT/jaxb-xjc-2.0-SNAPSHOT.pom
Downloading: http://mvn03.src.dev.imocha.com.my/nexus/content/groups/public/com.sun.xml.bind/poms/jaxb-xjc-2.0-SNAPSHOT.pom
Downloading: http://mvn03.src.dev.imocha.com.my/nexus/content/groups/public/com/sun/xml/bind/jaxb-xjc/2.0-SNAPSHOT/jaxb-xjc-2.0-SNAPSHOT.pom
Downloading: http://mvn03.src.dev.imocha.com.my/nexus/content/groups/public/com/sun/xml/bind/jaxb-impl/2.0-SNAPSHOT/jaxb-impl-2.0-SNAPSHOT.jar
Downloading: http://mvn03.src.dev.imocha.com.my/nexus/content/groups/public/com.sun.xml.bind/jars/jaxb-impl-2.0-SNAPSHOT.jar
Downloading: http://mvn03.src.dev.imocha.com.my/nexus/content/groups/public/com/sun/xml/bind/jaxb-impl/2.0-SNAPSHOT/jaxb-impl-2.0-SNAPSHOT.jar
Downloading: http://mvn03.src.dev.imocha.com.my/nexus/content/groups/public/com/sun/xml/bind/jaxb-xjc/2.0-SNAPSHOT/jaxb-xjc-2.0-SNAPSHOT.jar
Downloading: http://mvn03.src.dev.imocha.com.my/nexus/content/groups/public/com.sun.xml.bind/jars/jaxb-xjc-2.0-SNAPSHOT.jar
Downloading: http://mvn03.src.dev.imocha.com.my/nexus/content/groups/public/com/sun/xml/bind/jaxb-xjc/2.0-SNAPSHOT/jaxb-xjc-2.0-SNAPSHOT.jar
[INFO] ————————————————————————
[ERROR] BUILD ERROR
[INFO] ————————————————————————
[INFO] Failed to resolve artifact.

Missing:
———-
1) com.sun.xml.bind:jaxb-impl:jar:2.0-SNAPSHOT

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=com.sun.xml.bind -DartifactId=jaxb-impl -Dversion=2.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.sun.xml.bind -DartifactId=jaxb-impl -Dversion=2.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) com.sun.tools.xjc.maven2:maven-jaxb-plugin:maven-plugin:1.0
2) com.sun.xml.bind:jaxb-impl:jar:2.0-SNAPSHOT

2) com.sun.xml.bind:jaxb-xjc:jar:2.0-SNAPSHOT

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=com.sun.xml.bind -DartifactId=jaxb-xjc -Dversion=2.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.sun.xml.bind -DartifactId=jaxb-xjc -Dversion=2.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) com.sun.tools.xjc.maven2:maven-jaxb-plugin:maven-plugin:1.0
2) com.sun.xml.bind:jaxb-xjc:jar:2.0-SNAPSHOT

———-
2 required artifacts are missing.

for artifact:
com.sun.tools.xjc.maven2:maven-jaxb-plugin:maven-plugin:1.0

from the specified remote repositories:
nexus (http://mvn03.src.dev.imocha.com.my/nexus/content/groups/public)

[INFO] ————————————————————————
[INFO] For more information, run Maven with the -e switch
[INFO] ————————————————————————
[INFO] Total time: 15 seconds
[INFO] Finished at: Wed Feb 04 16:13:59 WIT 2009
[INFO] Final Memory: 8M/98M
[INFO] ————————————————————————

Permalink Tinggalkan sebuah Komentar

awal php install server xampp versi linux

Januari 20, 2009 at 5:15 am (Uncategorized)

su ## login sebagai super user (root)

tar xvfz xampp-linux-1.6.tar.gz -C /opt ## ekstrak lampp ke folder /opt

/opt/lampp/lampp start ## untuk menjalankan lampp

/opt/lampp/lampp php4 ## menjalankan lampp memakai php v4

/opt/lampp/lampp php5 ## menjalankan lampp memakai php v5 /opt/lampp/lampp phpstatus ## melihat status versi php

/opt/lampp/lampp stop ## menghentikan lampp

/opt/lampp/lampp restart ## me-restart (stop-start) lampp

rm -rf /opt/lampp ## meng-uninstall lampp

cp /opt/lampp/lampp /etc/init.d/lampp

# ln -s /etc/init.d/lampp /etc/rc2.d/S86lampp

# ln -s /etc/init.d/lampp /etc/rc3.d/S86lampp

Permalink Tinggalkan sebuah Komentar

pasang log4j

Januari 14, 2009 at 8:02 am (Uncategorized) (, , , , , )

import org.apache.log4j.Logger;

public class aha {
private static final Logger log = Logger.getLogger(aha.class);
private String coba=”percobaan log4j”;
log.info(“LOGNYA:”+coba);
}

untuk keterangan tempat log.. lihat di log4j.properties

Permalink Tinggalkan sebuah Komentar

Converter variable Java

Januari 14, 2009 at 8:01 am (Uncategorized) (, , , , , )

Java – comparing strings

Use == for primitive data types like int

If (mystring == null)

Use the equals() method to compare objects

Use .equals for strings : if (a.equals(“cat”))

Java – Converting int to string

String myString = Integer.toString(my int value)

or

String str = “” + i

Java – Converting String to int

int i = Integer.parseInt(str);

or

int i = Integer.valueOf(str).intValue();

double to String :

String str = Double.toString(i);

long to String :

String str = Long.toString(l);

float to String :

String str = Float.toString(f);

String to double :

double d = Double.valueOf(str).doubleValue();

String to long :

long l = Long.valueOf(str).longValue();

or

long l = Long.parseLong(str);

String to float :

float f = Float.valueOf(str).floatValue();

decimal to binary :

int i = 42;

String binstr = Integer.toBinaryString(i);

decimal to hexadecimal :

int i = 42;

String hexstr = Integer.toString(i, 16);

or

String hexstr = Integer.toHexString(i);

or (with leading zeroes and uppercase)

public class Hex {

public static void main(String args[]){

int i = 42;

System.out.print

(Integer.toHexString( 0×10000 | i).substring(1).toUpperCase());

}

}

hexadecimal (String) to integer :

int i = Integer.valueOf(“B8DA3″, 16).intValue();

or

int i = Integer.parseInt(“B8DA3″, 16);

ASCII code to String

int i = 64;

String aChar = new Character((char)i).toString();

integer to ASCII code (byte)

char c = ‘A’;

int i = (int) c; // i will have the value 65 decimal

integer to boolean

b = (i != 0);

boolean to integer

i = (b)?1:0;

Permalink Tinggalkan sebuah Komentar

ajax laksana VB

November 4, 2008 at 4:40 am (Uncategorized)

http://www.zkoss.org/download/

Permalink Tinggalkan sebuah Komentar

belajar validasi sederhana

November 3, 2008 at 9:30 am (java)

Name : String with a maximum length of 50 characters
Age : Integer between 1 and 120
Email : A valid email address

The sample screen is given below.

sample-validation-screen1.jpg

First we need an action class to display the new customer form.

CustomerNewAction.java – Action class to dispatch to customer data capture form

  1. package validation.action;
  2. import com.opensymphony.xwork2.ActionSupport;
  3. public class CustomerNewAction extends ActionSupport {
  4. public String execute(){
  5. return SUCCESS;
  6. }
  7. }

package validation.action; import com.opensymphony.xwork2.ActionSupport; public class CustomerNewAction extends ActionSupport { public String execute(){ return SUCCESS; } }

customer_new.jsp – Form to capture customer data

  1. <%@ taglib prefix=“s” uri=“/struts-tags” %>
  2. <html>
  3. <head>
  4. <s:head/>
  5. </head>
  6. <body>
  7. <s:form action=“CustomerSaveAction”>
  8. <h2>Enter Customer Details</h2>
  9. <s:textfield label=“Name” name=“name”></s:textfield>
  10. <s:textfield label=“Age” name=“age”></s:textfield>
  11. <s:textfield label=“Email” name=“email”></s:textfield>
  12. <s:submit label=“Save” name=“Save”></s:submit>
  13. </s:form>
  14. </body>
  15. </html>

<%@ taglib prefix=”s” uri=”/struts-tags” %> <html> <head> <s:head/> </head> <body> <s:form action=”CustomerSaveAction”> <h2>Enter Customer Details</h2> <s:textfield label=”Name” name=”name”></s:textfield> <s:textfield label=”Age” name=”age”></s:textfield> <s:textfield label=”Email” name=”email”></s:textfield> <s:submit label=”Save” name=”Save”></s:submit> </s:form> </body> </html>

One important thing to note here is the use of s:head tag. This injects the required stylesheets for error display after validation. The default theme used here is xhtml.

As you can see the input form is submitted to CustomerSaveAction. This will save the data and will dispatch to a page customer_save_success.jsp.

CustomerSaveAction.java – This is responsible for saving customer data. In this example, actual save is not implemented.

  1. package validation.action;
  2. import com.opensymphony.xwork2.ActionSupport;
  3. public class CustomerSaveAction extends ActionSupport {
  4. private String name;
  5. private int age;
  6. private String email;
  7. public String getName() {
  8. return name;
  9. }
  10. public void setName(String name) {
  11. this.name = name;
  12. }
  13. public int getAge() {
  14. return age;
  15. }
  16. public void setAge(int age) {
  17. this.age = age;
  18. }
  19. public String getEmail() {
  20. return email;
  21. }
  22. public void setEmail(String email) {
  23. this.email = email;
  24. }
  25. public String execute(){
  26. return SUCCESS;
  27. }
  28. }

package validation.action; import com.opensymphony.xwork2.ActionSupport; public class CustomerSaveAction extends ActionSupport { private String name; private int age; private String email; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String execute(){ return SUCCESS; } }

customer_save_success.jsp

  1. <%@ taglib prefix=“s” uri=“/struts-tags” %>
  2. <html>
  3. <head>
  4. </head>
  5. <body>
  6. <h2>Customer information saved successfully</h2>
  7. </body>
  8. </html>

<%@ taglib prefix=”s” uri=”/struts-tags” %> <html> <head> </head> <body> <h2>Customer information saved successfully</h2> </body> </html>

Now we need to apply the declarative validation to CustomerSaveAction. To do that create a file CustomerSaveAction-validation.xml in the same folder which contains CustomerSaveAction.java. In Struts2, validation rules for an action class X is saved in a file X-validation.xml.

CustomerSaveAction-validation.xml

  1. <!DOCTYPE validators PUBLIC ”-//OpenSymphony Group//XWork Validator 1.0.2//EN”
  2. “http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd”>
  3. <validators>
  4. <field name=“name”>
  5. <field-validator type=“requiredstring”>
  6. <message>You must enter a value for Name</message>
  7. </field-validator>
  8. <field-validator type=“stringlength”>
  9. <param name=“maxLength”>50</param>
  10. <message>
  11. Name cannot contain more than 50 characters
  12. </message>
  13. </field-validator>
  14. </field>
  15. <field name=“age”>
  16. <field-validator type=“int”>
  17. <param name=“min”>1</param>
  18. <param name=“max”>120</param>
  19. <message>Age must between 1 and 120</message>
  20. </field-validator>
  21. </field>
  22. <field name=“email”>
  23. <field-validator type=“email”>
  24. <message>Please enter a valid email address</message>
  25. </field-validator>
  26. </field>
  27. </validators>

<!DOCTYPE validators PUBLIC “-//OpenSymphony Group//XWork Validator 1.0.2//EN” “http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd”> <validators> <field name=”name”> <field-validator type=”requiredstring”> <message>You must enter a value for Name</message> </field-validator> <field-validator type=”stringlength”> <param name=”maxLength”>50</param> <message> Name cannot contain more than 50 characters </message> </field-validator> </field> <field name=”age”> <field-validator type=”int”> <param name=”min”>1</param> <param name=”max”>120</param> <message>Age must between 1 and 120</message> </field-validator> </field> <field name=”email”> <field-validator type=”email”> <message>Please enter a valid email address</message> </field-validator> </field> </validators>

For more details on each of the validators and their parameters, please see here.

Let us connect everything together using struts.xml. Note the extra result tag (input) for CustomerSaveAction. It indicates the page to be displayed in case of input error.

struts.xml

  1. <?xml version=“1.0″ encoding=“UTF-8″ ?>
  2. <!DOCTYPE struts PUBLIC
  3. “-//Apache Software Foundation//DTD Struts Configuration 2.0//EN”
  4. “http://struts.apache.org/dtds/struts-2.0.dtd”>
  5. <struts>
  6. <package name=“validation” extends=“struts-default”>
  7. <action name=“CustomerNewAction”
  8. class=“validation.action.CustomerNewAction”>
  9. <result>/validation/customer_new.jsp</result>
  10. </action>
  11. <action name=“CustomerSaveAction”
  12. class=“validation.action.CustomerSaveAction”>
  13. <result name=“input”>/validation/customer_new.jsp</result>
  14. <result>/validation/customer_save_success.jsp</result>
  15. </action>
  16. </package>
  17. </struts>

<?xml version=”1.0″ encoding=”UTF-8″ ?> <!DOCTYPE struts PUBLIC “-//Apache Software Foundation//DTD Struts Configuration 2.0//EN” “http://struts.apache.org/dtds/struts-2.0.dtd”> <struts> <package name=”validation” extends=”struts-default”> <action name=”CustomerNewAction” class=”validation.action.CustomerNewAction”> <result>/validation/customer_new.jsp</result> </action> <action name=”CustomerSaveAction” class=”validation.action.CustomerSaveAction”> <result name=”input”>/validation/customer_new.jsp</result> <result>/validation/customer_save_success.jsp</result> </action> </package> </struts>

web.xml

  1. <?xml version=“1.0″ encoding=“UTF-8″?>
  2. <web-app xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
  3. xmlns=“http://java.sun.com/xml/ns/javaee”
  4. xmlns:web=“http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”
  5. xsi:schemaLocation=“http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”
  6. id=“WebApp_ID” version=“2.5″>
  7. <display-name>struts2</display-name>
  8. <filter>
  9. <filter-name>struts2</filter-name>
  10. <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
  11. </filter>
  12. <filter-mapping>
  13. <filter-name>struts2</filter-name>
  14. <url-pattern>/*</url-pattern>
  15. </filter-mapping>
  16. </web-app>

<?xml version=”1.0″ encoding=”UTF-8″?> <web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://java.sun.com/xml/ns/javaee” xmlns:web=”http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd” id=”WebApp_ID” version=”2.5″> <display-name>struts2</display-name> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>

To invoke this sample, access the URL http://localhost:8080/struts2/CustomerNewAction.action. This is how the screen appears after validation,

sample-validation-screen2.jpg

Permalink 1 Komentar

english – indonesia – english

Oktober 30, 2008 at 4:57 am (tips)

http://www.speedytown.com/kimyong/translator.html

Permalink Tinggalkan sebuah Komentar

update plugin eclipse … reminder

Oktober 28, 2008 at 2:45 am (java, tips)

subversion
http://download.eclipse.org/technology/subversive/0.7/update-site/
Subversive Integrations
http://www.polarion.org/projects/subversive/download/integrations/update-site/
Subversive SVN Connectors
http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/
maven
http://m2eclipse.sonatype.org/update-dev/

Permalink Tinggalkan sebuah Komentar

lari-lari kecil

Oktober 14, 2008 at 7:48 am (java)

mvn jetty:run

localhost:8080/nama_project

Permalink Tinggalkan sebuah Komentar

badan sehat , tubuh pun Quartz

Oktober 9, 2008 at 9:15 am (java)

// samain nilai ctime = jam kamu

long ctime = System.currentTimeMillis();

SchedulerFactory schedulerFactory = new StdSchedulerFactory();
Scheduler scheduler = schedulerFactory.getScheduler();

// job detail itu buat nentuin action apa yg bakal di kerjain , klo di sini sih yg mau jalanin simpleQuartz.class
JobDetail jobDetail = new JobDetail(“detailKeteranganHonda”, “detailKeteranganGroup”, simpleQuartz.class);

// trigger ibarat bom alarm ,isinya cuma setting waktu kapan meledak dan mau berapa kali meledak
SimpleTrigger simpleTrigger = new SimpleTrigger(“HondaTrigger”, “NamaGroup”);

// si trigger bakal langsung mulai soalnya starttimenya sekarang juga, jalannya tiap 1 detik dan ngulang selama 4 kali (jadi total jalannya 5 kali )

simpleTrigger.setStartTime(new Date(ctime));
simpleTrigger.setRepeatInterval(1000);//berjalan tiap 1 seconds
simpleTrigger.setRepeatCount(4);// berjalan 5 kali

// yang paling penting dan utama sebenarnya cuma 2 baris dibawah ini

scheduler.scheduleJob(jobDetail, simpleTrigger);
scheduler.start();

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

cronTtrigger di pakai untuk parameter waktu yang lebih detail dari simpletrigger ,

contohnya seperti berikut :

CronTrigger ct = new CronTrigger(“QuartzCronTrigger”,”QuartzCtGrup”);
ct.setName(“QuartzCronTrigger”);
ct.setGroup(“QuartzCtGrup”);
ct.setCronExpression(“0/2 17 * * * ?”);// jalan tiap 2 detik selama menit ke 17  tiap jam tiap hari
scheduler.scheduleJob(jobDetail, ct);

Contoh2 parameter waktu untuk CronExpression ada di :

Expression Meaning
"0 0 12 * * ?" Fire at 12pm (noon) every day
"0 15 10 ? * *" Fire at 10:15am every day
"0 15 10 * * ?" Fire at 10:15am every day
"0 15 10 * * ? *" Fire at 10:15am every day
"0 15 10 * * ? 2005" Fire at 10:15am every day during the year 2005
"0 * 14 * * ?" Fire every minute starting at 2pm and ending at 2:59pm, every day
"0 0/5 14 * * ?" Fire every 5 minutes starting at 2pm and ending at 2:55pm, every day
"0 0/5 14,18 * * ?" Fire every 5 minutes starting at 2pm and ending at 2:55pm, AND fire every 5 minutes starting at 6pm and ending at 6:55pm, every day
"0 0-5 14 * * ?" Fire every minute starting at 2pm and ending at 2:05pm, every day
"0 10,44 14 ? 3 WED" Fire at 2:10pm and at 2:44pm every Wednesday in the month of March.
"0 15 10 ? * MON-FRI" Fire at 10:15am every Monday, Tuesday, Wednesday, Thursday and Friday
"0 15 10 15 * ?" Fire at 10:15am on the 15th day of every month
"0 15 10 L * ?" Fire at 10:15am on the last day of every month
"0 15 10 ? * 6L" Fire at 10:15am on the last Friday of every month
"0 15 10 ? * 6L" Fire at 10:15am on the last Friday of every month
"0 15 10 ? * 6L 2002-2005" Fire at 10:15am on every last friday of every month during the years 2002, 2003, 2004 and 2005
"0 15 10 ? * 6#3" Fire at 10:15am on the third Friday of every month

Permalink Tinggalkan sebuah Komentar

Next page »