snippetjournal

– notes, snippet codes, and my journal

Archive for May 2013

Netbeans Themes

leave a comment »

Netbeans Themes

Saya baru tau klo netbeans bisa juga di ganti ganti themes nya berdasarkan template orang lain, dan web nya pula yang menyediakan.

silahkan teman teman yang ingin mengganti themes atau pun mau upload themes yang di buat sendiri.

Untuk mengganti themes cukup klik tools – options, pilih fonts & colors. klik tombol import dan browse hasil zip yang sudah di download.

checklist semua component dari themes, restart netbeans dan tadaaaa.

themes baru 😀

Advertisements

Written by snippetjournal

May 31, 2013 at 3:38 am

Posted in Personal, Programming

Tagged with , ,

Remote Debugger – Attach Debuger Di Nebeans 7.x

leave a comment »

Masuk ke services dialog atau window konfigurasi dari tomcat, services dialog (ctrl + 5),  klik kanan pilih properties.

pada VM Options tambahkan debugger paramater :

-Xdebug -Xrunjdwp:transport=dt_socket,address=7951,server=y,suspend=n

nilai dari “address” adalah port dimana tomcat akan “listening”

run atau deploy project mu, jika sukses di output terminal akan terlihat :

Listening for transport dt_socket at address: 7951

agar bisa netbeans bisa terkoneksi pada debugger klik Debug – Attach Debugger. Isi port number sesuai pada paramater debugger sebelum nya.

Written by snippetjournal

May 29, 2013 at 9:23 am

ADD JAR OR LIBRARY TO NETBEANS MAVEN PROJECT.

leave a comment »

Yeah its really troublesome if u wanna add jars that are not supported maven in netbeans, the default dependencies in netbeans is to search in maven repo.

so if we want to add jar that not supported maven, we must install the jar to our maven local repo.

there is 2 way to add your jar to maven project in netbeans, first add it manually using maven command in console/cmd or the easier way, right click in your missing jar 🙂

Right click  in your missing jar in project explorer and browse your missing jar

 

netbeans - maven right click

 

netbeans- maven browse

 

Using maven command in your console/cmd

first we just using maven that already in netbeans installation package, the maven netbeans library is located in :

E:\Program Files\NetBeans 7.3\java\maven\bin

you can simply open command console in the maven path, or you can set up configure the maven in system variable, just add in the PATH variable in the system environment
note: split it between the path application using semicolon (;)

make sure that u have set up your java environment variable
JAVA_HOME add in system variable

JAVA_HOME = E:\Program Files\Java\jdk1.7.0_21\

open cmd, and install the jar file using maven,

mvn install:install-file -Dfile=F:\xx\xx\xx\jcprov-1.0.jar -DgroupId=safenet.jcprov -DartifactId=jcprov -Dversion=1.0 -Dpackaging=jar

note : notice that “-DgroupId”, “-DartifactId” and “-Dversion” value must exact the same as in pom.xml

command result :

C:\Users\xxx>mvn install:install-file -Dfile=F:\xx\xx\
xx\jcprov-1.0.jar -DgroupId=safenet.jcprov -DartifactId=jcprov -Dversion=1.0 -D
packaging=jar
[INFO] Scanning for projects…
[INFO]
[INFO] ————————————————————————
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ————————————————————————
[INFO]
[INFO] — maven-install-plugin:2.3.1:install-file (default-cli) @ standalone-po
m —
[INFO] Installing F:\xx\xx\xx\jcprov-1.0.jar to C:\xx\xx\.m2\repository\safenet\jcprov\jcprov\1.0\jcprov-1.0.jar
[INFO] Installing C:\xx\xx~1\AppData\Local\Temp\mvninstall987667663473993
863.pom to C:\xx\xx\.m2\repository\safenet\jcprov\jcprov\1.0
\jcprov-1.0.pom
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 2.393s
[INFO] Finished at: Mon May 27 10:48:02 ICT 2013
[INFO] Final Memory: 6M/112M
[INFO] ————————————————————————

yeay the jar successfully installed :D, and for the final step u can add the dependency in the pom.xml in netbeans project.

<dependency>
<groupId>safenet.jcprov</groupId>
<artifactId>jcprov</artifactId>
<version>1.0</version>
</dependency>

netbeans will auto refresh the project and it will no red error anymore…

references :

http://www.mkyong.com/maven/how-to-include-library-manully-into-maven-local-repository/

Written by snippetjournal

May 27, 2013 at 4:09 am

Override dan Overloading

leave a comment »

Overloading/Overwriting :

Overloading/Overwriting adalah ketika dalam suatu class yang sama mempunyai beberapa method dengan nama yang sama tetapi dengan parameter yang berbeda.

contoh paling sederhana adalah ketika kita mempunyai method a(String param1, String param2), kemudian ketika kita membuat method dengan nama yang sama dengan jumlah dan type parameter yang berbeda, misal a(int param1, String param2)

Override :

Override adalah ketika suatu class child yang turunan dari class parent. mempunyai beberapa method dengan nama yang sama dengan yang di punya si parent . tetapi dengan implementasi yang berbeda.

Contoh paling sederhana adalah ketika kita mempunyai class interface kemudian kita implements pada class kita, maka class kita wajib mengimplementasikan method method yang sebelum nya telah kita definisikan pada class interface tersebut

berikut contoh code agar bisa lebih jelas di pahami :

class parent


package ASN.Coders;

public class Parent {

public String getOverride(){
return "from class parent";
}

public String getOverride(String string){
return string;
}

}

class child


package ASN.Coders;

public class Child extends Parent{

public String getOverloadClass(){
return "overload method";
}

//overload method
public String getOverloadClass(String string){
return string;
}

@Override
public String getOverride() {
System.out.println("override : diffrent implementation");
return super.getOverride();
}

//this will cause compilation error
@Override
public String getOverride(String string, int i) {
System.out.println(i);
return super.getOverride(string);
}

//this will cause compilation error
@Override
public int getOverride(String string, int i) {
super.getOverride(string);

return i;
}

public static void main(String[] args) {
Child child = new Child();
child.getOverride();

}
}

Written by snippetjournal

May 11, 2013 at 3:36 am

Programmer Life Represented in Gif Picture :D

leave a comment »

Programmer Life Represented in Gif Picture 😀

This is hilarious, as programmer u really need to see this, its very funny, the gif really represented the real situations 😀

Written by snippetjournal

May 10, 2013 at 2:08 am